diff --git a/cmake/taosadapter_CMakeLists.txt.in b/cmake/taosadapter_CMakeLists.txt.in
index 13b247770e..8df50af03c 100644
--- a/cmake/taosadapter_CMakeLists.txt.in
+++ b/cmake/taosadapter_CMakeLists.txt.in
@@ -2,7 +2,7 @@
# taosadapter
ExternalProject_Add(taosadapter
GIT_REPOSITORY https://github.com/taosdata/taosadapter.git
- GIT_TAG 213f8b3
+ GIT_TAG db6c843
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter"
BINARY_DIR ""
#BUILD_IN_SOURCE TRUE
diff --git a/cmake/taostools_CMakeLists.txt.in b/cmake/taostools_CMakeLists.txt.in
index 13a81f88ea..37dd448b87 100644
--- a/cmake/taostools_CMakeLists.txt.in
+++ b/cmake/taostools_CMakeLists.txt.in
@@ -2,7 +2,7 @@
# taos-tools
ExternalProject_Add(taos-tools
GIT_REPOSITORY https://github.com/taosdata/taos-tools.git
- GIT_TAG 0cd564a
+ GIT_TAG 6a2d9fc
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools"
BINARY_DIR ""
#BUILD_IN_SOURCE TRUE
diff --git a/docs/en/01-index.md b/docs/en/01-index.md
index 13552ea9dc..296cd96898 100644
--- a/docs/en/01-index.md
+++ b/docs/en/01-index.md
@@ -1,6 +1,7 @@
---
title: TDengine Documentation
sidebar_label: Documentation Home
+description: This website contains the user manuals for TDengine, an open-source, cloud-native time-series database optimized for IoT, Connected Cars, and Industrial IoT.
slug: /
---
diff --git a/docs/en/02-intro/index.md b/docs/en/02-intro/index.md
index a60bfab2cc..95dd4324f1 100644
--- a/docs/en/02-intro/index.md
+++ b/docs/en/02-intro/index.md
@@ -1,5 +1,6 @@
---
title: Introduction
+description: This document introduces the major features, competitive advantages, typical use cases, and benchmarks of TDengine.
toc_max_heading_level: 2
---
diff --git a/docs/en/04-concept/index.md b/docs/en/04-concept/index.md
index 0b1b226c17..771a061c31 100644
--- a/docs/en/04-concept/index.md
+++ b/docs/en/04-concept/index.md
@@ -1,5 +1,6 @@
---
title: Concepts
+description: This document describes the basic concepts of TDengine, including the supertable.
---
In order to explain the basic concepts and provide some sample code, the TDengine documentation smart meters as a typical time series use case. We assume the following: 1. Each smart meter collects three metrics i.e. current, voltage, and phase; 2. There are multiple smart meters; 3. Each meter has static attributes like location and group ID. Based on this, collected data will look similar to the following table:
diff --git a/docs/en/05-get-started/01-docker.md b/docs/en/05-get-started/01-docker.md
index ac273daba4..42e6861674 100644
--- a/docs/en/05-get-started/01-docker.md
+++ b/docs/en/05-get-started/01-docker.md
@@ -1,6 +1,7 @@
---
-sidebar_label: Docker
title: Quick Install on Docker
+sidebar_label: Docker
+description: This document describes how to install TDengine in a Docker container and perform queries and inserts.
---
This document describes how to install TDengine in a Docker container and perform queries and inserts.
diff --git a/docs/en/05-get-started/03-package.md b/docs/en/05-get-started/03-package.md
index 54d2e046c2..a0c1d93983 100644
--- a/docs/en/05-get-started/03-package.md
+++ b/docs/en/05-get-started/03-package.md
@@ -1,6 +1,7 @@
---
-sidebar_label: Package
title: Quick Install from Package
+sidebar_label: Package
+description: This document describes how to install TDengine on Linux, Windows, and macOS and perform queries and inserts.
---
import Tabs from "@theme/Tabs";
diff --git a/docs/en/05-get-started/index.md b/docs/en/05-get-started/index.md
index 12cfa22c69..66573a89cd 100644
--- a/docs/en/05-get-started/index.md
+++ b/docs/en/05-get-started/index.md
@@ -1,6 +1,6 @@
---
title: Get Started
-description: This article describes how to install TDengine and test its performance.
+description: This document describes how to install TDengine on various platforms.
---
import GitHubSVG from './github.svg'
diff --git a/docs/en/07-develop/01-connect/index.md b/docs/en/07-develop/01-connect/index.md
index 45bbaa2751..913c24f189 100644
--- a/docs/en/07-develop/01-connect/index.md
+++ b/docs/en/07-develop/01-connect/index.md
@@ -1,7 +1,7 @@
---
-sidebar_label: Connect
title: Connect to TDengine
-description: "How to establish connections to TDengine and how to install and use TDengine connectors."
+sidebar_label: Connect
+description: This document describes how to establish connections to TDengine and how to install and use TDengine connectors.
---
import Tabs from "@theme/Tabs";
diff --git a/docs/en/07-develop/02-model/index.mdx b/docs/en/07-develop/02-model/index.mdx
index 19a239805f..db5a259cfe 100644
--- a/docs/en/07-develop/02-model/index.mdx
+++ b/docs/en/07-develop/02-model/index.mdx
@@ -1,5 +1,6 @@
---
title: Data Model
+description: This document describes the data model of TDengine.
---
The data model employed by TDengine is similar to that of a relational database. You have to create databases and tables. You must design the data model based on your own business and application requirements. You should design the [STable](/concept/#super-table-stable) (an abbreviation for super table) schema to fit your data. This chapter will explain the big picture without getting into syntactical details.
diff --git a/docs/en/07-develop/03-insert-data/01-sql-writing.mdx b/docs/en/07-develop/03-insert-data/01-sql-writing.mdx
index f2168645ff..32ba53a0cb 100644
--- a/docs/en/07-develop/03-insert-data/01-sql-writing.mdx
+++ b/docs/en/07-develop/03-insert-data/01-sql-writing.mdx
@@ -1,5 +1,6 @@
---
title: Insert Using SQL
+description: This document describes how to insert data into TDengine using SQL.
---
import Tabs from "@theme/Tabs";
diff --git a/docs/en/07-develop/03-insert-data/20-kafka-writting.mdx b/docs/en/07-develop/03-insert-data/20-kafka-writting.mdx
index ffb969a8a6..89ca10b669 100644
--- a/docs/en/07-develop/03-insert-data/20-kafka-writting.mdx
+++ b/docs/en/07-develop/03-insert-data/20-kafka-writting.mdx
@@ -1,5 +1,6 @@
---
title: Write from Kafka
+description: This document describes how to insert data into TDengine using Kafka.
---
import Tabs from "@theme/Tabs";
diff --git a/docs/en/07-develop/03-insert-data/30-influxdb-line.mdx b/docs/en/07-develop/03-insert-data/30-influxdb-line.mdx
index fc5644850c..c559883d26 100644
--- a/docs/en/07-develop/03-insert-data/30-influxdb-line.mdx
+++ b/docs/en/07-develop/03-insert-data/30-influxdb-line.mdx
@@ -1,6 +1,7 @@
---
-sidebar_label: InfluxDB Line Protocol
title: InfluxDB Line Protocol
+sidebar_label: InfluxDB Line Protocol
+description: This document describes how to insert data into TDengine using the InfluxDB Line Protocol.
---
import Tabs from "@theme/Tabs";
diff --git a/docs/en/07-develop/03-insert-data/40-opentsdb-telnet.mdx b/docs/en/07-develop/03-insert-data/40-opentsdb-telnet.mdx
index 5d3f25dca9..30bc3b87bf 100644
--- a/docs/en/07-develop/03-insert-data/40-opentsdb-telnet.mdx
+++ b/docs/en/07-develop/03-insert-data/40-opentsdb-telnet.mdx
@@ -1,6 +1,7 @@
---
-sidebar_label: OpenTSDB Line Protocol
title: OpenTSDB Line Protocol
+sidebar_label: OpenTSDB Line Protocol
+description: This document describes how to insert data into TDengine using the OpenTSDB Line Protocol.
---
import Tabs from "@theme/Tabs";
diff --git a/docs/en/07-develop/03-insert-data/50-opentsdb-json.mdx b/docs/en/07-develop/03-insert-data/50-opentsdb-json.mdx
index 214580c179..e9db130241 100644
--- a/docs/en/07-develop/03-insert-data/50-opentsdb-json.mdx
+++ b/docs/en/07-develop/03-insert-data/50-opentsdb-json.mdx
@@ -1,6 +1,7 @@
---
-sidebar_label: OpenTSDB JSON Protocol
title: OpenTSDB JSON Protocol
+sidebar_label: OpenTSDB JSON Protocol
+description: This document describes how to insert data into TDengine using the OpenTSDB JSON protocol.
---
import Tabs from "@theme/Tabs";
diff --git a/docs/en/07-develop/03-insert-data/60-high-volume.md b/docs/en/07-develop/03-insert-data/60-high-volume.md
index 272a138813..d5afa8ef6e 100644
--- a/docs/en/07-develop/03-insert-data/60-high-volume.md
+++ b/docs/en/07-develop/03-insert-data/60-high-volume.md
@@ -1,6 +1,7 @@
---
-sidebar_label: High Performance Writing
title: High Performance Writing
+sidebar_label: High Performance Writing
+description: This document describes how to achieve high performance when writing data into TDengine.
---
import Tabs from "@theme/Tabs";
diff --git a/docs/en/07-develop/03-insert-data/index.md b/docs/en/07-develop/03-insert-data/index.md
index 1a71e719a5..15f8f4ee9e 100644
--- a/docs/en/07-develop/03-insert-data/index.md
+++ b/docs/en/07-develop/03-insert-data/index.md
@@ -1,5 +1,6 @@
---
title: Insert Data
+description: This document describes how to insert data into TDengine.
---
TDengine supports multiple protocols of inserting data, including SQL, InfluxDB Line protocol, OpenTSDB Telnet protocol, and OpenTSDB JSON protocol. Data can be inserted row by row, or in batches. Data from one or more collection points can be inserted simultaneously. Data can be inserted with multiple threads, and out of order data and historical data can be inserted as well. InfluxDB Line protocol, OpenTSDB Telnet protocol and OpenTSDB JSON protocol are the 3 kinds of schemaless insert protocols supported by TDengine. It's not necessary to create STables and tables in advance if using schemaless protocols, and the schemas can be adjusted automatically based on the data being inserted.
diff --git a/docs/en/07-develop/04-query-data/index.mdx b/docs/en/07-develop/04-query-data/index.mdx
index 38dc98d1ff..7e167bb4f3 100644
--- a/docs/en/07-develop/04-query-data/index.mdx
+++ b/docs/en/07-develop/04-query-data/index.mdx
@@ -1,6 +1,6 @@
---
title: Query Data
-description: "This chapter introduces major query functionalities and how to perform sync and async query using connectors."
+description: This document describes how to query data in TDengine and how to perform synchronous and asynchronous queries using connectors.
---
import Tabs from "@theme/Tabs";
diff --git a/docs/en/07-develop/06-stream.md b/docs/en/07-develop/06-stream.md
index 36f903ee9a..125173e60b 100644
--- a/docs/en/07-develop/06-stream.md
+++ b/docs/en/07-develop/06-stream.md
@@ -1,7 +1,7 @@
---
-sidebar_label: Stream Processing
-description: "The TDengine stream processing engine combines data inserts, preprocessing, analytics, real-time computation, and alerting into a single component."
title: Stream Processing
+sidebar_label: Stream Processing
+description: This document describes the stream processing component of TDengine.
---
Raw time-series data is often cleaned and preprocessed before being permanently stored in a database. In a traditional time-series solution, this generally requires the deployment of stream processing systems such as Kafka or Flink. However, the complexity of such systems increases the cost of development and maintenance.
diff --git a/docs/en/07-develop/08-cache.md b/docs/en/07-develop/08-cache.md
index 82a4787016..6a6ca3e594 100644
--- a/docs/en/07-develop/08-cache.md
+++ b/docs/en/07-develop/08-cache.md
@@ -1,7 +1,7 @@
---
-sidebar_label: Caching
title: Caching
-description: "This document describes the caching component of TDengine."
+sidebar_label: Caching
+description: This document describes the caching component of TDengine.
---
TDengine uses various kinds of caching techniques to efficiently write and query data. This document describes the caching component of TDengine.
diff --git a/docs/en/07-develop/09-udf.md b/docs/en/07-develop/09-udf.md
index 699b3ebe5f..553a7b932b 100644
--- a/docs/en/07-develop/09-udf.md
+++ b/docs/en/07-develop/09-udf.md
@@ -1,7 +1,7 @@
---
-sidebar_label: UDF
title: User-Defined Functions (UDF)
-description: "You can define your own scalar and aggregate functions to expand the query capabilities of TDengine."
+sidebar_label: UDF
+description: This document describes how to create user-defined functions (UDF), your own scalar and aggregate functions that can expand the query capabilities of TDengine.
---
The built-in functions of TDengine may not be sufficient for the use cases of every application. In this case, you can define custom functions for use in TDengine queries. These are known as user-defined functions (UDF). A user-defined function takes one column of data or the result of a subquery as its input.
diff --git a/docs/en/07-develop/index.md b/docs/en/07-develop/index.md
index 34649d32a2..8f80b82b97 100644
--- a/docs/en/07-develop/index.md
+++ b/docs/en/07-develop/index.md
@@ -1,5 +1,6 @@
---
title: Developer Guide
+description: This document describes how to use the various components of TDengine from a developer's perspective.
---
Before creating an application to process time-series data with TDengine, consider the following:
diff --git a/docs/en/10-deployment/01-deploy.md b/docs/en/10-deployment/01-deploy.md
index 5dfcd3108d..da00e21a7e 100644
--- a/docs/en/10-deployment/01-deploy.md
+++ b/docs/en/10-deployment/01-deploy.md
@@ -1,6 +1,7 @@
---
-sidebar_label: Manual Deployment
title: Manual Deployment and Management
+sidebar_label: Manual Deployment
+description: This document describes how to deploy TDengine on a server.
---
## Prerequisites
diff --git a/docs/en/10-deployment/03-k8s.md b/docs/en/10-deployment/03-k8s.md
index b0aa677713..49e61caafc 100644
--- a/docs/en/10-deployment/03-k8s.md
+++ b/docs/en/10-deployment/03-k8s.md
@@ -1,6 +1,7 @@
---
-sidebar_label: Kubernetes
title: Deploying a TDengine Cluster in Kubernetes
+sidebar_label: Kubernetes
+description: This document describes how to deploy TDengine on Kubernetes.
---
TDengine is a cloud-native time-series database that can be deployed on Kubernetes. This document gives a step-by-step description of how you can use YAML files to create a TDengine cluster and introduces common operations for TDengine in a Kubernetes environment.
diff --git a/docs/en/10-deployment/05-helm.md b/docs/en/10-deployment/05-helm.md
index 90baa5f445..aa61717669 100644
--- a/docs/en/10-deployment/05-helm.md
+++ b/docs/en/10-deployment/05-helm.md
@@ -1,6 +1,7 @@
---
-sidebar_label: Helm
title: Use Helm to deploy TDengine
+sidebar_label: Helm
+description: This document describes how to deploy TDengine on Kubernetes by using Helm.
---
Helm is a package manager for Kubernetes that can provide more capabilities in deploying on Kubernetes.
diff --git a/docs/en/10-deployment/index.md b/docs/en/10-deployment/index.md
index 7054a33e4a..865fbc2da5 100644
--- a/docs/en/10-deployment/index.md
+++ b/docs/en/10-deployment/index.md
@@ -1,5 +1,6 @@
---
title: Deployment
+description: This document describes how to deploy a TDengine cluster on a server, on Kubernetes, and by using Helm.
---
TDengine has a native distributed design and provides the ability to scale out. A few nodes can form a TDengine cluster. If you need higher processing power, you just need to add more nodes into the cluster. TDengine uses virtual node technology to virtualize a node into multiple virtual nodes to achieve load balancing. At the same time, TDengine can group virtual nodes on different nodes into virtual node groups, and use the replication mechanism to ensure the high availability of the system. The cluster feature of TDengine is completely open source.
diff --git a/docs/en/12-taos-sql/01-data-type.md b/docs/en/12-taos-sql/01-data-type.md
index 60046629a4..641fd3cbb7 100644
--- a/docs/en/12-taos-sql/01-data-type.md
+++ b/docs/en/12-taos-sql/01-data-type.md
@@ -1,7 +1,7 @@
---
-sidebar_label: Data Types
title: Data Types
-description: 'TDengine supports a variety of data types including timestamp, float, JSON and many others.'
+sidebar_label: Data Types
+description: This document describes the data types that TDengine supports.
---
## Timestamp
diff --git a/docs/en/12-taos-sql/02-database.md b/docs/en/12-taos-sql/02-database.md
index 476df0a60d..280d72697c 100644
--- a/docs/en/12-taos-sql/02-database.md
+++ b/docs/en/12-taos-sql/02-database.md
@@ -1,7 +1,7 @@
---
-sidebar_label: Database
title: Database
-description: "create and drop database, show or change database parameters"
+sidebar_label: Database
+description: This document describes how to create and perform operations on databases.
---
## Create a Database
@@ -58,7 +58,7 @@ database_option: {
- WAL_FSYNC_PERIOD: specifies the interval (in milliseconds) at which data is written from the WAL to disk. This parameter takes effect only when the WAL parameter is set to 2. The default value is 3000. Enter a value between 0 and 180000. The value 0 indicates that incoming data is immediately written to disk.
- MAXROWS: specifies the maximum number of rows recorded in a block. The default value is 4096.
- MINROWS: specifies the minimum number of rows recorded in a block. The default value is 100.
-- KEEP: specifies the time for which data is retained. Enter a value between 1 and 365000. The default value is 3650. The value of the KEEP parameter must be greater than or equal to the value of the DURATION parameter. TDengine automatically deletes data that is older than the value of the KEEP parameter. You can use m (minutes), h (hours), and d (days) as the unit, for example KEEP 100h or KEEP 10d. If you do not include a unit, d is used by default.
+- KEEP: specifies the time for which data is retained. Enter a value between 1 and 365000. The default value is 3650. The value of the KEEP parameter must be greater than or equal to the value of the DURATION parameter. TDengine automatically deletes data that is older than the value of the KEEP parameter. You can use m (minutes), h (hours), and d (days) as the unit, for example KEEP 100h or KEEP 10d. If you do not include a unit, d is used by default. The Enterprise Edition supports [Tiered Storage](https://docs.tdengine.com/tdinternal/arch/#tiered-storage) function, thus multiple KEEP values (comma separated and up to 3 values supported, and meet keep 0 <= keep 1 <= keep 2, e.g. KEEP 100h,100d,3650d) are supported; the Community Edition does not support Tiered Storage function (although multiple keep values are configured, they do not take effect, only the maximum keep value is used as KEEP).
- PAGES: specifies the number of pages in the metadata storage engine cache on each vnode. Enter a value greater than or equal to 64. The default value is 256. The space occupied by metadata storage on each vnode is equal to the product of the values of the PAGESIZE and PAGES parameters. The space occupied by default is 1 MB.
- PAGESIZE: specifies the size (in KB) of each page in the metadata storage engine cache on each vnode. The default value is 4. Enter a value between 1 and 16384.
- PRECISION: specifies the precision at which a database records timestamps. Enter ms for milliseconds, us for microseconds, or ns for nanoseconds. The default value is ms.
diff --git a/docs/en/12-taos-sql/03-table.md b/docs/en/12-taos-sql/03-table.md
index 6d12b8c730..f61d1f5147 100644
--- a/docs/en/12-taos-sql/03-table.md
+++ b/docs/en/12-taos-sql/03-table.md
@@ -1,5 +1,6 @@
---
title: Table
+description: This document describes how to create and perform operations on standard tables and subtables.
---
## Create Table
diff --git a/docs/en/12-taos-sql/04-stable.md b/docs/en/12-taos-sql/04-stable.md
index 8a7c713f8c..5b316d0d24 100644
--- a/docs/en/12-taos-sql/04-stable.md
+++ b/docs/en/12-taos-sql/04-stable.md
@@ -1,6 +1,7 @@
---
-sidebar_label: Supertable
title: Supertable
+sidebar_label: Supertable
+description: This document describes how to create and perform operations on supertables.
---
## Create a Supertable
diff --git a/docs/en/12-taos-sql/05-insert.md b/docs/en/12-taos-sql/05-insert.md
index 9141211db5..c22357abfa 100644
--- a/docs/en/12-taos-sql/05-insert.md
+++ b/docs/en/12-taos-sql/05-insert.md
@@ -1,6 +1,7 @@
---
-sidebar_label: Insert
title: Insert
+sidebar_label: Insert
+description: This document describes how to insert data into TDengine.
---
## Syntax
@@ -27,7 +28,7 @@ INSERT INTO tb_name [(field1_name, ...)] subquery
2. The precision of a timestamp depends on its format. The precision configured for the database affects only timestamps that are inserted as long integers (UNIX time). Timestamps inserted as date and time strings are not affected. As an example, the timestamp 2021-07-13 16:16:48 is equivalent to 1626164208 in UNIX time. This UNIX time is modified to 1626164208000 for databases with millisecond precision, 1626164208000000 for databases with microsecond precision, and 1626164208000000000 for databases with nanosecond precision.
3. If you want to insert multiple rows simultaneously, do not use the NOW function in the timestamp. Using the NOW function in this situation will cause multiple rows to have the same timestamp and prevent them from being stored correctly. This is because the NOW function obtains the current time on the client, and multiple instances of NOW in a single statement will return the same time.
- The earliest timestamp that you can use when inserting data is equal to the current time on the server minus the value of the KEEP parameter. The latest timestamp that you can use when inserting data is equal to the current time on the server plus the value of the DURATION parameter. You can configure the KEEP and DURATION parameters when you create a database. The default values are 3650 days for the KEEP parameter and 10 days for the DURATION parameter.
+ The earliest timestamp that you can use when inserting data is equal to the current time on the server minus the value of the KEEP parameter (You can configure the KEEP parameter when you create a database and the default value is 3650 days). The latest timestamp you can use when inserting data depends on the PRECISION parameter (You can configure the PRECISION parameter when you create a database, ms means milliseconds, us means microseconds, ns means nanoseconds, and the default value is milliseconds). If the timestamp precision is milliseconds or microseconds, the latest timestamp is the Unix epoch (January 1st, 1970 at 00:00:00.000 UTC) plus 1000 years, that is, January 1st, 2970 at 00:00:00.000 UTC; If the timestamp precision is nanoseconds, the latest timestamp is the Unix epoch plus 292 years, that is, January 1st, 2262 at 00:00:00.000000000 UTC.
**Syntax**
diff --git a/docs/en/12-taos-sql/06-select.md b/docs/en/12-taos-sql/06-select.md
index ee06a7be2d..183ab58726 100644
--- a/docs/en/12-taos-sql/06-select.md
+++ b/docs/en/12-taos-sql/06-select.md
@@ -1,6 +1,7 @@
---
-sidebar_label: Select
title: Select
+sidebar_label: Select
+description: This document describes how to query data in TDengine.
---
## Syntax
diff --git a/docs/en/12-taos-sql/08-delete-data.mdx b/docs/en/12-taos-sql/08-delete-data.mdx
index 999c467ad0..f91a89a7eb 100644
--- a/docs/en/12-taos-sql/08-delete-data.mdx
+++ b/docs/en/12-taos-sql/08-delete-data.mdx
@@ -1,7 +1,7 @@
---
-sidebar_label: Delete Data
-description: "Delete data from table or Stable"
title: Delete Data
+sidebar_label: Delete Data
+description: This document describes how to delete data from TDengine.
---
TDengine provides the functionality of deleting data from a table or STable according to specified time range, it can be used to cleanup abnormal data generated due to device failure.
diff --git a/docs/en/12-taos-sql/10-function.md b/docs/en/12-taos-sql/10-function.md
index 802eb259bf..b2d44f1a1d 100644
--- a/docs/en/12-taos-sql/10-function.md
+++ b/docs/en/12-taos-sql/10-function.md
@@ -1,6 +1,7 @@
---
-sidebar_label: Functions
title: Functions
+sidebar_label: Functions
+description: This document describes the standard SQL functions available in TDengine.
toc_max_heading_level: 4
---
diff --git a/docs/en/12-taos-sql/12-distinguished.md b/docs/en/12-taos-sql/12-distinguished.md
index 0763e85a53..536fd8ffc3 100644
--- a/docs/en/12-taos-sql/12-distinguished.md
+++ b/docs/en/12-taos-sql/12-distinguished.md
@@ -1,6 +1,7 @@
---
-sidebar_label: Time-Series Extensions
title: Time-Series Extensions
+sidebar_label: Time-Series Extensions
+description: This document describes the extended functions specific to time-series data processing available in TDengine.
---
As a purpose-built database for storing and processing time-series data, TDengine provides time-series-specific extensions to standard SQL.
diff --git a/docs/en/12-taos-sql/13-tmq.md b/docs/en/12-taos-sql/13-tmq.md
index befab4f4f0..1a805c76fb 100644
--- a/docs/en/12-taos-sql/13-tmq.md
+++ b/docs/en/12-taos-sql/13-tmq.md
@@ -1,6 +1,7 @@
---
-sidebar_label: Data Subscription
title: Data Subscription
+sidebar_label: Data Subscription
+description: This document describes the SQL statements related to the data subscription component of TDengine.
---
The information in this document is related to the TDengine data subscription feature.
diff --git a/docs/en/12-taos-sql/14-stream.md b/docs/en/12-taos-sql/14-stream.md
index e70e962668..b8f6c3a163 100644
--- a/docs/en/12-taos-sql/14-stream.md
+++ b/docs/en/12-taos-sql/14-stream.md
@@ -1,6 +1,7 @@
---
-sidebar_label: Stream Processing
title: Stream Processing
+sidebar_label: Stream Processing
+description: This document describes the SQL statements related to the stream processing component of TDengine.
---
Raw time-series data is often cleaned and preprocessed before being permanently stored in a database. Stream processing components like Kafka, Flink, and Spark are often deployed alongside a time-series database to handle these operations, increasing system complexity and maintenance costs.
diff --git a/docs/en/12-taos-sql/16-operators.md b/docs/en/12-taos-sql/16-operators.md
index c426e28793..32ad4e7075 100644
--- a/docs/en/12-taos-sql/16-operators.md
+++ b/docs/en/12-taos-sql/16-operators.md
@@ -1,6 +1,7 @@
---
-sidebar_label: Operators
title: Operators
+sidebar_label: Operators
+description: This document describes the SQL operators available in TDengine.
---
## Arithmetic Operators
diff --git a/docs/en/12-taos-sql/17-json.md b/docs/en/12-taos-sql/17-json.md
index 77f7743033..b2494e0cc1 100644
--- a/docs/en/12-taos-sql/17-json.md
+++ b/docs/en/12-taos-sql/17-json.md
@@ -1,6 +1,7 @@
---
-sidebar_label: JSON Type
title: JSON Type
+sidebar_label: JSON Type
+description: This document describes the JSON data type in TDengine.
---
diff --git a/docs/en/12-taos-sql/18-escape.md b/docs/en/12-taos-sql/18-escape.md
index a2ae40de98..85e4610e44 100644
--- a/docs/en/12-taos-sql/18-escape.md
+++ b/docs/en/12-taos-sql/18-escape.md
@@ -1,5 +1,6 @@
---
title: Escape Characters
+description: This document describes the usage of escape characters in TDengine.
---
## Escape Characters
diff --git a/docs/en/12-taos-sql/19-limit.md b/docs/en/12-taos-sql/19-limit.md
index f00ec90f57..654fae7560 100644
--- a/docs/en/12-taos-sql/19-limit.md
+++ b/docs/en/12-taos-sql/19-limit.md
@@ -1,6 +1,7 @@
---
-sidebar_label: Name and Size Limits
title: Name and Size Limits
+sidebar_label: Name and Size Limits
+description: This document describes the name and size limits in TDengine.
---
## Naming Rules
diff --git a/docs/en/12-taos-sql/20-keywords.md b/docs/en/12-taos-sql/20-keywords.md
index 23f85947e3..a2191c87ee 100644
--- a/docs/en/12-taos-sql/20-keywords.md
+++ b/docs/en/12-taos-sql/20-keywords.md
@@ -1,6 +1,7 @@
---
-sidebar_label: Reserved Keywords
title: Reserved Keywords
+sidebar_label: Reserved Keywords
+description: This document describes the reserved keywords in TDengine that cannot be used in object names.
---
## Keyword List
diff --git a/docs/en/12-taos-sql/21-node.md b/docs/en/12-taos-sql/21-node.md
index a0d49ab208..8a5069e66f 100644
--- a/docs/en/12-taos-sql/21-node.md
+++ b/docs/en/12-taos-sql/21-node.md
@@ -1,6 +1,7 @@
---
-sidebar_label: Cluster
title: Cluster
+sidebar_label: Cluster
+description: This document describes the SQL statements related to cluster management in TDengine.
---
The physical entities that form TDengine clusters are known as data nodes (dnodes). Each dnode is a process running on the operating system of the physical machine. Dnodes can contain virtual nodes (vnodes), which store time-series data. Virtual nodes are formed into vgroups, which have 1 or 3 vnodes depending on the replica setting. If you want to enable replication on your cluster, it must contain at least three nodes. Dnodes can also contain management nodes (mnodes). Each cluster has up to three mnodes. Finally, dnodes can contain query nodes (qnodes), which compute time-series data, thus separating compute from storage. A single dnode can contain a vnode, qnode, and mnode.
diff --git a/docs/en/12-taos-sql/22-meta.md b/docs/en/12-taos-sql/22-meta.md
index 1cd759742a..d2bc72f047 100644
--- a/docs/en/12-taos-sql/22-meta.md
+++ b/docs/en/12-taos-sql/22-meta.md
@@ -1,6 +1,7 @@
---
-sidebar_label: Metadata
title: Information_Schema Database
+sidebar_label: Metadata
+description: This document describes how to use the INFORMATION_SCHEMA database in TDengine.
---
TDengine includes a built-in database named `INFORMATION_SCHEMA` to provide access to database metadata, system information, and status information. This information includes database names, table names, and currently running SQL statements. All information related to TDengine maintenance is stored in this database. It contains several read-only tables. These tables are more accurately described as views, and they do not correspond to specific files. You can query these tables but cannot write data to them. The INFORMATION_SCHEMA database is intended to provide a unified method for SHOW commands to access data. However, using SELECT ... FROM INFORMATION_SCHEMA.tablename offers several advantages over SHOW commands:
diff --git a/docs/en/12-taos-sql/23-perf.md b/docs/en/12-taos-sql/23-perf.md
index 29cf3af6ab..fc369ec663 100644
--- a/docs/en/12-taos-sql/23-perf.md
+++ b/docs/en/12-taos-sql/23-perf.md
@@ -1,6 +1,7 @@
---
-sidebar_label: Statistics
title: Performance_Schema Database
+sidebar_label: Statistics
+description: This document describes how to use the PERFORMANCE_SCHEMA database in TDengine.
---
TDengine includes a built-in database named `PERFORMANCE_SCHEMA` to provide access to database performance statistics. This document introduces the tables of PERFORMANCE_SCHEMA and their structure.
diff --git a/docs/en/12-taos-sql/24-show.md b/docs/en/12-taos-sql/24-show.md
index f70d86570e..dc1db956a0 100644
--- a/docs/en/12-taos-sql/24-show.md
+++ b/docs/en/12-taos-sql/24-show.md
@@ -1,6 +1,7 @@
---
-sidebar_label: SHOW Statement
title: SHOW Statement for Metadata
+sidebar_label: SHOW Statement
+description: This document describes how to use the SHOW statement in TDengine.
---
`SHOW` command can be used to get brief system information. To get details about metatadata, information, and status in the system, please use `select` to query the tables in database `INFORMATION_SCHEMA`.
diff --git a/docs/en/12-taos-sql/25-grant.md b/docs/en/12-taos-sql/25-grant.md
index f895567c62..8b4c439352 100644
--- a/docs/en/12-taos-sql/25-grant.md
+++ b/docs/en/12-taos-sql/25-grant.md
@@ -1,7 +1,7 @@
---
-sidebar_label: Access Control
title: User and Access Control
-description: Manage user and user's permission
+sidebar_label: Access Control
+description: This document describes how to manage users and permissions in TDengine.
---
This document describes how to manage permissions in TDengine.
diff --git a/docs/en/12-taos-sql/26-udf.md b/docs/en/12-taos-sql/26-udf.md
index 977f3bcc08..249fcd3b54 100644
--- a/docs/en/12-taos-sql/26-udf.md
+++ b/docs/en/12-taos-sql/26-udf.md
@@ -1,6 +1,7 @@
---
-sidebar_label: User-Defined Functions
title: User-Defined Functions (UDF)
+sidebar_label: User-Defined Functions
+description: This document describes the SQL statements related to user-defined functions (UDF) in TDengine.
---
You can create user-defined functions and import them into TDengine.
diff --git a/docs/en/12-taos-sql/27-index.md b/docs/en/12-taos-sql/27-index.md
index 7d09bc43ab..7586e4af76 100644
--- a/docs/en/12-taos-sql/27-index.md
+++ b/docs/en/12-taos-sql/27-index.md
@@ -1,6 +1,7 @@
---
-sidebar_label: Index
-title: Using Indices
+title: Indexing
+sidebar_label: Indexing
+description: This document describes the SQL statements related to indexing in TDengine.
---
TDengine supports SMA and FULLTEXT indexing.
diff --git a/docs/en/12-taos-sql/28-recovery.md b/docs/en/12-taos-sql/28-recovery.md
index e869ffc45f..b4da25ea0c 100644
--- a/docs/en/12-taos-sql/28-recovery.md
+++ b/docs/en/12-taos-sql/28-recovery.md
@@ -1,6 +1,7 @@
---
-sidebar_label: Error Recovery
title: Error Recovery
+sidebar_label: Error Recovery
+description: This document describes the SQL statements related to error recovery in TDengine.
---
In a complex environment, connections and query tasks may encounter errors or fail to return in a reasonable time. If this occurs, you can terminate the connection or task.
diff --git a/docs/en/12-taos-sql/29-changes.md b/docs/en/12-taos-sql/29-changes.md
index f288cd7545..341791d675 100644
--- a/docs/en/12-taos-sql/29-changes.md
+++ b/docs/en/12-taos-sql/29-changes.md
@@ -1,7 +1,7 @@
---
-sidebar_label: Changes in TDengine 3.0
title: Changes in TDengine 3.0
-description: "This document explains how TDengine SQL has changed in version 3.0."
+sidebar_label: Changes in TDengine 3.0
+description: This document describes how TDengine SQL has changed in version 3.0 compared with previous versions.
---
## Basic SQL Elements
diff --git a/docs/en/12-taos-sql/index.md b/docs/en/12-taos-sql/index.md
index a5ffc9dc8d..276f84f21b 100644
--- a/docs/en/12-taos-sql/index.md
+++ b/docs/en/12-taos-sql/index.md
@@ -1,6 +1,6 @@
---
title: TDengine SQL
-description: 'The syntax supported by TDengine SQL '
+description: This document describes the syntax and functions supported by TDengine SQL.
---
This section explains the syntax of SQL to perform operations on databases, tables and STables, insert data, select data and use functions. We also provide some tips that can be used in TDengine SQL. If you have previous experience with SQL this section will be fairly easy to understand. If you do not have previous experience with SQL, you'll come to appreciate the simplicity and power of SQL. TDengine SQL has been enhanced in version 3.0, and the query engine has been rearchitected. For information about how TDengine SQL has changed, see [Changes in TDengine 3.0](../taos-sql/changes).
diff --git a/docs/en/13-operation/01-pkg-install.md b/docs/en/13-operation/01-pkg-install.md
index d7713b943f..6e6c4aaebf 100644
--- a/docs/en/13-operation/01-pkg-install.md
+++ b/docs/en/13-operation/01-pkg-install.md
@@ -1,6 +1,6 @@
---
title: Install and Uninstall
-description: Install, Uninstall, Start, Stop and Upgrade
+description: This document describes how to install, upgrade, and uninstall TDengine.
---
import Tabs from "@theme/Tabs";
diff --git a/docs/en/13-operation/02-planning.mdx b/docs/en/13-operation/02-planning.mdx
index 2dffa7bb87..37ef6aae26 100644
--- a/docs/en/13-operation/02-planning.mdx
+++ b/docs/en/13-operation/02-planning.mdx
@@ -1,6 +1,7 @@
---
-sidebar_label: Resource Planning
title: Resource Planning
+sidebar_label: Resource Planning
+description: This document describes how to plan compute and storage resources for your TDengine cluster.
---
It is important to plan computing and storage resources if using TDengine to build an IoT, time-series or Big Data platform. How to plan the CPU, memory and disk resources required, will be described in this chapter.
diff --git a/docs/en/13-operation/03-tolerance.md b/docs/en/13-operation/03-tolerance.md
index 21a5a90282..4f33748e68 100644
--- a/docs/en/13-operation/03-tolerance.md
+++ b/docs/en/13-operation/03-tolerance.md
@@ -1,5 +1,6 @@
---
title: Fault Tolerance and Disaster Recovery
+description: This document describes how TDengine provides fault tolerance and disaster recovery.
---
## Fault Tolerance
diff --git a/docs/en/13-operation/07-import.md b/docs/en/13-operation/07-import.md
index 8362cec1ab..e95824e927 100644
--- a/docs/en/13-operation/07-import.md
+++ b/docs/en/13-operation/07-import.md
@@ -1,5 +1,6 @@
---
title: Data Import
+description: This document describes how to import data into TDengine.
---
There are multiple ways of importing data provided by TDengine: import with script, import from data file, import using `taosdump`.
diff --git a/docs/en/13-operation/08-export.md b/docs/en/13-operation/08-export.md
index 5780de42fa..bffda36e23 100644
--- a/docs/en/13-operation/08-export.md
+++ b/docs/en/13-operation/08-export.md
@@ -1,5 +1,6 @@
---
title: Data Export
+description: This document describes how to export data from TDengine.
---
There are two ways of exporting data from a TDengine cluster:
diff --git a/docs/en/13-operation/10-monitor.md b/docs/en/13-operation/10-monitor.md
index 74a5564a2a..346b874059 100644
--- a/docs/en/13-operation/10-monitor.md
+++ b/docs/en/13-operation/10-monitor.md
@@ -1,5 +1,6 @@
---
title: TDengine Monitoring
+description: This document describes how to monitor your TDengine cluster.
---
After TDengine is started, it automatically writes monitoring data including CPU, memory and disk usage, bandwidth, number of requests, disk I/O speed, slow queries, into a designated database at a predefined interval through taosKeeper. Additionally, some important system operations, like logon, create user, drop database, and alerts and warnings generated in TDengine are written into the `log` database too. A system operator can view the data in `log` database from TDengine CLI or from a web console.
diff --git a/docs/en/13-operation/17-diagnose.md b/docs/en/13-operation/17-diagnose.md
index fa202a23ea..9d42b3ebbc 100644
--- a/docs/en/13-operation/17-diagnose.md
+++ b/docs/en/13-operation/17-diagnose.md
@@ -1,5 +1,6 @@
---
title: Problem Diagnostics
+description: This document describes how to diagnose issues with your TDengine cluster.
---
## Network Connection Diagnostics
diff --git a/docs/en/13-operation/index.md b/docs/en/13-operation/index.md
index c64749c40e..8b386dc19a 100644
--- a/docs/en/13-operation/index.md
+++ b/docs/en/13-operation/index.md
@@ -1,5 +1,6 @@
---
title: Administration
+description: This document describes how to perform management operations on your TDengine cluster from an administrator's perspective.
---
This chapter is mainly written for system administrators. It covers download, install/uninstall, data import/export, system monitoring, user management, connection management, capacity planning and system optimization.
diff --git a/docs/en/14-reference/02-rest-api/02-rest-api.mdx b/docs/en/14-reference/02-rest-api/02-rest-api.mdx
index 09e40b956f..b138d69bfc 100644
--- a/docs/en/14-reference/02-rest-api/02-rest-api.mdx
+++ b/docs/en/14-reference/02-rest-api/02-rest-api.mdx
@@ -1,5 +1,6 @@
---
title: REST API
+description: This document describes the TDengine REST API.
---
To support the development of various types of applications and platforms, TDengine provides an API that conforms to REST principles; namely REST API. To minimize the learning cost, unlike REST APIs for other database engines, TDengine allows insertion of SQL commands in the BODY of an HTTP POST request, to operate the database.
diff --git a/docs/en/14-reference/03-connector/03-cpp.mdx b/docs/en/14-reference/03-connector/03-cpp.mdx
index 906d56ab15..3bd7b7f4c6 100644
--- a/docs/en/14-reference/03-connector/03-cpp.mdx
+++ b/docs/en/14-reference/03-connector/03-cpp.mdx
@@ -1,6 +1,7 @@
---
-sidebar_label: C/C++
title: C/C++ Connector
+sidebar_label: C/C++
+description: This document describes the TDengine C/C++ connector.
---
C/C++ developers can use TDengine's client driver and the C/C++ connector, to develop their applications to connect to TDengine clusters for data writing, querying, and other functions. To use the C/C++ connector you must include the TDengine header file _taos.h_, which lists the function prototypes of the provided APIs. The application also needs to link to the corresponding dynamic libraries on the platform where it is located.
diff --git a/docs/en/14-reference/03-connector/04-java.mdx b/docs/en/14-reference/03-connector/04-java.mdx
index c37738b3f8..61ce166069 100644
--- a/docs/en/14-reference/03-connector/04-java.mdx
+++ b/docs/en/14-reference/03-connector/04-java.mdx
@@ -1,8 +1,8 @@
---
-toc_max_heading_level: 4
-sidebar_label: Java
title: TDengine Java Connector
-description: The TDengine Java Connector is implemented on the standard JDBC API and provides native and REST connectors.
+sidebar_label: Java
+description: This document describes the TDengine Java Connector.
+toc_max_heading_level: 4
---
import Tabs from '@theme/Tabs';
diff --git a/docs/en/14-reference/03-connector/05-go.mdx b/docs/en/14-reference/03-connector/05-go.mdx
index 60407c0735..da2f54708f 100644
--- a/docs/en/14-reference/03-connector/05-go.mdx
+++ b/docs/en/14-reference/03-connector/05-go.mdx
@@ -1,7 +1,8 @@
---
-toc_max_heading_level: 4
-sidebar_label: Go
title: TDengine Go Connector
+sidebar_label: Go
+description: This document describes the TDengine Go connector.
+toc_max_heading_level: 4
---
import Tabs from '@theme/Tabs';
diff --git a/docs/en/14-reference/03-connector/06-rust.mdx b/docs/en/14-reference/03-connector/06-rust.mdx
index 4e2a7848dc..6e84859610 100644
--- a/docs/en/14-reference/03-connector/06-rust.mdx
+++ b/docs/en/14-reference/03-connector/06-rust.mdx
@@ -1,7 +1,8 @@
---
-toc_max_heading_level: 4
-sidebar_label: Rust
title: TDengine Rust Connector
+sidebar_label: Rust
+description: This document describes the TDengine Rust connector.
+toc_max_heading_level: 4
---
import Tabs from '@theme/Tabs';
diff --git a/docs/en/14-reference/03-connector/07-python.mdx b/docs/en/14-reference/03-connector/07-python.mdx
index d593c3f133..146da268a8 100644
--- a/docs/en/14-reference/03-connector/07-python.mdx
+++ b/docs/en/14-reference/03-connector/07-python.mdx
@@ -1,7 +1,7 @@
---
-sidebar_label: Python
title: TDengine Python Connector
-description: "taospy is the official Python connector for TDengine. taospy provides a rich API that makes it easy for Python applications to use TDengine. tasopy wraps both the native and REST interfaces of TDengine, corresponding to the two submodules of tasopy: taos and taosrest. In addition to wrapping the native and REST interfaces, taospy also provides a programming interface that conforms to the Python Data Access Specification (PEP 249), making it easy to integrate taospy with many third-party tools, such as SQLAlchemy and pandas."
+sidebar_label: Python
+description: This document describes taospy, the TDengine Python connector.
---
import Tabs from "@theme/Tabs";
diff --git a/docs/en/14-reference/03-connector/08-node.mdx b/docs/en/14-reference/03-connector/08-node.mdx
index a36cf0efc9..83479f91da 100644
--- a/docs/en/14-reference/03-connector/08-node.mdx
+++ b/docs/en/14-reference/03-connector/08-node.mdx
@@ -1,7 +1,8 @@
---
-toc_max_heading_level: 4
-sidebar_label: Node.js
title: TDengine Node.js Connector
+sidebar_label: Node.js
+description: This document describes the TDengine Node.js connector.
+toc_max_heading_level: 4
---
import Tabs from "@theme/Tabs";
@@ -59,9 +60,19 @@ Please refer to [version support list](/reference/connector#version-support)
- `python` (recommended for `v2.7` , `v3.x.x` currently not supported)
- `@tdengine/client` 3.0.0 supports Node.js LTS v10.9.0 or later and Node.js LTS v12.8.0 or later. Older versions may be incompatible.
- `make`
-- C compiler, [GCC](https://gcc.gnu.org) v4.8.5 or higher
+- C compiler, [GCC](https://gcc.gnu.org) v4.8.5 or later.
+
+
+
+- `python` (recommended for `v2.7` , `v3.x.x` currently not supported)
+- `@tdengine/client` 3.0.0 currently supports Node.js from v12.22.12, but only later versions of v12. Other versions may be incompatible.
+- `make`
+- C compiler, [GCC](https://gcc.gnu.org) v4.8.5 or later.
+
+
+
- Installation method 1
@@ -249,4 +260,4 @@ let cursor = conn.cursor();
## API Reference
-[API Reference](https://docs.taosdata.com/api/td2.0-connector/)
\ No newline at end of file
+[API Reference](https://docs.taosdata.com/api/td2.0-connector/)
diff --git a/docs/en/14-reference/03-connector/09-csharp.mdx b/docs/en/14-reference/03-connector/09-csharp.mdx
index 756e948bd2..e984967fb7 100644
--- a/docs/en/14-reference/03-connector/09-csharp.mdx
+++ b/docs/en/14-reference/03-connector/09-csharp.mdx
@@ -1,7 +1,8 @@
---
-toc_max_heading_level: 4
-sidebar_label: C#
title: C# Connector
+sidebar_label: C#
+description: This document describes the TDengine C# connector.
+toc_max_heading_level: 4
---
import Tabs from '@theme/Tabs';
diff --git a/docs/en/14-reference/03-connector/10-php.mdx b/docs/en/14-reference/03-connector/10-php.mdx
index 87f8616f9e..fd00d11239 100644
--- a/docs/en/14-reference/03-connector/10-php.mdx
+++ b/docs/en/14-reference/03-connector/10-php.mdx
@@ -1,6 +1,7 @@
---
-sidebar_label: PHP
title: PHP Connector
+sidebar_label: PHP
+description: This document describes the TDengine PHP connector.
---
`php-tdengine` is the TDengine PHP connector provided by TDengine community. In particular, it supports Swoole coroutine.
diff --git a/docs/en/14-reference/03-connector/index.mdx b/docs/en/14-reference/03-connector/index.mdx
index da3aae8309..2df73b8592 100644
--- a/docs/en/14-reference/03-connector/index.mdx
+++ b/docs/en/14-reference/03-connector/index.mdx
@@ -1,5 +1,6 @@
---
title: Connector
+description: This document describes the connectors that TDengine provides to interface with various programming languages.
---
TDengine provides a rich set of APIs (application development interface). To facilitate users to develop their applications quickly, TDengine supports connectors for multiple programming languages, including official connectors for C/C++, Java, Python, Go, Node.js, C#, and Rust. These connectors support connecting to TDengine clusters using both native interfaces (taosc) and REST interfaces (not supported in a few languages yet). Community developers have also contributed several unofficial connectors, such as the ADO.NET connector, the Lua connector, and the PHP connector.
diff --git a/docs/en/14-reference/04-taosadapter.md b/docs/en/14-reference/04-taosadapter.md
index 9eb6cb9213..c1ec97b647 100644
--- a/docs/en/14-reference/04-taosadapter.md
+++ b/docs/en/14-reference/04-taosadapter.md
@@ -1,7 +1,7 @@
---
-title: "taosAdapter"
-description: "taosAdapter is a TDengine companion tool that acts as a bridge and adapter between TDengine clusters and applications. It provides an easy-to-use and efficient way to ingest data directly from data collection agent software such as Telegraf, StatsD, collectd, etc. It also provides an InfluxDB/OpenTSDB compatible data ingestion interface, allowing InfluxDB/OpenTSDB applications to be seamlessly ported to TDengine."
-sidebar_label: "taosAdapter"
+title: taosAdapter
+sidebar_label: taosAdapter
+description: This document describes how to use taosAdapter, a TDengine companion tool that acts as a bridge and adapter between TDengine clusters and applications.
---
import Prometheus from "./_prometheus.mdx"
diff --git a/docs/en/14-reference/05-taosbenchmark.md b/docs/en/14-reference/05-taosbenchmark.md
index 4017b12be9..9828d71ece 100644
--- a/docs/en/14-reference/05-taosbenchmark.md
+++ b/docs/en/14-reference/05-taosbenchmark.md
@@ -1,8 +1,8 @@
---
title: taosBenchmark
sidebar_label: taosBenchmark
+description: This document describes how to use taosBenchmark, a tool for testing the performance of TDengine.
toc_max_heading_level: 4
-description: "taosBenchmark (once called taosdemo ) is a tool for testing the performance of TDengine."
---
# Introduction
diff --git a/docs/en/14-reference/06-taosdump.md b/docs/en/14-reference/06-taosdump.md
index 9c63b4dc03..dcfc068a3d 100644
--- a/docs/en/14-reference/06-taosdump.md
+++ b/docs/en/14-reference/06-taosdump.md
@@ -1,6 +1,6 @@
---
title: taosdump
-description: "taosdump is a tool that supports backing up data from a running TDengine cluster and restoring the backed up data to the same, or another running TDengine cluster."
+description: This document describes how to use taosdump, a tool for backing up and restoring the data in a TDengine cluster.
---
## Introduction
diff --git a/docs/en/14-reference/07-tdinsight/index.md b/docs/en/14-reference/07-tdinsight/index.md
index d03c16a8bc..1c58dd6a76 100644
--- a/docs/en/14-reference/07-tdinsight/index.md
+++ b/docs/en/14-reference/07-tdinsight/index.md
@@ -1,6 +1,7 @@
---
title: TDinsight - Grafana-based Zero-Dependency Monitoring Solution for TDengine
sidebar_label: TDinsight
+description: This document describes TDinsight, a monitoring solution for TDengine.
---
TDinsight is a solution for monitoring TDengine using the builtin native monitoring database and [Grafana].
diff --git a/docs/en/14-reference/08-taos-shell.md b/docs/en/14-reference/08-taos-shell.md
index 68e2f08765..7833ac861f 100644
--- a/docs/en/14-reference/08-taos-shell.md
+++ b/docs/en/14-reference/08-taos-shell.md
@@ -1,7 +1,7 @@
---
title: TDengine Command Line Interface (CLI)
sidebar_label: Command Line Interface
-description: Instructions and tips for using the TDengine CLI
+description: This document describes how to use the TDengine CLI.
---
The TDengine command-line interface (hereafter referred to as `TDengine CLI`) is the simplest way for users to manipulate and interact with TDengine instances.
diff --git a/docs/en/14-reference/09-support-platform/index.md b/docs/en/14-reference/09-support-platform/index.md
index 061294f016..7dfa8ac93a 100644
--- a/docs/en/14-reference/09-support-platform/index.md
+++ b/docs/en/14-reference/09-support-platform/index.md
@@ -1,6 +1,6 @@
---
title: List of supported platforms
-description: "List of platforms supported by TDengine server, client, and connector"
+description: This document describes the supported platforms for the TDengine server, client, and connectors.
---
## List of supported platforms for TDengine server
diff --git a/docs/en/14-reference/11-docker/index.md b/docs/en/14-reference/11-docker/index.md
index 89987c456f..b9278c6961 100644
--- a/docs/en/14-reference/11-docker/index.md
+++ b/docs/en/14-reference/11-docker/index.md
@@ -1,6 +1,6 @@
---
title: Deploying TDengine with Docker
-description: "This chapter focuses on starting the TDengine service in a container and accessing it."
+description: This chapter describes how to start and access TDengine in a Docker container.
---
This chapter describes how to start the TDengine service in a container and access it. Users can control the behavior of the service in the container by using environment variables on the docker run command-line or in the docker-compose file.
diff --git a/docs/en/14-reference/12-config/index.md b/docs/en/14-reference/12-config/index.md
index a8f4978abf..afa9f5a8ae 100644
--- a/docs/en/14-reference/12-config/index.md
+++ b/docs/en/14-reference/12-config/index.md
@@ -1,6 +1,6 @@
---
title: Configuration Parameters
-description: "Configuration parameters for client and server in TDengine"
+description: This document describes the configuration parameters for the TDengine server and client.
---
## Configuration File on Server Side
@@ -162,11 +162,7 @@ The parameters described in this document by the effect that they have on the sy
| Meaning | Execution policy for query statements |
| Unit | None |
| Default | 1 |
-| Value Range | 1: Run queries on vnodes and not on qnodes
-
-2: Run subtasks without scan operators on qnodes and subtasks with scan operators on vnodes.
-
-3: Only run scan operators on vnodes; run all other operators on qnodes. |
+| Value Range | 1: Run queries on vnodes and not on qnodes; 2: Run subtasks without scan operators on qnodes and subtasks with scan operators on vnodes; 3: Only run scan operators on vnodes, and run all other operators on qnodes. |
### querySmaOptimize
@@ -176,11 +172,7 @@ The parameters described in this document by the effect that they have on the sy
| Meaning | SMA index optimization policy |
| Unit | None |
| Default Value | 0 |
-| Notes |
-
-0: Disable SMA indexing and perform all queries on non-indexed data.
-
-1: Enable SMA indexing and perform queries from suitable statements on precomputation results.|
+| Notes |0: Disable SMA indexing and perform all queries on non-indexed data; 1: Enable SMA indexing and perform queries from suitable statements on precomputation results.|
### countAlwaysReturnValue
@@ -323,6 +315,7 @@ The charset that takes effect is UTF-8.
| Applicable | Server Only |
| Meaning | All data files are stored in this directory |
| Default Value | /var/lib/taos |
+| Note | The [Tiered Storage](https://docs.tdengine.com/tdinternal/arch/#tiered-storage) function needs to be used in conjunction with the [KEEP](https://docs.tdengine.com/taos-sql/database/#parameters) parameter |
### tempDir
diff --git a/docs/en/14-reference/12-directory.md b/docs/en/14-reference/12-directory.md
index 19b036418f..651892c8b2 100644
--- a/docs/en/14-reference/12-directory.md
+++ b/docs/en/14-reference/12-directory.md
@@ -1,6 +1,6 @@
---
title: File directory structure
-description: "TDengine installation directory description"
+description: This document describes the structure of the TDengine directory after installation.
---
After TDengine is installed, the following directories or files will be created in the system by default.
diff --git a/docs/en/14-reference/13-schemaless/13-schemaless.md b/docs/en/14-reference/13-schemaless/13-schemaless.md
index a97a54af02..caedd76df8 100644
--- a/docs/en/14-reference/13-schemaless/13-schemaless.md
+++ b/docs/en/14-reference/13-schemaless/13-schemaless.md
@@ -1,6 +1,6 @@
---
title: Schemaless Writing
-description: 'The Schemaless write method eliminates the need to create super tables/sub tables in advance and automatically creates the storage structure corresponding to the data, as it is written to the interface.'
+description: This document describes how to use the schemaless write component of TDengine.
---
In IoT applications, data is collected for many purposes such as intelligent control, business analysis, device monitoring and so on. Due to changes in business or functional requirements or changes in device hardware, the application logic and even the data collected may change. Schemaless writing automatically creates storage structures for your data as it is being written to TDengine, so that you do not need to create supertables in advance. When necessary, schemaless writing
diff --git a/docs/en/14-reference/14-taosKeeper.md b/docs/en/14-reference/14-taosKeeper.md
index 665bc75380..0b4a1fbd60 100644
--- a/docs/en/14-reference/14-taosKeeper.md
+++ b/docs/en/14-reference/14-taosKeeper.md
@@ -1,7 +1,7 @@
---
sidebar_label: taosKeeper
title: taosKeeper
-description: exports TDengine monitoring metrics.
+description: This document describes how to use taosKeeper, a tool for exporting TDengine monitoring metrics.
---
## Introduction
diff --git a/docs/en/14-reference/index.md b/docs/en/14-reference/index.md
index f3a64913d0..bc8ec69965 100644
--- a/docs/en/14-reference/index.md
+++ b/docs/en/14-reference/index.md
@@ -1,5 +1,6 @@
---
title: Reference
+description: This document describes TDengine connectors and utilities.
---
This section describes the TDengine connectors and utilities.
diff --git a/docs/en/20-third-party/01-grafana.mdx b/docs/en/20-third-party/01-grafana.mdx
index ca32ce8afc..b33e1c1199 100644
--- a/docs/en/20-third-party/01-grafana.mdx
+++ b/docs/en/20-third-party/01-grafana.mdx
@@ -1,6 +1,7 @@
---
-sidebar_label: Grafana
title: Grafana
+sidebar_label: Grafana
+description: This document describes how to integrate TDengine with Grafana.
---
import Tabs from "@theme/Tabs";
diff --git a/docs/en/20-third-party/02-prometheus.md b/docs/en/20-third-party/02-prometheus.md
index ef9b9cb637..bfdd3d015e 100644
--- a/docs/en/20-third-party/02-prometheus.md
+++ b/docs/en/20-third-party/02-prometheus.md
@@ -1,6 +1,7 @@
---
-sidebar_label: Prometheus
title: Prometheus writing and reading
+sidebar_label: Prometheus
+description: This document describes how to integrate TDengine with Prometheus.
---
import Prometheus from "../14-reference/_prometheus.mdx"
diff --git a/docs/en/20-third-party/03-telegraf.md b/docs/en/20-third-party/03-telegraf.md
index 8f3cab0e57..7e99b84eab 100644
--- a/docs/en/20-third-party/03-telegraf.md
+++ b/docs/en/20-third-party/03-telegraf.md
@@ -1,6 +1,7 @@
---
-sidebar_label: Telegraf
title: Telegraf writing
+sidebar_label: Telegraf
+description: This document describes how to integrate TDengine with Telegraf.
---
import Telegraf from "../14-reference/_telegraf.mdx"
diff --git a/docs/en/20-third-party/05-collectd.md b/docs/en/20-third-party/05-collectd.md
index 5b52e3b7bc..d8c8e7f81d 100644
--- a/docs/en/20-third-party/05-collectd.md
+++ b/docs/en/20-third-party/05-collectd.md
@@ -1,6 +1,7 @@
---
-sidebar_label: collectd
title: collectd writing
+sidebar_label: collectd
+description: This document describes how to integrate TDengine with collectd.
---
import CollectD from "../14-reference/_collectd.mdx"
diff --git a/docs/en/20-third-party/06-statsd.md b/docs/en/20-third-party/06-statsd.md
index b861a48ecd..ea428e9cdb 100644
--- a/docs/en/20-third-party/06-statsd.md
+++ b/docs/en/20-third-party/06-statsd.md
@@ -1,6 +1,7 @@
---
-sidebar_label: StatsD
title: StatsD Writing
+sidebar_label: StatsD
+description: This document describes how to integrate TDengine with StatsD.
---
import StatsD from "../14-reference/_statsd.mdx"
diff --git a/docs/en/20-third-party/07-icinga2.md b/docs/en/20-third-party/07-icinga2.md
index 167b6a4303..540aae8689 100644
--- a/docs/en/20-third-party/07-icinga2.md
+++ b/docs/en/20-third-party/07-icinga2.md
@@ -1,6 +1,7 @@
---
-sidebar_label: icinga2
title: icinga2 writing
+sidebar_label: icinga2
+description: This document describes how to integrate TDengine with icinga2.
---
import Icinga2 from "../14-reference/_icinga2.mdx"
diff --git a/docs/en/20-third-party/08-tcollector.md b/docs/en/20-third-party/08-tcollector.md
index b604a2d712..f1c0ecd44d 100644
--- a/docs/en/20-third-party/08-tcollector.md
+++ b/docs/en/20-third-party/08-tcollector.md
@@ -1,6 +1,7 @@
---
-sidebar_label: TCollector
title: TCollector writing
+sidebar_label: TCollector
+description: This document describes how to integrate TDengine with TCollector.
---
import TCollector from "../14-reference/_tcollector.mdx"
diff --git a/docs/en/20-third-party/09-emq-broker.md b/docs/en/20-third-party/09-emq-broker.md
index 2ead1bbaf4..10ce0174ed 100644
--- a/docs/en/20-third-party/09-emq-broker.md
+++ b/docs/en/20-third-party/09-emq-broker.md
@@ -1,6 +1,7 @@
---
-sidebar_label: EMQX Broker
title: EMQX Broker writing
+sidebar_label: EMQX Broker
+description: This document describes how to integrate TDengine with the EMQX broker.
---
MQTT is a popular IoT data transfer protocol. [EMQX](https://github.com/emqx/emqx) is an open-source MQTT Broker software. You can write MQTT data directly to TDengine without any code. You only need to setup "rules" in EMQX Dashboard to create a simple configuration. EMQX supports saving data to TDengine by sending data to a web service and provides a native TDengine driver for direct saving in the Enterprise Edition. Please refer to the [EMQX official documentation](https://www.emqx.io/docs/en/v4.4/rule/rule-engine.html) for details on how to use it.).
diff --git a/docs/en/20-third-party/10-hive-mq-broker.md b/docs/en/20-third-party/10-hive-mq-broker.md
index 828a62ac5b..6c5165596e 100644
--- a/docs/en/20-third-party/10-hive-mq-broker.md
+++ b/docs/en/20-third-party/10-hive-mq-broker.md
@@ -1,6 +1,7 @@
---
-sidebar_label: HiveMQ Broker
title: HiveMQ Broker Writing
+sidebar_label: HiveMQ Broker
+description: This document describes how to integrate TDengine with the HiveMQ broker.
---
[HiveMQ](https://www.hivemq.com/) is an MQTT broker that provides community and enterprise editions. HiveMQ is mainly for enterprise emerging machine-to-machine M2M communication and internal transport, meeting scalability, ease of management, and security features. HiveMQ provides an open-source plug-in development kit. MQTT data can be saved to TDengine via TDengine extension for HiveMQ. For more information, see [HiveMQ TDengine Extension](https://github.com/huskar-t/hivemq-tdengine-extension/blob/b62a26ecc164a310104df57691691b237e091c89/README_EN.md).
diff --git a/docs/en/20-third-party/11-kafka.md b/docs/en/20-third-party/11-kafka.md
index 3e8f7c295d..0998862b2d 100644
--- a/docs/en/20-third-party/11-kafka.md
+++ b/docs/en/20-third-party/11-kafka.md
@@ -1,6 +1,7 @@
---
-sidebar_label: Kafka
title: TDengine Kafka Connector Tutorial
+sidebar_label: Kafka
+description: This document describes how to integrate TDengine with Kafka.
---
TDengine Kafka Connector contains two plugins: TDengine Source Connector and TDengine Sink Connector. Users only need to provide a simple configuration file to synchronize the data of the specified topic in Kafka (batch or real-time) to TDengine or synchronize the data (batch or real-time) of the specified database in TDengine to Kafka.
diff --git a/docs/en/20-third-party/12-google-data-studio.md b/docs/en/20-third-party/12-google-data-studio.md
index fc94f98056..ea6431fa5a 100644
--- a/docs/en/20-third-party/12-google-data-studio.md
+++ b/docs/en/20-third-party/12-google-data-studio.md
@@ -1,6 +1,7 @@
---
-sidebar_label: Google Data Studio
title: Use Google Data Studio to access TDengine
+sidebar_label: Google Data Studio
+description: This document describes how to integrate TDengine with Google Data Studio.
---
Data Studio is a powerful tool for reporting and visualization, offering a wide variety of charts and connectors and making it easy to generate reports based on predefined templates. Its ease of use and robust ecosystem have made it one of the first choices for people working in data analysis.
diff --git a/docs/en/20-third-party/13-Jupyter.md b/docs/en/20-third-party/13-Jupyter.md
index fbd7e530f0..1ac9df1da4 100644
--- a/docs/en/20-third-party/13-Jupyter.md
+++ b/docs/en/20-third-party/13-Jupyter.md
@@ -1,6 +1,7 @@
---
-sidebar_label: JupyterLab
title: Connect JupyterLab to TDengine
+sidebar_label: JupyterLab
+description: This document describes how to integrate TDengine with JupyterLab.
---
JupyterLab is the next generation of the ubiquitous Jupyter Notebook. In this note we show you how to install the TDengine Python connector to connect to TDengine in JupyterLab. You can then insert data and perform queries against the TDengine instance within JupyterLab.
diff --git a/docs/en/20-third-party/index.md b/docs/en/20-third-party/index.md
index 87bd9e0751..6fc8043eef 100644
--- a/docs/en/20-third-party/index.md
+++ b/docs/en/20-third-party/index.md
@@ -1,5 +1,6 @@
---
title: Third Party Tools
+description: This document describes how to integrate TDengine with various third-party tools.
---
Since TDengine supports standard SQL commands, common database connector standards (e.g., JDBC), ORM, and other popular time-series database writing protocols (e.g., InfluxDB Line Protocol, OpenTSDB JSON, OpenTSDB Telnet, etc.), it is very easy to integrate TDengine with other third party tools. You only need to provide simple configuration, the integration can be done without a line of code.
diff --git a/docs/en/21-tdinternal/01-arch.md b/docs/en/21-tdinternal/01-arch.md
index 697ecb98a1..cef05dcc56 100644
--- a/docs/en/21-tdinternal/01-arch.md
+++ b/docs/en/21-tdinternal/01-arch.md
@@ -1,6 +1,7 @@
---
-sidebar_label: Architecture
title: Architecture
+sidebar_label: Architecture
+description: This document describes the architecture of TDengine.
---
## Cluster and Primary Logic Unit
diff --git a/docs/en/21-tdinternal/03-high-availability.md b/docs/en/21-tdinternal/03-high-availability.md
index e2e1c6521e..a0f6ca4ffe 100644
--- a/docs/en/21-tdinternal/03-high-availability.md
+++ b/docs/en/21-tdinternal/03-high-availability.md
@@ -1,6 +1,7 @@
---
-sidebar_label: High Availability
title: High Availability
+sidebar_label: High Availability
+description: This document describes how TDengine implements high availability.
---
## High Availability of Vnode
diff --git a/docs/en/21-tdinternal/04-load-balance.md b/docs/en/21-tdinternal/04-load-balance.md
index 7648398059..73da1c1dd6 100644
--- a/docs/en/21-tdinternal/04-load-balance.md
+++ b/docs/en/21-tdinternal/04-load-balance.md
@@ -1,6 +1,7 @@
---
-sidebar_label: Load Balance
title: Load Balance
+sidebar_label: Load Balance
+description: This document describes how TDengine implements load balancing.
---
The load balance in TDengine is mainly about processing data series data. TDengine employes builtin hash algorithm to distribute all the tables, sub-tables and their data of a database across all the vgroups that belongs to the database. Each table or sub-table can only be handled by a single vgroup, while each vgroup can process multiple table or sub-table.
diff --git a/docs/en/21-tdinternal/index.md b/docs/en/21-tdinternal/index.md
index 999d6f89ff..4f08467543 100644
--- a/docs/en/21-tdinternal/index.md
+++ b/docs/en/21-tdinternal/index.md
@@ -1,5 +1,6 @@
---
title: TDengine Inside
+description: This document describes the internals of TDengine from an architectural perspective.
---
```mdx-code-block
diff --git a/docs/en/25-application/01-telegraf.md b/docs/en/25-application/01-telegraf.md
index 65fb08ee67..e043aebcb6 100644
--- a/docs/en/25-application/01-telegraf.md
+++ b/docs/en/25-application/01-telegraf.md
@@ -1,6 +1,7 @@
---
-sidebar_label: TDengine + Telegraf + Grafana
title: Quickly Build IT DevOps Visualization System with TDengine + Telegraf + Grafana
+sidebar_label: TDengine + Telegraf + Grafana
+description: This document describes how to create an IT visualization system by integrating TDengine with Telegraf and Grafana.
---
## Background
diff --git a/docs/en/25-application/02-collectd.md b/docs/en/25-application/02-collectd.md
index 97412b2309..6ac7253fc4 100644
--- a/docs/en/25-application/02-collectd.md
+++ b/docs/en/25-application/02-collectd.md
@@ -1,6 +1,7 @@
---
-sidebar_label: TDengine + collectd/StatsD + Grafana
title: Quickly build an IT DevOps visualization system using TDengine + collectd/StatsD + Grafana
+sidebar_label: TDengine + collectd/StatsD + Grafana
+description: This document describes how to build an IT visualization system by integrating TDengine with Grafana and collectd or StatsD.
---
## Background
diff --git a/docs/en/25-application/03-immigrate.md b/docs/en/25-application/03-immigrate.md
index 1aabaa43e7..30d069e4e2 100644
--- a/docs/en/25-application/03-immigrate.md
+++ b/docs/en/25-application/03-immigrate.md
@@ -1,6 +1,7 @@
---
-sidebar_label: OpenTSDB Migration to TDengine
title: Best Practices for Migrating OpenTSDB Applications to TDengine
+sidebar_label: OpenTSDB Migration to TDengine
+description: This document describes the best practices for migrating an OpenTSDB application to TDengine.
---
As a distributed, scalable, distributed time-series database platform based on HBase, and thanks to its first-mover advantage, OpenTSDB is widely used for monitoring in DevOps. However, as new technologies like cloud computing, microservices, and containerization technology has developed rapidly, Enterprise-level services are becoming more and more diverse and the architecture is becoming more complex.
diff --git a/docs/en/25-application/index.md b/docs/en/25-application/index.md
index 5383a00c67..178fef47b6 100644
--- a/docs/en/25-application/index.md
+++ b/docs/en/25-application/index.md
@@ -1,5 +1,6 @@
---
title: Application Practice
+description: This document describes some examples of building systems around TDengine.
---
```mdx-code-block
diff --git a/docs/en/27-train-faq/01-faq.md b/docs/en/27-train-faq/01-faq.md
index 7650e97365..9e7f4f8e0d 100644
--- a/docs/en/27-train-faq/01-faq.md
+++ b/docs/en/27-train-faq/01-faq.md
@@ -1,5 +1,6 @@
---
title: Frequently Asked Questions
+description: This document describes the frequently asked questions about TDengine.
---
## Submit an Issue
diff --git a/docs/en/27-train-faq/index.md b/docs/en/27-train-faq/index.md
index 2cb87aab00..cc55a41559 100644
--- a/docs/en/27-train-faq/index.md
+++ b/docs/en/27-train-faq/index.md
@@ -1,5 +1,6 @@
---
title: FAQ & Others
+description: This document describes common issues related with TDengine.
---
```mdx-code-block
diff --git a/docs/en/28-releases/01-tdengine.md b/docs/en/28-releases/01-tdengine.md
index 83ea3eb5e6..a6a28e04c4 100644
--- a/docs/en/28-releases/01-tdengine.md
+++ b/docs/en/28-releases/01-tdengine.md
@@ -1,7 +1,7 @@
---
-sidebar_label: TDengine
title: TDengine Release History and Download Links
-description: TDengine release history, Release Notes and download links.
+sidebar_label: TDengine
+description: This document provides download links for all released versions of TDengine 3.0.
---
TDengine 3.x installation packages can be downloaded at the following links:
diff --git a/docs/en/28-releases/02-tools.md b/docs/en/28-releases/02-tools.md
index 97fed654f2..3c1dc32f8d 100644
--- a/docs/en/28-releases/02-tools.md
+++ b/docs/en/28-releases/02-tools.md
@@ -1,7 +1,7 @@
---
-sidebar_label: taosTools
title: taosTools Release History and Download Links
-description: taosTools release history, Release Notes, download links.
+sidebar_label: taosTools
+description: This document provides download links for all released versions of taosTools compatible with TDengine 3.0.
---
taosTools installation packages can be downloaded at the following links:
diff --git a/docs/en/28-releases/index.md b/docs/en/28-releases/index.md
index c01c99cdce..d1f93c3b9b 100644
--- a/docs/en/28-releases/index.md
+++ b/docs/en/28-releases/index.md
@@ -1,5 +1,6 @@
---
title: Releases
+description: This document describes TDengine products that have been released.
---
```mdx-code-block
diff --git a/docs/examples/csharp/wsConnect/wsConnect.csproj b/docs/examples/csharp/wsConnect/wsConnect.csproj
index 6d78be6e7a..c7988b6e9c 100644
--- a/docs/examples/csharp/wsConnect/wsConnect.csproj
+++ b/docs/examples/csharp/wsConnect/wsConnect.csproj
@@ -2,7 +2,7 @@
Exe
- net5.0
+ net6.0
diff --git a/docs/examples/csharp/wsInsert/wsInsert.csproj b/docs/examples/csharp/wsInsert/wsInsert.csproj
index 95bfbdea3d..5aa419b2c8 100644
--- a/docs/examples/csharp/wsInsert/wsInsert.csproj
+++ b/docs/examples/csharp/wsInsert/wsInsert.csproj
@@ -2,7 +2,7 @@
Exe
- net5.0
+ net6.0
enable
diff --git a/docs/examples/csharp/wsQuery/wsQuery.csproj b/docs/examples/csharp/wsQuery/wsQuery.csproj
index e5c2cf767c..bcc7c19a59 100644
--- a/docs/examples/csharp/wsQuery/wsQuery.csproj
+++ b/docs/examples/csharp/wsQuery/wsQuery.csproj
@@ -2,7 +2,7 @@
Exe
- net5.0
+ net6.0
enable
diff --git a/docs/examples/csharp/wsStmt/wsStmt.csproj b/docs/examples/csharp/wsStmt/wsStmt.csproj
index e5c2cf767c..bcc7c19a59 100644
--- a/docs/examples/csharp/wsStmt/wsStmt.csproj
+++ b/docs/examples/csharp/wsStmt/wsStmt.csproj
@@ -2,7 +2,7 @@
Exe
- net5.0
+ net6.0
enable
diff --git a/docs/examples/go/go.sum b/docs/examples/go/go.sum
new file mode 100644
index 0000000000..13e13adaa1
--- /dev/null
+++ b/docs/examples/go/go.sum
@@ -0,0 +1,15 @@
+github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
+github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
+github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
+github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
+github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
+github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
+github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
+github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
+github.com/taosdata/driver-go/v3 v3.1.0/go.mod h1:H2vo/At+rOPY1aMzUV9P49SVX7NlXb3LAbKw+MCLrmU=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
diff --git a/docs/examples/node/restexample/connect.js b/docs/examples/node/restexample/connect.js
index bb027d4fe8..f36472b4c0 100644
--- a/docs/examples/node/restexample/connect.js
+++ b/docs/examples/node/restexample/connect.js
@@ -3,18 +3,14 @@ const { options, connect } = require("@tdengine/rest");
async function test() {
options.path = "/rest/sql";
options.host = "localhost";
+ options.port = 6041;
let conn = connect(options);
let cursor = conn.cursor();
try {
let res = await cursor.query("SELECT server_version()");
- res.toString();
+ console.log("res.getResult()",res.getResult());
} catch (err) {
console.log(err);
}
}
test();
-
-// output:
-// server_version() |
-// ===================
-// 3.0.0.0 |
diff --git a/docs/examples/python/conn_native_pandas.py b/docs/examples/python/conn_native_pandas.py
index 56942ef570..f3bab15efb 100644
--- a/docs/examples/python/conn_native_pandas.py
+++ b/docs/examples/python/conn_native_pandas.py
@@ -1,8 +1,11 @@
import pandas
-from sqlalchemy import create_engine
+from sqlalchemy import create_engine, text
engine = create_engine("taos://root:taosdata@localhost:6030/power")
-df = pandas.read_sql("SELECT * FROM meters", engine)
+conn = engine.connect()
+df = pandas.read_sql(text("SELECT * FROM power.meters"), conn)
+conn.close()
+
# print index
print(df.index)
diff --git a/docs/examples/python/conn_rest_pandas.py b/docs/examples/python/conn_rest_pandas.py
index 0164080cd5..1b207d6ff1 100644
--- a/docs/examples/python/conn_rest_pandas.py
+++ b/docs/examples/python/conn_rest_pandas.py
@@ -1,8 +1,10 @@
import pandas
-from sqlalchemy import create_engine
+from sqlalchemy import create_engine, text
engine = create_engine("taosrest://root:taosdata@localhost:6041")
-df: pandas.DataFrame = pandas.read_sql("SELECT * FROM power.meters", engine)
+conn = engine.connect()
+df: pandas.DataFrame = pandas.read_sql(text("SELECT * FROM power.meters"), conn)
+conn.close()
# print index
print(df.index)
diff --git a/docs/examples/python/connect_rest_examples.py b/docs/examples/python/connect_rest_examples.py
index dba00b5a82..0f8625ae53 100644
--- a/docs/examples/python/connect_rest_examples.py
+++ b/docs/examples/python/connect_rest_examples.py
@@ -1,18 +1,19 @@
# ANCHOR: connect
from taosrest import connect, TaosRestConnection, TaosRestCursor
-conn: TaosRestConnection = connect(url="http://localhost:6041",
- user="root",
- password="taosdata",
- timeout=30)
+conn = connect(url="http://localhost:6041",
+ user="root",
+ password="taosdata",
+ timeout=30)
# ANCHOR_END: connect
# ANCHOR: basic
# create STable
-cursor: TaosRestCursor = conn.cursor()
+cursor = conn.cursor()
cursor.execute("DROP DATABASE IF EXISTS power")
cursor.execute("CREATE DATABASE power")
-cursor.execute("CREATE STABLE power.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (location BINARY(64), groupId INT)")
+cursor.execute(
+ "CREATE STABLE power.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (location BINARY(64), groupId INT)")
# insert data
cursor.execute("""INSERT INTO power.d1001 USING power.meters TAGS('California.SanFrancisco', 2) VALUES ('2018-10-03 14:38:05.000', 10.30000, 219, 0.31000) ('2018-10-03 14:38:15.000', 12.60000, 218, 0.33000) ('2018-10-03 14:38:16.800', 12.30000, 221, 0.31000)
@@ -28,7 +29,7 @@ print("queried row count:", cursor.rowcount)
# get column names from cursor
column_names = [meta[0] for meta in cursor.description]
# get rows
-data: list[tuple] = cursor.fetchall()
+data = cursor.fetchall()
print(column_names)
for row in data:
print(row)
diff --git a/docs/examples/python/connection_usage_native_reference.py b/docs/examples/python/connection_usage_native_reference.py
index a7179b4cf8..0a23c5f95b 100644
--- a/docs/examples/python/connection_usage_native_reference.py
+++ b/docs/examples/python/connection_usage_native_reference.py
@@ -8,7 +8,7 @@ conn.execute("CREATE DATABASE test")
# change database. same as execute "USE db"
conn.select_db("test")
conn.execute("CREATE STABLE weather(ts TIMESTAMP, temperature FLOAT) TAGS (location INT)")
-affected_row: int = conn.execute("INSERT INTO t1 USING weather TAGS(1) VALUES (now, 23.5) (now+1m, 23.5) (now+2m, 24.4)")
+affected_row = conn.execute("INSERT INTO t1 USING weather TAGS(1) VALUES (now, 23.5) (now+1m, 23.5) (now+2m, 24.4)")
print("affected_row", affected_row)
# output:
# affected_row 3
@@ -16,10 +16,10 @@ print("affected_row", affected_row)
# ANCHOR: query
# Execute a sql and get its result set. It's useful for SELECT statement
-result: taos.TaosResult = conn.query("SELECT * from weather")
+result = conn.query("SELECT * from weather")
# Get fields from result
-fields: taos.field.TaosFields = result.fields
+fields = result.fields
for field in fields:
print(field) # {name: ts, type: 9, bytes: 8}
@@ -42,4 +42,4 @@ print(data)
# ANCHOR_END: query
-conn.close()
+conn.close()
\ No newline at end of file
diff --git a/docs/examples/python/fast_write_example.py b/docs/examples/python/fast_write_example.py
index c9d606388f..626e3310b1 100644
--- a/docs/examples/python/fast_write_example.py
+++ b/docs/examples/python/fast_write_example.py
@@ -1,15 +1,14 @@
# install dependencies:
# recommend python >= 3.8
-# pip3 install faster-fifo
#
import logging
import math
+import multiprocessing
import sys
import time
import os
-from multiprocessing import Process
-from faster_fifo import Queue
+from multiprocessing import Process, Queue
from mockdatasource import MockDataSource
from queue import Empty
from typing import List
@@ -22,8 +21,7 @@ TABLE_COUNT = 1000
QUEUE_SIZE = 1000000
MAX_BATCH_SIZE = 3000
-read_processes = []
-write_processes = []
+_DONE_MESSAGE = '__DONE__'
def get_connection():
@@ -44,41 +42,64 @@ def get_connection():
# ANCHOR: read
-def run_read_task(task_id: int, task_queues: List[Queue]):
+def run_read_task(task_id: int, task_queues: List[Queue], infinity):
table_count_per_task = TABLE_COUNT // READ_TASK_COUNT
- data_source = MockDataSource(f"tb{task_id}", table_count_per_task)
+ data_source = MockDataSource(f"tb{task_id}", table_count_per_task, infinity)
try:
for batch in data_source:
+ if isinstance(batch, tuple):
+ batch = [batch]
for table_id, rows in batch:
# hash data to different queue
i = table_id % len(task_queues)
# block putting forever when the queue is full
- task_queues[i].put_many(rows, block=True, timeout=-1)
+ for row in rows:
+ task_queues[i].put(row)
+ if not infinity:
+ for queue in task_queues:
+ queue.put(_DONE_MESSAGE)
except KeyboardInterrupt:
pass
+ finally:
+ logging.info('read task over')
# ANCHOR_END: read
+
# ANCHOR: write
-def run_write_task(task_id: int, queue: Queue):
+def run_write_task(task_id: int, queue: Queue, done_queue: Queue):
from sql_writer import SQLWriter
log = logging.getLogger(f"WriteTask-{task_id}")
writer = SQLWriter(get_connection)
lines = None
try:
while True:
- try:
- # get as many as possible
- lines = queue.get_many(block=False, max_messages_to_get=MAX_BATCH_SIZE)
+ over = False
+ lines = []
+ for _ in range(MAX_BATCH_SIZE):
+ try:
+ line = queue.get_nowait()
+ if line == _DONE_MESSAGE:
+ over = True
+ break
+ if line:
+ lines.append(line)
+ except Empty:
+ time.sleep(0.1)
+ if len(lines) > 0:
writer.process_lines(lines)
- except Empty:
- time.sleep(0.01)
+ if over:
+ done_queue.put(_DONE_MESSAGE)
+ break
except KeyboardInterrupt:
pass
except BaseException as e:
log.debug(f"lines={lines}")
raise e
+ finally:
+ writer.close()
+ log.debug('write task over')
# ANCHOR_END: write
@@ -103,47 +124,64 @@ def set_global_config():
# ANCHOR: monitor
-def run_monitor_process():
+def run_monitor_process(done_queue: Queue):
log = logging.getLogger("DataBaseMonitor")
- conn = get_connection()
- conn.execute("DROP DATABASE IF EXISTS test")
- conn.execute("CREATE DATABASE test")
- conn.execute("CREATE STABLE test.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) "
- "TAGS (location BINARY(64), groupId INT)")
+ conn = None
+ try:
+ conn = get_connection()
- def get_count():
- res = conn.query("SELECT count(*) FROM test.meters")
- rows = res.fetch_all()
- return rows[0][0] if rows else 0
+ def get_count():
+ res = conn.query("SELECT count(*) FROM test.meters")
+ rows = res.fetch_all()
+ return rows[0][0] if rows else 0
- last_count = 0
- while True:
- time.sleep(10)
- count = get_count()
- log.info(f"count={count} speed={(count - last_count) / 10}")
- last_count = count
+ last_count = 0
+ while True:
+ try:
+ done = done_queue.get_nowait()
+ if done == _DONE_MESSAGE:
+ break
+ except Empty:
+ pass
+ time.sleep(10)
+ count = get_count()
+ log.info(f"count={count} speed={(count - last_count) / 10}")
+ last_count = count
+ finally:
+ conn.close()
# ANCHOR_END: monitor
# ANCHOR: main
-def main():
+def main(infinity):
set_global_config()
logging.info(f"READ_TASK_COUNT={READ_TASK_COUNT}, WRITE_TASK_COUNT={WRITE_TASK_COUNT}, "
f"TABLE_COUNT={TABLE_COUNT}, QUEUE_SIZE={QUEUE_SIZE}, MAX_BATCH_SIZE={MAX_BATCH_SIZE}")
- monitor_process = Process(target=run_monitor_process)
+ conn = get_connection()
+ conn.execute("DROP DATABASE IF EXISTS test")
+ conn.execute("CREATE DATABASE IF NOT EXISTS test")
+ conn.execute("CREATE STABLE IF NOT EXISTS test.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) "
+ "TAGS (location BINARY(64), groupId INT)")
+ conn.close()
+
+ done_queue = Queue()
+ monitor_process = Process(target=run_monitor_process, args=(done_queue,))
monitor_process.start()
- time.sleep(3) # waiting for database ready.
+ logging.debug(f"monitor task started with pid {monitor_process.pid}")
task_queues: List[Queue] = []
+ write_processes = []
+ read_processes = []
+
# create task queues
for i in range(WRITE_TASK_COUNT):
- queue = Queue(max_size_bytes=QUEUE_SIZE)
+ queue = Queue()
task_queues.append(queue)
# create write processes
for i in range(WRITE_TASK_COUNT):
- p = Process(target=run_write_task, args=(i, task_queues[i]))
+ p = Process(target=run_write_task, args=(i, task_queues[i], done_queue))
p.start()
logging.debug(f"WriteTask-{i} started with pid {p.pid}")
write_processes.append(p)
@@ -151,13 +189,19 @@ def main():
# create read processes
for i in range(READ_TASK_COUNT):
queues = assign_queues(i, task_queues)
- p = Process(target=run_read_task, args=(i, queues))
+ p = Process(target=run_read_task, args=(i, queues, infinity))
p.start()
logging.debug(f"ReadTask-{i} started with pid {p.pid}")
read_processes.append(p)
try:
monitor_process.join()
+ for p in read_processes:
+ p.join()
+ for p in write_processes:
+ p.join()
+ time.sleep(1)
+ return
except KeyboardInterrupt:
monitor_process.terminate()
[p.terminate() for p in read_processes]
@@ -176,5 +220,6 @@ def assign_queues(read_task_id, task_queues):
if __name__ == '__main__':
- main()
+ multiprocessing.set_start_method('spawn')
+ main(False)
# ANCHOR_END: main
diff --git a/docs/examples/python/kafka_example.py b/docs/examples/python/kafka_example.py
index 735059eec0..5b81706ef7 100644
--- a/docs/examples/python/kafka_example.py
+++ b/docs/examples/python/kafka_example.py
@@ -26,7 +26,8 @@ class Consumer(object):
'bath_consume': True,
'batch_size': 1000,
'async_model': True,
- 'workers': 10
+ 'workers': 10,
+ 'testing': False
}
LOCATIONS = ['California.SanFrancisco', 'California.LosAngles', 'California.SanDiego', 'California.SanJose',
@@ -46,11 +47,12 @@ class Consumer(object):
def __init__(self, **configs):
self.config: dict = self.DEFAULT_CONFIGS
self.config.update(configs)
- self.consumer = KafkaConsumer(
- self.config.get('kafka_topic'), # topic
- bootstrap_servers=self.config.get('kafka_brokers'),
- group_id=self.config.get('kafka_group_id'),
- )
+ if not self.config.get('testing'):
+ self.consumer = KafkaConsumer(
+ self.config.get('kafka_topic'), # topic
+ bootstrap_servers=self.config.get('kafka_brokers'),
+ group_id=self.config.get('kafka_group_id'),
+ )
self.taos = taos.connect(
host=self.config.get('taos_host'),
user=self.config.get('taos_user'),
@@ -60,7 +62,7 @@ class Consumer(object):
)
if self.config.get('async_model'):
self.pool = ThreadPoolExecutor(max_workers=self.config.get('workers'))
- self.tasks: list[Future] = []
+ self.tasks = []
# tags and table mapping # key: {location}_{groupId} value:
self.tag_table_mapping = {}
i = 0
@@ -104,8 +106,8 @@ class Consumer(object):
for task in self.tasks:
while not task.done():
pass
- if self.pool is not None:
- self.pool.shutdown()
+ if self.pool is not None:
+ self.pool.shutdown()
# clean data
if self.config.get('clean_after_testing'):
@@ -115,14 +117,14 @@ class Consumer(object):
if self.taos is not None:
self.taos.close()
- def _run(self, f: Callable[[ConsumerRecord], bool]):
+ def _run(self, f):
for message in self.consumer:
if self.config.get('async_model'):
self.pool.submit(f(message))
else:
f(message)
- def _run_batch(self, f: Callable[[list[list[ConsumerRecord]]], None]):
+ def _run_batch(self, f):
while True:
messages = self.consumer.poll(timeout_ms=500, max_records=self.config.get('batch_size'))
if messages:
@@ -140,7 +142,7 @@ class Consumer(object):
logging.info('## insert sql %s', sql)
return self.taos.execute(sql=sql) == 1
- def _to_taos_batch(self, messages: list[list[ConsumerRecord]]):
+ def _to_taos_batch(self, messages):
sql = self._build_sql_batch(messages=messages)
if len(sql) == 0: # decode error, skip
return
@@ -162,7 +164,7 @@ class Consumer(object):
table_name = self._get_table_name(location=location, group_id=group_id)
return self.INSERT_PART_SQL.format(table_name, ts, current, voltage, phase)
- def _build_sql_batch(self, messages: list[list[ConsumerRecord]]) -> str:
+ def _build_sql_batch(self, messages) -> str:
sql_list = []
for partition_messages in messages:
for message in partition_messages:
@@ -186,7 +188,54 @@ def _get_location_and_group(key: str) -> (str, int):
return fields[0], fields[1]
+def test_to_taos(consumer: Consumer):
+ msg = {
+ 'location': 'California.SanFrancisco',
+ 'groupId': 1,
+ 'ts': '2022-12-06 15:13:38.643',
+ 'current': 3.41,
+ 'voltage': 105,
+ 'phase': 0.02027,
+ }
+ record = ConsumerRecord(checksum=None, headers=None, offset=1, key=None, value=json.dumps(msg), partition=1,
+ topic='test', serialized_key_size=None, serialized_header_size=None,
+ serialized_value_size=None, timestamp=time.time(), timestamp_type=None)
+ assert consumer._to_taos(message=record)
+
+
+def test_to_taos_batch(consumer: Consumer):
+ records = [
+ [
+ ConsumerRecord(checksum=None, headers=None, offset=1, key=None,
+ value=json.dumps({'location': 'California.SanFrancisco',
+ 'groupId': 1,
+ 'ts': '2022-12-06 15:13:38.643',
+ 'current': 3.41,
+ 'voltage': 105,
+ 'phase': 0.02027, }),
+ partition=1, topic='test', serialized_key_size=None, serialized_header_size=None,
+ serialized_value_size=None, timestamp=time.time(), timestamp_type=None),
+ ConsumerRecord(checksum=None, headers=None, offset=1, key=None,
+ value=json.dumps({'location': 'California.LosAngles',
+ 'groupId': 2,
+ 'ts': '2022-12-06 15:13:39.643',
+ 'current': 3.41,
+ 'voltage': 102,
+ 'phase': 0.02027, }),
+ partition=1, topic='test', serialized_key_size=None, serialized_header_size=None,
+ serialized_value_size=None, timestamp=time.time(), timestamp_type=None),
+ ]
+ ]
+
+ consumer._to_taos_batch(messages=records)
+
+
if __name__ == '__main__':
- consumer = Consumer(async_model=True)
+ consumer = Consumer(async_model=True, testing=True)
+ # init env
consumer.init_env()
- consumer.consume()
\ No newline at end of file
+ # consumer.consume()
+ # test build sql
+ # test build sql batch
+ test_to_taos(consumer)
+ test_to_taos_batch(consumer)
diff --git a/docs/examples/python/mockdatasource.py b/docs/examples/python/mockdatasource.py
index 1c516a800e..9c702936ea 100644
--- a/docs/examples/python/mockdatasource.py
+++ b/docs/examples/python/mockdatasource.py
@@ -10,13 +10,14 @@ class MockDataSource:
"9.4,118,0.141,California.SanFrancisco,4"
]
- def __init__(self, tb_name_prefix, table_count):
+ def __init__(self, tb_name_prefix, table_count, infinity=True):
self.table_name_prefix = tb_name_prefix + "_"
self.table_count = table_count
self.max_rows = 10000000
self.current_ts = round(time.time() * 1000) - self.max_rows * 100
# [(tableId, tableName, values),]
self.data = self._init_data()
+ self.infinity = infinity
def _init_data(self):
lines = self.samples * (self.table_count // 5 + 1)
@@ -28,14 +29,19 @@ class MockDataSource:
def __iter__(self):
self.row = 0
- return self
+ if not self.infinity:
+ return iter(self._iter_data())
+ else:
+ return self
def __next__(self):
"""
next 1000 rows for each table.
return: {tableId:[row,...]}
"""
- # generate 1000 timestamps
+ return self._iter_data()
+
+ def _iter_data(self):
ts = []
for _ in range(1000):
self.current_ts += 100
@@ -47,3 +53,9 @@ class MockDataSource:
rows = [table_name + ',' + t + ',' + values for t in ts]
result.append((table_id, rows))
return result
+
+
+if __name__ == '__main__':
+ datasource = MockDataSource('t', 10, False)
+ for data in datasource:
+ print(data)
diff --git a/docs/examples/python/sql_writer.py b/docs/examples/python/sql_writer.py
index 758167376b..3456981a7b 100644
--- a/docs/examples/python/sql_writer.py
+++ b/docs/examples/python/sql_writer.py
@@ -10,6 +10,7 @@ class SQLWriter:
self._tb_tags = {}
self._conn = get_connection_func()
self._max_sql_length = self.get_max_sql_length()
+ self._conn.execute("create database if not exists test")
self._conn.execute("USE test")
def get_max_sql_length(self):
@@ -20,7 +21,7 @@ class SQLWriter:
return int(r[1])
return 1024 * 1024
- def process_lines(self, lines: str):
+ def process_lines(self, lines: [str]):
"""
:param lines: [[tbName,ts,current,voltage,phase,location,groupId]]
"""
@@ -60,6 +61,7 @@ class SQLWriter:
buf.append(q)
sql_len += len(q)
sql += " ".join(buf)
+ self.create_tables()
self.execute_sql(sql)
self._tb_values.clear()
@@ -88,3 +90,22 @@ class SQLWriter:
except BaseException as e:
self.log.error("Execute SQL: %s", sql)
raise e
+
+ def close(self):
+ if self._conn:
+ self._conn.close()
+
+
+if __name__ == '__main__':
+ def get_connection_func():
+ conn = taos.connect()
+ return conn
+
+
+ writer = SQLWriter(get_connection_func=get_connection_func)
+ writer.execute_sql(
+ "create stable if not exists meters (ts timestamp, current float, voltage int, phase float) "
+ "tags (location binary(64), groupId int)")
+ writer.execute_sql(
+ "INSERT INTO d21001 USING meters TAGS ('California.SanFrancisco', 2) "
+ "VALUES ('2021-07-13 14:06:32.272', 10.2, 219, 0.32)")
diff --git a/docs/examples/python/tmq_example.py b/docs/examples/python/tmq_example.py
index fafa81e8b5..6f7fb87c89 100644
--- a/docs/examples/python/tmq_example.py
+++ b/docs/examples/python/tmq_example.py
@@ -19,8 +19,14 @@ def init_tmq_env(db, topic):
conn.execute("insert into tb3 values (now, 3, 3.0, 'tmq test')")
+def cleanup(db, topic):
+ conn = taos.connect()
+ conn.execute("drop topic if exists {}".format(topic))
+ conn.execute("drop database if exists {}".format(db))
+
+
if __name__ == '__main__':
- init_tmq_env("tmq_test", "tmq_test_topic") # init env
+ init_tmq_env("tmq_test", "tmq_test_topic") # init env
consumer = Consumer(
{
"group.id": "tg2",
@@ -33,9 +39,9 @@ if __name__ == '__main__':
try:
while True:
- res = consumer.poll(100)
+ res = consumer.poll(1)
if not res:
- continue
+ break
err = res.error()
if err is not None:
raise err
@@ -46,3 +52,4 @@ if __name__ == '__main__':
finally:
consumer.unsubscribe()
consumer.close()
+ cleanup("tmq_test", "tmq_test_topic")
diff --git a/docs/zh/08-connector/35-node.mdx b/docs/zh/08-connector/35-node.mdx
index 35c28e3b9f..f2aff41da2 100644
--- a/docs/zh/08-connector/35-node.mdx
+++ b/docs/zh/08-connector/35-node.mdx
@@ -62,6 +62,16 @@ REST 连接器支持所有能运行 Node.js 的平台。
- C 语言编译器,[GCC](https://gcc.gnu.org) v4.8.5 或更高版本
+
+
+
+- `python` (建议`v2.7` , `v3.x.x` 目前还不支持)
+- `@tdengine/client` 3.0.0 目前是只支持 Node.js v12.22.12 或 v12 的更高版本;其他版本可能存在包兼容性的问题
+- `make`
+- C 语言编译器,[GCC](https://gcc.gnu.org) v4.8.5 或更高版本
+
+
+
- 安装方法 1
diff --git a/docs/zh/12-taos-sql/02-database.md b/docs/zh/12-taos-sql/02-database.md
index 7d9566f4f2..b0a84af6dc 100644
--- a/docs/zh/12-taos-sql/02-database.md
+++ b/docs/zh/12-taos-sql/02-database.md
@@ -58,7 +58,7 @@ database_option: {
- WAL_FSYNC_PERIOD:当 WAL 参数设置为 2 时,落盘的周期。默认为 3000,单位毫秒。最小为 0,表示每次写入立即落盘;最大为 180000,即三分钟。
- MAXROWS:文件块中记录的最大条数,默认为 4096 条。
- MINROWS:文件块中记录的最小条数,默认为 100 条。
-- KEEP:表示数据文件保存的天数,缺省值为 3650,取值范围 [1, 365000],且必须大于或等于 DURATION 参数值。数据库会自动删除保存时间超过 KEEP 值的数据。KEEP 可以使用加单位的表示形式,如 KEEP 100h、KEEP 10d 等,支持 m(分钟)、h(小时)和 d(天)三个单位。也可以不写单位,如 KEEP 50,此时默认单位为天。
+- KEEP:表示数据文件保存的天数,缺省值为 3650,取值范围 [1, 365000],且必须大于或等于 DURATION 参数值。数据库会自动删除保存时间超过 KEEP 值的数据。KEEP 可以使用加单位的表示形式,如 KEEP 100h、KEEP 10d 等,支持 m(分钟)、h(小时)和 d(天)三个单位。也可以不写单位,如 KEEP 50,此时默认单位为天。企业版支持[多级存储](https://docs.taosdata.com/tdinternal/arch/#%E5%A4%9A%E7%BA%A7%E5%AD%98%E5%82%A8)功能, 因此, 可以设置多个保存时间(多个以英文逗号分隔,最多 3 个,满足 keep 0 <= keep 1 <= keep 2,如 KEEP 100h,100d,3650d); 社区版不支持多级存储功能(即使配置了多个保存时间, 也不会生效, KEEP 会取最大的保存时间)。
- PAGES:一个 VNODE 中元数据存储引擎的缓存页个数,默认为 256,最小 64。一个 VNODE 元数据存储占用 PAGESIZE \* PAGES,默认情况下为 1MB 内存。
- PAGESIZE:一个 VNODE 中元数据存储引擎的页大小,单位为 KB,默认为 4 KB。范围为 1 到 16384,即 1 KB 到 16 MB。
- PRECISION:数据库的时间戳精度。ms 表示毫秒,us 表示微秒,ns 表示纳秒,默认 ms 毫秒。
@@ -142,7 +142,7 @@ SHOW DATABASES;
### 显示一个数据库的创建语句
```
-SHOW CREATE DATABASE db_name;
+SHOW CREATE DATABASE db_name \G;
```
常用于数据库迁移。对一个已经存在的数据库,返回其创建语句;在另一个集群中执行该语句,就能得到一个设置完全相同的 Database。
@@ -150,7 +150,7 @@ SHOW CREATE DATABASE db_name;
### 查看数据库参数
```sql
-SELECT * FROM INFORMATION_SCHEMA.INS_DATABASES WHERE NAME='DBNAME' \G;
+SELECT * FROM INFORMATION_SCHEMA.INS_DATABASES WHERE NAME='db_name' \G;
```
会列出指定数据库的配置参数,并且每行只显示一个参数。
@@ -177,4 +177,4 @@ REDISTRIBUTE VGROUP vgroup_no DNODE dnode_id1 [DNODE dnode_id2] [DNODE dnode_id3
BALANCE VGROUP
```
-自动调整集群所有vgroup中的vnode分布,相当于在vnode级别对集群进行数据的负载均衡操作。
\ No newline at end of file
+自动调整集群所有vgroup中的vnode分布,相当于在vnode级别对集群进行数据的负载均衡操作。
diff --git a/docs/zh/12-taos-sql/05-insert.md b/docs/zh/12-taos-sql/05-insert.md
index ccb8f40b21..b72754b154 100644
--- a/docs/zh/12-taos-sql/05-insert.md
+++ b/docs/zh/12-taos-sql/05-insert.md
@@ -28,7 +28,7 @@ INSERT INTO tb_name [(field1_name, ...)] subquery
2. 时间戳不同的格式语法会有不同的精度影响。字符串格式的时间戳写法不受所在 DATABASE 的时间精度设置影响;而长整形格式的时间戳写法会受到所在 DATABASE 的时间精度设置影响。例如,时间戳"2021-07-13 16:16:48"的 UNIX 秒数为 1626164208。则其在毫秒精度下需要写作 1626164208000,在微秒精度设置下就需要写为 1626164208000000,纳秒精度设置下需要写为 1626164208000000000。
3. 一次插入多行数据时,不要把首列的时间戳的值都写 NOW。否则会导致语句中的多条记录使用相同的时间戳,于是就可能出现相互覆盖以致这些数据行无法全部被正确保存。其原因在于,NOW 函数在执行中会被解析为所在 SQL 语句的客户端执行时间,出现在同一语句中的多个 NOW 标记也就会被替换为完全相同的时间戳取值。
- 允许插入的最老记录的时间戳,是相对于当前服务器时间,减去配置的 KEEP 值(数据保留的天数)。允许插入的最新记录的时间戳,是相对于当前服务器时间,加上配置的 DURATION 值(数据文件存储数据的时间跨度,单位为天)。KEEP 和 DURATION 都是可以在创建数据库时指定的,缺省值分别是 3650 天和 10 天。
+ 允许插入的最老记录的时间戳,是相对于当前服务器时间,减去配置的 KEEP 值(数据保留的天数, 可以在创建数据库时指定,缺省值是 3650 天)。允许插入的最新记录的时间戳,取决于数据库的 PRECISION 值(时间戳精度, 可以在创建数据库时指定, ms 表示毫秒,us 表示微秒,ns 表示纳秒,默认毫秒):如果是毫秒或微秒, 取值为 1970 年 1 月 1 日 00:00:00.000 UTC 加上 1000 年, 即 2970 年 1 月 1 日 00:00:00.000 UTC; 如果是纳秒, 取值为 1970 年 1 月 1 日 00:00:00.000000000 UTC 加上 292 年, 即 2262 年 1 月 1 日 00:00:00.000000000 UTC。
**语法说明**
diff --git a/docs/zh/14-reference/12-config/index.md b/docs/zh/14-reference/12-config/index.md
index 3b9dbabd49..28b409de30 100644
--- a/docs/zh/14-reference/12-config/index.md
+++ b/docs/zh/14-reference/12-config/index.md
@@ -162,11 +162,7 @@ taos --dump-config
| 含义 | 查询语句的执行策略 |
| 单位 | 无 |
| 缺省值 | 1 |
-| 补充说明 | 1: 只使用 vnode,不使用 qnode |
-
-2: 没有扫描算子的子任务在 qnode 执行,带扫描算子的子任务在 vnode 执行
-
-3: vnode 只运行扫描算子,其余算子均在 qnode 执行 |
+| 补充说明 | 1: 只使用 vnode,不使用 qnode; 2: 没有扫描算子的子任务在 qnode 执行,带扫描算子的子任务在 vnode 执行; 3: vnode 只运行扫描算子,其余算子均在 qnode 执行 |
### querySmaOptimize
@@ -176,11 +172,7 @@ taos --dump-config
| 含义 | sma index 的优化策略 |
| 单位 | 无 |
| 缺省值 | 0 |
-| 补充说明 |
-
-0: 表示不使用 sma index,永远从原始数据进行查询
-
-1: 表示使用 sma index,对符合的语句,直接从预计算的结果进行查询 |
+| 补充说明 |0: 表示不使用 sma index,永远从原始数据进行查询; 1: 表示使用 sma index,对符合的语句,直接从预计算的结果进行查询 |
### maxNumOfDistinctRes
@@ -323,6 +315,7 @@ charset 的有效值是 UTF-8。
| 适用范围 | 仅服务端适用 |
| 含义 | 数据文件目录,所有的数据文件都将写入该目录 |
| 缺省值 | /var/lib/taos |
+| 补充说明 | [多级存储](https://docs.taosdata.com/tdinternal/arch/#%E5%A4%9A%E7%BA%A7%E5%AD%98%E5%82%A8) 功能需要与 [KEEP](https://docs.taosdata.com/taos-sql/database/#%E5%8F%82%E6%95%B0%E8%AF%B4%E6%98%8E) 参数配合使用 |
### tempDir
@@ -388,7 +381,7 @@ charset 的有效值是 UTF-8。
| 属性 | 说明 |
| -------- | -------------------------------------------- |
| 适用范围 | 服务端和客户端均适用 |
-| 含义 | 当日志文件夹的磁盘大小小于该值时,停止写日志 |
+| 含义 | 当日志文件夹所在磁盘可用空间大小小于该值时,停止写日志 |
| 单位 | GB |
| 缺省值 | 1.0 |
diff --git a/examples/nodejs/node-example-raw.js b/examples/nodejs/node-example-raw.js
deleted file mode 100644
index 058a50c4c3..0000000000
--- a/examples/nodejs/node-example-raw.js
+++ /dev/null
@@ -1,135 +0,0 @@
-/* This example is to show how to use the td-connector through the cursor only and is a bit more raw.
- * No promises, object wrappers around data, functions that prettify the data, or anything.
- * The cursor will generally use callback functions over promises, and return and store the raw data from the C Interface.
- * It is advised to use the td-connector through the cursor and the TaosQuery class amongst other higher level APIs.
-*/
-
-// Get the td-connector package
-const taos = require('td2.0-connector');
-
-/* We will connect to TDengine by passing an object comprised of connection options to taos.connect and store the
- * connection to the variable conn
- */
-/*
- * Connection Options
- * host: the host to connect to
- * user: the use to login as
- * password: the password for the above user to login
- * config: the location of the taos.cfg file, by default it is in /etc/taos
- * port: the port we connect through
- */
-var conn = taos.connect({host:"127.0.0.1", user:"root", password:"taosdata", config:"/etc/taos",port:0});
-
-// Initialize our TDengineCursor, which we use to interact with TDengine
-var c1 = conn.cursor();
-
-// c1.execute(query) will execute the query
-// Let's create a database named db
-try {
- c1.execute('create database if not exists db;');
-}
-catch(err) {
- conn.close();
- throw err;
-}
-
-// Now we will use database db
-try {
- c1.execute('use db;');
-}
-catch (err) {
- conn.close();
- throw err;
-}
-
-// Let's create a table called weather
-// which stores some weather data like humidity, AQI (air quality index), temperature, and some notes as text
-try {
- c1.execute('create table if not exists weather (ts timestamp, humidity smallint, aqi int, temperature float, notes binary(30));');
-}
-catch (err) {
- conn.close();
- throw err;
-}
-
-// Let's get the description of the table weather
-try {
- c1.execute('describe db.weather');
-}
-catch (err) {
- conn.close();
- throw err;
-}
-
-// To get results, we run the function c1.fetchall()
-// It only returns the query results as an array of result rows, but also stores the latest results in c1.data
-try {
- var tableDesc = c1.fetchall(); // The description variable here is equal to c1.data;
- console.log(tableDesc);
-}
-catch (err) {
- conn.close();
- throw err;
-}
-
-// Let's try to insert some random generated data to test with
-
-let stime = new Date();
-let interval = 1000;
-
-// Timestamps must be in the form of "YYYY-MM-DD HH:MM:SS.MMM" if they are in milliseconds
-// "YYYY-MM-DD HH:MM:SS.MMMMMM" if they are in microseconds
-// Thus, we create the following function to convert a javascript Date object to the correct formatting
-function convertDateToTS(date) {
- let tsArr = date.toISOString().split("T")
- return "\"" + tsArr[0] + " " + tsArr[1].substring(0, tsArr[1].length-1) + "\"";
-}
-
-try {
- for (let i = 0; i < 10000; i++) {
- stime.setMilliseconds(stime.getMilliseconds() + interval);
- let insertData = [convertDateToTS(stime),
- parseInt(Math.random()*100),
- parseInt(Math.random()*300),
- parseFloat(Math.random()*10 + 30),
- "\"random note!\""];
- c1.execute('insert into db.weather values(' + insertData.join(',') + ' );');
- }
-}
-catch (err) {
- conn.close();
- throw err;
-}
-
-// Now let's look at our newly inserted data
-var retrievedData;
-try {
- c1.execute('select * from db.weather;')
- retrievedData = c1.fetchall();
-
- // c1.fields stores the names of each column retrieved
- console.log(c1.fields);
- console.log(retrievedData);
- // timestamps retrieved are always JS Date Objects
- // Numbers are numbers, big ints are big ints, and strings are strings
-}
-catch (err) {
- conn.close();
- throw err;
-}
-
-// Let's try running some basic functions
-try {
- c1.execute('select count(*), avg(temperature), max(temperature), min(temperature), stddev(temperature) from db.weather;')
- c1.fetchall();
- console.log(c1.fields);
- console.log(c1.data);
-}
-catch(err) {
- conn.close();
- throw err;
-}
-
-conn.close();
-
-// Feel free to fork this repository or copy this code and start developing your own apps and backends with NodeJS and TDengine!
diff --git a/examples/nodejs/node-example.js b/examples/nodejs/node-example.js
deleted file mode 100644
index bfdd9e49a0..0000000000
--- a/examples/nodejs/node-example.js
+++ /dev/null
@@ -1,153 +0,0 @@
-/* This example is to show the preferred way to use the td-connector */
-/* To run, enter node path/to/node-example.js */
-// Get the td-connector package
-const taos = require('td2.0-connector');
-
-/* We will connect to TDengine by passing an object comprised of connection options to taos.connect and store the
- * connection to the variable conn
- */
-/*
- * Connection Options
- * host: the host to connect to
- * user: the use to login as
- * password: the password for the above user to login
- * config: the location of the taos.cfg file, by default it is in /etc/taos
- * port: the port we connect through
- */
-var conn = taos.connect({host:"127.0.0.1", user:"root", password:"taosdata", config:"/etc/taos",port:0});
-
-// Initialize our TDengineCursor, which we use to interact with TDengine
-var c1 = conn.cursor();
-
-// c1.query(query) will return a TaosQuery object, of which then we can execute. The execute function then returns a promise
-// Let's create a database named db
-try {
- c1.execute('create database if not exists db;');
- //var query = c1.query('create database if not exists db;');
- //query.execute();
-}
-catch(err) {
- conn.close();
- throw err;
-}
-
-// Now we will use database db. As this query won't return any results,
-// we can simplify the code and directly use the c1.execute() function. No need for a TaosQuery object to wrap around the query
-try {
- c1.execute('use db;');
-}
-catch (err) {
- conn.close();
- throw err;
-}
-
-// Let's create a table called weather
-// which stores some weather data like humidity, AQI (air quality index), temperature, and some notes as text
-// We can also immedietely execute a TaosQuery object by passing true as the secodn argument
-// This will then return a promise that we can then attach a callback function to
-try {
- var promise = c1.query('create table if not exists weather (ts timestamp, humidity smallint, aqi int, temperature float, notes binary(30));', true);
- promise.then(function(){
- console.log("Table created!");
- }).catch(function() {
- console.log("Table couldn't be created.")
- });
-}
-catch (err) {
- conn.close();
- throw err;
-}
-
-// Let's get the description of the table weather
-// When using a TaosQuery object and then executing it, upon success it returns a TaosResult object, which is a wrapper around the
-// retrieved data and allows us to easily access data and manipulate or display it.
-try {
- c1.query('describe db.weather;').execute().then(function(result){
- // Result is an instance of TaosResult and has the function pretty() which instantly logs a prettified version to the console
- result.pretty();
- });
-}
-catch (err) {
- conn.close();
- throw err;
-}
-
-
-Date.prototype.Format = function(fmt){
- var o = {
- 'M+': this.getMonth() + 1,
- 'd+': this.getDate(),
- 'H+': this.getHours(),
- 'm+': this.getMinutes(),
- 's+': this.getSeconds(),
- 'S+': this.getMilliseconds()
- };
- if (/(y+)/.test(fmt)) {
- fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length));
- }
- for (var k in o) {
- if (new RegExp('(' + k + ')').test(fmt)) {
- fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (('00' + o[k]).substr(String(o[k]).length)));
- }
- }
- return fmt;
-}
-
-
-// Let's try to insert some random generated data to test with
-// We will use the bind function of the TaosQuery object to easily bind values to question marks in the query
-// For Timestamps, a normal Datetime object or TaosTimestamp or milliseconds can be passed in through the bind function
-let stime = new Date();
-let interval = 1000;
-try {
- for (let i = 0; i < 1000; i++) {
- stime.setMilliseconds(stime.getMilliseconds() + interval);
-
- //console.log(stime.Format('yyyy-MM-dd HH:mm:ss.SSS'));
-
- let insertData = [stime,
- parseInt(Math.random()*100),
- parseInt(Math.random()*300),
- parseFloat(Math.random()*10 + 30),
- "Note"];
- //c1.execute('insert into db.weather values(' + insertData.join(',') + ' );');
-
- //var query = c1.query('insert into db.weather values(?, ?, ?, ?, ?);').bind(insertData);
- //query.execute();
- c1.execute('insert into db.weather values(\"'+stime.Format('yyyy-MM-dd HH:mm:ss.SSS')+'\",'+parseInt(Math.random() * 100)+','+parseInt(Math.random() * 300)+','+parseFloat(Math.random()*10 + 30)+',"Note");');
- }
-}catch (err) {
- conn.close();
- throw err;
-}
-
-// Now let's look at our newly inserted data
-var retrievedData;
-try {
- c1.query('select * from db.weather limit 5 offset 100;', true).then(function(result){
- //result.pretty();
- console.log('=========>'+JSON.stringify(result));
- // Neat!
- });
-
-}
-catch (err) {
- conn.close();
- throw err;
-}
-
-// Let's try running some basic functions
-try {
- c1.query('select count(*), avg(temperature), max(temperature), min(temperature), stddev(temperature) from db.weather;', true)
- .then(function(result) {
- result.pretty();
- })
-}
-catch(err) {
- conn.close();
- throw err;
-}
-
-conn.close();
-
-// Feel free to fork this repository or copy this code and start developing your own apps and backends with NodeJS and TDengine!
diff --git a/examples/nodejs/nodejsChecker.js b/examples/nodejs/nodejsChecker.js
index e634a54ea1..58b27dad67 100644
--- a/examples/nodejs/nodejsChecker.js
+++ b/examples/nodejs/nodejsChecker.js
@@ -1,29 +1,27 @@
-const taos = require('td2.0-connector');
-//const taos = require('../../../src/connector/nodejs/');
-
+const taos = require("@tdengine/client");
var host = null;
var port = 6030;
for(var i = 2; i < global.process.argv.length; i++){
- var key = global.process.argv[i].split("=")[0];
- var value = global.process.argv[i].split("=")[1];
-
- if("host" == key){
- host = value;
- }
- if("port" == key){
- port = value;
- }
+ var key = global.process.argv[i].split("=")[0];
+ var value = global.process.argv[i].split("=")[1];
+
+ if("host" == key){
+ host = value;
+ }
+ if("port" == key){
+ port = value;
+ }
}
if(host == null){
- console.log("Usage: node nodejsChecker.js host= port=");
- process.exit(0);
+ console.log("Usage: node nodejsChecker.js host= port=");
+ process.exit(0);
}
// establish connection
var conn = taos.connect({host:host, user:"root", password:"taosdata",port:port});
-var cursor = conn.cursor();
+var cursor = conn.cursor();
// create database
executeSql("create database if not exists test", 0);
// use db
@@ -40,22 +38,22 @@ executeQuery("select * from test.weather");
conn.close();
function executeQuery(sql){
- var start = new Date().getTime();
- var promise = cursor.query(sql, true);
- var end = new Date().getTime();
- promise.then(function(result){
- printSql(sql, result != null,(end - start));
- result.pretty();
- });
+ var start = new Date().getTime();
+ var promise = cursor.query(sql, true);
+ var end = new Date().getTime();
+ promise.then(function(result){
+ printSql(sql, result != null,(end - start));
+ result.pretty();
+ });
}
function executeSql(sql, affectRows){
- var start = new Date().getTime();
- var promise = cursor.execute(sql);
- var end = new Date().getTime();
- printSql(sql, promise == affectRows, (end - start));
+ var start = new Date().getTime();
+ var promise = cursor.execute(sql);
+ var end = new Date().getTime();
+ printSql(sql, promise == affectRows, (end - start));
}
function printSql(sql, succeed, cost){
- console.log("[ "+(succeed ? "OK" : "ERROR!")+" ] time cost: " + cost + " ms, execute statement ====> " + sql);
-}
+ console.log("[ "+(succeed ? "OK" : "ERROR!")+" ] time cost: " + cost + " ms, execute statement ====> " + sql);
+}
\ No newline at end of file
diff --git a/examples/nodejs/test1970.js b/examples/nodejs/test1970.js
deleted file mode 100644
index 5177a7371e..0000000000
--- a/examples/nodejs/test1970.js
+++ /dev/null
@@ -1,125 +0,0 @@
-const taos = require('td2.0-connector');
-var conn = taos.connect({host:"127.0.0.1", user:"root", password:"taosdata", config:"/etc/taos",port:0})
-var c1 = conn.cursor(); // Initializing a new cursor
-
-let stime = new Date();
-let interval = 1000;
-
-function convertDateToTS(date) {
- let tsArr = date.toISOString().split("T")
- return "\"" + tsArr[0] + " " + tsArr[1].substring(0, tsArr[1].length - 1) + "\"";
-}
-
-function R(l, r) {
- return Math.random() * (r - l) - r;
-}
-
-function randomBool() {
- if (Math.random() < 0.5) {
- return true;
- }
- return false;
-}
-
-// Initialize
-const dbname = "nodejs_1970_db";
-const tbname = "t1";
-
-let dropDB = "drop database if exists " + dbname
-console.log(dropDB);//asdasdasd
-c1.execute(dropDB);///asdasd
-
-let createDB = "create database " + dbname + " keep 36500"
-console.log(createDB);
-c1.execute(createDB);
-
-let useTbl = "use " + dbname
-console.log(useTbl)
-c1.execute(useTbl);
-
-let createTbl = "create table if not exists " + tbname + "(ts timestamp,id int)"
-console.log(createTbl);
-c1.execute(createTbl);
-
-//1969-12-31 23:59:59.999
-//1970-01-01 00:00:00.000
-//1970-01-01 07:59:59.999
-//1970-01-01 08:00:00.000a
-//1628928479484 2021-08-14 08:07:59.484
-let sql1 = "insert into " + dbname + "." + tbname + " values('1969-12-31 23:59:59.999',1)"
-console.log(sql1);
-c1.execute(sql1);
-
-let sql2 = "insert into " + dbname + "." + tbname + " values('1970-01-01 00:00:00.000',2)"
-console.log(sql2);
-c1.execute(sql2);
-
-let sql3 = "insert into " + dbname + "." + tbname + " values('1970-01-01 07:59:59.999',3)"
-console.log(sql3);
-c1.execute(sql3);
-
-let sql4 = "insert into " + dbname + "." + tbname + " values('1970-01-01 08:00:00.000',4)"
-console.log(sql4);
-c1.execute(sql4);
-
-let sql5 = "insert into " + dbname + "." + tbname + " values('2021-08-14 08:07:59.484',5)"
-console.log(sql5);
-c1.execute(sql5);
-
-// Select
-let query1 = "select * from " + dbname + "." + tbname
-console.log(query1);
-c1.execute(query1);
-
-var d = c1.fetchall();
-console.log(c1.fields);
-for (let i = 0; i < d.length; i++)
- console.log(d[i][0].valueOf());
-
-//initialize
-let initSql1 = "drop table if exists " + tbname
-console.log(initSql1);
-c1.execute(initSql1);
-
-console.log(createTbl);
-c1.execute(createTbl);
-c1.execute(useTbl)
-
-//-28800001 1969-12-31 23:59:59.999
-//-28800000 1970-01-01 00:00:00.000
-//-1 1970-01-01 07:59:59.999
-//0 1970-01-01 08:00:00.00
-//1628928479484 2021-08-14 08:07:59.484
-let sql11 = "insert into " + dbname + "." + tbname + " values(-28800001,11)";
-console.log(sql11);
-c1.execute(sql11);
-
-let sql12 = "insert into " + dbname + "." + tbname + " values(-28800000,12)"
-console.log(sql12);
-c1.execute(sql12);
-
-let sql13 = "insert into " + dbname + "." + tbname + " values(-1,13)"
-console.log(sql13);
-c1.execute(sql13);
-
-let sql14 = "insert into " + dbname + "." + tbname + " values(0,14)"
-console.log(sql14);
-c1.execute(sql14);
-
-let sql15 = "insert into " + dbname + "." + tbname + " values(1628928479484,15)"
-console.log(sql15);
-c1.execute(sql15);
-
-// Select
-console.log(query1);
-c1.execute(query1);
-
-var d = c1.fetchall();
-console.log(c1.fields);
-for (let i = 0; i < d.length; i++)
- console.log(d[i][0].valueOf());
-
-setTimeout(function () {
- conn.close();
-}, 2000);
-
diff --git a/include/common/tdataformat.h b/include/common/tdataformat.h
index e0aacbfec9..b5971d8a9e 100644
--- a/include/common/tdataformat.h
+++ b/include/common/tdataformat.h
@@ -146,9 +146,9 @@ extern void (*tColDataCalcSMA[])(SColData *pColData, int64_t *sum, int64_t *max,
int32_t tColDataAddValueByBind(SColData *pColData, TAOS_MULTI_BIND *pBind);
void tColDataSortMerge(SArray *colDataArr);
-//for raw block
-int32_t tColDataAddValueByDataBlock(SColData *pColData, int8_t type, int32_t bytes,
- int32_t nRows, char* lengthOrbitmap, char *data);
+// for raw block
+int32_t tColDataAddValueByDataBlock(SColData *pColData, int8_t type, int32_t bytes, int32_t nRows, char *lengthOrbitmap,
+ char *data);
// for encode/decode
int32_t tPutColData(uint8_t *pBuf, SColData *pColData);
int32_t tGetColData(uint8_t *pBuf, SColData *pColData);
@@ -261,7 +261,13 @@ struct STag {
// STSchema ================================
STSchema *tBuildTSchema(SSchema *aSchema, int32_t numOfCols, int32_t version);
-void tDestroyTSchema(STSchema *pTSchema);
+#define tDestroyTSchema(pTSchema) \
+ do { \
+ if (pTSchema) { \
+ taosMemoryFree(pTSchema); \
+ pTSchema = NULL; \
+ } \
+ } while (0)
#endif
diff --git a/include/common/tmsg.h b/include/common/tmsg.h
index caf67ee3a9..c0e8cbae49 100644
--- a/include/common/tmsg.h
+++ b/include/common/tmsg.h
@@ -1279,6 +1279,25 @@ typedef struct {
int32_t tSerializeSAlterVnodeReplicaReq(void* buf, int32_t bufLen, SAlterVnodeReplicaReq* pReq);
int32_t tDeserializeSAlterVnodeReplicaReq(void* buf, int32_t bufLen, SAlterVnodeReplicaReq* pReq);
+typedef struct {
+ int32_t vgId;
+ int8_t disable;
+} SDisableVnodeWriteReq;
+
+int32_t tSerializeSDisableVnodeWriteReq(void* buf, int32_t bufLen, SDisableVnodeWriteReq* pReq);
+int32_t tDeserializeSDisableVnodeWriteReq(void* buf, int32_t bufLen, SDisableVnodeWriteReq* pReq);
+
+typedef struct {
+ int32_t srcVgId;
+ int32_t dstVgId;
+ uint32_t hashBegin;
+ uint32_t hashEnd;
+ int64_t reserved;
+} SAlterVnodeHashRangeReq;
+
+int32_t tSerializeSAlterVnodeHashRangeReq(void* buf, int32_t bufLen, SAlterVnodeHashRangeReq* pReq);
+int32_t tDeserializeSAlterVnodeHashRangeReq(void* buf, int32_t bufLen, SAlterVnodeHashRangeReq* pReq);
+
typedef struct {
SMsgHead header;
char dbFName[TSDB_DB_FNAME_LEN];
diff --git a/include/common/tmsgdef.h b/include/common/tmsgdef.h
index 7833bdf139..44ee26ef24 100644
--- a/include/common/tmsgdef.h
+++ b/include/common/tmsgdef.h
@@ -220,6 +220,7 @@ enum {
TD_DEF_MSG_TYPE(TDMT_VND_DROP_TTL_TABLE, "vnode-drop-ttl-stb", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_VND_TRIM, "vnode-trim", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_VND_COMMIT, "vnode-commit", NULL, NULL)
+ TD_DEF_MSG_TYPE(TDMT_VND_DISABLE_WRITE, "vnode-disable-write", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_VND_MAX_MSG, "vnd-max", NULL, NULL)
TD_NEW_MSG_SEG(TDMT_SCH_MSG)
diff --git a/include/libs/parser/parser.h b/include/libs/parser/parser.h
index 8f22745973..51b285cddd 100644
--- a/include/libs/parser/parser.h
+++ b/include/libs/parser/parser.h
@@ -86,10 +86,11 @@ void qCleanupKeywordsTable();
int32_t qBuildStmtOutput(SQuery* pQuery, SHashObj* pVgHash, SHashObj* pBlockHash);
int32_t qResetStmtDataBlock(STableDataCxt* block, bool keepBuf);
int32_t qCloneStmtDataBlock(STableDataCxt** pDst, STableDataCxt* pSrc, bool reset);
-int32_t qRebuildStmtDataBlock(STableDataCxt** pDst, STableDataCxt* pSrc, uint64_t uid, uint64_t suid, int32_t vgId, bool rebuildCreateTb);
+int32_t qRebuildStmtDataBlock(STableDataCxt** pDst, STableDataCxt* pSrc, uint64_t uid, uint64_t suid, int32_t vgId,
+ bool rebuildCreateTb);
void qDestroyStmtDataBlock(STableDataCxt* pBlock);
STableMeta* qGetTableMetaInDataBlock(STableDataCxt* pDataBlock);
-int32_t qCloneCurrentTbData(STableDataCxt* pDataBlock, SSubmitTbData **pData);
+int32_t qCloneCurrentTbData(STableDataCxt* pDataBlock, SSubmitTbData** pData);
int32_t qStmtBindParams(SQuery* pQuery, TAOS_MULTI_BIND* pParams, int32_t colIdx);
int32_t qStmtParseQuerySql(SParseContext* pCxt, SQuery* pQuery);
@@ -104,18 +105,20 @@ void destroyBoundColumnInfo(void* pBoundInfo);
int32_t qCreateSName(SName* pName, const char* pTableName, int32_t acctId, char* dbName, char* msgBuf,
int32_t msgBufLen);
-void qDestroyBoundColInfo(void* pInfo);
+void qDestroyBoundColInfo(void* pInfo);
-SQuery* smlInitHandle();
-int32_t smlBuildRow(STableDataCxt* pTableCxt);
-int32_t smlBuildCol(STableDataCxt* pTableCxt, SSchema* schema, void *kv, int32_t index);
+SQuery* smlInitHandle();
+int32_t smlBuildRow(STableDataCxt* pTableCxt);
+int32_t smlBuildCol(STableDataCxt* pTableCxt, SSchema* schema, void* kv, int32_t index);
STableDataCxt* smlInitTableDataCtx(SQuery* query, STableMeta* pTableMeta);
-int32_t smlBindData(SQuery* handle, bool dataFormat, SArray* tags, SArray* colsSchema, SArray* cols, STableMeta* pTableMeta,
- char* tableName, const char* sTableName, int32_t sTableNameLen, int32_t ttl, char* msgBuf, int16_t msgBufLen);
+int32_t smlBindData(SQuery* handle, bool dataFormat, SArray* tags, SArray* colsSchema, SArray* cols,
+ STableMeta* pTableMeta, char* tableName, const char* sTableName, int32_t sTableNameLen, int32_t ttl,
+ char* msgBuf, int16_t msgBufLen);
int32_t smlBuildOutput(SQuery* handle, SHashObj* pVgHash);
-int rawBlockBindData(SQuery *query, STableMeta* pTableMeta, void* data, SVCreateTbReq* pCreateTb, TAOS_FIELD *fields, int numFields);
+int rawBlockBindData(SQuery* query, STableMeta* pTableMeta, void* data, SVCreateTbReq* pCreateTb, TAOS_FIELD* fields,
+ int numFields);
int32_t rewriteToVnodeModifyOpStmt(SQuery* pQuery, SArray* pBufArray);
SArray* serializeVgroupsCreateTableBatch(SHashObj* pVgroupHashmap);
diff --git a/include/libs/tfs/tfs.h b/include/libs/tfs/tfs.h
index 3af75e0eaf..cbf1d60e35 100644
--- a/include/libs/tfs/tfs.h
+++ b/include/libs/tfs/tfs.h
@@ -150,7 +150,7 @@ int32_t tfsRmdir(STfs *pTfs, const char *rname);
* @param nrname The rel name of new file.
* @return int32_t 0 for success, -1 for failure.
*/
-int32_t tfsRename(STfs *pTfs, char *orname, char *nrname);
+int32_t tfsRename(STfs *pTfs, const char *orname, const char *nrname);
/**
* @brief Init file object in tfs.
diff --git a/include/libs/wal/wal.h b/include/libs/wal/wal.h
index a1ae1e429d..a0f421212a 100644
--- a/include/libs/wal/wal.h
+++ b/include/libs/wal/wal.h
@@ -201,6 +201,7 @@ int32_t walFetchHead(SWalReader *pRead, int64_t ver, SWalCkHead *pHead);
int32_t walFetchBody(SWalReader *pRead, SWalCkHead **ppHead);
int32_t walSkipFetchBody(SWalReader *pRead, const SWalCkHead *pHead);
+SWalRef *walRefFirstVer(SWal *, SWalRef *);
SWalRef *walRefCommittedVer(SWal *);
SWalRef *walOpenRef(SWal *);
diff --git a/packaging/tools/install.sh b/packaging/tools/install.sh
index 4be179b04d..dfdbaa6fdd 100755
--- a/packaging/tools/install.sh
+++ b/packaging/tools/install.sh
@@ -210,8 +210,8 @@ function install_bin() {
[ -x ${install_main_dir}/bin/${serverName} ] && ${csudo}ln -s ${install_main_dir}/bin/${serverName} ${bin_link_dir}/${serverName} || :
[ -x ${install_main_dir}/bin/${udfdName} ] && ${csudo}ln -s ${install_main_dir}/bin/${udfdName} ${bin_link_dir}/${udfdName} || :
[ -x ${install_main_dir}/bin/${adapterName} ] && ${csudo}ln -s ${install_main_dir}/bin/${adapterName} ${bin_link_dir}/${adapterName} || :
- [ -x ${install_main_dir}/bin/${benchmarkName} ] && ${csudo}ln -s ${install_main_dir}/bin/${benchmarkName} ${bin_link_dir}/${demoName} || :
- [ -x ${install_main_dir}/bin/${benchmarkName} ] && ${csudo}ln -s ${install_main_dir}/bin/${benchmarkName} ${bin_link_dir}/${benchmarkName} || :
+ [ -x ${install_main_dir}/bin/${benchmarkName} ] && ${csudo}ln -sf ${install_main_dir}/bin/${benchmarkName} ${bin_link_dir}/${demoName} || :
+ [ -x ${install_main_dir}/bin/${benchmarkName} ] && ${csudo}ln -sf ${install_main_dir}/bin/${benchmarkName} ${bin_link_dir}/${benchmarkName} || :
[ -x ${install_main_dir}/bin/${dumpName} ] && ${csudo}ln -s ${install_main_dir}/bin/${dumpName} ${bin_link_dir}/${dumpName} || :
[ -x ${install_main_dir}/bin/${xname} ] && ${csudo}ln -s ${install_main_dir}/bin/${xname} ${bin_link_dir}/${xname} || :
[ -x ${install_main_dir}/bin/TDinsight.sh ] && ${csudo}ln -s ${install_main_dir}/bin/TDinsight.sh ${bin_link_dir}/TDinsight.sh || :
@@ -746,7 +746,7 @@ function is_version_compatible() {
deb_erase() {
confirm=""
while [ "" == "${confirm}" ]; do
- echo -e -n "${RED}Exist tdengine deb detected, do you want to remove it? [yes|no] ${NC}:"
+ echo -e -n "${RED}Existing TDengine deb is detected, do you want to remove it? [yes|no] ${NC}:"
read confirm
if [ "yes" == "$confirm" ]; then
${csudo}dpkg --remove tdengine ||:
@@ -760,7 +760,7 @@ deb_erase() {
rpm_erase() {
confirm=""
while [ "" == "${confirm}" ]; do
- echo -e -n "${RED}Exist tdengine rpm detected, do you want to remove it? [yes|no] ${NC}:"
+ echo -e -n "${RED}Existing TDengine rpm is detected, do you want to remove it? [yes|no] ${NC}:"
read confirm
if [ "yes" == "$confirm" ]; then
${csudo}rpm -e tdengine ||:
@@ -787,7 +787,7 @@ function updateProduct() {
if echo $osinfo | grep -qwi "centos"; then
rpm -q tdengine 2>&1 > /dev/null && rpm_erase tdengine ||:
elif echo $osinfo | grep -qwi "ubuntu"; then
- dpkg -l tdengine 2>&1 > /dev/null && deb_erase tdengine ||:
+ dpkg -l tdengine 2>&1 | grep ii > /dev/null && deb_erase tdengine ||:
fi
tar -zxf ${tarName}
diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c
index fbab1ee08b..2b79fc7388 100644
--- a/source/client/src/clientEnv.c
+++ b/source/client/src/clientEnv.c
@@ -23,12 +23,12 @@
#include "scheduler.h"
#include "tcache.h"
#include "tglobal.h"
+#include "thttp.h"
#include "tmsg.h"
#include "tref.h"
#include "trpc.h"
#include "tsched.h"
#include "ttime.h"
-#include "thttp.h"
#define TSC_VAR_NOT_RELEASE 1
#define TSC_VAR_RELEASED 0
@@ -65,7 +65,7 @@ static int32_t registerRequest(SRequestObj *pRequest, STscObj *pTscObj) {
static void deregisterRequest(SRequestObj *pRequest) {
const static int64_t SLOW_QUERY_INTERVAL = 3000000L; // todo configurable
- if(pRequest == NULL){
+ if (pRequest == NULL) {
tscError("pRequest == NULL");
return;
}
@@ -380,9 +380,9 @@ void doDestroyRequest(void *p) {
}
if (pRequest->syncQuery) {
- if (pRequest->body.param){
- tsem_destroy(&((SSyncQueryParam*)pRequest->body.param)->sem);
- }
+ if (pRequest->body.param) {
+ tsem_destroy(&((SSyncQueryParam *)pRequest->body.param)->sem);
+ }
taosMemoryFree(pRequest->body.param);
}
@@ -406,20 +406,20 @@ static void *tscCrashReportThreadFp(void *param) {
setThreadName("client-crashReport");
char filepath[PATH_MAX] = {0};
snprintf(filepath, sizeof(filepath), "%s%s.taosCrashLog", tsLogDir, TD_DIRSEP);
- char *pMsg = NULL;
- int64_t msgLen = 0;
+ char *pMsg = NULL;
+ int64_t msgLen = 0;
TdFilePtr pFile = NULL;
- bool truncateFile = false;
- int32_t sleepTime = 200;
- int32_t reportPeriodNum = 3600 * 1000 / sleepTime;
- int32_t loopTimes = reportPeriodNum;
+ bool truncateFile = false;
+ int32_t sleepTime = 200;
+ int32_t reportPeriodNum = 3600 * 1000 / sleepTime;
+ int32_t loopTimes = reportPeriodNum;
#ifdef WINDOWS
if (taosCheckCurrentInDll()) {
atexit(crashReportThreadFuncUnexpectedStopped);
}
#endif
-
+
while (1) {
if (clientStop) break;
if (loopTimes++ < reportPeriodNum) {
@@ -449,12 +449,12 @@ static void *tscCrashReportThreadFp(void *param) {
pMsg = NULL;
continue;
}
-
+
if (pFile) {
taosReleaseCrashLogFile(pFile, truncateFile);
truncateFile = false;
}
-
+
taosMsleep(sleepTime);
loopTimes = 0;
}
@@ -467,11 +467,11 @@ int32_t tscCrashReportInit() {
if (!tsEnableCrashReport) {
return 0;
}
-
+
TdThreadAttr thAttr;
taosThreadAttrInit(&thAttr);
taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE);
- TdThread crashReportThread;
+ TdThread crashReportThread;
if (taosThreadCreate(&crashReportThread, &thAttr, tscCrashReportThreadFp, NULL) != 0) {
tscError("failed to create crashReport thread since %s", strerror(errno));
return -1;
@@ -496,26 +496,24 @@ void tscStopCrashReport() {
}
}
-
void tscWriteCrashInfo(int signum, void *sigInfo, void *context) {
- char *pMsg = NULL;
+ char *pMsg = NULL;
const char *flags = "UTL FATAL ";
ELogLevel level = DEBUG_FATAL;
int32_t dflag = 255;
- int64_t msgLen= -1;
+ int64_t msgLen = -1;
if (tsEnableCrashReport) {
if (taosGenCrashJsonMsg(signum, &pMsg, lastClusterId, appInfo.startTime)) {
taosPrintLog(flags, level, dflag, "failed to generate crash json msg");
} else {
- msgLen = strlen(pMsg);
+ msgLen = strlen(pMsg);
}
}
taosLogCrashInfo("taos", pMsg, msgLen, signum, sigInfo);
}
-
void taos_init_imp(void) {
// In the APIs of other program language, taos_cleanup is not available yet.
// So, to make sure taos_cleanup will be invoked to clean up the allocated resource to suppress the valgrind warning.
@@ -570,7 +568,7 @@ void taos_init_imp(void) {
taosThreadMutexInit(&appInfo.mutex, NULL);
tscCrashReportInit();
-
+
tscDebug("client is initialized successfully");
}
@@ -621,6 +619,9 @@ int taos_options_imp(TSDB_OPTION option, const char *str) {
tscError("failed to set cfg:%s to %s since %s", pItem->name, str, terrstr());
} else {
tscInfo("set cfg:%s to %s", pItem->name, str);
+ if (TSDB_OPTION_SHELL_ACTIVITY_TIMER == option || TSDB_OPTION_USE_ADAPTER == option) {
+ code = taosSetCfg(pCfg, pItem->name);
+ }
}
return code;
diff --git a/source/client/src/clientStmt.c b/source/client/src/clientStmt.c
index f5b65371a7..3ed157efef 100644
--- a/source/client/src/clientStmt.c
+++ b/source/client/src/clientStmt.c
@@ -393,7 +393,7 @@ int32_t stmtGetFromCache(STscStmt* pStmt) {
if (NULL == pStmt->sql.pTableCache || taosHashGetSize(pStmt->sql.pTableCache) <= 0) {
if (pStmt->bInfo.inExecCache) {
- if(ASSERT(taosHashGetSize(pStmt->exec.pBlockHash) == 1)){
+ if (ASSERT(taosHashGetSize(pStmt->exec.pBlockHash) == 1)) {
tscError("stmtGetFromCache error");
return TSDB_CODE_TSC_STMT_CACHE_ERROR;
}
diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c
index 01c99c6e9e..96f18e5fb6 100644
--- a/source/client/src/clientTmq.c
+++ b/source/client/src/clientTmq.c
@@ -1885,9 +1885,6 @@ int32_t tmq_consumer_close(tmq_t* tmq) {
}
tmq_list_destroy(lst);
-
- /*return rsp;*/
- return 0;
}
taosRemoveRef(tmqMgmt.rsetId, tmq->refId);
return 0;
diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c
index 9b5b32cf69..a4b1be5a12 100644
--- a/source/common/src/tdatablock.c
+++ b/source/common/src/tdatablock.c
@@ -1431,6 +1431,7 @@ SSDataBlock* createOneDataBlock(const SSDataBlock* pDataBlock, bool copyData) {
pBlock->info.rows = 0;
pBlock->info.capacity = 0;
pBlock->info.rowSize = 0;
+ pBlock->info.id = pDataBlock->info.id;
size_t numOfCols = taosArrayGetSize(pDataBlock->pDataBlock);
for (int32_t i = 0; i < numOfCols; ++i) {
diff --git a/source/common/src/tdataformat.c b/source/common/src/tdataformat.c
index 5e001a9687..7b3038280a 100644
--- a/source/common/src/tdataformat.c
+++ b/source/common/src/tdataformat.c
@@ -1532,10 +1532,6 @@ STSchema *tBuildTSchema(SSchema *aSchema, int32_t numOfCols, int32_t version) {
return pTSchema;
}
-void tDestroyTSchema(STSchema *pTSchema) {
- if (pTSchema) taosMemoryFree(pTSchema);
-}
-
// SColData ========================================
void tColDataDestroy(void *ph) {
SColData *pColData = (SColData *)ph;
diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c
index a9ff9a1e8b..370a232827 100644
--- a/source/common/src/tglobal.c
+++ b/source/common/src/tglobal.c
@@ -76,19 +76,19 @@ bool tsEnableTelem = true;
int32_t tsTelemInterval = 43200;
char tsTelemServer[TSDB_FQDN_LEN] = "telemetry.taosdata.com";
uint16_t tsTelemPort = 80;
-char* tsTelemUri = "/report";
+char *tsTelemUri = "/report";
-bool tsEnableCrashReport = true;
-char* tsClientCrashReportUri = "/ccrashreport";
-char* tsSvrCrashReportUri = "/dcrashreport";
+bool tsEnableCrashReport = true;
+char *tsClientCrashReportUri = "/ccrashreport";
+char *tsSvrCrashReportUri = "/dcrashreport";
// schemaless
char tsSmlTagName[TSDB_COL_NAME_LEN] = "_tag_null";
char tsSmlChildTableName[TSDB_TABLE_NAME_LEN] = ""; // user defined child table name can be specified in tag value.
// If set to empty system will generate table name using MD5 hash.
// true means that the name and order of cols in each line are the same(only for influx protocol)
-//bool tsSmlDataFormat = false;
-//int32_t tsSmlBatchSize = 10000;
+// bool tsSmlDataFormat = false;
+// int32_t tsSmlBatchSize = 10000;
// query
int32_t tsQueryPolicy = 1;
@@ -210,9 +210,7 @@ int32_t taosSetTfsCfg(SConfig *pCfg) {
int32_t taosSetTfsCfg(SConfig *pCfg);
#endif
-struct SConfig *taosGetCfg() {
- return tsCfg;
-}
+struct SConfig *taosGetCfg() { return tsCfg; }
static int32_t taosLoadCfg(SConfig *pCfg, const char **envCmd, const char *inputCfgDir, const char *envFile,
char *apolloUrl) {
@@ -319,8 +317,8 @@ static int32_t taosAddClientCfg(SConfig *pCfg) {
if (cfgAddBool(pCfg, "keepColumnName", tsKeepColumnName, true) != 0) return -1;
if (cfgAddString(pCfg, "smlChildTableName", "", 1) != 0) return -1;
if (cfgAddString(pCfg, "smlTagName", tsSmlTagName, 1) != 0) return -1;
-// if (cfgAddBool(pCfg, "smlDataFormat", tsSmlDataFormat, 1) != 0) return -1;
-// if (cfgAddInt32(pCfg, "smlBatchSize", tsSmlBatchSize, 1, INT32_MAX, true) != 0) return -1;
+ // if (cfgAddBool(pCfg, "smlDataFormat", tsSmlDataFormat, 1) != 0) return -1;
+ // if (cfgAddInt32(pCfg, "smlBatchSize", tsSmlBatchSize, 1, INT32_MAX, true) != 0) return -1;
if (cfgAddInt32(pCfg, "maxMemUsedByInsert", tsMaxMemUsedByInsert, 1, INT32_MAX, true) != 0) return -1;
if (cfgAddInt32(pCfg, "maxRetryWaitTime", tsMaxRetryWaitTime, 0, 86400000, 0) != 0) return -1;
if (cfgAddBool(pCfg, "useAdapter", tsUseAdapter, true) != 0) return -1;
@@ -662,9 +660,9 @@ static int32_t taosSetClientCfg(SConfig *pCfg) {
tstrncpy(tsSmlChildTableName, cfgGetItem(pCfg, "smlChildTableName")->str, TSDB_TABLE_NAME_LEN);
tstrncpy(tsSmlTagName, cfgGetItem(pCfg, "smlTagName")->str, TSDB_COL_NAME_LEN);
-// tsSmlDataFormat = cfgGetItem(pCfg, "smlDataFormat")->bval;
+ // tsSmlDataFormat = cfgGetItem(pCfg, "smlDataFormat")->bval;
-// tsSmlBatchSize = cfgGetItem(pCfg, "smlBatchSize")->i32;
+ // tsSmlBatchSize = cfgGetItem(pCfg, "smlBatchSize")->i32;
tsMaxMemUsedByInsert = cfgGetItem(pCfg, "maxMemUsedByInsert")->i32;
tsShellActivityTimer = cfgGetItem(pCfg, "shellActivityTimer")->i32;
@@ -1048,10 +1046,10 @@ int32_t taosSetCfg(SConfig *pCfg, char *name) {
tstrncpy(tsSmlChildTableName, cfgGetItem(pCfg, "smlChildTableName")->str, TSDB_TABLE_NAME_LEN);
} else if (strcasecmp("smlTagName", name) == 0) {
tstrncpy(tsSmlTagName, cfgGetItem(pCfg, "smlTagName")->str, TSDB_COL_NAME_LEN);
-// } else if (strcasecmp("smlDataFormat", name) == 0) {
-// tsSmlDataFormat = cfgGetItem(pCfg, "smlDataFormat")->bval;
-// } else if (strcasecmp("smlBatchSize", name) == 0) {
-// tsSmlBatchSize = cfgGetItem(pCfg, "smlBatchSize")->i32;
+ // } else if (strcasecmp("smlDataFormat", name) == 0) {
+ // tsSmlDataFormat = cfgGetItem(pCfg, "smlDataFormat")->bval;
+ // } else if (strcasecmp("smlBatchSize", name) == 0) {
+ // tsSmlBatchSize = cfgGetItem(pCfg, "smlBatchSize")->i32;
} else if (strcasecmp("shellActivityTimer", name) == 0) {
tsShellActivityTimer = cfgGetItem(pCfg, "shellActivityTimer")->i32;
} else if (strcasecmp("supportVnodes", name) == 0) {
@@ -1121,6 +1119,8 @@ int32_t taosSetCfg(SConfig *pCfg, char *name) {
tsStartUdfd = cfgGetItem(pCfg, "udf")->bval;
} else if (strcasecmp("uDebugFlag", name) == 0) {
uDebugFlag = cfgGetItem(pCfg, "uDebugFlag")->i32;
+ } else if (strcasecmp("useAdapter", name) == 0) {
+ tsUseAdapter = cfgGetItem(pCfg, "useAdapter")->bval;
}
break;
}
diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c
index 95f74da803..322143b71f 100644
--- a/source/common/src/tmsg.c
+++ b/source/common/src/tmsg.c
@@ -4118,6 +4118,68 @@ int32_t tDeserializeSAlterVnodeReplicaReq(void *buf, int32_t bufLen, SAlterVnode
return 0;
}
+int32_t tSerializeSDisableVnodeWriteReq(void *buf, int32_t bufLen, SDisableVnodeWriteReq *pReq) {
+ SEncoder encoder = {0};
+ tEncoderInit(&encoder, buf, bufLen);
+
+ if (tStartEncode(&encoder) < 0) return -1;
+ if (tEncodeI32(&encoder, pReq->vgId) < 0) return -1;
+ if (tEncodeI8(&encoder, pReq->disable) < 0) return -1;
+
+ tEndEncode(&encoder);
+
+ int32_t tlen = encoder.pos;
+ tEncoderClear(&encoder);
+ return tlen;
+}
+
+int32_t tDeserializeSDisableVnodeWriteReq(void *buf, int32_t bufLen, SDisableVnodeWriteReq *pReq) {
+ SDecoder decoder = {0};
+ tDecoderInit(&decoder, buf, bufLen);
+
+ if (tStartDecode(&decoder) < 0) return -1;
+ if (tDecodeI32(&decoder, &pReq->vgId) < 0) return -1;
+ if (tDecodeI8(&decoder, &pReq->disable) < 0) return -1;
+
+ tEndDecode(&decoder);
+ tDecoderClear(&decoder);
+ return 0;
+}
+
+int32_t tSerializeSAlterVnodeHashRangeReq(void *buf, int32_t bufLen, SAlterVnodeHashRangeReq *pReq) {
+ SEncoder encoder = {0};
+ tEncoderInit(&encoder, buf, bufLen);
+
+ if (tStartEncode(&encoder) < 0) return -1;
+ if (tEncodeI32(&encoder, pReq->srcVgId) < 0) return -1;
+ if (tEncodeI32(&encoder, pReq->dstVgId) < 0) return -1;
+ if (tEncodeI32(&encoder, pReq->hashBegin) < 0) return -1;
+ if (tEncodeI32(&encoder, pReq->hashEnd) < 0) return -1;
+ if (tEncodeI64(&encoder, pReq->reserved) < 0) return -1;
+
+ tEndEncode(&encoder);
+
+ int32_t tlen = encoder.pos;
+ tEncoderClear(&encoder);
+ return tlen;
+}
+
+int32_t tDeserializeSAlterVnodeHashRangeReq(void *buf, int32_t bufLen, SAlterVnodeHashRangeReq *pReq) {
+ SDecoder decoder = {0};
+ tDecoderInit(&decoder, buf, bufLen);
+
+ if (tStartDecode(&decoder) < 0) return -1;
+ if (tDecodeI32(&decoder, &pReq->srcVgId) < 0) return -1;
+ if (tDecodeI32(&decoder, &pReq->dstVgId) < 0) return -1;
+ if (tDecodeI32(&decoder, &pReq->hashBegin) < 0) return -1;
+ if (tDecodeI32(&decoder, &pReq->hashEnd) < 0) return -1;
+ if (tDecodeI64(&decoder, &pReq->reserved) < 0) return -1;
+
+ tEndDecode(&decoder);
+ tDecoderClear(&decoder);
+ return 0;
+}
+
int32_t tSerializeSKillQueryReq(void *buf, int32_t bufLen, SKillQueryReq *pReq) {
SEncoder encoder = {0};
tEncoderInit(&encoder, buf, bufLen);
diff --git a/source/dnode/mgmt/mgmt_dnode/inc/dmInt.h b/source/dnode/mgmt/mgmt_dnode/inc/dmInt.h
index ff32cbcb08..600a1f6829 100644
--- a/source/dnode/mgmt/mgmt_dnode/inc/dmInt.h
+++ b/source/dnode/mgmt/mgmt_dnode/inc/dmInt.h
@@ -48,7 +48,7 @@ int32_t dmProcessAuthRsp(SDnodeMgmt *pMgmt, SRpcMsg *pMsg);
int32_t dmProcessGrantRsp(SDnodeMgmt *pMgmt, SRpcMsg *pMsg);
int32_t dmProcessServerRunStatus(SDnodeMgmt *pMgmt, SRpcMsg *pMsg);
int32_t dmProcessRetrieve(SDnodeMgmt *pMgmt, SRpcMsg *pMsg);
-int32_t dmProcessGrantReq(SRpcMsg *pMsg);
+int32_t dmProcessGrantReq(void *pInfo, SRpcMsg *pMsg);
// dmWorker.c
int32_t dmPutNodeMsgToMgmtQueue(SDnodeMgmt *pMgmt, SRpcMsg *pMsg);
diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c b/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c
index 76c8e09b70..0d3b423771 100644
--- a/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c
+++ b/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c
@@ -234,7 +234,7 @@ static void dmProcessMgmtQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
code = dmProcessRetrieve(pMgmt, pMsg);
break;
case TDMT_MND_GRANT:
- code = dmProcessGrantReq(pMsg);
+ code = dmProcessGrantReq(&pMgmt->pData->clusterId, pMsg);
break;
default:
terrno = TSDB_CODE_MSG_NOT_PROCESSED;
diff --git a/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c b/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
index 16fe6c1b91..7d11bc7082 100644
--- a/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
+++ b/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
@@ -167,6 +167,7 @@ SArray *mmGetMsgHandles() {
if (dmSetMgmtHandle(pArray, TDMT_VND_CREATE_STB_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_VND_ALTER_STB_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_VND_DROP_STB_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
+ if (dmSetMgmtHandle(pArray, TDMT_VND_DROP_TTL_TABLE_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_VND_CREATE_SMA_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_VND_DROP_SMA_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_VND_TMQ_SUBSCRIBE_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
@@ -181,6 +182,7 @@ SArray *mmGetMsgHandles() {
if (dmSetMgmtHandle(pArray, TDMT_VND_ALTER_CONFIRM_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_VND_ALTER_HASHRANGE_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_VND_COMPACT_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
+ if (dmSetMgmtHandle(pArray, TDMT_VND_DISABLE_WRITE_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_SYNC_TIMEOUT, mmPutMsgToSyncQueue, 1) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_SYNC_CLIENT_REQUEST, mmPutMsgToSyncQueue, 1) == NULL) goto _OVER;
diff --git a/source/dnode/mgmt/mgmt_vnode/inc/vmInt.h b/source/dnode/mgmt/mgmt_vnode/inc/vmInt.h
index 6e724f4d43..e3fa2964b7 100644
--- a/source/dnode/mgmt/mgmt_vnode/inc/vmInt.h
+++ b/source/dnode/mgmt/mgmt_vnode/inc/vmInt.h
@@ -54,6 +54,7 @@ typedef struct {
int32_t vgVersion;
int32_t refCount;
int8_t dropped;
+ int8_t disable;
char *path;
SVnode *pImpl;
SMultiWorker pWriteW;
@@ -80,13 +81,15 @@ typedef struct {
SVnodeObj *vmAcquireVnode(SVnodeMgmt *pMgmt, int32_t vgId);
void vmReleaseVnode(SVnodeMgmt *pMgmt, SVnodeObj *pVnode);
int32_t vmOpenVnode(SVnodeMgmt *pMgmt, SWrapperCfg *pCfg, SVnode *pImpl);
-void vmCloseVnode(SVnodeMgmt *pMgmt, SVnodeObj *pVnode);
+void vmCloseVnode(SVnodeMgmt *pMgmt, SVnodeObj *pVnode, bool commitAndRemoveWal);
// vmHandle.c
SArray *vmGetMsgHandles();
int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg);
int32_t vmProcessDropVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg);
-int32_t vmProcessAlterVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg);
+int32_t vmProcessAlterVnodeReplicaReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg);
+int32_t vmProcessDisableVnodeWriteReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg);
+int32_t vmProcessAlterHashRangeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg);
// vmFile.c
int32_t vmGetVnodeListFromFile(SVnodeMgmt *pMgmt, SWrapperCfg **ppCfgs, int32_t *numOfVnodes);
diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
index 47772acbdc..1c1b8e32cd 100644
--- a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
+++ b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
@@ -281,7 +281,94 @@ _OVER:
return code;
}
-int32_t vmProcessAlterVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
+int32_t vmProcessDisableVnodeWriteReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
+ SDisableVnodeWriteReq req = {0};
+ if (tDeserializeSDisableVnodeWriteReq(pMsg->pCont, pMsg->contLen, &req) != 0) {
+ terrno = TSDB_CODE_INVALID_MSG;
+ return -1;
+ }
+
+ dInfo("vgId:%d, vnode write disable:%d", req.vgId, req.disable);
+
+ SVnodeObj *pVnode = vmAcquireVnode(pMgmt, req.vgId);
+ if (pVnode == NULL) {
+ dError("vgId:%d, failed to disable write since %s", req.vgId, terrstr());
+ terrno = TSDB_CODE_VND_NOT_EXIST;
+ return -1;
+ }
+
+ pVnode->disable = req.disable;
+ vmReleaseVnode(pMgmt, pVnode);
+ return 0;
+}
+
+int32_t vmProcessAlterHashRangeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
+ SAlterVnodeHashRangeReq req = {0};
+ if (tDeserializeSAlterVnodeHashRangeReq(pMsg->pCont, pMsg->contLen, &req) != 0) {
+ terrno = TSDB_CODE_INVALID_MSG;
+ return -1;
+ }
+
+ int32_t srcVgId = req.srcVgId;
+ int32_t dstVgId = req.dstVgId;
+ dInfo("vgId:%d, start to alter vnode hashrange[%u, %u), dstVgId:%d", req.srcVgId, req.hashBegin, req.hashEnd,
+ req.dstVgId);
+
+ SVnodeObj *pVnode = vmAcquireVnode(pMgmt, srcVgId);
+ if (pVnode == NULL) {
+ dError("vgId:%d, failed to alter hashrange since %s", srcVgId, terrstr());
+ terrno = TSDB_CODE_VND_NOT_EXIST;
+ return -1;
+ }
+
+ SWrapperCfg wrapperCfg = {
+ .dropped = pVnode->dropped,
+ .vgId = dstVgId,
+ .vgVersion = pVnode->vgVersion,
+ };
+ tstrncpy(wrapperCfg.path, pVnode->path, sizeof(wrapperCfg.path));
+
+ dInfo("vgId:%d, close vnode", srcVgId);
+ vmCloseVnode(pMgmt, pVnode, true);
+
+ char srcPath[TSDB_FILENAME_LEN] = {0};
+ char dstPath[TSDB_FILENAME_LEN] = {0};
+ snprintf(srcPath, TSDB_FILENAME_LEN, "vnode%svnode%d", TD_DIRSEP, srcVgId);
+ snprintf(dstPath, TSDB_FILENAME_LEN, "vnode%svnode%d", TD_DIRSEP, dstVgId);
+
+ dInfo("vgId:%d, alter vnode hashrange at %s", srcVgId, srcPath);
+ if (vnodeAlterHashRange(srcPath, dstPath, &req, pMgmt->pTfs) < 0) {
+ dError("vgId:%d, failed to alter vnode hashrange since %s", srcVgId, terrstr());
+ return -1;
+ }
+
+ dInfo("vgId:%d, start to open vnode", dstVgId);
+ SVnode *pImpl = vnodeOpen(dstPath, pMgmt->pTfs, pMgmt->msgCb);
+ if (pImpl == NULL) {
+ dError("vgId:%d, failed to open vnode at %s since %s", dstVgId, dstPath, terrstr());
+ return -1;
+ }
+
+ if (vmOpenVnode(pMgmt, &wrapperCfg, pImpl) != 0) {
+ dError("vgId:%d, failed to open vnode mgmt since %s", dstVgId, terrstr());
+ return -1;
+ }
+
+ if (vnodeStart(pImpl) != 0) {
+ dError("vgId:%d, failed to start sync since %s", dstVgId, terrstr());
+ return -1;
+ }
+
+ if (vmWriteVnodeListToFile(pMgmt) != 0) {
+ dError("vgId:%d, failed to write vnode list since %s", dstVgId, terrstr());
+ return -1;
+ }
+
+ dInfo("vgId:%d, vnode hashrange is altered", dstVgId);
+ return 0;
+}
+
+int32_t vmProcessAlterVnodeReplicaReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
SAlterVnodeReplicaReq alterReq = {0};
if (tDeserializeSAlterVnodeReplicaReq(pMsg->pCont, pMsg->contLen, &alterReq) != 0) {
terrno = TSDB_CODE_INVALID_MSG;
@@ -289,16 +376,16 @@ int32_t vmProcessAlterVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
}
int32_t vgId = alterReq.vgId;
- dInfo("vgId:%d, start to alter vnode, replica:%d selfIndex:%d strict:%d", alterReq.vgId, alterReq.replica,
- alterReq.selfIndex, alterReq.strict);
+ dInfo("vgId:%d, start to alter vnode, replica:%d selfIndex:%d strict:%d", vgId, alterReq.replica, alterReq.selfIndex,
+ alterReq.strict);
for (int32_t i = 0; i < alterReq.replica; ++i) {
SReplica *pReplica = &alterReq.replicas[i];
- dInfo("vgId:%d, replica:%d ep:%s:%u dnode:%d", alterReq.vgId, i, pReplica->fqdn, pReplica->port, pReplica->port);
+ dInfo("vgId:%d, replica:%d ep:%s:%u dnode:%d", vgId, i, pReplica->fqdn, pReplica->port, pReplica->port);
}
if (alterReq.replica <= 0 || alterReq.selfIndex < 0 || alterReq.selfIndex >= alterReq.replica) {
terrno = TSDB_CODE_INVALID_MSG;
- dError("vgId:%d, failed to alter replica since invalid msg", alterReq.vgId);
+ dError("vgId:%d, failed to alter replica since invalid msg", vgId);
return -1;
}
@@ -306,7 +393,7 @@ int32_t vmProcessAlterVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
if (pReplica->id != pMgmt->pData->dnodeId || pReplica->port != tsServerPort ||
strcmp(pReplica->fqdn, tsLocalFqdn) != 0) {
terrno = TSDB_CODE_INVALID_MSG;
- dError("vgId:%d, dnodeId:%d ep:%s:%u not matched with local dnode", alterReq.vgId, pReplica->id, pReplica->fqdn,
+ dError("vgId:%d, dnodeId:%d ep:%s:%u not matched with local dnode", vgId, pReplica->id, pReplica->fqdn,
pReplica->port);
return -1;
}
@@ -325,13 +412,13 @@ int32_t vmProcessAlterVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
.vgVersion = pVnode->vgVersion,
};
tstrncpy(wrapperCfg.path, pVnode->path, sizeof(wrapperCfg.path));
- vmCloseVnode(pMgmt, pVnode);
+ vmCloseVnode(pMgmt, pVnode, false);
char path[TSDB_FILENAME_LEN] = {0};
snprintf(path, TSDB_FILENAME_LEN, "vnode%svnode%d", TD_DIRSEP, vgId);
dInfo("vgId:%d, start to alter vnode replica at %s", vgId, path);
- if (vnodeAlter(path, &alterReq, pMgmt->pTfs) < 0) {
+ if (vnodeAlterReplica(path, &alterReq, pMgmt->pTfs) < 0) {
dError("vgId:%d, failed to alter vnode at %s since %s", vgId, path, terrstr());
return -1;
}
@@ -387,7 +474,7 @@ int32_t vmProcessDropVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
return -1;
}
- vmCloseVnode(pMgmt, pVnode);
+ vmCloseVnode(pMgmt, pVnode, false);
vmWriteVnodeListToFile(pMgmt);
dInfo("vgId:%d, is dropped", vgId);
@@ -451,7 +538,8 @@ SArray *vmGetMsgHandles() {
if (dmSetMgmtHandle(pArray, TDMT_VND_ALTER_REPLICA, vmPutMsgToMgmtQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_VND_ALTER_CONFIG, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_VND_ALTER_CONFIRM, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
- if (dmSetMgmtHandle(pArray, TDMT_VND_ALTER_HASHRANGE, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
+ if (dmSetMgmtHandle(pArray, TDMT_VND_DISABLE_WRITE, vmPutMsgToMgmtQueue, 0) == NULL) goto _OVER;
+ if (dmSetMgmtHandle(pArray, TDMT_VND_ALTER_HASHRANGE, vmPutMsgToMgmtQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_VND_COMPACT, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_VND_TRIM, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_DND_CREATE_VNODE, vmPutMsgToMgmtQueue, 0) == NULL) goto _OVER;
diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmInt.c b/source/dnode/mgmt/mgmt_vnode/src/vmInt.c
index 99ba9b9b3b..8049db9c78 100644
--- a/source/dnode/mgmt/mgmt_vnode/src/vmInt.c
+++ b/source/dnode/mgmt/mgmt_vnode/src/vmInt.c
@@ -76,11 +76,9 @@ int32_t vmOpenVnode(SVnodeMgmt *pMgmt, SWrapperCfg *pCfg, SVnode *pImpl) {
return code;
}
-void vmCloseVnode(SVnodeMgmt *pMgmt, SVnodeObj *pVnode) {
+void vmCloseVnode(SVnodeMgmt *pMgmt, SVnodeObj *pVnode, bool commitAndRemoveWal) {
char path[TSDB_FILENAME_LEN] = {0};
- vnodeProposeCommitOnNeed(pVnode->pImpl);
-
taosThreadRwlockWrlock(&pMgmt->lock);
taosHashRemove(pMgmt->hash, &pVnode->vgId, sizeof(int32_t));
taosThreadRwlockUnlock(&pMgmt->lock);
@@ -124,10 +122,26 @@ void vmCloseVnode(SVnodeMgmt *pMgmt, SVnodeObj *pVnode) {
vnodePostClose(pVnode->pImpl);
vmFreeQueue(pMgmt, pVnode);
+
+ if (commitAndRemoveWal) {
+ dInfo("vgId:%d, commit data", pVnode->vgId);
+ vnodeSyncCommit(pVnode->pImpl);
+ vnodeBegin(pVnode->pImpl);
+ dInfo("vgId:%d, commit data finished", pVnode->vgId);
+ }
+
vnodeClose(pVnode->pImpl);
pVnode->pImpl = NULL;
dInfo("vgId:%d, vnode is closed", pVnode->vgId);
+ if (commitAndRemoveWal) {
+ char path[TSDB_FILENAME_LEN] = {0};
+ snprintf(path, TSDB_FILENAME_LEN, "vnode%svnode%d%swal", TD_DIRSEP, pVnode->vgId, TD_DIRSEP);
+ dInfo("vgId:%d, remove all wals, path:%s", pVnode->vgId, path);
+ tfsRmdir(pMgmt->pTfs, path);
+ tfsMkdir(pMgmt->pTfs, path);
+ }
+
if (pVnode->dropped) {
dInfo("vgId:%d, vnode is destroyed, dropped:%d", pVnode->vgId, pVnode->dropped);
snprintf(path, TSDB_FILENAME_LEN, "vnode%svnode%d", TD_DIRSEP, pVnode->vgId);
@@ -257,7 +271,7 @@ static void *vmCloseVnodeInThread(void *param) {
pMgmt->state.openVnodes, pMgmt->state.totalVnodes);
tmsgReportStartup("vnode-close", stepDesc);
- vmCloseVnode(pMgmt, pVnode);
+ vmCloseVnode(pMgmt, pVnode, false);
}
dInfo("thread:%d, numOfVnodes:%d is closed", pThread->threadIndex, pThread->vnodeNum);
diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
index cd29b11550..600dd3671d 100644
--- a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
+++ b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
@@ -41,7 +41,13 @@ static void vmProcessMgmtQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
code = vmProcessDropVnodeReq(pMgmt, pMsg);
break;
case TDMT_VND_ALTER_REPLICA:
- code = vmProcessAlterVnodeReq(pMgmt, pMsg);
+ code = vmProcessAlterVnodeReplicaReq(pMgmt, pMsg);
+ break;
+ case TDMT_VND_DISABLE_WRITE:
+ code = vmProcessDisableVnodeWriteReq(pMgmt, pMsg);
+ break;
+ case TDMT_VND_ALTER_HASHRANGE:
+ code = vmProcessAlterHashRangeReq(pMgmt, pMsg);
break;
default:
terrno = TSDB_CODE_MSG_NOT_PROCESSED;
@@ -191,14 +197,21 @@ static int32_t vmPutMsgToQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg, EQueueType qtyp
terrno = TSDB_CODE_NO_DISKSPACE;
code = terrno;
dError("vgId:%d, msg:%p put into vnode-write queue failed since %s", pVnode->vgId, pMsg, terrstr(code));
- } else if ((pMsg->msgType == TDMT_VND_SUBMIT) && (grantCheck(TSDB_GRANT_STORAGE) != TSDB_CODE_SUCCESS)) {
+ break;
+ }
+ if (pMsg->msgType == TDMT_VND_SUBMIT && (grantCheck(TSDB_GRANT_STORAGE) != TSDB_CODE_SUCCESS)) {
terrno = TSDB_CODE_VND_NO_WRITE_AUTH;
code = terrno;
dDebug("vgId:%d, msg:%p put into vnode-write queue failed since %s", pVnode->vgId, pMsg, terrstr(code));
- } else {
- dGTrace("vgId:%d, msg:%p put into vnode-write queue", pVnode->vgId, pMsg);
- taosWriteQitem(pVnode->pWriteW.queue, pMsg);
+ break;
}
+ if (pMsg->msgType != TDMT_VND_ALTER_CONFIRM && pVnode->disable) {
+ dDebug("vgId:%d, msg:%p put into vnode-write queue failed since its disable", pVnode->vgId, pMsg);
+ terrno = TSDB_CODE_VND_STOPPED;
+ break;
+ }
+ dGTrace("vgId:%d, msg:%p put into vnode-write queue", pVnode->vgId, pMsg);
+ taosWriteQitem(pVnode->pWriteW.queue, pMsg);
break;
case SYNC_QUEUE:
dGTrace("vgId:%d, msg:%p put into vnode-sync queue", pVnode->vgId, pMsg);
diff --git a/source/dnode/mgmt/node_mgmt/src/dmTransport.c b/source/dnode/mgmt/node_mgmt/src/dmTransport.c
index dcb63f6524..d2b9618c60 100644
--- a/source/dnode/mgmt/node_mgmt/src/dmTransport.c
+++ b/source/dnode/mgmt/node_mgmt/src/dmTransport.c
@@ -39,7 +39,7 @@ int32_t dmProcessNodeMsg(SMgmtWrapper *pWrapper, SRpcMsg *pMsg) {
NodeMsgFp msgFp = pWrapper->msgFps[TMSG_INDEX(pMsg->msgType)];
if (msgFp == NULL) {
terrno = TSDB_CODE_MSG_NOT_PROCESSED;
- dGError("msg:%p, not processed since no handler", pMsg);
+ dGError("msg:%p, not processed since no handler, type:%s", pMsg, TMSG_INFO(pMsg->msgType));
return -1;
}
diff --git a/source/dnode/mnode/impl/inc/mndDb.h b/source/dnode/mnode/impl/inc/mndDb.h
index cea0a43b61..9edfd9bf3b 100644
--- a/source/dnode/mnode/impl/inc/mndDb.h
+++ b/source/dnode/mnode/impl/inc/mndDb.h
@@ -30,6 +30,7 @@ int32_t mndValidateDbInfo(SMnode *pMnode, SDbVgVersion *pDbs, int32_t numOfDbs,
int32_t mndExtractDbInfo(SMnode *pMnode, SDbObj *pDb, SUseDbRsp *pRsp, const SUseDbReq *pReq);
bool mndIsDbReady(SMnode *pMnode, SDbObj *pDb);
+SSdbRaw *mndDbActionEncode(SDbObj *pDb);
const char *mndGetDbStr(const char *src);
#ifdef __cplusplus
diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c
index eeb4249217..eb4fc3cdad 100644
--- a/source/dnode/mnode/impl/src/mndConsumer.c
+++ b/source/dnode/mnode/impl/src/mndConsumer.c
@@ -839,10 +839,14 @@ static int32_t mndConsumerActionUpdate(SSdb *pSdb, SMqConsumerObj *pOldConsumer,
char *addedTopic = strdup(taosArrayGetP(pNewConsumer->rebNewTopics, 0));
// not exist in current topic
-#if 0
+
+ bool existing = false;
+#if 1
for (int32_t i = 0; i < taosArrayGetSize(pOldConsumer->currentTopics); i++) {
char *topic = taosArrayGetP(pOldConsumer->currentTopics, i);
- A(strcmp(topic, addedTopic) != 0);
+ if (strcmp(topic, addedTopic) == 0) {
+ existing = true;
+ }
}
#endif
@@ -857,8 +861,10 @@ static int32_t mndConsumerActionUpdate(SSdb *pSdb, SMqConsumerObj *pOldConsumer,
}
// add to current topic
- taosArrayPush(pOldConsumer->currentTopics, &addedTopic);
- taosArraySort(pOldConsumer->currentTopics, taosArrayCompareString);
+ if (!existing) {
+ taosArrayPush(pOldConsumer->currentTopics, &addedTopic);
+ taosArraySort(pOldConsumer->currentTopics, taosArrayCompareString);
+ }
// set status
if (taosArrayGetSize(pOldConsumer->rebNewTopics) == 0 && taosArrayGetSize(pOldConsumer->rebRemovedTopics) == 0) {
diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c
index bdfda14a32..ea1d3281d4 100644
--- a/source/dnode/mnode/impl/src/mndDb.c
+++ b/source/dnode/mnode/impl/src/mndDb.c
@@ -32,7 +32,6 @@
#define DB_VER_NUMBER 1
#define DB_RESERVE_SIZE 54
-static SSdbRaw *mndDbActionEncode(SDbObj *pDb);
static SSdbRow *mndDbActionDecode(SSdbRaw *pRaw);
static int32_t mndDbActionInsert(SSdb *pSdb, SDbObj *pDb);
static int32_t mndDbActionDelete(SSdb *pSdb, SDbObj *pDb);
@@ -74,7 +73,7 @@ int32_t mndInitDb(SMnode *pMnode) {
void mndCleanupDb(SMnode *pMnode) {}
-static SSdbRaw *mndDbActionEncode(SDbObj *pDb) {
+SSdbRaw *mndDbActionEncode(SDbObj *pDb) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
int32_t size = sizeof(SDbObj) + pDb->cfg.numOfRetensions * sizeof(SRetention) + DB_RESERVE_SIZE;
@@ -259,6 +258,7 @@ static int32_t mndDbActionUpdate(SSdb *pSdb, SDbObj *pOld, SDbObj *pNew) {
pOld->updateTime = pNew->updateTime;
pOld->cfgVersion = pNew->cfgVersion;
pOld->vgVersion = pNew->vgVersion;
+ pOld->cfg.numOfVgroups = pNew->cfg.numOfVgroups;
pOld->cfg.buffer = pNew->cfg.buffer;
pOld->cfg.pageSize = pNew->cfg.pageSize;
pOld->cfg.pages = pNew->cfg.pages;
diff --git a/source/dnode/mnode/impl/src/mndGrant.c b/source/dnode/mnode/impl/src/mndGrant.c
index 396de7eed3..42851bd16a 100644
--- a/source/dnode/mnode/impl/src/mndGrant.c
+++ b/source/dnode/mnode/impl/src/mndGrant.c
@@ -129,7 +129,7 @@ void grantParseParameter() { mError("can't parsed parameter k"); }
void grantReset(SMnode *pMnode, EGrantType grant, uint64_t value) {}
void grantAdd(EGrantType grant, uint64_t value) {}
void grantRestore(EGrantType grant, uint64_t value) {}
-int32_t dmProcessGrantReq(SRpcMsg *pMsg) { return TSDB_CODE_SUCCESS; }
+int32_t dmProcessGrantReq(void* pInfo, SRpcMsg *pMsg) { return TSDB_CODE_SUCCESS; }
#endif
diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c
index c243e83a15..52f7190dd6 100644
--- a/source/dnode/mnode/impl/src/mndStb.c
+++ b/source/dnode/mnode/impl/src/mndStb.c
@@ -41,6 +41,7 @@ static int32_t mndProcessTtlTimer(SRpcMsg *pReq);
static int32_t mndProcessCreateStbReq(SRpcMsg *pReq);
static int32_t mndProcessAlterStbReq(SRpcMsg *pReq);
static int32_t mndProcessDropStbReq(SRpcMsg *pReq);
+static int32_t mndProcessDropTtltbReq(SRpcMsg *pReq);
static int32_t mndProcessTableMetaReq(SRpcMsg *pReq);
static int32_t mndRetrieveStb(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows);
static int32_t mndRetrieveStbCol(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows);
@@ -65,6 +66,7 @@ int32_t mndInitStb(SMnode *pMnode) {
mndSetMsgHandle(pMnode, TDMT_MND_ALTER_STB, mndProcessAlterStbReq);
mndSetMsgHandle(pMnode, TDMT_MND_DROP_STB, mndProcessDropStbReq);
mndSetMsgHandle(pMnode, TDMT_VND_CREATE_STB_RSP, mndTransProcessRsp);
+ mndSetMsgHandle(pMnode, TDMT_VND_DROP_TTL_TABLE_RSP, mndProcessDropTtltbReq);
mndSetMsgHandle(pMnode, TDMT_VND_ALTER_STB_RSP, mndTransProcessRsp);
mndSetMsgHandle(pMnode, TDMT_VND_DROP_STB_RSP, mndTransProcessRsp);
mndSetMsgHandle(pMnode, TDMT_MND_TABLE_META, mndProcessTableMetaReq);
@@ -2181,6 +2183,10 @@ static int32_t mndCheckDropStbForStream(SMnode *pMnode, const char *stbFullName,
return 0;
}
+static int32_t mndProcessDropTtltbReq(SRpcMsg *pRsp) {
+ return 0;
+}
+
static int32_t mndProcessDropStbReq(SRpcMsg *pReq) {
SMnode *pMnode = pReq->info.node;
int32_t code = -1;
diff --git a/source/dnode/mnode/impl/src/mndVgroup.c b/source/dnode/mnode/impl/src/mndVgroup.c
index 54ea9e7b24..67780a7369 100644
--- a/source/dnode/mnode/impl/src/mndVgroup.c
+++ b/source/dnode/mnode/impl/src/mndVgroup.c
@@ -59,6 +59,7 @@ int32_t mndInitVgroup(SMnode *pMnode) {
mndSetMsgHandle(pMnode, TDMT_VND_ALTER_HASHRANGE_RSP, mndTransProcessRsp);
mndSetMsgHandle(pMnode, TDMT_DND_DROP_VNODE_RSP, mndTransProcessRsp);
mndSetMsgHandle(pMnode, TDMT_VND_COMPACT_RSP, mndTransProcessRsp);
+ mndSetMsgHandle(pMnode, TDMT_VND_DISABLE_WRITE_RSP, mndTransProcessRsp);
mndSetMsgHandle(pMnode, TDMT_MND_REDISTRIBUTE_VGROUP, mndProcessRedistributeVgroupMsg);
mndSetMsgHandle(pMnode, TDMT_MND_SPLIT_VGROUP, mndProcessSplitVgroupMsg);
@@ -355,9 +356,7 @@ static void *mndBuildAlterVnodeReplicaReq(SMnode *pMnode, SDbObj *pDb, SVgObj *p
SReplica *pReplica = &alterReq.replicas[v];
SVnodeGid *pVgid = &pVgroup->vnodeGid[v];
SDnodeObj *pVgidDnode = mndAcquireDnode(pMnode, pVgid->dnodeId);
- if (pVgidDnode == NULL) {
- return NULL;
- }
+ if (pVgidDnode == NULL) return NULL;
pReplica->id = pVgidDnode->id;
pReplica->port = pVgidDnode->port;
@@ -397,6 +396,57 @@ static void *mndBuildAlterVnodeReplicaReq(SMnode *pMnode, SDbObj *pDb, SVgObj *p
return pReq;
}
+static void *mndBuildDisableVnodeWriteReq(SMnode *pMnode, SDbObj *pDb, int32_t vgId, int32_t *pContLen) {
+ SDisableVnodeWriteReq disableReq = {
+ .vgId = vgId,
+ .disable = 1,
+ };
+
+ mInfo("vgId:%d, build disable vnode write req", vgId);
+ int32_t contLen = tSerializeSDisableVnodeWriteReq(NULL, 0, &disableReq);
+ if (contLen < 0) {
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ return NULL;
+ }
+
+ void *pReq = taosMemoryMalloc(contLen);
+ if (pReq == NULL) {
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ return NULL;
+ }
+
+ tSerializeSDisableVnodeWriteReq(pReq, contLen, &disableReq);
+ *pContLen = contLen;
+ return pReq;
+}
+
+static void *mndBuildAlterVnodeHashRangeReq(SMnode *pMnode, SVgObj *pVgroup, int32_t dstVgId, int32_t *pContLen) {
+ SAlterVnodeHashRangeReq alterReq = {
+ .srcVgId = pVgroup->vgId,
+ .dstVgId = dstVgId,
+ .hashBegin = pVgroup->hashBegin,
+ .hashEnd = pVgroup->hashEnd,
+ };
+
+ mInfo("vgId:%d, build alter vnode hashrange req, dstVgId:%d, begin:%u, end:%u", pVgroup->vgId, dstVgId,
+ pVgroup->hashBegin, pVgroup->hashEnd);
+ int32_t contLen = tSerializeSAlterVnodeHashRangeReq(NULL, 0, &alterReq);
+ if (contLen < 0) {
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ return NULL;
+ }
+
+ void *pReq = taosMemoryMalloc(contLen);
+ if (pReq == NULL) {
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ return NULL;
+ }
+
+ tSerializeSAlterVnodeHashRangeReq(pReq, contLen, &alterReq);
+ *pContLen = contLen;
+ return pReq;
+}
+
void *mndBuildDropVnodeReq(SMnode *pMnode, SDnodeObj *pDnode, SDbObj *pDb, SVgObj *pVgroup, int32_t *pContLen) {
SDropVnodeReq dropReq = {0};
dropReq.dnodeId = pDnode->id;
@@ -1029,6 +1079,7 @@ int32_t mndAddAlterVnodeConfirmAction(SMnode *pMnode, STrans *pTrans, SDbObj *pD
STransAction action = {0};
action.epSet = mndGetVgroupEpset(pMnode, pVgroup);
+ mInfo("vgId:%d, build alter vnode confirm req", pVgroup->vgId);
int32_t contLen = sizeof(SMsgHead);
SMsgHead *pHead = taosMemoryMalloc(contLen);
if (pHead == NULL) {
@@ -1053,7 +1104,25 @@ int32_t mndAddAlterVnodeConfirmAction(SMnode *pMnode, STrans *pTrans, SDbObj *pD
return 0;
}
-int32_t mndAddAlterVnodeHashRangeAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup) { return 0; }
+static int32_t mndAddAlterVnodeHashRangeAction(SMnode *pMnode, STrans *pTrans, SVgObj *pVgroup, int32_t dstVgId) {
+ STransAction action = {0};
+ action.epSet = mndGetVgroupEpset(pMnode, pVgroup);
+
+ int32_t contLen = 0;
+ void *pReq = mndBuildAlterVnodeHashRangeReq(pMnode, pVgroup, dstVgId, &contLen);
+ if (pReq == NULL) return -1;
+
+ action.pCont = pReq;
+ action.contLen = contLen;
+ action.msgType = TDMT_VND_ALTER_HASHRANGE;
+
+ if (mndTransAppendRedoAction(pTrans, &action) != 0) {
+ taosMemoryFree(pReq);
+ return -1;
+ }
+
+ return 0;
+}
int32_t mndAddAlterVnodeConfigAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup) {
STransAction action = {0};
@@ -1099,6 +1168,30 @@ int32_t mndAddAlterVnodeReplicaAction(SMnode *pMnode, STrans *pTrans, SDbObj *pD
return 0;
}
+static int32_t mndAddDisableVnodeWriteAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, int32_t dnodeId) {
+ SDnodeObj *pDnode = mndAcquireDnode(pMnode, dnodeId);
+ if (pDnode == NULL) return -1;
+
+ STransAction action = {0};
+ action.epSet = mndGetDnodeEpset(pDnode);
+ mndReleaseDnode(pMnode, pDnode);
+
+ int32_t contLen = 0;
+ void *pReq = mndBuildDisableVnodeWriteReq(pMnode, pDb, pVgroup->vgId, &contLen);
+ if (pReq == NULL) return -1;
+
+ action.pCont = pReq;
+ action.contLen = contLen;
+ action.msgType = TDMT_VND_DISABLE_WRITE;
+
+ if (mndTransAppendRedoAction(pTrans, &action) != 0) {
+ taosMemoryFree(pReq);
+ return -1;
+ }
+
+ return 0;
+}
+
int32_t mndAddDropVnodeAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, SVnodeGid *pVgid,
bool isRedo) {
STransAction action = {0};
@@ -1763,9 +1856,11 @@ static int32_t mndAddAdjustVnodeHashRangeAction(SMnode *pMnode, STrans *pTrans,
}
static int32_t mndSplitVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SVgObj *pVgroup) {
- int32_t code = -1;
- STrans *pTrans = NULL;
- SArray *pArray = mndBuildDnodesArray(pMnode, 0);
+ 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");
if (pTrans == NULL) goto _OVER;
@@ -1784,18 +1879,21 @@ static int32_t mndSplitVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SVgObj
if (mndAddVnodeToVgroup(pMnode, pTrans, &newVg1, pArray) != 0) goto _OVER;
if (mndAddAlterVnodeReplicaAction(pMnode, pTrans, pDb, &newVg1, newVg1.vnodeGid[0].dnodeId) != 0) goto _OVER;
if (mndAddCreateVnodeAction(pMnode, pTrans, pDb, &newVg1, &newVg1.vnodeGid[1]) != 0) goto _OVER;
- if (mndAddAlterVnodeConfirmAction(pMnode, pTrans, pDb, &newVg1) != 0) goto _OVER;
} else if (newVg1.replica == 3) {
SVnodeGid del1 = {0};
if (mndRemoveVnodeFromVgroup(pMnode, pTrans, &newVg1, pArray, &del1) != 0) goto _OVER;
if (mndAddDropVnodeAction(pMnode, pTrans, pDb, &newVg1, &del1, true) != 0) goto _OVER;
if (mndAddAlterVnodeReplicaAction(pMnode, pTrans, pDb, &newVg1, newVg1.vnodeGid[0].dnodeId) != 0) goto _OVER;
if (mndAddAlterVnodeReplicaAction(pMnode, pTrans, pDb, &newVg1, newVg1.vnodeGid[1].dnodeId) != 0) goto _OVER;
- if (mndAddAlterVnodeConfirmAction(pMnode, pTrans, pDb, &newVg1) != 0) goto _OVER;
} else {
goto _OVER;
}
+ for (int32_t i = 0; i < newVg1.replica; ++i) {
+ if (mndAddDisableVnodeWriteAction(pMnode, pTrans, pDb, &newVg1, newVg1.vnodeGid[i].dnodeId) != 0) goto _OVER;
+ }
+ if (mndAddAlterVnodeConfirmAction(pMnode, pTrans, pDb, &newVg1) != 0) goto _OVER;
+
mInfo("vgId:%d, vgroup info after adjust replica, replica:%d hashBegin:%u hashEnd:%u vnode:0 dnode:%d", newVg1.vgId,
newVg1.replica, newVg1.hashBegin, newVg1.hashEnd, newVg1.vnodeGid[0].dnodeId);
for (int32_t i = 0; i < newVg1.replica; ++i) {
@@ -1813,44 +1911,6 @@ static int32_t mndSplitVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SVgObj
memcpy(&newVg2.vnodeGid[0], &newVg2.vnodeGid[1], sizeof(SVnodeGid));
memset(&newVg2.vnodeGid[1], 0, sizeof(SVnodeGid));
- mInfo("vgId:%d, vgroup info after adjust hash, replica:%d hashBegin:%u hashEnd:%u vnode:0 dnode:%d", newVg1.vgId,
- newVg1.replica, newVg1.hashBegin, newVg1.hashEnd, newVg1.vnodeGid[0].dnodeId);
- mInfo("vgId:%d, vgroup info after adjust hash, replica:%d hashBegin:%u hashEnd:%u vnode:0 dnode:%d", newVg2.vgId,
- newVg2.replica, newVg2.hashBegin, newVg2.hashEnd, newVg2.vnodeGid[0].dnodeId);
-
- if (mndAddAlterVnodeHashRangeAction(pMnode, pTrans, pDb, &newVg1) != 0) goto _OVER;
- if (mndAddAlterVnodeHashRangeAction(pMnode, pTrans, pDb, &newVg2) != 0) goto _OVER;
-
-#if 0
- // adjust vgroup replica
- if (pDb->cfg.replications != newVg1.replica) {
- if (mndBuildAlterVgroupAction(pMnode, pTrans, pDb, pDb, &newVg1, pArray) != 0) goto _OVER;
- }
- if (pDb->cfg.replications != newVg2.replica) {
- if (mndBuildAlterVgroupAction(pMnode, pTrans, pDb, pDb, &newVg2, pArray) != 0) goto _OVER;
- }
-#endif
-
- {
- SSdbRaw *pRaw = mndVgroupActionEncode(&newVg1);
- if (pRaw == NULL) return -1;
- if (mndTransAppendCommitlog(pTrans, pRaw) != 0) {
- sdbFreeRaw(pRaw);
- return -1;
- }
- (void)sdbSetRawStatus(pRaw, SDB_STATUS_READY);
- }
-
- {
- SSdbRaw *pRaw = mndVgroupActionEncode(&newVg2);
- if (pRaw == NULL) return -1;
- if (mndTransAppendCommitlog(pTrans, pRaw) != 0) {
- sdbFreeRaw(pRaw);
- return -1;
- }
- (void)sdbSetRawStatus(pRaw, SDB_STATUS_READY);
- }
-
mInfo("vgId:%d, vgroup info after adjust hash, replica:%d hashBegin:%u hashEnd:%u vnode:0 dnode:%d", newVg1.vgId,
newVg1.replica, newVg1.hashBegin, newVg1.hashEnd, newVg1.vnodeGid[0].dnodeId);
for (int32_t i = 0; i < newVg1.replica; ++i) {
@@ -1862,28 +1922,83 @@ static int32_t mndSplitVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SVgObj
mInfo("vgId:%d, vnode:%d dnode:%d", newVg2.vgId, i, newVg2.vnodeGid[i].dnodeId);
}
+ int32_t maxVgId = sdbGetMaxId(pMnode->pSdb, SDB_VGROUP);
+ if (mndAddAlterVnodeHashRangeAction(pMnode, pTrans, &newVg1, maxVgId) != 0) goto _OVER;
+ newVg1.vgId = maxVgId;
+
+ maxVgId++;
+ if (mndAddAlterVnodeHashRangeAction(pMnode, pTrans, &newVg2, maxVgId) != 0) goto _OVER;
+ newVg2.vgId = maxVgId;
+
+ // adjust vgroup replica
+ if (pDb->cfg.replications != newVg1.replica) {
+ if (mndBuildAlterVgroupAction(pMnode, pTrans, pDb, pDb, &newVg1, pArray) != 0) goto _OVER;
+ }
+ if (pDb->cfg.replications != newVg2.replica) {
+ if (mndBuildAlterVgroupAction(pMnode, pTrans, pDb, pDb, &newVg2, pArray) != 0) goto _OVER;
+ }
+
+ pRaw = mndVgroupActionEncode(&newVg1);
+ if (pRaw == NULL) goto _OVER;
+ if (mndTransAppendCommitlog(pTrans, pRaw) != 0) goto _OVER;
+ (void)sdbSetRawStatus(pRaw, SDB_STATUS_READY);
+ pRaw = NULL;
+
+ pRaw = mndVgroupActionEncode(&newVg2);
+ if (pRaw == NULL) goto _OVER;
+ if (mndTransAppendCommitlog(pTrans, pRaw) != 0) goto _OVER;
+ (void)sdbSetRawStatus(pRaw, SDB_STATUS_READY);
+ pRaw = NULL;
+
+ pRaw = mndVgroupActionEncode(pVgroup);
+ if (pRaw == NULL) goto _OVER;
+ if (mndTransAppendCommitlog(pTrans, pRaw) != 0) goto _OVER;
+ (void)sdbSetRawStatus(pRaw, SDB_STATUS_DROPPED);
+ pRaw = NULL;
+
+ memcpy(&dbObj, pDb, sizeof(SDbObj));
+ if (dbObj.cfg.pRetensions != NULL) {
+ dbObj.cfg.pRetensions = taosArrayDup(pDb->cfg.pRetensions, NULL);
+ if (dbObj.cfg.pRetensions == NULL) goto _OVER;
+ }
+ 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 (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
code = 0;
_OVER:
taosArrayDestroy(pArray);
mndTransDrop(pTrans);
+ sdbFreeRaw(pRaw);
+ taosArrayDestroy(dbObj.cfg.pRetensions);
return code;
}
static int32_t mndProcessSplitVgroupMsg(SRpcMsg *pReq) {
SMnode *pMnode = pReq->info.node;
int32_t code = -1;
- int32_t vgId = 2;
SVgObj *pVgroup = NULL;
SDbObj *pDb = NULL;
- mInfo("vgId:%d, start to split", vgId);
+ SSplitVgroupReq req = {0};
+ if (tDeserializeSSplitVgroupReq(pReq->pCont, pReq->contLen, &req) != 0) {
+ terrno = TSDB_CODE_INVALID_MSG;
+ goto _OVER;
+ }
+
+ mInfo("vgId:%d, start to split", req.vgId);
if (mndCheckOperPrivilege(pMnode, pReq->info.conn.user, MND_OPER_SPLIT_VGROUP) != 0) {
goto _OVER;
}
- pVgroup = mndAcquireVgroup(pMnode, vgId);
+ pVgroup = mndAcquireVgroup(pMnode, req.vgId);
if (pVgroup == NULL) goto _OVER;
pDb = mndAcquireDb(pMnode, pVgroup->dbName);
diff --git a/source/dnode/snode/src/snode.c b/source/dnode/snode/src/snode.c
index 860db20fa8..1d2f4da26b 100644
--- a/source/dnode/snode/src/snode.c
+++ b/source/dnode/snode/src/snode.c
@@ -93,6 +93,8 @@ int32_t sndExpandTask(SSnode *pSnode, SStreamTask *pTask, int64_t ver) {
pTask->exec.executor = qCreateStreamExecTaskInfo(pTask->exec.qmsg, &mgHandle);
ASSERT(pTask->exec.executor);
+ streamSetupTrigger(pTask);
+
return 0;
}
diff --git a/source/dnode/vnode/inc/vnode.h b/source/dnode/vnode/inc/vnode.h
index 7d368c76c5..db35a7c088 100644
--- a/source/dnode/vnode/inc/vnode.h
+++ b/source/dnode/vnode/inc/vnode.h
@@ -50,13 +50,16 @@ extern const SVnodeCfg vnodeCfgDefault;
int32_t vnodeInit(int32_t nthreads);
void vnodeCleanup();
int32_t vnodeCreate(const char *path, SVnodeCfg *pCfg, STfs *pTfs);
-int32_t vnodeAlter(const char *path, SAlterVnodeReplicaReq *pReq, STfs *pTfs);
+int32_t vnodeAlterReplica(const char *path, SAlterVnodeReplicaReq *pReq, STfs *pTfs);
+int32_t vnodeAlterHashRange(const char *srcPath, const char *dstPath, SAlterVnodeHashRangeReq *pReq, STfs *pTfs);
void vnodeDestroy(const char *path, STfs *pTfs);
SVnode *vnodeOpen(const char *path, STfs *pTfs, SMsgCb msgCb);
void vnodePreClose(SVnode *pVnode);
void vnodePostClose(SVnode *pVnode);
void vnodeSyncCheckTimeout(SVnode *pVnode);
void vnodeClose(SVnode *pVnode);
+int32_t vnodeSyncCommit(SVnode *pVnode);
+int32_t vnodeBegin(SVnode* pVnode);
int32_t vnodeStart(SVnode *pVnode);
void vnodeStop(SVnode *pVnode);
diff --git a/source/dnode/vnode/src/inc/tsdb.h b/source/dnode/vnode/src/inc/tsdb.h
index 8c8775548d..6ff085c8f1 100644
--- a/source/dnode/vnode/src/inc/tsdb.h
+++ b/source/dnode/vnode/src/inc/tsdb.h
@@ -206,6 +206,7 @@ int32_t tsdbCmprColData(SColData *pColData, int8_t cmprAlg, SBlockCol *pBlockCol
uint8_t **ppBuf);
int32_t tsdbDecmprColData(uint8_t *pIn, SBlockCol *pBlockCol, int8_t cmprAlg, int32_t nVal, SColData *pColData,
uint8_t **ppBuf);
+int32_t tRowInfoCmprFn(const void *p1, const void *p2);
// tsdbMemTable ==============================================================================================
// SMemTable
int32_t tsdbMemTableCreate(STsdb *pTsdb, SMemTable **ppMemTable);
diff --git a/source/dnode/vnode/src/inc/vnodeInt.h b/source/dnode/vnode/src/inc/vnodeInt.h
index 9c5f47b731..84330b279f 100644
--- a/source/dnode/vnode/src/inc/vnodeInt.h
+++ b/source/dnode/vnode/src/inc/vnodeInt.h
@@ -252,7 +252,7 @@ int32_t tsdbSnapReaderClose(STsdbSnapReader** ppReader);
int32_t tsdbSnapRead(STsdbSnapReader* pReader, uint8_t** ppData);
// STsdbSnapWriter ========================================
int32_t tsdbSnapWriterOpen(STsdb* pTsdb, int64_t sver, int64_t ever, STsdbSnapWriter** ppWriter);
-int32_t tsdbSnapWrite(STsdbSnapWriter* pWriter, uint8_t* pData, uint32_t nData);
+int32_t tsdbSnapWrite(STsdbSnapWriter* pWriter, SSnapDataHdr* pHdr);
int32_t tsdbSnapWriterPrepareClose(STsdbSnapWriter* pWriter);
int32_t tsdbSnapWriterClose(STsdbSnapWriter** ppWriter, int8_t rollback);
// STqSnapshotReader ==
diff --git a/source/dnode/vnode/src/meta/metaCommit.c b/source/dnode/vnode/src/meta/metaCommit.c
index f61930b84c..f597c100d0 100644
--- a/source/dnode/vnode/src/meta/metaCommit.c
+++ b/source/dnode/vnode/src/meta/metaCommit.c
@@ -56,4 +56,7 @@ int metaPrepareAsyncCommit(SMeta *pMeta) {
}
// abort the meta txn
-int metaAbort(SMeta *pMeta) { return tdbAbort(pMeta->pEnv, pMeta->txn); }
+int metaAbort(SMeta *pMeta) {
+ if (!pMeta->txn) return 0;
+ return tdbAbort(pMeta->pEnv, pMeta->txn);
+}
diff --git a/source/dnode/vnode/src/meta/metaOpen.c b/source/dnode/vnode/src/meta/metaOpen.c
index 609ffc58c3..e5bc301fa1 100644
--- a/source/dnode/vnode/src/meta/metaOpen.c
+++ b/source/dnode/vnode/src/meta/metaOpen.c
@@ -203,7 +203,7 @@ _err:
int metaClose(SMeta *pMeta) {
if (pMeta) {
- if (pMeta->pEnv) tdbAbort(pMeta->pEnv, pMeta->txn);
+ if (pMeta->pEnv) metaAbort(pMeta);
if (pMeta->pCache) metaCacheClose(pMeta);
if (pMeta->pIdx) metaCloseIdx(pMeta);
if (pMeta->pStreamDb) tdbTbClose(pMeta->pStreamDb);
diff --git a/source/dnode/vnode/src/meta/metaQuery.c b/source/dnode/vnode/src/meta/metaQuery.c
index fc41d507a8..6741b7ca45 100644
--- a/source/dnode/vnode/src/meta/metaQuery.c
+++ b/source/dnode/vnode/src/meta/metaQuery.c
@@ -706,9 +706,8 @@ int32_t metaGetTbTSchemaEx(SMeta *pMeta, tb_uid_t suid, tb_uid_t uid, int32_t sv
}
}
- if (sver <= 0) {
- metaError("meta/query: incorrect sver: %" PRId32 ".", sver);
- code = TSDB_CODE_FAILED;
+ if (ASSERTS(sver > 0, __FILE__, __LINE__, "failed to get table schema version: %d", sver)) {
+ code = TSDB_CODE_NOT_FOUND;
goto _exit;
}
diff --git a/source/dnode/vnode/src/sma/smaSnapshot.c b/source/dnode/vnode/src/sma/smaSnapshot.c
index de3d93395a..c00e96a066 100644
--- a/source/dnode/vnode/src/sma/smaSnapshot.c
+++ b/source/dnode/vnode/src/sma/smaSnapshot.c
@@ -446,10 +446,10 @@ int32_t rsmaSnapWrite(SRSmaSnapWriter* pWriter, uint8_t* pData, uint32_t nData)
// rsma1/rsma2
if (pHdr->type == SNAP_DATA_RSMA1) {
pHdr->type = SNAP_DATA_TSDB;
- code = tsdbSnapWrite(pWriter->pDataWriter[0], pData, nData);
+ code = tsdbSnapWrite(pWriter->pDataWriter[0], pHdr);
} else if (pHdr->type == SNAP_DATA_RSMA2) {
pHdr->type = SNAP_DATA_TSDB;
- code = tsdbSnapWrite(pWriter->pDataWriter[1], pData, nData);
+ code = tsdbSnapWrite(pWriter->pDataWriter[1], pHdr);
} else if (pHdr->type == SNAP_DATA_QTASK) {
code = rsmaSnapWriteQTaskInfo(pWriter, pData, nData);
} else {
diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c
index a27b6988c5..1b6da6c50d 100644
--- a/source/dnode/vnode/src/tq/tq.c
+++ b/source/dnode/vnode/src/tq/tq.c
@@ -520,7 +520,12 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) {
tqOffsetResetToData(&fetchOffsetNew, 0, 0);
}
} else {
- tqOffsetResetToLog(&fetchOffsetNew, walGetFirstVer(pTq->pVnode->pWal));
+ pHandle->pRef = walRefFirstVer(pTq->pVnode->pWal, pHandle->pRef);
+ if (pHandle->pRef == NULL) {
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ return -1;
+ }
+ tqOffsetResetToLog(&fetchOffsetNew, pHandle->pRef->refVer - 1);
}
} else if (reqOffset.type == TMQ_OFFSET__RESET_LATEST) {
if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__COLUMN) {
diff --git a/source/dnode/vnode/src/tq/tqOffsetSnapshot.c b/source/dnode/vnode/src/tq/tqOffsetSnapshot.c
index 2413a792c6..a4428aed43 100644
--- a/source/dnode/vnode/src/tq/tqOffsetSnapshot.c
+++ b/source/dnode/vnode/src/tq/tqOffsetSnapshot.c
@@ -56,7 +56,7 @@ int32_t tqOffsetSnapRead(STqOffsetReader* pReader, uint8_t** ppData) {
TdFilePtr pFile = taosOpenFile(fname, TD_FILE_READ);
if (pFile == NULL) {
taosMemoryFree(fname);
- return -1;
+ return 0;
}
int64_t sz = 0;
diff --git a/source/dnode/vnode/src/tq/tqSink.c b/source/dnode/vnode/src/tq/tqSink.c
index f1103ad48a..3801a25d6d 100644
--- a/source/dnode/vnode/src/tq/tqSink.c
+++ b/source/dnode/vnode/src/tq/tqSink.c
@@ -488,9 +488,7 @@ void tqSinkToTablePipeline2(SStreamTask* pTask, void* vnode, int64_t ver, void*
};
void* pData = colDataGetData(pTagData, rowId);
if (colDataIsNull_s(pTagData, rowId)) {
- tagVal.type = TSDB_DATA_TYPE_NULL;
- tagVal.pData = NULL;
- tagVal.nData = 0;
+ continue;
} else if (IS_VAR_DATA_TYPE(pTagData->info.type)) {
tagVal.nData = varDataLen(pData);
tagVal.pData = varDataVal(pData);
diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c
index 588debbe52..fc0678e3e6 100644
--- a/source/dnode/vnode/src/tsdb/tsdbRead.c
+++ b/source/dnode/vnode/src/tsdb/tsdbRead.c
@@ -218,6 +218,7 @@ static int32_t doBuildDataBlock(STsdbReader* pReader);
static TSDBKEY getCurrentKeyInBuf(STableBlockScanInfo* pScanInfo, STsdbReader* pReader);
static bool hasDataInFileBlock(const SBlockData* pBlockData, const SFileBlockDumpInfo* pDumpInfo);
static void initBlockDumpInfo(STsdbReader* pReader, SDataBlockIter* pBlockIter);
+static int32_t getInitialDelIndex(const SArray* pDelSkyline, int32_t order);
static bool outOfTimeWindow(int64_t ts, STimeWindow* pWindow) { return (ts > pWindow->ekey) || (ts < pWindow->skey); }
@@ -573,6 +574,68 @@ static SSDataBlock* createResBlock(SQueryTableDataCond* pCond, int32_t capacity)
return pResBlock;
}
+static int32_t tsdbInitReaderLock(STsdbReader* pReader) {
+ int32_t code = -1;
+ qTrace("tsdb/read: %p, pre-init read mutex: %p, code: %d", pReader, &pReader->readerMutex, code);
+
+ code = taosThreadMutexInit(&pReader->readerMutex, NULL);
+
+ qTrace("tsdb/read: %p, post-init read mutex: %p, code: %d", pReader, &pReader->readerMutex, code);
+
+ return code;
+}
+
+static int32_t tsdbUninitReaderLock(STsdbReader* pReader) {
+ int32_t code = -1;
+ qTrace("tsdb/read: %p, pre-uninit read mutex: %p, code: %d", pReader, &pReader->readerMutex, code);
+
+ code = taosThreadMutexDestroy(&pReader->readerMutex);
+
+ qTrace("tsdb/read: %p, post-uninit read mutex: %p, code: %d", pReader, &pReader->readerMutex, code);
+
+ return code;
+}
+
+static int32_t tsdbAcquireReader(STsdbReader* pReader) {
+ int32_t code = -1;
+ qTrace("tsdb/read: %p, pre-take read mutex: %p, code: %d", pReader, &pReader->readerMutex, code);
+
+ code = taosThreadMutexLock(&pReader->readerMutex);
+
+ qTrace("tsdb/read: %p, post-take read mutex: %p, code: %d", pReader, &pReader->readerMutex, code);
+
+ return code;
+}
+
+static int32_t tsdbTryAcquireReader(STsdbReader* pReader) {
+ int32_t code = -1;
+ qTrace("tsdb/read: %p, pre-trytake read mutex: %p, code: %d", pReader, &pReader->readerMutex, code);
+
+ code = taosThreadMutexTryLock(&pReader->readerMutex);
+
+ qTrace("tsdb/read: %p, post-trytake read mutex: %p, code: %d", pReader, &pReader->readerMutex, code);
+
+ return code;
+}
+
+static int32_t tsdbReleaseReader(STsdbReader* pReader) {
+ int32_t code = -1;
+ qTrace("tsdb/read: %p, pre-untake read mutex: %p, code: %d", pReader, &pReader->readerMutex, code);
+
+ code = taosThreadMutexUnlock(&pReader->readerMutex);
+
+ qTrace("tsdb/read: %p, post-untake read mutex: %p, code: %d", pReader, &pReader->readerMutex, code);
+
+ return code;
+}
+
+void tsdbReleaseDataBlock(STsdbReader* pReader) {
+ SReaderStatus* pStatus = &pReader->status;
+ if (!pStatus->composedDataBlock) {
+ tsdbReleaseReader(pReader);
+ }
+}
+
static int32_t tsdbReaderCreate(SVnode* pVnode, SQueryTableDataCond* pCond, STsdbReader** ppReader, int32_t capacity,
SSDataBlock* pResBlock, const char* idstr) {
int32_t code = 0;
@@ -636,7 +699,7 @@ static int32_t tsdbReaderCreate(SVnode* pVnode, SQueryTableDataCond* pCond, STsd
setColumnIdSlotList(&pReader->suppInfo, pCond->colList, pCond->pSlotList, pCond->numOfCols);
- taosThreadMutexInit(&pReader->readerMutex, NULL);
+ tsdbInitReaderLock(pReader);
*ppReader = pReader;
return code;
@@ -1130,9 +1193,9 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanIn
int32_t unDumpedRows = asc ? pBlock->nRow - pDumpInfo->rowIndex : pDumpInfo->rowIndex + 1;
tsdbDebug("%p copy file block to sdatablock, global index:%d, table index:%d, brange:%" PRId64 "-%" PRId64
- ", rows:%d, remain:%d, minVer:%" PRId64 ", maxVer:%" PRId64 ", elapsed time:%.2f ms, %s",
+ ", rows:%d, remain:%d, minVer:%" PRId64 ", maxVer:%" PRId64 ", uid:%"PRIu64" elapsed time:%.2f ms, %s",
pReader, pBlockIter->index, pBlockInfo->tbBlockIdx, pBlock->minKey.ts, pBlock->maxKey.ts, dumpedRows,
- unDumpedRows, pBlock->minVer, pBlock->maxVer, elapsedTime, pReader->idStr);
+ unDumpedRows, pBlock->minVer, pBlock->maxVer, pBlockInfo->uid, elapsedTime, pReader->idStr);
return TSDB_CODE_SUCCESS;
}
@@ -2206,17 +2269,17 @@ static int32_t initMemDataIterator(STableBlockScanInfo* pBlockScanInfo, STsdbRea
if (code == TSDB_CODE_SUCCESS) {
pBlockScanInfo->iter.hasVal = (tsdbTbDataIterGet(pBlockScanInfo->iter.iter) != NULL);
- tsdbDebug("%p uid:%" PRId64 ", check data in mem from skey:%" PRId64 ", order:%d, ts range in buf:%" PRId64
+ tsdbDebug("%p uid:%" PRIu64 ", check data in mem from skey:%" PRId64 ", order:%d, ts range in buf:%" PRId64
"-%" PRId64 " %s",
pReader, pBlockScanInfo->uid, startKey.ts, pReader->order, d->minKey, d->maxKey, pReader->idStr);
} else {
- tsdbError("%p uid:%" PRId64 ", failed to create iterator for imem, code:%s, %s", pReader, pBlockScanInfo->uid,
+ tsdbError("%p uid:%" PRIu64 ", failed to create iterator for imem, code:%s, %s", pReader, pBlockScanInfo->uid,
tstrerror(code), pReader->idStr);
return code;
}
}
} else {
- tsdbDebug("%p uid:%" PRId64 ", no data in mem, %s", pReader, pBlockScanInfo->uid, pReader->idStr);
+ tsdbDebug("%p uid:%" PRIu64 ", no data in mem, %s", pReader, pBlockScanInfo->uid, pReader->idStr);
}
STbData* di = NULL;
@@ -2227,17 +2290,17 @@ static int32_t initMemDataIterator(STableBlockScanInfo* pBlockScanInfo, STsdbRea
if (code == TSDB_CODE_SUCCESS) {
pBlockScanInfo->iiter.hasVal = (tsdbTbDataIterGet(pBlockScanInfo->iiter.iter) != NULL);
- tsdbDebug("%p uid:%" PRId64 ", check data in imem from skey:%" PRId64 ", order:%d, ts range in buf:%" PRId64
+ tsdbDebug("%p uid:%" PRIu64 ", check data in imem from skey:%" PRId64 ", order:%d, ts range in buf:%" PRId64
"-%" PRId64 " %s",
pReader, pBlockScanInfo->uid, startKey.ts, pReader->order, di->minKey, di->maxKey, pReader->idStr);
} else {
- tsdbError("%p uid:%" PRId64 ", failed to create iterator for mem, code:%s, %s", pReader, pBlockScanInfo->uid,
+ tsdbError("%p uid:%" PRIu64 ", failed to create iterator for mem, code:%s, %s", pReader, pBlockScanInfo->uid,
tstrerror(code), pReader->idStr);
return code;
}
}
} else {
- tsdbDebug("%p uid:%" PRId64 ", no data in imem, %s", pReader, pBlockScanInfo->uid, pReader->idStr);
+ tsdbDebug("%p uid:%" PRIu64 ", no data in imem, %s", pReader, pBlockScanInfo->uid, pReader->idStr);
}
initDelSkylineIterator(pBlockScanInfo, pReader, d, di);
@@ -2547,6 +2610,14 @@ _end:
void setComposedBlockFlag(STsdbReader* pReader, bool composed) { pReader->status.composedDataBlock = composed; }
+int32_t getInitialDelIndex(const SArray* pDelSkyline, int32_t order) {
+ if (pDelSkyline == NULL) {
+ return 0;
+ }
+
+ return ASCENDING_TRAVERSE(order) ? 0 : taosArrayGetSize(pDelSkyline) - 1;
+}
+
int32_t initDelSkylineIterator(STableBlockScanInfo* pBlockScanInfo, STsdbReader* pReader, STbData* pMemTbData,
STbData* piMemTbData) {
if (pBlockScanInfo->delSkyline != NULL) {
@@ -2564,7 +2635,6 @@ int32_t initDelSkylineIterator(STableBlockScanInfo* pBlockScanInfo, STsdbReader*
if (pIdx != NULL) {
code = tsdbReadDelData(pReader->pDelFReader, pIdx, pDelData);
}
-
if (code != TSDB_CODE_SUCCESS) {
goto _err;
}
@@ -2593,11 +2663,13 @@ int32_t initDelSkylineIterator(STableBlockScanInfo* pBlockScanInfo, STsdbReader*
}
taosArrayDestroy(pDelData);
- pBlockScanInfo->iter.index =
- ASCENDING_TRAVERSE(pReader->order) ? 0 : taosArrayGetSize(pBlockScanInfo->delSkyline) - 1;
- pBlockScanInfo->iiter.index = pBlockScanInfo->iter.index;
- pBlockScanInfo->fileDelIndex = pBlockScanInfo->iter.index;
- pBlockScanInfo->lastBlockDelIndex = pBlockScanInfo->iter.index;
+ int32_t index = getInitialDelIndex(pBlockScanInfo->delSkyline, pReader->order);
+
+ pBlockScanInfo->iter.index = index;
+ pBlockScanInfo->iiter.index = index;
+ pBlockScanInfo->fileDelIndex = index;
+ pBlockScanInfo->lastBlockDelIndex = index;
+
return code;
_err:
@@ -2696,7 +2768,7 @@ static int32_t uidComparFunc(const void* p1, const void* p2) {
}
}
-static void extractOrderedTableUidList(SUidOrderCheckInfo* pOrderCheckInfo, SReaderStatus* pStatus) {
+static void extractOrderedTableUidList(SUidOrderCheckInfo* pOrderCheckInfo, SReaderStatus* pStatus, int32_t order) {
int32_t index = 0;
int32_t total = taosHashGetSize(pStatus->pTableMap);
@@ -2710,7 +2782,21 @@ static void extractOrderedTableUidList(SUidOrderCheckInfo* pOrderCheckInfo, SRea
taosSort(pOrderCheckInfo->tableUidList, total, sizeof(uint64_t), uidComparFunc);
}
-static int32_t initOrderCheckInfo(SUidOrderCheckInfo* pOrderCheckInfo, SReaderStatus* pStatus) {
+// reset the last del file index
+static void resetScanBlockLastBlockDelIndex(SReaderStatus* pStatus, int32_t order) {
+ void* p = taosHashIterate(pStatus->pTableMap, NULL);
+ while (p != NULL) {
+ STableBlockScanInfo* pScanInfo = *(STableBlockScanInfo**)p;
+
+ // reset the last del file index
+ pScanInfo->lastBlockDelIndex = getInitialDelIndex(pScanInfo->delSkyline, order);
+ p = taosHashIterate(pStatus->pTableMap, p);
+ }
+}
+
+static int32_t initOrderCheckInfo(SUidOrderCheckInfo* pOrderCheckInfo, STsdbReader* pReader) {
+ SReaderStatus* pStatus = &pReader->status;
+
int32_t total = taosHashGetSize(pStatus->pTableMap);
if (total == 0) {
return TSDB_CODE_SUCCESS;
@@ -2723,7 +2809,7 @@ static int32_t initOrderCheckInfo(SUidOrderCheckInfo* pOrderCheckInfo, SReaderSt
return TSDB_CODE_OUT_OF_MEMORY;
}
- extractOrderedTableUidList(pOrderCheckInfo, pStatus);
+ extractOrderedTableUidList(pOrderCheckInfo, pStatus, pReader->order);
uint64_t uid = pOrderCheckInfo->tableUidList[0];
pStatus->pTableIter = taosHashGet(pStatus->pTableMap, &uid, sizeof(uid));
} else {
@@ -2740,7 +2826,7 @@ static int32_t initOrderCheckInfo(SUidOrderCheckInfo* pOrderCheckInfo, SReaderSt
}
pOrderCheckInfo->tableUidList = p;
- extractOrderedTableUidList(pOrderCheckInfo, pStatus);
+ extractOrderedTableUidList(pOrderCheckInfo, pStatus, pReader->order);
uid = pOrderCheckInfo->tableUidList[0];
pStatus->pTableIter = taosHashGet(pStatus->pTableMap, &uid, sizeof(uid));
@@ -2760,11 +2846,7 @@ static bool moveToNextTable(SUidOrderCheckInfo* pOrderedCheckInfo, SReaderStatus
uint64_t uid = pOrderedCheckInfo->tableUidList[pOrderedCheckInfo->currentIndex];
pStatus->pTableIter = taosHashGet(pStatus->pTableMap, &uid, sizeof(uid));
- if (pStatus->pTableIter == NULL) {
- return false;
- }
-
- return true;
+ return (pStatus->pTableIter != NULL);
}
static int32_t doLoadLastBlockSequentially(STsdbReader* pReader) {
@@ -2772,7 +2854,7 @@ static int32_t doLoadLastBlockSequentially(STsdbReader* pReader) {
SLastBlockReader* pLastBlockReader = pStatus->fileIter.pLastBlockReader;
SUidOrderCheckInfo* pOrderedCheckInfo = &pStatus->uidCheckInfo;
- int32_t code = initOrderCheckInfo(pOrderedCheckInfo, pStatus);
+ int32_t code = initOrderCheckInfo(pOrderedCheckInfo, pReader);
if (code != TSDB_CODE_SUCCESS || (taosHashGetSize(pStatus->pTableMap) == 0)) {
return code;
}
@@ -2837,6 +2919,8 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) {
SFileDataBlockInfo* pBlockInfo = getCurrentBlockInfo(pBlockIter);
SLastBlockReader* pLastBlockReader = pReader->status.fileIter.pLastBlockReader;
+ ASSERT(pBlockInfo != NULL);
+
if (pBlockInfo != NULL) {
pScanInfo =
*(STableBlockScanInfo**)taosHashGet(pReader->status.pTableMap, &pBlockInfo->uid, sizeof(pBlockInfo->uid));
@@ -2857,7 +2941,7 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) {
initLastBlockReader(pLastBlockReader, pScanInfo, pReader);
TSDBKEY keyInBuf = getCurrentKeyInBuf(pScanInfo, pReader);
- if (pBlockInfo == NULL) { // build data block from last data file
+ /*if (pBlockInfo == NULL) { // build data block from last data file
SBlockData* pBData = &pReader->status.fileBlockData;
tBlockDataReset(pBData);
@@ -2889,7 +2973,7 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) {
pReader, pResBlock->info.id.uid, pResBlock->info.window.skey, pResBlock->info.window.ekey,
pResBlock->info.rows, el, pReader->idStr);
}
- } else if (fileBlockShouldLoad(pReader, pBlockInfo, pBlock, pScanInfo, keyInBuf, pLastBlockReader)) {
+ } else*/ if (fileBlockShouldLoad(pReader, pBlockInfo, pBlock, pScanInfo, keyInBuf, pLastBlockReader)) {
code = doLoadFileBlockData(pReader, pBlockIter, &pStatus->fileBlockData, pScanInfo->uid);
if (code != TSDB_CODE_SUCCESS) {
return code;
@@ -3068,6 +3152,7 @@ static int32_t buildBlockFromFiles(STsdbReader* pReader) {
// this file does not have data files, let's start check the last block file if exists
if (pBlockIter->numOfBlocks == 0) {
+ resetScanBlockLastBlockDelIndex(&pReader->status, pReader->order);
goto _begin;
}
}
@@ -3104,6 +3189,7 @@ static int32_t buildBlockFromFiles(STsdbReader* pReader) {
tBlockDataReset(pBlockData);
resetDataBlockIterator(pBlockIter, pReader->order);
+ resetScanBlockLastBlockDelIndex(&pReader->status, pReader->order);
goto _begin;
} else {
code = initForFirstBlockInFile(pReader, pBlockIter);
@@ -3115,6 +3201,7 @@ static int32_t buildBlockFromFiles(STsdbReader* pReader) {
// this file does not have blocks, let's start check the last block file
if (pBlockIter->numOfBlocks == 0) {
+ resetScanBlockLastBlockDelIndex(&pReader->status, pReader->order);
goto _begin;
}
}
@@ -3957,6 +4044,7 @@ void tsdbReaderClose(STsdbReader* pReader) {
return;
}
+ tsdbAcquireReader(pReader);
{
if (pReader->innerReader[0] != NULL || pReader->innerReader[1] != NULL) {
STsdbReader* p = pReader->innerReader[0];
@@ -4014,10 +4102,13 @@ void tsdbReaderClose(STsdbReader* pReader) {
pReader->pDelIdx = NULL;
}
- qTrace("tsdb/reader: %p, untake snapshot", pReader);
+ qTrace("tsdb/reader-close: %p, untake snapshot", pReader);
tsdbUntakeReadSnap(pReader, pReader->pReadSnap, true);
+ pReader->pReadSnap = NULL;
- taosThreadMutexDestroy(&pReader->readerMutex);
+ tsdbReleaseReader(pReader);
+
+ tsdbUninitReaderLock(pReader);
taosMemoryFree(pReader->status.uidCheckInfo.tableUidList);
SIOCostSummary* pCost = &pReader->cost;
@@ -4164,16 +4255,16 @@ static int32_t tsdbSetQueryReseek(void* pQHandle) {
int32_t code = 0;
STsdbReader* pReader = pQHandle;
- code = taosThreadMutexTryLock(&pReader->readerMutex);
+ code = tsdbTryAcquireReader(pReader);
if (code == 0) {
if (pReader->suspended) {
- taosThreadMutexUnlock(&pReader->readerMutex);
+ tsdbReleaseReader(pReader);
return code;
}
tsdbReaderSuspend(pReader);
- taosThreadMutexUnlock(&pReader->readerMutex);
+ tsdbReleaseReader(pReader);
return code;
} else if (code == EBUSY) {
@@ -4274,8 +4365,9 @@ bool tsdbNextDataBlock(STsdbReader* pReader) {
SReaderStatus* pStatus = &pReader->status;
- qTrace("tsdb/read: %p, take read mutex", pReader);
- taosThreadMutexLock(&pReader->readerMutex);
+ int32_t code = tsdbAcquireReader(pReader);
+ qTrace("tsdb/read: %p, take read mutex, code: %d", pReader, code);
+
if (pReader->suspended) {
tsdbReaderResume(pReader);
}
@@ -4287,7 +4379,7 @@ bool tsdbNextDataBlock(STsdbReader* pReader) {
pStatus = &pReader->innerReader[0]->status;
if (pStatus->composedDataBlock) {
qTrace("tsdb/read: %p, unlock read mutex", pReader);
- taosThreadMutexUnlock(&pReader->readerMutex);
+ tsdbReleaseReader(pReader);
}
return ret;
@@ -4310,7 +4402,7 @@ bool tsdbNextDataBlock(STsdbReader* pReader) {
if (ret) {
if (pStatus->composedDataBlock) {
qTrace("tsdb/read: %p, unlock read mutex", pReader);
- taosThreadMutexUnlock(&pReader->readerMutex);
+ tsdbReleaseReader(pReader);
}
return ret;
@@ -4330,7 +4422,7 @@ bool tsdbNextDataBlock(STsdbReader* pReader) {
pStatus = &pReader->innerReader[1]->status;
if (pStatus->composedDataBlock) {
qTrace("tsdb/read: %p, unlock read mutex", pReader);
- taosThreadMutexUnlock(&pReader->readerMutex);
+ tsdbReleaseReader(pReader);
}
return ret1;
@@ -4338,7 +4430,7 @@ bool tsdbNextDataBlock(STsdbReader* pReader) {
}
qTrace("tsdb/read: %p, unlock read mutex", pReader);
- taosThreadMutexUnlock(&pReader->readerMutex);
+ tsdbReleaseReader(pReader);
return false;
}
@@ -4497,13 +4589,6 @@ static SSDataBlock* doRetrieveDataBlock(STsdbReader* pReader) {
return pReader->pResBlock;
}
-void tsdbReleaseDataBlock(STsdbReader* pReader) {
- // SReaderStatus* pStatus = &pReader->status;
- // if (!pStatus->composedDataBlock) {
- taosThreadMutexUnlock(&pReader->readerMutex);
- //}
-}
-
SSDataBlock* tsdbRetrieveDataBlock(STsdbReader* pReader, SArray* pIdList) {
STsdbReader* pTReader = pReader;
if (pReader->type == TIMEWINDOW_RANGE_EXTERNAL) {
@@ -4522,7 +4607,7 @@ SSDataBlock* tsdbRetrieveDataBlock(STsdbReader* pReader, SArray* pIdList) {
SSDataBlock* ret = doRetrieveDataBlock(pTReader);
qTrace("tsdb/read-retrieve: %p, unlock read mutex", pReader);
- taosThreadMutexUnlock(&pReader->readerMutex);
+ tsdbReleaseReader(pReader);
return ret;
}
@@ -4531,7 +4616,7 @@ int32_t tsdbReaderReset(STsdbReader* pReader, SQueryTableDataCond* pCond) {
SReaderStatus* pStatus = &pReader->status;
qTrace("tsdb/reader-reset: %p, take read mutex", pReader);
- taosThreadMutexLock(&pReader->readerMutex);
+ tsdbAcquireReader(pReader);
if (pReader->suspended) {
tsdbReaderResume(pReader);
@@ -4540,7 +4625,7 @@ int32_t tsdbReaderReset(STsdbReader* pReader, SQueryTableDataCond* pCond) {
if (isEmptyQueryTimeWindow(&pReader->window) || pReader->pReadSnap == NULL) {
tsdbDebug("tsdb reader reset return %p", pReader->pReadSnap);
- taosThreadMutexUnlock(&pReader->readerMutex);
+ tsdbReleaseReader(pReader);
return TSDB_CODE_SUCCESS;
}
@@ -4578,7 +4663,7 @@ int32_t tsdbReaderReset(STsdbReader* pReader, SQueryTableDataCond* pCond) {
tsdbError("%p reset reader failed, numOfTables:%d, query range:%" PRId64 " - %" PRId64 " in query %s", pReader,
numOfTables, pReader->window.skey, pReader->window.ekey, pReader->idStr);
- taosThreadMutexUnlock(&pReader->readerMutex);
+ tsdbReleaseReader(pReader);
return code;
}
@@ -4589,7 +4674,7 @@ int32_t tsdbReaderReset(STsdbReader* pReader, SQueryTableDataCond* pCond) {
pReader, pReader->suid, numOfTables, pCond->twindows.skey, pReader->window.skey, pReader->window.ekey,
pReader->idStr);
- taosThreadMutexUnlock(&pReader->readerMutex);
+ tsdbReleaseReader(pReader);
return code;
}
@@ -4674,7 +4759,7 @@ int64_t tsdbGetNumOfRowsInMemTable(STsdbReader* pReader) {
int64_t rows = 0;
SReaderStatus* pStatus = &pReader->status;
- taosThreadMutexLock(&pReader->readerMutex);
+ tsdbAcquireReader(pReader);
if (pReader->suspended) {
tsdbReaderResume(pReader);
}
@@ -4704,7 +4789,7 @@ int64_t tsdbGetNumOfRowsInMemTable(STsdbReader* pReader) {
pStatus->pTableIter = taosHashIterate(pStatus->pTableMap, pStatus->pTableIter);
}
- taosThreadMutexUnlock(&pReader->readerMutex);
+ tsdbReleaseReader(pReader);
return rows;
}
diff --git a/source/dnode/vnode/src/tsdb/tsdbSnapshot.c b/source/dnode/vnode/src/tsdb/tsdbSnapshot.c
index 453b95b6c3..a04d7b8a5d 100644
--- a/source/dnode/vnode/src/tsdb/tsdbSnapshot.c
+++ b/source/dnode/vnode/src/tsdb/tsdbSnapshot.c
@@ -15,274 +15,628 @@
#include "tsdb.h"
-// STsdbSnapReader ========================================
-typedef enum { SNAP_DATA_FILE_ITER = 0, SNAP_STT_FILE_ITER } EFIterT;
-typedef struct {
- SRBTreeNode n;
- SRowInfo rInfo;
- EFIterT type;
- union {
- struct {
- SArray* aBlockIdx;
- int32_t iBlockIdx;
- SBlockIdx* pBlockIdx;
- SMapData mBlock;
- int32_t iBlock;
- }; // .data file
- struct {
- int32_t iStt;
- SArray* aSttBlk;
- int32_t iSttBlk;
- }; // .stt file
- };
- SBlockData bData;
- int32_t iRow;
-} SFDataIter;
-
-struct STsdbSnapReader {
- STsdb* pTsdb;
- int64_t sver;
- int64_t ever;
- STsdbFS fs;
- int8_t type;
- // for data file
- int8_t dataDone;
- int32_t fid;
- SDataFReader* pDataFReader;
- SFDataIter* pIter;
- SRBTree rbt;
- SFDataIter aFDataIter[TSDB_MAX_STT_TRIGGER + 1];
- SBlockData bData;
- SSkmInfo skmTable;
- // for del file
- int8_t delDone;
- SDelFReader* pDelFReader;
- SArray* aDelIdx; // SArray
- int32_t iDelIdx;
- SArray* aDelData; // SArray
- uint8_t* aBuf[5];
-};
-
-extern int32_t tRowInfoCmprFn(const void* p1, const void* p2);
extern int32_t tsdbReadDataBlockEx(SDataFReader* pReader, SDataBlk* pDataBlk, SBlockData* pBlockData);
extern int32_t tsdbUpdateTableSchema(SMeta* pMeta, int64_t suid, int64_t uid, SSkmInfo* pSkmInfo);
+extern int32_t tsdbWriteDataBlock(SDataFWriter* pWriter, SBlockData* pBlockData, SMapData* mDataBlk, int8_t cmprAlg);
+extern int32_t tsdbWriteSttBlock(SDataFWriter* pWriter, SBlockData* pBlockData, SArray* aSttBlk, int8_t cmprAlg);
-static int32_t tFDataIterCmprFn(const SRBTreeNode* pNode1, const SRBTreeNode* pNode2) {
- SFDataIter* pIter1 = (SFDataIter*)(((uint8_t*)pNode1) - offsetof(SFDataIter, n));
- SFDataIter* pIter2 = (SFDataIter*)(((uint8_t*)pNode2) - offsetof(SFDataIter, n));
+// STsdbDataIter2 ========================================
+#define TSDB_MEM_TABLE_DATA_ITER 0
+#define TSDB_DATA_FILE_DATA_ITER 1
+#define TSDB_STT_FILE_DATA_ITER 2
+#define TSDB_TOMB_FILE_DATA_ITER 3
- return tRowInfoCmprFn(&pIter1->rInfo, &pIter2->rInfo);
-}
+typedef struct STsdbDataIter2 STsdbDataIter2;
+typedef struct STsdbFilterInfo STsdbFilterInfo;
-static int32_t tsdbSnapReadOpenFile(STsdbSnapReader* pReader) {
+typedef struct {
+ int64_t suid;
+ int64_t uid;
+ SDelData delData;
+} SDelInfo;
+
+struct STsdbDataIter2 {
+ STsdbDataIter2* next;
+ SRBTreeNode rbtn;
+
+ int32_t type;
+ SRowInfo rowInfo;
+ SDelInfo delInfo;
+ union {
+ // TSDB_MEM_TABLE_DATA_ITER
+ struct {
+ SMemTable* pMemTable;
+ } mIter;
+
+ // TSDB_DATA_FILE_DATA_ITER
+ struct {
+ SDataFReader* pReader;
+ SArray* aBlockIdx; // SArray
+ SMapData mDataBlk;
+ SBlockData bData;
+ int32_t iBlockIdx;
+ int32_t iDataBlk;
+ int32_t iRow;
+ } dIter;
+
+ // TSDB_STT_FILE_DATA_ITER
+ struct {
+ SDataFReader* pReader;
+ int32_t iStt;
+ SArray* aSttBlk;
+ SBlockData bData;
+ int32_t iSttBlk;
+ int32_t iRow;
+ } sIter;
+ // TSDB_TOMB_FILE_DATA_ITER
+ struct {
+ SDelFReader* pReader;
+ SArray* aDelIdx;
+ SArray* aDelData;
+ int32_t iDelIdx;
+ int32_t iDelData;
+ } tIter;
+ };
+};
+
+#define TSDB_FILTER_FLAG_BY_VERSION 0x1
+struct STsdbFilterInfo {
+ int32_t flag;
+ int64_t sver;
+ int64_t ever;
+};
+
+#define TSDB_RBTN_TO_DATA_ITER(pNode) ((STsdbDataIter2*)(((char*)pNode) - offsetof(STsdbDataIter2, rbtn)))
+
+/* open */
+static int32_t tsdbOpenDataFileDataIter(SDataFReader* pReader, STsdbDataIter2** ppIter) {
int32_t code = 0;
int32_t lino = 0;
- SDFileSet dFileSet = {.fid = pReader->fid};
- SDFileSet* pSet = taosArraySearch(pReader->fs.aDFileSet, &dFileSet, tDFileSetCmprFn, TD_GT);
- if (pSet == NULL) return code;
-
- pReader->fid = pSet->fid;
- code = tsdbDataFReaderOpen(&pReader->pDataFReader, pReader->pTsdb, pSet);
- TSDB_CHECK_CODE(code, lino, _exit);
-
- pReader->pIter = NULL;
- tRBTreeCreate(&pReader->rbt, tFDataIterCmprFn);
-
- // .data file
- SFDataIter* pIter = &pReader->aFDataIter[0];
- pIter->type = SNAP_DATA_FILE_ITER;
-
- code = tsdbReadBlockIdx(pReader->pDataFReader, pIter->aBlockIdx);
- TSDB_CHECK_CODE(code, lino, _exit);
-
- for (pIter->iBlockIdx = 0; pIter->iBlockIdx < taosArrayGetSize(pIter->aBlockIdx); pIter->iBlockIdx++) {
- pIter->pBlockIdx = (SBlockIdx*)taosArrayGet(pIter->aBlockIdx, pIter->iBlockIdx);
-
- code = tsdbReadDataBlk(pReader->pDataFReader, pIter->pBlockIdx, &pIter->mBlock);
+ // create handle
+ STsdbDataIter2* pIter = (STsdbDataIter2*)taosMemoryCalloc(1, sizeof(*pIter));
+ if (pIter == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
TSDB_CHECK_CODE(code, lino, _exit);
-
- for (pIter->iBlock = 0; pIter->iBlock < pIter->mBlock.nItem; pIter->iBlock++) {
- SDataBlk dataBlk;
- tMapDataGetItemByIdx(&pIter->mBlock, pIter->iBlock, &dataBlk, tGetDataBlk);
-
- if (dataBlk.minVer > pReader->ever || dataBlk.maxVer < pReader->sver) continue;
-
- code = tsdbReadDataBlockEx(pReader->pDataFReader, &dataBlk, &pIter->bData);
- TSDB_CHECK_CODE(code, lino, _exit);
-
- ASSERT(pIter->pBlockIdx->suid == pIter->bData.suid);
- ASSERT(pIter->pBlockIdx->uid == pIter->bData.uid);
-
- for (pIter->iRow = 0; pIter->iRow < pIter->bData.nRow; pIter->iRow++) {
- int64_t rowVer = pIter->bData.aVersion[pIter->iRow];
-
- if (rowVer >= pReader->sver && rowVer <= pReader->ever) {
- pIter->rInfo.suid = pIter->pBlockIdx->suid;
- pIter->rInfo.uid = pIter->pBlockIdx->uid;
- pIter->rInfo.row = tsdbRowFromBlockData(&pIter->bData, pIter->iRow);
- goto _add_iter_and_break;
- }
- }
- }
-
- continue;
-
- _add_iter_and_break:
- tRBTreePut(&pReader->rbt, (SRBTreeNode*)pIter);
- break;
}
- // .stt file
- pIter = &pReader->aFDataIter[1];
- for (int32_t iStt = 0; iStt < pSet->nSttF; iStt++) {
- pIter->type = SNAP_STT_FILE_ITER;
- pIter->iStt = iStt;
-
- code = tsdbReadSttBlk(pReader->pDataFReader, iStt, pIter->aSttBlk);
+ pIter->type = TSDB_DATA_FILE_DATA_ITER;
+ pIter->dIter.pReader = pReader;
+ if ((pIter->dIter.aBlockIdx = taosArrayInit(0, sizeof(SBlockIdx))) == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
TSDB_CHECK_CODE(code, lino, _exit);
+ }
- for (pIter->iSttBlk = 0; pIter->iSttBlk < taosArrayGetSize(pIter->aSttBlk); pIter->iSttBlk++) {
- SSttBlk* pSttBlk = (SSttBlk*)taosArrayGet(pIter->aSttBlk, pIter->iSttBlk);
+ code = tBlockDataCreate(&pIter->dIter.bData);
+ TSDB_CHECK_CODE(code, lino, _exit);
- if (pSttBlk->minVer > pReader->ever) continue;
- if (pSttBlk->maxVer < pReader->sver) continue;
+ pIter->dIter.iBlockIdx = 0;
+ pIter->dIter.iDataBlk = 0;
+ pIter->dIter.iRow = 0;
- code = tsdbReadSttBlockEx(pReader->pDataFReader, iStt, pSttBlk, &pIter->bData);
- TSDB_CHECK_CODE(code, lino, _exit);
+ // read data
+ code = tsdbReadBlockIdx(pReader, pIter->dIter.aBlockIdx);
+ TSDB_CHECK_CODE(code, lino, _exit);
- for (pIter->iRow = 0; pIter->iRow < pIter->bData.nRow; pIter->iRow++) {
- int64_t rowVer = pIter->bData.aVersion[pIter->iRow];
+ if (taosArrayGetSize(pIter->dIter.aBlockIdx) == 0) goto _clear;
- if (rowVer >= pReader->sver && rowVer <= pReader->ever) {
- pIter->rInfo.suid = pIter->bData.suid;
- pIter->rInfo.uid = pIter->bData.uid ? pIter->bData.uid : pIter->bData.aUid[pIter->iRow];
- pIter->rInfo.row = tsdbRowFromBlockData(&pIter->bData, pIter->iRow);
- goto _add_iter;
+_exit:
+ if (code) {
+ if (pIter) {
+ _clear:
+ tBlockDataDestroy(&pIter->dIter.bData);
+ taosArrayDestroy(pIter->dIter.aBlockIdx);
+ taosMemoryFree(pIter);
+ pIter = NULL;
+ }
+ }
+ *ppIter = pIter;
+ return code;
+}
+
+static int32_t tsdbOpenSttFileDataIter(SDataFReader* pReader, int32_t iStt, STsdbDataIter2** ppIter) {
+ int32_t code = 0;
+ int32_t lino = 0;
+
+ // create handle
+ STsdbDataIter2* pIter = (STsdbDataIter2*)taosMemoryCalloc(1, sizeof(*pIter));
+ if (pIter == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ TSDB_CHECK_CODE(code, lino, _exit);
+ }
+
+ pIter->type = TSDB_STT_FILE_DATA_ITER;
+ pIter->sIter.pReader = pReader;
+ pIter->sIter.iStt = iStt;
+ pIter->sIter.aSttBlk = taosArrayInit(0, sizeof(SSttBlk));
+ if (pIter->sIter.aSttBlk == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ TSDB_CHECK_CODE(code, lino, _exit);
+ }
+
+ code = tBlockDataCreate(&pIter->sIter.bData);
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+ pIter->sIter.iSttBlk = 0;
+ pIter->sIter.iRow = 0;
+
+ // read data
+ code = tsdbReadSttBlk(pReader, iStt, pIter->sIter.aSttBlk);
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+ if (taosArrayGetSize(pIter->sIter.aSttBlk) == 0) goto _clear;
+
+_exit:
+ if (code) {
+ if (pIter) {
+ _clear:
+ taosArrayDestroy(pIter->sIter.aSttBlk);
+ tBlockDataDestroy(&pIter->sIter.bData);
+ taosMemoryFree(pIter);
+ pIter = NULL;
+ }
+ }
+ *ppIter = pIter;
+ return code;
+}
+
+static int32_t tsdbOpenTombFileDataIter(SDelFReader* pReader, STsdbDataIter2** ppIter) {
+ int32_t code = 0;
+ int32_t lino = 0;
+
+ STsdbDataIter2* pIter = (STsdbDataIter2*)taosMemoryCalloc(1, sizeof(*pIter));
+ if (pIter == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ TSDB_CHECK_CODE(code, lino, _exit);
+ }
+ pIter->type = TSDB_TOMB_FILE_DATA_ITER;
+
+ pIter->tIter.pReader = pReader;
+ if ((pIter->tIter.aDelIdx = taosArrayInit(0, sizeof(SDelIdx))) == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ TSDB_CHECK_CODE(code, lino, _exit);
+ }
+ if ((pIter->tIter.aDelData = taosArrayInit(0, sizeof(SDelData))) == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ TSDB_CHECK_CODE(code, lino, _exit);
+ }
+
+ code = tsdbReadDelIdx(pReader, pIter->tIter.aDelIdx);
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+ if (taosArrayGetSize(pIter->tIter.aDelIdx) == 0) goto _clear;
+
+ pIter->tIter.iDelIdx = 0;
+ pIter->tIter.iDelData = 0;
+
+_exit:
+ if (code) {
+ if (pIter) {
+ _clear:
+ taosArrayDestroy(pIter->tIter.aDelIdx);
+ taosArrayDestroy(pIter->tIter.aDelData);
+ taosMemoryFree(pIter);
+ pIter = NULL;
+ }
+ }
+ *ppIter = pIter;
+ return code;
+}
+
+/* close */
+static void tsdbCloseDataFileDataIter(STsdbDataIter2* pIter) {
+ tBlockDataDestroy(&pIter->dIter.bData);
+ tMapDataClear(&pIter->dIter.mDataBlk);
+ taosArrayDestroy(pIter->dIter.aBlockIdx);
+ taosMemoryFree(pIter);
+}
+
+static void tsdbCloseSttFileDataIter(STsdbDataIter2* pIter) {
+ tBlockDataDestroy(&pIter->sIter.bData);
+ taosArrayDestroy(pIter->sIter.aSttBlk);
+ taosMemoryFree(pIter);
+}
+
+static void tsdbCloseTombFileDataIter(STsdbDataIter2* pIter) {
+ taosArrayDestroy(pIter->tIter.aDelData);
+ taosArrayDestroy(pIter->tIter.aDelIdx);
+ taosMemoryFree(pIter);
+}
+
+static void tsdbCloseDataIter2(STsdbDataIter2* pIter) {
+ if (pIter->type == TSDB_MEM_TABLE_DATA_ITER) {
+ ASSERT(0);
+ } else if (pIter->type == TSDB_DATA_FILE_DATA_ITER) {
+ tsdbCloseDataFileDataIter(pIter);
+ } else if (pIter->type == TSDB_STT_FILE_DATA_ITER) {
+ tsdbCloseSttFileDataIter(pIter);
+ } else if (pIter->type == TSDB_TOMB_FILE_DATA_ITER) {
+ tsdbCloseTombFileDataIter(pIter);
+ } else {
+ ASSERT(0);
+ }
+}
+
+/* cmpr */
+static int32_t tsdbDataIterCmprFn(const SRBTreeNode* pNode1, const SRBTreeNode* pNode2) {
+ STsdbDataIter2* pIter1 = TSDB_RBTN_TO_DATA_ITER(pNode1);
+ STsdbDataIter2* pIter2 = TSDB_RBTN_TO_DATA_ITER(pNode2);
+ return tRowInfoCmprFn(&pIter1->rowInfo, &pIter2->rowInfo);
+}
+
+/* seek */
+
+/* iter next */
+static int32_t tsdbDataFileDataIterNext(STsdbDataIter2* pIter, STsdbFilterInfo* pFilterInfo) {
+ int32_t code = 0;
+ int32_t lino = 0;
+
+ for (;;) {
+ while (pIter->dIter.iRow < pIter->dIter.bData.nRow) {
+ if (pFilterInfo) {
+ if (pFilterInfo->flag & TSDB_FILTER_FLAG_BY_VERSION) {
+ if (pIter->dIter.bData.aVersion[pIter->dIter.iRow] < pFilterInfo->sver ||
+ pIter->dIter.bData.aVersion[pIter->dIter.iRow] > pFilterInfo->ever) {
+ pIter->dIter.iRow++;
+ continue;
+ }
+ }
+ }
+
+ pIter->rowInfo.suid = pIter->dIter.bData.suid;
+ pIter->rowInfo.uid = pIter->dIter.bData.uid;
+ pIter->rowInfo.row = tsdbRowFromBlockData(&pIter->dIter.bData, pIter->dIter.iRow);
+ pIter->dIter.iRow++;
+ goto _exit;
+ }
+
+ for (;;) {
+ while (pIter->dIter.iDataBlk < pIter->dIter.mDataBlk.nItem) {
+ SDataBlk dataBlk;
+ tMapDataGetItemByIdx(&pIter->dIter.mDataBlk, pIter->dIter.iDataBlk, &dataBlk, tGetDataBlk);
+
+ // filter
+ if (pFilterInfo) {
+ if (pFilterInfo->flag & TSDB_FILTER_FLAG_BY_VERSION) {
+ if (pFilterInfo->sver > dataBlk.maxVer || pFilterInfo->ever < dataBlk.minVer) {
+ pIter->dIter.iDataBlk++;
+ continue;
+ }
+ }
+ }
+
+ code = tsdbReadDataBlockEx(pIter->dIter.pReader, &dataBlk, &pIter->dIter.bData);
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+ pIter->dIter.iDataBlk++;
+ pIter->dIter.iRow = 0;
+
+ break;
+ }
+
+ if (pIter->dIter.iRow < pIter->dIter.bData.nRow) break;
+
+ for (;;) {
+ if (pIter->dIter.iBlockIdx < taosArrayGetSize(pIter->dIter.aBlockIdx)) {
+ SBlockIdx* pBlockIdx = taosArrayGet(pIter->dIter.aBlockIdx, pIter->dIter.iBlockIdx);
+
+ code = tsdbReadDataBlk(pIter->dIter.pReader, pBlockIdx, &pIter->dIter.mDataBlk);
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+ pIter->dIter.iBlockIdx++;
+ pIter->dIter.iDataBlk = 0;
+
+ break;
+ } else {
+ pIter->rowInfo = (SRowInfo){0};
+ goto _exit;
}
}
}
-
- continue;
-
- _add_iter:
- tRBTreePut(&pReader->rbt, (SRBTreeNode*)pIter);
- pIter++;
}
_exit:
if (code) {
- tsdbError("vgId:%d, %s failed since %s", TD_VID(pReader->pTsdb->pVnode), __func__, tstrerror(code));
- } else {
- tsdbInfo("vgId:%d, %s done, path:%s, fid:%d", TD_VID(pReader->pTsdb->pVnode), __func__, pReader->pTsdb->path,
- pReader->fid);
+ tsdbError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
}
return code;
}
-static int32_t tsdbSnapNextRow(STsdbSnapReader* pReader) {
+static int32_t tsdbSttFileDataIterNext(STsdbDataIter2* pIter, STsdbFilterInfo* pFilterInfo) {
int32_t code = 0;
+ int32_t lino = 0;
- if (pReader->pIter) {
- SFDataIter* pIter = NULL;
- while (true) {
- _find_row:
- pIter = pReader->pIter;
- for (pIter->iRow++; pIter->iRow < pIter->bData.nRow; pIter->iRow++) {
- int64_t rowVer = pIter->bData.aVersion[pIter->iRow];
-
- if (rowVer >= pReader->sver && rowVer <= pReader->ever) {
- pIter->rInfo.suid = pIter->bData.suid;
- pIter->rInfo.uid = pIter->bData.uid ? pIter->bData.uid : pIter->bData.aUid[pIter->iRow];
- pIter->rInfo.row = tsdbRowFromBlockData(&pIter->bData, pIter->iRow);
- goto _out;
- }
- }
-
- if (pIter->type == SNAP_DATA_FILE_ITER) {
- while (true) {
- for (pIter->iBlock++; pIter->iBlock < pIter->mBlock.nItem; pIter->iBlock++) {
- SDataBlk dataBlk;
- tMapDataGetItemByIdx(&pIter->mBlock, pIter->iBlock, &dataBlk, tGetDataBlk);
-
- if (dataBlk.minVer > pReader->ever || dataBlk.maxVer < pReader->sver) continue;
-
- code = tsdbReadDataBlockEx(pReader->pDataFReader, &dataBlk, &pIter->bData);
- if (code) goto _err;
-
- pIter->iRow = -1;
- goto _find_row;
+ for (;;) {
+ while (pIter->sIter.iRow < pIter->sIter.bData.nRow) {
+ if (pFilterInfo) {
+ if (pFilterInfo->flag & TSDB_FILTER_FLAG_BY_VERSION) {
+ if (pFilterInfo->sver > pIter->sIter.bData.aVersion[pIter->sIter.iRow] ||
+ pFilterInfo->ever < pIter->sIter.bData.aVersion[pIter->sIter.iRow]) {
+ pIter->sIter.iRow++;
+ continue;
}
-
- pIter->iBlockIdx++;
- if (pIter->iBlockIdx >= taosArrayGetSize(pIter->aBlockIdx)) break;
-
- pIter->pBlockIdx = (SBlockIdx*)taosArrayGet(pIter->aBlockIdx, pIter->iBlockIdx);
- code = tsdbReadDataBlk(pReader->pDataFReader, pIter->pBlockIdx, &pIter->mBlock);
- if (code) goto _err;
- pIter->iBlock = -1;
}
-
- pReader->pIter = NULL;
- break;
- } else if (pIter->type == SNAP_STT_FILE_ITER) {
- for (pIter->iSttBlk++; pIter->iSttBlk < taosArrayGetSize(pIter->aSttBlk); pIter->iSttBlk++) {
- SSttBlk* pSttBlk = (SSttBlk*)taosArrayGet(pIter->aSttBlk, pIter->iSttBlk);
-
- if (pSttBlk->minVer > pReader->ever || pSttBlk->maxVer < pReader->sver) continue;
-
- code = tsdbReadSttBlockEx(pReader->pDataFReader, pIter->iStt, pSttBlk, &pIter->bData);
- if (code) goto _err;
-
- pIter->iRow = -1;
- goto _find_row;
- }
-
- pReader->pIter = NULL;
- break;
- } else {
- ASSERT(0);
}
+
+ pIter->rowInfo.suid = pIter->sIter.bData.suid;
+ pIter->rowInfo.uid = pIter->sIter.bData.uid ? pIter->sIter.bData.uid : pIter->sIter.bData.aUid[pIter->sIter.iRow];
+ pIter->rowInfo.row = tsdbRowFromBlockData(&pIter->sIter.bData, pIter->sIter.iRow);
+ pIter->sIter.iRow++;
+ goto _exit;
}
- _out:
- pIter = (SFDataIter*)tRBTreeMin(&pReader->rbt);
- if (pReader->pIter && pIter) {
- int32_t c = tRowInfoCmprFn(&pReader->pIter->rInfo, &pIter->rInfo);
- if (c > 0) {
- tRBTreePut(&pReader->rbt, (SRBTreeNode*)pReader->pIter);
- pReader->pIter = NULL;
+ for (;;) {
+ if (pIter->sIter.iSttBlk < taosArrayGetSize(pIter->sIter.aSttBlk)) {
+ SSttBlk* pSttBlk = taosArrayGet(pIter->sIter.aSttBlk, pIter->sIter.iSttBlk);
+
+ if (pFilterInfo) {
+ if (pFilterInfo->flag & TSDB_FILTER_FLAG_BY_VERSION) {
+ if (pFilterInfo->sver > pSttBlk->maxVer || pFilterInfo->ever < pSttBlk->minVer) {
+ pIter->sIter.iSttBlk++;
+ continue;
+ }
+ }
+ }
+
+ code = tsdbReadSttBlockEx(pIter->sIter.pReader, pIter->sIter.iStt, pSttBlk, &pIter->sIter.bData);
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+ pIter->sIter.iRow = 0;
+ pIter->sIter.iSttBlk++;
+ break;
} else {
- ASSERT(c);
+ pIter->rowInfo = (SRowInfo){0};
+ goto _exit;
+ }
+ }
+ }
+
+_exit:
+ if (code) {
+ tsdbError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
+ }
+ return code;
+}
+
+static int32_t tsdbTombFileDataIterNext(STsdbDataIter2* pIter, STsdbFilterInfo* pFilterInfo) {
+ int32_t code = 0;
+ int32_t lino = 0;
+
+ for (;;) {
+ while (pIter->tIter.iDelData < taosArrayGetSize(pIter->tIter.aDelData)) {
+ SDelData* pDelData = taosArrayGet(pIter->tIter.aDelData, pIter->tIter.iDelData);
+
+ if (pFilterInfo) {
+ if (pFilterInfo->flag & TSDB_FILTER_FLAG_BY_VERSION) {
+ if (pFilterInfo->sver > pDelData->version || pFilterInfo->ever < pDelData->version) {
+ pIter->tIter.iDelData++;
+ continue;
+ }
+ }
+ }
+
+ pIter->delInfo.delData = *pDelData;
+ pIter->tIter.iDelData++;
+ goto _exit;
+ }
+
+ for (;;) {
+ if (pIter->tIter.iDelIdx < taosArrayGetSize(pIter->tIter.aDelIdx)) {
+ SDelIdx* pDelIdx = taosArrayGet(pIter->tIter.aDelIdx, pIter->tIter.iDelIdx);
+
+ code = tsdbReadDelData(pIter->tIter.pReader, pDelIdx, pIter->tIter.aDelData);
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+ pIter->delInfo.suid = pDelIdx->suid;
+ pIter->delInfo.uid = pDelIdx->uid;
+ pIter->tIter.iDelData = 0;
+ pIter->tIter.iDelIdx++;
+ break;
+ } else {
+ pIter->delInfo = (SDelInfo){0};
+ goto _exit;
+ }
+ }
+ }
+
+_exit:
+ if (code) {
+ tsdbError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
+ }
+ return code;
+}
+
+static int32_t tsdbDataIterNext2(STsdbDataIter2* pIter, STsdbFilterInfo* pFilterInfo) {
+ int32_t code = 0;
+
+ if (pIter->type == TSDB_MEM_TABLE_DATA_ITER) {
+ ASSERT(0);
+ return code;
+ } else if (pIter->type == TSDB_DATA_FILE_DATA_ITER) {
+ return tsdbDataFileDataIterNext(pIter, pFilterInfo);
+ } else if (pIter->type == TSDB_STT_FILE_DATA_ITER) {
+ return tsdbSttFileDataIterNext(pIter, pFilterInfo);
+ } else if (pIter->type == TSDB_TOMB_FILE_DATA_ITER) {
+ return tsdbTombFileDataIterNext(pIter, pFilterInfo);
+ } else {
+ ASSERT(0);
+ return code;
+ }
+}
+
+/* get */
+
+// STsdbSnapReader ========================================
+struct STsdbSnapReader {
+ STsdb* pTsdb;
+ int64_t sver;
+ int64_t ever;
+ int8_t type;
+ uint8_t* aBuf[5];
+
+ STsdbFS fs;
+ TABLEID tbid;
+ SSkmInfo skmTable;
+
+ // timeseries data
+ int8_t dataDone;
+ int32_t fid;
+
+ SDataFReader* pDataFReader;
+ STsdbDataIter2* iterList;
+ STsdbDataIter2* pIter;
+ SRBTree rbt;
+ SBlockData bData;
+
+ // tombstone data
+ int8_t delDone;
+ SDelFReader* pDelFReader;
+ STsdbDataIter2* pTIter;
+ SArray* aDelData;
+};
+
+static int32_t tsdbSnapReadFileDataStart(STsdbSnapReader* pReader) {
+ int32_t code = 0;
+ int32_t lino = 0;
+
+ SDFileSet* pSet = taosArraySearch(pReader->fs.aDFileSet, &(SDFileSet){.fid = pReader->fid}, tDFileSetCmprFn, TD_GT);
+ if (pSet == NULL) {
+ pReader->fid = INT32_MAX;
+ goto _exit;
+ }
+
+ pReader->fid = pSet->fid;
+
+ tRBTreeCreate(&pReader->rbt, tsdbDataIterCmprFn);
+
+ code = tsdbDataFReaderOpen(&pReader->pDataFReader, pReader->pTsdb, pSet);
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+ code = tsdbOpenDataFileDataIter(pReader->pDataFReader, &pReader->pIter);
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+ if (pReader->pIter) {
+ // iter to next with filter info (sver, ever)
+ code = tsdbDataIterNext2(pReader->pIter,
+ &(STsdbFilterInfo){.flag = TSDB_FILTER_FLAG_BY_VERSION, // flag
+ .sver = pReader->sver,
+ .ever = pReader->ever});
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+ if (pReader->pIter->rowInfo.suid || pReader->pIter->rowInfo.uid) {
+ // add to rbtree
+ tRBTreePut(&pReader->rbt, &pReader->pIter->rbtn);
+
+ // add to iterList
+ pReader->pIter->next = pReader->iterList;
+ pReader->iterList = pReader->pIter;
+ } else {
+ tsdbCloseDataIter2(pReader->pIter);
+ }
+ }
+
+ for (int32_t iStt = 0; iStt < pSet->nSttF; ++iStt) {
+ code = tsdbOpenSttFileDataIter(pReader->pDataFReader, iStt, &pReader->pIter);
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+ if (pReader->pIter) {
+ // iter to valid row
+ code = tsdbDataIterNext2(pReader->pIter,
+ &(STsdbFilterInfo){.flag = TSDB_FILTER_FLAG_BY_VERSION, // flag
+ .sver = pReader->sver,
+ .ever = pReader->ever});
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+ if (pReader->pIter->rowInfo.suid || pReader->pIter->rowInfo.uid) {
+ // add to rbtree
+ tRBTreePut(&pReader->rbt, &pReader->pIter->rbtn);
+
+ // add to iterList
+ pReader->pIter->next = pReader->iterList;
+ pReader->iterList = pReader->pIter;
+ } else {
+ tsdbCloseDataIter2(pReader->pIter);
+ }
+ }
+ }
+
+ pReader->pIter = NULL;
+
+_exit:
+ if (code) {
+ tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pReader->pTsdb->pVnode), __func__, lino, tstrerror(code));
+ } else {
+ tsdbInfo("vgId:%d %s done, fid:%d", TD_VID(pReader->pTsdb->pVnode), __func__, pReader->fid);
+ }
+ return code;
+}
+
+static void tsdbSnapReadFileDataEnd(STsdbSnapReader* pReader) {
+ while (pReader->iterList) {
+ STsdbDataIter2* pIter = pReader->iterList;
+ pReader->iterList = pIter->next;
+ tsdbCloseDataIter2(pIter);
+ }
+
+ tsdbDataFReaderClose(&pReader->pDataFReader);
+}
+
+static int32_t tsdbSnapReadNextRow(STsdbSnapReader* pReader, SRowInfo** ppRowInfo) {
+ int32_t code = 0;
+ int32_t lino = 0;
+
+ if (pReader->pIter) {
+ code = tsdbDataIterNext2(pReader->pIter, &(STsdbFilterInfo){.flag = TSDB_FILTER_FLAG_BY_VERSION, // flag
+ .sver = pReader->sver,
+ .ever = pReader->ever});
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+ if (pReader->pIter->rowInfo.suid == 0 && pReader->pIter->rowInfo.uid == 0) {
+ pReader->pIter = NULL;
+ } else {
+ SRBTreeNode* pNode = tRBTreeMin(&pReader->rbt);
+ if (pNode) {
+ int32_t c = tsdbDataIterCmprFn(&pReader->pIter->rbtn, pNode);
+ if (c > 0) {
+ tRBTreePut(&pReader->rbt, &pReader->pIter->rbtn);
+ pReader->pIter = NULL;
+ } else if (c == 0) {
+ ASSERT(0);
+ }
}
}
}
if (pReader->pIter == NULL) {
- pReader->pIter = (SFDataIter*)tRBTreeMin(&pReader->rbt);
- if (pReader->pIter) {
- tRBTreeDrop(&pReader->rbt, (SRBTreeNode*)pReader->pIter);
+ SRBTreeNode* pNode = tRBTreeMin(&pReader->rbt);
+ if (pNode) {
+ tRBTreeDrop(&pReader->rbt, pNode);
+ pReader->pIter = TSDB_RBTN_TO_DATA_ITER(pNode);
}
}
- return code;
+ if (ppRowInfo) {
+ if (pReader->pIter) {
+ *ppRowInfo = &pReader->pIter->rowInfo;
+ } else {
+ *ppRowInfo = NULL;
+ }
+ }
-_err:
+_exit:
+ if (code) {
+ tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pReader->pTsdb->pVnode), __func__, lino, tstrerror(code));
+ }
return code;
}
-static SRowInfo* tsdbSnapGetRow(STsdbSnapReader* pReader) {
+static int32_t tsdbSnapReadGetRow(STsdbSnapReader* pReader, SRowInfo** ppRowInfo) {
if (pReader->pIter) {
- return &pReader->pIter->rInfo;
- } else {
- tsdbSnapNextRow(pReader);
-
- if (pReader->pIter) {
- return &pReader->pIter->rInfo;
- } else {
- return NULL;
- }
+ *ppRowInfo = &pReader->pIter->rowInfo;
+ return 0;
}
+
+ return tsdbSnapReadNextRow(pReader, ppRowInfo);
}
static int32_t tsdbSnapCmprData(STsdbSnapReader* pReader, uint8_t** ppData) {
@@ -318,155 +672,215 @@ _exit:
return code;
}
-static int32_t tsdbSnapReadData(STsdbSnapReader* pReader, uint8_t** ppData) {
+static int32_t tsdbSnapReadTimeSeriesData(STsdbSnapReader* pReader, uint8_t** ppData) {
int32_t code = 0;
int32_t lino = 0;
STsdb* pTsdb = pReader->pTsdb;
- while (true) {
+ tBlockDataReset(&pReader->bData);
+
+ for (;;) {
+ // start a new file read if need
if (pReader->pDataFReader == NULL) {
- code = tsdbSnapReadOpenFile(pReader);
+ code = tsdbSnapReadFileDataStart(pReader);
TSDB_CHECK_CODE(code, lino, _exit);
}
if (pReader->pDataFReader == NULL) break;
- SRowInfo* pRowInfo = tsdbSnapGetRow(pReader);
+ SRowInfo* pRowInfo;
+ code = tsdbSnapReadGetRow(pReader, &pRowInfo);
+ TSDB_CHECK_CODE(code, lino, _exit);
+
if (pRowInfo == NULL) {
- tsdbDataFReaderClose(&pReader->pDataFReader);
+ tsdbSnapReadFileDataEnd(pReader);
continue;
}
- TABLEID id = {.suid = pRowInfo->suid, .uid = pRowInfo->uid};
- SBlockData* pBlockData = &pReader->bData;
-
- code = tsdbUpdateTableSchema(pTsdb->pVnode->pMeta, id.suid, id.uid, &pReader->skmTable);
+ code = tsdbUpdateTableSchema(pTsdb->pVnode->pMeta, pRowInfo->suid, pRowInfo->uid, &pReader->skmTable);
TSDB_CHECK_CODE(code, lino, _exit);
- code = tBlockDataInit(pBlockData, &id, pReader->skmTable.pTSchema, NULL, 0);
+ code = tBlockDataInit(&pReader->bData, (TABLEID*)pRowInfo, pReader->skmTable.pTSchema, NULL, 0);
TSDB_CHECK_CODE(code, lino, _exit);
- while (pRowInfo->suid == id.suid && pRowInfo->uid == id.uid) {
- code = tBlockDataAppendRow(pBlockData, &pRowInfo->row, NULL, pRowInfo->uid);
- TSDB_CHECK_CODE(code, lino, _exit);
+ do {
+ if (!TABLE_SAME_SCHEMA(pReader->bData.suid, pReader->bData.uid, pRowInfo->suid, pRowInfo->uid)) break;
- code = tsdbSnapNextRow(pReader);
- TSDB_CHECK_CODE(code, lino, _exit);
+ if (pReader->bData.uid && pReader->bData.uid != pRowInfo->uid) {
+ code = tRealloc((uint8_t**)&pReader->bData.aUid, sizeof(int64_t) * (pReader->bData.nRow + 1));
+ TSDB_CHECK_CODE(code, lino, _exit);
- pRowInfo = tsdbSnapGetRow(pReader);
- if (pRowInfo == NULL) {
- tsdbDataFReaderClose(&pReader->pDataFReader);
- break;
+ for (int32_t iRow = 0; iRow < pReader->bData.nRow; ++iRow) {
+ pReader->bData.aUid[iRow] = pReader->bData.uid;
+ }
+ pReader->bData.uid = 0;
}
- if (pBlockData->nRow >= 4096) break;
- }
+ code = tBlockDataAppendRow(&pReader->bData, &pRowInfo->row, NULL, pRowInfo->uid);
+ TSDB_CHECK_CODE(code, lino, _exit);
- code = tsdbSnapCmprData(pReader, ppData);
- TSDB_CHECK_CODE(code, lino, _exit);
+ code = tsdbSnapReadNextRow(pReader, &pRowInfo);
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+ if (pReader->bData.nRow >= 4096) break;
+ } while (pRowInfo);
+
+ ASSERT(pReader->bData.nRow > 0);
break;
}
+ if (pReader->bData.nRow > 0) {
+ ASSERT(pReader->bData.suid || pReader->bData.uid);
+
+ code = tsdbSnapCmprData(pReader, ppData);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ }
+
_exit:
if (code) {
- tsdbError("vgId:%d, %s failed since %s, path:%s", TD_VID(pTsdb->pVnode), __func__, tstrerror(code), pTsdb->path);
+ tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, lino, tstrerror(code));
}
return code;
}
-static int32_t tsdbSnapReadDel(STsdbSnapReader* pReader, uint8_t** ppData) {
+static int32_t tsdbSnapCmprTombData(STsdbSnapReader* pReader, uint8_t** ppData) {
int32_t code = 0;
int32_t lino = 0;
- STsdb* pTsdb = pReader->pTsdb;
- SDelFile* pDelFile = pReader->fs.pDelFile;
-
- if (pReader->pDelFReader == NULL) {
- if (pDelFile == NULL) {
- goto _exit;
- }
-
- // open
- code = tsdbDelFReaderOpen(&pReader->pDelFReader, pDelFile, pTsdb);
- TSDB_CHECK_CODE(code, lino, _exit);
-
- // read index
- code = tsdbReadDelIdx(pReader->pDelFReader, pReader->aDelIdx);
- TSDB_CHECK_CODE(code, lino, _exit);
-
- pReader->iDelIdx = 0;
+ int64_t size = sizeof(TABLEID);
+ for (int32_t iDelData = 0; iDelData < taosArrayGetSize(pReader->aDelData); ++iDelData) {
+ size += tPutDelData(NULL, taosArrayGet(pReader->aDelData, iDelData));
}
- while (true) {
- if (pReader->iDelIdx >= taosArrayGetSize(pReader->aDelIdx)) {
- tsdbDelFReaderClose(&pReader->pDelFReader);
- break;
- }
-
- SDelIdx* pDelIdx = (SDelIdx*)taosArrayGet(pReader->aDelIdx, pReader->iDelIdx);
-
- pReader->iDelIdx++;
-
- code = tsdbReadDelData(pReader->pDelFReader, pDelIdx, pReader->aDelData);
+ uint8_t* pData = (uint8_t*)taosMemoryMalloc(sizeof(SSnapDataHdr) + size);
+ if (pData == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
TSDB_CHECK_CODE(code, lino, _exit);
+ }
- int32_t size = 0;
- for (int32_t iDelData = 0; iDelData < taosArrayGetSize(pReader->aDelData); iDelData++) {
- SDelData* pDelData = (SDelData*)taosArrayGet(pReader->aDelData, iDelData);
+ SSnapDataHdr* pHdr = (SSnapDataHdr*)pData;
+ pHdr->type = SNAP_DATA_DEL;
+ pHdr->size = size;
- if (pDelData->version >= pReader->sver && pDelData->version <= pReader->ever) {
- size += tPutDelData(NULL, pDelData);
- }
- }
- if (size == 0) continue;
+ TABLEID* pId = (TABLEID*)(pData + sizeof(SSnapDataHdr));
+ *pId = pReader->tbid;
- // org data
- size = sizeof(TABLEID) + size;
- *ppData = taosMemoryMalloc(sizeof(SSnapDataHdr) + size);
- if (*ppData == NULL) {
- code = TSDB_CODE_OUT_OF_MEMORY;
- TSDB_CHECK_CODE(code, lino, _exit);
- }
-
- SSnapDataHdr* pHdr = (SSnapDataHdr*)(*ppData);
- pHdr->type = SNAP_DATA_DEL;
- pHdr->size = size;
-
- TABLEID* pId = (TABLEID*)(&pHdr[1]);
- pId->suid = pDelIdx->suid;
- pId->uid = pDelIdx->uid;
- int32_t n = sizeof(SSnapDataHdr) + sizeof(TABLEID);
- for (int32_t iDelData = 0; iDelData < taosArrayGetSize(pReader->aDelData); iDelData++) {
- SDelData* pDelData = (SDelData*)taosArrayGet(pReader->aDelData, iDelData);
-
- if (pDelData->version < pReader->sver) continue;
- if (pDelData->version > pReader->ever) continue;
-
- n += tPutDelData((*ppData) + n, pDelData);
- }
-
- tsdbInfo("vgId:%d, vnode snapshot tsdb read del data for %s, suid:%" PRId64 " uid:%" PRId64 " size:%d",
- TD_VID(pTsdb->pVnode), pTsdb->path, pDelIdx->suid, pDelIdx->uid, size);
-
- break;
+ size = sizeof(SSnapDataHdr) + sizeof(TABLEID);
+ for (int32_t iDelData = 0; iDelData < taosArrayGetSize(pReader->aDelData); ++iDelData) {
+ size += tPutDelData(pData + size, taosArrayGet(pReader->aDelData, iDelData));
}
_exit:
if (code) {
- tsdbError("vgId:%d, %s failed since %s, path:%s", TD_VID(pTsdb->pVnode), __func__, tstrerror(code), pTsdb->path);
+ tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pReader->pTsdb->pVnode), __func__, lino, tstrerror(code));
+ if (pData) {
+ taosMemoryFree(pData);
+ pData = NULL;
+ }
+ }
+ *ppData = pData;
+ return code;
+}
+
+static void tsdbSnapReadGetTombData(STsdbSnapReader* pReader, SDelInfo** ppDelInfo) {
+ if (pReader->pTIter == NULL || (pReader->pTIter->delInfo.suid == 0 && pReader->pTIter->delInfo.uid == 0)) {
+ *ppDelInfo = NULL;
+ } else {
+ *ppDelInfo = &pReader->pTIter->delInfo;
+ }
+}
+
+static int32_t tsdbSnapReadNextTombData(STsdbSnapReader* pReader, SDelInfo** ppDelInfo) {
+ int32_t code = 0;
+ int32_t lino = 0;
+
+ code = tsdbDataIterNext2(
+ pReader->pTIter,
+ &(STsdbFilterInfo){.flag = TSDB_FILTER_FLAG_BY_VERSION, .sver = pReader->sver, .ever = pReader->ever});
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+ if (ppDelInfo) {
+ tsdbSnapReadGetTombData(pReader, ppDelInfo);
+ }
+
+_exit:
+ if (code) {
+ tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pReader->pTsdb->pVnode), __func__, lino, tstrerror(code));
+ }
+ return code;
+}
+
+static int32_t tsdbSnapReadTombData(STsdbSnapReader* pReader, uint8_t** ppData) {
+ int32_t code = 0;
+ int32_t lino = 0;
+
+ STsdb* pTsdb = pReader->pTsdb;
+
+ // open tombstone data iter if need
+ if (pReader->pDelFReader == NULL) {
+ if (pReader->fs.pDelFile == NULL) goto _exit;
+
+ // open
+ code = tsdbDelFReaderOpen(&pReader->pDelFReader, pReader->fs.pDelFile, pTsdb);
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+ code = tsdbOpenTombFileDataIter(pReader->pDelFReader, &pReader->pTIter);
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+ if (pReader->pTIter) {
+ code = tsdbSnapReadNextTombData(pReader, NULL);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ }
+ }
+
+ // loop to get tombstone data
+ SDelInfo* pDelInfo;
+ tsdbSnapReadGetTombData(pReader, &pDelInfo);
+
+ if (pDelInfo == NULL) goto _exit;
+
+ pReader->tbid = *(TABLEID*)pDelInfo;
+
+ if (pReader->aDelData) {
+ taosArrayClear(pReader->aDelData);
+ } else if ((pReader->aDelData = taosArrayInit(16, sizeof(SDelData))) == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ TSDB_CHECK_CODE(code, lino, _exit);
+ }
+
+ while (pDelInfo && pDelInfo->suid == pReader->tbid.suid && pDelInfo->uid == pReader->tbid.uid) {
+ if (taosArrayPush(pReader->aDelData, &pDelInfo->delData) < 0) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ TSDB_CHECK_CODE(code, lino, _exit);
+ }
+
+ code = tsdbSnapReadNextTombData(pReader, &pDelInfo);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ }
+
+ // encode tombstone data
+ if (taosArrayGetSize(pReader->aDelData) > 0) {
+ code = tsdbSnapCmprTombData(pReader, ppData);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ }
+
+_exit:
+ if (code) {
+ tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, lino, tstrerror(code));
+ } else {
+ tsdbDebug("vgId:%d %s done", TD_VID(pTsdb->pVnode), __func__);
}
return code;
}
int32_t tsdbSnapReaderOpen(STsdb* pTsdb, int64_t sver, int64_t ever, int8_t type, STsdbSnapReader** ppReader) {
- int32_t code = 0;
- int32_t lino = 0;
- STsdbSnapReader* pReader = NULL;
+ int32_t code = 0;
+ int32_t lino = 0;
// alloc
- pReader = (STsdbSnapReader*)taosMemoryCalloc(1, sizeof(*pReader));
+ STsdbSnapReader* pReader = (STsdbSnapReader*)taosMemoryCalloc(1, sizeof(*pReader));
if (pReader == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY;
TSDB_CHECK_CODE(code, lino, _exit);
@@ -476,118 +890,80 @@ int32_t tsdbSnapReaderOpen(STsdb* pTsdb, int64_t sver, int64_t ever, int8_t type
pReader->ever = ever;
pReader->type = type;
- code = taosThreadRwlockRdlock(&pTsdb->rwLock);
- if (code) {
- code = TAOS_SYSTEM_ERROR(code);
- TSDB_CHECK_CODE(code, lino, _exit);
- }
-
+ taosThreadRwlockRdlock(&pTsdb->rwLock);
code = tsdbFSRef(pTsdb, &pReader->fs);
if (code) {
taosThreadRwlockUnlock(&pTsdb->rwLock);
TSDB_CHECK_CODE(code, lino, _exit);
}
+ taosThreadRwlockUnlock(&pTsdb->rwLock);
- code = taosThreadRwlockUnlock(&pTsdb->rwLock);
- if (code) {
- code = TAOS_SYSTEM_ERROR(code);
- TSDB_CHECK_CODE(code, lino, _exit);
- }
-
- // data
+ // init
pReader->fid = INT32_MIN;
- for (int32_t iIter = 0; iIter < sizeof(pReader->aFDataIter) / sizeof(pReader->aFDataIter[0]); iIter++) {
- SFDataIter* pIter = &pReader->aFDataIter[iIter];
-
- if (iIter == 0) {
- pIter->aBlockIdx = taosArrayInit(0, sizeof(SBlockIdx));
- if (pIter->aBlockIdx == NULL) {
- code = TSDB_CODE_OUT_OF_MEMORY;
- TSDB_CHECK_CODE(code, lino, _exit);
- }
- } else {
- pIter->aSttBlk = taosArrayInit(0, sizeof(SSttBlk));
- if (pIter->aSttBlk == NULL) {
- code = TSDB_CODE_OUT_OF_MEMORY;
- TSDB_CHECK_CODE(code, lino, _exit);
- }
- }
-
- code = tBlockDataCreate(&pIter->bData);
- TSDB_CHECK_CODE(code, lino, _exit);
- }
code = tBlockDataCreate(&pReader->bData);
TSDB_CHECK_CODE(code, lino, _exit);
- // del
- pReader->aDelIdx = taosArrayInit(0, sizeof(SDelIdx));
- if (pReader->aDelIdx == NULL) {
- code = TSDB_CODE_OUT_OF_MEMORY;
- TSDB_CHECK_CODE(code, lino, _exit);
- }
- pReader->aDelData = taosArrayInit(0, sizeof(SDelData));
- if (pReader->aDelData == NULL) {
- code = TSDB_CODE_OUT_OF_MEMORY;
- TSDB_CHECK_CODE(code, lino, _exit);
- }
-
_exit:
if (code) {
- tsdbError("vgId:%d, %s failed at line %d since %s, TSDB path: %s", TD_VID(pTsdb->pVnode), __func__, lino,
- tstrerror(code), pTsdb->path);
- *ppReader = NULL;
-
+ tsdbError("vgId:%d %s failed at line %d since %s, sver:%" PRId64 " ever:%" PRId64 " type:%d", TD_VID(pTsdb->pVnode),
+ __func__, lino, tstrerror(code), sver, ever, type);
if (pReader) {
- taosArrayDestroy(pReader->aDelData);
- taosArrayDestroy(pReader->aDelIdx);
tBlockDataDestroy(&pReader->bData);
- tsdbFSDestroy(&pReader->fs);
+ tsdbFSUnref(pTsdb, &pReader->fs);
taosMemoryFree(pReader);
+ pReader = NULL;
}
} else {
- *ppReader = pReader;
- tsdbInfo("vgId:%d, vnode snapshot tsdb reader opened for %s", TD_VID(pTsdb->pVnode), pTsdb->path);
+ tsdbInfo("vgId:%d %s done, sver:%" PRId64 " ever:%" PRId64 " type:%d", TD_VID(pTsdb->pVnode), __func__, sver, ever,
+ type);
}
+ *ppReader = pReader;
return code;
}
int32_t tsdbSnapReaderClose(STsdbSnapReader** ppReader) {
- int32_t code = 0;
+ int32_t code = 0;
+ int32_t lino = 0;
+
STsdbSnapReader* pReader = *ppReader;
+ STsdb* pTsdb = pReader->pTsdb;
- // data
- if (pReader->pDataFReader) tsdbDataFReaderClose(&pReader->pDataFReader);
- for (int32_t iIter = 0; iIter < sizeof(pReader->aFDataIter) / sizeof(pReader->aFDataIter[0]); iIter++) {
- SFDataIter* pIter = &pReader->aFDataIter[iIter];
-
- if (iIter == 0) {
- taosArrayDestroy(pIter->aBlockIdx);
- tMapDataClear(&pIter->mBlock);
- } else {
- taosArrayDestroy(pIter->aSttBlk);
- }
-
- tBlockDataDestroy(&pIter->bData);
+ // tombstone
+ if (pReader->pTIter) {
+ tsdbCloseDataIter2(pReader->pTIter);
+ pReader->pTIter = NULL;
+ }
+ if (pReader->pDelFReader) {
+ tsdbDelFReaderClose(&pReader->pDelFReader);
}
-
- tBlockDataDestroy(&pReader->bData);
- tDestroyTSchema(pReader->skmTable.pTSchema);
-
- // del
- if (pReader->pDelFReader) tsdbDelFReaderClose(&pReader->pDelFReader);
- taosArrayDestroy(pReader->aDelIdx);
taosArrayDestroy(pReader->aDelData);
+ // timeseries
+ while (pReader->iterList) {
+ STsdbDataIter2* pIter = pReader->iterList;
+ pReader->iterList = pIter->next;
+ tsdbCloseDataIter2(pIter);
+ }
+ if (pReader->pDataFReader) {
+ tsdbDataFReaderClose(&pReader->pDataFReader);
+ }
+ tBlockDataDestroy(&pReader->bData);
+
+ // other
+ tDestroyTSchema(pReader->skmTable.pTSchema);
tsdbFSUnref(pReader->pTsdb, &pReader->fs);
-
- tsdbInfo("vgId:%d, vnode snapshot tsdb reader closed for %s", TD_VID(pReader->pTsdb->pVnode), pReader->pTsdb->path);
-
for (int32_t iBuf = 0; iBuf < sizeof(pReader->aBuf) / sizeof(pReader->aBuf[0]); iBuf++) {
tFree(pReader->aBuf[iBuf]);
}
-
taosMemoryFree(pReader);
+
+_exit:
+ if (code) {
+ tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, lino, tstrerror(code));
+ } else {
+ tsdbDebug("vgId:%d %s done", TD_VID(pTsdb->pVnode), __func__);
+ }
*ppReader = NULL;
return code;
}
@@ -600,7 +976,7 @@ int32_t tsdbSnapRead(STsdbSnapReader* pReader, uint8_t** ppData) {
// read data file
if (!pReader->dataDone) {
- code = tsdbSnapReadData(pReader, ppData);
+ code = tsdbSnapReadTimeSeriesData(pReader, ppData);
TSDB_CHECK_CODE(code, lino, _exit);
if (*ppData) {
goto _exit;
@@ -611,7 +987,7 @@ int32_t tsdbSnapRead(STsdbSnapReader* pReader, uint8_t** ppData) {
// read del file
if (!pReader->delDone) {
- code = tsdbSnapReadDel(pReader, ppData);
+ code = tsdbSnapReadTombData(pReader, ppData);
TSDB_CHECK_CODE(code, lino, _exit);
if (*ppData) {
goto _exit;
@@ -622,22 +998,18 @@ int32_t tsdbSnapRead(STsdbSnapReader* pReader, uint8_t** ppData) {
_exit:
if (code) {
- tsdbError("vgId:%d, %s failed since %s, path:%s", TD_VID(pReader->pTsdb->pVnode), __func__, tstrerror(code),
- pReader->pTsdb->path);
+ tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pReader->pTsdb->pVnode), __func__, lino, tstrerror(code));
} else {
- tsdbDebug("vgId:%d, %s done, path:%s", TD_VID(pReader->pTsdb->pVnode), __func__, pReader->pTsdb->path);
+ tsdbDebug("vgId:%d %s done", TD_VID(pReader->pTsdb->pVnode), __func__);
}
return code;
}
// STsdbSnapWriter ========================================
struct STsdbSnapWriter {
- STsdb* pTsdb;
- int64_t sver;
- int64_t ever;
- STsdbFS fs;
-
- // config
+ STsdb* pTsdb;
+ int64_t sver;
+ int64_t ever;
int32_t minutes;
int8_t precision;
int32_t minRow;
@@ -646,641 +1018,816 @@ struct STsdbSnapWriter {
int64_t commitID;
uint8_t* aBuf[5];
- // for data file
- SBlockData bData;
- int32_t fid;
- TABLEID id;
- SSkmInfo skmTable;
- struct {
- SDataFReader* pReader;
- SArray* aBlockIdx;
- int32_t iBlockIdx;
- SBlockIdx* pBlockIdx;
- SMapData mDataBlk;
- int32_t iDataBlk;
- SBlockData bData;
- int32_t iRow;
- } dReader;
- struct {
- SDataFWriter* pWriter;
- SArray* aBlockIdx;
- SMapData mDataBlk;
- SArray* aSttBlk;
- SBlockData bData;
- SBlockData sData;
- } dWriter;
+ STsdbFS fs;
+ TABLEID tbid;
- // for del file
- SDelFReader* pDelFReader;
+ // time-series data
+ SBlockData inData;
+
+ int32_t fid;
+ SSkmInfo skmTable;
+
+ /* reader */
+ SDataFReader* pDataFReader;
+ STsdbDataIter2* iterList;
+ STsdbDataIter2* pDIter;
+ STsdbDataIter2* pSIter;
+ SRBTree rbt; // SRBTree
+
+ /* writer */
+ SDataFWriter* pDataFWriter;
+ SArray* aBlockIdx;
+ SMapData mDataBlk; // SMapData
+ SArray* aSttBlk; // SArray
+ SBlockData bData;
+ SBlockData sData;
+
+ // tombstone data
+ /* reader */
+ SDelFReader* pDelFReader;
+ STsdbDataIter2* pTIter;
+
+ /* writer */
SDelFWriter* pDelFWriter;
- int32_t iDelIdx;
- SArray* aDelIdxR;
+ SArray* aDelIdx;
SArray* aDelData;
- SArray* aDelIdxW;
};
// SNAP_DATA_TSDB
-extern int32_t tsdbWriteDataBlock(SDataFWriter* pWriter, SBlockData* pBlockData, SMapData* mDataBlk, int8_t cmprAlg);
-extern int32_t tsdbWriteSttBlock(SDataFWriter* pWriter, SBlockData* pBlockData, SArray* aSttBlk, int8_t cmprAlg);
-
-static int32_t tsdbSnapNextTableData(STsdbSnapWriter* pWriter) {
- int32_t code = 0;
-
- ASSERT(pWriter->dReader.iRow >= pWriter->dReader.bData.nRow);
-
- if (pWriter->dReader.iBlockIdx < taosArrayGetSize(pWriter->dReader.aBlockIdx)) {
- pWriter->dReader.pBlockIdx = (SBlockIdx*)taosArrayGet(pWriter->dReader.aBlockIdx, pWriter->dReader.iBlockIdx);
-
- code = tsdbReadDataBlk(pWriter->dReader.pReader, pWriter->dReader.pBlockIdx, &pWriter->dReader.mDataBlk);
- if (code) goto _exit;
-
- pWriter->dReader.iBlockIdx++;
- } else {
- pWriter->dReader.pBlockIdx = NULL;
- tMapDataReset(&pWriter->dReader.mDataBlk);
- }
- pWriter->dReader.iDataBlk = 0; // point to the next one
- tBlockDataReset(&pWriter->dReader.bData);
- pWriter->dReader.iRow = 0;
-
-_exit:
- return code;
-}
-
-static int32_t tsdbSnapWriteCopyData(STsdbSnapWriter* pWriter, TABLEID* pId) {
- int32_t code = 0;
-
- while (true) {
- if (pWriter->dReader.pBlockIdx == NULL) break;
- if (tTABLEIDCmprFn(pWriter->dReader.pBlockIdx, pId) >= 0) break;
-
- SBlockIdx blkIdx = *pWriter->dReader.pBlockIdx;
- code = tsdbWriteDataBlk(pWriter->dWriter.pWriter, &pWriter->dReader.mDataBlk, &blkIdx);
- if (code) goto _exit;
-
- if (taosArrayPush(pWriter->dWriter.aBlockIdx, &blkIdx) == NULL) {
- code = TSDB_CODE_OUT_OF_MEMORY;
- goto _exit;
- }
-
- code = tsdbSnapNextTableData(pWriter);
- if (code) goto _exit;
- }
-
-_exit:
- return code;
-}
-
static int32_t tsdbSnapWriteTableDataStart(STsdbSnapWriter* pWriter, TABLEID* pId) {
int32_t code = 0;
+ int32_t lino = 0;
- code = tsdbSnapWriteCopyData(pWriter, pId);
- if (code) goto _err;
+ if (pId) {
+ pWriter->tbid = *pId;
+ } else {
+ pWriter->tbid = (TABLEID){INT64_MAX, INT64_MAX};
+ }
- pWriter->id.suid = pId->suid;
- pWriter->id.uid = pId->uid;
+ if (pWriter->pDIter) {
+ STsdbDataIter2* pIter = pWriter->pDIter;
- code = tsdbUpdateTableSchema(pWriter->pTsdb->pVnode->pMeta, pId->suid, pId->uid, &pWriter->skmTable);
- if (code) goto _err;
+ // assert last table data end
+ ASSERT(pIter->dIter.iRow >= pIter->dIter.bData.nRow);
+ ASSERT(pIter->dIter.iDataBlk >= pIter->dIter.mDataBlk.nItem);
- tMapDataReset(&pWriter->dWriter.mDataBlk);
- code = tBlockDataInit(&pWriter->dWriter.bData, pId, pWriter->skmTable.pTSchema, NULL, 0);
- if (code) goto _err;
+ for (;;) {
+ if (pIter->dIter.iBlockIdx >= taosArrayGetSize(pIter->dIter.aBlockIdx)) {
+ pWriter->pDIter = NULL;
+ break;
+ }
+ SBlockIdx* pBlockIdx = (SBlockIdx*)taosArrayGet(pIter->dIter.aBlockIdx, pIter->dIter.iBlockIdx);
+
+ int32_t c = tTABLEIDCmprFn(pBlockIdx, &pWriter->tbid);
+ if (c < 0) {
+ code = tsdbReadDataBlk(pIter->dIter.pReader, pBlockIdx, &pIter->dIter.mDataBlk);
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+ SBlockIdx* pNewBlockIdx = taosArrayReserve(pWriter->aBlockIdx, 1);
+ if (pNewBlockIdx == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ TSDB_CHECK_CODE(code, lino, _exit);
+ }
+
+ pNewBlockIdx->suid = pBlockIdx->suid;
+ pNewBlockIdx->uid = pBlockIdx->uid;
+
+ code = tsdbWriteDataBlk(pWriter->pDataFWriter, &pIter->dIter.mDataBlk, pNewBlockIdx);
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+ pIter->dIter.iBlockIdx++;
+ } else if (c == 0) {
+ code = tsdbReadDataBlk(pIter->dIter.pReader, pBlockIdx, &pIter->dIter.mDataBlk);
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+ pIter->dIter.iDataBlk = 0;
+ pIter->dIter.iBlockIdx++;
+
+ break;
+ } else {
+ pIter->dIter.iDataBlk = pIter->dIter.mDataBlk.nItem;
+ break;
+ }
+ }
+ }
+
+ if (pId) {
+ code = tsdbUpdateTableSchema(pWriter->pTsdb->pVnode->pMeta, pId->suid, pId->uid, &pWriter->skmTable);
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+ tMapDataReset(&pWriter->mDataBlk);
+
+ code = tBlockDataInit(&pWriter->bData, pId, pWriter->skmTable.pTSchema, NULL, 0);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ }
+
+ if (!TABLE_SAME_SCHEMA(pWriter->tbid.suid, pWriter->tbid.uid, pWriter->sData.suid, pWriter->sData.uid)) {
+ if ((pWriter->sData.nRow > 0)) {
+ code = tsdbWriteSttBlock(pWriter->pDataFWriter, &pWriter->sData, pWriter->aSttBlk, pWriter->cmprAlg);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ }
+
+ if (pId) {
+ TABLEID id = {.suid = pWriter->tbid.suid, .uid = pWriter->tbid.suid ? 0 : pWriter->tbid.uid};
+ code = tBlockDataInit(&pWriter->sData, &id, pWriter->skmTable.pTSchema, NULL, 0);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ }
+ }
+
+_exit:
+ if (code) {
+ tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pWriter->pTsdb->pVnode), __func__, lino, tstrerror(code));
+ } else {
+ tsdbTrace("vgId:%d %s done, suid:%" PRId64 " uid:%" PRId64, TD_VID(pWriter->pTsdb->pVnode), __func__,
+ pWriter->tbid.suid, pWriter->tbid.uid);
+ }
return code;
+}
-_err:
- tsdbError("vgId:%d, %s failed since %s", TD_VID(pWriter->pTsdb->pVnode), __func__, tstrerror(code));
+static int32_t tsdbSnapWriteTableRowImpl(STsdbSnapWriter* pWriter, TSDBROW* pRow) {
+ int32_t code = 0;
+ int32_t lino = 0;
+
+ code = tBlockDataAppendRow(&pWriter->bData, pRow, pWriter->skmTable.pTSchema, pWriter->tbid.uid);
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+ if (pWriter->bData.nRow >= pWriter->maxRow) {
+ code = tsdbWriteDataBlock(pWriter->pDataFWriter, &pWriter->bData, &pWriter->mDataBlk, pWriter->cmprAlg);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ }
+
+_exit:
+ if (code) {
+ tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pWriter->pTsdb->pVnode), __func__, lino, tstrerror(code));
+ }
+ return code;
+}
+
+static int32_t tsdbSnapWriteTableRow(STsdbSnapWriter* pWriter, TSDBROW* pRow) {
+ int32_t code = 0;
+ int32_t lino = 0;
+
+ TSDBKEY inKey = pRow ? TSDBROW_KEY(pRow) : TSDBKEY_MAX;
+
+ if (pWriter->pDIter == NULL || (pWriter->pDIter->dIter.iRow >= pWriter->pDIter->dIter.bData.nRow &&
+ pWriter->pDIter->dIter.iDataBlk >= pWriter->pDIter->dIter.mDataBlk.nItem)) {
+ goto _write_row;
+ } else {
+ for (;;) {
+ while (pWriter->pDIter->dIter.iRow < pWriter->pDIter->dIter.bData.nRow) {
+ TSDBROW row = tsdbRowFromBlockData(&pWriter->pDIter->dIter.bData, pWriter->pDIter->dIter.iRow);
+
+ int32_t c = tsdbKeyCmprFn(&inKey, &TSDBROW_KEY(&row));
+ if (c < 0) {
+ goto _write_row;
+ } else if (c > 0) {
+ code = tsdbSnapWriteTableRowImpl(pWriter, &row);
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+ pWriter->pDIter->dIter.iRow++;
+ } else {
+ ASSERT(0);
+ }
+ }
+
+ for (;;) {
+ if (pWriter->pDIter->dIter.iDataBlk >= pWriter->pDIter->dIter.mDataBlk.nItem) goto _write_row;
+
+ // FIXME: Here can be slow, use array instead
+ SDataBlk dataBlk;
+ tMapDataGetItemByIdx(&pWriter->pDIter->dIter.mDataBlk, pWriter->pDIter->dIter.iDataBlk, &dataBlk, tGetDataBlk);
+
+ int32_t c = tDataBlkCmprFn(&dataBlk, &(SDataBlk){.minKey = inKey, .maxKey = inKey});
+ if (c > 0) {
+ goto _write_row;
+ } else if (c < 0) {
+ if (pWriter->bData.nRow > 0) {
+ code = tsdbWriteDataBlock(pWriter->pDataFWriter, &pWriter->bData, &pWriter->mDataBlk, pWriter->cmprAlg);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ }
+
+ tMapDataPutItem(&pWriter->mDataBlk, &dataBlk, tPutDataBlk);
+ pWriter->pDIter->dIter.iDataBlk++;
+ } else {
+ code = tsdbReadDataBlockEx(pWriter->pDataFReader, &dataBlk, &pWriter->pDIter->dIter.bData);
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+ pWriter->pDIter->dIter.iRow = 0;
+ pWriter->pDIter->dIter.iDataBlk++;
+ break;
+ }
+ }
+ }
+ }
+
+_write_row:
+ if (pRow) {
+ code = tsdbSnapWriteTableRowImpl(pWriter, pRow);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ }
+
+_exit:
+ if (code) {
+ tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pWriter->pTsdb->pVnode), __func__, lino, tstrerror(code));
+ }
return code;
}
static int32_t tsdbSnapWriteTableDataEnd(STsdbSnapWriter* pWriter) {
int32_t code = 0;
+ int32_t lino = 0;
- if (pWriter->id.suid == 0 && pWriter->id.uid == 0) return code;
+ // write a NULL row to end current table data write
+ code = tsdbSnapWriteTableRow(pWriter, NULL);
+ TSDB_CHECK_CODE(code, lino, _exit);
- int32_t c = 1;
- if (pWriter->dReader.pBlockIdx) {
- c = tTABLEIDCmprFn(pWriter->dReader.pBlockIdx, &pWriter->id);
- ASSERT(c >= 0);
- }
+ if (pWriter->bData.nRow > 0) {
+ if (pWriter->bData.nRow < pWriter->minRow) {
+ ASSERT(TABLE_SAME_SCHEMA(pWriter->sData.suid, pWriter->sData.uid, pWriter->tbid.suid, pWriter->tbid.uid));
+ for (int32_t iRow = 0; iRow < pWriter->bData.nRow; iRow++) {
+ code =
+ tBlockDataAppendRow(&pWriter->sData, &tsdbRowFromBlockData(&pWriter->bData, iRow), NULL, pWriter->tbid.uid);
+ TSDB_CHECK_CODE(code, lino, _exit);
- if (c == 0) {
- SBlockData* pBData = &pWriter->dWriter.bData;
-
- for (; pWriter->dReader.iRow < pWriter->dReader.bData.nRow; pWriter->dReader.iRow++) {
- TSDBROW row = tsdbRowFromBlockData(&pWriter->dReader.bData, pWriter->dReader.iRow);
-
- code = tBlockDataAppendRow(pBData, &row, NULL, pWriter->id.uid);
- if (code) goto _err;
-
- if (pBData->nRow >= pWriter->maxRow) {
- code = tsdbWriteDataBlock(pWriter->dWriter.pWriter, pBData, &pWriter->dWriter.mDataBlk, pWriter->cmprAlg);
- if (code) goto _err;
+ if (pWriter->sData.nRow >= pWriter->maxRow) {
+ code = tsdbWriteSttBlock(pWriter->pDataFWriter, &pWriter->sData, pWriter->aSttBlk, pWriter->cmprAlg);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ }
}
+
+ tBlockDataClear(&pWriter->bData);
+ } else {
+ code = tsdbWriteDataBlock(pWriter->pDataFWriter, &pWriter->bData, &pWriter->mDataBlk, pWriter->cmprAlg);
+ TSDB_CHECK_CODE(code, lino, _exit);
}
-
- code = tsdbWriteDataBlock(pWriter->dWriter.pWriter, pBData, &pWriter->dWriter.mDataBlk, pWriter->cmprAlg);
- if (code) goto _err;
-
- for (; pWriter->dReader.iDataBlk < pWriter->dReader.mDataBlk.nItem; pWriter->dReader.iDataBlk++) {
- SDataBlk dataBlk;
- tMapDataGetItemByIdx(&pWriter->dReader.mDataBlk, pWriter->dReader.iDataBlk, &dataBlk, tGetDataBlk);
-
- code = tMapDataPutItem(&pWriter->dWriter.mDataBlk, &dataBlk, tPutDataBlk);
- if (code) goto _err;
- }
-
- code = tsdbSnapNextTableData(pWriter);
- if (code) goto _err;
}
- if (pWriter->dWriter.mDataBlk.nItem) {
- SBlockIdx blockIdx = {.suid = pWriter->id.suid, .uid = pWriter->id.uid};
- code = tsdbWriteDataBlk(pWriter->dWriter.pWriter, &pWriter->dWriter.mDataBlk, &blockIdx);
-
- if (taosArrayPush(pWriter->dWriter.aBlockIdx, &blockIdx) == NULL) {
+ if (pWriter->mDataBlk.nItem) {
+ SBlockIdx* pBlockIdx = taosArrayReserve(pWriter->aBlockIdx, 1);
+ if (pBlockIdx == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY;
- goto _err;
+ TSDB_CHECK_CODE(code, lino, _exit);
}
- }
- pWriter->id.suid = 0;
- pWriter->id.uid = 0;
+ pBlockIdx->suid = pWriter->tbid.suid;
+ pBlockIdx->uid = pWriter->tbid.uid;
- return code;
-
-_err:
- return code;
-}
-
-static int32_t tsdbSnapWriteOpenFile(STsdbSnapWriter* pWriter, int32_t fid) {
- int32_t code = 0;
- STsdb* pTsdb = pWriter->pTsdb;
-
- ASSERT(pWriter->dWriter.pWriter == NULL);
-
- pWriter->fid = fid;
- pWriter->id = (TABLEID){0};
- SDFileSet* pSet = taosArraySearch(pWriter->fs.aDFileSet, &(SDFileSet){.fid = fid}, tDFileSetCmprFn, TD_EQ);
-
- // Reader
- if (pSet) {
- code = tsdbDataFReaderOpen(&pWriter->dReader.pReader, pWriter->pTsdb, pSet);
- if (code) goto _err;
-
- code = tsdbReadBlockIdx(pWriter->dReader.pReader, pWriter->dReader.aBlockIdx);
- if (code) goto _err;
- } else {
- ASSERT(pWriter->dReader.pReader == NULL);
- taosArrayClear(pWriter->dReader.aBlockIdx);
- }
- pWriter->dReader.iBlockIdx = 0; // point to the next one
- code = tsdbSnapNextTableData(pWriter);
- if (code) goto _err;
-
- // Writer
- SHeadFile fHead = {.commitID = pWriter->commitID};
- SDataFile fData = {.commitID = pWriter->commitID};
- SSmaFile fSma = {.commitID = pWriter->commitID};
- SSttFile fStt = {.commitID = pWriter->commitID};
- SDFileSet wSet = {.fid = pWriter->fid, .pHeadF = &fHead, .pDataF = &fData, .pSmaF = &fSma};
- if (pSet) {
- wSet.diskId = pSet->diskId;
- fData = *pSet->pDataF;
- fSma = *pSet->pSmaF;
- for (int32_t iStt = 0; iStt < pSet->nSttF; iStt++) {
- wSet.aSttF[iStt] = pSet->aSttF[iStt];
- }
- wSet.nSttF = pSet->nSttF + 1; // TODO: fix pSet->nSttF == pTsdb->maxFile
- } else {
- SDiskID did = {0};
- tfsAllocDisk(pTsdb->pVnode->pTfs, 0, &did);
- tfsMkdirRecurAt(pTsdb->pVnode->pTfs, pTsdb->path, did);
- wSet.diskId = did;
- wSet.nSttF = 1;
- }
- wSet.aSttF[wSet.nSttF - 1] = &fStt;
-
- code = tsdbDataFWriterOpen(&pWriter->dWriter.pWriter, pWriter->pTsdb, &wSet);
- if (code) goto _err;
- taosArrayClear(pWriter->dWriter.aBlockIdx);
- tMapDataReset(&pWriter->dWriter.mDataBlk);
- taosArrayClear(pWriter->dWriter.aSttBlk);
- tBlockDataReset(&pWriter->dWriter.bData);
- tBlockDataReset(&pWriter->dWriter.sData);
-
- return code;
-
-_err:
- return code;
-}
-
-static int32_t tsdbSnapWriteCloseFile(STsdbSnapWriter* pWriter) {
- int32_t code = 0;
-
- ASSERT(pWriter->dWriter.pWriter);
-
- code = tsdbSnapWriteTableDataEnd(pWriter);
- if (code) goto _err;
-
- // copy remain table data
- TABLEID id = {.suid = INT64_MAX, .uid = INT64_MAX};
- code = tsdbSnapWriteCopyData(pWriter, &id);
- if (code) goto _err;
-
- code =
- tsdbWriteSttBlock(pWriter->dWriter.pWriter, &pWriter->dWriter.sData, pWriter->dWriter.aSttBlk, pWriter->cmprAlg);
- if (code) goto _err;
-
- // Indices
- code = tsdbWriteBlockIdx(pWriter->dWriter.pWriter, pWriter->dWriter.aBlockIdx);
- if (code) goto _err;
-
- code = tsdbWriteSttBlk(pWriter->dWriter.pWriter, pWriter->dWriter.aSttBlk);
- if (code) goto _err;
-
- code = tsdbUpdateDFileSetHeader(pWriter->dWriter.pWriter);
- if (code) goto _err;
-
- code = tsdbFSUpsertFSet(&pWriter->fs, &pWriter->dWriter.pWriter->wSet);
- if (code) goto _err;
-
- code = tsdbDataFWriterClose(&pWriter->dWriter.pWriter, 1);
- if (code) goto _err;
-
- if (pWriter->dReader.pReader) {
- code = tsdbDataFReaderClose(&pWriter->dReader.pReader);
- if (code) goto _err;
+ code = tsdbWriteDataBlk(pWriter->pDataFWriter, &pWriter->mDataBlk, pBlockIdx);
+ TSDB_CHECK_CODE(code, lino, _exit);
}
_exit:
- return code;
-
-_err:
+ if (code) {
+ tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pWriter->pTsdb->pVnode), __func__, lino, tstrerror(code));
+ }
return code;
}
-static int32_t tsdbSnapWriteToDataFile(STsdbSnapWriter* pWriter, int32_t iRow, int8_t* done) {
+static int32_t tsdbSnapWriteFileDataStart(STsdbSnapWriter* pWriter, int32_t fid) {
int32_t code = 0;
+ int32_t lino = 0;
- SBlockData* pBData = &pWriter->bData;
- TABLEID id = {.suid = pBData->suid, .uid = pBData->uid ? pBData->uid : pBData->aUid[iRow]};
- TSDBROW row = tsdbRowFromBlockData(pBData, iRow);
- TSDBKEY key = TSDBROW_KEY(&row);
+ ASSERT(pWriter->pDataFWriter == NULL && pWriter->fid < fid);
- *done = 0;
- while (pWriter->dReader.iRow < pWriter->dReader.bData.nRow ||
- pWriter->dReader.iDataBlk < pWriter->dReader.mDataBlk.nItem) {
- // Merge row by row
- for (; pWriter->dReader.iRow < pWriter->dReader.bData.nRow; pWriter->dReader.iRow++) {
- TSDBROW trow = tsdbRowFromBlockData(&pWriter->dReader.bData, pWriter->dReader.iRow);
- TSDBKEY tKey = TSDBROW_KEY(&trow);
+ STsdb* pTsdb = pWriter->pTsdb;
- ASSERT(pWriter->dReader.bData.suid == id.suid && pWriter->dReader.bData.uid == id.uid);
+ pWriter->fid = fid;
+ pWriter->tbid = (TABLEID){0};
+ SDFileSet* pSet = taosArraySearch(pWriter->fs.aDFileSet, &(SDFileSet){.fid = fid}, tDFileSetCmprFn, TD_EQ);
- int32_t c = tsdbKeyCmprFn(&key, &tKey);
- if (c < 0) {
- code = tBlockDataAppendRow(&pWriter->dWriter.bData, &row, NULL, id.uid);
- if (code) goto _err;
- } else if (c > 0) {
- code = tBlockDataAppendRow(&pWriter->dWriter.bData, &trow, NULL, id.uid);
- if (code) goto _err;
- } else {
- ASSERT(0);
- }
+ // open reader
+ pWriter->pDataFReader = NULL;
+ pWriter->iterList = NULL;
+ pWriter->pDIter = NULL;
+ pWriter->pSIter = NULL;
+ tRBTreeCreate(&pWriter->rbt, tsdbDataIterCmprFn);
+ if (pSet) {
+ code = tsdbDataFReaderOpen(&pWriter->pDataFReader, pTsdb, pSet);
+ TSDB_CHECK_CODE(code, lino, _exit);
- if (pWriter->dWriter.bData.nRow >= pWriter->maxRow) {
- code = tsdbWriteDataBlock(pWriter->dWriter.pWriter, &pWriter->dWriter.bData, &pWriter->dWriter.mDataBlk,
- pWriter->cmprAlg);
- if (code) goto _err;
- }
+ code = tsdbOpenDataFileDataIter(pWriter->pDataFReader, &pWriter->pDIter);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ if (pWriter->pDIter) {
+ pWriter->pDIter->next = pWriter->iterList;
+ pWriter->iterList = pWriter->pDIter;
+ }
- if (c < 0) {
- *done = 1;
- goto _exit;
+ for (int32_t iStt = 0; iStt < pSet->nSttF; iStt++) {
+ code = tsdbOpenSttFileDataIter(pWriter->pDataFReader, iStt, &pWriter->pSIter);
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+ if (pWriter->pSIter) {
+ code = tsdbSttFileDataIterNext(pWriter->pSIter, NULL);
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+ // add to tree
+ tRBTreePut(&pWriter->rbt, &pWriter->pSIter->rbtn);
+
+ // add to list
+ pWriter->pSIter->next = pWriter->iterList;
+ pWriter->iterList = pWriter->pSIter;
}
}
- // Merge row by block
- SDataBlk tDataBlk = {.minKey = key, .maxKey = key};
- for (; pWriter->dReader.iDataBlk < pWriter->dReader.mDataBlk.nItem; pWriter->dReader.iDataBlk++) {
- SDataBlk dataBlk;
- tMapDataGetItemByIdx(&pWriter->dReader.mDataBlk, pWriter->dReader.iDataBlk, &dataBlk, tGetDataBlk);
+ pWriter->pSIter = NULL;
+ }
- int32_t c = tDataBlkCmprFn(&dataBlk, &tDataBlk);
+ // open writer
+ SDiskID diskId;
+ if (pSet) {
+ diskId = pSet->diskId;
+ } else {
+ tfsAllocDisk(pTsdb->pVnode->pTfs, 0 /*TODO*/, &diskId);
+ tfsMkdirRecurAt(pTsdb->pVnode->pTfs, pTsdb->path, diskId);
+ }
+ SDFileSet wSet = {.diskId = diskId,
+ .fid = fid,
+ .pHeadF = &(SHeadFile){.commitID = pWriter->commitID},
+ .pDataF = (pSet) ? pSet->pDataF : &(SDataFile){.commitID = pWriter->commitID},
+ .pSmaF = (pSet) ? pSet->pSmaF : &(SSmaFile){.commitID = pWriter->commitID},
+ .nSttF = 1,
+ .aSttF = {&(SSttFile){.commitID = pWriter->commitID}}};
+ code = tsdbDataFWriterOpen(&pWriter->pDataFWriter, pTsdb, &wSet);
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+ if (pWriter->aBlockIdx) {
+ taosArrayClear(pWriter->aBlockIdx);
+ } else if ((pWriter->aBlockIdx = taosArrayInit(0, sizeof(SBlockIdx))) == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ TSDB_CHECK_CODE(code, lino, _exit);
+ }
+
+ tMapDataReset(&pWriter->mDataBlk);
+
+ if (pWriter->aSttBlk) {
+ taosArrayClear(pWriter->aSttBlk);
+ } else if ((pWriter->aSttBlk = taosArrayInit(0, sizeof(SSttBlk))) == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ TSDB_CHECK_CODE(code, lino, _exit);
+ }
+
+ tBlockDataReset(&pWriter->bData);
+ tBlockDataReset(&pWriter->sData);
+
+_exit:
+ if (code) {
+ tsdbError("vgId:%d %s failed at line %d since %s, fid:%d", TD_VID(pTsdb->pVnode), __func__, lino, tstrerror(code),
+ fid);
+ } else {
+ tsdbDebug("vgId:%d %s done, fid:%d", TD_VID(pTsdb->pVnode), __func__, fid);
+ }
+ return code;
+}
+
+static int32_t tsdbSnapWriteTableData(STsdbSnapWriter* pWriter, SRowInfo* pRowInfo) {
+ int32_t code = 0;
+ int32_t lino = 0;
+
+ // switch to new table if need
+ if (pRowInfo == NULL || pRowInfo->uid != pWriter->tbid.uid) {
+ if (pWriter->tbid.uid) {
+ code = tsdbSnapWriteTableDataEnd(pWriter);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ }
+
+ code = tsdbSnapWriteTableDataStart(pWriter, (TABLEID*)pRowInfo);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ }
+
+ if (pRowInfo == NULL) goto _exit;
+
+ code = tsdbSnapWriteTableRow(pWriter, &pRowInfo->row);
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+_exit:
+ if (code) {
+ tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pWriter->pTsdb->pVnode), __func__, lino, tstrerror(code));
+ }
+ return code;
+}
+
+static int32_t tsdbSnapWriteNextRow(STsdbSnapWriter* pWriter, SRowInfo** ppRowInfo) {
+ int32_t code = 0;
+ int32_t lino = 0;
+
+ if (pWriter->pSIter) {
+ code = tsdbDataIterNext2(pWriter->pSIter, NULL);
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+ if (pWriter->pSIter->rowInfo.suid == 0 && pWriter->pSIter->rowInfo.uid == 0) {
+ pWriter->pSIter = NULL;
+ } else {
+ SRBTreeNode* pNode = tRBTreeMin(&pWriter->rbt);
+ if (pNode) {
+ int32_t c = tsdbDataIterCmprFn(&pWriter->pSIter->rbtn, pNode);
+ if (c > 0) {
+ tRBTreePut(&pWriter->rbt, &pWriter->pSIter->rbtn);
+ pWriter->pSIter = NULL;
+ } else if (c == 0) {
+ ASSERT(0);
+ }
+ }
+ }
+ }
+
+ if (pWriter->pSIter == NULL) {
+ SRBTreeNode* pNode = tRBTreeMin(&pWriter->rbt);
+ if (pNode) {
+ tRBTreeDrop(&pWriter->rbt, pNode);
+ pWriter->pSIter = TSDB_RBTN_TO_DATA_ITER(pNode);
+ }
+ }
+
+ if (ppRowInfo) {
+ if (pWriter->pSIter) {
+ *ppRowInfo = &pWriter->pSIter->rowInfo;
+ } else {
+ *ppRowInfo = NULL;
+ }
+ }
+
+_exit:
+ if (code) {
+ tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pWriter->pTsdb->pVnode), __func__, lino, tstrerror(code));
+ }
+ return code;
+}
+
+static int32_t tsdbSnapWriteGetRow(STsdbSnapWriter* pWriter, SRowInfo** ppRowInfo) {
+ int32_t code = 0;
+ int32_t lino = 0;
+
+ if (pWriter->pSIter) {
+ *ppRowInfo = &pWriter->pSIter->rowInfo;
+ goto _exit;
+ }
+
+ code = tsdbSnapWriteNextRow(pWriter, ppRowInfo);
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+_exit:
+ if (code) {
+ tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pWriter->pTsdb->pVnode), __func__, lino, tstrerror(code));
+ }
+ return code;
+}
+
+static int32_t tsdbSnapWriteFileDataEnd(STsdbSnapWriter* pWriter) {
+ int32_t code = 0;
+ int32_t lino = 0;
+
+ ASSERT(pWriter->pDataFWriter);
+
+ // consume remain data and end with a NULL table row
+ SRowInfo* pRowInfo;
+ code = tsdbSnapWriteGetRow(pWriter, &pRowInfo);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ for (;;) {
+ code = tsdbSnapWriteTableData(pWriter, pRowInfo);
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+ if (pRowInfo == NULL) break;
+
+ code = tsdbSnapWriteNextRow(pWriter, &pRowInfo);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ }
+
+ // do file-level updates
+ code = tsdbWriteSttBlk(pWriter->pDataFWriter, pWriter->aSttBlk);
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+ code = tsdbWriteBlockIdx(pWriter->pDataFWriter, pWriter->aBlockIdx);
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+ code = tsdbUpdateDFileSetHeader(pWriter->pDataFWriter);
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+ code = tsdbFSUpsertFSet(&pWriter->fs, &pWriter->pDataFWriter->wSet);
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+ code = tsdbDataFWriterClose(&pWriter->pDataFWriter, 1);
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+ if (pWriter->pDataFReader) {
+ code = tsdbDataFReaderClose(&pWriter->pDataFReader);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ }
+
+ // clear sources
+ while (pWriter->iterList) {
+ STsdbDataIter2* pIter = pWriter->iterList;
+ pWriter->iterList = pIter->next;
+ tsdbCloseDataIter2(pIter);
+ }
+
+_exit:
+ if (code) {
+ tsdbError("vgId:%d %s failed since %s", TD_VID(pWriter->pTsdb->pVnode), __func__, tstrerror(code));
+ } else {
+ tsdbDebug("vgId:%d %s is done", TD_VID(pWriter->pTsdb->pVnode), __func__);
+ }
+ return code;
+}
+
+static int32_t tsdbSnapWriteTimeSeriesData(STsdbSnapWriter* pWriter, SSnapDataHdr* pHdr) {
+ int32_t code = 0;
+ int32_t lino = 0;
+
+ code = tDecmprBlockData(pHdr->data, pHdr->size, &pWriter->inData, pWriter->aBuf);
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+ ASSERT(pWriter->inData.nRow > 0);
+
+ // switch to new data file if need
+ int32_t fid = tsdbKeyFid(pWriter->inData.aTSKEY[0], pWriter->minutes, pWriter->precision);
+ if (pWriter->fid != fid) {
+ if (pWriter->pDataFWriter) {
+ code = tsdbSnapWriteFileDataEnd(pWriter);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ }
+
+ code = tsdbSnapWriteFileDataStart(pWriter, fid);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ }
+
+ // loop write each row
+ SRowInfo* pRowInfo;
+ code = tsdbSnapWriteGetRow(pWriter, &pRowInfo);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ for (int32_t iRow = 0; iRow < pWriter->inData.nRow; ++iRow) {
+ SRowInfo rInfo = {.suid = pWriter->inData.suid,
+ .uid = pWriter->inData.uid ? pWriter->inData.uid : pWriter->inData.aUid[iRow],
+ .row = tsdbRowFromBlockData(&pWriter->inData, iRow)};
+
+ for (;;) {
+ if (pRowInfo == NULL) {
+ code = tsdbSnapWriteTableData(pWriter, &rInfo);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ break;
+ } else {
+ int32_t c = tRowInfoCmprFn(&rInfo, pRowInfo);
+ if (c < 0) {
+ code = tsdbSnapWriteTableData(pWriter, &rInfo);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ break;
+ } else if (c > 0) {
+ code = tsdbSnapWriteTableData(pWriter, pRowInfo);
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+ code = tsdbSnapWriteNextRow(pWriter, &pRowInfo);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ } else {
+ ASSERT(0);
+ }
+ }
+ }
+ }
+
+_exit:
+ if (code) {
+ tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pWriter->pTsdb->pVnode), __func__, lino, tstrerror(code));
+ } else {
+ tsdbDebug("vgId:%d %s done, suid:%" PRId64 " uid:%" PRId64 " nRow:%d", TD_VID(pWriter->pTsdb->pVnode), __func__,
+ pWriter->inData.suid, pWriter->inData.uid, pWriter->inData.nRow);
+ }
+ return code;
+}
+
+// SNAP_DATA_DEL
+static int32_t tsdbSnapWriteDelTableDataStart(STsdbSnapWriter* pWriter, TABLEID* pId) {
+ int32_t code = 0;
+ int32_t lino = 0;
+
+ if (pId) {
+ pWriter->tbid = *pId;
+ } else {
+ pWriter->tbid = (TABLEID){.suid = INT64_MAX, .uid = INT64_MAX};
+ }
+
+ taosArrayClear(pWriter->aDelData);
+
+ if (pWriter->pTIter) {
+ while (pWriter->pTIter->tIter.iDelIdx < taosArrayGetSize(pWriter->pTIter->tIter.aDelIdx)) {
+ SDelIdx* pDelIdx = taosArrayGet(pWriter->pTIter->tIter.aDelIdx, pWriter->pTIter->tIter.iDelIdx);
+
+ int32_t c = tTABLEIDCmprFn(pDelIdx, &pWriter->tbid);
if (c < 0) {
- code = tsdbWriteDataBlock(pWriter->dWriter.pWriter, &pWriter->dWriter.bData, &pWriter->dWriter.mDataBlk,
- pWriter->cmprAlg);
- if (code) goto _err;
+ code = tsdbReadDelData(pWriter->pDelFReader, pDelIdx, pWriter->pTIter->tIter.aDelData);
+ TSDB_CHECK_CODE(code, lino, _exit);
- code = tMapDataPutItem(&pWriter->dWriter.mDataBlk, &dataBlk, tPutDataBlk);
- if (code) goto _err;
- } else if (c > 0) {
- code = tBlockDataAppendRow(&pWriter->dWriter.bData, &row, NULL, id.uid);
- if (code) goto _err;
-
- if (pWriter->dWriter.bData.nRow >= pWriter->maxRow) {
- code = tsdbWriteDataBlock(pWriter->dWriter.pWriter, &pWriter->dWriter.bData, &pWriter->dWriter.mDataBlk,
- pWriter->cmprAlg);
- if (code) goto _err;
+ SDelIdx* pDelIdxNew = taosArrayReserve(pWriter->aDelIdx, 1);
+ if (pDelIdxNew == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ TSDB_CHECK_CODE(code, lino, _exit);
}
- *done = 1;
- goto _exit;
- } else {
- code = tsdbReadDataBlockEx(pWriter->dReader.pReader, &dataBlk, &pWriter->dReader.bData);
- if (code) goto _err;
- pWriter->dReader.iRow = 0;
+ pDelIdxNew->suid = pDelIdx->suid;
+ pDelIdxNew->uid = pDelIdx->uid;
- pWriter->dReader.iDataBlk++;
+ code = tsdbWriteDelData(pWriter->pDelFWriter, pWriter->pTIter->tIter.aDelData, pDelIdxNew);
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+ pWriter->pTIter->tIter.iDelIdx++;
+ } else if (c == 0) {
+ code = tsdbReadDelData(pWriter->pDelFReader, pDelIdx, pWriter->aDelData);
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+ pWriter->pTIter->tIter.iDelIdx++;
+ break;
+ } else {
break;
}
}
}
_exit:
- return code;
-
-_err:
- tsdbError("vgId:%d, %s failed since %s", TD_VID(pWriter->pTsdb->pVnode), __func__, tstrerror(code));
- return code;
-}
-
-static int32_t tsdbSnapWriteToSttFile(STsdbSnapWriter* pWriter, int32_t iRow) {
- int32_t code = 0;
-
- TABLEID id = {.suid = pWriter->bData.suid,
- .uid = pWriter->bData.uid ? pWriter->bData.uid : pWriter->bData.aUid[iRow]};
- TSDBROW row = tsdbRowFromBlockData(&pWriter->bData, iRow);
- SBlockData* pBData = &pWriter->dWriter.sData;
-
- if (pBData->suid || pBData->uid) {
- if (!TABLE_SAME_SCHEMA(pBData->suid, pBData->uid, id.suid, id.uid)) {
- code = tsdbWriteSttBlock(pWriter->dWriter.pWriter, pBData, pWriter->dWriter.aSttBlk, pWriter->cmprAlg);
- if (code) goto _err;
-
- pBData->suid = 0;
- pBData->uid = 0;
- }
- }
-
- if (pBData->suid == 0 && pBData->uid == 0) {
- code = tsdbUpdateTableSchema(pWriter->pTsdb->pVnode->pMeta, pWriter->id.suid, pWriter->id.uid, &pWriter->skmTable);
- if (code) goto _err;
-
- TABLEID tid = {.suid = pWriter->id.suid, .uid = pWriter->id.suid ? 0 : pWriter->id.uid};
- code = tBlockDataInit(pBData, &tid, pWriter->skmTable.pTSchema, NULL, 0);
- if (code) goto _err;
- }
-
- code = tBlockDataAppendRow(pBData, &row, NULL, id.uid);
- if (code) goto _err;
-
- if (pBData->nRow >= pWriter->maxRow) {
- code = tsdbWriteSttBlock(pWriter->dWriter.pWriter, pBData, pWriter->dWriter.aSttBlk, pWriter->cmprAlg);
- if (code) goto _err;
- }
-
-_exit:
- return code;
-
-_err:
- return code;
-}
-
-static int32_t tsdbSnapWriteRowData(STsdbSnapWriter* pWriter, int32_t iRow) {
- int32_t code = 0;
-
- SBlockData* pBlockData = &pWriter->bData;
- TABLEID id = {.suid = pBlockData->suid, .uid = pBlockData->uid ? pBlockData->uid : pBlockData->aUid[iRow]};
-
- // End last table data write if need
- if (tTABLEIDCmprFn(&pWriter->id, &id) != 0) {
- code = tsdbSnapWriteTableDataEnd(pWriter);
- if (code) goto _err;
- }
-
- // Start new table data write if need
- if (pWriter->id.suid == 0 && pWriter->id.uid == 0) {
- code = tsdbSnapWriteTableDataStart(pWriter, &id);
- if (code) goto _err;
- }
-
- // Merge with .data file data
- int8_t done = 0;
- if (pWriter->dReader.pBlockIdx && tTABLEIDCmprFn(pWriter->dReader.pBlockIdx, &id) == 0) {
- code = tsdbSnapWriteToDataFile(pWriter, iRow, &done);
- if (code) goto _err;
- }
-
- // Append to the .stt data block (todo: check if need to set/reload sst block)
- if (!done) {
- code = tsdbSnapWriteToSttFile(pWriter, iRow);
- if (code) goto _err;
- }
-
-_exit:
- return code;
-
-_err:
- tsdbError("vgId:%d, %s failed since %s", TD_VID(pWriter->pTsdb->pVnode), __func__, tstrerror(code));
- return code;
-}
-
-static int32_t tsdbSnapWriteData(STsdbSnapWriter* pWriter, uint8_t* pData, uint32_t nData) {
- int32_t code = 0;
- STsdb* pTsdb = pWriter->pTsdb;
- SBlockData* pBlockData = &pWriter->bData;
-
- // Decode data
- SSnapDataHdr* pHdr = (SSnapDataHdr*)pData;
- code = tDecmprBlockData(pHdr->data, pHdr->size, pBlockData, pWriter->aBuf);
- if (code) goto _err;
-
- ASSERT(pBlockData->nRow > 0);
-
- // Loop to handle each row
- for (int32_t iRow = 0; iRow < pBlockData->nRow; iRow++) {
- TSKEY ts = pBlockData->aTSKEY[iRow];
- int32_t fid = tsdbKeyFid(ts, pWriter->minutes, pWriter->precision);
-
- if (pWriter->dWriter.pWriter == NULL || pWriter->fid != fid) {
- if (pWriter->dWriter.pWriter) {
- // ASSERT(fid > pWriter->fid);
-
- code = tsdbSnapWriteCloseFile(pWriter);
- if (code) goto _err;
- }
-
- code = tsdbSnapWriteOpenFile(pWriter, fid);
- if (code) goto _err;
- }
-
- code = tsdbSnapWriteRowData(pWriter, iRow);
- if (code) goto _err;
- }
-
- return code;
-
-_err:
- tsdbError("vgId:%d, vnode snapshot tsdb write data for %s failed since %s", TD_VID(pTsdb->pVnode), pTsdb->path,
- tstrerror(code));
- return code;
-}
-
-// SNAP_DATA_DEL
-static int32_t tsdbSnapMoveWriteDelData(STsdbSnapWriter* pWriter, TABLEID* pId) {
- int32_t code = 0;
-
- while (true) {
- if (pWriter->iDelIdx >= taosArrayGetSize(pWriter->aDelIdxR)) break;
-
- SDelIdx* pDelIdx = (SDelIdx*)taosArrayGet(pWriter->aDelIdxR, pWriter->iDelIdx);
-
- if (tTABLEIDCmprFn(pDelIdx, pId) >= 0) break;
-
- code = tsdbReadDelData(pWriter->pDelFReader, pDelIdx, pWriter->aDelData);
- if (code) goto _exit;
-
- SDelIdx delIdx = *pDelIdx;
- code = tsdbWriteDelData(pWriter->pDelFWriter, pWriter->aDelData, &delIdx);
- if (code) goto _exit;
-
- if (taosArrayPush(pWriter->aDelIdxW, &delIdx) == NULL) {
- code = TSDB_CODE_OUT_OF_MEMORY;
- goto _exit;
- }
-
- pWriter->iDelIdx++;
- }
-
-_exit:
- return code;
-}
-
-static int32_t tsdbSnapWriteDel(STsdbSnapWriter* pWriter, uint8_t* pData, uint32_t nData) {
- int32_t code = 0;
- STsdb* pTsdb = pWriter->pTsdb;
-
- // Open del file if not opened yet
- if (pWriter->pDelFWriter == NULL) {
- SDelFile* pDelFile = pWriter->fs.pDelFile;
-
- // reader
- if (pDelFile) {
- code = tsdbDelFReaderOpen(&pWriter->pDelFReader, pDelFile, pTsdb);
- if (code) goto _err;
-
- code = tsdbReadDelIdx(pWriter->pDelFReader, pWriter->aDelIdxR);
- if (code) goto _err;
- } else {
- taosArrayClear(pWriter->aDelIdxR);
- }
- pWriter->iDelIdx = 0;
-
- // writer
- SDelFile delFile = {.commitID = pWriter->commitID};
- code = tsdbDelFWriterOpen(&pWriter->pDelFWriter, &delFile, pTsdb);
- if (code) goto _err;
- taosArrayClear(pWriter->aDelIdxW);
- }
-
- SSnapDataHdr* pHdr = (SSnapDataHdr*)pData;
- TABLEID id = *(TABLEID*)pHdr->data;
-
- ASSERT(pHdr->size + sizeof(SSnapDataHdr) == nData);
-
- // Move write data < id
- code = tsdbSnapMoveWriteDelData(pWriter, &id);
- if (code) goto _err;
-
- // Merge incoming data with current
- if (pWriter->iDelIdx < taosArrayGetSize(pWriter->aDelIdxR) &&
- tTABLEIDCmprFn(taosArrayGet(pWriter->aDelIdxR, pWriter->iDelIdx), &id) == 0) {
- SDelIdx* pDelIdx = (SDelIdx*)taosArrayGet(pWriter->aDelIdxR, pWriter->iDelIdx);
-
- code = tsdbReadDelData(pWriter->pDelFReader, pDelIdx, pWriter->aDelData);
- if (code) goto _err;
-
- pWriter->iDelIdx++;
+ if (code) {
+ tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pWriter->pTsdb->pVnode), __func__, lino, tstrerror(code));
} else {
- taosArrayClear(pWriter->aDelData);
+ tsdbTrace("vgId:%d %s done, suid:%" PRId64 " uid:%" PRId64, TD_VID(pWriter->pTsdb->pVnode), __func__,
+ pWriter->tbid.suid, pWriter->tbid.uid);
+ }
+ return code;
+}
+
+static int32_t tsdbSnapWriteDelTableDataEnd(STsdbSnapWriter* pWriter) {
+ int32_t code = 0;
+ int32_t lino = 0;
+
+ if (taosArrayGetSize(pWriter->aDelData) > 0) {
+ SDelIdx* pDelIdx = taosArrayReserve(pWriter->aDelIdx, 1);
+ if (pDelIdx == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ TSDB_CHECK_CODE(code, lino, _exit);
+ }
+
+ pDelIdx->suid = pWriter->tbid.suid;
+ pDelIdx->uid = pWriter->tbid.uid;
+
+ code = tsdbWriteDelData(pWriter->pDelFWriter, pWriter->aDelData, pDelIdx);
+ TSDB_CHECK_CODE(code, lino, _exit);
}
- int64_t n = sizeof(SSnapDataHdr) + sizeof(TABLEID);
- while (n < nData) {
- SDelData delData;
+_exit:
+ if (code) {
+ tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pWriter->pTsdb->pVnode), __func__, lino, tstrerror(code));
+ } else {
+ tsdbTrace("vgId:%d %s done", TD_VID(pWriter->pTsdb->pVnode), __func__);
+ }
+ return code;
+}
+static int32_t tsdbSnapWriteDelTableData(STsdbSnapWriter* pWriter, TABLEID* pId, uint8_t* pData, int64_t size) {
+ int32_t code = 0;
+ int32_t lino = 0;
+
+ if (pId == NULL || pId->uid != pWriter->tbid.uid) {
+ if (pWriter->tbid.uid) {
+ code = tsdbSnapWriteDelTableDataEnd(pWriter);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ }
+
+ code = tsdbSnapWriteDelTableDataStart(pWriter, pId);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ }
+
+ if (pId == NULL) goto _exit;
+
+ int64_t n = 0;
+ while (n < size) {
+ SDelData delData;
n += tGetDelData(pData + n, &delData);
- if (taosArrayPush(pWriter->aDelData, &delData) == NULL) {
+ if (taosArrayPush(pWriter->aDelData, &delData) < 0) {
code = TSDB_CODE_OUT_OF_MEMORY;
- goto _err;
+ TSDB_CHECK_CODE(code, lino, _exit);
}
}
+ ASSERT(n == size);
- SDelIdx delIdx = {.suid = id.suid, .uid = id.uid};
- code = tsdbWriteDelData(pWriter->pDelFWriter, pWriter->aDelData, &delIdx);
- if (code) goto _err;
-
- if (taosArrayPush(pWriter->aDelIdxW, &delIdx) == NULL) {
- code = TSDB_CODE_OUT_OF_MEMORY;
- goto _err;
+_exit:
+ if (code) {
+ tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pWriter->pTsdb->pVnode), __func__, lino, tstrerror(code));
}
-
- return code;
-
-_err:
- tsdbError("vgId:%d, vnode snapshot tsdb write del for %s failed since %s", TD_VID(pTsdb->pVnode), pTsdb->path,
- tstrerror(code));
return code;
}
-static int32_t tsdbSnapWriteDelEnd(STsdbSnapWriter* pWriter) {
+static int32_t tsdbSnapWriteDelDataStart(STsdbSnapWriter* pWriter) {
int32_t code = 0;
- STsdb* pTsdb = pWriter->pTsdb;
+ int32_t lino = 0;
- if (pWriter->pDelFWriter == NULL) return code;
+ STsdb* pTsdb = pWriter->pTsdb;
+ SDelFile* pDelFile = pWriter->fs.pDelFile;
- TABLEID id = {.suid = INT64_MAX, .uid = INT64_MAX};
- code = tsdbSnapMoveWriteDelData(pWriter, &id);
- if (code) goto _err;
+ pWriter->tbid = (TABLEID){0};
- code = tsdbWriteDelIdx(pWriter->pDelFWriter, pWriter->aDelIdxW);
- if (code) goto _err;
+ // reader
+ if (pDelFile) {
+ code = tsdbDelFReaderOpen(&pWriter->pDelFReader, pDelFile, pTsdb);
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+ code = tsdbOpenTombFileDataIter(pWriter->pDelFReader, &pWriter->pTIter);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ }
+
+ // writer
+ code = tsdbDelFWriterOpen(&pWriter->pDelFWriter, &(SDelFile){.commitID = pWriter->commitID}, pTsdb);
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+ if ((pWriter->aDelIdx = taosArrayInit(0, sizeof(SDelIdx))) == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ TSDB_CHECK_CODE(code, lino, _exit);
+ }
+ if ((pWriter->aDelData = taosArrayInit(0, sizeof(SDelData))) == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ TSDB_CHECK_CODE(code, lino, _exit);
+ }
+
+_exit:
+ if (code) {
+ tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, lino, tstrerror(code));
+ } else {
+ tsdbDebug("vgId:%d %s done", TD_VID(pTsdb->pVnode), __func__);
+ }
+ return code;
+}
+
+static int32_t tsdbSnapWriteDelDataEnd(STsdbSnapWriter* pWriter) {
+ int32_t code = 0;
+ int32_t lino = 0;
+
+ STsdb* pTsdb = pWriter->pTsdb;
+
+ // end remaining table with NULL data
+ code = tsdbSnapWriteDelTableData(pWriter, NULL, NULL, 0);
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+ // update file-level info
+ code = tsdbWriteDelIdx(pWriter->pDelFWriter, pWriter->aDelIdx);
+ TSDB_CHECK_CODE(code, lino, _exit);
code = tsdbUpdateDelFileHdr(pWriter->pDelFWriter);
- if (code) goto _err;
+ TSDB_CHECK_CODE(code, lino, _exit);
code = tsdbFSUpsertDelFile(&pWriter->fs, &pWriter->pDelFWriter->fDel);
- if (code) goto _err;
+ TSDB_CHECK_CODE(code, lino, _exit);
code = tsdbDelFWriterClose(&pWriter->pDelFWriter, 1);
- if (code) goto _err;
+ TSDB_CHECK_CODE(code, lino, _exit);
if (pWriter->pDelFReader) {
code = tsdbDelFReaderClose(&pWriter->pDelFReader);
- if (code) goto _err;
+ TSDB_CHECK_CODE(code, lino, _exit);
}
- tsdbInfo("vgId:%d, vnode snapshot tsdb write del for %s end", TD_VID(pTsdb->pVnode), pTsdb->path);
- return code;
+ if (pWriter->pTIter) {
+ tsdbCloseDataIter2(pWriter->pTIter);
+ pWriter->pTIter = NULL;
+ }
-_err:
- tsdbError("vgId:%d, vnode snapshot tsdb write del end for %s failed since %s", TD_VID(pTsdb->pVnode), pTsdb->path,
- tstrerror(code));
+_exit:
+ if (code) {
+ tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, lino, tstrerror(code));
+ } else {
+ tsdbInfo("vgId:%d %s done", TD_VID(pTsdb->pVnode), __func__);
+ }
+ return code;
+}
+
+static int32_t tsdbSnapWriteDelData(STsdbSnapWriter* pWriter, SSnapDataHdr* pHdr) {
+ int32_t code = 0;
+ int32_t lino = 0;
+
+ STsdb* pTsdb = pWriter->pTsdb;
+
+ // start to write del data if need
+ if (pWriter->pDelFWriter == NULL) {
+ code = tsdbSnapWriteDelDataStart(pWriter);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ }
+
+ // do write del data
+ code = tsdbSnapWriteDelTableData(pWriter, (TABLEID*)pHdr->data, pHdr->data + sizeof(TABLEID),
+ pHdr->size - sizeof(TABLEID));
+ TSDB_CHECK_CODE(code, lino, _exit);
+
+_exit:
+ if (code) {
+ tsdbError("vgId:%d %s failed since %s", TD_VID(pTsdb->pVnode), __func__, tstrerror(code));
+ } else {
+ tsdbTrace("vgId:%d %s done", TD_VID(pTsdb->pVnode), __func__);
+ }
return code;
}
// APIs
int32_t tsdbSnapWriterOpen(STsdb* pTsdb, int64_t sver, int64_t ever, STsdbSnapWriter** ppWriter) {
- int32_t code = 0;
- int32_t lino = 0;
- STsdbSnapWriter* pWriter = NULL;
+ int32_t code = 0;
+ int32_t lino = 0;
// alloc
- pWriter = (STsdbSnapWriter*)taosMemoryCalloc(1, sizeof(*pWriter));
+ STsdbSnapWriter* pWriter = (STsdbSnapWriter*)taosMemoryCalloc(1, sizeof(*pWriter));
if (pWriter == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY;
TSDB_CHECK_CODE(code, lino, _exit);
@@ -1288,11 +1835,6 @@ int32_t tsdbSnapWriterOpen(STsdb* pTsdb, int64_t sver, int64_t ever, STsdbSnapWr
pWriter->pTsdb = pTsdb;
pWriter->sver = sver;
pWriter->ever = ever;
-
- code = tsdbFSCopy(pTsdb, &pWriter->fs);
- TSDB_CHECK_CODE(code, lino, _exit);
-
- // config
pWriter->minutes = pTsdb->keepCfg.days;
pWriter->precision = pTsdb->keepCfg.precision;
pWriter->minRow = pTsdb->pVnode->config.tsdbCfg.minRows;
@@ -1300,102 +1842,70 @@ int32_t tsdbSnapWriterOpen(STsdb* pTsdb, int64_t sver, int64_t ever, STsdbSnapWr
pWriter->cmprAlg = pTsdb->pVnode->config.tsdbCfg.compression;
pWriter->commitID = pTsdb->pVnode->state.commitID;
+ code = tsdbFSCopy(pTsdb, &pWriter->fs);
+ TSDB_CHECK_CODE(code, lino, _exit);
+
// SNAP_DATA_TSDB
- code = tBlockDataCreate(&pWriter->bData);
+ code = tBlockDataCreate(&pWriter->inData);
TSDB_CHECK_CODE(code, lino, _exit);
pWriter->fid = INT32_MIN;
- pWriter->id = (TABLEID){0};
- // Reader
- pWriter->dReader.aBlockIdx = taosArrayInit(0, sizeof(SBlockIdx));
- if (pWriter->dReader.aBlockIdx == NULL) {
- code = TSDB_CODE_OUT_OF_MEMORY;
- TSDB_CHECK_CODE(code, lino, _exit);
- }
- code = tBlockDataCreate(&pWriter->dReader.bData);
+
+ code = tBlockDataCreate(&pWriter->bData);
TSDB_CHECK_CODE(code, lino, _exit);
- // Writer
- pWriter->dWriter.aBlockIdx = taosArrayInit(0, sizeof(SBlockIdx));
- if (pWriter->dWriter.aBlockIdx == NULL) {
- code = TSDB_CODE_OUT_OF_MEMORY;
- TSDB_CHECK_CODE(code, lino, _exit);
- }
- pWriter->dWriter.aSttBlk = taosArrayInit(0, sizeof(SSttBlk));
- if (pWriter->dWriter.aSttBlk == NULL) {
- code = TSDB_CODE_OUT_OF_MEMORY;
- TSDB_CHECK_CODE(code, lino, _exit);
- }
- code = tBlockDataCreate(&pWriter->dWriter.bData);
- TSDB_CHECK_CODE(code, lino, _exit);
- code = tBlockDataCreate(&pWriter->dWriter.sData);
+ code = tBlockDataCreate(&pWriter->sData);
TSDB_CHECK_CODE(code, lino, _exit);
// SNAP_DATA_DEL
- pWriter->aDelIdxR = taosArrayInit(0, sizeof(SDelIdx));
- if (pWriter->aDelIdxR == NULL) {
- code = TSDB_CODE_OUT_OF_MEMORY;
- TSDB_CHECK_CODE(code, lino, _exit);
- }
- pWriter->aDelData = taosArrayInit(0, sizeof(SDelData));
- if (pWriter->aDelData == NULL) {
- code = TSDB_CODE_OUT_OF_MEMORY;
- TSDB_CHECK_CODE(code, lino, _exit);
- }
- pWriter->aDelIdxW = taosArrayInit(0, sizeof(SDelIdx));
- if (pWriter->aDelIdxW == NULL) {
- code = TSDB_CODE_OUT_OF_MEMORY;
- TSDB_CHECK_CODE(code, lino, _exit);
- }
_exit:
if (code) {
- tsdbError("vgId:%d, %s failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, lino, tstrerror(code));
- *ppWriter = NULL;
-
+ tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, lino, tstrerror(code));
if (pWriter) {
- if (pWriter->aDelIdxW) taosArrayDestroy(pWriter->aDelIdxW);
- if (pWriter->aDelData) taosArrayDestroy(pWriter->aDelData);
- if (pWriter->aDelIdxR) taosArrayDestroy(pWriter->aDelIdxR);
- tBlockDataDestroy(&pWriter->dWriter.sData);
- tBlockDataDestroy(&pWriter->dWriter.bData);
- if (pWriter->dWriter.aSttBlk) taosArrayDestroy(pWriter->dWriter.aSttBlk);
- if (pWriter->dWriter.aBlockIdx) taosArrayDestroy(pWriter->dWriter.aBlockIdx);
- tBlockDataDestroy(&pWriter->dReader.bData);
- if (pWriter->dReader.aBlockIdx) taosArrayDestroy(pWriter->dReader.aBlockIdx);
+ tBlockDataDestroy(&pWriter->sData);
tBlockDataDestroy(&pWriter->bData);
+ tBlockDataDestroy(&pWriter->inData);
tsdbFSDestroy(&pWriter->fs);
- taosMemoryFree(pWriter);
+ pWriter = NULL;
}
} else {
- tsdbInfo("vgId:%d, %s done", TD_VID(pTsdb->pVnode), __func__);
- *ppWriter = pWriter;
+ tsdbInfo("vgId:%d %s done, sver:%" PRId64 " ever:%" PRId64, TD_VID(pTsdb->pVnode), __func__, sver, ever);
}
+ *ppWriter = pWriter;
return code;
}
int32_t tsdbSnapWriterPrepareClose(STsdbSnapWriter* pWriter) {
int32_t code = 0;
- if (pWriter->dWriter.pWriter) {
- code = tsdbSnapWriteCloseFile(pWriter);
- if (code) goto _exit;
+ int32_t lino = 0;
+
+ if (pWriter->pDataFWriter) {
+ code = tsdbSnapWriteFileDataEnd(pWriter);
+ TSDB_CHECK_CODE(code, lino, _exit);
}
- code = tsdbSnapWriteDelEnd(pWriter);
- if (code) goto _exit;
+ if (pWriter->pDelFWriter) {
+ code = tsdbSnapWriteDelDataEnd(pWriter);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ }
code = tsdbFSPrepareCommit(pWriter->pTsdb, &pWriter->fs);
- if (code) goto _exit;
+ TSDB_CHECK_CODE(code, lino, _exit);
_exit:
if (code) {
- tsdbError("vgId:%d, %s failed since %s", TD_VID(pWriter->pTsdb->pVnode), __func__, tstrerror(code));
+ tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pWriter->pTsdb->pVnode), __func__, lino, tstrerror(code));
+ } else {
+ tsdbDebug("vgId:%d %s done", TD_VID(pWriter->pTsdb->pVnode), __func__);
}
return code;
}
int32_t tsdbSnapWriterClose(STsdbSnapWriter** ppWriter, int8_t rollback) {
- int32_t code = 0;
+ int32_t code = 0;
+ int32_t lino = 0;
+
STsdbSnapWriter* pWriter = *ppWriter;
STsdb* pTsdb = pWriter->pTsdb;
@@ -1408,7 +1918,7 @@ int32_t tsdbSnapWriterClose(STsdbSnapWriter** ppWriter, int8_t rollback) {
code = tsdbFSCommit(pWriter->pTsdb);
if (code) {
taosThreadRwlockUnlock(&pTsdb->rwLock);
- goto _err;
+ TSDB_CHECK_CODE(code, lino, _exit);
}
// unlock
@@ -1416,72 +1926,60 @@ int32_t tsdbSnapWriterClose(STsdbSnapWriter** ppWriter, int8_t rollback) {
}
// SNAP_DATA_DEL
- taosArrayDestroy(pWriter->aDelIdxW);
taosArrayDestroy(pWriter->aDelData);
- taosArrayDestroy(pWriter->aDelIdxR);
+ taosArrayDestroy(pWriter->aDelIdx);
// SNAP_DATA_TSDB
-
- // Writer
- tBlockDataDestroy(&pWriter->dWriter.sData);
- tBlockDataDestroy(&pWriter->dWriter.bData);
- taosArrayDestroy(pWriter->dWriter.aSttBlk);
- tMapDataClear(&pWriter->dWriter.mDataBlk);
- taosArrayDestroy(pWriter->dWriter.aBlockIdx);
-
- // Reader
- tBlockDataDestroy(&pWriter->dReader.bData);
- tMapDataClear(&pWriter->dReader.mDataBlk);
- taosArrayDestroy(pWriter->dReader.aBlockIdx);
-
+ tBlockDataDestroy(&pWriter->sData);
tBlockDataDestroy(&pWriter->bData);
+ taosArrayDestroy(pWriter->aSttBlk);
+ tMapDataClear(&pWriter->mDataBlk);
+ taosArrayDestroy(pWriter->aBlockIdx);
tDestroyTSchema(pWriter->skmTable.pTSchema);
+ tBlockDataDestroy(&pWriter->inData);
for (int32_t iBuf = 0; iBuf < sizeof(pWriter->aBuf) / sizeof(uint8_t*); iBuf++) {
tFree(pWriter->aBuf[iBuf]);
}
- tsdbInfo("vgId:%d, %s done", TD_VID(pWriter->pTsdb->pVnode), __func__);
+ tsdbFSDestroy(&pWriter->fs);
taosMemoryFree(pWriter);
*ppWriter = NULL;
- return code;
-_err:
- tsdbError("vgId:%d, vnode snapshot tsdb writer close for %s failed since %s", TD_VID(pWriter->pTsdb->pVnode),
- pWriter->pTsdb->path, tstrerror(code));
- taosMemoryFree(pWriter);
- *ppWriter = NULL;
+_exit:
+ if (code) {
+ tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, lino, tstrerror(code));
+ } else {
+ tsdbInfo("vgId:%d %s done", TD_VID(pTsdb->pVnode), __func__);
+ }
return code;
}
-int32_t tsdbSnapWrite(STsdbSnapWriter* pWriter, uint8_t* pData, uint32_t nData) {
- int32_t code = 0;
- SSnapDataHdr* pHdr = (SSnapDataHdr*)pData;
+int32_t tsdbSnapWrite(STsdbSnapWriter* pWriter, SSnapDataHdr* pHdr) {
+ int32_t code = 0;
+ int32_t lino = 0;
- // ts data
if (pHdr->type == SNAP_DATA_TSDB) {
- code = tsdbSnapWriteData(pWriter, pData, nData);
- if (code) goto _err;
-
+ code = tsdbSnapWriteTimeSeriesData(pWriter, pHdr);
+ TSDB_CHECK_CODE(code, lino, _exit);
goto _exit;
- } else {
- if (pWriter->dWriter.pWriter) {
- code = tsdbSnapWriteCloseFile(pWriter);
- if (code) goto _err;
- }
+ } else if (pWriter->pDataFWriter) {
+ code = tsdbSnapWriteFileDataEnd(pWriter);
+ TSDB_CHECK_CODE(code, lino, _exit);
}
- // del data
if (pHdr->type == SNAP_DATA_DEL) {
- code = tsdbSnapWriteDel(pWriter, pData, nData);
- if (code) goto _err;
+ code = tsdbSnapWriteDelData(pWriter, pHdr);
+ TSDB_CHECK_CODE(code, lino, _exit);
+ goto _exit;
}
_exit:
- tsdbDebug("vgId:%d, tsdb snapshot write for %s succeed", TD_VID(pWriter->pTsdb->pVnode), pWriter->pTsdb->path);
- return code;
-
-_err:
- tsdbError("vgId:%d, tsdb snapshot write for %s failed since %s", TD_VID(pWriter->pTsdb->pVnode), pWriter->pTsdb->path,
- tstrerror(code));
+ if (code) {
+ tsdbError("vgId:%d %s failed at line %d since %s, type:%d index:%" PRId64 " size:%" PRId64,
+ TD_VID(pWriter->pTsdb->pVnode), __func__, lino, tstrerror(code), pHdr->type, pHdr->index, pHdr->size);
+ } else {
+ tsdbDebug("vgId:%d %s done, type:%d index:%" PRId64 " size:%" PRId64, TD_VID(pWriter->pTsdb->pVnode), __func__,
+ pHdr->type, pHdr->index, pHdr->size);
+ }
return code;
}
diff --git a/source/dnode/vnode/src/tsdb/tsdbUtil.c b/source/dnode/vnode/src/tsdb/tsdbUtil.c
index 25fafff25a..4e051b8b30 100644
--- a/source/dnode/vnode/src/tsdb/tsdbUtil.c
+++ b/source/dnode/vnode/src/tsdb/tsdbUtil.c
@@ -758,7 +758,7 @@ int32_t tsdbRowMergerAdd(SRowMerger *pMerger, TSDBROW *pRow, STSchema *pTSchema)
pTColVal->value.nData = pColVal->value.nData;
if (pTColVal->value.nData) {
- memcpy(pTColVal->value.pData, pColVal->value.pData, pTColVal->value.nData);
+ memcpy(pTColVal->value.pData, pColVal->value.pData, pTColVal->value.nData);
}
pTColVal->flag = 0;
} else {
@@ -1133,6 +1133,7 @@ _exit:
void tBlockDataReset(SBlockData *pBlockData) {
pBlockData->suid = 0;
pBlockData->uid = 0;
+ pBlockData->nRow = 0;
}
void tBlockDataClear(SBlockData *pBlockData) {
diff --git a/source/dnode/vnode/src/vnd/vnodeBufPool.c b/source/dnode/vnode/src/vnd/vnodeBufPool.c
index b1575fb496..40112c5579 100644
--- a/source/dnode/vnode/src/vnd/vnodeBufPool.c
+++ b/source/dnode/vnode/src/vnd/vnodeBufPool.c
@@ -219,10 +219,10 @@ void vnodeBufPoolAddToFreeList(SVBufPool *pPool) {
if (pPool->node.size != size) {
SVBufPool *pNewPool = NULL;
if (vnodeBufPoolCreate(pVnode, pPool->id, size, &pNewPool) < 0) {
- vWarn("vgId:%d failed to change buffer pool of id %d size from %" PRId64 " to %" PRId64 " since %s",
+ vWarn("vgId:%d, failed to change buffer pool of id %d size from %" PRId64 " to %" PRId64 " since %s",
TD_VID(pVnode), pPool->id, pPool->node.size, size, tstrerror(errno));
} else {
- vInfo("vgId:%d buffer pool of id %d size changed from %" PRId64 " to %" PRId64, TD_VID(pVnode), pPool->id,
+ vInfo("vgId:%d, buffer pool of id %d size changed from %" PRId64 " to %" PRId64, TD_VID(pVnode), pPool->id,
pPool->node.size, size);
vnodeBufPoolDestroy(pPool);
@@ -232,7 +232,7 @@ void vnodeBufPoolAddToFreeList(SVBufPool *pPool) {
}
// add to free list
- vDebug("vgId:%d buffer pool %p of id %d is added to free list", TD_VID(pVnode), pPool, pPool->id);
+ vDebug("vgId:%d, buffer pool %p of id %d is added to free list", TD_VID(pVnode), pPool, pPool->id);
vnodeBufPoolReset(pPool);
pPool->freeNext = pVnode->freeList;
pVnode->freeList = pPool;
@@ -307,7 +307,7 @@ int32_t vnodeBufPoolRecycle(SVBufPool *pPool) {
SVnode *pVnode = pPool->pVnode;
- vDebug("vgId:%d recycle buffer pool %p of id %d", TD_VID(pVnode), pPool, pPool->id);
+ vDebug("vgId:%d, recycle buffer pool %p of id %d", TD_VID(pVnode), pPool, pPool->id);
taosThreadMutexLock(&pPool->mutex);
diff --git a/source/dnode/vnode/src/vnd/vnodeCommit.c b/source/dnode/vnode/src/vnd/vnodeCommit.c
index 241470ac8c..b8448747a4 100644
--- a/source/dnode/vnode/src/vnd/vnodeCommit.c
+++ b/source/dnode/vnode/src/vnd/vnodeCommit.c
@@ -28,10 +28,10 @@ static int32_t vnodeTryRecycleBufPool(SVnode *pVnode) {
if (pVnode->onRecycle == NULL) {
if (pVnode->recycleHead == NULL) {
- vDebug("vgId:%d no recyclable buffer pool", TD_VID(pVnode));
+ vDebug("vgId:%d, no recyclable buffer pool", TD_VID(pVnode));
goto _exit;
} else {
- vDebug("vgId:%d buffer pool %p of id %d on recycle queue, try to recycle", TD_VID(pVnode), pVnode->recycleHead,
+ vDebug("vgId:%d, buffer pool %p of id %d on recycle queue, try to recycle", TD_VID(pVnode), pVnode->recycleHead,
pVnode->recycleHead->id);
pVnode->onRecycle = pVnode->recycleHead;
@@ -50,7 +50,7 @@ static int32_t vnodeTryRecycleBufPool(SVnode *pVnode) {
_exit:
if (code) {
- vError("vgId:%d %s failed since %s", TD_VID(pVnode), __func__, tstrerror(code));
+ vError("vgId:%d, %s failed since %s", TD_VID(pVnode), __func__, tstrerror(code));
}
return code;
}
@@ -65,7 +65,7 @@ static int32_t vnodeGetBufPoolToUse(SVnode *pVnode) {
++nTry;
if (pVnode->freeList) {
- vDebug("vgId:%d allocate free buffer pool on %d try, pPool:%p id:%d", TD_VID(pVnode), nTry, pVnode->freeList,
+ vDebug("vgId:%d, allocate free buffer pool on %d try, pPool:%p id:%d", TD_VID(pVnode), nTry, pVnode->freeList,
pVnode->freeList->id);
pVnode->inUse = pVnode->freeList;
@@ -74,13 +74,13 @@ static int32_t vnodeGetBufPoolToUse(SVnode *pVnode) {
pVnode->inUse->freeNext = NULL;
break;
} else {
- vDebug("vgId:%d no free buffer pool on %d try, try to recycle...", TD_VID(pVnode), nTry);
+ vDebug("vgId:%d, no free buffer pool on %d try, try to recycle...", TD_VID(pVnode), nTry);
code = vnodeTryRecycleBufPool(pVnode);
TSDB_CHECK_CODE(code, lino, _exit);
if (pVnode->freeList == NULL) {
- vDebug("vgId:%d no free buffer pool on %d try, wait %d ms...", TD_VID(pVnode), nTry, WAIT_TIME_MILI_SEC);
+ vDebug("vgId:%d, no free buffer pool on %d try, wait %d ms...", TD_VID(pVnode), nTry, WAIT_TIME_MILI_SEC);
struct timeval tv;
struct timespec ts;
@@ -105,7 +105,7 @@ static int32_t vnodeGetBufPoolToUse(SVnode *pVnode) {
_exit:
taosThreadMutexUnlock(&pVnode->mutex);
if (code) {
- vError("vgId:%d %s failed at line %d since %s", TD_VID(pVnode), __func__, lino, tstrerror(code));
+ vError("vgId:%d, %s failed at line %d since %s", TD_VID(pVnode), __func__, lino, tstrerror(code));
}
return code;
}
@@ -140,7 +140,7 @@ int vnodeBegin(SVnode *pVnode) {
_exit:
if (code) {
terrno = code;
- vError("vgId:%d %s failed at line %d since %s", TD_VID(pVnode), __func__, lino, tstrerror(code));
+ vError("vgId:%d, %s failed at line %d since %s", TD_VID(pVnode), __func__, lino, tstrerror(code));
}
return code;
}
@@ -351,7 +351,7 @@ static void vnodeReturnBufPool(SVnode *pVnode) {
if (nRef == 0) {
vnodeBufPoolAddToFreeList(pPool);
} else if (nRef > 0) {
- vDebug("vgId:%d buffer pool %p of id %d is added to recycle queue", TD_VID(pVnode), pPool, pPool->id);
+ vDebug("vgId:%d, buffer pool %p of id %d is added to recycle queue", TD_VID(pVnode), pPool, pPool->id);
if (pVnode->recycleTail == NULL) {
pPool->recyclePrev = pPool->recycleNext = NULL;
diff --git a/source/dnode/vnode/src/vnd/vnodeOpen.c b/source/dnode/vnode/src/vnd/vnodeOpen.c
index 61cb75b1da..da27b5e4d3 100644
--- a/source/dnode/vnode/src/vnd/vnodeOpen.c
+++ b/source/dnode/vnode/src/vnd/vnodeOpen.c
@@ -58,7 +58,7 @@ int32_t vnodeCreate(const char *path, SVnodeCfg *pCfg, STfs *pTfs) {
return 0;
}
-int32_t vnodeAlter(const char *path, SAlterVnodeReplicaReq *pReq, STfs *pTfs) {
+int32_t vnodeAlterReplica(const char *path, SAlterVnodeReplicaReq *pReq, STfs *pTfs) {
SVnodeInfo info = {0};
char dir[TSDB_FILENAME_LEN] = {0};
int32_t ret = 0;
@@ -107,6 +107,117 @@ int32_t vnodeAlter(const char *path, SAlterVnodeReplicaReq *pReq, STfs *pTfs) {
return 0;
}
+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;
+
+ char oldRname[TSDB_FILENAME_LEN] = {0};
+ char newRname[TSDB_FILENAME_LEN] = {0};
+ char tsdbPath[TSDB_FILENAME_LEN] = {0};
+ char tsdbFilePrefix[TSDB_FILENAME_LEN] = {0};
+ snprintf(tsdbPath, TSDB_FILENAME_LEN, "%s%stsdb", dstPath, TD_DIRSEP);
+ snprintf(tsdbFilePrefix, TSDB_FILENAME_LEN, "tsdb%sv", TD_DIRSEP);
+
+ STfsDir *tsdbDir = tfsOpendir(pTfs, tsdbPath);
+ if (tsdbDir == NULL) return 0;
+
+ while (1) {
+ const STfsFile *tsdbFile = tfsReaddir(tsdbDir);
+ if (tsdbFile == NULL) break;
+ if (tsdbFile->rname == NULL) continue;
+ tstrncpy(oldRname, tsdbFile->rname, TSDB_FILENAME_LEN);
+
+ char *tsdbFilePrefixPos = strstr(oldRname, tsdbFilePrefix);
+ if (tsdbFilePrefixPos == NULL) continue;
+
+ int32_t tsdbFileVgId = atoi(tsdbFilePrefixPos + 6);
+ if (tsdbFileVgId == srcVgId) {
+ char *tsdbFileSurfixPos = strstr(tsdbFilePrefixPos, "f");
+ if (tsdbFileSurfixPos == NULL) continue;
+
+ tsdbFilePrefixPos[6] = 0;
+ snprintf(newRname, TSDB_FILENAME_LEN, "%s%d%s", oldRname, dstVgId, tsdbFileSurfixPos);
+ vInfo("vgId:%d, rename file from %s to %s", dstVgId, tsdbFile->rname, newRname);
+
+ ret = tfsRename(pTfs, tsdbFile->rname, newRname);
+ if (ret != 0) {
+ vInfo("vgId:%d, failed to rename file from %s to %s since %s", dstVgId, tsdbFile->rname, newRname, terrstr());
+ tfsClosedir(tsdbDir);
+ return ret;
+ }
+ }
+ }
+
+ tfsClosedir(tsdbDir);
+ return 0;
+}
+
+int32_t vnodeAlterHashRange(const char *srcPath, const char *dstPath, SAlterVnodeHashRangeReq *pReq, STfs *pTfs) {
+ SVnodeInfo info = {0};
+ char dir[TSDB_FILENAME_LEN] = {0};
+ int32_t ret = 0;
+
+ if (pTfs) {
+ snprintf(dir, TSDB_FILENAME_LEN, "%s%s%s", tfsGetPrimaryPath(pTfs), TD_DIRSEP, srcPath);
+ } else {
+ snprintf(dir, TSDB_FILENAME_LEN, "%s", srcPath);
+ }
+
+ // todo add stat file to handle exception while vnode open
+
+ ret = vnodeLoadInfo(dir, &info);
+ if (ret < 0) {
+ vError("vgId:%d, failed to read vnode config from %s since %s", pReq->srcVgId, srcPath, tstrerror(terrno));
+ return -1;
+ }
+
+ vInfo("vgId:%d, start to alter hashrange from [%u, %u) to [%u, %u)", pReq->srcVgId, info.config.hashBegin,
+ info.config.hashEnd, pReq->hashBegin, pReq->hashEnd);
+ info.config.vgId = pReq->dstVgId;
+ info.config.hashBegin = pReq->hashBegin;
+ info.config.hashEnd = pReq->hashEnd;
+ info.config.walCfg.vgId = pReq->dstVgId;
+
+ SSyncCfg *pCfg = &info.config.syncCfg;
+ pCfg->myIndex = 0;
+ pCfg->replicaNum = 1;
+ memset(&pCfg->nodeInfo, 0, sizeof(pCfg->nodeInfo));
+
+ vInfo("vgId:%d, alter vnode replicas to 1", pReq->srcVgId);
+ SNodeInfo *pNode = &pCfg->nodeInfo[0];
+ pNode->nodePort = tsServerPort;
+ tstrncpy(pNode->nodeFqdn, tsLocalFqdn, TSDB_FQDN_LEN);
+ (void)tmsgUpdateDnodeInfo(&pNode->nodeId, &pNode->clusterId, pNode->nodeFqdn, &pNode->nodePort);
+ vInfo("vgId:%d, ep:%s:%u dnode:%d", pReq->srcVgId, pNode->nodeFqdn, pNode->nodePort, pNode->nodeId);
+
+ info.config.syncCfg = *pCfg;
+
+ ret = vnodeSaveInfo(dir, &info);
+ if (ret < 0) {
+ vError("vgId:%d, failed to save vnode config since %s", pReq->dstVgId, tstrerror(terrno));
+ return -1;
+ }
+
+ ret = vnodeCommitInfo(dir, &info);
+ if (ret < 0) {
+ vError("vgId:%d, failed to commit vnode config since %s", pReq->dstVgId, tstrerror(terrno));
+ return -1;
+ }
+
+ vInfo("vgId:%d, start to rename %s to %s", pReq->dstVgId, srcPath, dstPath);
+ ret = vnodeRenameVgroupId(srcPath, dstPath, pReq->srcVgId, pReq->dstVgId, pTfs);
+ if (ret < 0) {
+ vError("vgId:%d, failed to rename vnode from %s to %s since %s", pReq->dstVgId, srcPath, dstPath,
+ tstrerror(terrno));
+ return -1;
+ }
+
+ // todo vnode compact here
+
+ vInfo("vgId:%d, vnode hashrange is altered", info.config.vgId);
+ return 0;
+}
+
void vnodeDestroy(const char *path, STfs *pTfs) {
vInfo("path:%s is removed while destroy vnode", path);
tfsRmdir(pTfs, path);
diff --git a/source/dnode/vnode/src/vnd/vnodeSnapshot.c b/source/dnode/vnode/src/vnd/vnodeSnapshot.c
index e75dc24329..43f903dc48 100644
--- a/source/dnode/vnode/src/vnd/vnodeSnapshot.c
+++ b/source/dnode/vnode/src/vnd/vnodeSnapshot.c
@@ -455,7 +455,7 @@ int32_t vnodeSnapWrite(SVSnapWriter *pWriter, uint8_t *pData, uint32_t nData) {
if (code) goto _err;
}
- code = tsdbSnapWrite(pWriter->pTsdbSnapWriter, pData, nData);
+ code = tsdbSnapWrite(pWriter->pTsdbSnapWriter, pHdr);
if (code) goto _err;
} break;
case SNAP_DATA_TQ_HANDLE: {
diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c
index 6abc144b91..313b9da9a5 100644
--- a/source/dnode/vnode/src/vnd/vnodeSvr.c
+++ b/source/dnode/vnode/src/vnd/vnodeSvr.c
@@ -24,7 +24,6 @@ static int32_t vnodeProcessDropTbReq(SVnode *pVnode, int64_t version, void *pReq
static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq, int32_t len, SRpcMsg *pRsp);
static int32_t vnodeProcessCreateTSmaReq(SVnode *pVnode, int64_t version, void *pReq, int32_t len, SRpcMsg *pRsp);
static int32_t vnodeProcessAlterConfirmReq(SVnode *pVnode, int64_t version, void *pReq, int32_t len, SRpcMsg *pRsp);
-static int32_t vnodeProcessAlterHashRangeReq(SVnode *pVnode, int64_t version, void *pReq, int32_t len, SRpcMsg *pRsp);
static int32_t vnodeProcessAlterConfigReq(SVnode *pVnode, int64_t version, void *pReq, int32_t len, SRpcMsg *pRsp);
static int32_t vnodeProcessDropTtlTbReq(SVnode *pVnode, int64_t version, void *pReq, int32_t len, SRpcMsg *pRsp);
static int32_t vnodeProcessTrimReq(SVnode *pVnode, int64_t version, void *pReq, int32_t len, SRpcMsg *pRsp);
@@ -313,9 +312,6 @@ int32_t vnodeProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRp
case TDMT_VND_ALTER_CONFIRM:
vnodeProcessAlterConfirmReq(pVnode, version, pReq, len, pRsp);
break;
- case TDMT_VND_ALTER_HASHRANGE:
- vnodeProcessAlterHashRangeReq(pVnode, version, pReq, len, pRsp);
- break;
case TDMT_VND_ALTER_CONFIG:
vnodeProcessAlterConfigReq(pVnode, version, pReq, len, pRsp);
break;
@@ -1246,16 +1242,6 @@ static int32_t vnodeProcessAlterConfirmReq(SVnode *pVnode, int64_t version, void
return 0;
}
-static int32_t vnodeProcessAlterHashRangeReq(SVnode *pVnode, int64_t version, void *pReq, int32_t len, SRpcMsg *pRsp) {
- vInfo("vgId:%d, alter hashrange msg will be processed", TD_VID(pVnode));
-
- // todo
- // 1. stop work
- // 2. adjust hash range / compact / remove wals / rename vgroups
- // 3. reload sync
- return 0;
-}
-
static int32_t vnodeProcessAlterConfigReq(SVnode *pVnode, int64_t version, void *pReq, int32_t len, SRpcMsg *pRsp) {
bool walChanged = false;
bool tsdbChanged = false;
diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h
index 7d33f150ff..d939f7ea77 100644
--- a/source/libs/executor/inc/executorimpl.h
+++ b/source/libs/executor/inc/executorimpl.h
@@ -570,7 +570,7 @@ typedef struct SStreamIntervalOperatorInfo {
SWinKey delKey;
uint64_t numOfDatapack;
SArray* pUpdated;
- SHashObj* pUpdatedMap;
+ SSHashObj* pUpdatedMap;
} SStreamIntervalOperatorInfo;
typedef struct SDataGroupInfo {
@@ -717,9 +717,10 @@ void doBuildResultDatablock(SOperatorInfo* pOperator, SOptrBasicInfo* pbInfo, SG
SDiskbasedBuf* pBuf);
bool hasLimitOffsetInfo(SLimitInfo* pLimitInfo);
+bool hasSlimitOffsetInfo(SLimitInfo* pLimitInfo);
void initLimitInfo(const SNode* pLimit, const SNode* pSLimit, SLimitInfo* pLimitInfo);
void resetLimitInfoForNextGroup(SLimitInfo* pLimitInfo);
-bool applyLimitOffset(SLimitInfo* pLimitInfo, SSDataBlock* pBlock, SExecTaskInfo* pTaskInfo, SOperatorInfo* pOperator);
+bool applyLimitOffset(SLimitInfo* pLimitInfo, SSDataBlock* pBlock, SExecTaskInfo* pTaskInfo);
void applyAggFunctionOnPartialTuples(SExecTaskInfo* taskInfo, SqlFunctionCtx* pCtx, SColumnInfoData* pTimeWindowData,
int32_t offset, int32_t forwardStep, int32_t numOfTotal, int32_t numOfOutput);
diff --git a/source/libs/executor/src/dataDispatcher.c b/source/libs/executor/src/dataDispatcher.c
index a603bffba5..d8efcf50ca 100644
--- a/source/libs/executor/src/dataDispatcher.c
+++ b/source/libs/executor/src/dataDispatcher.c
@@ -77,8 +77,8 @@ static void toDataCacheEntry(SDataDispatchHandle* pHandle, const SInputData* pIn
pBuf->useSize = sizeof(SDataCacheEntry);
pEntry->dataLen = blockEncode(pInput->pData, pEntry->data, numOfCols);
-// ASSERT(pEntry->numOfRows == *(int32_t*)(pEntry->data + 8));
-// ASSERT(pEntry->numOfCols == *(int32_t*)(pEntry->data + 8 + 4));
+ // ASSERT(pEntry->numOfRows == *(int32_t*)(pEntry->data + 8));
+ // ASSERT(pEntry->numOfCols == *(int32_t*)(pEntry->data + 8 + 4));
pBuf->useSize += pEntry->dataLen;
@@ -135,7 +135,7 @@ static int32_t putDataBlock(SDataSinkHandle* pHandle, const SInputData* pInput,
taosFreeQitem(pBuf);
return TSDB_CODE_OUT_OF_MEMORY;
}
-
+
toDataCacheEntry(pDispatcher, pInput, pBuf);
taosWriteQitem(pDispatcher->pDataBlocks, pBuf);
@@ -162,14 +162,16 @@ static void getDataLength(SDataSinkHandle* pHandle, int64_t* pLen, bool* pQueryE
SDataDispatchBuf* pBuf = NULL;
taosReadQitem(pDispatcher->pDataBlocks, (void**)&pBuf);
- memcpy(&pDispatcher->nextOutput, pBuf, sizeof(SDataDispatchBuf));
- taosFreeQitem(pBuf);
+ if (pBuf != NULL) {
+ memcpy(&pDispatcher->nextOutput, pBuf, sizeof(SDataDispatchBuf));
+ taosFreeQitem(pBuf);
+ }
SDataCacheEntry* pEntry = (SDataCacheEntry*)pDispatcher->nextOutput.pData;
*pLen = pEntry->dataLen;
-// ASSERT(pEntry->numOfRows == *(int32_t*)(pEntry->data + 8));
-// ASSERT(pEntry->numOfCols == *(int32_t*)(pEntry->data + 8 + 4));
+ // ASSERT(pEntry->numOfRows == *(int32_t*)(pEntry->data + 8));
+ // ASSERT(pEntry->numOfCols == *(int32_t*)(pEntry->data + 8 + 4));
*pQueryEnd = pDispatcher->queryEnd;
qDebug("got data len %" PRId64 ", row num %d in sink", *pLen,
@@ -192,8 +194,8 @@ static int32_t getDataBlock(SDataSinkHandle* pHandle, SOutputData* pOutput) {
pOutput->numOfCols = pEntry->numOfCols;
pOutput->compressed = pEntry->compressed;
-// ASSERT(pEntry->numOfRows == *(int32_t*)(pEntry->data + 8));
-// ASSERT(pEntry->numOfCols == *(int32_t*)(pEntry->data + 8 + 4));
+ // ASSERT(pEntry->numOfRows == *(int32_t*)(pEntry->data + 8));
+ // ASSERT(pEntry->numOfCols == *(int32_t*)(pEntry->data + 8 + 4));
atomic_sub_fetch_64(&pDispatcher->cachedSize, pEntry->dataLen);
atomic_sub_fetch_64(&gDataSinkStat.cachedSize, pEntry->dataLen);
diff --git a/source/libs/executor/src/exchangeoperator.c b/source/libs/executor/src/exchangeoperator.c
index 037b33dc9f..e5089ab4a9 100644
--- a/source/libs/executor/src/exchangeoperator.c
+++ b/source/libs/executor/src/exchangeoperator.c
@@ -218,10 +218,7 @@ static SSDataBlock* loadRemoteData(SOperatorInfo* pOperator) {
if (status == PROJECT_RETRIEVE_CONTINUE) {
continue;
} else if (status == PROJECT_RETRIEVE_DONE) {
- size_t rows = pBlock->info.rows;
- pExchangeInfo->limitInfo.numOfOutputRows += rows;
-
- if (rows == 0) {
+ if (pBlock->info.rows == 0) {
setOperatorCompleted(pOperator);
return NULL;
} else {
@@ -707,6 +704,8 @@ int32_t prepareLoadRemoteData(SOperatorInfo* pOperator) {
}
int32_t handleLimitOffset(SOperatorInfo* pOperator, SLimitInfo* pLimitInfo, SSDataBlock* pBlock, bool holdDataInBuf) {
+ SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
+
if (pLimitInfo->remainGroupOffset > 0) {
if (pLimitInfo->currentGroupId == 0) { // it is the first group
pLimitInfo->currentGroupId = pBlock->info.id.groupId;
@@ -750,36 +749,20 @@ int32_t handleLimitOffset(SOperatorInfo* pOperator, SLimitInfo* pLimitInfo, SSDa
// set current group id
pLimitInfo->currentGroupId = pBlock->info.id.groupId;
- if (pLimitInfo->remainOffset >= pBlock->info.rows) {
- pLimitInfo->remainOffset -= pBlock->info.rows;
- blockDataCleanup(pBlock);
+ bool limitReached = applyLimitOffset(pLimitInfo, pBlock, pTaskInfo);
+ if (pBlock->info.rows == 0) {
return PROJECT_RETRIEVE_CONTINUE;
- } else if (pLimitInfo->remainOffset < pBlock->info.rows && pLimitInfo->remainOffset > 0) {
- blockDataTrimFirstNRows(pBlock, pLimitInfo->remainOffset);
- pLimitInfo->remainOffset = 0;
- }
-
- // check for the limitation in each group
- if (pLimitInfo->limit.limit >= 0 && pLimitInfo->numOfOutputRows + pBlock->info.rows >= pLimitInfo->limit.limit) {
- int32_t keepRows = (int32_t)(pLimitInfo->limit.limit - pLimitInfo->numOfOutputRows);
- blockDataKeepFirstNRows(pBlock, keepRows);
- if (pLimitInfo->slimit.limit > 0 && pLimitInfo->slimit.limit <= pLimitInfo->numOfOutputGroups) {
+ } else {
+ if (limitReached && (pLimitInfo->slimit.limit > 0 && pLimitInfo->slimit.limit <= pLimitInfo->numOfOutputGroups)) {
setOperatorCompleted(pOperator);
- } else {
- // current group limitation is reached, and future blocks of this group need to be discarded.
- if (pBlock->info.rows == 0) {
- return PROJECT_RETRIEVE_CONTINUE;
- }
+ return PROJECT_RETRIEVE_DONE;
}
-
- return PROJECT_RETRIEVE_DONE;
}
// todo optimize performance
// If there are slimit/soffset value exists, multi-round result can not be packed into one group, since the
// they may not belong to the same group the limit/offset value is not valid in this case.
- if ((!holdDataInBuf) || (pBlock->info.rows >= pOperator->resultInfo.threshold) || pLimitInfo->slimit.offset != -1 ||
- pLimitInfo->slimit.limit != -1) {
+ if ((!holdDataInBuf) || (pBlock->info.rows >= pOperator->resultInfo.threshold) || hasSlimitOffsetInfo(pLimitInfo)) {
return PROJECT_RETRIEVE_DONE;
} else { // not full enough, continue to accumulate the output data in the buffer.
return PROJECT_RETRIEVE_CONTINUE;
diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c
index 1d16a3418d..540b5e90f8 100644
--- a/source/libs/executor/src/executil.c
+++ b/source/libs/executor/src/executil.c
@@ -155,7 +155,7 @@ void initGroupedResultInfo(SGroupResInfo* pGroupResInfo, SSHashObj* pHashmap, in
void initMultiResInfoFromArrayList(SGroupResInfo* pGroupResInfo, SArray* pArrayList) {
if (pGroupResInfo->pRows != NULL) {
- taosArrayDestroyP(pGroupResInfo->pRows, taosMemoryFree);
+ taosArrayDestroy(pGroupResInfo->pRows);
}
pGroupResInfo->pRows = pArrayList;
@@ -1761,6 +1761,10 @@ bool hasLimitOffsetInfo(SLimitInfo* pLimitInfo) {
pLimitInfo->slimit.offset != -1);
}
+bool hasSlimitOffsetInfo(SLimitInfo* pLimitInfo) {
+ return (pLimitInfo->slimit.limit != -1 || pLimitInfo->slimit.offset != -1);
+}
+
void initLimitInfo(const SNode* pLimit, const SNode* pSLimit, SLimitInfo* pLimitInfo) {
SLimit limit = {.limit = getLimit(pLimit), .offset = getOffset(pLimit)};
SLimit slimit = {.limit = getLimit(pSLimit), .offset = getOffset(pSLimit)};
diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c
index 21ef5dfab3..08d7f02f8c 100644
--- a/source/libs/executor/src/executorimpl.c
+++ b/source/libs/executor/src/executorimpl.c
@@ -2589,26 +2589,22 @@ int32_t buildDataBlockFromGroupRes(SOperatorInfo* pOperator, SStreamState* pStat
int32_t numOfRows = getNumOfTotalRes(pGroupResInfo);
for (int32_t i = pGroupResInfo->index; i < numOfRows; i += 1) {
- SResKeyPos* pPos = taosArrayGetP(pGroupResInfo->pRows, i);
+ SWinKey* pKey = taosArrayGet(pGroupResInfo->pRows, i);
int32_t size = 0;
void* pVal = NULL;
- SWinKey key = {
- .ts = *(TSKEY*)pPos->key,
- .groupId = pPos->groupId,
- };
- int32_t code = streamStateGet(pState, &key, &pVal, &size);
+ int32_t code = streamStateGet(pState, pKey, &pVal, &size);
ASSERT(code == 0);
SResultRow* pRow = (SResultRow*)pVal;
doUpdateNumOfRows(pCtx, pRow, numOfExprs, rowEntryOffset);
// no results, continue to check the next one
if (pRow->numOfRows == 0) {
pGroupResInfo->index += 1;
- releaseOutputBuf(pState, &key, pRow);
+ releaseOutputBuf(pState, pKey, pRow);
continue;
}
if (pBlock->info.id.groupId == 0) {
- pBlock->info.id.groupId = pPos->groupId;
+ pBlock->info.id.groupId = pKey->groupId;
void* tbname = NULL;
if (streamStateGetParName(pTaskInfo->streamInfo.pState, pBlock->info.id.groupId, &tbname) < 0) {
pBlock->info.parTbName[0] = 0;
@@ -2618,15 +2614,15 @@ int32_t buildDataBlockFromGroupRes(SOperatorInfo* pOperator, SStreamState* pStat
tdbFree(tbname);
} else {
// current value belongs to different group, it can't be packed into one datablock
- if (pBlock->info.id.groupId != pPos->groupId) {
- releaseOutputBuf(pState, &key, pRow);
+ if (pBlock->info.id.groupId != pKey->groupId) {
+ releaseOutputBuf(pState, pKey, pRow);
break;
}
}
if (pBlock->info.rows + pRow->numOfRows > pBlock->info.capacity) {
ASSERT(pBlock->info.rows > 0);
- releaseOutputBuf(pState, &key, pRow);
+ releaseOutputBuf(pState, pKey, pRow);
break;
}
@@ -2656,7 +2652,7 @@ int32_t buildDataBlockFromGroupRes(SOperatorInfo* pOperator, SStreamState* pStat
}
pBlock->info.rows += pRow->numOfRows;
- releaseOutputBuf(pState, &key, pRow);
+ releaseOutputBuf(pState, pKey, pRow);
}
pBlock->info.dataLoad = 1;
blockDataUpdateTsWindow(pBlock, 0);
diff --git a/source/libs/executor/src/groupoperator.c b/source/libs/executor/src/groupoperator.c
index fb122b077f..9c8137db34 100644
--- a/source/libs/executor/src/groupoperator.c
+++ b/source/libs/executor/src/groupoperator.c
@@ -971,7 +971,7 @@ static SSDataBlock* buildStreamPartitionResult(SOperatorInfo* pOperator) {
void appendCreateTableRow(SStreamState* pState, SExprSupp* pTableSup, SExprSupp* pTagSup, int64_t groupId,
SSDataBlock* pSrcBlock, int32_t rowId, SSDataBlock* pDestBlock) {
void* pValue = NULL;
- if (groupId != 0 && streamStateGetParName(pState, groupId, &pValue) != 0) {
+ if (streamStateGetParName(pState, groupId, &pValue) != 0) {
SSDataBlock* pTmpBlock = blockCopyOneRow(pSrcBlock, rowId);
if (pTableSup->numOfExprs > 0) {
projectApplyFunctions(pTableSup->pExprInfo, pDestBlock, pTmpBlock, pTableSup->pCtx, pTableSup->numOfExprs, NULL);
diff --git a/source/libs/executor/src/projectoperator.c b/source/libs/executor/src/projectoperator.c
index 6c2bcf086d..f84871ea92 100644
--- a/source/libs/executor/src/projectoperator.c
+++ b/source/libs/executor/src/projectoperator.c
@@ -90,7 +90,16 @@ SOperatorInfo* createProjectOperatorInfo(SOperatorInfo* downstream, SProjectPhys
pInfo->binfo.pRes = pResBlock;
pInfo->pFinalRes = createOneDataBlock(pResBlock, false);
- pInfo->mergeDataBlocks = (pTaskInfo->execModel == OPTR_EXEC_MODEL_STREAM) ? false : pProjPhyNode->mergeDataBlock;
+
+ if (pTaskInfo->execModel == OPTR_EXEC_MODEL_STREAM) {
+ pInfo->mergeDataBlocks = false;
+ } else {
+ if (!pProjPhyNode->ignoreGroupId) {
+ pInfo->mergeDataBlocks = false;
+ } else {
+ pInfo->mergeDataBlocks = pProjPhyNode->mergeDataBlock;
+ }
+ }
int32_t numOfRows = 4096;
size_t keyBufSize = sizeof(int64_t) + sizeof(int64_t) + POINTER_BYTES;
@@ -185,36 +194,15 @@ static int32_t doIngroupLimitOffset(SLimitInfo* pLimitInfo, uint64_t groupId, SS
SOperatorInfo* pOperator) {
// set current group id
pLimitInfo->currentGroupId = groupId;
-
- if (pLimitInfo->remainOffset >= pBlock->info.rows) {
- pLimitInfo->remainOffset -= pBlock->info.rows;
- blockDataCleanup(pBlock);
+ bool limitReached = applyLimitOffset(pLimitInfo, pBlock, pOperator->pTaskInfo);
+ if (pBlock->info.rows == 0) {
return PROJECT_RETRIEVE_CONTINUE;
- } else if (pLimitInfo->remainOffset < pBlock->info.rows && pLimitInfo->remainOffset > 0) {
- blockDataTrimFirstNRows(pBlock, pLimitInfo->remainOffset);
- pLimitInfo->remainOffset = 0;
- }
-
- // check for the limitation in each group
- if (pLimitInfo->limit.limit >= 0 && pLimitInfo->numOfOutputRows + pBlock->info.rows >= pLimitInfo->limit.limit) {
- int32_t keepRows = (int32_t)(pLimitInfo->limit.limit - pLimitInfo->numOfOutputRows);
- blockDataKeepFirstNRows(pBlock, keepRows);
-
- // TODO: optimize it later when partition by + limit
- // all retrieved requirement has been fulfilled, let's finish this
- if ((pLimitInfo->slimit.limit == -1 && pLimitInfo->currentGroupId == 0) ||
- (pLimitInfo->slimit.limit > 0 && pLimitInfo->slimit.limit <= pLimitInfo->numOfOutputGroups)) {
+ } else {
+ if (limitReached && (pLimitInfo->slimit.limit > 0 && pLimitInfo->slimit.limit <= pLimitInfo->numOfOutputGroups)) {
setOperatorCompleted(pOperator);
- } else {
- // Even current group is done, there may be many vgroups remain existed, and we need to continue to retrieve data
- // from next group. So let's continue this retrieve process
- if (keepRows == 0) {
- return PROJECT_RETRIEVE_CONTINUE;
- }
}
}
- pLimitInfo->numOfOutputRows += pBlock->info.rows;
return PROJECT_RETRIEVE_DONE;
}
diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c
index 37c33c44e2..a7b9cce7aa 100644
--- a/source/libs/executor/src/scanoperator.c
+++ b/source/libs/executor/src/scanoperator.c
@@ -256,12 +256,11 @@ static void doSetTagColumnData(STableScanBase* pTableScanInfo, SSDataBlock* pBlo
}
}
-// todo handle the slimit info
-bool applyLimitOffset(SLimitInfo* pLimitInfo, SSDataBlock* pBlock, SExecTaskInfo* pTaskInfo, SOperatorInfo* pOperator) {
+bool applyLimitOffset(SLimitInfo* pLimitInfo, SSDataBlock* pBlock, SExecTaskInfo* pTaskInfo) {
SLimit* pLimit = &pLimitInfo->limit;
const char* id = GET_TASKID(pTaskInfo);
- if (pLimit->offset > 0 && pLimitInfo->remainOffset > 0) {
+ if (pLimitInfo->remainOffset > 0) {
if (pLimitInfo->remainOffset >= pBlock->info.rows) {
pLimitInfo->remainOffset -= pBlock->info.rows;
blockDataEmpty(pBlock);
@@ -276,12 +275,14 @@ bool applyLimitOffset(SLimitInfo* pLimitInfo, SSDataBlock* pBlock, SExecTaskInfo
if (pLimit->limit != -1 && pLimit->limit <= (pLimitInfo->numOfOutputRows + pBlock->info.rows)) {
// limit the output rows
int32_t keep = (int32_t)(pLimit->limit - pLimitInfo->numOfOutputRows);
-
blockDataKeepFirstNRows(pBlock, keep);
+
+ pLimitInfo->numOfOutputRows += pBlock->info.rows;
qDebug("output limit %" PRId64 " has reached, %s", pLimit->limit, id);
return true;
}
+ pLimitInfo->numOfOutputRows += pBlock->info.rows;
return false;
}
@@ -397,13 +398,12 @@ static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanBase* pTableSca
}
}
- bool limitReached = applyLimitOffset(&pTableScanInfo->limitInfo, pBlock, pTaskInfo, pOperator);
+ bool limitReached = applyLimitOffset(&pTableScanInfo->limitInfo, pBlock, pTaskInfo);
if (limitReached) { // set operator flag is done
setOperatorCompleted(pOperator);
}
pCost->totalRows += pBlock->info.rows;
- pTableScanInfo->limitInfo.numOfOutputRows = pCost->totalRows;
return TSDB_CODE_SUCCESS;
}
@@ -1786,7 +1786,7 @@ FETCH_NEXT_BLOCK:
int32_t current = pInfo->validBlockIndex++;
SPackedData* pPacked = taosArrayGet(pInfo->pBlockLists, current);
SSDataBlock* pBlock = pPacked->pDataBlock;
- if (pBlock->info.id.groupId && pBlock->info.parTbName[0]) {
+ if (pBlock->info.parTbName[0]) {
streamStatePutParName(pTaskInfo->streamInfo.pState, pBlock->info.id.groupId, pBlock->info.parTbName);
}
// TODO move into scan
@@ -2714,9 +2714,7 @@ SSDataBlock* getSortedTableMergeScanBlockData(SSortHandle* pHandle, SSDataBlock*
}
}
- applyLimitOffset(&pInfo->limitInfo, pResBlock, pTaskInfo, pOperator);
- pInfo->limitInfo.numOfOutputRows += pResBlock->info.rows;
-
+ applyLimitOffset(&pInfo->limitInfo, pResBlock, pTaskInfo);
qDebug("%s get sorted row block, rows:%d, limit:%"PRId64, GET_TASKID(pTaskInfo), pResBlock->info.rows,
pInfo->limitInfo.numOfOutputRows);
diff --git a/source/libs/executor/src/sortoperator.c b/source/libs/executor/src/sortoperator.c
index 97b4fd9dc4..98ef6b8a36 100644
--- a/source/libs/executor/src/sortoperator.c
+++ b/source/libs/executor/src/sortoperator.c
@@ -222,6 +222,7 @@ SSDataBlock* doSort(SOperatorInfo* pOperator) {
T_LONG_JMP(pTaskInfo->env, code);
}
+ // multi-group case not handle here
SSDataBlock* pBlock = NULL;
while (1) {
pBlock = getSortedBlockData(pInfo->pSortHandle, pInfo->binfo.pRes, pOperator->resultInfo.capacity,
@@ -236,28 +237,14 @@ SSDataBlock* doSort(SOperatorInfo* pOperator) {
continue;
}
- // todo add the limit/offset info
- if (pInfo->limitInfo.remainOffset > 0) {
- if (pInfo->limitInfo.remainOffset >= blockDataGetNumOfRows(pBlock)) {
- pInfo->limitInfo.remainOffset -= pBlock->info.rows;
- continue;
- }
-
- blockDataTrimFirstNRows(pBlock, pInfo->limitInfo.remainOffset);
- pInfo->limitInfo.remainOffset = 0;
+ // there are bugs?
+ bool limitReached = applyLimitOffset(&pInfo->limitInfo, pBlock, pTaskInfo);
+ if (limitReached) {
+ resetLimitInfoForNextGroup(&pInfo->limitInfo);
}
- if (pInfo->limitInfo.limit.limit > 0 &&
- pInfo->limitInfo.limit.limit <= pInfo->limitInfo.numOfOutputRows + blockDataGetNumOfRows(pBlock)) {
- int32_t remain = pInfo->limitInfo.limit.limit - pInfo->limitInfo.numOfOutputRows;
- blockDataKeepFirstNRows(pBlock, remain);
- }
-
- size_t numOfRows = blockDataGetNumOfRows(pBlock);
- pInfo->limitInfo.numOfOutputRows += numOfRows;
- pOperator->resultInfo.totalRows += numOfRows;
-
- if (numOfRows > 0) {
+ pOperator->resultInfo.totalRows += pBlock->info.rows;
+ if (pBlock->info.rows > 0) {
break;
}
}
@@ -557,7 +544,6 @@ typedef struct SMultiwayMergeOperatorInfo {
SSDataBlock* pIntermediateBlock; // to hold the intermediate result
int64_t startTs; // sort start time
bool groupSort;
- bool hasGroupId;
uint64_t groupId;
STupleHandle* prefetchedTuple;
} SMultiwayMergeOperatorInfo;
@@ -604,7 +590,9 @@ int32_t openMultiwayMergeOperator(SOperatorInfo* pOperator) {
return TSDB_CODE_SUCCESS;
}
-static void doGetSortedBlockData(SMultiwayMergeOperatorInfo* pInfo, SSortHandle* pHandle, int32_t capacity, SSDataBlock* p) {
+static void doGetSortedBlockData(SMultiwayMergeOperatorInfo* pInfo, SSortHandle* pHandle, int32_t capacity,
+ SSDataBlock* p, bool* newgroup) {
+ *newgroup = false;
while (1) {
STupleHandle* pTupleHandle = NULL;
@@ -613,8 +601,12 @@ static void doGetSortedBlockData(SMultiwayMergeOperatorInfo* pInfo, SSortHandle*
pTupleHandle = tsortNextTuple(pHandle);
} else {
pTupleHandle = pInfo->prefetchedTuple;
- pInfo->groupId = tsortGetGroupId(pTupleHandle);
pInfo->prefetchedTuple = NULL;
+ uint64_t gid = tsortGetGroupId(pTupleHandle);
+ if (gid != pInfo->groupId) {
+ *newgroup = true;
+ pInfo->groupId = gid;
+ }
}
} else {
pTupleHandle = tsortNextTuple(pHandle);
@@ -627,12 +619,10 @@ static void doGetSortedBlockData(SMultiwayMergeOperatorInfo* pInfo, SSortHandle*
if (pInfo->groupSort) {
uint64_t tupleGroupId = tsortGetGroupId(pTupleHandle);
- if (!pInfo->hasGroupId) {
+ if (pInfo->groupId == 0 || pInfo->groupId == tupleGroupId) {
+ appendOneRowToDataBlock(p, pTupleHandle);
+ p->info.id.groupId = tupleGroupId;
pInfo->groupId = tupleGroupId;
- pInfo->hasGroupId = true;
- appendOneRowToDataBlock(p, pTupleHandle);
- } else if (pInfo->groupId == tupleGroupId) {
- appendOneRowToDataBlock(p, pTupleHandle);
} else {
pInfo->prefetchedTuple = pTupleHandle;
break;
@@ -645,11 +635,6 @@ static void doGetSortedBlockData(SMultiwayMergeOperatorInfo* pInfo, SSortHandle*
break;
}
}
-
- if (pInfo->groupSort) {
- pInfo->hasGroupId = false;
- }
-
}
SSDataBlock* getMultiwaySortedBlockData(SSortHandle* pHandle, SSDataBlock* pDataBlock, SArray* pColMatchInfo,
@@ -673,14 +658,19 @@ SSDataBlock* getMultiwaySortedBlockData(SSortHandle* pHandle, SSDataBlock* pData
}
SSDataBlock* p = pInfo->pIntermediateBlock;
+ bool newgroup = false;
while (1) {
- doGetSortedBlockData(pInfo, pHandle, capacity, p);
+ doGetSortedBlockData(pInfo, pHandle, capacity, p, &newgroup);
if (p->info.rows == 0) {
break;
}
- bool limitReached = applyLimitOffset(&pInfo->limitInfo, p, pTaskInfo, pOperator);
+ if (newgroup) {
+ resetLimitInfoForNextGroup(&pInfo->limitInfo);
+ }
+
+ bool limitReached = applyLimitOffset(&pInfo->limitInfo, p, pTaskInfo);
if (limitReached) {
resetLimitInfoForNextGroup(&pInfo->limitInfo);
}
diff --git a/source/libs/executor/src/timesliceoperator.c b/source/libs/executor/src/timesliceoperator.c
index f5ceeeafe7..7cb49c8f54 100644
--- a/source/libs/executor/src/timesliceoperator.c
+++ b/source/libs/executor/src/timesliceoperator.c
@@ -440,6 +440,11 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) {
break;
}
+ if (pSliceInfo->scalarSup.pExprInfo != NULL) {
+ SExprSupp* pExprSup = &pSliceInfo->scalarSup;
+ projectApplyFunctions(pExprSup->pExprInfo, pBlock, pBlock, pExprSup->pCtx, pExprSup->numOfExprs, NULL);
+ }
+
int32_t code = initKeeperInfo(pSliceInfo, pBlock);
if (code != TSDB_CODE_SUCCESS) {
T_LONG_JMP(pTaskInfo->env, code);
@@ -538,6 +543,8 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) {
taosTimeAdd(pSliceInfo->current, pInterval->interval, pInterval->intervalUnit, pInterval->precision);
}
+ doFilter(pResBlock, pOperator->exprSupp.pFilterInfo, NULL);
+
// restore the value
setTaskStatus(pOperator->pTaskInfo, TASK_COMPLETED);
if (pResBlock->info.rows == 0) {
@@ -573,6 +580,11 @@ SOperatorInfo* createTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode
}
}
+ code = filterInitFromNode((SNode*)pInterpPhyNode->node.pConditions, &pOperator->exprSupp.pFilterInfo, 0);
+ if (code != TSDB_CODE_SUCCESS) {
+ goto _error;
+ }
+
pInfo->tsCol = extractColumnFromColumnNode((SColumnNode*)pInterpPhyNode->pTimeSeries);
pInfo->fillType = convertFillType(pInterpPhyNode->fillMode);
initResultSizeInfo(&pOperator->resultInfo, 4096);
@@ -629,6 +641,7 @@ void destroyTimeSliceOperatorInfo(void* param) {
taosMemoryFree(pKey->end.val);
}
taosArrayDestroy(pInfo->pLinearInfo);
+ cleanupExprSupp(&pInfo->scalarSup);
taosMemoryFree(pInfo->pFillColInfo);
taosMemoryFreeClear(param);
diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c
index eccdcb85bf..38108dcff6 100644
--- a/source/libs/executor/src/timewindowoperator.c
+++ b/source/libs/executor/src/timewindowoperator.c
@@ -639,7 +639,7 @@ static void doInterpUnclosedTimeWindow(SOperatorInfo* pOperatorInfo, int32_t num
if (NULL == pr) {
T_LONG_JMP(pTaskInfo->env, terrno);
}
-
+
ASSERT(pr->offset == p1->offset && pr->pageId == p1->pageId);
if (pr->closed) {
@@ -842,68 +842,61 @@ static int32_t saveResult(SResultWindowInfo winInfo, SSHashObj* pStUpdated) {
return tSimpleHashPut(pStUpdated, &winInfo.sessionWin, sizeof(SSessionKey), &winInfo, sizeof(SResultWindowInfo));
}
-static int32_t saveWinResult(int64_t ts, int32_t pageId, int32_t offset, uint64_t groupId, SHashObj* pUpdatedMap) {
- SResKeyPos* newPos = taosMemoryMalloc(sizeof(SResKeyPos) + sizeof(uint64_t));
- if (newPos == NULL) {
- return TSDB_CODE_OUT_OF_MEMORY;
- }
- newPos->groupId = groupId;
- newPos->pos = (SResultRowPosition){.pageId = pageId, .offset = offset};
- *(int64_t*)newPos->key = ts;
+static int32_t saveWinResult(int64_t ts, uint64_t groupId, SSHashObj* pUpdatedMap) {
SWinKey key = {.ts = ts, .groupId = groupId};
- if (taosHashPut(pUpdatedMap, &key, sizeof(SWinKey), &newPos, sizeof(void*)) != TSDB_CODE_SUCCESS) {
- taosMemoryFree(newPos);
- }
+ tSimpleHashPut(pUpdatedMap, &key, sizeof(SWinKey), NULL, 0);
return TSDB_CODE_SUCCESS;
}
-static int32_t saveWinResultInfo(TSKEY ts, uint64_t groupId, SHashObj* pUpdatedMap) {
- return saveWinResult(ts, -1, -1, groupId, pUpdatedMap);
+static int32_t saveWinResultInfo(TSKEY ts, uint64_t groupId, SSHashObj* pUpdatedMap) {
+ return saveWinResult(ts, groupId, pUpdatedMap);
}
-static void removeResults(SArray* pWins, SHashObj* pUpdatedMap) {
+static void removeResults(SArray* pWins, SSHashObj* pUpdatedMap) {
int32_t size = taosArrayGetSize(pWins);
for (int32_t i = 0; i < size; i++) {
SWinKey* pW = taosArrayGet(pWins, i);
- void* tmp = taosHashGet(pUpdatedMap, pW, sizeof(SWinKey));
+ void* tmp = tSimpleHashGet(pUpdatedMap, pW, sizeof(SWinKey));
if (tmp) {
void* value = *(void**)tmp;
taosMemoryFree(value);
- taosHashRemove(pUpdatedMap, pW, sizeof(SWinKey));
+ tSimpleHashRemove(pUpdatedMap, pW, sizeof(SWinKey));
}
}
}
-int32_t compareWinRes(void* pKey, void* data, int32_t index) {
- SArray* res = (SArray*)data;
- SWinKey* pDataPos = taosArrayGet(res, index);
- SResKeyPos* pRKey = (SResKeyPos*)pKey;
- if (pRKey->groupId > pDataPos->groupId) {
+int32_t compareWinKey(void* pKey, void* data, int32_t index) {
+ SArray* res = (SArray*)data;
+ SWinKey* pDataPos = taosArrayGet(res, index);
+ SWinKey* pWKey = (SWinKey*)pKey;
+
+ if (pWKey->groupId > pDataPos->groupId) {
return 1;
- } else if (pRKey->groupId < pDataPos->groupId) {
+ } else if (pWKey->groupId < pDataPos->groupId) {
return -1;
}
- if (*(int64_t*)pRKey->key > pDataPos->ts) {
+ if (pWKey->ts > pDataPos->ts) {
return 1;
- } else if (*(int64_t*)pRKey->key < pDataPos->ts) {
+ } else if (pWKey->ts < pDataPos->ts) {
return -1;
}
return 0;
}
-static void removeDeleteResults(SHashObj* pUpdatedMap, SArray* pDelWins) {
+static void removeDeleteResults(SSHashObj* pUpdatedMap, SArray* pDelWins) {
taosArraySort(pDelWins, winKeyCmprImpl);
taosArrayRemoveDuplicate(pDelWins, winKeyCmprImpl, NULL);
int32_t delSize = taosArrayGetSize(pDelWins);
- if (taosHashGetSize(pUpdatedMap) == 0 || delSize == 0) {
+ if (tSimpleHashGetSize(pUpdatedMap) == 0 || delSize == 0) {
return;
}
- void* pIte = NULL;
- while ((pIte = taosHashIterate(pUpdatedMap, pIte)) != NULL) {
- SResKeyPos* pResKey = *(SResKeyPos**)pIte;
- int32_t index = binarySearchCom(pDelWins, delSize, pResKey, TSDB_ORDER_DESC, compareWinRes);
- if (index >= 0 && 0 == compareWinRes(pResKey, pDelWins, index)) {
+ void* pIte = NULL;
+ int32_t iter = 0;
+ while ((pIte = tSimpleHashIterate(pUpdatedMap, pIte, &iter)) != NULL) {
+ SWinKey* pResKey = tSimpleHashGetKey(pIte, NULL);
+ int32_t index = binarySearchCom(pDelWins, delSize, pResKey, TSDB_ORDER_DESC, compareWinKey);
+ if (index >= 0 && 0 == compareWinKey(pResKey, pDelWins, index)) {
taosArrayRemove(pDelWins, index);
delSize = taosArrayGetSize(pDelWins);
}
@@ -1318,11 +1311,11 @@ static void setInverFunction(SqlFunctionCtx* pCtx, int32_t num, EStreamType type
}
static void doClearWindowImpl(SResultRowPosition* p1, SDiskbasedBuf* pResultBuf, SExprSupp* pSup, int32_t numOfOutput) {
- SResultRow* pResult = getResultRowByPos(pResultBuf, p1, false);
+ SResultRow* pResult = getResultRowByPos(pResultBuf, p1, false);
if (NULL == pResult) {
return;
}
-
+
SqlFunctionCtx* pCtx = pSup->pCtx;
for (int32_t i = 0; i < numOfOutput; ++i) {
pCtx[i].resultInfo = getResultEntryInfo(pResult, i, pSup->rowEntryInfoOffset);
@@ -1352,7 +1345,7 @@ static bool doDeleteWindow(SOperatorInfo* pOperator, TSKEY ts, uint64_t groupId)
}
static void doDeleteWindows(SOperatorInfo* pOperator, SInterval* pInterval, SSDataBlock* pBlock, SArray* pUpWins,
- SHashObj* pUpdatedMap) {
+ SSHashObj* pUpdatedMap) {
SStreamIntervalOperatorInfo* pInfo = pOperator->info;
SColumnInfoData* pStartTsCol = taosArrayGet(pBlock->pDataBlock, START_TS_COLUMN_INDEX);
TSKEY* startTsCols = (TSKEY*)pStartTsCol->pData;
@@ -1388,28 +1381,21 @@ static void doDeleteWindows(SOperatorInfo* pOperator, SInterval* pInterval, SSDa
taosArrayPush(pUpWins, &winRes);
}
if (pUpdatedMap) {
- void* tmp = taosHashGet(pUpdatedMap, &winRes, sizeof(SWinKey));
- if (tmp) {
- void* value = *(void**)tmp;
- taosMemoryFree(value);
- taosHashRemove(pUpdatedMap, &winRes, sizeof(SWinKey));
- }
+ tSimpleHashRemove(pUpdatedMap, &winRes, sizeof(SWinKey));
}
getNextTimeWindow(pInterval, pInterval->precision, TSDB_ORDER_ASC, &win);
} while (win.ekey <= endTsCols[i]);
}
}
-static int32_t getAllIntervalWindow(SSHashObj* pHashMap, SHashObj* resWins) {
+static int32_t getAllIntervalWindow(SSHashObj* pHashMap, SSHashObj* resWins) {
void* pIte = NULL;
- size_t keyLen = 0;
int32_t iter = 0;
while ((pIte = tSimpleHashIterate(pHashMap, pIte, &iter)) != NULL) {
- void* key = tSimpleHashGetKey(pIte, &keyLen);
- uint64_t groupId = *(uint64_t*)key;
- TSKEY ts = *(int64_t*)((char*)key + sizeof(uint64_t));
- SResultRowPosition* pPos = (SResultRowPosition*)pIte;
- int32_t code = saveWinResult(ts, pPos->pageId, pPos->offset, groupId, resWins);
+ SWinKey* pKey = tSimpleHashGetKey(pIte, NULL);
+ uint64_t groupId = pKey->groupId;
+ TSKEY ts = pKey->ts;
+ int32_t code = saveWinResult(ts, groupId, resWins);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
@@ -1417,36 +1403,16 @@ static int32_t getAllIntervalWindow(SSHashObj* pHashMap, SHashObj* resWins) {
return TSDB_CODE_SUCCESS;
}
-int32_t compareWinKey(void* pKey, void* data, int32_t index) {
- SArray* res = (SArray*)data;
- SWinKey* pDataPos = taosArrayGet(res, index);
- SWinKey* pWKey = (SWinKey*)pKey;
-
- if (pWKey->groupId > pDataPos->groupId) {
- return 1;
- } else if (pWKey->groupId < pDataPos->groupId) {
- return -1;
- }
-
- if (pWKey->ts > pDataPos->ts) {
- return 1;
- } else if (pWKey->ts < pDataPos->ts) {
- return -1;
- }
- return 0;
-}
-
static int32_t closeStreamIntervalWindow(SSHashObj* pHashMap, STimeWindowAggSupp* pTwSup, SInterval* pInterval,
- SHashObj* pPullDataMap, SHashObj* closeWins, SArray* pDelWins,
+ SHashObj* pPullDataMap, SSHashObj* closeWins, SArray* pDelWins,
SOperatorInfo* pOperator) {
qDebug("===stream===close interval window");
void* pIte = NULL;
- size_t keyLen = 0;
int32_t iter = 0;
SStreamIntervalOperatorInfo* pInfo = pOperator->info;
int32_t delSize = taosArrayGetSize(pDelWins);
while ((pIte = tSimpleHashIterate(pHashMap, pIte, &iter)) != NULL) {
- void* key = tSimpleHashGetKey(pIte, &keyLen);
+ void* key = tSimpleHashGetKey(pIte, NULL);
SWinKey* pWinKey = (SWinKey*)key;
if (delSize > 0) {
int32_t index = binarySearchCom(pDelWins, delSize, pWinKey, TSDB_ORDER_DESC, compareWinKey);
@@ -1648,7 +1614,7 @@ void destroyStreamFinalIntervalOperatorInfo(void* param) {
}
nodesDestroyNode((SNode*)pInfo->pPhyNode);
colDataDestroy(&pInfo->twAggSup.timeWindowData);
- cleanupGroupResInfo(&pInfo->groupResInfo);
+ pInfo->groupResInfo.pRows = taosArrayDestroy(pInfo->groupResInfo.pRows);
cleanupExprSupp(&pInfo->scalarSupp);
taosMemoryFreeClear(param);
@@ -2157,7 +2123,7 @@ bool hasIntervalWindow(SStreamState* pState, SWinKey* pKey) {
return TSDB_CODE_SUCCESS == streamStateGet(pState, pKey, NULL, 0);
}
-static void rebuildIntervalWindow(SOperatorInfo* pOperator, SArray* pWinArray, SHashObj* pUpdatedMap) {
+static void rebuildIntervalWindow(SOperatorInfo* pOperator, SArray* pWinArray, SSHashObj* pUpdatedMap) {
SStreamIntervalOperatorInfo* pInfo = pOperator->info;
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
int32_t size = taosArrayGetSize(pWinArray);
@@ -2343,7 +2309,8 @@ static void clearFunctionContext(SExprSupp* pSup) {
}
}
-void doBuildResult(SOperatorInfo* pOperator, SStreamState* pState, SSDataBlock* pBlock, SGroupResInfo* pGroupResInfo) {
+void doBuildStreamIntervalResult(SOperatorInfo* pOperator, SStreamState* pState, SSDataBlock* pBlock,
+ SGroupResInfo* pGroupResInfo) {
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
// set output datablock version
pBlock->info.version = pTaskInfo->version;
@@ -2370,7 +2337,7 @@ static int32_t getNextQualifiedFinalWindow(SInterval* pInterval, STimeWindow* pN
}
static void doStreamIntervalAggImpl(SOperatorInfo* pOperatorInfo, SSDataBlock* pSDataBlock, uint64_t groupId,
- SHashObj* pUpdatedMap) {
+ SSHashObj* pUpdatedMap) {
SStreamIntervalOperatorInfo* pInfo = (SStreamIntervalOperatorInfo*)pOperatorInfo->info;
SResultRowInfo* pResultRowInfo = &(pInfo->binfo.resultRowInfo);
@@ -2478,7 +2445,19 @@ static void doStreamIntervalAggImpl(SOperatorInfo* pOperatorInfo, SSDataBlock* p
pInfo->delKey = key;
}
int32_t prevEndPos = (forwardRows - 1) * step + startPos;
- ASSERT(pSDataBlock->info.window.skey > 0 && pSDataBlock->info.window.ekey > 0);
+ if (pSDataBlock->info.window.skey <= 0 || pSDataBlock->info.window.ekey <= 0) {
+ qError("table uid %" PRIu64 " data block timestamp range may not be calculated! minKey %" PRId64
+ ",maxKey %" PRId64,
+ pSDataBlock->info.id.uid, pSDataBlock->info.window.skey, pSDataBlock->info.window.ekey);
+ blockDataUpdateTsWindow(pSDataBlock, 0);
+
+ // timestamp of the data is incorrect
+ if (pSDataBlock->info.window.skey <= 0 || pSDataBlock->info.window.ekey <= 0) {
+ qError("table uid %" PRIu64 " data block timestamp is out of range! minKey %" PRId64 ",maxKey %" PRId64,
+ pSDataBlock->info.id.uid, pSDataBlock->info.window.skey, pSDataBlock->info.window.ekey);
+ }
+ }
+
if (IS_FINAL_OP(pInfo)) {
startPos = getNextQualifiedFinalWindow(&pInfo->interval, &nextWin, &pSDataBlock->info, tsCols, prevEndPos);
} else {
@@ -2516,7 +2495,7 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) {
return pInfo->pDelRes;
}
- doBuildResult(pOperator, pInfo->pState, pInfo->binfo.pRes, &pInfo->groupResInfo);
+ doBuildStreamIntervalResult(pOperator, pInfo->pState, pInfo->binfo.pRes, &pInfo->groupResInfo);
if (pInfo->binfo.pRes->info.rows != 0) {
printDataBlock(pInfo->binfo.pRes, IS_FINAL_OP(pInfo) ? "interval final" : "interval semi");
return pInfo->binfo.pRes;
@@ -2543,7 +2522,7 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) {
return pInfo->pDelRes;
}
- doBuildResult(pOperator, pInfo->pState, pInfo->binfo.pRes, &pInfo->groupResInfo);
+ doBuildStreamIntervalResult(pOperator, pInfo->pState, pInfo->binfo.pRes, &pInfo->groupResInfo);
if (pInfo->binfo.pRes->info.rows != 0) {
printDataBlock(pInfo->binfo.pRes, IS_FINAL_OP(pInfo) ? "interval final" : "interval semi");
return pInfo->binfo.pRes;
@@ -2552,11 +2531,11 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) {
}
if (!pInfo->pUpdated) {
- pInfo->pUpdated = taosArrayInit(4, POINTER_BYTES);
+ pInfo->pUpdated = taosArrayInit(4, sizeof(SWinKey));
}
if (!pInfo->pUpdatedMap) {
_hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY);
- pInfo->pUpdatedMap = taosHashInit(1024, hashFn, false, HASH_NO_LOCK);
+ pInfo->pUpdatedMap = tSimpleHashInit(1024, hashFn);
}
while (1) {
@@ -2649,13 +2628,14 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) {
}
pInfo->binfo.pRes->info.watermark = pInfo->twAggSup.maxTs;
- void* pIte = NULL;
- while ((pIte = taosHashIterate(pInfo->pUpdatedMap, pIte)) != NULL) {
+ void* pIte = NULL;
+ int32_t iter = 0;
+ while ((pIte = tSimpleHashIterate(pInfo->pUpdatedMap, pIte, &iter)) != NULL) {
taosArrayPush(pInfo->pUpdated, pIte);
}
- taosHashCleanup(pInfo->pUpdatedMap);
+ tSimpleHashCleanup(pInfo->pUpdatedMap);
pInfo->pUpdatedMap = NULL;
- taosArraySort(pInfo->pUpdated, resultrowComparAsc);
+ taosArraySort(pInfo->pUpdated, winKeyCmprImpl);
initMultiResInfoFromArrayList(&pInfo->groupResInfo, pInfo->pUpdated);
pInfo->pUpdated = NULL;
@@ -2675,7 +2655,7 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) {
return pInfo->pDelRes;
}
- doBuildResult(pOperator, pInfo->pState, pInfo->binfo.pRes, &pInfo->groupResInfo);
+ doBuildStreamIntervalResult(pOperator, pInfo->pState, pInfo->binfo.pRes, &pInfo->groupResInfo);
if (pInfo->binfo.pRes->info.rows != 0) {
printDataBlock(pInfo->binfo.pRes, IS_FINAL_OP(pInfo) ? "interval final" : "interval semi");
return pInfo->binfo.pRes;
@@ -3239,10 +3219,9 @@ static inline int32_t sessionKeyCompareAsc(const void* pKey1, const void* pKey2)
static int32_t copyUpdateResult(SSHashObj* pStUpdated, SArray* pUpdated) {
void* pIte = NULL;
- size_t keyLen = 0;
int32_t iter = 0;
while ((pIte = tSimpleHashIterate(pStUpdated, pIte, &iter)) != NULL) {
- void* key = tSimpleHashGetKey(pIte, &keyLen);
+ void* key = tSimpleHashGetKey(pIte, NULL);
taosArrayPush(pUpdated, key);
}
taosArraySort(pUpdated, sessionKeyCompareAsc);
@@ -3256,13 +3235,12 @@ void doBuildDeleteDataBlock(SOperatorInfo* pOp, SSHashObj* pStDeleted, SSDataBlo
return;
}
blockDataEnsureCapacity(pBlock, size);
- size_t keyLen = 0;
int32_t iter = 0;
while (((*Ite) = tSimpleHashIterate(pStDeleted, *Ite, &iter)) != NULL) {
if (pBlock->info.rows + 1 > pBlock->info.capacity) {
break;
}
- SSessionKey* res = tSimpleHashGetKey(*Ite, &keyLen);
+ SSessionKey* res = tSimpleHashGetKey(*Ite, NULL);
SColumnInfoData* pStartTsCol = taosArrayGet(pBlock->pDataBlock, START_TS_COLUMN_INDEX);
colDataAppend(pStartTsCol, pBlock->info.rows, (const char*)&res->win.skey, false);
SColumnInfoData* pEndTsCol = taosArrayGet(pBlock->pDataBlock, END_TS_COLUMN_INDEX);
@@ -3351,7 +3329,6 @@ static void rebuildSessionWindow(SOperatorInfo* pOperator, SArray* pWinArray, SS
int32_t closeSessionWindow(SSHashObj* pHashMap, STimeWindowAggSupp* pTwSup, SSHashObj* pClosed) {
void* pIte = NULL;
- size_t keyLen = 0;
int32_t iter = 0;
while ((pIte = tSimpleHashIterate(pHashMap, pIte, &iter)) != NULL) {
SResultWindowInfo* pWinInfo = pIte;
@@ -3362,7 +3339,7 @@ int32_t closeSessionWindow(SSHashObj* pHashMap, STimeWindowAggSupp* pTwSup, SSHa
return code;
}
}
- SSessionKey* pKey = tSimpleHashGetKey(pIte, &keyLen);
+ SSessionKey* pKey = tSimpleHashGetKey(pIte, NULL);
tSimpleHashIterateRemove(pHashMap, pKey, sizeof(SSessionKey), &pIte, &iter);
}
}
@@ -3451,7 +3428,7 @@ static SSDataBlock* doStreamSessionAgg(SOperatorInfo* pOperator) {
pInfo->pUpdated = taosArrayInit(16, sizeof(SSessionKey));
}
if (!pInfo->pStUpdated) {
- _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY);
+ _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY);
pInfo->pStUpdated = tSimpleHashInit(64, hashFn);
}
while (1) {
@@ -3675,7 +3652,7 @@ static SSDataBlock* doStreamSessionSemiAgg(SOperatorInfo* pOperator) {
pInfo->pUpdated = taosArrayInit(16, sizeof(SSessionKey));
}
if (!pInfo->pStUpdated) {
- _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY);
+ _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY);
pInfo->pStUpdated = tSimpleHashInit(64, hashFn);
}
while (1) {
@@ -4006,7 +3983,7 @@ static SSDataBlock* doStreamStateAgg(SOperatorInfo* pOperator) {
pInfo->pUpdated = taosArrayInit(16, sizeof(SSessionKey));
}
if (!pInfo->pSeUpdated) {
- _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY);
+ _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY);
pInfo->pSeUpdated = tSimpleHashInit(64, hashFn);
}
while (1) {
@@ -4761,7 +4738,7 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) {
return pInfo->pDelRes;
}
- doBuildResult(pOperator, pInfo->pState, pInfo->binfo.pRes, &pInfo->groupResInfo);
+ doBuildStreamIntervalResult(pOperator, pInfo->pState, pInfo->binfo.pRes, &pInfo->groupResInfo);
if (pInfo->binfo.pRes->info.rows > 0) {
printDataBlock(pInfo->binfo.pRes, "single interval");
return pInfo->binfo.pRes;
@@ -4776,14 +4753,13 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) {
SOperatorInfo* downstream = pOperator->pDownstream[0];
if (!pInfo->pUpdated) {
- pInfo->pUpdated = taosArrayInit(4, POINTER_BYTES);
+ pInfo->pUpdated = taosArrayInit(4, sizeof(SWinKey));
}
if (!pInfo->pUpdatedMap) {
_hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY);
- pInfo->pUpdatedMap = taosHashInit(1024, hashFn, false, HASH_NO_LOCK);
+ pInfo->pUpdatedMap = tSimpleHashInit(1024, hashFn);
}
-
while (1) {
SSDataBlock* pBlock = downstream->fpSet.getNextFn(downstream);
if (pBlock == NULL) {
@@ -4832,19 +4808,21 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) {
}
pOperator->status = OP_RES_TO_RETURN;
removeDeleteResults(pInfo->pUpdatedMap, pInfo->pDelWins);
- closeStreamIntervalWindow(pInfo->aggSup.pResultRowHashTable, &pInfo->twAggSup, &pInfo->interval, NULL, pInfo->pUpdatedMap,
- pInfo->pDelWins, pOperator);
+ closeStreamIntervalWindow(pInfo->aggSup.pResultRowHashTable, &pInfo->twAggSup, &pInfo->interval, NULL,
+ pInfo->pUpdatedMap, pInfo->pDelWins, pOperator);
- void* pIte = NULL;
- while ((pIte = taosHashIterate(pInfo->pUpdatedMap, pIte)) != NULL) {
- taosArrayPush(pInfo->pUpdated, pIte);
+ void* pIte = NULL;
+ int32_t iter = 0;
+ while ((pIte = tSimpleHashIterate(pInfo->pUpdatedMap, pIte, &iter)) != NULL) {
+ SWinKey* pKey = tSimpleHashGetKey(pIte, NULL);
+ taosArrayPush(pInfo->pUpdated, pKey);
}
- taosArraySort(pInfo->pUpdated, resultrowComparAsc);
+ taosArraySort(pInfo->pUpdated, winKeyCmprImpl);
initMultiResInfoFromArrayList(&pInfo->groupResInfo, pInfo->pUpdated);
pInfo->pUpdated = NULL;
blockDataEnsureCapacity(pInfo->binfo.pRes, pOperator->resultInfo.capacity);
- taosHashCleanup(pInfo->pUpdatedMap);
+ tSimpleHashCleanup(pInfo->pUpdatedMap);
pInfo->pUpdatedMap = NULL;
doBuildDeleteResult(pInfo, pInfo->pDelWins, &pInfo->delIndex, pInfo->pDelRes);
@@ -4853,7 +4831,7 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) {
return pInfo->pDelRes;
}
- doBuildResult(pOperator, pInfo->pState, pInfo->binfo.pRes, &pInfo->groupResInfo);
+ doBuildStreamIntervalResult(pOperator, pInfo->pState, pInfo->binfo.pRes, &pInfo->groupResInfo);
if (pInfo->binfo.pRes->info.rows > 0) {
printDataBlock(pInfo->binfo.pRes, "single interval");
return pInfo->binfo.pRes;
diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c
index 61bb3778fa..723d6d9eee 100644
--- a/source/libs/nodes/src/nodesUtilFuncs.c
+++ b/source/libs/nodes/src/nodesUtilFuncs.c
@@ -436,7 +436,7 @@ SNode* nodesMakeNode(ENodeType type) {
return makeNode(type, sizeof(SShowCreateDatabaseStmt));
case QUERY_NODE_SHOW_DB_ALIVE_STMT:
case QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT:
- return makeNode(type, sizeof(SShowAliveStmt));
+ return makeNode(type, sizeof(SShowAliveStmt));
case QUERY_NODE_SHOW_CREATE_TABLE_STMT:
case QUERY_NODE_SHOW_CREATE_STABLE_STMT:
return makeNode(type, sizeof(SShowCreateTableStmt));
@@ -964,7 +964,7 @@ void nodesDestroyNode(SNode* pNode) {
case QUERY_NODE_SHOW_LICENCES_STMT:
case QUERY_NODE_SHOW_VGROUPS_STMT:
case QUERY_NODE_SHOW_DB_ALIVE_STMT:
- case QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT:
+ case QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT:
case QUERY_NODE_SHOW_TOPICS_STMT:
case QUERY_NODE_SHOW_CONSUMERS_STMT:
case QUERY_NODE_SHOW_CONNECTIONS_STMT:
@@ -1103,6 +1103,8 @@ void nodesDestroyNode(SNode* pNode) {
nodesDestroyNode(pLogicNode->pTspk);
nodesDestroyNode(pLogicNode->pTsEnd);
nodesDestroyNode(pLogicNode->pStateExpr);
+ nodesDestroyNode(pLogicNode->pStartCond);
+ nodesDestroyNode(pLogicNode->pEndCond);
break;
}
case QUERY_NODE_LOGIC_PLAN_FILL: {
diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y
index ba17488470..eaaa101701 100644
--- a/source/libs/parser/inc/sql.y
+++ b/source/libs/parser/inc/sql.y
@@ -517,6 +517,7 @@ cmd ::= RESET QUERY CACHE.
/************************************************ explain *************************************************************/
cmd ::= EXPLAIN analyze_opt(A) explain_options(B) query_or_subquery(C). { pCxt->pRootNode = createExplainStmt(pCxt, A, B, C); }
+cmd ::= EXPLAIN analyze_opt(A) explain_options(B) insert_query(C). { pCxt->pRootNode = createExplainStmt(pCxt, A, B, C); }
%type analyze_opt { bool }
%destructor analyze_opt { }
@@ -599,9 +600,11 @@ cmd ::= DELETE FROM full_table_name(A) where_clause_opt(B).
cmd ::= query_or_subquery(A). { pCxt->pRootNode = A; }
/************************************************ insert **************************************************************/
-cmd ::= INSERT INTO full_table_name(A)
- NK_LP col_name_list(B) NK_RP query_or_subquery(C). { pCxt->pRootNode = createInsertStmt(pCxt, A, B, C); }
-cmd ::= INSERT INTO full_table_name(A) query_or_subquery(B). { pCxt->pRootNode = createInsertStmt(pCxt, A, NULL, B); }
+cmd ::= insert_query(A). { pCxt->pRootNode = A; }
+
+insert_query(A) ::= INSERT INTO full_table_name(D)
+ NK_LP col_name_list(B) NK_RP query_or_subquery(C). { A = createInsertStmt(pCxt, D, B, C); }
+insert_query(A) ::= INSERT INTO full_table_name(C) query_or_subquery(B). { A = createInsertStmt(pCxt, C, NULL, B); }
/************************************************ literal *************************************************************/
literal(A) ::= NK_INTEGER(B). { A = createRawExprNode(pCxt, &B, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &B)); }
diff --git a/source/libs/parser/src/parInsertSql.c b/source/libs/parser/src/parInsertSql.c
index 3c5d4d506a..630b61bd4b 100644
--- a/source/libs/parser/src/parInsertSql.c
+++ b/source/libs/parser/src/parInsertSql.c
@@ -1693,6 +1693,9 @@ static int32_t getTableSchemaFromMetaData(SInsertParseContext* pCxt, const SMeta
if (TSDB_CODE_SUCCESS == code && !isStb && TSDB_SUPER_TABLE == pStmt->pTableMeta->tableType) {
code = buildInvalidOperationMsg(&pCxt->msg, "insert data into super table is not supported");
}
+ if (TSDB_CODE_SUCCESS == code && isStb) {
+ code = storeTableMeta(pCxt, pStmt);
+ }
if (TSDB_CODE_SUCCESS == code) {
code = getTableVgroupFromMetaData(pMetaData->pTableHash, pStmt, isStb);
}
diff --git a/source/libs/parser/src/parInsertUtil.c b/source/libs/parser/src/parInsertUtil.c
index 7cc93b448f..5791a634df 100644
--- a/source/libs/parser/src/parInsertUtil.c
+++ b/source/libs/parser/src/parInsertUtil.c
@@ -290,7 +290,8 @@ int32_t insGetTableDataCxt(SHashObj* pHash, void* id, int32_t idLen, STableMeta*
}
int32_t code = createTableDataCxt(pTableMeta, pCreateTbReq, pTableCxt, colMode);
if (TSDB_CODE_SUCCESS == code) {
- code = taosHashPut(pHash, id, idLen, pTableCxt, POINTER_BYTES);
+ void* pData = *pTableCxt; // deal scan coverity
+ code = taosHashPut(pHash, id, idLen, &pData, POINTER_BYTES);
}
return code;
}
diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c
index 6e94883849..ae3f5226f5 100644
--- a/source/libs/parser/src/parTranslater.c
+++ b/source/libs/parser/src/parTranslater.c
@@ -1550,11 +1550,14 @@ static int32_t translateRepeatScanFunc(STranslateContext* pCxt, SFunctionNode* p
// select percentile() without from clause is also valid
if ((NULL != pTable && (QUERY_NODE_REAL_TABLE != nodeType(pTable) ||
(TSDB_CHILD_TABLE != ((SRealTableNode*)pTable)->pMeta->tableType &&
- TSDB_NORMAL_TABLE != ((SRealTableNode*)pTable)->pMeta->tableType))) ||
- NULL != pSelect->pPartitionByList) {
+ TSDB_NORMAL_TABLE != ((SRealTableNode*)pTable)->pMeta->tableType)))) {
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_ONLY_SUPPORT_SINGLE_TABLE,
"%s is only supported in single table query", pFunc->functionName);
}
+ if (NULL != pSelect->pPartitionByList) {
+ return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_ALLOWED_FUNC,
+ "%s function is not supported in partition query", pFunc->functionName);
+ }
return TSDB_CODE_SUCCESS;
}
@@ -2979,7 +2982,7 @@ static int32_t checkFill(STranslateContext* pCxt, SFillNode* pFill, SValueNode*
intervalRange = pInterval->datum.i;
}
- if ((timeRange == 0) || (timeRange / intervalRange) >= MAX_INTERVAL_TIME_WINDOW) {
+ if ((timeRange / intervalRange) >= MAX_INTERVAL_TIME_WINDOW) {
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_FILL_TIME_RANGE);
}
@@ -3281,9 +3284,6 @@ static int32_t translateInterp(STranslateContext* pCxt, SSelectStmt* pSelect) {
}
static int32_t translatePartitionBy(STranslateContext* pCxt, SSelectStmt* pSelect) {
- if (NULL == pSelect->pPartitionByList) {
- return TSDB_CODE_SUCCESS;
- }
pCxt->currClause = SQL_CLAUSE_PARTITION_BY;
int32_t code = translateExprList(pCxt, pSelect->pPartitionByList);
if (TSDB_CODE_SUCCESS == code) {
@@ -3517,7 +3517,7 @@ static int32_t translateSetOperProject(STranslateContext* pCxt, SSetOperator* pS
if (comp > 0) {
SNode* pRightFunc = NULL;
int32_t code = createCastFunc(pCxt, pRight, pLeftExpr->resType, &pRightFunc);
- if (TSDB_CODE_SUCCESS != code) {
+ if (TSDB_CODE_SUCCESS != code || NULL == pRightFunc) { // deal scan coverity
return code;
}
REPLACE_LIST2_NODE(pRightFunc);
@@ -3525,7 +3525,7 @@ static int32_t translateSetOperProject(STranslateContext* pCxt, SSetOperator* pS
} else if (comp < 0) {
SNode* pLeftFunc = NULL;
int32_t code = createCastFunc(pCxt, pLeft, pRightExpr->resType, &pLeftFunc);
- if (TSDB_CODE_SUCCESS != code) {
+ if (TSDB_CODE_SUCCESS != code || NULL == pLeftFunc) { // deal scan coverity
return code;
}
REPLACE_LIST1_NODE(pLeftFunc);
@@ -5674,10 +5674,6 @@ static SNode* createNullValue() {
}
static int32_t addNullTagsForExistTable(STranslateContext* pCxt, STableMeta* pMeta, SSelectStmt* pSelect) {
- if (NULL == pMeta) {
- return TSDB_CODE_SUCCESS;
- }
-
int32_t numOfTags = getNumOfTags(pMeta);
int32_t code = TSDB_CODE_SUCCESS;
for (int32_t i = 0; TSDB_CODE_SUCCESS == code && i < numOfTags; ++i) {
@@ -5731,14 +5727,30 @@ static int32_t addSubtableNameToCreateStreamQuery(STranslateContext* pCxt, SCrea
return pCxt->errCode;
}
+static int32_t addNullTagsForCreateTable(STranslateContext* pCxt, SCreateStreamStmt* pStmt) {
+ int32_t code = TSDB_CODE_SUCCESS;
+ for (int32_t i = 0; TSDB_CODE_SUCCESS == code && i < LIST_LENGTH(pStmt->pTags); ++i) {
+ code = nodesListMakeStrictAppend(&((SSelectStmt*)pStmt->pQuery)->pTags, createNullValue());
+ }
+ return code;
+}
+
+static int32_t addNullTagsToCreateStreamQuery(STranslateContext* pCxt, STableMeta* pMeta, SCreateStreamStmt* pStmt) {
+ if (NULL == pMeta) {
+ return addNullTagsForCreateTable(pCxt, pStmt);
+ }
+ return addNullTagsForExistTable(pCxt, pMeta, (SSelectStmt*)pStmt->pQuery);
+}
+
static int32_t addSubtableInfoToCreateStreamQuery(STranslateContext* pCxt, STableMeta* pMeta,
SCreateStreamStmt* pStmt) {
+ int32_t code = TSDB_CODE_SUCCESS;
SSelectStmt* pSelect = (SSelectStmt*)pStmt->pQuery;
if (NULL == pSelect->pPartitionByList) {
- return addNullTagsForExistTable(pCxt, pMeta, pSelect);
+ code = addNullTagsToCreateStreamQuery(pCxt, pMeta, pStmt);
+ } else {
+ code = addTagsToCreateStreamQuery(pCxt, pStmt, pSelect);
}
-
- int32_t code = addTagsToCreateStreamQuery(pCxt, pStmt, pSelect);
if (TSDB_CODE_SUCCESS == code) {
code = addSubtableNameToCreateStreamQuery(pCxt, pStmt, pSelect);
}
@@ -6013,17 +6025,66 @@ static int32_t adjustTagsForExistTable(STranslateContext* pCxt, SCreateStreamStm
return adjustOrderOfTags(pCxt, pStmt->pTags, pMeta, &pSelect->pTags, pReq);
}
+static int32_t adjustTagsForCreateTable(STranslateContext* pCxt, SCreateStreamStmt* pStmt, SCMCreateStreamReq* pReq) {
+ SSelectStmt* pSelect = (SSelectStmt*)pStmt->pQuery;
+ if (NULL == pSelect->pPartitionByList || NULL == pSelect->pTags) {
+ return TSDB_CODE_SUCCESS;
+ }
+
+ SNode* pTagDef = NULL;
+ SNode* pTagExpr = NULL;
+ FORBOTH(pTagDef, pStmt->pTags, pTagExpr, pSelect->pTags) {
+ SColumnDefNode* pDef = (SColumnDefNode*)pTagDef;
+ if (!dataTypeEqual(&pDef->dataType, &((SExprNode*)pTagExpr)->resType)) {
+ SNode* pFunc = NULL;
+ int32_t code = createCastFunc(pCxt, pTagExpr, pDef->dataType, &pFunc);
+ if (TSDB_CODE_SUCCESS != code) {
+ return code;
+ }
+ REPLACE_LIST2_NODE(pFunc);
+ }
+ }
+
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t adjustTags(STranslateContext* pCxt, SCreateStreamStmt* pStmt, const STableMeta* pMeta,
+ SCMCreateStreamReq* pReq) {
+ if (NULL == pMeta) {
+ return adjustTagsForCreateTable(pCxt, pStmt, pReq);
+ }
+ return adjustTagsForExistTable(pCxt, pStmt, pMeta, pReq);
+}
+
+static bool isTagDef(SNodeList* pTags) {
+ if (NULL == pTags) {
+ return false;
+ }
+ return QUERY_NODE_COLUMN_DEF == nodeType(nodesListGetNode(pTags, 0));
+}
+
+static bool isTagBound(SNodeList* pTags) {
+ if (NULL == pTags) {
+ return false;
+ }
+ return QUERY_NODE_COLUMN == nodeType(nodesListGetNode(pTags, 0));
+}
+
static int32_t translateStreamTargetTable(STranslateContext* pCxt, SCreateStreamStmt* pStmt, SCMCreateStreamReq* pReq,
STableMeta** pMeta) {
int32_t code = getTableMeta(pCxt, pStmt->targetDbName, pStmt->targetTabName, pMeta);
if (TSDB_CODE_PAR_TABLE_NOT_EXIST == code) {
- if (NULL != pStmt->pCols) {
+ if (NULL != pStmt->pCols || isTagBound(pStmt->pTags)) {
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_TABLE_NOT_EXIST, pStmt->targetTabName);
}
pReq->createStb = STREAM_CREATE_STABLE_TRUE;
pReq->targetStbUid = 0;
return TSDB_CODE_SUCCESS;
} else {
+ if (isTagDef(pStmt->pTags)) {
+ return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, "Table already exist: %s",
+ pStmt->targetTabName);
+ }
pReq->createStb = STREAM_CREATE_STABLE_FALSE;
pReq->targetStbUid = (*pMeta)->suid;
}
@@ -6049,8 +6110,8 @@ static int32_t buildCreateStreamQuery(STranslateContext* pCxt, SCreateStreamStmt
if (TSDB_CODE_SUCCESS == code && NULL != pMeta) {
code = adjustProjectionsForExistTable(pCxt, pStmt, pMeta, pReq);
}
- if (TSDB_CODE_SUCCESS == code && NULL != pMeta) {
- code = adjustTagsForExistTable(pCxt, pStmt, pMeta, pReq);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = adjustTags(pCxt, pStmt, pMeta, pReq);
}
if (TSDB_CODE_SUCCESS == code) {
getSourceDatabase(pStmt->pQuery, pCxt->pParseCxt->acctId, pReq->sourceDB);
diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c
index 03cd8093f9..6086858043 100644
--- a/source/libs/parser/src/sql.c
+++ b/source/libs/parser/src/sql.c
@@ -104,26 +104,26 @@
#endif
/************* Begin control #defines *****************************************/
#define YYCODETYPE unsigned short int
-#define YYNOCODE 466
+#define YYNOCODE 467
#define YYACTIONTYPE unsigned short int
#define ParseTOKENTYPE SToken
typedef union {
int yyinit;
ParseTOKENTYPE yy0;
- int8_t yy27;
- ENullOrder yy89;
- int64_t yy129;
- SToken yy233;
- SAlterOption yy257;
- bool yy397;
- EJoinType yy428;
- EFillMode yy646;
- SNodeList* yy776;
+ EFillMode yy22;
+ ENullOrder yy23;
+ SNode* yy44;
+ int64_t yy91;
+ SAlterOption yy153;
+ bool yy163;
+ int8_t yy169;
+ SDataType yy260;
+ SToken yy455;
+ EOrder yy490;
+ SNodeList* yy684;
+ EOperatorType yy704;
+ EJoinType yy724;
int32_t yy832;
- SDataType yy852;
- EOperatorType yy856;
- EOrder yy870;
- SNode* yy924;
} YYMINORTYPE;
#ifndef YYSTACKDEPTH
#define YYSTACKDEPTH 100
@@ -140,16 +140,16 @@ typedef union {
#define ParseCTX_STORE
#define YYFALLBACK 1
#define YYNSTATE 734
-#define YYNRULE 556
+#define YYNRULE 558
#define YYNTOKEN 326
#define YY_MAX_SHIFT 733
-#define YY_MIN_SHIFTREDUCE 1087
-#define YY_MAX_SHIFTREDUCE 1642
-#define YY_ERROR_ACTION 1643
-#define YY_ACCEPT_ACTION 1644
-#define YY_NO_ACTION 1645
-#define YY_MIN_REDUCE 1646
-#define YY_MAX_REDUCE 2201
+#define YY_MIN_SHIFTREDUCE 1089
+#define YY_MAX_SHIFTREDUCE 1646
+#define YY_ERROR_ACTION 1647
+#define YY_ACCEPT_ACTION 1648
+#define YY_NO_ACTION 1649
+#define YY_MIN_REDUCE 1650
+#define YY_MAX_REDUCE 2207
/************* End control #defines *******************************************/
#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
@@ -216,793 +216,819 @@ typedef union {
** yy_default[] Default action for each state.
**
*********** Begin parsing tables **********************************************/
-#define YY_ACTTAB_COUNT (2952)
+#define YY_ACTTAB_COUNT (3082)
static const YYACTIONTYPE yy_action[] = {
- /* 0 */ 1918, 2177, 366, 623, 1788, 2172, 474, 2001, 475, 1682,
- /* 10 */ 163, 557, 45, 43, 1572, 1916, 610, 54, 1997, 1801,
- /* 20 */ 374, 2176, 1421, 38, 37, 2173, 2175, 44, 42, 41,
- /* 30 */ 40, 39, 419, 1502, 1799, 1419, 1715, 44, 42, 41,
- /* 40 */ 40, 39, 38, 37, 2001, 175, 44, 42, 41, 40,
- /* 50 */ 39, 1993, 1999, 356, 219, 1997, 377, 377, 1497, 163,
- /* 60 */ 348, 2015, 633, 18, 160, 163, 344, 1901, 1802, 170,
- /* 70 */ 1427, 354, 327, 1801, 1801, 509, 505, 501, 497, 216,
- /* 80 */ 1850, 598, 379, 45, 43, 1845, 1847, 1448, 1993, 1999,
- /* 90 */ 369, 374, 2033, 1421, 1446, 14, 2177, 337, 104, 633,
- /* 100 */ 601, 528, 527, 526, 1502, 1983, 1419, 639, 101, 136,
- /* 110 */ 522, 1609, 139, 1448, 521, 86, 480, 730, 214, 520,
- /* 120 */ 525, 349, 476, 347, 346, 519, 515, 60, 1446, 1497,
- /* 130 */ 517, 1120, 1504, 1505, 18, 2014, 623, 105, 1531, 2050,
- /* 140 */ 177, 1427, 108, 2016, 643, 2018, 2019, 638, 1852, 633,
- /* 150 */ 131, 140, 516, 1839, 178, 353, 2103, 513, 1421, 1791,
- /* 160 */ 368, 2099, 1477, 1487, 1850, 1430, 14, 1799, 1503, 1506,
- /* 170 */ 1122, 1419, 1125, 1126, 183, 600, 179, 2111, 2112, 85,
- /* 180 */ 137, 2116, 2129, 1422, 234, 1420, 213, 207, 730, 1632,
- /* 190 */ 64, 212, 38, 37, 488, 1532, 44, 42, 41, 40,
- /* 200 */ 39, 1447, 1795, 1504, 1505, 165, 1427, 1658, 1425, 1426,
- /* 210 */ 205, 1476, 1479, 1480, 1481, 1482, 1483, 1484, 1485, 1486,
- /* 220 */ 635, 631, 1495, 1496, 1498, 1499, 1500, 1501, 2, 60,
- /* 230 */ 1139, 266, 1138, 1477, 1487, 492, 1344, 1345, 121, 1503,
- /* 240 */ 1506, 120, 119, 118, 117, 116, 115, 114, 113, 112,
- /* 250 */ 1398, 1399, 2033, 730, 1422, 622, 1420, 266, 38, 37,
- /* 260 */ 580, 1140, 44, 42, 41, 40, 39, 34, 372, 1526,
- /* 270 */ 1527, 1528, 1529, 1530, 1534, 1535, 1536, 1537, 184, 1425,
- /* 280 */ 1426, 60, 1476, 1479, 1480, 1481, 1482, 1483, 1484, 1485,
- /* 290 */ 1486, 635, 631, 1495, 1496, 1498, 1499, 1500, 1501, 2,
- /* 300 */ 175, 11, 45, 43, 579, 483, 598, 475, 1682, 457,
- /* 310 */ 374, 420, 1421, 1361, 1362, 1433, 412, 622, 411, 1422,
- /* 320 */ 49, 1420, 1902, 1502, 421, 1419, 1246, 665, 664, 663,
- /* 330 */ 1250, 662, 1252, 1253, 661, 1255, 658, 139, 1261, 655,
- /* 340 */ 1263, 1264, 652, 649, 1425, 1426, 1588, 608, 1497, 1360,
- /* 350 */ 1363, 31, 267, 18, 41, 40, 39, 38, 37, 1639,
- /* 360 */ 1427, 44, 42, 41, 40, 39, 598, 197, 196, 528,
- /* 370 */ 527, 526, 2118, 45, 43, 1507, 1882, 136, 522, 593,
- /* 380 */ 184, 374, 521, 1421, 1599, 14, 1646, 520, 525, 60,
- /* 390 */ 456, 91, 48, 519, 1502, 622, 1419, 139, 2115, 408,
- /* 400 */ 1533, 264, 2111, 597, 1669, 132, 596, 730, 1447, 2172,
- /* 410 */ 130, 129, 128, 127, 126, 125, 124, 123, 122, 1497,
- /* 420 */ 410, 406, 1504, 1505, 585, 181, 1918, 35, 285, 2173,
- /* 430 */ 587, 1427, 184, 573, 1597, 1598, 1600, 1601, 365, 38,
- /* 440 */ 37, 1915, 610, 44, 42, 41, 40, 39, 1983, 581,
- /* 450 */ 166, 1449, 1477, 1487, 1638, 1753, 46, 52, 1503, 1506,
- /* 460 */ 1647, 180, 2111, 2112, 561, 137, 2116, 1852, 233, 1445,
- /* 470 */ 48, 184, 32, 1422, 341, 1420, 473, 1777, 730, 478,
- /* 480 */ 1688, 121, 1538, 1850, 120, 119, 118, 117, 116, 115,
- /* 490 */ 114, 113, 112, 1504, 1505, 276, 277, 413, 1425, 1426,
- /* 500 */ 275, 1476, 1479, 1480, 1481, 1482, 1483, 1484, 1485, 1486,
- /* 510 */ 635, 631, 1495, 1496, 1498, 1499, 1500, 1501, 2, 733,
- /* 520 */ 1289, 1290, 482, 1477, 1487, 478, 1688, 437, 623, 1503,
- /* 530 */ 1506, 88, 332, 292, 1446, 546, 436, 544, 542, 492,
- /* 540 */ 184, 562, 186, 586, 1422, 2172, 1420, 2172, 174, 1776,
- /* 550 */ 677, 540, 609, 538, 723, 719, 715, 711, 290, 1799,
- /* 560 */ 2178, 181, 585, 181, 551, 2173, 587, 2173, 587, 1425,
- /* 570 */ 1426, 604, 1476, 1479, 1480, 1481, 1482, 1483, 1484, 1485,
- /* 580 */ 1486, 635, 631, 1495, 1496, 1498, 1499, 1500, 1501, 2,
- /* 590 */ 45, 43, 2118, 533, 106, 244, 1954, 283, 374, 490,
- /* 600 */ 1421, 1911, 1644, 609, 594, 675, 576, 1852, 543, 60,
- /* 610 */ 1775, 1502, 2118, 1419, 362, 562, 1846, 1847, 2114, 2172,
- /* 620 */ 2015, 184, 232, 1850, 153, 152, 672, 671, 670, 150,
- /* 630 */ 619, 11, 623, 9, 2178, 181, 1497, 536, 2113, 2173,
- /* 640 */ 587, 235, 530, 1139, 1668, 1138, 131, 231, 1427, 1667,
- /* 650 */ 607, 2033, 1911, 518, 13, 12, 675, 11, 218, 640,
- /* 660 */ 193, 45, 43, 1799, 1983, 270, 639, 1446, 389, 374,
- /* 670 */ 269, 1421, 677, 46, 1140, 153, 152, 672, 671, 670,
- /* 680 */ 150, 1427, 1502, 68, 1419, 1206, 67, 1387, 1983, 238,
- /* 690 */ 582, 577, 571, 1983, 2014, 730, 82, 141, 2050, 81,
- /* 700 */ 2074, 167, 2016, 643, 2018, 2019, 638, 1497, 633, 586,
- /* 710 */ 1504, 1505, 562, 2172, 524, 523, 2172, 38, 37, 1427,
- /* 720 */ 1208, 44, 42, 41, 40, 39, 609, 299, 585, 181,
- /* 730 */ 1829, 2178, 181, 2173, 587, 1689, 2173, 587, 701, 699,
- /* 740 */ 1477, 1487, 563, 2140, 14, 33, 1503, 1506, 623, 1545,
- /* 750 */ 668, 38, 37, 27, 598, 44, 42, 41, 40, 39,
- /* 760 */ 184, 1422, 417, 1420, 38, 37, 730, 1852, 44, 42,
- /* 770 */ 41, 40, 39, 618, 367, 1911, 1666, 689, 625, 1799,
- /* 780 */ 2075, 1504, 1505, 1850, 725, 139, 1425, 1426, 1774, 1476,
- /* 790 */ 1479, 1480, 1481, 1482, 1483, 1484, 1485, 1486, 635, 631,
- /* 800 */ 1495, 1496, 1498, 1499, 1500, 1501, 2, 85, 627, 1478,
- /* 810 */ 2075, 1477, 1487, 330, 1784, 1444, 1897, 1503, 1506, 1852,
- /* 820 */ 1983, 135, 450, 380, 623, 464, 378, 189, 463, 2176,
- /* 830 */ 1794, 163, 1422, 1786, 1420, 1850, 387, 99, 418, 669,
- /* 840 */ 1801, 1790, 1843, 433, 50, 465, 3, 1665, 435, 182,
- /* 850 */ 2111, 2112, 1997, 137, 2116, 1799, 1782, 1425, 1426, 1792,
- /* 860 */ 1476, 1479, 1480, 1481, 1482, 1483, 1484, 1485, 1486, 635,
- /* 870 */ 631, 1495, 1496, 1498, 1499, 1500, 1501, 2, 623, 623,
- /* 880 */ 562, 1576, 1569, 164, 2172, 1993, 1999, 1446, 305, 345,
- /* 890 */ 1712, 1983, 427, 442, 667, 675, 633, 623, 623, 2178,
- /* 900 */ 181, 423, 303, 71, 2173, 587, 70, 1852, 8, 1799,
- /* 910 */ 1799, 443, 491, 1449, 153, 152, 672, 671, 670, 150,
- /* 920 */ 162, 1897, 1897, 1851, 201, 470, 468, 673, 1799, 1799,
- /* 930 */ 1843, 461, 191, 195, 455, 454, 453, 452, 449, 448,
+ /* 0 */ 474, 1673, 475, 1686, 1886, 586, 1792, 604, 2007, 2178,
+ /* 10 */ 1788, 1856, 45, 43, 1576, 480, 1922, 175, 342, 2003,
+ /* 20 */ 374, 476, 1425, 1794, 585, 181, 419, 1854, 365, 2179,
+ /* 30 */ 587, 1919, 610, 1506, 2003, 1423, 2021, 2183, 344, 1905,
+ /* 40 */ 2007, 2178, 38, 37, 1922, 1989, 44, 42, 41, 40,
+ /* 50 */ 39, 2003, 562, 1999, 2005, 356, 2178, 2182, 1501, 1920,
+ /* 60 */ 610, 2179, 2181, 18, 633, 177, 327, 2039, 1999, 2005,
+ /* 70 */ 1431, 2184, 181, 366, 598, 637, 2179, 587, 1843, 633,
+ /* 80 */ 1989, 163, 639, 45, 43, 1999, 2005, 369, 586, 1959,
+ /* 90 */ 1805, 374, 2178, 1425, 163, 14, 633, 337, 44, 42,
+ /* 100 */ 41, 40, 39, 1806, 1506, 139, 1423, 585, 181, 35,
+ /* 110 */ 285, 2020, 2179, 587, 165, 2056, 1662, 730, 321, 2022,
+ /* 120 */ 643, 2024, 2025, 638, 636, 633, 624, 2074, 267, 1501,
+ /* 130 */ 1450, 2008, 1508, 1509, 18, 235, 379, 1982, 1535, 1849,
+ /* 140 */ 1851, 1431, 2003, 590, 1248, 665, 664, 663, 1252, 662,
+ /* 150 */ 1254, 1255, 661, 1257, 658, 437, 1263, 655, 1265, 1266,
+ /* 160 */ 652, 649, 1481, 1491, 436, 60, 14, 91, 1507, 1510,
+ /* 170 */ 264, 2117, 597, 1781, 132, 596, 1999, 2005, 2178, 41,
+ /* 180 */ 40, 39, 562, 1426, 1856, 1424, 2178, 633, 730, 348,
+ /* 190 */ 1122, 353, 1451, 585, 181, 1536, 1850, 1851, 2179, 587,
+ /* 200 */ 1854, 2184, 181, 1508, 1509, 166, 2179, 587, 1429, 1430,
+ /* 210 */ 1757, 1480, 1483, 1484, 1485, 1486, 1487, 1488, 1489, 1490,
+ /* 220 */ 635, 631, 1499, 1500, 1502, 1503, 1504, 1505, 2, 1124,
+ /* 230 */ 1975, 1127, 1128, 1481, 1491, 492, 622, 85, 121, 1507,
+ /* 240 */ 1510, 120, 119, 118, 117, 116, 115, 114, 113, 112,
+ /* 250 */ 349, 135, 347, 346, 1426, 515, 1424, 38, 37, 517,
+ /* 260 */ 1798, 44, 42, 41, 40, 39, 593, 34, 372, 1530,
+ /* 270 */ 1531, 1532, 1533, 1534, 1538, 1539, 1540, 1541, 394, 1429,
+ /* 280 */ 1430, 516, 1480, 1483, 1484, 1485, 1486, 1487, 1488, 1489,
+ /* 290 */ 1490, 635, 631, 1499, 1500, 1502, 1503, 1504, 1505, 2,
+ /* 300 */ 377, 11, 45, 43, 1291, 1292, 622, 219, 160, 622,
+ /* 310 */ 374, 48, 1425, 1651, 609, 354, 184, 1805, 1672, 1141,
+ /* 320 */ 598, 1140, 170, 1506, 1854, 1423, 2021, 1603, 509, 505,
+ /* 330 */ 501, 497, 216, 623, 121, 233, 60, 120, 119, 118,
+ /* 340 */ 117, 116, 115, 114, 113, 112, 1450, 131, 1501, 1580,
+ /* 350 */ 1142, 139, 1573, 18, 513, 1450, 483, 2039, 475, 1686,
+ /* 360 */ 1431, 490, 1989, 1915, 1803, 640, 591, 675, 86, 2124,
+ /* 370 */ 1989, 214, 639, 45, 43, 1511, 573, 1601, 1602, 1604,
+ /* 380 */ 1605, 374, 1671, 1425, 48, 14, 153, 152, 672, 671,
+ /* 390 */ 670, 150, 105, 1779, 1506, 2121, 1423, 2021, 88, 332,
+ /* 400 */ 608, 2020, 546, 2124, 544, 2056, 140, 730, 167, 2022,
+ /* 410 */ 643, 2024, 2025, 638, 1795, 633, 180, 2117, 2118, 1501,
+ /* 420 */ 137, 2122, 1508, 1509, 1643, 1450, 1989, 1452, 2039, 2120,
+ /* 430 */ 64, 1431, 175, 1141, 473, 1140, 640, 478, 1692, 213,
+ /* 440 */ 207, 1989, 482, 639, 212, 478, 1692, 488, 218, 563,
+ /* 450 */ 2146, 1670, 1481, 1491, 1906, 677, 46, 1208, 1507, 1510,
+ /* 460 */ 492, 38, 37, 205, 1142, 44, 42, 41, 40, 39,
+ /* 470 */ 581, 49, 2020, 1426, 1719, 1424, 2056, 677, 730, 168,
+ /* 480 */ 2022, 643, 2024, 2025, 638, 8, 633, 184, 1346, 1347,
+ /* 490 */ 1648, 594, 1210, 1508, 1509, 1989, 598, 1482, 1429, 1430,
+ /* 500 */ 60, 1480, 1483, 1484, 1485, 1486, 1487, 1488, 1489, 1490,
+ /* 510 */ 635, 631, 1499, 1500, 1502, 1503, 1504, 1505, 2, 1642,
+ /* 520 */ 623, 60, 1901, 1481, 1491, 524, 523, 139, 623, 1507,
+ /* 530 */ 1510, 588, 2199, 189, 186, 184, 623, 1451, 1449, 528,
+ /* 540 */ 527, 526, 54, 406, 1426, 1537, 1424, 136, 522, 1613,
+ /* 550 */ 417, 1803, 521, 2039, 1983, 60, 387, 520, 525, 1803,
+ /* 560 */ 386, 580, 551, 519, 408, 404, 11, 1803, 9, 1429,
+ /* 570 */ 1430, 266, 1480, 1483, 1484, 1485, 1486, 1487, 1488, 1489,
+ /* 580 */ 1490, 635, 631, 1499, 1500, 1502, 1503, 1504, 1505, 2,
+ /* 590 */ 45, 43, 182, 2117, 2118, 1572, 137, 2122, 374, 562,
+ /* 600 */ 1425, 562, 733, 2178, 2124, 2178, 579, 457, 2183, 13,
+ /* 610 */ 12, 1506, 2178, 1423, 2021, 623, 292, 32, 2184, 181,
+ /* 620 */ 2184, 181, 184, 2179, 587, 2179, 587, 1542, 2182, 418,
+ /* 630 */ 2119, 174, 2179, 2180, 609, 1450, 1501, 723, 719, 715,
+ /* 640 */ 711, 290, 411, 623, 410, 2039, 1803, 1856, 1431, 1363,
+ /* 650 */ 1364, 184, 1856, 640, 362, 701, 699, 427, 1989, 367,
+ /* 660 */ 639, 45, 43, 1854, 85, 197, 196, 409, 1854, 374,
+ /* 670 */ 1453, 1425, 184, 46, 1803, 2183, 141, 106, 598, 2080,
+ /* 680 */ 283, 607, 1506, 1915, 1423, 1362, 1365, 1799, 456, 2020,
+ /* 690 */ 413, 1569, 1452, 2056, 412, 730, 167, 2022, 643, 2024,
+ /* 700 */ 2025, 638, 1650, 633, 1549, 1453, 184, 1501, 1516, 139,
+ /* 710 */ 1508, 1509, 420, 619, 1450, 609, 38, 37, 234, 1431,
+ /* 720 */ 44, 42, 41, 40, 39, 421, 130, 129, 128, 127,
+ /* 730 */ 126, 125, 124, 123, 122, 562, 623, 11, 2147, 2178,
+ /* 740 */ 1481, 1491, 1856, 690, 14, 1773, 1507, 1510, 270, 378,
+ /* 750 */ 131, 668, 27, 269, 2184, 181, 576, 518, 1854, 2179,
+ /* 760 */ 587, 1426, 618, 1424, 1915, 1669, 730, 1803, 1636, 625,
+ /* 770 */ 1390, 2081, 238, 600, 179, 2117, 2118, 1482, 137, 2122,
+ /* 780 */ 1668, 1508, 1509, 1431, 1401, 1402, 1429, 1430, 99, 1480,
+ /* 790 */ 1483, 1484, 1485, 1486, 1487, 1488, 1489, 1490, 635, 631,
+ /* 800 */ 1499, 1500, 1502, 1503, 1504, 1505, 2, 623, 689, 1989,
+ /* 810 */ 1796, 1481, 1491, 330, 190, 1448, 623, 1507, 1510, 623,
+ /* 820 */ 1901, 442, 450, 224, 1989, 464, 222, 377, 463, 380,
+ /* 830 */ 443, 191, 1426, 491, 1424, 163, 266, 163, 1803, 542,
+ /* 840 */ 582, 577, 571, 433, 1805, 465, 1805, 1803, 435, 243,
+ /* 850 */ 1803, 1667, 540, 1666, 538, 2182, 1482, 1429, 1430, 1790,
+ /* 860 */ 1480, 1483, 1484, 1485, 1486, 1487, 1488, 1489, 1490, 635,
+ /* 870 */ 631, 1499, 1500, 1502, 1503, 1504, 1505, 2, 1665, 1664,
+ /* 880 */ 623, 276, 277, 164, 1661, 627, 275, 2081, 305, 345,
+ /* 890 */ 1716, 528, 527, 526, 1800, 1989, 1786, 1989, 623, 136,
+ /* 900 */ 522, 423, 303, 71, 521, 1901, 70, 1127, 1128, 520,
+ /* 910 */ 525, 1803, 236, 38, 37, 519, 195, 44, 42, 41,
+ /* 920 */ 40, 39, 1989, 1989, 201, 470, 468, 669, 1989, 1803,
+ /* 930 */ 1847, 461, 2129, 1569, 455, 454, 453, 452, 449, 448,
/* 940 */ 447, 446, 445, 441, 440, 439, 438, 329, 430, 429,
- /* 950 */ 428, 1664, 425, 424, 343, 707, 706, 705, 704, 384,
+ /* 950 */ 428, 1660, 425, 424, 343, 707, 706, 705, 704, 384,
/* 960 */ 60, 703, 702, 143, 697, 696, 695, 694, 693, 692,
/* 970 */ 691, 155, 687, 686, 685, 383, 382, 682, 681, 680,
- /* 980 */ 679, 678, 674, 386, 690, 1843, 1769, 590, 1663, 623,
- /* 990 */ 1512, 549, 371, 370, 2177, 1983, 1446, 623, 2172, 107,
- /* 1000 */ 38, 37, 1435, 1796, 44, 42, 41, 40, 39, 1125,
- /* 1010 */ 1126, 236, 623, 1502, 2176, 1428, 1641, 1642, 2173, 2174,
- /* 1020 */ 1799, 1662, 623, 1449, 2123, 1565, 558, 562, 1799, 1478,
- /* 1030 */ 623, 2172, 1983, 1661, 1660, 562, 602, 151, 1497, 2172,
- /* 1040 */ 79, 78, 416, 1799, 606, 188, 2178, 181, 623, 2015,
- /* 1050 */ 1427, 2173, 587, 1799, 2178, 181, 1970, 190, 1657, 2173,
- /* 1060 */ 587, 1799, 280, 328, 2002, 1983, 404, 623, 402, 398,
- /* 1070 */ 394, 391, 388, 239, 72, 1997, 2015, 1983, 1983, 1799,
- /* 1080 */ 2033, 620, 623, 1702, 1656, 623, 623, 151, 640, 53,
- /* 1090 */ 1659, 589, 1655, 1983, 630, 639, 621, 629, 1799, 286,
- /* 1100 */ 381, 1654, 1983, 1653, 396, 529, 1429, 2033, 1993, 1999,
- /* 1110 */ 1754, 184, 1652, 1799, 1565, 601, 1799, 1799, 224, 633,
- /* 1120 */ 1983, 222, 639, 2014, 80, 1568, 1651, 2050, 1983, 1650,
- /* 1130 */ 108, 2016, 643, 2018, 2019, 638, 1983, 633, 1478, 1393,
- /* 1140 */ 142, 2015, 148, 2074, 2103, 1983, 517, 1983, 368, 2099,
- /* 1150 */ 2014, 1649, 226, 634, 2050, 225, 1983, 108, 2016, 643,
- /* 1160 */ 2018, 2019, 638, 1436, 633, 1431, 151, 243, 516, 178,
- /* 1170 */ 1983, 2103, 2033, 1983, 1695, 368, 2099, 145, 228, 133,
- /* 1180 */ 640, 227, 242, 62, 2143, 1983, 1693, 639, 1439, 1441,
- /* 1190 */ 248, 230, 151, 1168, 229, 1983, 531, 2130, 2004, 2015,
- /* 1200 */ 47, 631, 1495, 1496, 1498, 1499, 1500, 1501, 534, 273,
- /* 1210 */ 591, 683, 69, 149, 151, 2014, 13, 12, 1396, 2050,
- /* 1220 */ 62, 89, 108, 2016, 643, 2018, 2019, 638, 1169, 633,
- /* 1230 */ 2033, 261, 2015, 1187, 2192, 1596, 2103, 47, 640, 1523,
- /* 1240 */ 368, 2099, 250, 1983, 605, 639, 2006, 684, 47, 647,
- /* 1250 */ 149, 2137, 1358, 151, 217, 134, 1432, 574, 255, 2034,
- /* 1260 */ 149, 278, 385, 2033, 615, 282, 1239, 1683, 1906, 1185,
- /* 1270 */ 1840, 640, 1539, 2014, 2133, 599, 1983, 2050, 639, 260,
- /* 1280 */ 108, 2016, 643, 2018, 2019, 638, 263, 633, 1, 1488,
- /* 1290 */ 2015, 390, 2192, 4, 2103, 395, 342, 1380, 368, 2099,
- /* 1300 */ 298, 1267, 1271, 293, 194, 1278, 2014, 1276, 422, 2150,
- /* 1310 */ 2050, 1449, 154, 108, 2016, 643, 2018, 2019, 638, 1907,
- /* 1320 */ 633, 2033, 426, 459, 431, 2192, 1444, 2103, 444, 640,
- /* 1330 */ 451, 368, 2099, 1899, 1983, 458, 639, 460, 466, 467,
- /* 1340 */ 1450, 198, 569, 469, 471, 472, 481, 1452, 204, 484,
- /* 1350 */ 1447, 206, 485, 1451, 486, 1453, 487, 1142, 489, 512,
- /* 1360 */ 209, 211, 493, 1960, 2014, 83, 84, 215, 2050, 510,
- /* 1370 */ 2015, 108, 2016, 643, 2018, 2019, 638, 511, 633, 331,
- /* 1380 */ 548, 514, 1959, 2192, 111, 2103, 1789, 221, 550, 368,
- /* 1390 */ 2099, 87, 1785, 2015, 223, 156, 157, 147, 1787, 294,
- /* 1400 */ 2166, 2033, 1783, 237, 158, 552, 159, 553, 556, 640,
- /* 1410 */ 240, 559, 2149, 2134, 1983, 575, 639, 2148, 613, 7,
- /* 1420 */ 584, 2125, 566, 2144, 2033, 572, 254, 171, 357, 256,
- /* 1430 */ 578, 567, 640, 257, 565, 358, 564, 1983, 246, 639,
- /* 1440 */ 2195, 258, 249, 595, 2014, 592, 2171, 1565, 2050, 138,
- /* 1450 */ 1448, 108, 2016, 643, 2018, 2019, 638, 262, 633, 361,
- /* 1460 */ 2015, 268, 603, 2192, 259, 2103, 1454, 2014, 94, 368,
- /* 1470 */ 2099, 2050, 2119, 1912, 108, 2016, 643, 2018, 2019, 638,
- /* 1480 */ 2122, 633, 295, 611, 2015, 612, 2078, 1926, 2103, 296,
- /* 1490 */ 1925, 2033, 368, 2099, 616, 96, 1924, 297, 617, 640,
- /* 1500 */ 1800, 364, 98, 59, 1983, 2084, 639, 100, 645, 1844,
- /* 1510 */ 1770, 729, 726, 289, 300, 2033, 727, 324, 333, 334,
- /* 1520 */ 309, 51, 304, 640, 302, 1977, 1976, 323, 1983, 76,
- /* 1530 */ 639, 1975, 2015, 77, 2014, 313, 1974, 1971, 2050, 392,
- /* 1540 */ 393, 108, 2016, 643, 2018, 2019, 638, 1413, 633, 1414,
- /* 1550 */ 187, 397, 1969, 2076, 399, 2103, 2015, 400, 2014, 368,
- /* 1560 */ 2099, 401, 2050, 2033, 1968, 108, 2016, 643, 2018, 2019,
- /* 1570 */ 638, 640, 633, 403, 1967, 405, 1983, 626, 639, 2103,
- /* 1580 */ 1966, 407, 1965, 368, 2099, 409, 1383, 2033, 1382, 1937,
- /* 1590 */ 1936, 1935, 414, 415, 1934, 640, 1335, 1890, 1889, 1887,
- /* 1600 */ 1983, 1886, 639, 144, 1885, 1888, 2014, 1884, 1883, 1881,
- /* 1610 */ 2050, 1880, 1879, 109, 2016, 643, 2018, 2019, 638, 192,
- /* 1620 */ 633, 432, 2015, 1878, 434, 1892, 1877, 2103, 1876, 1875,
- /* 1630 */ 2014, 2102, 2099, 1874, 2050, 1873, 1872, 109, 2016, 643,
- /* 1640 */ 2018, 2019, 638, 1871, 633, 2015, 1870, 1869, 1868, 1867,
- /* 1650 */ 1866, 2103, 1865, 2033, 1864, 628, 2099, 1863, 146, 1862,
- /* 1660 */ 1861, 640, 1860, 1891, 1859, 1858, 1983, 1337, 639, 1857,
- /* 1670 */ 1856, 1855, 1854, 462, 1853, 1214, 2033, 1717, 199, 1716,
- /* 1680 */ 200, 1714, 1678, 202, 637, 2003, 176, 1128, 1677, 1983,
- /* 1690 */ 74, 639, 1127, 203, 1950, 1944, 641, 75, 1933, 1932,
- /* 1700 */ 2050, 210, 477, 109, 2016, 643, 2018, 2019, 638, 1910,
- /* 1710 */ 633, 1778, 1713, 2015, 479, 208, 1711, 2103, 494, 2014,
- /* 1720 */ 1709, 336, 2099, 2050, 496, 1161, 321, 2016, 643, 2018,
- /* 1730 */ 2019, 638, 636, 633, 624, 2068, 498, 495, 499, 2015,
- /* 1740 */ 1707, 500, 502, 504, 2033, 503, 1705, 508, 506, 1692,
- /* 1750 */ 1691, 507, 640, 1674, 1780, 1282, 1283, 1983, 1779, 639,
- /* 1760 */ 1205, 1204, 1203, 1202, 1199, 1198, 698, 700, 220, 1197,
- /* 1770 */ 2033, 1196, 61, 1703, 350, 1696, 1694, 351, 640, 352,
- /* 1780 */ 535, 532, 1673, 1983, 1672, 639, 537, 2014, 1671, 541,
- /* 1790 */ 110, 2050, 1405, 1949, 168, 2016, 643, 2018, 2019, 638,
- /* 1800 */ 539, 633, 1943, 1403, 2015, 545, 1402, 1389, 55, 26,
- /* 1810 */ 65, 554, 1931, 2014, 2177, 16, 161, 2050, 1929, 28,
- /* 1820 */ 109, 2016, 643, 2018, 2019, 638, 570, 633, 1611, 2015,
- /* 1830 */ 19, 568, 245, 169, 2103, 2033, 58, 247, 1595, 2100,
- /* 1840 */ 1587, 241, 252, 640, 555, 30, 588, 2193, 1983, 63,
- /* 1850 */ 639, 355, 253, 2004, 251, 29, 560, 5, 90, 21,
- /* 1860 */ 2033, 1626, 2015, 6, 20, 1631, 1625, 17, 640, 359,
- /* 1870 */ 1632, 1630, 1629, 1983, 360, 639, 1562, 1561, 2014, 265,
- /* 1880 */ 172, 56, 2050, 1930, 57, 167, 2016, 643, 2018, 2019,
- /* 1890 */ 638, 1928, 633, 2033, 1927, 2015, 1909, 93, 92, 271,
- /* 1900 */ 272, 640, 22, 2014, 1593, 274, 1983, 2050, 639, 1908,
- /* 1910 */ 315, 2016, 643, 2018, 2019, 638, 279, 633, 66, 95,
- /* 1920 */ 97, 101, 284, 614, 10, 23, 2033, 2141, 12, 281,
- /* 1930 */ 1437, 363, 173, 2053, 640, 1514, 2014, 1492, 632, 1983,
- /* 1940 */ 2050, 639, 36, 168, 2016, 643, 2018, 2019, 638, 1490,
- /* 1950 */ 633, 1524, 1489, 185, 583, 15, 24, 1469, 1461, 25,
- /* 1960 */ 2015, 644, 1268, 1513, 646, 376, 648, 650, 1265, 2014,
- /* 1970 */ 1260, 642, 651, 2050, 1262, 653, 322, 2016, 643, 2018,
- /* 1980 */ 2019, 638, 654, 633, 1256, 2015, 656, 657, 659, 1254,
- /* 1990 */ 660, 2033, 1259, 1245, 102, 1258, 2194, 103, 1257, 637,
- /* 2000 */ 287, 1277, 1273, 1159, 1983, 666, 639, 73, 676, 1193,
- /* 2010 */ 1192, 1191, 1190, 1189, 1188, 688, 2033, 1186, 1184, 1183,
- /* 2020 */ 1182, 373, 1212, 1180, 640, 288, 1179, 1178, 1177, 1983,
- /* 2030 */ 1176, 639, 1175, 1174, 2014, 1209, 1207, 1171, 2050, 1170,
- /* 2040 */ 1167, 321, 2016, 643, 2018, 2019, 638, 2015, 633, 1166,
- /* 2050 */ 2069, 1165, 1164, 1710, 708, 709, 1708, 710, 712, 2014,
- /* 2060 */ 713, 714, 1706, 2050, 2015, 716, 322, 2016, 643, 2018,
- /* 2070 */ 2019, 638, 717, 633, 718, 1704, 720, 722, 2033, 721,
- /* 2080 */ 1690, 724, 1117, 375, 1670, 291, 640, 728, 1645, 1423,
- /* 2090 */ 301, 1983, 731, 639, 732, 2033, 1645, 1645, 1645, 1645,
- /* 2100 */ 1645, 1645, 1645, 640, 1645, 1645, 1645, 1645, 1983, 1645,
- /* 2110 */ 639, 1645, 1645, 1645, 1645, 1645, 1645, 1645, 1645, 1645,
- /* 2120 */ 1645, 2014, 1645, 1645, 2015, 2050, 1645, 1645, 322, 2016,
- /* 2130 */ 643, 2018, 2019, 638, 1645, 633, 1645, 1645, 547, 1645,
- /* 2140 */ 1645, 1645, 2050, 2015, 1645, 317, 2016, 643, 2018, 2019,
- /* 2150 */ 638, 1645, 633, 1645, 1645, 2033, 1645, 1645, 1645, 1645,
- /* 2160 */ 1645, 1645, 1645, 640, 1645, 1645, 1645, 1645, 1983, 1645,
- /* 2170 */ 639, 1645, 1645, 1645, 2033, 1645, 1645, 1645, 1645, 1645,
- /* 2180 */ 1645, 1645, 640, 1645, 1645, 1645, 1645, 1983, 1645, 639,
- /* 2190 */ 1645, 1645, 1645, 1645, 1645, 1645, 1645, 1645, 2014, 1645,
- /* 2200 */ 1645, 1645, 2050, 2015, 1645, 306, 2016, 643, 2018, 2019,
- /* 2210 */ 638, 1645, 633, 1645, 1645, 1645, 1645, 2014, 1645, 2015,
- /* 2220 */ 1645, 2050, 1645, 1645, 307, 2016, 643, 2018, 2019, 638,
- /* 2230 */ 1645, 633, 1645, 1645, 2033, 1645, 2015, 1645, 1645, 1645,
- /* 2240 */ 1645, 1645, 640, 1645, 1645, 1645, 1645, 1983, 1645, 639,
- /* 2250 */ 2033, 1645, 1645, 1645, 1645, 1645, 1645, 1645, 640, 1645,
- /* 2260 */ 1645, 1645, 1645, 1983, 1645, 639, 1645, 2033, 1645, 1645,
- /* 2270 */ 1645, 1645, 1645, 1645, 1645, 640, 1645, 2014, 1645, 1645,
- /* 2280 */ 1983, 2050, 639, 1645, 308, 2016, 643, 2018, 2019, 638,
- /* 2290 */ 1645, 633, 1645, 2014, 1645, 1645, 1645, 2050, 1645, 2015,
- /* 2300 */ 314, 2016, 643, 2018, 2019, 638, 1645, 633, 1645, 1645,
- /* 2310 */ 2014, 1645, 1645, 1645, 2050, 2015, 1645, 318, 2016, 643,
- /* 2320 */ 2018, 2019, 638, 1645, 633, 1645, 1645, 1645, 1645, 1645,
- /* 2330 */ 2033, 1645, 1645, 1645, 1645, 1645, 1645, 1645, 640, 1645,
- /* 2340 */ 1645, 1645, 1645, 1983, 1645, 639, 2033, 1645, 1645, 1645,
- /* 2350 */ 1645, 1645, 1645, 1645, 640, 1645, 1645, 1645, 1645, 1983,
- /* 2360 */ 1645, 639, 1645, 1645, 1645, 1645, 1645, 1645, 1645, 1645,
- /* 2370 */ 1645, 2015, 1645, 2014, 1645, 1645, 1645, 2050, 1645, 1645,
- /* 2380 */ 310, 2016, 643, 2018, 2019, 638, 1645, 633, 1645, 2014,
- /* 2390 */ 1645, 1645, 1645, 2050, 2015, 1645, 319, 2016, 643, 2018,
- /* 2400 */ 2019, 638, 2033, 633, 1645, 1645, 1645, 1645, 1645, 1645,
- /* 2410 */ 640, 1645, 1645, 1645, 1645, 1983, 1645, 639, 1645, 1645,
- /* 2420 */ 1645, 1645, 1645, 1645, 1645, 2033, 1645, 1645, 1645, 1645,
- /* 2430 */ 1645, 1645, 1645, 640, 1645, 1645, 1645, 1645, 1983, 1645,
- /* 2440 */ 639, 1645, 1645, 1645, 1645, 2014, 1645, 1645, 1645, 2050,
- /* 2450 */ 1645, 1645, 311, 2016, 643, 2018, 2019, 638, 2015, 633,
- /* 2460 */ 1645, 1645, 1645, 1645, 1645, 1645, 1645, 1645, 2014, 1645,
- /* 2470 */ 1645, 1645, 2050, 1645, 1645, 320, 2016, 643, 2018, 2019,
- /* 2480 */ 638, 1645, 633, 1645, 1645, 2015, 1645, 1645, 1645, 2033,
- /* 2490 */ 1645, 1645, 1645, 1645, 1645, 1645, 1645, 640, 1645, 1645,
- /* 2500 */ 1645, 1645, 1983, 1645, 639, 1645, 1645, 1645, 1645, 1645,
- /* 2510 */ 1645, 1645, 1645, 1645, 1645, 1645, 2033, 1645, 1645, 1645,
- /* 2520 */ 1645, 1645, 1645, 1645, 640, 1645, 1645, 1645, 1645, 1983,
- /* 2530 */ 1645, 639, 2014, 2015, 1645, 1645, 2050, 1645, 1645, 312,
- /* 2540 */ 2016, 643, 2018, 2019, 638, 1645, 633, 1645, 1645, 2015,
- /* 2550 */ 1645, 1645, 1645, 1645, 1645, 1645, 1645, 1645, 1645, 2014,
- /* 2560 */ 1645, 1645, 1645, 2050, 2033, 1645, 325, 2016, 643, 2018,
- /* 2570 */ 2019, 638, 640, 633, 1645, 1645, 1645, 1983, 1645, 639,
- /* 2580 */ 2033, 1645, 1645, 1645, 1645, 1645, 1645, 1645, 640, 1645,
- /* 2590 */ 1645, 1645, 1645, 1983, 1645, 639, 1645, 2015, 1645, 1645,
- /* 2600 */ 1645, 1645, 1645, 1645, 1645, 1645, 1645, 2014, 1645, 1645,
- /* 2610 */ 1645, 2050, 1645, 1645, 326, 2016, 643, 2018, 2019, 638,
- /* 2620 */ 1645, 633, 1645, 2014, 1645, 1645, 1645, 2050, 2033, 1645,
- /* 2630 */ 2027, 2016, 643, 2018, 2019, 638, 640, 633, 1645, 1645,
- /* 2640 */ 1645, 1983, 1645, 639, 1645, 2015, 1645, 1645, 1645, 1645,
- /* 2650 */ 1645, 1645, 1645, 1645, 1645, 1645, 1645, 1645, 1645, 1645,
- /* 2660 */ 1645, 1645, 1645, 1645, 1645, 1645, 1645, 1645, 2015, 1645,
- /* 2670 */ 1645, 2014, 1645, 1645, 1645, 2050, 2033, 1645, 2026, 2016,
- /* 2680 */ 643, 2018, 2019, 638, 640, 633, 1645, 1645, 1645, 1983,
- /* 2690 */ 1645, 639, 1645, 1645, 1645, 1645, 1645, 1645, 1645, 2033,
- /* 2700 */ 1645, 2015, 1645, 1645, 1645, 1645, 1645, 640, 1645, 1645,
- /* 2710 */ 1645, 1645, 1983, 1645, 639, 1645, 1645, 1645, 1645, 2014,
- /* 2720 */ 1645, 1645, 1645, 2050, 2015, 1645, 2025, 2016, 643, 2018,
- /* 2730 */ 2019, 638, 2033, 633, 1645, 1645, 1645, 1645, 1645, 1645,
- /* 2740 */ 640, 1645, 2014, 1645, 1645, 1983, 2050, 639, 1645, 338,
- /* 2750 */ 2016, 643, 2018, 2019, 638, 2033, 633, 1645, 1645, 1645,
- /* 2760 */ 1645, 1645, 1645, 640, 1645, 1645, 1645, 1645, 1983, 1645,
- /* 2770 */ 639, 1645, 1645, 1645, 1645, 2014, 1645, 1645, 1645, 2050,
- /* 2780 */ 1645, 1645, 339, 2016, 643, 2018, 2019, 638, 2015, 633,
- /* 2790 */ 1645, 1645, 1645, 1645, 1645, 1645, 1645, 1645, 2014, 1645,
- /* 2800 */ 1645, 1645, 2050, 1645, 1645, 335, 2016, 643, 2018, 2019,
- /* 2810 */ 638, 1645, 633, 1645, 1645, 2015, 1645, 1645, 1645, 2033,
- /* 2820 */ 1645, 1645, 1645, 1645, 1645, 1645, 1645, 640, 1645, 1645,
- /* 2830 */ 1645, 1645, 1983, 1645, 639, 1645, 1645, 1645, 1645, 1645,
- /* 2840 */ 1645, 1645, 1645, 1645, 1645, 1645, 2033, 1645, 1645, 1645,
- /* 2850 */ 1645, 1645, 1645, 1645, 640, 1645, 1645, 1645, 1645, 1983,
- /* 2860 */ 1645, 639, 2014, 2015, 1645, 1645, 2050, 1645, 1645, 340,
- /* 2870 */ 2016, 643, 2018, 2019, 638, 1645, 633, 1645, 1645, 1645,
- /* 2880 */ 1645, 1645, 1645, 1645, 1645, 1645, 1645, 1645, 1645, 641,
- /* 2890 */ 1645, 1645, 1645, 2050, 2033, 1645, 317, 2016, 643, 2018,
- /* 2900 */ 2019, 638, 640, 633, 1645, 1645, 1645, 1983, 1645, 639,
- /* 2910 */ 1645, 1645, 1645, 1645, 1645, 1645, 1645, 1645, 1645, 1645,
- /* 2920 */ 1645, 1645, 1645, 1645, 1645, 1645, 1645, 1645, 1645, 1645,
- /* 2930 */ 1645, 1645, 1645, 1645, 1645, 1645, 1645, 2014, 1645, 1645,
- /* 2940 */ 1645, 2050, 1645, 1645, 316, 2016, 643, 2018, 2019, 638,
- /* 2950 */ 1645, 633,
+ /* 980 */ 679, 678, 38, 37, 623, 533, 44, 42, 41, 40,
+ /* 990 */ 39, 623, 667, 1659, 1453, 1989, 104, 31, 558, 107,
+ /* 1000 */ 543, 1592, 1780, 38, 37, 602, 101, 44, 42, 41,
+ /* 1010 */ 40, 39, 2021, 33, 232, 1803, 549, 1434, 623, 38,
+ /* 1020 */ 37, 623, 1803, 44, 42, 41, 40, 39, 1856, 536,
+ /* 1030 */ 239, 517, 606, 623, 530, 280, 623, 1989, 634, 231,
+ /* 1040 */ 79, 78, 416, 2039, 1855, 188, 1658, 620, 623, 1803,
+ /* 1050 */ 621, 601, 1803, 516, 299, 1706, 1989, 1833, 639, 1657,
+ /* 1060 */ 1656, 562, 286, 328, 1803, 2178, 402, 1803, 400, 396,
+ /* 1070 */ 392, 389, 409, 1778, 623, 68, 2021, 529, 67, 1803,
+ /* 1080 */ 2184, 181, 193, 1655, 557, 2179, 587, 2020, 381, 1425,
+ /* 1090 */ 1989, 2056, 1654, 1433, 108, 2022, 643, 2024, 2025, 638,
+ /* 1100 */ 1653, 633, 1423, 1989, 1989, 1803, 178, 2039, 2109, 675,
+ /* 1110 */ 630, 184, 368, 2105, 72, 640, 226, 589, 82, 225,
+ /* 1120 */ 1989, 81, 639, 51, 1663, 3, 183, 1989, 153, 152,
+ /* 1130 */ 672, 671, 670, 150, 2135, 2021, 1989, 1431, 244, 1758,
+ /* 1140 */ 673, 38, 37, 1847, 1989, 44, 42, 41, 40, 39,
+ /* 1150 */ 674, 2020, 2149, 1847, 151, 2056, 1699, 261, 108, 2022,
+ /* 1160 */ 643, 2024, 2025, 638, 80, 633, 2039, 1437, 142, 574,
+ /* 1170 */ 148, 2080, 2109, 145, 601, 133, 368, 2105, 531, 1989,
+ /* 1180 */ 675, 639, 1645, 1646, 730, 38, 37, 1697, 151, 44,
+ /* 1190 */ 42, 41, 40, 39, 228, 2021, 151, 227, 217, 153,
+ /* 1200 */ 152, 672, 671, 670, 150, 230, 53, 242, 229, 534,
+ /* 1210 */ 2020, 62, 47, 248, 2056, 151, 47, 108, 2022, 643,
+ /* 1220 */ 2024, 2025, 638, 52, 633, 2010, 2039, 1170, 2040, 178,
+ /* 1230 */ 561, 2109, 13, 12, 640, 368, 2105, 1693, 273, 1989,
+ /* 1240 */ 1396, 639, 69, 1436, 255, 385, 89, 149, 1399, 151,
+ /* 1250 */ 1426, 62, 1424, 47, 2021, 1527, 647, 2136, 149, 151,
+ /* 1260 */ 134, 149, 1171, 1600, 1492, 250, 1910, 605, 1360, 1687,
+ /* 1270 */ 2020, 1844, 2139, 2012, 2056, 1429, 1430, 108, 2022, 643,
+ /* 1280 */ 2024, 2025, 638, 599, 633, 2039, 725, 683, 2021, 2198,
+ /* 1290 */ 278, 2109, 684, 640, 615, 368, 2105, 162, 1989, 282,
+ /* 1300 */ 639, 1241, 260, 1543, 263, 298, 2143, 393, 1269, 1189,
+ /* 1310 */ 1273, 1280, 1278, 154, 1187, 1, 4, 388, 341, 2039,
+ /* 1320 */ 1383, 293, 194, 422, 1453, 1911, 426, 640, 431, 2020,
+ /* 1330 */ 1448, 459, 1989, 2056, 639, 444, 108, 2022, 643, 2024,
+ /* 1340 */ 2025, 638, 1903, 633, 451, 458, 460, 466, 2198, 467,
+ /* 1350 */ 2109, 198, 469, 471, 368, 2105, 1454, 472, 481, 1456,
+ /* 1360 */ 484, 204, 1451, 2020, 485, 2156, 206, 2056, 1455, 486,
+ /* 1370 */ 108, 2022, 643, 2024, 2025, 638, 1457, 633, 487, 209,
+ /* 1380 */ 489, 2021, 2198, 211, 2109, 493, 83, 84, 368, 2105,
+ /* 1390 */ 1144, 510, 215, 511, 512, 371, 370, 514, 1793, 569,
+ /* 1400 */ 550, 2021, 111, 1965, 87, 1439, 221, 331, 1964, 552,
+ /* 1410 */ 548, 147, 2039, 575, 1789, 237, 1506, 223, 1432, 294,
+ /* 1420 */ 640, 156, 157, 553, 1791, 1989, 1787, 639, 240, 158,
+ /* 1430 */ 159, 556, 2039, 559, 2155, 613, 7, 2154, 2131, 584,
+ /* 1440 */ 640, 1501, 254, 2140, 565, 1989, 171, 639, 566, 567,
+ /* 1450 */ 572, 357, 578, 1431, 2150, 256, 2020, 257, 2201, 564,
+ /* 1460 */ 2056, 358, 592, 108, 2022, 643, 2024, 2025, 638, 595,
+ /* 1470 */ 633, 246, 249, 258, 1569, 2198, 2020, 2109, 1452, 2177,
+ /* 1480 */ 2056, 368, 2105, 108, 2022, 643, 2024, 2025, 638, 138,
+ /* 1490 */ 633, 259, 2172, 262, 268, 2198, 2125, 2109, 603, 94,
+ /* 1500 */ 629, 368, 2105, 361, 1458, 1916, 295, 611, 612, 1930,
+ /* 1510 */ 1929, 1928, 2128, 296, 364, 616, 96, 617, 297, 1804,
+ /* 1520 */ 98, 59, 2090, 100, 645, 300, 1774, 1848, 726, 727,
+ /* 1530 */ 289, 729, 333, 302, 334, 50, 309, 323, 313, 1981,
+ /* 1540 */ 2021, 1980, 324, 1979, 76, 304, 1976, 390, 391, 1416,
+ /* 1550 */ 1417, 187, 395, 1974, 397, 398, 399, 1973, 1972, 401,
+ /* 1560 */ 403, 1971, 405, 1970, 407, 77, 1440, 1386, 1435, 1385,
+ /* 1570 */ 1942, 2039, 1941, 1940, 414, 415, 1939, 1938, 1337, 640,
+ /* 1580 */ 1894, 1893, 1891, 1890, 1989, 192, 639, 144, 1889, 1892,
+ /* 1590 */ 1888, 1443, 1445, 1887, 1885, 1884, 1883, 432, 1882, 434,
+ /* 1600 */ 2021, 146, 1866, 1865, 631, 1499, 1500, 1502, 1503, 1504,
+ /* 1610 */ 1505, 1896, 1881, 1880, 1879, 2020, 1878, 1877, 1876, 2056,
+ /* 1620 */ 1875, 1874, 108, 2022, 643, 2024, 2025, 638, 2021, 633,
+ /* 1630 */ 1873, 2039, 1872, 1871, 2084, 1870, 2109, 1869, 1868, 640,
+ /* 1640 */ 368, 2105, 1867, 1864, 1989, 1895, 639, 1863, 1862, 1339,
+ /* 1650 */ 1861, 1860, 1859, 462, 1858, 1857, 1721, 1216, 199, 2039,
+ /* 1660 */ 1720, 1718, 200, 1682, 74, 202, 2009, 640, 176, 1681,
+ /* 1670 */ 1955, 1130, 1989, 477, 639, 2020, 1129, 1949, 479, 2056,
+ /* 1680 */ 203, 1937, 108, 2022, 643, 2024, 2025, 638, 75, 633,
+ /* 1690 */ 1936, 210, 208, 1914, 2082, 2021, 2109, 1782, 1163, 1717,
+ /* 1700 */ 368, 2105, 1715, 2020, 496, 1713, 494, 2056, 1711, 498,
+ /* 1710 */ 108, 2022, 643, 2024, 2025, 638, 495, 633, 2021, 500,
+ /* 1720 */ 499, 502, 626, 503, 2109, 1709, 2039, 504, 368, 2105,
+ /* 1730 */ 507, 506, 1696, 508, 640, 1695, 1678, 1784, 1285, 1989,
+ /* 1740 */ 61, 639, 1284, 220, 1783, 1207, 1206, 1205, 1204, 2039,
+ /* 1750 */ 698, 700, 1201, 1200, 1198, 1199, 1707, 640, 1700, 532,
+ /* 1760 */ 350, 351, 1989, 352, 639, 1698, 535, 1677, 1676, 537,
+ /* 1770 */ 2020, 1675, 541, 110, 2056, 539, 1954, 109, 2022, 643,
+ /* 1780 */ 2024, 2025, 638, 1406, 633, 1408, 2021, 1405, 1948, 1392,
+ /* 1790 */ 1935, 2109, 545, 2020, 161, 2108, 2105, 2056, 1933, 26,
+ /* 1800 */ 109, 2022, 643, 2024, 2025, 638, 2021, 633, 55, 65,
+ /* 1810 */ 555, 554, 2183, 19, 2109, 16, 28, 2039, 628, 2105,
+ /* 1820 */ 1615, 245, 570, 355, 241, 640, 247, 253, 568, 58,
+ /* 1830 */ 1989, 252, 639, 2010, 20, 30, 560, 2039, 5, 1599,
+ /* 1840 */ 169, 251, 29, 63, 90, 640, 21, 6, 1630, 1629,
+ /* 1850 */ 1989, 1591, 639, 1635, 359, 1636, 17, 1634, 1633, 360,
+ /* 1860 */ 1566, 641, 1565, 265, 57, 2056, 1934, 1932, 109, 2022,
+ /* 1870 */ 643, 2024, 2025, 638, 172, 633, 1931, 1913, 93, 92,
+ /* 1880 */ 271, 2020, 2109, 56, 1912, 2056, 336, 2105, 109, 2022,
+ /* 1890 */ 643, 2024, 2025, 638, 22, 633, 2021, 272, 95, 1597,
+ /* 1900 */ 274, 279, 2109, 66, 284, 97, 23, 2106, 1518, 614,
+ /* 1910 */ 12, 1441, 101, 2059, 2021, 10, 281, 1496, 1473, 173,
+ /* 1920 */ 1517, 632, 185, 1528, 1494, 36, 15, 2039, 1493, 24,
+ /* 1930 */ 2021, 1465, 642, 25, 646, 640, 376, 1270, 648, 650,
+ /* 1940 */ 1989, 1267, 639, 644, 651, 2039, 1264, 653, 654, 656,
+ /* 1950 */ 1258, 657, 659, 640, 1256, 660, 1247, 287, 1989, 666,
+ /* 1960 */ 639, 2039, 1279, 1262, 102, 1261, 363, 1260, 103, 640,
+ /* 1970 */ 1275, 2020, 676, 73, 1989, 2056, 639, 1195, 315, 2022,
+ /* 1980 */ 643, 2024, 2025, 638, 1259, 633, 1161, 1194, 1193, 2020,
+ /* 1990 */ 1192, 1191, 1190, 2056, 1188, 1186, 168, 2022, 643, 2024,
+ /* 2000 */ 2025, 638, 2021, 633, 1185, 2020, 1184, 1214, 688, 2056,
+ /* 2010 */ 288, 1182, 322, 2022, 643, 2024, 2025, 638, 1181, 633,
+ /* 2020 */ 1180, 1179, 583, 1178, 2021, 1167, 1177, 1176, 1211, 1209,
+ /* 2030 */ 1173, 1172, 1169, 2039, 1714, 1168, 1166, 708, 1712, 1710,
+ /* 2040 */ 1708, 637, 712, 1694, 710, 716, 1989, 714, 639, 2200,
+ /* 2050 */ 718, 720, 709, 722, 713, 2039, 724, 717, 1119, 1674,
+ /* 2060 */ 373, 721, 728, 640, 291, 1649, 1427, 301, 1989, 731,
+ /* 2070 */ 639, 732, 1649, 1649, 1649, 1649, 1649, 2020, 1649, 1649,
+ /* 2080 */ 1649, 2056, 1649, 1649, 321, 2022, 643, 2024, 2025, 638,
+ /* 2090 */ 1649, 633, 2021, 2075, 1649, 1649, 1649, 1649, 1649, 2020,
+ /* 2100 */ 1649, 1649, 1649, 2056, 1649, 1649, 322, 2022, 643, 2024,
+ /* 2110 */ 2025, 638, 2021, 633, 1649, 1649, 1649, 1649, 1649, 1649,
+ /* 2120 */ 1649, 1649, 1649, 2039, 1649, 1649, 1649, 1649, 375, 1649,
+ /* 2130 */ 1649, 640, 1649, 1649, 1649, 1649, 1989, 1649, 639, 1649,
+ /* 2140 */ 1649, 1649, 1649, 2039, 1649, 1649, 1649, 1649, 1649, 1649,
+ /* 2150 */ 1649, 640, 1649, 1649, 1649, 1649, 1989, 1649, 639, 1649,
+ /* 2160 */ 1649, 1649, 1649, 1649, 1649, 1649, 1649, 2020, 1649, 1649,
+ /* 2170 */ 1649, 2056, 1649, 1649, 322, 2022, 643, 2024, 2025, 638,
+ /* 2180 */ 2021, 633, 1649, 1649, 1649, 1649, 1649, 547, 1649, 1649,
+ /* 2190 */ 1649, 2056, 1649, 1649, 317, 2022, 643, 2024, 2025, 638,
+ /* 2200 */ 2021, 633, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 1649,
+ /* 2210 */ 1649, 2039, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 640,
+ /* 2220 */ 1649, 1649, 1649, 1649, 1989, 1649, 639, 1649, 1649, 1649,
+ /* 2230 */ 1649, 2039, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 640,
+ /* 2240 */ 1649, 1649, 1649, 1649, 1989, 1649, 639, 1649, 1649, 1649,
+ /* 2250 */ 1649, 1649, 1649, 1649, 1649, 2020, 1649, 2021, 1649, 2056,
+ /* 2260 */ 1649, 1649, 306, 2022, 643, 2024, 2025, 638, 1649, 633,
+ /* 2270 */ 1649, 1649, 1649, 1649, 1649, 2020, 1649, 1649, 1649, 2056,
+ /* 2280 */ 1649, 1649, 307, 2022, 643, 2024, 2025, 638, 2039, 633,
+ /* 2290 */ 1649, 2021, 1649, 1649, 1649, 1649, 640, 1649, 1649, 1649,
+ /* 2300 */ 1649, 1989, 1649, 639, 1649, 1649, 1649, 1649, 1649, 1649,
+ /* 2310 */ 1649, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 2021,
+ /* 2320 */ 1649, 1649, 2039, 1649, 1649, 1649, 1649, 1649, 1649, 1649,
+ /* 2330 */ 640, 1649, 2020, 1649, 1649, 1989, 2056, 639, 1649, 308,
+ /* 2340 */ 2022, 643, 2024, 2025, 638, 1649, 633, 1649, 1649, 1649,
+ /* 2350 */ 2039, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 640, 1649,
+ /* 2360 */ 1649, 1649, 1649, 1989, 1649, 639, 2020, 1649, 1649, 1649,
+ /* 2370 */ 2056, 1649, 1649, 314, 2022, 643, 2024, 2025, 638, 2021,
+ /* 2380 */ 633, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 1649,
+ /* 2390 */ 1649, 1649, 1649, 1649, 2020, 1649, 1649, 1649, 2056, 1649,
+ /* 2400 */ 2021, 318, 2022, 643, 2024, 2025, 638, 1649, 633, 1649,
+ /* 2410 */ 2039, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 640, 1649,
+ /* 2420 */ 1649, 1649, 1649, 1989, 1649, 639, 1649, 1649, 1649, 1649,
+ /* 2430 */ 1649, 2039, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 640,
+ /* 2440 */ 1649, 1649, 1649, 1649, 1989, 1649, 639, 1649, 1649, 1649,
+ /* 2450 */ 1649, 1649, 1649, 1649, 2020, 1649, 1649, 1649, 2056, 1649,
+ /* 2460 */ 1649, 310, 2022, 643, 2024, 2025, 638, 1649, 633, 1649,
+ /* 2470 */ 1649, 1649, 1649, 2021, 1649, 2020, 1649, 1649, 1649, 2056,
+ /* 2480 */ 1649, 1649, 319, 2022, 643, 2024, 2025, 638, 1649, 633,
+ /* 2490 */ 1649, 1649, 1649, 1649, 1649, 1649, 1649, 2021, 1649, 1649,
+ /* 2500 */ 1649, 1649, 1649, 1649, 2039, 1649, 1649, 1649, 1649, 1649,
+ /* 2510 */ 1649, 1649, 640, 1649, 1649, 1649, 1649, 1989, 1649, 639,
+ /* 2520 */ 1649, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 2039, 1649,
+ /* 2530 */ 1649, 1649, 1649, 1649, 1649, 1649, 640, 1649, 1649, 1649,
+ /* 2540 */ 1649, 1989, 1649, 639, 1649, 1649, 1649, 1649, 2020, 1649,
+ /* 2550 */ 1649, 1649, 2056, 1649, 2021, 311, 2022, 643, 2024, 2025,
+ /* 2560 */ 638, 1649, 633, 1649, 1649, 1649, 1649, 1649, 1649, 1649,
+ /* 2570 */ 1649, 1649, 2020, 1649, 2021, 1649, 2056, 1649, 1649, 320,
+ /* 2580 */ 2022, 643, 2024, 2025, 638, 2039, 633, 1649, 1649, 1649,
+ /* 2590 */ 1649, 1649, 1649, 640, 1649, 1649, 1649, 1649, 1989, 1649,
+ /* 2600 */ 639, 1649, 1649, 1649, 1649, 2039, 1649, 1649, 1649, 1649,
+ /* 2610 */ 1649, 1649, 1649, 640, 1649, 1649, 1649, 1649, 1989, 1649,
+ /* 2620 */ 639, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 2020,
+ /* 2630 */ 1649, 2021, 1649, 2056, 1649, 1649, 312, 2022, 643, 2024,
+ /* 2640 */ 2025, 638, 1649, 633, 1649, 1649, 1649, 1649, 1649, 2020,
+ /* 2650 */ 1649, 1649, 2021, 2056, 1649, 1649, 325, 2022, 643, 2024,
+ /* 2660 */ 2025, 638, 2039, 633, 1649, 1649, 1649, 1649, 1649, 1649,
+ /* 2670 */ 640, 1649, 1649, 1649, 1649, 1989, 1649, 639, 1649, 1649,
+ /* 2680 */ 2021, 1649, 1649, 2039, 1649, 1649, 1649, 1649, 1649, 1649,
+ /* 2690 */ 1649, 640, 1649, 1649, 1649, 1649, 1989, 1649, 639, 1649,
+ /* 2700 */ 1649, 1649, 1649, 1649, 1649, 1649, 2020, 1649, 1649, 1649,
+ /* 2710 */ 2056, 2039, 1649, 326, 2022, 643, 2024, 2025, 638, 640,
+ /* 2720 */ 633, 1649, 1649, 1649, 1989, 1649, 639, 2020, 1649, 1649,
+ /* 2730 */ 1649, 2056, 1649, 1649, 2033, 2022, 643, 2024, 2025, 638,
+ /* 2740 */ 2021, 633, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 1649,
+ /* 2750 */ 1649, 1649, 1649, 1649, 1649, 2020, 1649, 1649, 1649, 2056,
+ /* 2760 */ 1649, 2021, 2032, 2022, 643, 2024, 2025, 638, 1649, 633,
+ /* 2770 */ 1649, 2039, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 640,
+ /* 2780 */ 1649, 1649, 1649, 1649, 1989, 1649, 639, 1649, 1649, 1649,
+ /* 2790 */ 1649, 1649, 2039, 1649, 1649, 1649, 1649, 1649, 1649, 1649,
+ /* 2800 */ 640, 1649, 1649, 1649, 1649, 1989, 1649, 639, 1649, 1649,
+ /* 2810 */ 1649, 1649, 1649, 1649, 1649, 2020, 1649, 1649, 1649, 2056,
+ /* 2820 */ 1649, 1649, 2031, 2022, 643, 2024, 2025, 638, 1649, 633,
+ /* 2830 */ 1649, 1649, 1649, 1649, 2021, 1649, 2020, 1649, 1649, 1649,
+ /* 2840 */ 2056, 1649, 1649, 338, 2022, 643, 2024, 2025, 638, 1649,
+ /* 2850 */ 633, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 2021, 1649,
+ /* 2860 */ 1649, 1649, 1649, 1649, 1649, 2039, 1649, 1649, 1649, 1649,
+ /* 2870 */ 1649, 1649, 1649, 640, 1649, 1649, 1649, 1649, 1989, 1649,
+ /* 2880 */ 639, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 2039,
+ /* 2890 */ 1649, 1649, 1649, 1649, 1649, 1649, 1649, 640, 1649, 1649,
+ /* 2900 */ 1649, 1649, 1989, 1649, 639, 1649, 1649, 1649, 1649, 2020,
+ /* 2910 */ 1649, 1649, 1649, 2056, 1649, 2021, 339, 2022, 643, 2024,
+ /* 2920 */ 2025, 638, 1649, 633, 1649, 1649, 1649, 1649, 1649, 1649,
+ /* 2930 */ 1649, 1649, 1649, 2020, 1649, 2021, 1649, 2056, 1649, 1649,
+ /* 2940 */ 335, 2022, 643, 2024, 2025, 638, 2039, 633, 1649, 1649,
+ /* 2950 */ 1649, 1649, 1649, 1649, 640, 1649, 1649, 1649, 1649, 1989,
+ /* 2960 */ 1649, 639, 1649, 1649, 1649, 1649, 2039, 1649, 1649, 1649,
+ /* 2970 */ 1649, 1649, 1649, 1649, 640, 1649, 1649, 1649, 1649, 1989,
+ /* 2980 */ 1649, 639, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 1649,
+ /* 2990 */ 2020, 1649, 2021, 1649, 2056, 1649, 1649, 340, 2022, 643,
+ /* 3000 */ 2024, 2025, 638, 1649, 633, 1649, 1649, 1649, 1649, 1649,
+ /* 3010 */ 641, 1649, 1649, 1649, 2056, 1649, 1649, 317, 2022, 643,
+ /* 3020 */ 2024, 2025, 638, 2039, 633, 1649, 1649, 1649, 1649, 1649,
+ /* 3030 */ 1649, 640, 1649, 1649, 1649, 1649, 1989, 1649, 639, 1649,
+ /* 3040 */ 1649, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 1649,
+ /* 3050 */ 1649, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 1649,
+ /* 3060 */ 1649, 1649, 1649, 1649, 1649, 1649, 1649, 2020, 1649, 1649,
+ /* 3070 */ 1649, 2056, 1649, 1649, 316, 2022, 643, 2024, 2025, 638,
+ /* 3080 */ 1649, 633,
};
static const YYCODETYPE yy_lookahead[] = {
- /* 0 */ 375, 436, 352, 337, 361, 440, 333, 362, 335, 336,
- /* 10 */ 360, 396, 12, 13, 14, 390, 391, 351, 373, 369,
- /* 20 */ 20, 456, 22, 8, 9, 460, 461, 12, 13, 14,
- /* 30 */ 15, 16, 337, 33, 368, 35, 0, 12, 13, 14,
- /* 40 */ 15, 16, 8, 9, 362, 360, 12, 13, 14, 15,
- /* 50 */ 16, 406, 407, 408, 33, 373, 352, 352, 58, 360,
- /* 60 */ 37, 329, 417, 63, 360, 360, 381, 382, 369, 48,
- /* 70 */ 70, 367, 377, 369, 369, 54, 55, 56, 57, 58,
- /* 80 */ 376, 337, 371, 12, 13, 374, 375, 20, 406, 407,
- /* 90 */ 408, 20, 360, 22, 20, 95, 3, 63, 95, 417,
- /* 100 */ 368, 65, 66, 67, 33, 373, 35, 375, 105, 73,
- /* 110 */ 74, 96, 368, 20, 78, 94, 14, 117, 97, 83,
- /* 120 */ 84, 98, 20, 100, 101, 89, 103, 95, 20, 58,
- /* 130 */ 107, 4, 132, 133, 63, 403, 337, 341, 104, 407,
- /* 140 */ 359, 70, 410, 411, 412, 413, 414, 415, 360, 417,
- /* 150 */ 351, 355, 129, 372, 422, 367, 424, 358, 22, 363,
- /* 160 */ 428, 429, 162, 163, 376, 35, 95, 368, 168, 169,
- /* 170 */ 43, 35, 45, 46, 442, 431, 432, 433, 434, 343,
- /* 180 */ 436, 437, 450, 183, 126, 185, 165, 166, 117, 96,
- /* 190 */ 4, 170, 8, 9, 173, 161, 12, 13, 14, 15,
- /* 200 */ 16, 20, 366, 132, 133, 328, 70, 330, 208, 209,
- /* 210 */ 189, 211, 212, 213, 214, 215, 216, 217, 218, 219,
- /* 220 */ 220, 221, 222, 223, 224, 225, 226, 227, 228, 95,
- /* 230 */ 20, 164, 22, 162, 163, 62, 162, 163, 21, 168,
+ /* 0 */ 333, 329, 335, 336, 0, 437, 361, 392, 362, 441,
+ /* 10 */ 361, 360, 12, 13, 14, 14, 375, 360, 367, 373,
+ /* 20 */ 20, 20, 22, 362, 456, 457, 337, 376, 387, 461,
+ /* 30 */ 462, 390, 391, 33, 373, 35, 329, 437, 381, 382,
+ /* 40 */ 362, 441, 8, 9, 375, 373, 12, 13, 14, 15,
+ /* 50 */ 16, 373, 437, 407, 408, 409, 441, 457, 58, 390,
+ /* 60 */ 391, 461, 462, 63, 418, 359, 377, 360, 407, 408,
+ /* 70 */ 70, 456, 457, 352, 337, 368, 461, 462, 372, 418,
+ /* 80 */ 373, 360, 375, 12, 13, 407, 408, 409, 437, 356,
+ /* 90 */ 369, 20, 441, 22, 360, 95, 418, 63, 12, 13,
+ /* 100 */ 14, 15, 16, 369, 33, 368, 35, 456, 457, 426,
+ /* 110 */ 427, 404, 461, 462, 328, 408, 330, 117, 411, 412,
+ /* 120 */ 413, 414, 415, 416, 417, 418, 419, 420, 58, 58,
+ /* 130 */ 20, 362, 132, 133, 63, 402, 371, 392, 104, 374,
+ /* 140 */ 375, 70, 373, 44, 108, 109, 110, 111, 112, 113,
+ /* 150 */ 114, 115, 116, 117, 118, 151, 120, 121, 122, 123,
+ /* 160 */ 124, 125, 162, 163, 160, 95, 95, 97, 168, 169,
+ /* 170 */ 433, 434, 435, 0, 437, 438, 407, 408, 441, 14,
+ /* 180 */ 15, 16, 437, 183, 360, 185, 441, 418, 117, 37,
+ /* 190 */ 4, 367, 20, 456, 457, 161, 374, 375, 461, 462,
+ /* 200 */ 376, 456, 457, 132, 133, 344, 461, 462, 208, 209,
+ /* 210 */ 349, 211, 212, 213, 214, 215, 216, 217, 218, 219,
+ /* 220 */ 220, 221, 222, 223, 224, 225, 226, 227, 228, 43,
+ /* 230 */ 0, 45, 46, 162, 163, 62, 20, 343, 21, 168,
/* 240 */ 169, 24, 25, 26, 27, 28, 29, 30, 31, 32,
- /* 250 */ 192, 193, 360, 117, 183, 20, 185, 164, 8, 9,
- /* 260 */ 368, 51, 12, 13, 14, 15, 16, 233, 234, 235,
- /* 270 */ 236, 237, 238, 239, 240, 241, 242, 243, 246, 208,
- /* 280 */ 209, 95, 211, 212, 213, 214, 215, 216, 217, 218,
+ /* 250 */ 98, 357, 100, 101, 183, 103, 185, 8, 9, 107,
+ /* 260 */ 366, 12, 13, 14, 15, 16, 44, 233, 234, 235,
+ /* 270 */ 236, 237, 238, 239, 240, 241, 242, 243, 48, 208,
+ /* 280 */ 209, 129, 211, 212, 213, 214, 215, 216, 217, 218,
/* 290 */ 219, 220, 221, 222, 223, 224, 225, 226, 227, 228,
- /* 300 */ 360, 230, 12, 13, 412, 333, 337, 335, 336, 79,
- /* 310 */ 20, 22, 22, 132, 133, 185, 182, 20, 184, 183,
- /* 320 */ 95, 185, 382, 33, 35, 35, 108, 109, 110, 111,
- /* 330 */ 112, 113, 114, 115, 116, 117, 118, 368, 120, 121,
- /* 340 */ 122, 123, 124, 125, 208, 209, 96, 20, 58, 168,
- /* 350 */ 169, 2, 58, 63, 14, 15, 16, 8, 9, 175,
- /* 360 */ 70, 12, 13, 14, 15, 16, 337, 137, 138, 65,
- /* 370 */ 66, 67, 409, 12, 13, 14, 0, 73, 74, 44,
- /* 380 */ 246, 20, 78, 22, 208, 95, 0, 83, 84, 95,
- /* 390 */ 160, 97, 95, 89, 33, 20, 35, 368, 435, 178,
- /* 400 */ 161, 432, 433, 434, 329, 436, 437, 117, 20, 440,
- /* 410 */ 24, 25, 26, 27, 28, 29, 30, 31, 32, 58,
- /* 420 */ 199, 200, 132, 133, 455, 456, 375, 425, 426, 460,
- /* 430 */ 461, 70, 246, 257, 258, 259, 260, 261, 387, 8,
- /* 440 */ 9, 390, 391, 12, 13, 14, 15, 16, 373, 20,
- /* 450 */ 344, 20, 162, 163, 270, 349, 95, 164, 168, 169,
- /* 460 */ 0, 432, 433, 434, 171, 436, 437, 360, 127, 20,
- /* 470 */ 95, 246, 233, 183, 367, 185, 334, 0, 117, 337,
- /* 480 */ 338, 21, 243, 376, 24, 25, 26, 27, 28, 29,
- /* 490 */ 30, 31, 32, 132, 133, 126, 127, 392, 208, 209,
- /* 500 */ 131, 211, 212, 213, 214, 215, 216, 217, 218, 219,
- /* 510 */ 220, 221, 222, 223, 224, 225, 226, 227, 228, 19,
- /* 520 */ 132, 133, 334, 162, 163, 337, 338, 151, 337, 168,
- /* 530 */ 169, 190, 191, 33, 20, 194, 160, 196, 21, 62,
- /* 540 */ 246, 436, 351, 436, 183, 440, 185, 440, 48, 0,
- /* 550 */ 62, 34, 337, 36, 54, 55, 56, 57, 58, 368,
- /* 560 */ 455, 456, 455, 456, 106, 460, 461, 460, 461, 208,
- /* 570 */ 209, 392, 211, 212, 213, 214, 215, 216, 217, 218,
+ /* 300 */ 352, 230, 12, 13, 132, 133, 20, 33, 360, 20,
+ /* 310 */ 20, 95, 22, 0, 337, 367, 246, 369, 329, 20,
+ /* 320 */ 337, 22, 48, 33, 376, 35, 329, 208, 54, 55,
+ /* 330 */ 56, 57, 58, 337, 21, 127, 95, 24, 25, 26,
+ /* 340 */ 27, 28, 29, 30, 31, 32, 20, 351, 58, 14,
+ /* 350 */ 51, 368, 4, 63, 358, 20, 333, 360, 335, 336,
+ /* 360 */ 70, 384, 373, 386, 368, 368, 267, 107, 94, 410,
+ /* 370 */ 373, 97, 375, 12, 13, 14, 257, 258, 259, 260,
+ /* 380 */ 261, 20, 329, 22, 95, 95, 126, 127, 128, 129,
+ /* 390 */ 130, 131, 341, 0, 33, 436, 35, 329, 190, 191,
+ /* 400 */ 20, 404, 194, 410, 196, 408, 355, 117, 411, 412,
+ /* 410 */ 413, 414, 415, 416, 363, 418, 433, 434, 435, 58,
+ /* 420 */ 437, 438, 132, 133, 175, 20, 373, 20, 360, 436,
+ /* 430 */ 4, 70, 360, 20, 334, 22, 368, 337, 338, 165,
+ /* 440 */ 166, 373, 334, 375, 170, 337, 338, 173, 35, 452,
+ /* 450 */ 453, 329, 162, 163, 382, 62, 95, 35, 168, 169,
+ /* 460 */ 62, 8, 9, 189, 51, 12, 13, 14, 15, 16,
+ /* 470 */ 20, 95, 404, 183, 0, 185, 408, 62, 117, 411,
+ /* 480 */ 412, 413, 414, 415, 416, 39, 418, 246, 162, 163,
+ /* 490 */ 326, 269, 70, 132, 133, 373, 337, 162, 208, 209,
+ /* 500 */ 95, 211, 212, 213, 214, 215, 216, 217, 218, 219,
+ /* 510 */ 220, 221, 222, 223, 224, 225, 226, 227, 228, 270,
+ /* 520 */ 337, 95, 368, 162, 163, 346, 347, 368, 337, 168,
+ /* 530 */ 169, 463, 464, 379, 351, 246, 337, 20, 20, 65,
+ /* 540 */ 66, 67, 351, 178, 183, 161, 185, 73, 74, 96,
+ /* 550 */ 351, 368, 78, 360, 392, 95, 392, 83, 84, 368,
+ /* 560 */ 396, 368, 106, 89, 199, 200, 230, 368, 232, 208,
+ /* 570 */ 209, 164, 211, 212, 213, 214, 215, 216, 217, 218,
/* 580 */ 219, 220, 221, 222, 223, 224, 225, 226, 227, 228,
- /* 590 */ 12, 13, 409, 4, 94, 164, 356, 97, 20, 384,
- /* 600 */ 22, 386, 326, 337, 269, 107, 167, 360, 19, 95,
- /* 610 */ 0, 33, 409, 35, 367, 436, 374, 375, 435, 440,
- /* 620 */ 329, 246, 33, 376, 126, 127, 128, 129, 130, 131,
- /* 630 */ 130, 230, 337, 232, 455, 456, 58, 48, 435, 460,
- /* 640 */ 461, 401, 53, 20, 329, 22, 351, 58, 70, 329,
- /* 650 */ 384, 360, 386, 358, 1, 2, 107, 230, 35, 368,
- /* 660 */ 58, 12, 13, 368, 373, 165, 375, 20, 392, 20,
- /* 670 */ 170, 22, 62, 95, 51, 126, 127, 128, 129, 130,
- /* 680 */ 131, 70, 33, 94, 35, 35, 97, 187, 373, 189,
- /* 690 */ 251, 252, 253, 373, 403, 117, 94, 420, 407, 97,
- /* 700 */ 423, 410, 411, 412, 413, 414, 415, 58, 417, 436,
- /* 710 */ 132, 133, 436, 440, 346, 347, 440, 8, 9, 70,
- /* 720 */ 70, 12, 13, 14, 15, 16, 337, 353, 455, 456,
- /* 730 */ 356, 455, 456, 460, 461, 0, 460, 461, 346, 347,
- /* 740 */ 162, 163, 451, 452, 95, 2, 168, 169, 337, 96,
- /* 750 */ 106, 8, 9, 44, 337, 12, 13, 14, 15, 16,
- /* 760 */ 246, 183, 351, 185, 8, 9, 117, 360, 12, 13,
- /* 770 */ 14, 15, 16, 384, 367, 386, 329, 70, 421, 368,
- /* 780 */ 423, 132, 133, 376, 49, 368, 208, 209, 0, 211,
+ /* 590 */ 12, 13, 433, 434, 435, 247, 437, 438, 20, 437,
+ /* 600 */ 22, 437, 19, 441, 410, 441, 413, 79, 437, 1,
+ /* 610 */ 2, 33, 441, 35, 329, 337, 33, 233, 456, 457,
+ /* 620 */ 456, 457, 246, 461, 462, 461, 462, 243, 457, 351,
+ /* 630 */ 436, 48, 461, 462, 337, 20, 58, 54, 55, 56,
+ /* 640 */ 57, 58, 182, 337, 184, 360, 368, 360, 70, 132,
+ /* 650 */ 133, 246, 360, 368, 367, 346, 347, 351, 373, 367,
+ /* 660 */ 375, 12, 13, 376, 343, 137, 138, 207, 376, 20,
+ /* 670 */ 20, 22, 246, 95, 368, 3, 421, 94, 337, 424,
+ /* 680 */ 97, 384, 33, 386, 35, 168, 169, 366, 160, 404,
+ /* 690 */ 392, 245, 20, 408, 396, 117, 411, 412, 413, 414,
+ /* 700 */ 415, 416, 0, 418, 96, 20, 246, 58, 14, 368,
+ /* 710 */ 132, 133, 22, 130, 20, 337, 8, 9, 126, 70,
+ /* 720 */ 12, 13, 14, 15, 16, 35, 24, 25, 26, 27,
+ /* 730 */ 28, 29, 30, 31, 32, 437, 337, 230, 453, 441,
+ /* 740 */ 162, 163, 360, 348, 95, 350, 168, 169, 165, 367,
+ /* 750 */ 351, 106, 44, 170, 456, 457, 167, 358, 376, 461,
+ /* 760 */ 462, 183, 384, 185, 386, 329, 117, 368, 96, 422,
+ /* 770 */ 187, 424, 189, 432, 433, 434, 435, 162, 437, 438,
+ /* 780 */ 329, 132, 133, 70, 192, 193, 208, 209, 341, 211,
/* 790 */ 212, 213, 214, 215, 216, 217, 218, 219, 220, 221,
- /* 800 */ 222, 223, 224, 225, 226, 227, 228, 343, 421, 162,
- /* 810 */ 423, 162, 163, 18, 361, 20, 368, 168, 169, 360,
- /* 820 */ 373, 357, 27, 352, 337, 30, 367, 379, 33, 3,
- /* 830 */ 366, 360, 183, 361, 185, 376, 392, 341, 351, 370,
- /* 840 */ 369, 362, 373, 48, 42, 50, 44, 329, 53, 432,
- /* 850 */ 433, 434, 373, 436, 437, 368, 361, 208, 209, 363,
+ /* 800 */ 222, 223, 224, 225, 226, 227, 228, 337, 70, 373,
+ /* 810 */ 363, 162, 163, 18, 164, 20, 337, 168, 169, 337,
+ /* 820 */ 368, 351, 27, 99, 373, 30, 102, 352, 33, 352,
+ /* 830 */ 351, 379, 183, 351, 185, 360, 164, 360, 368, 21,
+ /* 840 */ 251, 252, 253, 48, 369, 50, 369, 368, 53, 164,
+ /* 850 */ 368, 329, 34, 329, 36, 3, 162, 208, 209, 361,
/* 860 */ 211, 212, 213, 214, 215, 216, 217, 218, 219, 220,
- /* 870 */ 221, 222, 223, 224, 225, 226, 227, 228, 337, 337,
- /* 880 */ 436, 14, 4, 18, 440, 406, 407, 20, 23, 94,
- /* 890 */ 0, 373, 351, 351, 361, 107, 417, 337, 337, 455,
- /* 900 */ 456, 106, 37, 38, 460, 461, 41, 360, 39, 368,
- /* 910 */ 368, 351, 351, 20, 126, 127, 128, 129, 130, 131,
- /* 920 */ 164, 368, 368, 376, 59, 60, 61, 370, 368, 368,
- /* 930 */ 373, 136, 379, 379, 139, 140, 141, 142, 143, 144,
+ /* 870 */ 221, 222, 223, 224, 225, 226, 227, 228, 329, 329,
+ /* 880 */ 337, 126, 127, 18, 329, 422, 131, 424, 23, 94,
+ /* 890 */ 0, 65, 66, 67, 351, 373, 361, 373, 337, 73,
+ /* 900 */ 74, 106, 37, 38, 78, 368, 41, 45, 46, 83,
+ /* 910 */ 84, 368, 351, 8, 9, 89, 379, 12, 13, 14,
+ /* 920 */ 15, 16, 373, 373, 59, 60, 61, 370, 373, 368,
+ /* 930 */ 373, 136, 244, 245, 139, 140, 141, 142, 143, 144,
/* 940 */ 145, 146, 147, 148, 149, 150, 151, 152, 153, 154,
/* 950 */ 155, 329, 157, 158, 159, 65, 66, 67, 68, 69,
/* 960 */ 95, 71, 72, 73, 74, 75, 76, 77, 78, 79,
/* 970 */ 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
- /* 980 */ 90, 91, 370, 392, 348, 373, 350, 44, 329, 337,
- /* 990 */ 14, 392, 12, 13, 436, 373, 20, 337, 440, 134,
- /* 1000 */ 8, 9, 22, 351, 12, 13, 14, 15, 16, 45,
- /* 1010 */ 46, 351, 337, 33, 456, 35, 132, 133, 460, 461,
- /* 1020 */ 368, 329, 337, 20, 244, 245, 351, 436, 368, 162,
- /* 1030 */ 337, 440, 373, 329, 329, 436, 351, 44, 58, 440,
- /* 1040 */ 175, 176, 177, 368, 351, 180, 455, 456, 337, 329,
- /* 1050 */ 70, 460, 461, 368, 455, 456, 0, 164, 329, 460,
- /* 1060 */ 461, 368, 351, 198, 362, 373, 201, 337, 203, 204,
- /* 1070 */ 205, 206, 207, 361, 106, 373, 329, 373, 373, 368,
- /* 1080 */ 360, 351, 337, 0, 329, 337, 337, 44, 368, 96,
- /* 1090 */ 330, 265, 329, 373, 63, 375, 351, 117, 368, 351,
- /* 1100 */ 351, 329, 373, 329, 48, 22, 35, 360, 406, 407,
- /* 1110 */ 349, 246, 329, 368, 245, 368, 368, 368, 99, 417,
- /* 1120 */ 373, 102, 375, 403, 156, 247, 329, 407, 373, 329,
- /* 1130 */ 410, 411, 412, 413, 414, 415, 373, 417, 162, 96,
- /* 1140 */ 420, 329, 422, 423, 424, 373, 107, 373, 428, 429,
- /* 1150 */ 403, 329, 99, 361, 407, 102, 373, 410, 411, 412,
- /* 1160 */ 413, 414, 415, 183, 417, 185, 44, 164, 129, 422,
- /* 1170 */ 373, 424, 360, 373, 0, 428, 429, 42, 99, 44,
- /* 1180 */ 368, 102, 58, 44, 383, 373, 0, 375, 208, 209,
- /* 1190 */ 44, 99, 44, 35, 102, 373, 22, 450, 47, 329,
- /* 1200 */ 44, 221, 222, 223, 224, 225, 226, 227, 22, 44,
- /* 1210 */ 267, 13, 44, 44, 44, 403, 1, 2, 96, 407,
- /* 1220 */ 44, 97, 410, 411, 412, 413, 414, 415, 70, 417,
- /* 1230 */ 360, 464, 329, 35, 422, 96, 424, 44, 368, 208,
- /* 1240 */ 428, 429, 96, 373, 96, 375, 95, 13, 44, 44,
- /* 1250 */ 44, 439, 96, 44, 339, 44, 185, 453, 447, 360,
- /* 1260 */ 44, 96, 339, 360, 96, 96, 96, 336, 383, 35,
- /* 1270 */ 372, 368, 96, 403, 383, 438, 373, 407, 375, 430,
- /* 1280 */ 410, 411, 412, 413, 414, 415, 457, 417, 441, 96,
- /* 1290 */ 329, 405, 422, 248, 424, 48, 404, 181, 428, 429,
- /* 1300 */ 96, 96, 96, 394, 42, 96, 403, 96, 380, 439,
- /* 1310 */ 407, 20, 96, 410, 411, 412, 413, 414, 415, 383,
- /* 1320 */ 417, 360, 380, 161, 378, 422, 20, 424, 337, 368,
- /* 1330 */ 380, 428, 429, 337, 373, 378, 375, 378, 93, 345,
- /* 1340 */ 20, 337, 439, 337, 337, 331, 331, 20, 343, 398,
- /* 1350 */ 20, 343, 375, 20, 338, 20, 393, 52, 338, 331,
- /* 1360 */ 343, 343, 337, 373, 403, 343, 343, 343, 407, 340,
- /* 1370 */ 329, 410, 411, 412, 413, 414, 415, 340, 417, 331,
- /* 1380 */ 197, 360, 373, 422, 337, 424, 360, 360, 402, 428,
- /* 1390 */ 429, 95, 360, 329, 360, 360, 360, 400, 360, 398,
- /* 1400 */ 439, 360, 360, 341, 360, 188, 360, 397, 375, 368,
- /* 1410 */ 341, 337, 446, 383, 373, 256, 375, 446, 255, 262,
- /* 1420 */ 174, 449, 373, 383, 360, 373, 448, 446, 373, 445,
- /* 1430 */ 373, 264, 368, 444, 263, 271, 249, 373, 388, 375,
- /* 1440 */ 465, 443, 388, 268, 403, 266, 459, 245, 407, 368,
- /* 1450 */ 20, 410, 411, 412, 413, 414, 415, 458, 417, 338,
- /* 1460 */ 329, 341, 337, 422, 405, 424, 20, 403, 341, 428,
- /* 1470 */ 429, 407, 409, 386, 410, 411, 412, 413, 414, 415,
- /* 1480 */ 439, 417, 388, 373, 329, 373, 422, 373, 424, 388,
- /* 1490 */ 373, 360, 428, 429, 166, 341, 373, 356, 385, 368,
- /* 1500 */ 368, 373, 341, 95, 373, 427, 375, 95, 364, 373,
- /* 1510 */ 350, 331, 36, 341, 337, 360, 332, 399, 389, 389,
- /* 1520 */ 354, 395, 327, 368, 342, 0, 0, 354, 373, 190,
- /* 1530 */ 375, 0, 329, 42, 403, 354, 0, 0, 407, 35,
- /* 1540 */ 202, 410, 411, 412, 413, 414, 415, 35, 417, 35,
- /* 1550 */ 35, 202, 0, 422, 35, 424, 329, 35, 403, 428,
- /* 1560 */ 429, 202, 407, 360, 0, 410, 411, 412, 413, 414,
- /* 1570 */ 415, 368, 417, 202, 0, 35, 373, 422, 375, 424,
- /* 1580 */ 0, 22, 0, 428, 429, 35, 185, 360, 183, 0,
- /* 1590 */ 0, 0, 179, 178, 0, 368, 47, 0, 0, 0,
- /* 1600 */ 373, 0, 375, 42, 0, 0, 403, 0, 0, 0,
- /* 1610 */ 407, 0, 0, 410, 411, 412, 413, 414, 415, 151,
- /* 1620 */ 417, 35, 329, 0, 151, 0, 0, 424, 0, 0,
- /* 1630 */ 403, 428, 429, 0, 407, 0, 0, 410, 411, 412,
- /* 1640 */ 413, 414, 415, 0, 417, 329, 0, 0, 0, 0,
- /* 1650 */ 0, 424, 0, 360, 0, 428, 429, 0, 42, 0,
- /* 1660 */ 0, 368, 0, 0, 0, 0, 373, 22, 375, 0,
- /* 1670 */ 0, 0, 0, 135, 0, 35, 360, 0, 58, 0,
- /* 1680 */ 58, 0, 0, 42, 368, 47, 44, 14, 0, 373,
- /* 1690 */ 39, 375, 14, 40, 0, 0, 403, 39, 0, 0,
- /* 1700 */ 407, 174, 47, 410, 411, 412, 413, 414, 415, 0,
- /* 1710 */ 417, 0, 0, 329, 47, 39, 0, 424, 35, 403,
- /* 1720 */ 0, 428, 429, 407, 39, 64, 410, 411, 412, 413,
- /* 1730 */ 414, 415, 416, 417, 418, 419, 35, 48, 48, 329,
- /* 1740 */ 0, 39, 35, 39, 360, 48, 0, 39, 35, 0,
- /* 1750 */ 0, 48, 368, 0, 0, 22, 35, 373, 0, 375,
- /* 1760 */ 35, 35, 35, 35, 35, 35, 44, 44, 102, 22,
- /* 1770 */ 360, 35, 104, 0, 22, 0, 0, 22, 368, 22,
- /* 1780 */ 35, 50, 0, 373, 0, 375, 35, 403, 0, 22,
- /* 1790 */ 20, 407, 96, 0, 410, 411, 412, 413, 414, 415,
- /* 1800 */ 35, 417, 0, 35, 329, 195, 35, 35, 164, 95,
- /* 1810 */ 95, 22, 0, 403, 3, 250, 186, 407, 0, 95,
- /* 1820 */ 410, 411, 412, 413, 414, 415, 254, 417, 96, 329,
- /* 1830 */ 44, 229, 95, 95, 424, 360, 44, 96, 96, 429,
- /* 1840 */ 96, 166, 44, 368, 164, 44, 462, 463, 373, 3,
- /* 1850 */ 375, 164, 47, 47, 95, 95, 172, 171, 95, 44,
- /* 1860 */ 360, 35, 329, 171, 250, 96, 35, 250, 368, 35,
- /* 1870 */ 96, 35, 35, 373, 35, 375, 96, 96, 403, 47,
- /* 1880 */ 47, 244, 407, 0, 44, 410, 411, 412, 413, 414,
- /* 1890 */ 415, 0, 417, 360, 0, 329, 0, 39, 95, 47,
- /* 1900 */ 96, 368, 95, 403, 96, 95, 373, 407, 375, 0,
- /* 1910 */ 410, 411, 412, 413, 414, 415, 95, 417, 95, 39,
- /* 1920 */ 95, 105, 47, 167, 231, 44, 360, 452, 2, 165,
- /* 1930 */ 22, 365, 47, 95, 368, 229, 403, 96, 95, 373,
- /* 1940 */ 407, 375, 95, 410, 411, 412, 413, 414, 415, 96,
- /* 1950 */ 417, 208, 96, 47, 454, 95, 95, 22, 96, 95,
- /* 1960 */ 329, 106, 96, 229, 35, 35, 95, 35, 96, 403,
- /* 1970 */ 119, 210, 95, 407, 96, 35, 410, 411, 412, 413,
- /* 1980 */ 414, 415, 95, 417, 96, 329, 35, 95, 35, 96,
- /* 1990 */ 95, 360, 119, 22, 95, 119, 463, 95, 119, 368,
- /* 2000 */ 44, 35, 22, 64, 373, 107, 375, 95, 63, 35,
- /* 2010 */ 35, 35, 35, 35, 35, 92, 360, 35, 35, 35,
- /* 2020 */ 35, 365, 70, 35, 368, 44, 35, 35, 22, 373,
- /* 2030 */ 35, 375, 35, 35, 403, 70, 35, 35, 407, 35,
- /* 2040 */ 35, 410, 411, 412, 413, 414, 415, 329, 417, 35,
- /* 2050 */ 419, 22, 35, 0, 35, 48, 0, 39, 35, 403,
- /* 2060 */ 48, 39, 0, 407, 329, 35, 410, 411, 412, 413,
- /* 2070 */ 414, 415, 48, 417, 39, 0, 35, 39, 360, 48,
- /* 2080 */ 0, 35, 35, 365, 0, 22, 368, 21, 466, 22,
- /* 2090 */ 22, 373, 21, 375, 20, 360, 466, 466, 466, 466,
- /* 2100 */ 466, 466, 466, 368, 466, 466, 466, 466, 373, 466,
- /* 2110 */ 375, 466, 466, 466, 466, 466, 466, 466, 466, 466,
- /* 2120 */ 466, 403, 466, 466, 329, 407, 466, 466, 410, 411,
- /* 2130 */ 412, 413, 414, 415, 466, 417, 466, 466, 403, 466,
- /* 2140 */ 466, 466, 407, 329, 466, 410, 411, 412, 413, 414,
- /* 2150 */ 415, 466, 417, 466, 466, 360, 466, 466, 466, 466,
- /* 2160 */ 466, 466, 466, 368, 466, 466, 466, 466, 373, 466,
- /* 2170 */ 375, 466, 466, 466, 360, 466, 466, 466, 466, 466,
- /* 2180 */ 466, 466, 368, 466, 466, 466, 466, 373, 466, 375,
- /* 2190 */ 466, 466, 466, 466, 466, 466, 466, 466, 403, 466,
- /* 2200 */ 466, 466, 407, 329, 466, 410, 411, 412, 413, 414,
- /* 2210 */ 415, 466, 417, 466, 466, 466, 466, 403, 466, 329,
- /* 2220 */ 466, 407, 466, 466, 410, 411, 412, 413, 414, 415,
- /* 2230 */ 466, 417, 466, 466, 360, 466, 329, 466, 466, 466,
- /* 2240 */ 466, 466, 368, 466, 466, 466, 466, 373, 466, 375,
- /* 2250 */ 360, 466, 466, 466, 466, 466, 466, 466, 368, 466,
- /* 2260 */ 466, 466, 466, 373, 466, 375, 466, 360, 466, 466,
- /* 2270 */ 466, 466, 466, 466, 466, 368, 466, 403, 466, 466,
- /* 2280 */ 373, 407, 375, 466, 410, 411, 412, 413, 414, 415,
- /* 2290 */ 466, 417, 466, 403, 466, 466, 466, 407, 466, 329,
- /* 2300 */ 410, 411, 412, 413, 414, 415, 466, 417, 466, 466,
- /* 2310 */ 403, 466, 466, 466, 407, 329, 466, 410, 411, 412,
- /* 2320 */ 413, 414, 415, 466, 417, 466, 466, 466, 466, 466,
- /* 2330 */ 360, 466, 466, 466, 466, 466, 466, 466, 368, 466,
- /* 2340 */ 466, 466, 466, 373, 466, 375, 360, 466, 466, 466,
- /* 2350 */ 466, 466, 466, 466, 368, 466, 466, 466, 466, 373,
- /* 2360 */ 466, 375, 466, 466, 466, 466, 466, 466, 466, 466,
- /* 2370 */ 466, 329, 466, 403, 466, 466, 466, 407, 466, 466,
- /* 2380 */ 410, 411, 412, 413, 414, 415, 466, 417, 466, 403,
- /* 2390 */ 466, 466, 466, 407, 329, 466, 410, 411, 412, 413,
- /* 2400 */ 414, 415, 360, 417, 466, 466, 466, 466, 466, 466,
- /* 2410 */ 368, 466, 466, 466, 466, 373, 466, 375, 466, 466,
- /* 2420 */ 466, 466, 466, 466, 466, 360, 466, 466, 466, 466,
- /* 2430 */ 466, 466, 466, 368, 466, 466, 466, 466, 373, 466,
- /* 2440 */ 375, 466, 466, 466, 466, 403, 466, 466, 466, 407,
- /* 2450 */ 466, 466, 410, 411, 412, 413, 414, 415, 329, 417,
- /* 2460 */ 466, 466, 466, 466, 466, 466, 466, 466, 403, 466,
- /* 2470 */ 466, 466, 407, 466, 466, 410, 411, 412, 413, 414,
- /* 2480 */ 415, 466, 417, 466, 466, 329, 466, 466, 466, 360,
- /* 2490 */ 466, 466, 466, 466, 466, 466, 466, 368, 466, 466,
- /* 2500 */ 466, 466, 373, 466, 375, 466, 466, 466, 466, 466,
- /* 2510 */ 466, 466, 466, 466, 466, 466, 360, 466, 466, 466,
- /* 2520 */ 466, 466, 466, 466, 368, 466, 466, 466, 466, 373,
- /* 2530 */ 466, 375, 403, 329, 466, 466, 407, 466, 466, 410,
- /* 2540 */ 411, 412, 413, 414, 415, 466, 417, 466, 466, 329,
- /* 2550 */ 466, 466, 466, 466, 466, 466, 466, 466, 466, 403,
- /* 2560 */ 466, 466, 466, 407, 360, 466, 410, 411, 412, 413,
- /* 2570 */ 414, 415, 368, 417, 466, 466, 466, 373, 466, 375,
- /* 2580 */ 360, 466, 466, 466, 466, 466, 466, 466, 368, 466,
- /* 2590 */ 466, 466, 466, 373, 466, 375, 466, 329, 466, 466,
- /* 2600 */ 466, 466, 466, 466, 466, 466, 466, 403, 466, 466,
- /* 2610 */ 466, 407, 466, 466, 410, 411, 412, 413, 414, 415,
- /* 2620 */ 466, 417, 466, 403, 466, 466, 466, 407, 360, 466,
- /* 2630 */ 410, 411, 412, 413, 414, 415, 368, 417, 466, 466,
- /* 2640 */ 466, 373, 466, 375, 466, 329, 466, 466, 466, 466,
- /* 2650 */ 466, 466, 466, 466, 466, 466, 466, 466, 466, 466,
- /* 2660 */ 466, 466, 466, 466, 466, 466, 466, 466, 329, 466,
- /* 2670 */ 466, 403, 466, 466, 466, 407, 360, 466, 410, 411,
- /* 2680 */ 412, 413, 414, 415, 368, 417, 466, 466, 466, 373,
- /* 2690 */ 466, 375, 466, 466, 466, 466, 466, 466, 466, 360,
- /* 2700 */ 466, 329, 466, 466, 466, 466, 466, 368, 466, 466,
- /* 2710 */ 466, 466, 373, 466, 375, 466, 466, 466, 466, 403,
- /* 2720 */ 466, 466, 466, 407, 329, 466, 410, 411, 412, 413,
- /* 2730 */ 414, 415, 360, 417, 466, 466, 466, 466, 466, 466,
- /* 2740 */ 368, 466, 403, 466, 466, 373, 407, 375, 466, 410,
- /* 2750 */ 411, 412, 413, 414, 415, 360, 417, 466, 466, 466,
- /* 2760 */ 466, 466, 466, 368, 466, 466, 466, 466, 373, 466,
- /* 2770 */ 375, 466, 466, 466, 466, 403, 466, 466, 466, 407,
- /* 2780 */ 466, 466, 410, 411, 412, 413, 414, 415, 329, 417,
- /* 2790 */ 466, 466, 466, 466, 466, 466, 466, 466, 403, 466,
- /* 2800 */ 466, 466, 407, 466, 466, 410, 411, 412, 413, 414,
- /* 2810 */ 415, 466, 417, 466, 466, 329, 466, 466, 466, 360,
- /* 2820 */ 466, 466, 466, 466, 466, 466, 466, 368, 466, 466,
- /* 2830 */ 466, 466, 373, 466, 375, 466, 466, 466, 466, 466,
- /* 2840 */ 466, 466, 466, 466, 466, 466, 360, 466, 466, 466,
- /* 2850 */ 466, 466, 466, 466, 368, 466, 466, 466, 466, 373,
- /* 2860 */ 466, 375, 403, 329, 466, 466, 407, 466, 466, 410,
- /* 2870 */ 411, 412, 413, 414, 415, 466, 417, 466, 466, 466,
- /* 2880 */ 466, 466, 466, 466, 466, 466, 466, 466, 466, 403,
- /* 2890 */ 466, 466, 466, 407, 360, 466, 410, 411, 412, 413,
- /* 2900 */ 414, 415, 368, 417, 466, 466, 466, 373, 466, 375,
- /* 2910 */ 466, 466, 466, 466, 466, 466, 466, 466, 466, 466,
- /* 2920 */ 466, 466, 466, 466, 466, 466, 466, 466, 466, 466,
- /* 2930 */ 466, 466, 466, 466, 466, 466, 466, 403, 466, 466,
- /* 2940 */ 466, 407, 466, 466, 410, 411, 412, 413, 414, 415,
- /* 2950 */ 466, 417,
+ /* 980 */ 90, 91, 8, 9, 337, 4, 12, 13, 14, 15,
+ /* 990 */ 16, 337, 361, 329, 20, 373, 95, 2, 351, 134,
+ /* 1000 */ 19, 96, 0, 8, 9, 351, 105, 12, 13, 14,
+ /* 1010 */ 15, 16, 329, 2, 33, 368, 392, 35, 337, 8,
+ /* 1020 */ 9, 337, 368, 12, 13, 14, 15, 16, 360, 48,
+ /* 1030 */ 361, 107, 351, 337, 53, 351, 337, 373, 361, 58,
+ /* 1040 */ 175, 176, 177, 360, 376, 180, 329, 351, 337, 368,
+ /* 1050 */ 351, 368, 368, 129, 353, 0, 373, 356, 375, 329,
+ /* 1060 */ 329, 437, 351, 198, 368, 441, 201, 368, 203, 204,
+ /* 1070 */ 205, 206, 207, 0, 337, 94, 329, 22, 97, 368,
+ /* 1080 */ 456, 457, 58, 329, 397, 461, 462, 404, 351, 22,
+ /* 1090 */ 373, 408, 329, 35, 411, 412, 413, 414, 415, 416,
+ /* 1100 */ 329, 418, 35, 373, 373, 368, 423, 360, 425, 107,
+ /* 1110 */ 63, 246, 429, 430, 106, 368, 99, 265, 94, 102,
+ /* 1120 */ 373, 97, 375, 42, 330, 44, 443, 373, 126, 127,
+ /* 1130 */ 128, 129, 130, 131, 451, 329, 373, 70, 164, 349,
+ /* 1140 */ 370, 8, 9, 373, 373, 12, 13, 14, 15, 16,
+ /* 1150 */ 370, 404, 383, 373, 44, 408, 0, 465, 411, 412,
+ /* 1160 */ 413, 414, 415, 416, 156, 418, 360, 185, 421, 454,
+ /* 1170 */ 423, 424, 425, 42, 368, 44, 429, 430, 22, 373,
+ /* 1180 */ 107, 375, 132, 133, 117, 8, 9, 0, 44, 12,
+ /* 1190 */ 13, 14, 15, 16, 99, 329, 44, 102, 339, 126,
+ /* 1200 */ 127, 128, 129, 130, 131, 99, 96, 58, 102, 22,
+ /* 1210 */ 404, 44, 44, 44, 408, 44, 44, 411, 412, 413,
+ /* 1220 */ 414, 415, 416, 164, 418, 47, 360, 35, 360, 423,
+ /* 1230 */ 171, 425, 1, 2, 368, 429, 430, 0, 44, 373,
+ /* 1240 */ 96, 375, 44, 185, 448, 339, 97, 44, 96, 44,
+ /* 1250 */ 183, 44, 185, 44, 329, 208, 44, 451, 44, 44,
+ /* 1260 */ 44, 44, 70, 96, 96, 96, 383, 96, 96, 336,
+ /* 1270 */ 404, 372, 383, 95, 408, 208, 209, 411, 412, 413,
+ /* 1280 */ 414, 415, 416, 439, 418, 360, 49, 13, 329, 423,
+ /* 1290 */ 96, 425, 13, 368, 96, 429, 430, 164, 373, 96,
+ /* 1300 */ 375, 96, 431, 96, 458, 96, 440, 48, 96, 35,
+ /* 1310 */ 96, 96, 96, 96, 35, 442, 248, 406, 405, 360,
+ /* 1320 */ 181, 394, 42, 380, 20, 383, 380, 368, 378, 404,
+ /* 1330 */ 20, 161, 373, 408, 375, 337, 411, 412, 413, 414,
+ /* 1340 */ 415, 416, 337, 418, 380, 378, 378, 93, 423, 345,
+ /* 1350 */ 425, 337, 337, 337, 429, 430, 20, 331, 331, 20,
+ /* 1360 */ 399, 343, 20, 404, 375, 440, 343, 408, 20, 338,
+ /* 1370 */ 411, 412, 413, 414, 415, 416, 20, 418, 393, 343,
+ /* 1380 */ 338, 329, 423, 343, 425, 337, 343, 343, 429, 430,
+ /* 1390 */ 52, 340, 343, 340, 331, 12, 13, 360, 360, 440,
+ /* 1400 */ 403, 329, 337, 373, 95, 22, 360, 331, 373, 188,
+ /* 1410 */ 197, 401, 360, 256, 360, 341, 33, 360, 35, 399,
+ /* 1420 */ 368, 360, 360, 398, 360, 373, 360, 375, 341, 360,
+ /* 1430 */ 360, 375, 360, 337, 447, 255, 262, 447, 450, 174,
+ /* 1440 */ 368, 58, 449, 383, 263, 373, 447, 375, 373, 264,
+ /* 1450 */ 373, 373, 373, 70, 383, 446, 404, 445, 466, 249,
+ /* 1460 */ 408, 271, 266, 411, 412, 413, 414, 415, 416, 268,
+ /* 1470 */ 418, 388, 388, 444, 245, 423, 404, 425, 20, 460,
+ /* 1480 */ 408, 429, 430, 411, 412, 413, 414, 415, 416, 368,
+ /* 1490 */ 418, 406, 440, 459, 341, 423, 410, 425, 337, 341,
+ /* 1500 */ 117, 429, 430, 338, 20, 386, 388, 373, 373, 373,
+ /* 1510 */ 373, 373, 440, 388, 373, 166, 341, 385, 356, 368,
+ /* 1520 */ 341, 95, 428, 95, 364, 337, 350, 373, 36, 332,
+ /* 1530 */ 341, 331, 389, 342, 389, 395, 354, 354, 354, 0,
+ /* 1540 */ 329, 0, 400, 0, 42, 327, 0, 35, 202, 35,
+ /* 1550 */ 35, 35, 202, 0, 35, 35, 202, 0, 0, 202,
+ /* 1560 */ 35, 0, 22, 0, 35, 190, 183, 185, 185, 183,
+ /* 1570 */ 0, 360, 0, 0, 179, 178, 0, 0, 47, 368,
+ /* 1580 */ 0, 0, 0, 0, 373, 151, 375, 42, 0, 0,
+ /* 1590 */ 0, 208, 209, 0, 0, 0, 0, 35, 0, 151,
+ /* 1600 */ 329, 42, 0, 0, 221, 222, 223, 224, 225, 226,
+ /* 1610 */ 227, 0, 0, 0, 0, 404, 0, 0, 0, 408,
+ /* 1620 */ 0, 0, 411, 412, 413, 414, 415, 416, 329, 418,
+ /* 1630 */ 0, 360, 0, 0, 423, 0, 425, 0, 0, 368,
+ /* 1640 */ 429, 430, 0, 0, 373, 0, 375, 0, 0, 22,
+ /* 1650 */ 0, 0, 0, 135, 0, 0, 0, 35, 58, 360,
+ /* 1660 */ 0, 0, 58, 0, 39, 42, 47, 368, 44, 0,
+ /* 1670 */ 0, 14, 373, 47, 375, 404, 14, 0, 47, 408,
+ /* 1680 */ 40, 0, 411, 412, 413, 414, 415, 416, 39, 418,
+ /* 1690 */ 0, 174, 39, 0, 423, 329, 425, 0, 64, 0,
+ /* 1700 */ 429, 430, 0, 404, 39, 0, 35, 408, 0, 35,
+ /* 1710 */ 411, 412, 413, 414, 415, 416, 48, 418, 329, 39,
+ /* 1720 */ 48, 35, 423, 48, 425, 0, 360, 39, 429, 430,
+ /* 1730 */ 48, 35, 0, 39, 368, 0, 0, 0, 35, 373,
+ /* 1740 */ 104, 375, 22, 102, 0, 35, 35, 35, 35, 360,
+ /* 1750 */ 44, 44, 35, 35, 35, 22, 0, 368, 0, 50,
+ /* 1760 */ 22, 22, 373, 22, 375, 0, 35, 0, 0, 35,
+ /* 1770 */ 404, 0, 22, 20, 408, 35, 0, 411, 412, 413,
+ /* 1780 */ 414, 415, 416, 35, 418, 96, 329, 35, 0, 35,
+ /* 1790 */ 0, 425, 195, 404, 186, 429, 430, 408, 0, 95,
+ /* 1800 */ 411, 412, 413, 414, 415, 416, 329, 418, 164, 95,
+ /* 1810 */ 164, 22, 3, 44, 425, 250, 95, 360, 429, 430,
+ /* 1820 */ 96, 95, 254, 164, 166, 368, 96, 47, 229, 44,
+ /* 1830 */ 373, 44, 375, 47, 250, 44, 172, 360, 171, 96,
+ /* 1840 */ 95, 95, 95, 3, 95, 368, 44, 171, 35, 35,
+ /* 1850 */ 373, 96, 375, 96, 35, 96, 250, 35, 35, 35,
+ /* 1860 */ 96, 404, 96, 47, 44, 408, 0, 0, 411, 412,
+ /* 1870 */ 413, 414, 415, 416, 47, 418, 0, 0, 39, 95,
+ /* 1880 */ 47, 404, 425, 244, 0, 408, 429, 430, 411, 412,
+ /* 1890 */ 413, 414, 415, 416, 95, 418, 329, 96, 39, 96,
+ /* 1900 */ 95, 95, 425, 95, 47, 95, 44, 430, 229, 167,
+ /* 1910 */ 2, 22, 105, 95, 329, 231, 165, 96, 22, 47,
+ /* 1920 */ 229, 95, 47, 208, 96, 95, 95, 360, 96, 95,
+ /* 1930 */ 329, 96, 210, 95, 35, 368, 35, 96, 95, 35,
+ /* 1940 */ 373, 96, 375, 106, 95, 360, 96, 35, 95, 35,
+ /* 1950 */ 96, 95, 35, 368, 96, 95, 22, 44, 373, 107,
+ /* 1960 */ 375, 360, 35, 119, 95, 119, 365, 119, 95, 368,
+ /* 1970 */ 22, 404, 63, 95, 373, 408, 375, 35, 411, 412,
+ /* 1980 */ 413, 414, 415, 416, 119, 418, 64, 35, 35, 404,
+ /* 1990 */ 35, 35, 35, 408, 35, 35, 411, 412, 413, 414,
+ /* 2000 */ 415, 416, 329, 418, 35, 404, 35, 70, 92, 408,
+ /* 2010 */ 44, 35, 411, 412, 413, 414, 415, 416, 35, 418,
+ /* 2020 */ 35, 22, 455, 35, 329, 22, 35, 35, 70, 35,
+ /* 2030 */ 35, 35, 35, 360, 0, 35, 35, 35, 0, 0,
+ /* 2040 */ 0, 368, 35, 0, 39, 35, 373, 39, 375, 464,
+ /* 2050 */ 39, 35, 48, 39, 48, 360, 35, 48, 35, 0,
+ /* 2060 */ 365, 48, 21, 368, 22, 467, 22, 22, 373, 21,
+ /* 2070 */ 375, 20, 467, 467, 467, 467, 467, 404, 467, 467,
+ /* 2080 */ 467, 408, 467, 467, 411, 412, 413, 414, 415, 416,
+ /* 2090 */ 467, 418, 329, 420, 467, 467, 467, 467, 467, 404,
+ /* 2100 */ 467, 467, 467, 408, 467, 467, 411, 412, 413, 414,
+ /* 2110 */ 415, 416, 329, 418, 467, 467, 467, 467, 467, 467,
+ /* 2120 */ 467, 467, 467, 360, 467, 467, 467, 467, 365, 467,
+ /* 2130 */ 467, 368, 467, 467, 467, 467, 373, 467, 375, 467,
+ /* 2140 */ 467, 467, 467, 360, 467, 467, 467, 467, 467, 467,
+ /* 2150 */ 467, 368, 467, 467, 467, 467, 373, 467, 375, 467,
+ /* 2160 */ 467, 467, 467, 467, 467, 467, 467, 404, 467, 467,
+ /* 2170 */ 467, 408, 467, 467, 411, 412, 413, 414, 415, 416,
+ /* 2180 */ 329, 418, 467, 467, 467, 467, 467, 404, 467, 467,
+ /* 2190 */ 467, 408, 467, 467, 411, 412, 413, 414, 415, 416,
+ /* 2200 */ 329, 418, 467, 467, 467, 467, 467, 467, 467, 467,
+ /* 2210 */ 467, 360, 467, 467, 467, 467, 467, 467, 467, 368,
+ /* 2220 */ 467, 467, 467, 467, 373, 467, 375, 467, 467, 467,
+ /* 2230 */ 467, 360, 467, 467, 467, 467, 467, 467, 467, 368,
+ /* 2240 */ 467, 467, 467, 467, 373, 467, 375, 467, 467, 467,
+ /* 2250 */ 467, 467, 467, 467, 467, 404, 467, 329, 467, 408,
+ /* 2260 */ 467, 467, 411, 412, 413, 414, 415, 416, 467, 418,
+ /* 2270 */ 467, 467, 467, 467, 467, 404, 467, 467, 467, 408,
+ /* 2280 */ 467, 467, 411, 412, 413, 414, 415, 416, 360, 418,
+ /* 2290 */ 467, 329, 467, 467, 467, 467, 368, 467, 467, 467,
+ /* 2300 */ 467, 373, 467, 375, 467, 467, 467, 467, 467, 467,
+ /* 2310 */ 467, 467, 467, 467, 467, 467, 467, 467, 467, 329,
+ /* 2320 */ 467, 467, 360, 467, 467, 467, 467, 467, 467, 467,
+ /* 2330 */ 368, 467, 404, 467, 467, 373, 408, 375, 467, 411,
+ /* 2340 */ 412, 413, 414, 415, 416, 467, 418, 467, 467, 467,
+ /* 2350 */ 360, 467, 467, 467, 467, 467, 467, 467, 368, 467,
+ /* 2360 */ 467, 467, 467, 373, 467, 375, 404, 467, 467, 467,
+ /* 2370 */ 408, 467, 467, 411, 412, 413, 414, 415, 416, 329,
+ /* 2380 */ 418, 467, 467, 467, 467, 467, 467, 467, 467, 467,
+ /* 2390 */ 467, 467, 467, 467, 404, 467, 467, 467, 408, 467,
+ /* 2400 */ 329, 411, 412, 413, 414, 415, 416, 467, 418, 467,
+ /* 2410 */ 360, 467, 467, 467, 467, 467, 467, 467, 368, 467,
+ /* 2420 */ 467, 467, 467, 373, 467, 375, 467, 467, 467, 467,
+ /* 2430 */ 467, 360, 467, 467, 467, 467, 467, 467, 467, 368,
+ /* 2440 */ 467, 467, 467, 467, 373, 467, 375, 467, 467, 467,
+ /* 2450 */ 467, 467, 467, 467, 404, 467, 467, 467, 408, 467,
+ /* 2460 */ 467, 411, 412, 413, 414, 415, 416, 467, 418, 467,
+ /* 2470 */ 467, 467, 467, 329, 467, 404, 467, 467, 467, 408,
+ /* 2480 */ 467, 467, 411, 412, 413, 414, 415, 416, 467, 418,
+ /* 2490 */ 467, 467, 467, 467, 467, 467, 467, 329, 467, 467,
+ /* 2500 */ 467, 467, 467, 467, 360, 467, 467, 467, 467, 467,
+ /* 2510 */ 467, 467, 368, 467, 467, 467, 467, 373, 467, 375,
+ /* 2520 */ 467, 467, 467, 467, 467, 467, 467, 467, 360, 467,
+ /* 2530 */ 467, 467, 467, 467, 467, 467, 368, 467, 467, 467,
+ /* 2540 */ 467, 373, 467, 375, 467, 467, 467, 467, 404, 467,
+ /* 2550 */ 467, 467, 408, 467, 329, 411, 412, 413, 414, 415,
+ /* 2560 */ 416, 467, 418, 467, 467, 467, 467, 467, 467, 467,
+ /* 2570 */ 467, 467, 404, 467, 329, 467, 408, 467, 467, 411,
+ /* 2580 */ 412, 413, 414, 415, 416, 360, 418, 467, 467, 467,
+ /* 2590 */ 467, 467, 467, 368, 467, 467, 467, 467, 373, 467,
+ /* 2600 */ 375, 467, 467, 467, 467, 360, 467, 467, 467, 467,
+ /* 2610 */ 467, 467, 467, 368, 467, 467, 467, 467, 373, 467,
+ /* 2620 */ 375, 467, 467, 467, 467, 467, 467, 467, 467, 404,
+ /* 2630 */ 467, 329, 467, 408, 467, 467, 411, 412, 413, 414,
+ /* 2640 */ 415, 416, 467, 418, 467, 467, 467, 467, 467, 404,
+ /* 2650 */ 467, 467, 329, 408, 467, 467, 411, 412, 413, 414,
+ /* 2660 */ 415, 416, 360, 418, 467, 467, 467, 467, 467, 467,
+ /* 2670 */ 368, 467, 467, 467, 467, 373, 467, 375, 467, 467,
+ /* 2680 */ 329, 467, 467, 360, 467, 467, 467, 467, 467, 467,
+ /* 2690 */ 467, 368, 467, 467, 467, 467, 373, 467, 375, 467,
+ /* 2700 */ 467, 467, 467, 467, 467, 467, 404, 467, 467, 467,
+ /* 2710 */ 408, 360, 467, 411, 412, 413, 414, 415, 416, 368,
+ /* 2720 */ 418, 467, 467, 467, 373, 467, 375, 404, 467, 467,
+ /* 2730 */ 467, 408, 467, 467, 411, 412, 413, 414, 415, 416,
+ /* 2740 */ 329, 418, 467, 467, 467, 467, 467, 467, 467, 467,
+ /* 2750 */ 467, 467, 467, 467, 467, 404, 467, 467, 467, 408,
+ /* 2760 */ 467, 329, 411, 412, 413, 414, 415, 416, 467, 418,
+ /* 2770 */ 467, 360, 467, 467, 467, 467, 467, 467, 467, 368,
+ /* 2780 */ 467, 467, 467, 467, 373, 467, 375, 467, 467, 467,
+ /* 2790 */ 467, 467, 360, 467, 467, 467, 467, 467, 467, 467,
+ /* 2800 */ 368, 467, 467, 467, 467, 373, 467, 375, 467, 467,
+ /* 2810 */ 467, 467, 467, 467, 467, 404, 467, 467, 467, 408,
+ /* 2820 */ 467, 467, 411, 412, 413, 414, 415, 416, 467, 418,
+ /* 2830 */ 467, 467, 467, 467, 329, 467, 404, 467, 467, 467,
+ /* 2840 */ 408, 467, 467, 411, 412, 413, 414, 415, 416, 467,
+ /* 2850 */ 418, 467, 467, 467, 467, 467, 467, 467, 329, 467,
+ /* 2860 */ 467, 467, 467, 467, 467, 360, 467, 467, 467, 467,
+ /* 2870 */ 467, 467, 467, 368, 467, 467, 467, 467, 373, 467,
+ /* 2880 */ 375, 467, 467, 467, 467, 467, 467, 467, 467, 360,
+ /* 2890 */ 467, 467, 467, 467, 467, 467, 467, 368, 467, 467,
+ /* 2900 */ 467, 467, 373, 467, 375, 467, 467, 467, 467, 404,
+ /* 2910 */ 467, 467, 467, 408, 467, 329, 411, 412, 413, 414,
+ /* 2920 */ 415, 416, 467, 418, 467, 467, 467, 467, 467, 467,
+ /* 2930 */ 467, 467, 467, 404, 467, 329, 467, 408, 467, 467,
+ /* 2940 */ 411, 412, 413, 414, 415, 416, 360, 418, 467, 467,
+ /* 2950 */ 467, 467, 467, 467, 368, 467, 467, 467, 467, 373,
+ /* 2960 */ 467, 375, 467, 467, 467, 467, 360, 467, 467, 467,
+ /* 2970 */ 467, 467, 467, 467, 368, 467, 467, 467, 467, 373,
+ /* 2980 */ 467, 375, 467, 467, 467, 467, 467, 467, 467, 467,
+ /* 2990 */ 404, 467, 329, 467, 408, 467, 467, 411, 412, 413,
+ /* 3000 */ 414, 415, 416, 467, 418, 467, 467, 467, 467, 467,
+ /* 3010 */ 404, 467, 467, 467, 408, 467, 467, 411, 412, 413,
+ /* 3020 */ 414, 415, 416, 360, 418, 467, 467, 467, 467, 467,
+ /* 3030 */ 467, 368, 467, 467, 467, 467, 373, 467, 375, 467,
+ /* 3040 */ 467, 467, 467, 467, 467, 467, 467, 467, 467, 467,
+ /* 3050 */ 467, 467, 467, 467, 467, 467, 467, 467, 467, 467,
+ /* 3060 */ 467, 467, 467, 467, 467, 467, 467, 404, 467, 467,
+ /* 3070 */ 467, 408, 467, 467, 411, 412, 413, 414, 415, 416,
+ /* 3080 */ 467, 418,
};
#define YY_SHIFT_COUNT (733)
#define YY_SHIFT_MIN (0)
-#define YY_SHIFT_MAX (2084)
+#define YY_SHIFT_MAX (2059)
static const unsigned short int yy_shift_ofst[] = {
/* 0 */ 865, 0, 71, 0, 290, 290, 290, 290, 290, 290,
/* 10 */ 290, 290, 290, 290, 290, 361, 578, 578, 649, 578,
/* 20 */ 578, 578, 578, 578, 578, 578, 578, 578, 578, 578,
/* 30 */ 578, 578, 578, 578, 578, 578, 578, 578, 578, 578,
- /* 40 */ 578, 578, 578, 578, 578, 578, 578, 578, 375, 514,
- /* 50 */ 297, 134, 294, 32, 225, 32, 297, 297, 980, 980,
- /* 60 */ 32, 980, 980, 186, 32, 108, 181, 235, 235, 181,
- /* 70 */ 127, 127, 74, 388, 102, 102, 235, 235, 235, 235,
- /* 80 */ 235, 235, 235, 327, 235, 235, 173, 108, 235, 235,
- /* 90 */ 429, 235, 108, 235, 327, 235, 327, 108, 235, 235,
- /* 100 */ 108, 235, 108, 108, 108, 235, 488, 795, 34, 34,
- /* 110 */ 217, 304, 136, 136, 136, 136, 136, 136, 136, 136,
- /* 120 */ 136, 136, 136, 136, 136, 136, 136, 136, 136, 136,
- /* 130 */ 136, 23, 93, 74, 388, 477, 650, 67, 67, 67,
- /* 140 */ 610, 401, 401, 650, 449, 449, 449, 458, 427, 108,
- /* 150 */ 611, 108, 611, 611, 644, 707, 218, 218, 218, 218,
- /* 160 */ 218, 218, 218, 218, 500, 460, 36, 431, 184, 176,
- /* 170 */ 623, 439, 867, 976, 210, 893, 964, 1039, 1003, 780,
- /* 180 */ 869, 826, 780, 802, 878, 647, 1045, 1247, 1116, 1262,
- /* 190 */ 1291, 1262, 1162, 1306, 1306, 1262, 1162, 1162, 1245, 1306,
- /* 200 */ 1306, 1306, 1320, 1320, 1327, 173, 1330, 173, 1333, 1335,
- /* 210 */ 173, 1333, 173, 173, 173, 1306, 173, 1305, 1305, 1320,
- /* 220 */ 108, 108, 108, 108, 108, 108, 108, 108, 108, 108,
- /* 230 */ 108, 1306, 1320, 611, 611, 1183, 1296, 1327, 488, 1217,
- /* 240 */ 1330, 488, 1306, 1291, 1291, 611, 1159, 1163, 611, 1159,
- /* 250 */ 1163, 611, 611, 108, 1157, 1246, 1159, 1167, 1171, 1187,
- /* 260 */ 1045, 1164, 1175, 1179, 1202, 449, 1430, 1306, 1333, 488,
- /* 270 */ 488, 1446, 1163, 611, 611, 611, 611, 611, 1163, 611,
- /* 280 */ 1328, 488, 644, 488, 449, 1408, 1412, 611, 707, 1306,
- /* 290 */ 488, 1476, 1320, 2952, 2952, 2952, 2952, 2952, 2952, 2952,
- /* 300 */ 2952, 2952, 890, 21, 386, 589, 15, 709, 250, 549,
- /* 310 */ 349, 743, 756, 788, 992, 992, 992, 992, 992, 992,
- /* 320 */ 992, 992, 992, 498, 341, 25, 25, 230, 221, 376,
- /* 330 */ 602, 517, 58, 369, 369, 340, 653, 239, 340, 340,
- /* 340 */ 340, 993, 1056, 289, 1135, 968, 1019, 1053, 1079, 1092,
- /* 350 */ 1083, 1174, 1186, 1043, 1122, 1124, 1139, 1146, 884, 943,
- /* 360 */ 335, 293, 1148, 1156, 1165, 1168, 1169, 1170, 1215, 1176,
- /* 370 */ 130, 1071, 1031, 1193, 1151, 1204, 1205, 1206, 1209, 1211,
- /* 380 */ 1216, 3, 1198, 1234, 1158, 735, 1525, 1526, 1339, 1531,
- /* 390 */ 1536, 1491, 1537, 1504, 1338, 1512, 1514, 1515, 1349, 1552,
- /* 400 */ 1519, 1522, 1359, 1564, 1371, 1574, 1540, 1580, 1559, 1582,
- /* 410 */ 1550, 1401, 1405, 1589, 1590, 1413, 1415, 1591, 1594, 1549,
- /* 420 */ 1597, 1598, 1599, 1561, 1601, 1604, 1605, 1607, 1608, 1609,
- /* 430 */ 1611, 1612, 1468, 1586, 1623, 1473, 1625, 1626, 1628, 1629,
- /* 440 */ 1633, 1635, 1636, 1643, 1646, 1647, 1648, 1649, 1650, 1652,
- /* 450 */ 1654, 1657, 1616, 1659, 1660, 1662, 1663, 1664, 1665, 1645,
- /* 460 */ 1669, 1670, 1671, 1538, 1672, 1674, 1640, 1677, 1620, 1679,
- /* 470 */ 1622, 1681, 1682, 1641, 1651, 1642, 1638, 1673, 1655, 1678,
- /* 480 */ 1667, 1688, 1653, 1658, 1694, 1695, 1698, 1676, 1527, 1699,
- /* 490 */ 1709, 1711, 1661, 1712, 1716, 1683, 1689, 1685, 1720, 1701,
- /* 500 */ 1690, 1702, 1740, 1707, 1697, 1704, 1746, 1713, 1703, 1708,
- /* 510 */ 1749, 1750, 1753, 1754, 1668, 1666, 1721, 1733, 1758, 1725,
- /* 520 */ 1726, 1727, 1728, 1722, 1723, 1729, 1730, 1747, 1736, 1773,
- /* 530 */ 1752, 1775, 1755, 1731, 1776, 1757, 1745, 1782, 1751, 1784,
- /* 540 */ 1765, 1788, 1767, 1770, 1768, 1771, 1610, 1696, 1714, 1793,
- /* 550 */ 1644, 1715, 1772, 1802, 1630, 1789, 1680, 1675, 1812, 1818,
- /* 560 */ 1687, 1684, 1811, 1786, 1565, 1724, 1732, 1737, 1686, 1602,
- /* 570 */ 1692, 1572, 1741, 1792, 1742, 1738, 1759, 1760, 1744, 1798,
- /* 580 */ 1805, 1806, 1763, 1801, 1614, 1769, 1774, 1846, 1815, 1617,
- /* 590 */ 1826, 1831, 1834, 1836, 1837, 1839, 1780, 1781, 1832, 1637,
- /* 600 */ 1840, 1833, 1883, 1891, 1894, 1896, 1803, 1858, 1638, 1852,
- /* 610 */ 1807, 1804, 1808, 1810, 1821, 1756, 1823, 1909, 1880, 1764,
- /* 620 */ 1825, 1816, 1638, 1875, 1881, 1706, 1693, 1734, 1926, 1908,
- /* 630 */ 1743, 1838, 1841, 1843, 1853, 1847, 1856, 1885, 1860, 1861,
- /* 640 */ 1906, 1862, 1935, 1761, 1864, 1855, 1866, 1929, 1930, 1871,
- /* 650 */ 1872, 1932, 1877, 1878, 1940, 1887, 1888, 1951, 1892, 1893,
- /* 660 */ 1953, 1895, 1851, 1873, 1876, 1879, 1971, 1898, 1899, 1956,
- /* 670 */ 1902, 1966, 1912, 1956, 1956, 1980, 1939, 1945, 1974, 1975,
- /* 680 */ 1976, 1977, 1978, 1979, 1982, 1983, 1984, 1985, 1952, 1923,
- /* 690 */ 1981, 1988, 1991, 1992, 2006, 1995, 1997, 1998, 1965, 1722,
- /* 700 */ 2001, 1723, 2002, 2004, 2005, 2014, 2029, 2017, 2053, 2019,
- /* 710 */ 2007, 2018, 2056, 2023, 2012, 2022, 2062, 2030, 2024, 2035,
- /* 720 */ 2075, 2041, 2031, 2038, 2080, 2046, 2047, 2084, 2063, 2066,
- /* 730 */ 2067, 2068, 2071, 2074,
+ /* 40 */ 578, 578, 578, 578, 578, 578, 578, 578, 289, 405,
+ /* 50 */ 460, 216, 70, 241, 376, 241, 216, 216, 1383, 1383,
+ /* 60 */ 241, 1383, 1383, 426, 241, 110, 517, 286, 286, 517,
+ /* 70 */ 186, 186, 326, 172, 1, 1, 286, 286, 286, 286,
+ /* 80 */ 286, 286, 286, 380, 286, 286, 398, 110, 286, 286,
+ /* 90 */ 450, 286, 110, 286, 380, 286, 380, 110, 286, 286,
+ /* 100 */ 110, 286, 110, 110, 110, 286, 415, 795, 34, 34,
+ /* 110 */ 217, 826, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067,
+ /* 120 */ 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067,
+ /* 130 */ 1067, 152, 672, 326, 172, 173, 422, 407, 407, 407,
+ /* 140 */ 393, 336, 336, 422, 518, 518, 518, 456, 507, 110,
+ /* 150 */ 713, 110, 713, 713, 645, 738, 36, 36, 36, 36,
+ /* 160 */ 36, 36, 36, 36, 583, 313, 474, 974, 249, 119,
+ /* 170 */ 413, 589, 335, 694, 299, 650, 862, 924, 685, 688,
+ /* 180 */ 446, 852, 688, 1081, 348, 615, 1068, 1259, 1139, 1280,
+ /* 190 */ 1304, 1280, 1170, 1310, 1310, 1280, 1170, 1170, 1254, 1310,
+ /* 200 */ 1310, 1310, 1336, 1336, 1339, 398, 1342, 398, 1348, 1356,
+ /* 210 */ 398, 1348, 398, 398, 398, 1310, 398, 1338, 1338, 1336,
+ /* 220 */ 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
+ /* 230 */ 110, 1310, 1336, 713, 713, 1213, 1309, 1339, 415, 1221,
+ /* 240 */ 1342, 415, 1310, 1304, 1304, 713, 1157, 1180, 713, 1157,
+ /* 250 */ 1180, 713, 713, 110, 1174, 1265, 1157, 1185, 1181, 1210,
+ /* 260 */ 1068, 1190, 1201, 1196, 1229, 518, 1458, 1310, 1348, 415,
+ /* 270 */ 415, 1484, 1180, 713, 713, 713, 713, 713, 1180, 713,
+ /* 280 */ 1349, 415, 645, 415, 518, 1426, 1428, 713, 738, 1310,
+ /* 290 */ 415, 1492, 1336, 3082, 3082, 3082, 3082, 3082, 3082, 3082,
+ /* 300 */ 3082, 3082, 890, 274, 702, 981, 453, 708, 905, 1002,
+ /* 310 */ 995, 1011, 1133, 1073, 1177, 1177, 1177, 1177, 1177, 1177,
+ /* 320 */ 1177, 1177, 1177, 260, 208, 86, 86, 528, 365, 4,
+ /* 330 */ 1024, 818, 592, 755, 755, 165, 608, 384, 165, 165,
+ /* 340 */ 165, 230, 1110, 690, 1131, 1008, 724, 1017, 1095, 1106,
+ /* 350 */ 1055, 1156, 1187, 1144, 1152, 1149, 1167, 1169, 1050, 99,
+ /* 360 */ 222, 1059, 1171, 1172, 1194, 1198, 1203, 1205, 1231, 1207,
+ /* 370 */ 982, 1058, 1047, 1168, 1178, 1209, 1212, 1214, 1215, 1216,
+ /* 380 */ 1217, 901, 1274, 1279, 1192, 1237, 1539, 1541, 1543, 1502,
+ /* 390 */ 1546, 1512, 1346, 1514, 1515, 1516, 1350, 1553, 1519, 1520,
+ /* 400 */ 1354, 1557, 1357, 1558, 1525, 1561, 1540, 1563, 1529, 1375,
+ /* 410 */ 1382, 1386, 1570, 1572, 1573, 1395, 1397, 1576, 1577, 1531,
+ /* 420 */ 1580, 1581, 1582, 1545, 1583, 1588, 1589, 1590, 1593, 1594,
+ /* 430 */ 1595, 1596, 1434, 1562, 1598, 1448, 1611, 1612, 1613, 1614,
+ /* 440 */ 1616, 1617, 1618, 1620, 1621, 1630, 1632, 1633, 1635, 1637,
+ /* 450 */ 1638, 1642, 1559, 1602, 1603, 1643, 1645, 1647, 1648, 1627,
+ /* 460 */ 1650, 1651, 1652, 1518, 1654, 1655, 1622, 1656, 1600, 1660,
+ /* 470 */ 1604, 1661, 1663, 1623, 1625, 1624, 1619, 1657, 1626, 1662,
+ /* 480 */ 1631, 1669, 1640, 1649, 1670, 1677, 1681, 1653, 1517, 1690,
+ /* 490 */ 1693, 1697, 1634, 1699, 1702, 1671, 1668, 1665, 1705, 1674,
+ /* 500 */ 1672, 1680, 1708, 1686, 1675, 1688, 1725, 1696, 1682, 1694,
+ /* 510 */ 1732, 1735, 1736, 1737, 1636, 1641, 1703, 1720, 1744, 1710,
+ /* 520 */ 1711, 1712, 1713, 1706, 1707, 1717, 1718, 1733, 1719, 1756,
+ /* 530 */ 1738, 1758, 1739, 1709, 1765, 1741, 1731, 1767, 1734, 1768,
+ /* 540 */ 1740, 1771, 1750, 1753, 1748, 1752, 1597, 1689, 1704, 1776,
+ /* 550 */ 1644, 1714, 1754, 1788, 1608, 1789, 1646, 1658, 1790, 1798,
+ /* 560 */ 1659, 1664, 1809, 1769, 1565, 1721, 1724, 1726, 1667, 1599,
+ /* 570 */ 1676, 1568, 1730, 1785, 1743, 1745, 1746, 1747, 1755, 1787,
+ /* 580 */ 1780, 1786, 1749, 1791, 1584, 1757, 1759, 1840, 1802, 1606,
+ /* 590 */ 1813, 1814, 1819, 1822, 1823, 1824, 1764, 1766, 1816, 1639,
+ /* 600 */ 1820, 1827, 1866, 1867, 1876, 1877, 1784, 1839, 1619, 1833,
+ /* 610 */ 1799, 1801, 1803, 1805, 1806, 1742, 1808, 1884, 1859, 1751,
+ /* 620 */ 1810, 1807, 1619, 1857, 1862, 1679, 1684, 1691, 1908, 1889,
+ /* 630 */ 1715, 1818, 1821, 1826, 1828, 1830, 1832, 1872, 1831, 1834,
+ /* 640 */ 1875, 1835, 1896, 1722, 1838, 1837, 1841, 1899, 1901, 1843,
+ /* 650 */ 1845, 1904, 1849, 1850, 1912, 1853, 1854, 1914, 1856, 1858,
+ /* 660 */ 1917, 1860, 1844, 1846, 1848, 1865, 1934, 1852, 1869, 1913,
+ /* 670 */ 1873, 1927, 1878, 1913, 1913, 1948, 1922, 1909, 1942, 1952,
+ /* 680 */ 1953, 1955, 1956, 1957, 1959, 1960, 1969, 1971, 1937, 1916,
+ /* 690 */ 1966, 1976, 1983, 1985, 1999, 1988, 1991, 1992, 1958, 1706,
+ /* 700 */ 1994, 1707, 1995, 1996, 1997, 2000, 2003, 2001, 2034, 2002,
+ /* 710 */ 2004, 2005, 2038, 2007, 2006, 2008, 2039, 2010, 2009, 2011,
+ /* 720 */ 2040, 2016, 2013, 2014, 2043, 2021, 2023, 2059, 2042, 2041,
+ /* 730 */ 2044, 2045, 2048, 2051,
};
#define YY_REDUCE_COUNT (301)
-#define YY_REDUCE_MIN (-435)
-#define YY_REDUCE_MAX (2534)
+#define YY_REDUCE_MIN (-432)
+#define YY_REDUCE_MAX (2663)
static const short yy_reduce_ofst[] = {
- /* 0 */ 276, -268, 720, 747, 812, 870, 903, 961, 1041, 1064,
- /* 10 */ 1131, 1155, 1203, 1227, 1293, 1316, 291, 1384, 1410, 1475,
- /* 20 */ 1500, 1533, 1566, 1631, 1656, 1718, 1735, 1795, 1814, 1874,
- /* 30 */ 1890, 1907, 1970, 1986, 2042, 2065, 2129, 2156, 2204, 2220,
- /* 40 */ 2268, 2316, 2339, 2372, 2395, 2459, 2486, 2534, -31, 107,
- /* 50 */ -256, 105, 179, 444, 591, 599, 29, 417, -355, -318,
- /* 60 */ 273, 479, 702, -435, 558, -296, 51, -201, 295, -375,
- /* 70 */ -327, -28, -315, -289, 142, 188, -334, 191, 411, 487,
- /* 80 */ 541, 542, 560, 215, 561, 652, 464, -212, 660, 675,
- /* 90 */ -108, 685, 247, 693, 266, 711, 389, -350, 730, 745,
- /* 100 */ 407, 748, -295, 459, 471, 749, -204, -305, 2, 2,
- /* 110 */ -123, 106, 75, 315, 320, 447, 518, 622, 659, 692,
- /* 120 */ 704, 705, 729, 755, 763, 772, 774, 783, 797, 800,
- /* 130 */ 822, -219, -37, -60, 242, -164, 368, -37, 183, 203,
- /* 140 */ 496, 357, 387, 392, 448, 553, 554, 240, 277, -301,
- /* 150 */ 469, 547, 557, 612, 374, 636, -357, 453, 472, 495,
- /* 160 */ 533, 712, 792, 533, -385, 760, 761, 801, 767, 804,
- /* 170 */ 915, 811, 899, 899, 923, 885, 931, 898, 891, 837,
- /* 180 */ 837, 829, 837, 849, 847, 899, 886, 892, 909, 928,
- /* 190 */ 936, 942, 946, 991, 996, 950, 957, 959, 994, 1004,
- /* 200 */ 1006, 1007, 1014, 1015, 951, 1005, 977, 1008, 1016, 963,
- /* 210 */ 1017, 1020, 1018, 1022, 1023, 1025, 1024, 1029, 1037, 1028,
- /* 220 */ 1021, 1026, 1027, 1032, 1034, 1035, 1036, 1038, 1042, 1044,
- /* 230 */ 1046, 1047, 1048, 990, 1009, 986, 997, 1001, 1062, 1010,
- /* 240 */ 1033, 1069, 1074, 1030, 1040, 1049, 966, 1050, 1052, 971,
- /* 250 */ 1054, 1055, 1057, 899, 972, 978, 981, 984, 989, 998,
- /* 260 */ 1059, 975, 987, 999, 837, 1081, 1063, 1125, 1121, 1120,
- /* 270 */ 1127, 1087, 1094, 1110, 1112, 1114, 1117, 1123, 1101, 1128,
- /* 280 */ 1113, 1154, 1141, 1161, 1132, 1078, 1144, 1136, 1160, 1177,
- /* 290 */ 1172, 1184, 1180, 1126, 1118, 1129, 1130, 1166, 1173, 1181,
- /* 300 */ 1182, 1195,
+ /* 0 */ 164, 683, 747, 806, 866, 925, 959, 1052, 1072, 1211,
+ /* 10 */ 1271, 1299, 1366, 1389, 1457, -293, -3, 68, 1477, 285,
+ /* 20 */ 1567, 1585, 1601, 1673, 1695, 1763, 1783, 1851, 1871, 1928,
+ /* 30 */ 1962, 1990, 2050, 2071, 2144, 2168, 2225, 2245, 2302, 2323,
+ /* 40 */ 2351, 2411, 2432, 2505, 2529, 2586, 2606, 2663, -263, -349,
+ /* 50 */ 298, 341, -385, -255, 162, 624, -17, 159, -354, -322,
+ /* 60 */ -432, -339, -231, -400, 171, -52, -359, -4, 399, -331,
+ /* 70 */ -333, 23, -343, -235, 100, 108, 183, 191, 199, 278,
+ /* 80 */ 306, 470, 479, -23, 482, 543, -106, -176, 561, 647,
+ /* 90 */ 193, 654, 287, 681, 297, 684, 378, -279, 696, 699,
+ /* 100 */ 292, 711, 475, 382, 477, 737, 51, -311, -317, -317,
+ /* 110 */ -214, -139, -328, -11, 53, 122, 436, 451, 522, 524,
+ /* 120 */ 549, 550, 555, 622, 664, 717, 730, 731, 754, 763,
+ /* 130 */ 771, -294, -41, 72, -178, 321, 179, -41, -7, 194,
+ /* 140 */ 447, 347, 463, 309, 154, 452, 537, -267, 255, -266,
+ /* 150 */ 557, 668, 770, 780, 701, 395, -355, -351, 498, 535,
+ /* 160 */ 631, 669, 677, 631, 687, 794, 790, 769, 692, 715,
+ /* 170 */ 859, 796, 868, 868, 906, 883, 933, 899, 889, 844,
+ /* 180 */ 844, 846, 844, 871, 873, 868, 911, 913, 927, 943,
+ /* 190 */ 942, 946, 950, 998, 1005, 964, 967, 968, 1004, 1014,
+ /* 200 */ 1015, 1016, 1026, 1027, 961, 1018, 989, 1023, 1031, 985,
+ /* 210 */ 1036, 1042, 1040, 1043, 1044, 1048, 1049, 1051, 1053, 1063,
+ /* 220 */ 1037, 1038, 1046, 1054, 1057, 1061, 1062, 1064, 1066, 1069,
+ /* 230 */ 1070, 1065, 1076, 1030, 1035, 997, 1010, 1020, 1074, 1025,
+ /* 240 */ 1056, 1087, 1096, 1060, 1071, 1075, 987, 1083, 1077, 990,
+ /* 250 */ 1084, 1078, 1079, 868, 988, 993, 999, 1009, 1012, 1029,
+ /* 260 */ 1085, 992, 1019, 1034, 844, 1121, 1086, 1161, 1165, 1153,
+ /* 270 */ 1158, 1119, 1118, 1134, 1135, 1136, 1137, 1138, 1125, 1141,
+ /* 280 */ 1132, 1175, 1162, 1179, 1151, 1094, 1160, 1154, 1176, 1188,
+ /* 290 */ 1189, 1197, 1200, 1140, 1142, 1143, 1145, 1182, 1183, 1184,
+ /* 300 */ 1191, 1218,
};
static const YYACTIONTYPE yy_default[] = {
- /* 0 */ 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643,
- /* 10 */ 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643,
- /* 20 */ 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643,
- /* 30 */ 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643,
- /* 40 */ 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643,
- /* 50 */ 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643,
- /* 60 */ 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643,
- /* 70 */ 1643, 1643, 1900, 1643, 1643, 1643, 1643, 1643, 1643, 1643,
- /* 80 */ 1643, 1643, 1643, 1643, 1643, 1643, 1721, 1643, 1643, 1643,
- /* 90 */ 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643,
- /* 100 */ 1643, 1643, 1643, 1643, 1643, 1643, 1719, 1893, 2105, 1643,
- /* 110 */ 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643,
- /* 120 */ 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643,
- /* 130 */ 1643, 1643, 2117, 1643, 1643, 1721, 1643, 2117, 2117, 2117,
- /* 140 */ 1719, 2077, 2077, 1643, 1643, 1643, 1643, 1953, 1643, 1643,
- /* 150 */ 1643, 1643, 1643, 1643, 1828, 1643, 1643, 1643, 1643, 1643,
- /* 160 */ 1852, 1643, 1643, 1643, 1945, 1643, 1643, 2142, 2196, 1643,
- /* 170 */ 1643, 2145, 1643, 1643, 1643, 1905, 1643, 1781, 2132, 2109,
- /* 180 */ 2123, 2180, 2110, 2107, 2126, 1643, 2136, 1643, 1938, 1898,
- /* 190 */ 1643, 1898, 1895, 1643, 1643, 1898, 1895, 1895, 1772, 1643,
- /* 200 */ 1643, 1643, 1643, 1643, 1643, 1721, 1643, 1721, 1643, 1643,
- /* 210 */ 1721, 1643, 1721, 1721, 1721, 1643, 1721, 1700, 1700, 1643,
- /* 220 */ 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643,
- /* 230 */ 1643, 1643, 1643, 1643, 1643, 1963, 1951, 1643, 1719, 1947,
- /* 240 */ 1643, 1719, 1643, 1643, 1643, 1643, 2153, 2151, 1643, 2153,
- /* 250 */ 2151, 1643, 1643, 1643, 2165, 2161, 2153, 2169, 2167, 2138,
- /* 260 */ 2136, 2199, 2186, 2182, 2123, 1643, 1643, 1643, 1643, 1719,
- /* 270 */ 1719, 1643, 2151, 1643, 1643, 1643, 1643, 1643, 2151, 1643,
- /* 280 */ 1643, 1719, 1643, 1719, 1643, 1643, 1797, 1643, 1643, 1643,
- /* 290 */ 1719, 1675, 1643, 1940, 1956, 1923, 1923, 1831, 1831, 1831,
- /* 300 */ 1722, 1648, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643,
- /* 310 */ 1643, 1643, 1643, 1643, 2164, 2163, 2032, 1643, 2081, 2080,
- /* 320 */ 2079, 2070, 2031, 1793, 1643, 2030, 2029, 1643, 1643, 1643,
- /* 330 */ 1643, 1643, 1643, 1914, 1913, 2023, 1643, 1643, 2024, 2022,
- /* 340 */ 2021, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643,
- /* 350 */ 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 2183,
- /* 360 */ 2187, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 2106, 1643,
- /* 370 */ 1643, 1643, 1643, 1643, 2005, 1643, 1643, 1643, 1643, 1643,
- /* 380 */ 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643,
- /* 390 */ 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643,
- /* 400 */ 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643,
- /* 410 */ 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643,
- /* 420 */ 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643,
- /* 430 */ 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643,
- /* 440 */ 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643,
- /* 450 */ 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643,
- /* 460 */ 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643,
- /* 470 */ 1643, 1643, 1643, 1643, 1643, 1680, 2010, 1643, 1643, 1643,
- /* 480 */ 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643,
- /* 490 */ 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643,
- /* 500 */ 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643,
- /* 510 */ 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643,
- /* 520 */ 1643, 1643, 1643, 1760, 1759, 1643, 1643, 1643, 1643, 1643,
- /* 530 */ 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643,
- /* 540 */ 1643, 1643, 1643, 1643, 1643, 1643, 1643, 2014, 1643, 1643,
- /* 550 */ 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643,
- /* 560 */ 1643, 1643, 2179, 2139, 1643, 1643, 1643, 1643, 1643, 1643,
- /* 570 */ 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643,
- /* 580 */ 1643, 2005, 1643, 2162, 1643, 1643, 2177, 1643, 2181, 1643,
- /* 590 */ 1643, 1643, 1643, 1643, 1643, 1643, 2116, 2112, 1643, 1643,
- /* 600 */ 2108, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 2013, 1643,
- /* 610 */ 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643,
- /* 620 */ 1643, 1643, 2004, 1643, 2067, 1643, 1643, 1643, 2101, 1643,
- /* 630 */ 1643, 2052, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643,
- /* 640 */ 1643, 2014, 1643, 2017, 1643, 1643, 1643, 1643, 1643, 1825,
- /* 650 */ 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643,
- /* 660 */ 1643, 1643, 1810, 1808, 1807, 1806, 1643, 1803, 1643, 1838,
- /* 670 */ 1643, 1643, 1643, 1834, 1833, 1643, 1643, 1643, 1643, 1643,
- /* 680 */ 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643,
- /* 690 */ 1740, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1732,
- /* 700 */ 1643, 1731, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643,
- /* 710 */ 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643,
- /* 720 */ 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643,
- /* 730 */ 1643, 1643, 1643, 1643,
+ /* 0 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647,
+ /* 10 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647,
+ /* 20 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647,
+ /* 30 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647,
+ /* 40 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647,
+ /* 50 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647,
+ /* 60 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647,
+ /* 70 */ 1647, 1647, 1904, 1647, 1647, 1647, 1647, 1647, 1647, 1647,
+ /* 80 */ 1647, 1647, 1647, 1647, 1647, 1647, 1725, 1647, 1647, 1647,
+ /* 90 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647,
+ /* 100 */ 1647, 1647, 1647, 1647, 1647, 1647, 1723, 1897, 2111, 1647,
+ /* 110 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647,
+ /* 120 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647,
+ /* 130 */ 1647, 1647, 2123, 1647, 1647, 1725, 1647, 2123, 2123, 2123,
+ /* 140 */ 1723, 2083, 2083, 1647, 1647, 1647, 1647, 1958, 1647, 1647,
+ /* 150 */ 1647, 1647, 1647, 1647, 1832, 1647, 1647, 1647, 1647, 1647,
+ /* 160 */ 1856, 1647, 1647, 1647, 1950, 1647, 1647, 2148, 2202, 1647,
+ /* 170 */ 1647, 2151, 1647, 1647, 1647, 1909, 1647, 1785, 2138, 2115,
+ /* 180 */ 2129, 2186, 2116, 2113, 2132, 1647, 2142, 1647, 1943, 1902,
+ /* 190 */ 1647, 1902, 1899, 1647, 1647, 1902, 1899, 1899, 1776, 1647,
+ /* 200 */ 1647, 1647, 1647, 1647, 1647, 1725, 1647, 1725, 1647, 1647,
+ /* 210 */ 1725, 1647, 1725, 1725, 1725, 1647, 1725, 1704, 1704, 1647,
+ /* 220 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647,
+ /* 230 */ 1647, 1647, 1647, 1647, 1647, 1968, 1956, 1647, 1723, 1952,
+ /* 240 */ 1647, 1723, 1647, 1647, 1647, 1647, 2159, 2157, 1647, 2159,
+ /* 250 */ 2157, 1647, 1647, 1647, 2171, 2167, 2159, 2175, 2173, 2144,
+ /* 260 */ 2142, 2205, 2192, 2188, 2129, 1647, 1647, 1647, 1647, 1723,
+ /* 270 */ 1723, 1647, 2157, 1647, 1647, 1647, 1647, 1647, 2157, 1647,
+ /* 280 */ 1647, 1723, 1647, 1723, 1647, 1647, 1801, 1647, 1647, 1647,
+ /* 290 */ 1723, 1679, 1647, 1945, 1961, 1927, 1927, 1835, 1835, 1835,
+ /* 300 */ 1726, 1652, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647,
+ /* 310 */ 1647, 1647, 1647, 1647, 2170, 2169, 2038, 1647, 2087, 2086,
+ /* 320 */ 2085, 2076, 2037, 1797, 1647, 2036, 2035, 1647, 1647, 1647,
+ /* 330 */ 1647, 1647, 1647, 1918, 1917, 2029, 1647, 1647, 2030, 2028,
+ /* 340 */ 2027, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647,
+ /* 350 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 2189,
+ /* 360 */ 2193, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 2112, 1647,
+ /* 370 */ 1647, 1647, 1647, 1647, 2011, 1647, 1647, 1647, 1647, 1647,
+ /* 380 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647,
+ /* 390 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647,
+ /* 400 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647,
+ /* 410 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647,
+ /* 420 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647,
+ /* 430 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647,
+ /* 440 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647,
+ /* 450 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647,
+ /* 460 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647,
+ /* 470 */ 1647, 1647, 1647, 1647, 1647, 1684, 2016, 1647, 1647, 1647,
+ /* 480 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647,
+ /* 490 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647,
+ /* 500 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647,
+ /* 510 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647,
+ /* 520 */ 1647, 1647, 1647, 1764, 1763, 1647, 1647, 1647, 1647, 1647,
+ /* 530 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647,
+ /* 540 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 2020, 1647, 1647,
+ /* 550 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647,
+ /* 560 */ 1647, 1647, 2185, 2145, 1647, 1647, 1647, 1647, 1647, 1647,
+ /* 570 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647,
+ /* 580 */ 1647, 2011, 1647, 2168, 1647, 1647, 2183, 1647, 2187, 1647,
+ /* 590 */ 1647, 1647, 1647, 1647, 1647, 1647, 2122, 2118, 1647, 1647,
+ /* 600 */ 2114, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 2019, 1647,
+ /* 610 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647,
+ /* 620 */ 1647, 1647, 2010, 1647, 2073, 1647, 1647, 1647, 2107, 1647,
+ /* 630 */ 1647, 2058, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647,
+ /* 640 */ 1647, 2020, 1647, 2023, 1647, 1647, 1647, 1647, 1647, 1829,
+ /* 650 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647,
+ /* 660 */ 1647, 1647, 1814, 1812, 1811, 1810, 1647, 1807, 1647, 1842,
+ /* 670 */ 1647, 1647, 1647, 1838, 1837, 1647, 1647, 1647, 1647, 1647,
+ /* 680 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647,
+ /* 690 */ 1744, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1736,
+ /* 700 */ 1647, 1735, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647,
+ /* 710 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647,
+ /* 720 */ 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647,
+ /* 730 */ 1647, 1647, 1647, 1647,
};
/********** End of lemon-generated parsing tables *****************************/
@@ -1831,76 +1857,77 @@ static const char *const yyTokenName[] = {
/* 393 */ "cgroup_name",
/* 394 */ "analyze_opt",
/* 395 */ "explain_options",
- /* 396 */ "agg_func_opt",
- /* 397 */ "bufsize_opt",
- /* 398 */ "stream_name",
- /* 399 */ "stream_options",
- /* 400 */ "col_list_opt",
- /* 401 */ "tag_def_or_ref_opt",
- /* 402 */ "subtable_opt",
- /* 403 */ "expression",
- /* 404 */ "dnode_list",
- /* 405 */ "where_clause_opt",
- /* 406 */ "signed",
- /* 407 */ "literal_func",
- /* 408 */ "literal_list",
- /* 409 */ "table_alias",
- /* 410 */ "expr_or_subquery",
- /* 411 */ "pseudo_column",
- /* 412 */ "column_reference",
- /* 413 */ "function_expression",
- /* 414 */ "case_when_expression",
- /* 415 */ "star_func",
- /* 416 */ "star_func_para_list",
- /* 417 */ "noarg_func",
- /* 418 */ "other_para_list",
- /* 419 */ "star_func_para",
- /* 420 */ "when_then_list",
- /* 421 */ "case_when_else_opt",
- /* 422 */ "common_expression",
- /* 423 */ "when_then_expr",
- /* 424 */ "predicate",
- /* 425 */ "compare_op",
- /* 426 */ "in_op",
- /* 427 */ "in_predicate_value",
- /* 428 */ "boolean_value_expression",
- /* 429 */ "boolean_primary",
- /* 430 */ "from_clause_opt",
- /* 431 */ "table_reference_list",
- /* 432 */ "table_reference",
- /* 433 */ "table_primary",
- /* 434 */ "joined_table",
- /* 435 */ "alias_opt",
- /* 436 */ "subquery",
- /* 437 */ "parenthesized_joined_table",
- /* 438 */ "join_type",
- /* 439 */ "search_condition",
- /* 440 */ "query_specification",
- /* 441 */ "set_quantifier_opt",
- /* 442 */ "select_list",
- /* 443 */ "partition_by_clause_opt",
- /* 444 */ "range_opt",
- /* 445 */ "every_opt",
- /* 446 */ "fill_opt",
- /* 447 */ "twindow_clause_opt",
- /* 448 */ "group_by_clause_opt",
- /* 449 */ "having_clause_opt",
- /* 450 */ "select_item",
- /* 451 */ "partition_list",
- /* 452 */ "partition_item",
- /* 453 */ "fill_mode",
- /* 454 */ "group_by_list",
- /* 455 */ "query_expression",
- /* 456 */ "query_simple",
- /* 457 */ "order_by_clause_opt",
- /* 458 */ "slimit_clause_opt",
- /* 459 */ "limit_clause_opt",
- /* 460 */ "union_query_expression",
- /* 461 */ "query_simple_or_subquery",
- /* 462 */ "sort_specification_list",
- /* 463 */ "sort_specification",
- /* 464 */ "ordering_specification_opt",
- /* 465 */ "null_ordering_opt",
+ /* 396 */ "insert_query",
+ /* 397 */ "agg_func_opt",
+ /* 398 */ "bufsize_opt",
+ /* 399 */ "stream_name",
+ /* 400 */ "stream_options",
+ /* 401 */ "col_list_opt",
+ /* 402 */ "tag_def_or_ref_opt",
+ /* 403 */ "subtable_opt",
+ /* 404 */ "expression",
+ /* 405 */ "dnode_list",
+ /* 406 */ "where_clause_opt",
+ /* 407 */ "signed",
+ /* 408 */ "literal_func",
+ /* 409 */ "literal_list",
+ /* 410 */ "table_alias",
+ /* 411 */ "expr_or_subquery",
+ /* 412 */ "pseudo_column",
+ /* 413 */ "column_reference",
+ /* 414 */ "function_expression",
+ /* 415 */ "case_when_expression",
+ /* 416 */ "star_func",
+ /* 417 */ "star_func_para_list",
+ /* 418 */ "noarg_func",
+ /* 419 */ "other_para_list",
+ /* 420 */ "star_func_para",
+ /* 421 */ "when_then_list",
+ /* 422 */ "case_when_else_opt",
+ /* 423 */ "common_expression",
+ /* 424 */ "when_then_expr",
+ /* 425 */ "predicate",
+ /* 426 */ "compare_op",
+ /* 427 */ "in_op",
+ /* 428 */ "in_predicate_value",
+ /* 429 */ "boolean_value_expression",
+ /* 430 */ "boolean_primary",
+ /* 431 */ "from_clause_opt",
+ /* 432 */ "table_reference_list",
+ /* 433 */ "table_reference",
+ /* 434 */ "table_primary",
+ /* 435 */ "joined_table",
+ /* 436 */ "alias_opt",
+ /* 437 */ "subquery",
+ /* 438 */ "parenthesized_joined_table",
+ /* 439 */ "join_type",
+ /* 440 */ "search_condition",
+ /* 441 */ "query_specification",
+ /* 442 */ "set_quantifier_opt",
+ /* 443 */ "select_list",
+ /* 444 */ "partition_by_clause_opt",
+ /* 445 */ "range_opt",
+ /* 446 */ "every_opt",
+ /* 447 */ "fill_opt",
+ /* 448 */ "twindow_clause_opt",
+ /* 449 */ "group_by_clause_opt",
+ /* 450 */ "having_clause_opt",
+ /* 451 */ "select_item",
+ /* 452 */ "partition_list",
+ /* 453 */ "partition_item",
+ /* 454 */ "fill_mode",
+ /* 455 */ "group_by_list",
+ /* 456 */ "query_expression",
+ /* 457 */ "query_simple",
+ /* 458 */ "order_by_clause_opt",
+ /* 459 */ "slimit_clause_opt",
+ /* 460 */ "limit_clause_opt",
+ /* 461 */ "union_query_expression",
+ /* 462 */ "query_simple_or_subquery",
+ /* 463 */ "sort_specification_list",
+ /* 464 */ "sort_specification",
+ /* 465 */ "ordering_specification_opt",
+ /* 466 */ "null_ordering_opt",
};
#endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
@@ -2200,270 +2227,272 @@ static const char *const yyRuleName[] = {
/* 289 */ "cmd ::= DESCRIBE full_table_name",
/* 290 */ "cmd ::= RESET QUERY CACHE",
/* 291 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery",
- /* 292 */ "analyze_opt ::=",
- /* 293 */ "analyze_opt ::= ANALYZE",
- /* 294 */ "explain_options ::=",
- /* 295 */ "explain_options ::= explain_options VERBOSE NK_BOOL",
- /* 296 */ "explain_options ::= explain_options RATIO NK_FLOAT",
- /* 297 */ "cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt",
- /* 298 */ "cmd ::= DROP FUNCTION exists_opt function_name",
- /* 299 */ "agg_func_opt ::=",
- /* 300 */ "agg_func_opt ::= AGGREGATE",
- /* 301 */ "bufsize_opt ::=",
- /* 302 */ "bufsize_opt ::= BUFSIZE NK_INTEGER",
- /* 303 */ "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",
- /* 304 */ "cmd ::= DROP STREAM exists_opt stream_name",
- /* 305 */ "col_list_opt ::=",
- /* 306 */ "col_list_opt ::= NK_LP col_name_list NK_RP",
- /* 307 */ "tag_def_or_ref_opt ::=",
- /* 308 */ "tag_def_or_ref_opt ::= tags_def",
- /* 309 */ "tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP",
- /* 310 */ "stream_options ::=",
- /* 311 */ "stream_options ::= stream_options TRIGGER AT_ONCE",
- /* 312 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE",
- /* 313 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal",
- /* 314 */ "stream_options ::= stream_options WATERMARK duration_literal",
- /* 315 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER",
- /* 316 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER",
- /* 317 */ "subtable_opt ::=",
- /* 318 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP",
- /* 319 */ "cmd ::= KILL CONNECTION NK_INTEGER",
- /* 320 */ "cmd ::= KILL QUERY NK_STRING",
- /* 321 */ "cmd ::= KILL TRANSACTION NK_INTEGER",
- /* 322 */ "cmd ::= BALANCE VGROUP",
- /* 323 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER",
- /* 324 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list",
- /* 325 */ "cmd ::= SPLIT VGROUP NK_INTEGER",
- /* 326 */ "dnode_list ::= DNODE NK_INTEGER",
- /* 327 */ "dnode_list ::= dnode_list DNODE NK_INTEGER",
- /* 328 */ "cmd ::= DELETE FROM full_table_name where_clause_opt",
- /* 329 */ "cmd ::= query_or_subquery",
- /* 330 */ "cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery",
- /* 331 */ "cmd ::= INSERT INTO full_table_name query_or_subquery",
- /* 332 */ "literal ::= NK_INTEGER",
- /* 333 */ "literal ::= NK_FLOAT",
- /* 334 */ "literal ::= NK_STRING",
- /* 335 */ "literal ::= NK_BOOL",
- /* 336 */ "literal ::= TIMESTAMP NK_STRING",
- /* 337 */ "literal ::= duration_literal",
- /* 338 */ "literal ::= NULL",
- /* 339 */ "literal ::= NK_QUESTION",
- /* 340 */ "duration_literal ::= NK_VARIABLE",
- /* 341 */ "signed ::= NK_INTEGER",
- /* 342 */ "signed ::= NK_PLUS NK_INTEGER",
- /* 343 */ "signed ::= NK_MINUS NK_INTEGER",
- /* 344 */ "signed ::= NK_FLOAT",
- /* 345 */ "signed ::= NK_PLUS NK_FLOAT",
- /* 346 */ "signed ::= NK_MINUS NK_FLOAT",
- /* 347 */ "signed_literal ::= signed",
- /* 348 */ "signed_literal ::= NK_STRING",
- /* 349 */ "signed_literal ::= NK_BOOL",
- /* 350 */ "signed_literal ::= TIMESTAMP NK_STRING",
- /* 351 */ "signed_literal ::= duration_literal",
- /* 352 */ "signed_literal ::= NULL",
- /* 353 */ "signed_literal ::= literal_func",
- /* 354 */ "signed_literal ::= NK_QUESTION",
- /* 355 */ "literal_list ::= signed_literal",
- /* 356 */ "literal_list ::= literal_list NK_COMMA signed_literal",
- /* 357 */ "db_name ::= NK_ID",
- /* 358 */ "table_name ::= NK_ID",
- /* 359 */ "column_name ::= NK_ID",
- /* 360 */ "function_name ::= NK_ID",
- /* 361 */ "table_alias ::= NK_ID",
- /* 362 */ "column_alias ::= NK_ID",
- /* 363 */ "user_name ::= NK_ID",
- /* 364 */ "topic_name ::= NK_ID",
- /* 365 */ "stream_name ::= NK_ID",
- /* 366 */ "cgroup_name ::= NK_ID",
- /* 367 */ "index_name ::= NK_ID",
- /* 368 */ "expr_or_subquery ::= expression",
- /* 369 */ "expression ::= literal",
- /* 370 */ "expression ::= pseudo_column",
- /* 371 */ "expression ::= column_reference",
- /* 372 */ "expression ::= function_expression",
- /* 373 */ "expression ::= case_when_expression",
- /* 374 */ "expression ::= NK_LP expression NK_RP",
- /* 375 */ "expression ::= NK_PLUS expr_or_subquery",
- /* 376 */ "expression ::= NK_MINUS expr_or_subquery",
- /* 377 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery",
- /* 378 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery",
- /* 379 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery",
- /* 380 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery",
- /* 381 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery",
- /* 382 */ "expression ::= column_reference NK_ARROW NK_STRING",
- /* 383 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery",
- /* 384 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery",
- /* 385 */ "expression_list ::= expr_or_subquery",
- /* 386 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery",
- /* 387 */ "column_reference ::= column_name",
- /* 388 */ "column_reference ::= table_name NK_DOT column_name",
- /* 389 */ "pseudo_column ::= ROWTS",
- /* 390 */ "pseudo_column ::= TBNAME",
- /* 391 */ "pseudo_column ::= table_name NK_DOT TBNAME",
- /* 392 */ "pseudo_column ::= QSTART",
- /* 393 */ "pseudo_column ::= QEND",
- /* 394 */ "pseudo_column ::= QDURATION",
- /* 395 */ "pseudo_column ::= WSTART",
- /* 396 */ "pseudo_column ::= WEND",
- /* 397 */ "pseudo_column ::= WDURATION",
- /* 398 */ "pseudo_column ::= IROWTS",
- /* 399 */ "pseudo_column ::= ISFILLED",
- /* 400 */ "pseudo_column ::= QTAGS",
- /* 401 */ "function_expression ::= function_name NK_LP expression_list NK_RP",
- /* 402 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP",
- /* 403 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP",
- /* 404 */ "function_expression ::= literal_func",
- /* 405 */ "literal_func ::= noarg_func NK_LP NK_RP",
- /* 406 */ "literal_func ::= NOW",
- /* 407 */ "noarg_func ::= NOW",
- /* 408 */ "noarg_func ::= TODAY",
- /* 409 */ "noarg_func ::= TIMEZONE",
- /* 410 */ "noarg_func ::= DATABASE",
- /* 411 */ "noarg_func ::= CLIENT_VERSION",
- /* 412 */ "noarg_func ::= SERVER_VERSION",
- /* 413 */ "noarg_func ::= SERVER_STATUS",
- /* 414 */ "noarg_func ::= CURRENT_USER",
- /* 415 */ "noarg_func ::= USER",
- /* 416 */ "star_func ::= COUNT",
- /* 417 */ "star_func ::= FIRST",
- /* 418 */ "star_func ::= LAST",
- /* 419 */ "star_func ::= LAST_ROW",
- /* 420 */ "star_func_para_list ::= NK_STAR",
- /* 421 */ "star_func_para_list ::= other_para_list",
- /* 422 */ "other_para_list ::= star_func_para",
- /* 423 */ "other_para_list ::= other_para_list NK_COMMA star_func_para",
- /* 424 */ "star_func_para ::= expr_or_subquery",
- /* 425 */ "star_func_para ::= table_name NK_DOT NK_STAR",
- /* 426 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END",
- /* 427 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END",
- /* 428 */ "when_then_list ::= when_then_expr",
- /* 429 */ "when_then_list ::= when_then_list when_then_expr",
- /* 430 */ "when_then_expr ::= WHEN common_expression THEN common_expression",
- /* 431 */ "case_when_else_opt ::=",
- /* 432 */ "case_when_else_opt ::= ELSE common_expression",
- /* 433 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery",
- /* 434 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery",
- /* 435 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery",
- /* 436 */ "predicate ::= expr_or_subquery IS NULL",
- /* 437 */ "predicate ::= expr_or_subquery IS NOT NULL",
- /* 438 */ "predicate ::= expr_or_subquery in_op in_predicate_value",
- /* 439 */ "compare_op ::= NK_LT",
- /* 440 */ "compare_op ::= NK_GT",
- /* 441 */ "compare_op ::= NK_LE",
- /* 442 */ "compare_op ::= NK_GE",
- /* 443 */ "compare_op ::= NK_NE",
- /* 444 */ "compare_op ::= NK_EQ",
- /* 445 */ "compare_op ::= LIKE",
- /* 446 */ "compare_op ::= NOT LIKE",
- /* 447 */ "compare_op ::= MATCH",
- /* 448 */ "compare_op ::= NMATCH",
- /* 449 */ "compare_op ::= CONTAINS",
- /* 450 */ "in_op ::= IN",
- /* 451 */ "in_op ::= NOT IN",
- /* 452 */ "in_predicate_value ::= NK_LP literal_list NK_RP",
- /* 453 */ "boolean_value_expression ::= boolean_primary",
- /* 454 */ "boolean_value_expression ::= NOT boolean_primary",
- /* 455 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression",
- /* 456 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression",
- /* 457 */ "boolean_primary ::= predicate",
- /* 458 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP",
- /* 459 */ "common_expression ::= expr_or_subquery",
- /* 460 */ "common_expression ::= boolean_value_expression",
- /* 461 */ "from_clause_opt ::=",
- /* 462 */ "from_clause_opt ::= FROM table_reference_list",
- /* 463 */ "table_reference_list ::= table_reference",
- /* 464 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference",
- /* 465 */ "table_reference ::= table_primary",
- /* 466 */ "table_reference ::= joined_table",
- /* 467 */ "table_primary ::= table_name alias_opt",
- /* 468 */ "table_primary ::= db_name NK_DOT table_name alias_opt",
- /* 469 */ "table_primary ::= subquery alias_opt",
- /* 470 */ "table_primary ::= parenthesized_joined_table",
- /* 471 */ "alias_opt ::=",
- /* 472 */ "alias_opt ::= table_alias",
- /* 473 */ "alias_opt ::= AS table_alias",
- /* 474 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP",
- /* 475 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP",
- /* 476 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition",
- /* 477 */ "join_type ::=",
- /* 478 */ "join_type ::= INNER",
- /* 479 */ "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",
- /* 480 */ "set_quantifier_opt ::=",
- /* 481 */ "set_quantifier_opt ::= DISTINCT",
- /* 482 */ "set_quantifier_opt ::= ALL",
- /* 483 */ "select_list ::= select_item",
- /* 484 */ "select_list ::= select_list NK_COMMA select_item",
- /* 485 */ "select_item ::= NK_STAR",
- /* 486 */ "select_item ::= common_expression",
- /* 487 */ "select_item ::= common_expression column_alias",
- /* 488 */ "select_item ::= common_expression AS column_alias",
- /* 489 */ "select_item ::= table_name NK_DOT NK_STAR",
- /* 490 */ "where_clause_opt ::=",
- /* 491 */ "where_clause_opt ::= WHERE search_condition",
- /* 492 */ "partition_by_clause_opt ::=",
- /* 493 */ "partition_by_clause_opt ::= PARTITION BY partition_list",
- /* 494 */ "partition_list ::= partition_item",
- /* 495 */ "partition_list ::= partition_list NK_COMMA partition_item",
- /* 496 */ "partition_item ::= expr_or_subquery",
- /* 497 */ "partition_item ::= expr_or_subquery column_alias",
- /* 498 */ "partition_item ::= expr_or_subquery AS column_alias",
- /* 499 */ "twindow_clause_opt ::=",
- /* 500 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP",
- /* 501 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP",
- /* 502 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt",
- /* 503 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt",
- /* 504 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition",
- /* 505 */ "sliding_opt ::=",
- /* 506 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP",
- /* 507 */ "fill_opt ::=",
- /* 508 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP",
- /* 509 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP",
- /* 510 */ "fill_mode ::= NONE",
- /* 511 */ "fill_mode ::= PREV",
- /* 512 */ "fill_mode ::= NULL",
- /* 513 */ "fill_mode ::= LINEAR",
- /* 514 */ "fill_mode ::= NEXT",
- /* 515 */ "group_by_clause_opt ::=",
- /* 516 */ "group_by_clause_opt ::= GROUP BY group_by_list",
- /* 517 */ "group_by_list ::= expr_or_subquery",
- /* 518 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery",
- /* 519 */ "having_clause_opt ::=",
- /* 520 */ "having_clause_opt ::= HAVING search_condition",
- /* 521 */ "range_opt ::=",
- /* 522 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP",
- /* 523 */ "every_opt ::=",
- /* 524 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP",
- /* 525 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt",
- /* 526 */ "query_simple ::= query_specification",
- /* 527 */ "query_simple ::= union_query_expression",
- /* 528 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery",
- /* 529 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery",
- /* 530 */ "query_simple_or_subquery ::= query_simple",
- /* 531 */ "query_simple_or_subquery ::= subquery",
- /* 532 */ "query_or_subquery ::= query_expression",
- /* 533 */ "query_or_subquery ::= subquery",
- /* 534 */ "order_by_clause_opt ::=",
- /* 535 */ "order_by_clause_opt ::= ORDER BY sort_specification_list",
- /* 536 */ "slimit_clause_opt ::=",
- /* 537 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER",
- /* 538 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER",
- /* 539 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER",
- /* 540 */ "limit_clause_opt ::=",
- /* 541 */ "limit_clause_opt ::= LIMIT NK_INTEGER",
- /* 542 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER",
- /* 543 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER",
- /* 544 */ "subquery ::= NK_LP query_expression NK_RP",
- /* 545 */ "subquery ::= NK_LP subquery NK_RP",
- /* 546 */ "search_condition ::= common_expression",
- /* 547 */ "sort_specification_list ::= sort_specification",
- /* 548 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification",
- /* 549 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt",
- /* 550 */ "ordering_specification_opt ::=",
- /* 551 */ "ordering_specification_opt ::= ASC",
- /* 552 */ "ordering_specification_opt ::= DESC",
- /* 553 */ "null_ordering_opt ::=",
- /* 554 */ "null_ordering_opt ::= NULLS FIRST",
- /* 555 */ "null_ordering_opt ::= NULLS LAST",
+ /* 292 */ "cmd ::= EXPLAIN analyze_opt explain_options insert_query",
+ /* 293 */ "analyze_opt ::=",
+ /* 294 */ "analyze_opt ::= ANALYZE",
+ /* 295 */ "explain_options ::=",
+ /* 296 */ "explain_options ::= explain_options VERBOSE NK_BOOL",
+ /* 297 */ "explain_options ::= explain_options RATIO NK_FLOAT",
+ /* 298 */ "cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt",
+ /* 299 */ "cmd ::= DROP FUNCTION exists_opt function_name",
+ /* 300 */ "agg_func_opt ::=",
+ /* 301 */ "agg_func_opt ::= AGGREGATE",
+ /* 302 */ "bufsize_opt ::=",
+ /* 303 */ "bufsize_opt ::= BUFSIZE NK_INTEGER",
+ /* 304 */ "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",
+ /* 305 */ "cmd ::= DROP STREAM exists_opt stream_name",
+ /* 306 */ "col_list_opt ::=",
+ /* 307 */ "col_list_opt ::= NK_LP col_name_list NK_RP",
+ /* 308 */ "tag_def_or_ref_opt ::=",
+ /* 309 */ "tag_def_or_ref_opt ::= tags_def",
+ /* 310 */ "tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP",
+ /* 311 */ "stream_options ::=",
+ /* 312 */ "stream_options ::= stream_options TRIGGER AT_ONCE",
+ /* 313 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE",
+ /* 314 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal",
+ /* 315 */ "stream_options ::= stream_options WATERMARK duration_literal",
+ /* 316 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER",
+ /* 317 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER",
+ /* 318 */ "subtable_opt ::=",
+ /* 319 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP",
+ /* 320 */ "cmd ::= KILL CONNECTION NK_INTEGER",
+ /* 321 */ "cmd ::= KILL QUERY NK_STRING",
+ /* 322 */ "cmd ::= KILL TRANSACTION NK_INTEGER",
+ /* 323 */ "cmd ::= BALANCE VGROUP",
+ /* 324 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER",
+ /* 325 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list",
+ /* 326 */ "cmd ::= SPLIT VGROUP NK_INTEGER",
+ /* 327 */ "dnode_list ::= DNODE NK_INTEGER",
+ /* 328 */ "dnode_list ::= dnode_list DNODE NK_INTEGER",
+ /* 329 */ "cmd ::= DELETE FROM full_table_name where_clause_opt",
+ /* 330 */ "cmd ::= query_or_subquery",
+ /* 331 */ "cmd ::= insert_query",
+ /* 332 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery",
+ /* 333 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery",
+ /* 334 */ "literal ::= NK_INTEGER",
+ /* 335 */ "literal ::= NK_FLOAT",
+ /* 336 */ "literal ::= NK_STRING",
+ /* 337 */ "literal ::= NK_BOOL",
+ /* 338 */ "literal ::= TIMESTAMP NK_STRING",
+ /* 339 */ "literal ::= duration_literal",
+ /* 340 */ "literal ::= NULL",
+ /* 341 */ "literal ::= NK_QUESTION",
+ /* 342 */ "duration_literal ::= NK_VARIABLE",
+ /* 343 */ "signed ::= NK_INTEGER",
+ /* 344 */ "signed ::= NK_PLUS NK_INTEGER",
+ /* 345 */ "signed ::= NK_MINUS NK_INTEGER",
+ /* 346 */ "signed ::= NK_FLOAT",
+ /* 347 */ "signed ::= NK_PLUS NK_FLOAT",
+ /* 348 */ "signed ::= NK_MINUS NK_FLOAT",
+ /* 349 */ "signed_literal ::= signed",
+ /* 350 */ "signed_literal ::= NK_STRING",
+ /* 351 */ "signed_literal ::= NK_BOOL",
+ /* 352 */ "signed_literal ::= TIMESTAMP NK_STRING",
+ /* 353 */ "signed_literal ::= duration_literal",
+ /* 354 */ "signed_literal ::= NULL",
+ /* 355 */ "signed_literal ::= literal_func",
+ /* 356 */ "signed_literal ::= NK_QUESTION",
+ /* 357 */ "literal_list ::= signed_literal",
+ /* 358 */ "literal_list ::= literal_list NK_COMMA signed_literal",
+ /* 359 */ "db_name ::= NK_ID",
+ /* 360 */ "table_name ::= NK_ID",
+ /* 361 */ "column_name ::= NK_ID",
+ /* 362 */ "function_name ::= NK_ID",
+ /* 363 */ "table_alias ::= NK_ID",
+ /* 364 */ "column_alias ::= NK_ID",
+ /* 365 */ "user_name ::= NK_ID",
+ /* 366 */ "topic_name ::= NK_ID",
+ /* 367 */ "stream_name ::= NK_ID",
+ /* 368 */ "cgroup_name ::= NK_ID",
+ /* 369 */ "index_name ::= NK_ID",
+ /* 370 */ "expr_or_subquery ::= expression",
+ /* 371 */ "expression ::= literal",
+ /* 372 */ "expression ::= pseudo_column",
+ /* 373 */ "expression ::= column_reference",
+ /* 374 */ "expression ::= function_expression",
+ /* 375 */ "expression ::= case_when_expression",
+ /* 376 */ "expression ::= NK_LP expression NK_RP",
+ /* 377 */ "expression ::= NK_PLUS expr_or_subquery",
+ /* 378 */ "expression ::= NK_MINUS expr_or_subquery",
+ /* 379 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery",
+ /* 380 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery",
+ /* 381 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery",
+ /* 382 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery",
+ /* 383 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery",
+ /* 384 */ "expression ::= column_reference NK_ARROW NK_STRING",
+ /* 385 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery",
+ /* 386 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery",
+ /* 387 */ "expression_list ::= expr_or_subquery",
+ /* 388 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery",
+ /* 389 */ "column_reference ::= column_name",
+ /* 390 */ "column_reference ::= table_name NK_DOT column_name",
+ /* 391 */ "pseudo_column ::= ROWTS",
+ /* 392 */ "pseudo_column ::= TBNAME",
+ /* 393 */ "pseudo_column ::= table_name NK_DOT TBNAME",
+ /* 394 */ "pseudo_column ::= QSTART",
+ /* 395 */ "pseudo_column ::= QEND",
+ /* 396 */ "pseudo_column ::= QDURATION",
+ /* 397 */ "pseudo_column ::= WSTART",
+ /* 398 */ "pseudo_column ::= WEND",
+ /* 399 */ "pseudo_column ::= WDURATION",
+ /* 400 */ "pseudo_column ::= IROWTS",
+ /* 401 */ "pseudo_column ::= ISFILLED",
+ /* 402 */ "pseudo_column ::= QTAGS",
+ /* 403 */ "function_expression ::= function_name NK_LP expression_list NK_RP",
+ /* 404 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP",
+ /* 405 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP",
+ /* 406 */ "function_expression ::= literal_func",
+ /* 407 */ "literal_func ::= noarg_func NK_LP NK_RP",
+ /* 408 */ "literal_func ::= NOW",
+ /* 409 */ "noarg_func ::= NOW",
+ /* 410 */ "noarg_func ::= TODAY",
+ /* 411 */ "noarg_func ::= TIMEZONE",
+ /* 412 */ "noarg_func ::= DATABASE",
+ /* 413 */ "noarg_func ::= CLIENT_VERSION",
+ /* 414 */ "noarg_func ::= SERVER_VERSION",
+ /* 415 */ "noarg_func ::= SERVER_STATUS",
+ /* 416 */ "noarg_func ::= CURRENT_USER",
+ /* 417 */ "noarg_func ::= USER",
+ /* 418 */ "star_func ::= COUNT",
+ /* 419 */ "star_func ::= FIRST",
+ /* 420 */ "star_func ::= LAST",
+ /* 421 */ "star_func ::= LAST_ROW",
+ /* 422 */ "star_func_para_list ::= NK_STAR",
+ /* 423 */ "star_func_para_list ::= other_para_list",
+ /* 424 */ "other_para_list ::= star_func_para",
+ /* 425 */ "other_para_list ::= other_para_list NK_COMMA star_func_para",
+ /* 426 */ "star_func_para ::= expr_or_subquery",
+ /* 427 */ "star_func_para ::= table_name NK_DOT NK_STAR",
+ /* 428 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END",
+ /* 429 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END",
+ /* 430 */ "when_then_list ::= when_then_expr",
+ /* 431 */ "when_then_list ::= when_then_list when_then_expr",
+ /* 432 */ "when_then_expr ::= WHEN common_expression THEN common_expression",
+ /* 433 */ "case_when_else_opt ::=",
+ /* 434 */ "case_when_else_opt ::= ELSE common_expression",
+ /* 435 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery",
+ /* 436 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery",
+ /* 437 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery",
+ /* 438 */ "predicate ::= expr_or_subquery IS NULL",
+ /* 439 */ "predicate ::= expr_or_subquery IS NOT NULL",
+ /* 440 */ "predicate ::= expr_or_subquery in_op in_predicate_value",
+ /* 441 */ "compare_op ::= NK_LT",
+ /* 442 */ "compare_op ::= NK_GT",
+ /* 443 */ "compare_op ::= NK_LE",
+ /* 444 */ "compare_op ::= NK_GE",
+ /* 445 */ "compare_op ::= NK_NE",
+ /* 446 */ "compare_op ::= NK_EQ",
+ /* 447 */ "compare_op ::= LIKE",
+ /* 448 */ "compare_op ::= NOT LIKE",
+ /* 449 */ "compare_op ::= MATCH",
+ /* 450 */ "compare_op ::= NMATCH",
+ /* 451 */ "compare_op ::= CONTAINS",
+ /* 452 */ "in_op ::= IN",
+ /* 453 */ "in_op ::= NOT IN",
+ /* 454 */ "in_predicate_value ::= NK_LP literal_list NK_RP",
+ /* 455 */ "boolean_value_expression ::= boolean_primary",
+ /* 456 */ "boolean_value_expression ::= NOT boolean_primary",
+ /* 457 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression",
+ /* 458 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression",
+ /* 459 */ "boolean_primary ::= predicate",
+ /* 460 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP",
+ /* 461 */ "common_expression ::= expr_or_subquery",
+ /* 462 */ "common_expression ::= boolean_value_expression",
+ /* 463 */ "from_clause_opt ::=",
+ /* 464 */ "from_clause_opt ::= FROM table_reference_list",
+ /* 465 */ "table_reference_list ::= table_reference",
+ /* 466 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference",
+ /* 467 */ "table_reference ::= table_primary",
+ /* 468 */ "table_reference ::= joined_table",
+ /* 469 */ "table_primary ::= table_name alias_opt",
+ /* 470 */ "table_primary ::= db_name NK_DOT table_name alias_opt",
+ /* 471 */ "table_primary ::= subquery alias_opt",
+ /* 472 */ "table_primary ::= parenthesized_joined_table",
+ /* 473 */ "alias_opt ::=",
+ /* 474 */ "alias_opt ::= table_alias",
+ /* 475 */ "alias_opt ::= AS table_alias",
+ /* 476 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP",
+ /* 477 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP",
+ /* 478 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition",
+ /* 479 */ "join_type ::=",
+ /* 480 */ "join_type ::= INNER",
+ /* 481 */ "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",
+ /* 482 */ "set_quantifier_opt ::=",
+ /* 483 */ "set_quantifier_opt ::= DISTINCT",
+ /* 484 */ "set_quantifier_opt ::= ALL",
+ /* 485 */ "select_list ::= select_item",
+ /* 486 */ "select_list ::= select_list NK_COMMA select_item",
+ /* 487 */ "select_item ::= NK_STAR",
+ /* 488 */ "select_item ::= common_expression",
+ /* 489 */ "select_item ::= common_expression column_alias",
+ /* 490 */ "select_item ::= common_expression AS column_alias",
+ /* 491 */ "select_item ::= table_name NK_DOT NK_STAR",
+ /* 492 */ "where_clause_opt ::=",
+ /* 493 */ "where_clause_opt ::= WHERE search_condition",
+ /* 494 */ "partition_by_clause_opt ::=",
+ /* 495 */ "partition_by_clause_opt ::= PARTITION BY partition_list",
+ /* 496 */ "partition_list ::= partition_item",
+ /* 497 */ "partition_list ::= partition_list NK_COMMA partition_item",
+ /* 498 */ "partition_item ::= expr_or_subquery",
+ /* 499 */ "partition_item ::= expr_or_subquery column_alias",
+ /* 500 */ "partition_item ::= expr_or_subquery AS column_alias",
+ /* 501 */ "twindow_clause_opt ::=",
+ /* 502 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP",
+ /* 503 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP",
+ /* 504 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt",
+ /* 505 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt",
+ /* 506 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition",
+ /* 507 */ "sliding_opt ::=",
+ /* 508 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP",
+ /* 509 */ "fill_opt ::=",
+ /* 510 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP",
+ /* 511 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP",
+ /* 512 */ "fill_mode ::= NONE",
+ /* 513 */ "fill_mode ::= PREV",
+ /* 514 */ "fill_mode ::= NULL",
+ /* 515 */ "fill_mode ::= LINEAR",
+ /* 516 */ "fill_mode ::= NEXT",
+ /* 517 */ "group_by_clause_opt ::=",
+ /* 518 */ "group_by_clause_opt ::= GROUP BY group_by_list",
+ /* 519 */ "group_by_list ::= expr_or_subquery",
+ /* 520 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery",
+ /* 521 */ "having_clause_opt ::=",
+ /* 522 */ "having_clause_opt ::= HAVING search_condition",
+ /* 523 */ "range_opt ::=",
+ /* 524 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP",
+ /* 525 */ "every_opt ::=",
+ /* 526 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP",
+ /* 527 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt",
+ /* 528 */ "query_simple ::= query_specification",
+ /* 529 */ "query_simple ::= union_query_expression",
+ /* 530 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery",
+ /* 531 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery",
+ /* 532 */ "query_simple_or_subquery ::= query_simple",
+ /* 533 */ "query_simple_or_subquery ::= subquery",
+ /* 534 */ "query_or_subquery ::= query_expression",
+ /* 535 */ "query_or_subquery ::= subquery",
+ /* 536 */ "order_by_clause_opt ::=",
+ /* 537 */ "order_by_clause_opt ::= ORDER BY sort_specification_list",
+ /* 538 */ "slimit_clause_opt ::=",
+ /* 539 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER",
+ /* 540 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER",
+ /* 541 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER",
+ /* 542 */ "limit_clause_opt ::=",
+ /* 543 */ "limit_clause_opt ::= LIMIT NK_INTEGER",
+ /* 544 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER",
+ /* 545 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER",
+ /* 546 */ "subquery ::= NK_LP query_expression NK_RP",
+ /* 547 */ "subquery ::= NK_LP subquery NK_RP",
+ /* 548 */ "search_condition ::= common_expression",
+ /* 549 */ "sort_specification_list ::= sort_specification",
+ /* 550 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification",
+ /* 551 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt",
+ /* 552 */ "ordering_specification_opt ::=",
+ /* 553 */ "ordering_specification_opt ::= ASC",
+ /* 554 */ "ordering_specification_opt ::= DESC",
+ /* 555 */ "null_ordering_opt ::=",
+ /* 556 */ "null_ordering_opt ::= NULLS FIRST",
+ /* 557 */ "null_ordering_opt ::= NULLS LAST",
};
#endif /* NDEBUG */
@@ -2618,57 +2647,58 @@ static void yy_destructor(
case 390: /* func */
case 392: /* query_or_subquery */
case 395: /* explain_options */
- case 399: /* stream_options */
- case 402: /* subtable_opt */
- case 403: /* expression */
- case 405: /* where_clause_opt */
- case 406: /* signed */
- case 407: /* literal_func */
- case 410: /* expr_or_subquery */
- case 411: /* pseudo_column */
- case 412: /* column_reference */
- case 413: /* function_expression */
- case 414: /* case_when_expression */
- case 419: /* star_func_para */
- case 421: /* case_when_else_opt */
- case 422: /* common_expression */
- case 423: /* when_then_expr */
- case 424: /* predicate */
- case 427: /* in_predicate_value */
- case 428: /* boolean_value_expression */
- case 429: /* boolean_primary */
- case 430: /* from_clause_opt */
- case 431: /* table_reference_list */
- case 432: /* table_reference */
- case 433: /* table_primary */
- case 434: /* joined_table */
- case 436: /* subquery */
- case 437: /* parenthesized_joined_table */
- case 439: /* search_condition */
- case 440: /* query_specification */
- case 444: /* range_opt */
- case 445: /* every_opt */
- case 446: /* fill_opt */
- case 447: /* twindow_clause_opt */
- case 449: /* having_clause_opt */
- case 450: /* select_item */
- case 452: /* partition_item */
- case 455: /* query_expression */
- case 456: /* query_simple */
- case 458: /* slimit_clause_opt */
- case 459: /* limit_clause_opt */
- case 460: /* union_query_expression */
- case 461: /* query_simple_or_subquery */
- case 463: /* sort_specification */
+ case 396: /* insert_query */
+ case 400: /* stream_options */
+ case 403: /* subtable_opt */
+ case 404: /* expression */
+ case 406: /* where_clause_opt */
+ case 407: /* signed */
+ case 408: /* literal_func */
+ case 411: /* expr_or_subquery */
+ case 412: /* pseudo_column */
+ case 413: /* column_reference */
+ case 414: /* function_expression */
+ case 415: /* case_when_expression */
+ case 420: /* star_func_para */
+ case 422: /* case_when_else_opt */
+ case 423: /* common_expression */
+ case 424: /* when_then_expr */
+ case 425: /* predicate */
+ case 428: /* in_predicate_value */
+ case 429: /* boolean_value_expression */
+ case 430: /* boolean_primary */
+ case 431: /* from_clause_opt */
+ case 432: /* table_reference_list */
+ case 433: /* table_reference */
+ case 434: /* table_primary */
+ case 435: /* joined_table */
+ case 437: /* subquery */
+ case 438: /* parenthesized_joined_table */
+ case 440: /* search_condition */
+ case 441: /* query_specification */
+ case 445: /* range_opt */
+ case 446: /* every_opt */
+ case 447: /* fill_opt */
+ case 448: /* twindow_clause_opt */
+ case 450: /* having_clause_opt */
+ case 451: /* select_item */
+ case 453: /* partition_item */
+ case 456: /* query_expression */
+ case 457: /* query_simple */
+ case 459: /* slimit_clause_opt */
+ case 460: /* limit_clause_opt */
+ case 461: /* union_query_expression */
+ case 462: /* query_simple_or_subquery */
+ case 464: /* sort_specification */
{
- nodesDestroyNode((yypminor->yy924));
+ nodesDestroyNode((yypminor->yy44));
}
break;
case 327: /* account_options */
case 328: /* alter_account_options */
case 330: /* alter_account_option */
case 345: /* speed_opt */
- case 397: /* bufsize_opt */
+ case 398: /* bufsize_opt */
{
}
@@ -2685,11 +2715,11 @@ static void yy_destructor(
case 386: /* index_name */
case 391: /* sma_func_name */
case 393: /* cgroup_name */
- case 398: /* stream_name */
- case 409: /* table_alias */
- case 415: /* star_func */
- case 417: /* noarg_func */
- case 435: /* alias_opt */
+ case 399: /* stream_name */
+ case 410: /* table_alias */
+ case 416: /* star_func */
+ case 418: /* noarg_func */
+ case 436: /* alias_opt */
{
}
@@ -2710,8 +2740,8 @@ static void yy_destructor(
case 341: /* not_exists_opt */
case 343: /* exists_opt */
case 394: /* analyze_opt */
- case 396: /* agg_func_opt */
- case 441: /* set_quantifier_opt */
+ case 397: /* agg_func_opt */
+ case 442: /* set_quantifier_opt */
{
}
@@ -2731,22 +2761,22 @@ static void yy_destructor(
case 371: /* rollup_func_list */
case 381: /* tag_list_opt */
case 387: /* func_list */
- case 400: /* col_list_opt */
- case 401: /* tag_def_or_ref_opt */
- case 404: /* dnode_list */
- case 408: /* literal_list */
- case 416: /* star_func_para_list */
- case 418: /* other_para_list */
- case 420: /* when_then_list */
- case 442: /* select_list */
- case 443: /* partition_by_clause_opt */
- case 448: /* group_by_clause_opt */
- case 451: /* partition_list */
- case 454: /* group_by_list */
- case 457: /* order_by_clause_opt */
- case 462: /* sort_specification_list */
+ case 401: /* col_list_opt */
+ case 402: /* tag_def_or_ref_opt */
+ case 405: /* dnode_list */
+ case 409: /* literal_list */
+ case 417: /* star_func_para_list */
+ case 419: /* other_para_list */
+ case 421: /* when_then_list */
+ case 443: /* select_list */
+ case 444: /* partition_by_clause_opt */
+ case 449: /* group_by_clause_opt */
+ case 452: /* partition_list */
+ case 455: /* group_by_list */
+ case 458: /* order_by_clause_opt */
+ case 463: /* sort_specification_list */
{
- nodesDestroyList((yypminor->yy776));
+ nodesDestroyList((yypminor->yy684));
}
break;
case 349: /* alter_db_option */
@@ -2760,28 +2790,28 @@ static void yy_destructor(
}
break;
- case 425: /* compare_op */
- case 426: /* in_op */
+ case 426: /* compare_op */
+ case 427: /* in_op */
{
}
break;
- case 438: /* join_type */
+ case 439: /* join_type */
{
}
break;
- case 453: /* fill_mode */
+ case 454: /* fill_mode */
{
}
break;
- case 464: /* ordering_specification_opt */
+ case 465: /* ordering_specification_opt */
{
}
break;
- case 465: /* null_ordering_opt */
+ case 466: /* null_ordering_opt */
{
}
@@ -3372,270 +3402,272 @@ static const struct {
{ 326, -2 }, /* (289) cmd ::= DESCRIBE full_table_name */
{ 326, -3 }, /* (290) cmd ::= RESET QUERY CACHE */
{ 326, -4 }, /* (291) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */
- { 394, 0 }, /* (292) analyze_opt ::= */
- { 394, -1 }, /* (293) analyze_opt ::= ANALYZE */
- { 395, 0 }, /* (294) explain_options ::= */
- { 395, -3 }, /* (295) explain_options ::= explain_options VERBOSE NK_BOOL */
- { 395, -3 }, /* (296) explain_options ::= explain_options RATIO NK_FLOAT */
- { 326, -10 }, /* (297) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */
- { 326, -4 }, /* (298) cmd ::= DROP FUNCTION exists_opt function_name */
- { 396, 0 }, /* (299) agg_func_opt ::= */
- { 396, -1 }, /* (300) agg_func_opt ::= AGGREGATE */
- { 397, 0 }, /* (301) bufsize_opt ::= */
- { 397, -2 }, /* (302) bufsize_opt ::= BUFSIZE NK_INTEGER */
- { 326, -12 }, /* (303) 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 */
- { 326, -4 }, /* (304) cmd ::= DROP STREAM exists_opt stream_name */
- { 400, 0 }, /* (305) col_list_opt ::= */
- { 400, -3 }, /* (306) col_list_opt ::= NK_LP col_name_list NK_RP */
- { 401, 0 }, /* (307) tag_def_or_ref_opt ::= */
- { 401, -1 }, /* (308) tag_def_or_ref_opt ::= tags_def */
- { 401, -4 }, /* (309) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */
- { 399, 0 }, /* (310) stream_options ::= */
- { 399, -3 }, /* (311) stream_options ::= stream_options TRIGGER AT_ONCE */
- { 399, -3 }, /* (312) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */
- { 399, -4 }, /* (313) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
- { 399, -3 }, /* (314) stream_options ::= stream_options WATERMARK duration_literal */
- { 399, -4 }, /* (315) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */
- { 399, -3 }, /* (316) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */
- { 402, 0 }, /* (317) subtable_opt ::= */
- { 402, -4 }, /* (318) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */
- { 326, -3 }, /* (319) cmd ::= KILL CONNECTION NK_INTEGER */
- { 326, -3 }, /* (320) cmd ::= KILL QUERY NK_STRING */
- { 326, -3 }, /* (321) cmd ::= KILL TRANSACTION NK_INTEGER */
- { 326, -2 }, /* (322) cmd ::= BALANCE VGROUP */
- { 326, -4 }, /* (323) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
- { 326, -4 }, /* (324) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
- { 326, -3 }, /* (325) cmd ::= SPLIT VGROUP NK_INTEGER */
- { 404, -2 }, /* (326) dnode_list ::= DNODE NK_INTEGER */
- { 404, -3 }, /* (327) dnode_list ::= dnode_list DNODE NK_INTEGER */
- { 326, -4 }, /* (328) cmd ::= DELETE FROM full_table_name where_clause_opt */
- { 326, -1 }, /* (329) cmd ::= query_or_subquery */
- { 326, -7 }, /* (330) cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */
- { 326, -4 }, /* (331) cmd ::= INSERT INTO full_table_name query_or_subquery */
- { 329, -1 }, /* (332) literal ::= NK_INTEGER */
- { 329, -1 }, /* (333) literal ::= NK_FLOAT */
- { 329, -1 }, /* (334) literal ::= NK_STRING */
- { 329, -1 }, /* (335) literal ::= NK_BOOL */
- { 329, -2 }, /* (336) literal ::= TIMESTAMP NK_STRING */
- { 329, -1 }, /* (337) literal ::= duration_literal */
- { 329, -1 }, /* (338) literal ::= NULL */
- { 329, -1 }, /* (339) literal ::= NK_QUESTION */
- { 373, -1 }, /* (340) duration_literal ::= NK_VARIABLE */
- { 406, -1 }, /* (341) signed ::= NK_INTEGER */
- { 406, -2 }, /* (342) signed ::= NK_PLUS NK_INTEGER */
- { 406, -2 }, /* (343) signed ::= NK_MINUS NK_INTEGER */
- { 406, -1 }, /* (344) signed ::= NK_FLOAT */
- { 406, -2 }, /* (345) signed ::= NK_PLUS NK_FLOAT */
- { 406, -2 }, /* (346) signed ::= NK_MINUS NK_FLOAT */
- { 362, -1 }, /* (347) signed_literal ::= signed */
- { 362, -1 }, /* (348) signed_literal ::= NK_STRING */
- { 362, -1 }, /* (349) signed_literal ::= NK_BOOL */
- { 362, -2 }, /* (350) signed_literal ::= TIMESTAMP NK_STRING */
- { 362, -1 }, /* (351) signed_literal ::= duration_literal */
- { 362, -1 }, /* (352) signed_literal ::= NULL */
- { 362, -1 }, /* (353) signed_literal ::= literal_func */
- { 362, -1 }, /* (354) signed_literal ::= NK_QUESTION */
- { 408, -1 }, /* (355) literal_list ::= signed_literal */
- { 408, -3 }, /* (356) literal_list ::= literal_list NK_COMMA signed_literal */
- { 337, -1 }, /* (357) db_name ::= NK_ID */
- { 368, -1 }, /* (358) table_name ::= NK_ID */
- { 360, -1 }, /* (359) column_name ::= NK_ID */
- { 375, -1 }, /* (360) function_name ::= NK_ID */
- { 409, -1 }, /* (361) table_alias ::= NK_ID */
- { 383, -1 }, /* (362) column_alias ::= NK_ID */
- { 331, -1 }, /* (363) user_name ::= NK_ID */
- { 338, -1 }, /* (364) topic_name ::= NK_ID */
- { 398, -1 }, /* (365) stream_name ::= NK_ID */
- { 393, -1 }, /* (366) cgroup_name ::= NK_ID */
- { 386, -1 }, /* (367) index_name ::= NK_ID */
- { 410, -1 }, /* (368) expr_or_subquery ::= expression */
- { 403, -1 }, /* (369) expression ::= literal */
- { 403, -1 }, /* (370) expression ::= pseudo_column */
- { 403, -1 }, /* (371) expression ::= column_reference */
- { 403, -1 }, /* (372) expression ::= function_expression */
- { 403, -1 }, /* (373) expression ::= case_when_expression */
- { 403, -3 }, /* (374) expression ::= NK_LP expression NK_RP */
- { 403, -2 }, /* (375) expression ::= NK_PLUS expr_or_subquery */
- { 403, -2 }, /* (376) expression ::= NK_MINUS expr_or_subquery */
- { 403, -3 }, /* (377) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */
- { 403, -3 }, /* (378) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */
- { 403, -3 }, /* (379) expression ::= expr_or_subquery NK_STAR expr_or_subquery */
- { 403, -3 }, /* (380) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */
- { 403, -3 }, /* (381) expression ::= expr_or_subquery NK_REM expr_or_subquery */
- { 403, -3 }, /* (382) expression ::= column_reference NK_ARROW NK_STRING */
- { 403, -3 }, /* (383) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */
- { 403, -3 }, /* (384) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */
- { 365, -1 }, /* (385) expression_list ::= expr_or_subquery */
- { 365, -3 }, /* (386) expression_list ::= expression_list NK_COMMA expr_or_subquery */
- { 412, -1 }, /* (387) column_reference ::= column_name */
- { 412, -3 }, /* (388) column_reference ::= table_name NK_DOT column_name */
- { 411, -1 }, /* (389) pseudo_column ::= ROWTS */
- { 411, -1 }, /* (390) pseudo_column ::= TBNAME */
- { 411, -3 }, /* (391) pseudo_column ::= table_name NK_DOT TBNAME */
- { 411, -1 }, /* (392) pseudo_column ::= QSTART */
- { 411, -1 }, /* (393) pseudo_column ::= QEND */
- { 411, -1 }, /* (394) pseudo_column ::= QDURATION */
- { 411, -1 }, /* (395) pseudo_column ::= WSTART */
- { 411, -1 }, /* (396) pseudo_column ::= WEND */
- { 411, -1 }, /* (397) pseudo_column ::= WDURATION */
- { 411, -1 }, /* (398) pseudo_column ::= IROWTS */
- { 411, -1 }, /* (399) pseudo_column ::= ISFILLED */
- { 411, -1 }, /* (400) pseudo_column ::= QTAGS */
- { 413, -4 }, /* (401) function_expression ::= function_name NK_LP expression_list NK_RP */
- { 413, -4 }, /* (402) function_expression ::= star_func NK_LP star_func_para_list NK_RP */
- { 413, -6 }, /* (403) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */
- { 413, -1 }, /* (404) function_expression ::= literal_func */
- { 407, -3 }, /* (405) literal_func ::= noarg_func NK_LP NK_RP */
- { 407, -1 }, /* (406) literal_func ::= NOW */
- { 417, -1 }, /* (407) noarg_func ::= NOW */
- { 417, -1 }, /* (408) noarg_func ::= TODAY */
- { 417, -1 }, /* (409) noarg_func ::= TIMEZONE */
- { 417, -1 }, /* (410) noarg_func ::= DATABASE */
- { 417, -1 }, /* (411) noarg_func ::= CLIENT_VERSION */
- { 417, -1 }, /* (412) noarg_func ::= SERVER_VERSION */
- { 417, -1 }, /* (413) noarg_func ::= SERVER_STATUS */
- { 417, -1 }, /* (414) noarg_func ::= CURRENT_USER */
- { 417, -1 }, /* (415) noarg_func ::= USER */
- { 415, -1 }, /* (416) star_func ::= COUNT */
- { 415, -1 }, /* (417) star_func ::= FIRST */
- { 415, -1 }, /* (418) star_func ::= LAST */
- { 415, -1 }, /* (419) star_func ::= LAST_ROW */
- { 416, -1 }, /* (420) star_func_para_list ::= NK_STAR */
- { 416, -1 }, /* (421) star_func_para_list ::= other_para_list */
- { 418, -1 }, /* (422) other_para_list ::= star_func_para */
- { 418, -3 }, /* (423) other_para_list ::= other_para_list NK_COMMA star_func_para */
- { 419, -1 }, /* (424) star_func_para ::= expr_or_subquery */
- { 419, -3 }, /* (425) star_func_para ::= table_name NK_DOT NK_STAR */
- { 414, -4 }, /* (426) case_when_expression ::= CASE when_then_list case_when_else_opt END */
- { 414, -5 }, /* (427) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */
- { 420, -1 }, /* (428) when_then_list ::= when_then_expr */
- { 420, -2 }, /* (429) when_then_list ::= when_then_list when_then_expr */
- { 423, -4 }, /* (430) when_then_expr ::= WHEN common_expression THEN common_expression */
- { 421, 0 }, /* (431) case_when_else_opt ::= */
- { 421, -2 }, /* (432) case_when_else_opt ::= ELSE common_expression */
- { 424, -3 }, /* (433) predicate ::= expr_or_subquery compare_op expr_or_subquery */
- { 424, -5 }, /* (434) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */
- { 424, -6 }, /* (435) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */
- { 424, -3 }, /* (436) predicate ::= expr_or_subquery IS NULL */
- { 424, -4 }, /* (437) predicate ::= expr_or_subquery IS NOT NULL */
- { 424, -3 }, /* (438) predicate ::= expr_or_subquery in_op in_predicate_value */
- { 425, -1 }, /* (439) compare_op ::= NK_LT */
- { 425, -1 }, /* (440) compare_op ::= NK_GT */
- { 425, -1 }, /* (441) compare_op ::= NK_LE */
- { 425, -1 }, /* (442) compare_op ::= NK_GE */
- { 425, -1 }, /* (443) compare_op ::= NK_NE */
- { 425, -1 }, /* (444) compare_op ::= NK_EQ */
- { 425, -1 }, /* (445) compare_op ::= LIKE */
- { 425, -2 }, /* (446) compare_op ::= NOT LIKE */
- { 425, -1 }, /* (447) compare_op ::= MATCH */
- { 425, -1 }, /* (448) compare_op ::= NMATCH */
- { 425, -1 }, /* (449) compare_op ::= CONTAINS */
- { 426, -1 }, /* (450) in_op ::= IN */
- { 426, -2 }, /* (451) in_op ::= NOT IN */
- { 427, -3 }, /* (452) in_predicate_value ::= NK_LP literal_list NK_RP */
- { 428, -1 }, /* (453) boolean_value_expression ::= boolean_primary */
- { 428, -2 }, /* (454) boolean_value_expression ::= NOT boolean_primary */
- { 428, -3 }, /* (455) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
- { 428, -3 }, /* (456) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
- { 429, -1 }, /* (457) boolean_primary ::= predicate */
- { 429, -3 }, /* (458) boolean_primary ::= NK_LP boolean_value_expression NK_RP */
- { 422, -1 }, /* (459) common_expression ::= expr_or_subquery */
- { 422, -1 }, /* (460) common_expression ::= boolean_value_expression */
- { 430, 0 }, /* (461) from_clause_opt ::= */
- { 430, -2 }, /* (462) from_clause_opt ::= FROM table_reference_list */
- { 431, -1 }, /* (463) table_reference_list ::= table_reference */
- { 431, -3 }, /* (464) table_reference_list ::= table_reference_list NK_COMMA table_reference */
- { 432, -1 }, /* (465) table_reference ::= table_primary */
- { 432, -1 }, /* (466) table_reference ::= joined_table */
- { 433, -2 }, /* (467) table_primary ::= table_name alias_opt */
- { 433, -4 }, /* (468) table_primary ::= db_name NK_DOT table_name alias_opt */
- { 433, -2 }, /* (469) table_primary ::= subquery alias_opt */
- { 433, -1 }, /* (470) table_primary ::= parenthesized_joined_table */
- { 435, 0 }, /* (471) alias_opt ::= */
- { 435, -1 }, /* (472) alias_opt ::= table_alias */
- { 435, -2 }, /* (473) alias_opt ::= AS table_alias */
- { 437, -3 }, /* (474) parenthesized_joined_table ::= NK_LP joined_table NK_RP */
- { 437, -3 }, /* (475) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */
- { 434, -6 }, /* (476) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
- { 438, 0 }, /* (477) join_type ::= */
- { 438, -1 }, /* (478) join_type ::= INNER */
- { 440, -12 }, /* (479) 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 */
- { 441, 0 }, /* (480) set_quantifier_opt ::= */
- { 441, -1 }, /* (481) set_quantifier_opt ::= DISTINCT */
- { 441, -1 }, /* (482) set_quantifier_opt ::= ALL */
- { 442, -1 }, /* (483) select_list ::= select_item */
- { 442, -3 }, /* (484) select_list ::= select_list NK_COMMA select_item */
- { 450, -1 }, /* (485) select_item ::= NK_STAR */
- { 450, -1 }, /* (486) select_item ::= common_expression */
- { 450, -2 }, /* (487) select_item ::= common_expression column_alias */
- { 450, -3 }, /* (488) select_item ::= common_expression AS column_alias */
- { 450, -3 }, /* (489) select_item ::= table_name NK_DOT NK_STAR */
- { 405, 0 }, /* (490) where_clause_opt ::= */
- { 405, -2 }, /* (491) where_clause_opt ::= WHERE search_condition */
- { 443, 0 }, /* (492) partition_by_clause_opt ::= */
- { 443, -3 }, /* (493) partition_by_clause_opt ::= PARTITION BY partition_list */
- { 451, -1 }, /* (494) partition_list ::= partition_item */
- { 451, -3 }, /* (495) partition_list ::= partition_list NK_COMMA partition_item */
- { 452, -1 }, /* (496) partition_item ::= expr_or_subquery */
- { 452, -2 }, /* (497) partition_item ::= expr_or_subquery column_alias */
- { 452, -3 }, /* (498) partition_item ::= expr_or_subquery AS column_alias */
- { 447, 0 }, /* (499) twindow_clause_opt ::= */
- { 447, -6 }, /* (500) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */
- { 447, -4 }, /* (501) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */
- { 447, -6 }, /* (502) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
- { 447, -8 }, /* (503) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
- { 447, -7 }, /* (504) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */
- { 388, 0 }, /* (505) sliding_opt ::= */
- { 388, -4 }, /* (506) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
- { 446, 0 }, /* (507) fill_opt ::= */
- { 446, -4 }, /* (508) fill_opt ::= FILL NK_LP fill_mode NK_RP */
- { 446, -6 }, /* (509) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
- { 453, -1 }, /* (510) fill_mode ::= NONE */
- { 453, -1 }, /* (511) fill_mode ::= PREV */
- { 453, -1 }, /* (512) fill_mode ::= NULL */
- { 453, -1 }, /* (513) fill_mode ::= LINEAR */
- { 453, -1 }, /* (514) fill_mode ::= NEXT */
- { 448, 0 }, /* (515) group_by_clause_opt ::= */
- { 448, -3 }, /* (516) group_by_clause_opt ::= GROUP BY group_by_list */
- { 454, -1 }, /* (517) group_by_list ::= expr_or_subquery */
- { 454, -3 }, /* (518) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */
- { 449, 0 }, /* (519) having_clause_opt ::= */
- { 449, -2 }, /* (520) having_clause_opt ::= HAVING search_condition */
- { 444, 0 }, /* (521) range_opt ::= */
- { 444, -6 }, /* (522) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */
- { 445, 0 }, /* (523) every_opt ::= */
- { 445, -4 }, /* (524) every_opt ::= EVERY NK_LP duration_literal NK_RP */
- { 455, -4 }, /* (525) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
- { 456, -1 }, /* (526) query_simple ::= query_specification */
- { 456, -1 }, /* (527) query_simple ::= union_query_expression */
- { 460, -4 }, /* (528) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */
- { 460, -3 }, /* (529) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */
- { 461, -1 }, /* (530) query_simple_or_subquery ::= query_simple */
- { 461, -1 }, /* (531) query_simple_or_subquery ::= subquery */
- { 392, -1 }, /* (532) query_or_subquery ::= query_expression */
- { 392, -1 }, /* (533) query_or_subquery ::= subquery */
- { 457, 0 }, /* (534) order_by_clause_opt ::= */
- { 457, -3 }, /* (535) order_by_clause_opt ::= ORDER BY sort_specification_list */
- { 458, 0 }, /* (536) slimit_clause_opt ::= */
- { 458, -2 }, /* (537) slimit_clause_opt ::= SLIMIT NK_INTEGER */
- { 458, -4 }, /* (538) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
- { 458, -4 }, /* (539) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
- { 459, 0 }, /* (540) limit_clause_opt ::= */
- { 459, -2 }, /* (541) limit_clause_opt ::= LIMIT NK_INTEGER */
- { 459, -4 }, /* (542) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
- { 459, -4 }, /* (543) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
- { 436, -3 }, /* (544) subquery ::= NK_LP query_expression NK_RP */
- { 436, -3 }, /* (545) subquery ::= NK_LP subquery NK_RP */
- { 439, -1 }, /* (546) search_condition ::= common_expression */
- { 462, -1 }, /* (547) sort_specification_list ::= sort_specification */
- { 462, -3 }, /* (548) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
- { 463, -3 }, /* (549) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */
- { 464, 0 }, /* (550) ordering_specification_opt ::= */
- { 464, -1 }, /* (551) ordering_specification_opt ::= ASC */
- { 464, -1 }, /* (552) ordering_specification_opt ::= DESC */
- { 465, 0 }, /* (553) null_ordering_opt ::= */
- { 465, -2 }, /* (554) null_ordering_opt ::= NULLS FIRST */
- { 465, -2 }, /* (555) null_ordering_opt ::= NULLS LAST */
+ { 326, -4 }, /* (292) cmd ::= EXPLAIN analyze_opt explain_options insert_query */
+ { 394, 0 }, /* (293) analyze_opt ::= */
+ { 394, -1 }, /* (294) analyze_opt ::= ANALYZE */
+ { 395, 0 }, /* (295) explain_options ::= */
+ { 395, -3 }, /* (296) explain_options ::= explain_options VERBOSE NK_BOOL */
+ { 395, -3 }, /* (297) explain_options ::= explain_options RATIO NK_FLOAT */
+ { 326, -10 }, /* (298) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */
+ { 326, -4 }, /* (299) cmd ::= DROP FUNCTION exists_opt function_name */
+ { 397, 0 }, /* (300) agg_func_opt ::= */
+ { 397, -1 }, /* (301) agg_func_opt ::= AGGREGATE */
+ { 398, 0 }, /* (302) bufsize_opt ::= */
+ { 398, -2 }, /* (303) bufsize_opt ::= BUFSIZE NK_INTEGER */
+ { 326, -12 }, /* (304) 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 */
+ { 326, -4 }, /* (305) cmd ::= DROP STREAM exists_opt stream_name */
+ { 401, 0 }, /* (306) col_list_opt ::= */
+ { 401, -3 }, /* (307) col_list_opt ::= NK_LP col_name_list NK_RP */
+ { 402, 0 }, /* (308) tag_def_or_ref_opt ::= */
+ { 402, -1 }, /* (309) tag_def_or_ref_opt ::= tags_def */
+ { 402, -4 }, /* (310) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */
+ { 400, 0 }, /* (311) stream_options ::= */
+ { 400, -3 }, /* (312) stream_options ::= stream_options TRIGGER AT_ONCE */
+ { 400, -3 }, /* (313) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */
+ { 400, -4 }, /* (314) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
+ { 400, -3 }, /* (315) stream_options ::= stream_options WATERMARK duration_literal */
+ { 400, -4 }, /* (316) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */
+ { 400, -3 }, /* (317) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */
+ { 403, 0 }, /* (318) subtable_opt ::= */
+ { 403, -4 }, /* (319) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */
+ { 326, -3 }, /* (320) cmd ::= KILL CONNECTION NK_INTEGER */
+ { 326, -3 }, /* (321) cmd ::= KILL QUERY NK_STRING */
+ { 326, -3 }, /* (322) cmd ::= KILL TRANSACTION NK_INTEGER */
+ { 326, -2 }, /* (323) cmd ::= BALANCE VGROUP */
+ { 326, -4 }, /* (324) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
+ { 326, -4 }, /* (325) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
+ { 326, -3 }, /* (326) cmd ::= SPLIT VGROUP NK_INTEGER */
+ { 405, -2 }, /* (327) dnode_list ::= DNODE NK_INTEGER */
+ { 405, -3 }, /* (328) dnode_list ::= dnode_list DNODE NK_INTEGER */
+ { 326, -4 }, /* (329) cmd ::= DELETE FROM full_table_name where_clause_opt */
+ { 326, -1 }, /* (330) cmd ::= query_or_subquery */
+ { 326, -1 }, /* (331) cmd ::= insert_query */
+ { 396, -7 }, /* (332) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */
+ { 396, -4 }, /* (333) insert_query ::= INSERT INTO full_table_name query_or_subquery */
+ { 329, -1 }, /* (334) literal ::= NK_INTEGER */
+ { 329, -1 }, /* (335) literal ::= NK_FLOAT */
+ { 329, -1 }, /* (336) literal ::= NK_STRING */
+ { 329, -1 }, /* (337) literal ::= NK_BOOL */
+ { 329, -2 }, /* (338) literal ::= TIMESTAMP NK_STRING */
+ { 329, -1 }, /* (339) literal ::= duration_literal */
+ { 329, -1 }, /* (340) literal ::= NULL */
+ { 329, -1 }, /* (341) literal ::= NK_QUESTION */
+ { 373, -1 }, /* (342) duration_literal ::= NK_VARIABLE */
+ { 407, -1 }, /* (343) signed ::= NK_INTEGER */
+ { 407, -2 }, /* (344) signed ::= NK_PLUS NK_INTEGER */
+ { 407, -2 }, /* (345) signed ::= NK_MINUS NK_INTEGER */
+ { 407, -1 }, /* (346) signed ::= NK_FLOAT */
+ { 407, -2 }, /* (347) signed ::= NK_PLUS NK_FLOAT */
+ { 407, -2 }, /* (348) signed ::= NK_MINUS NK_FLOAT */
+ { 362, -1 }, /* (349) signed_literal ::= signed */
+ { 362, -1 }, /* (350) signed_literal ::= NK_STRING */
+ { 362, -1 }, /* (351) signed_literal ::= NK_BOOL */
+ { 362, -2 }, /* (352) signed_literal ::= TIMESTAMP NK_STRING */
+ { 362, -1 }, /* (353) signed_literal ::= duration_literal */
+ { 362, -1 }, /* (354) signed_literal ::= NULL */
+ { 362, -1 }, /* (355) signed_literal ::= literal_func */
+ { 362, -1 }, /* (356) signed_literal ::= NK_QUESTION */
+ { 409, -1 }, /* (357) literal_list ::= signed_literal */
+ { 409, -3 }, /* (358) literal_list ::= literal_list NK_COMMA signed_literal */
+ { 337, -1 }, /* (359) db_name ::= NK_ID */
+ { 368, -1 }, /* (360) table_name ::= NK_ID */
+ { 360, -1 }, /* (361) column_name ::= NK_ID */
+ { 375, -1 }, /* (362) function_name ::= NK_ID */
+ { 410, -1 }, /* (363) table_alias ::= NK_ID */
+ { 383, -1 }, /* (364) column_alias ::= NK_ID */
+ { 331, -1 }, /* (365) user_name ::= NK_ID */
+ { 338, -1 }, /* (366) topic_name ::= NK_ID */
+ { 399, -1 }, /* (367) stream_name ::= NK_ID */
+ { 393, -1 }, /* (368) cgroup_name ::= NK_ID */
+ { 386, -1 }, /* (369) index_name ::= NK_ID */
+ { 411, -1 }, /* (370) expr_or_subquery ::= expression */
+ { 404, -1 }, /* (371) expression ::= literal */
+ { 404, -1 }, /* (372) expression ::= pseudo_column */
+ { 404, -1 }, /* (373) expression ::= column_reference */
+ { 404, -1 }, /* (374) expression ::= function_expression */
+ { 404, -1 }, /* (375) expression ::= case_when_expression */
+ { 404, -3 }, /* (376) expression ::= NK_LP expression NK_RP */
+ { 404, -2 }, /* (377) expression ::= NK_PLUS expr_or_subquery */
+ { 404, -2 }, /* (378) expression ::= NK_MINUS expr_or_subquery */
+ { 404, -3 }, /* (379) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */
+ { 404, -3 }, /* (380) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */
+ { 404, -3 }, /* (381) expression ::= expr_or_subquery NK_STAR expr_or_subquery */
+ { 404, -3 }, /* (382) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */
+ { 404, -3 }, /* (383) expression ::= expr_or_subquery NK_REM expr_or_subquery */
+ { 404, -3 }, /* (384) expression ::= column_reference NK_ARROW NK_STRING */
+ { 404, -3 }, /* (385) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */
+ { 404, -3 }, /* (386) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */
+ { 365, -1 }, /* (387) expression_list ::= expr_or_subquery */
+ { 365, -3 }, /* (388) expression_list ::= expression_list NK_COMMA expr_or_subquery */
+ { 413, -1 }, /* (389) column_reference ::= column_name */
+ { 413, -3 }, /* (390) column_reference ::= table_name NK_DOT column_name */
+ { 412, -1 }, /* (391) pseudo_column ::= ROWTS */
+ { 412, -1 }, /* (392) pseudo_column ::= TBNAME */
+ { 412, -3 }, /* (393) pseudo_column ::= table_name NK_DOT TBNAME */
+ { 412, -1 }, /* (394) pseudo_column ::= QSTART */
+ { 412, -1 }, /* (395) pseudo_column ::= QEND */
+ { 412, -1 }, /* (396) pseudo_column ::= QDURATION */
+ { 412, -1 }, /* (397) pseudo_column ::= WSTART */
+ { 412, -1 }, /* (398) pseudo_column ::= WEND */
+ { 412, -1 }, /* (399) pseudo_column ::= WDURATION */
+ { 412, -1 }, /* (400) pseudo_column ::= IROWTS */
+ { 412, -1 }, /* (401) pseudo_column ::= ISFILLED */
+ { 412, -1 }, /* (402) pseudo_column ::= QTAGS */
+ { 414, -4 }, /* (403) function_expression ::= function_name NK_LP expression_list NK_RP */
+ { 414, -4 }, /* (404) function_expression ::= star_func NK_LP star_func_para_list NK_RP */
+ { 414, -6 }, /* (405) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */
+ { 414, -1 }, /* (406) function_expression ::= literal_func */
+ { 408, -3 }, /* (407) literal_func ::= noarg_func NK_LP NK_RP */
+ { 408, -1 }, /* (408) literal_func ::= NOW */
+ { 418, -1 }, /* (409) noarg_func ::= NOW */
+ { 418, -1 }, /* (410) noarg_func ::= TODAY */
+ { 418, -1 }, /* (411) noarg_func ::= TIMEZONE */
+ { 418, -1 }, /* (412) noarg_func ::= DATABASE */
+ { 418, -1 }, /* (413) noarg_func ::= CLIENT_VERSION */
+ { 418, -1 }, /* (414) noarg_func ::= SERVER_VERSION */
+ { 418, -1 }, /* (415) noarg_func ::= SERVER_STATUS */
+ { 418, -1 }, /* (416) noarg_func ::= CURRENT_USER */
+ { 418, -1 }, /* (417) noarg_func ::= USER */
+ { 416, -1 }, /* (418) star_func ::= COUNT */
+ { 416, -1 }, /* (419) star_func ::= FIRST */
+ { 416, -1 }, /* (420) star_func ::= LAST */
+ { 416, -1 }, /* (421) star_func ::= LAST_ROW */
+ { 417, -1 }, /* (422) star_func_para_list ::= NK_STAR */
+ { 417, -1 }, /* (423) star_func_para_list ::= other_para_list */
+ { 419, -1 }, /* (424) other_para_list ::= star_func_para */
+ { 419, -3 }, /* (425) other_para_list ::= other_para_list NK_COMMA star_func_para */
+ { 420, -1 }, /* (426) star_func_para ::= expr_or_subquery */
+ { 420, -3 }, /* (427) star_func_para ::= table_name NK_DOT NK_STAR */
+ { 415, -4 }, /* (428) case_when_expression ::= CASE when_then_list case_when_else_opt END */
+ { 415, -5 }, /* (429) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */
+ { 421, -1 }, /* (430) when_then_list ::= when_then_expr */
+ { 421, -2 }, /* (431) when_then_list ::= when_then_list when_then_expr */
+ { 424, -4 }, /* (432) when_then_expr ::= WHEN common_expression THEN common_expression */
+ { 422, 0 }, /* (433) case_when_else_opt ::= */
+ { 422, -2 }, /* (434) case_when_else_opt ::= ELSE common_expression */
+ { 425, -3 }, /* (435) predicate ::= expr_or_subquery compare_op expr_or_subquery */
+ { 425, -5 }, /* (436) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */
+ { 425, -6 }, /* (437) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */
+ { 425, -3 }, /* (438) predicate ::= expr_or_subquery IS NULL */
+ { 425, -4 }, /* (439) predicate ::= expr_or_subquery IS NOT NULL */
+ { 425, -3 }, /* (440) predicate ::= expr_or_subquery in_op in_predicate_value */
+ { 426, -1 }, /* (441) compare_op ::= NK_LT */
+ { 426, -1 }, /* (442) compare_op ::= NK_GT */
+ { 426, -1 }, /* (443) compare_op ::= NK_LE */
+ { 426, -1 }, /* (444) compare_op ::= NK_GE */
+ { 426, -1 }, /* (445) compare_op ::= NK_NE */
+ { 426, -1 }, /* (446) compare_op ::= NK_EQ */
+ { 426, -1 }, /* (447) compare_op ::= LIKE */
+ { 426, -2 }, /* (448) compare_op ::= NOT LIKE */
+ { 426, -1 }, /* (449) compare_op ::= MATCH */
+ { 426, -1 }, /* (450) compare_op ::= NMATCH */
+ { 426, -1 }, /* (451) compare_op ::= CONTAINS */
+ { 427, -1 }, /* (452) in_op ::= IN */
+ { 427, -2 }, /* (453) in_op ::= NOT IN */
+ { 428, -3 }, /* (454) in_predicate_value ::= NK_LP literal_list NK_RP */
+ { 429, -1 }, /* (455) boolean_value_expression ::= boolean_primary */
+ { 429, -2 }, /* (456) boolean_value_expression ::= NOT boolean_primary */
+ { 429, -3 }, /* (457) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
+ { 429, -3 }, /* (458) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
+ { 430, -1 }, /* (459) boolean_primary ::= predicate */
+ { 430, -3 }, /* (460) boolean_primary ::= NK_LP boolean_value_expression NK_RP */
+ { 423, -1 }, /* (461) common_expression ::= expr_or_subquery */
+ { 423, -1 }, /* (462) common_expression ::= boolean_value_expression */
+ { 431, 0 }, /* (463) from_clause_opt ::= */
+ { 431, -2 }, /* (464) from_clause_opt ::= FROM table_reference_list */
+ { 432, -1 }, /* (465) table_reference_list ::= table_reference */
+ { 432, -3 }, /* (466) table_reference_list ::= table_reference_list NK_COMMA table_reference */
+ { 433, -1 }, /* (467) table_reference ::= table_primary */
+ { 433, -1 }, /* (468) table_reference ::= joined_table */
+ { 434, -2 }, /* (469) table_primary ::= table_name alias_opt */
+ { 434, -4 }, /* (470) table_primary ::= db_name NK_DOT table_name alias_opt */
+ { 434, -2 }, /* (471) table_primary ::= subquery alias_opt */
+ { 434, -1 }, /* (472) table_primary ::= parenthesized_joined_table */
+ { 436, 0 }, /* (473) alias_opt ::= */
+ { 436, -1 }, /* (474) alias_opt ::= table_alias */
+ { 436, -2 }, /* (475) alias_opt ::= AS table_alias */
+ { 438, -3 }, /* (476) parenthesized_joined_table ::= NK_LP joined_table NK_RP */
+ { 438, -3 }, /* (477) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */
+ { 435, -6 }, /* (478) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
+ { 439, 0 }, /* (479) join_type ::= */
+ { 439, -1 }, /* (480) join_type ::= INNER */
+ { 441, -12 }, /* (481) 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 */
+ { 442, 0 }, /* (482) set_quantifier_opt ::= */
+ { 442, -1 }, /* (483) set_quantifier_opt ::= DISTINCT */
+ { 442, -1 }, /* (484) set_quantifier_opt ::= ALL */
+ { 443, -1 }, /* (485) select_list ::= select_item */
+ { 443, -3 }, /* (486) select_list ::= select_list NK_COMMA select_item */
+ { 451, -1 }, /* (487) select_item ::= NK_STAR */
+ { 451, -1 }, /* (488) select_item ::= common_expression */
+ { 451, -2 }, /* (489) select_item ::= common_expression column_alias */
+ { 451, -3 }, /* (490) select_item ::= common_expression AS column_alias */
+ { 451, -3 }, /* (491) select_item ::= table_name NK_DOT NK_STAR */
+ { 406, 0 }, /* (492) where_clause_opt ::= */
+ { 406, -2 }, /* (493) where_clause_opt ::= WHERE search_condition */
+ { 444, 0 }, /* (494) partition_by_clause_opt ::= */
+ { 444, -3 }, /* (495) partition_by_clause_opt ::= PARTITION BY partition_list */
+ { 452, -1 }, /* (496) partition_list ::= partition_item */
+ { 452, -3 }, /* (497) partition_list ::= partition_list NK_COMMA partition_item */
+ { 453, -1 }, /* (498) partition_item ::= expr_or_subquery */
+ { 453, -2 }, /* (499) partition_item ::= expr_or_subquery column_alias */
+ { 453, -3 }, /* (500) partition_item ::= expr_or_subquery AS column_alias */
+ { 448, 0 }, /* (501) twindow_clause_opt ::= */
+ { 448, -6 }, /* (502) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */
+ { 448, -4 }, /* (503) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */
+ { 448, -6 }, /* (504) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
+ { 448, -8 }, /* (505) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
+ { 448, -7 }, /* (506) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */
+ { 388, 0 }, /* (507) sliding_opt ::= */
+ { 388, -4 }, /* (508) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
+ { 447, 0 }, /* (509) fill_opt ::= */
+ { 447, -4 }, /* (510) fill_opt ::= FILL NK_LP fill_mode NK_RP */
+ { 447, -6 }, /* (511) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
+ { 454, -1 }, /* (512) fill_mode ::= NONE */
+ { 454, -1 }, /* (513) fill_mode ::= PREV */
+ { 454, -1 }, /* (514) fill_mode ::= NULL */
+ { 454, -1 }, /* (515) fill_mode ::= LINEAR */
+ { 454, -1 }, /* (516) fill_mode ::= NEXT */
+ { 449, 0 }, /* (517) group_by_clause_opt ::= */
+ { 449, -3 }, /* (518) group_by_clause_opt ::= GROUP BY group_by_list */
+ { 455, -1 }, /* (519) group_by_list ::= expr_or_subquery */
+ { 455, -3 }, /* (520) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */
+ { 450, 0 }, /* (521) having_clause_opt ::= */
+ { 450, -2 }, /* (522) having_clause_opt ::= HAVING search_condition */
+ { 445, 0 }, /* (523) range_opt ::= */
+ { 445, -6 }, /* (524) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */
+ { 446, 0 }, /* (525) every_opt ::= */
+ { 446, -4 }, /* (526) every_opt ::= EVERY NK_LP duration_literal NK_RP */
+ { 456, -4 }, /* (527) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
+ { 457, -1 }, /* (528) query_simple ::= query_specification */
+ { 457, -1 }, /* (529) query_simple ::= union_query_expression */
+ { 461, -4 }, /* (530) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */
+ { 461, -3 }, /* (531) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */
+ { 462, -1 }, /* (532) query_simple_or_subquery ::= query_simple */
+ { 462, -1 }, /* (533) query_simple_or_subquery ::= subquery */
+ { 392, -1 }, /* (534) query_or_subquery ::= query_expression */
+ { 392, -1 }, /* (535) query_or_subquery ::= subquery */
+ { 458, 0 }, /* (536) order_by_clause_opt ::= */
+ { 458, -3 }, /* (537) order_by_clause_opt ::= ORDER BY sort_specification_list */
+ { 459, 0 }, /* (538) slimit_clause_opt ::= */
+ { 459, -2 }, /* (539) slimit_clause_opt ::= SLIMIT NK_INTEGER */
+ { 459, -4 }, /* (540) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
+ { 459, -4 }, /* (541) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ { 460, 0 }, /* (542) limit_clause_opt ::= */
+ { 460, -2 }, /* (543) limit_clause_opt ::= LIMIT NK_INTEGER */
+ { 460, -4 }, /* (544) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
+ { 460, -4 }, /* (545) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ { 437, -3 }, /* (546) subquery ::= NK_LP query_expression NK_RP */
+ { 437, -3 }, /* (547) subquery ::= NK_LP subquery NK_RP */
+ { 440, -1 }, /* (548) search_condition ::= common_expression */
+ { 463, -1 }, /* (549) sort_specification_list ::= sort_specification */
+ { 463, -3 }, /* (550) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
+ { 464, -3 }, /* (551) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */
+ { 465, 0 }, /* (552) ordering_specification_opt ::= */
+ { 465, -1 }, /* (553) ordering_specification_opt ::= ASC */
+ { 465, -1 }, /* (554) ordering_specification_opt ::= DESC */
+ { 466, 0 }, /* (555) null_ordering_opt ::= */
+ { 466, -2 }, /* (556) null_ordering_opt ::= NULLS FIRST */
+ { 466, -2 }, /* (557) null_ordering_opt ::= NULLS LAST */
};
static void yy_accept(yyParser*); /* Forward Declaration */
@@ -3772,78 +3804,78 @@ static YYACTIONTYPE yy_reduce(
yy_destructor(yypParser,329,&yymsp[0].minor);
break;
case 24: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */
-{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy233, &yymsp[-1].minor.yy0, yymsp[0].minor.yy27); }
+{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy455, &yymsp[-1].minor.yy0, yymsp[0].minor.yy169); }
break;
case 25: /* cmd ::= ALTER USER user_name PASS NK_STRING */
-{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy233, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); }
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy455, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); }
break;
case 26: /* cmd ::= ALTER USER user_name ENABLE NK_INTEGER */
-{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy233, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); }
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy455, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); }
break;
case 27: /* cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */
-{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy233, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); }
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy455, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); }
break;
case 28: /* cmd ::= DROP USER user_name */
-{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy233); }
+{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy455); }
break;
case 29: /* sysinfo_opt ::= */
-{ yymsp[1].minor.yy27 = 1; }
+{ yymsp[1].minor.yy169 = 1; }
break;
case 30: /* sysinfo_opt ::= SYSINFO NK_INTEGER */
-{ yymsp[-1].minor.yy27 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); }
+{ yymsp[-1].minor.yy169 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); }
break;
case 31: /* cmd ::= GRANT privileges ON priv_level TO user_name */
-{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-4].minor.yy129, &yymsp[-2].minor.yy233, &yymsp[0].minor.yy233); }
+{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-4].minor.yy91, &yymsp[-2].minor.yy455, &yymsp[0].minor.yy455); }
break;
case 32: /* cmd ::= REVOKE privileges ON priv_level FROM user_name */
-{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy129, &yymsp[-2].minor.yy233, &yymsp[0].minor.yy233); }
+{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy91, &yymsp[-2].minor.yy455, &yymsp[0].minor.yy455); }
break;
case 33: /* privileges ::= ALL */
-{ yymsp[0].minor.yy129 = PRIVILEGE_TYPE_ALL; }
+{ yymsp[0].minor.yy91 = PRIVILEGE_TYPE_ALL; }
break;
case 34: /* privileges ::= priv_type_list */
case 36: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==36);
-{ yylhsminor.yy129 = yymsp[0].minor.yy129; }
- yymsp[0].minor.yy129 = yylhsminor.yy129;
+{ yylhsminor.yy91 = yymsp[0].minor.yy91; }
+ yymsp[0].minor.yy91 = yylhsminor.yy91;
break;
case 35: /* privileges ::= SUBSCRIBE */
-{ yymsp[0].minor.yy129 = PRIVILEGE_TYPE_SUBSCRIBE; }
+{ yymsp[0].minor.yy91 = PRIVILEGE_TYPE_SUBSCRIBE; }
break;
case 37: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */
-{ yylhsminor.yy129 = yymsp[-2].minor.yy129 | yymsp[0].minor.yy129; }
- yymsp[-2].minor.yy129 = yylhsminor.yy129;
+{ yylhsminor.yy91 = yymsp[-2].minor.yy91 | yymsp[0].minor.yy91; }
+ yymsp[-2].minor.yy91 = yylhsminor.yy91;
break;
case 38: /* priv_type ::= READ */
-{ yymsp[0].minor.yy129 = PRIVILEGE_TYPE_READ; }
+{ yymsp[0].minor.yy91 = PRIVILEGE_TYPE_READ; }
break;
case 39: /* priv_type ::= WRITE */
-{ yymsp[0].minor.yy129 = PRIVILEGE_TYPE_WRITE; }
+{ yymsp[0].minor.yy91 = PRIVILEGE_TYPE_WRITE; }
break;
case 40: /* priv_level ::= NK_STAR NK_DOT NK_STAR */
-{ yylhsminor.yy233 = yymsp[-2].minor.yy0; }
- yymsp[-2].minor.yy233 = yylhsminor.yy233;
+{ yylhsminor.yy455 = yymsp[-2].minor.yy0; }
+ yymsp[-2].minor.yy455 = yylhsminor.yy455;
break;
case 41: /* priv_level ::= db_name NK_DOT NK_STAR */
-{ yylhsminor.yy233 = yymsp[-2].minor.yy233; }
- yymsp[-2].minor.yy233 = yylhsminor.yy233;
+{ yylhsminor.yy455 = yymsp[-2].minor.yy455; }
+ yymsp[-2].minor.yy455 = yylhsminor.yy455;
break;
case 42: /* priv_level ::= topic_name */
case 272: /* sma_func_name ::= function_name */ yytestcase(yyruleno==272);
- case 472: /* alias_opt ::= table_alias */ yytestcase(yyruleno==472);
-{ yylhsminor.yy233 = yymsp[0].minor.yy233; }
- yymsp[0].minor.yy233 = yylhsminor.yy233;
+ case 474: /* alias_opt ::= table_alias */ yytestcase(yyruleno==474);
+{ yylhsminor.yy455 = yymsp[0].minor.yy455; }
+ yymsp[0].minor.yy455 = yylhsminor.yy455;
break;
case 43: /* cmd ::= CREATE DNODE dnode_endpoint */
-{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy233, NULL); }
+{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy455, NULL); }
break;
case 44: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */
-{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy233, &yymsp[0].minor.yy0); }
+{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy455, &yymsp[0].minor.yy0); }
break;
case 45: /* cmd ::= DROP DNODE NK_INTEGER force_opt */
-{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy397); }
+{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy163); }
break;
case 46: /* cmd ::= DROP DNODE dnode_endpoint force_opt */
-{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy233, yymsp[0].minor.yy397); }
+{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy455, yymsp[0].minor.yy163); }
break;
case 47: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */
{ pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); }
@@ -3864,46 +3896,46 @@ static YYACTIONTYPE yy_reduce(
case 274: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==274);
case 275: /* sma_func_name ::= LAST */ yytestcase(yyruleno==275);
case 276: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==276);
- case 357: /* db_name ::= NK_ID */ yytestcase(yyruleno==357);
- case 358: /* table_name ::= NK_ID */ yytestcase(yyruleno==358);
- case 359: /* column_name ::= NK_ID */ yytestcase(yyruleno==359);
- case 360: /* function_name ::= NK_ID */ yytestcase(yyruleno==360);
- case 361: /* table_alias ::= NK_ID */ yytestcase(yyruleno==361);
- case 362: /* column_alias ::= NK_ID */ yytestcase(yyruleno==362);
- case 363: /* user_name ::= NK_ID */ yytestcase(yyruleno==363);
- case 364: /* topic_name ::= NK_ID */ yytestcase(yyruleno==364);
- case 365: /* stream_name ::= NK_ID */ yytestcase(yyruleno==365);
- case 366: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==366);
- case 367: /* index_name ::= NK_ID */ yytestcase(yyruleno==367);
- case 407: /* noarg_func ::= NOW */ yytestcase(yyruleno==407);
- case 408: /* noarg_func ::= TODAY */ yytestcase(yyruleno==408);
- case 409: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==409);
- case 410: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==410);
- case 411: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==411);
- case 412: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==412);
- case 413: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==413);
- case 414: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==414);
- case 415: /* noarg_func ::= USER */ yytestcase(yyruleno==415);
- case 416: /* star_func ::= COUNT */ yytestcase(yyruleno==416);
- case 417: /* star_func ::= FIRST */ yytestcase(yyruleno==417);
- case 418: /* star_func ::= LAST */ yytestcase(yyruleno==418);
- case 419: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==419);
-{ yylhsminor.yy233 = yymsp[0].minor.yy0; }
- yymsp[0].minor.yy233 = yylhsminor.yy233;
+ case 359: /* db_name ::= NK_ID */ yytestcase(yyruleno==359);
+ case 360: /* table_name ::= NK_ID */ yytestcase(yyruleno==360);
+ case 361: /* column_name ::= NK_ID */ yytestcase(yyruleno==361);
+ case 362: /* function_name ::= NK_ID */ yytestcase(yyruleno==362);
+ case 363: /* table_alias ::= NK_ID */ yytestcase(yyruleno==363);
+ case 364: /* column_alias ::= NK_ID */ yytestcase(yyruleno==364);
+ case 365: /* user_name ::= NK_ID */ yytestcase(yyruleno==365);
+ case 366: /* topic_name ::= NK_ID */ yytestcase(yyruleno==366);
+ case 367: /* stream_name ::= NK_ID */ yytestcase(yyruleno==367);
+ case 368: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==368);
+ case 369: /* index_name ::= NK_ID */ yytestcase(yyruleno==369);
+ case 409: /* noarg_func ::= NOW */ yytestcase(yyruleno==409);
+ case 410: /* noarg_func ::= TODAY */ yytestcase(yyruleno==410);
+ case 411: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==411);
+ case 412: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==412);
+ case 413: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==413);
+ case 414: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==414);
+ case 415: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==415);
+ case 416: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==416);
+ case 417: /* noarg_func ::= USER */ yytestcase(yyruleno==417);
+ case 418: /* star_func ::= COUNT */ yytestcase(yyruleno==418);
+ case 419: /* star_func ::= FIRST */ yytestcase(yyruleno==419);
+ case 420: /* star_func ::= LAST */ yytestcase(yyruleno==420);
+ case 421: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==421);
+{ yylhsminor.yy455 = yymsp[0].minor.yy0; }
+ yymsp[0].minor.yy455 = yylhsminor.yy455;
break;
case 54: /* force_opt ::= */
case 73: /* not_exists_opt ::= */ yytestcase(yyruleno==73);
case 75: /* exists_opt ::= */ yytestcase(yyruleno==75);
- case 292: /* analyze_opt ::= */ yytestcase(yyruleno==292);
- case 299: /* agg_func_opt ::= */ yytestcase(yyruleno==299);
- case 480: /* set_quantifier_opt ::= */ yytestcase(yyruleno==480);
-{ yymsp[1].minor.yy397 = false; }
+ case 293: /* analyze_opt ::= */ yytestcase(yyruleno==293);
+ case 300: /* agg_func_opt ::= */ yytestcase(yyruleno==300);
+ case 482: /* set_quantifier_opt ::= */ yytestcase(yyruleno==482);
+{ yymsp[1].minor.yy163 = false; }
break;
case 55: /* force_opt ::= FORCE */
- case 293: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==293);
- case 300: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==300);
- case 481: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==481);
-{ yymsp[0].minor.yy397 = true; }
+ case 294: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==294);
+ case 301: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==301);
+ case 483: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==483);
+{ yymsp[0].minor.yy163 = true; }
break;
case 56: /* cmd ::= ALTER LOCAL NK_STRING */
{ pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); }
@@ -3936,206 +3968,206 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); }
break;
case 66: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */
-{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy397, &yymsp[-1].minor.yy233, yymsp[0].minor.yy924); }
+{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy163, &yymsp[-1].minor.yy455, yymsp[0].minor.yy44); }
break;
case 67: /* cmd ::= DROP DATABASE exists_opt db_name */
-{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy397, &yymsp[0].minor.yy233); }
+{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy163, &yymsp[0].minor.yy455); }
break;
case 68: /* cmd ::= USE db_name */
-{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy233); }
+{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy455); }
break;
case 69: /* cmd ::= ALTER DATABASE db_name alter_db_options */
-{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy233, yymsp[0].minor.yy924); }
+{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy455, yymsp[0].minor.yy44); }
break;
case 70: /* cmd ::= FLUSH DATABASE db_name */
-{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy233); }
+{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy455); }
break;
case 71: /* cmd ::= TRIM DATABASE db_name speed_opt */
-{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy233, yymsp[0].minor.yy832); }
+{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy455, yymsp[0].minor.yy832); }
break;
case 72: /* not_exists_opt ::= IF NOT EXISTS */
-{ yymsp[-2].minor.yy397 = true; }
+{ yymsp[-2].minor.yy163 = true; }
break;
case 74: /* exists_opt ::= IF EXISTS */
-{ yymsp[-1].minor.yy397 = true; }
+{ yymsp[-1].minor.yy163 = true; }
break;
case 76: /* db_options ::= */
-{ yymsp[1].minor.yy924 = createDefaultDatabaseOptions(pCxt); }
+{ yymsp[1].minor.yy44 = createDefaultDatabaseOptions(pCxt); }
break;
case 77: /* db_options ::= db_options BUFFER NK_INTEGER */
-{ yylhsminor.yy924 = setDatabaseOption(pCxt, yymsp[-2].minor.yy924, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
case 78: /* db_options ::= db_options CACHEMODEL NK_STRING */
-{ yylhsminor.yy924 = setDatabaseOption(pCxt, yymsp[-2].minor.yy924, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
case 79: /* db_options ::= db_options CACHESIZE NK_INTEGER */
-{ yylhsminor.yy924 = setDatabaseOption(pCxt, yymsp[-2].minor.yy924, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
case 80: /* db_options ::= db_options COMP NK_INTEGER */
-{ yylhsminor.yy924 = setDatabaseOption(pCxt, yymsp[-2].minor.yy924, DB_OPTION_COMP, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_COMP, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
case 81: /* db_options ::= db_options DURATION NK_INTEGER */
case 82: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==82);
-{ yylhsminor.yy924 = setDatabaseOption(pCxt, yymsp[-2].minor.yy924, DB_OPTION_DAYS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_DAYS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
case 83: /* db_options ::= db_options MAXROWS NK_INTEGER */
-{ yylhsminor.yy924 = setDatabaseOption(pCxt, yymsp[-2].minor.yy924, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
case 84: /* db_options ::= db_options MINROWS NK_INTEGER */
-{ yylhsminor.yy924 = setDatabaseOption(pCxt, yymsp[-2].minor.yy924, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
case 85: /* db_options ::= db_options KEEP integer_list */
case 86: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==86);
-{ yylhsminor.yy924 = setDatabaseOption(pCxt, yymsp[-2].minor.yy924, DB_OPTION_KEEP, yymsp[0].minor.yy776); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_KEEP, yymsp[0].minor.yy684); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
case 87: /* db_options ::= db_options PAGES NK_INTEGER */
-{ yylhsminor.yy924 = setDatabaseOption(pCxt, yymsp[-2].minor.yy924, DB_OPTION_PAGES, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_PAGES, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
case 88: /* db_options ::= db_options PAGESIZE NK_INTEGER */
-{ yylhsminor.yy924 = setDatabaseOption(pCxt, yymsp[-2].minor.yy924, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
case 89: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */
-{ yylhsminor.yy924 = setDatabaseOption(pCxt, yymsp[-2].minor.yy924, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
case 90: /* db_options ::= db_options PRECISION NK_STRING */
-{ yylhsminor.yy924 = setDatabaseOption(pCxt, yymsp[-2].minor.yy924, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
case 91: /* db_options ::= db_options REPLICA NK_INTEGER */
-{ yylhsminor.yy924 = setDatabaseOption(pCxt, yymsp[-2].minor.yy924, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
case 92: /* db_options ::= db_options VGROUPS NK_INTEGER */
-{ yylhsminor.yy924 = setDatabaseOption(pCxt, yymsp[-2].minor.yy924, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
case 93: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */
-{ yylhsminor.yy924 = setDatabaseOption(pCxt, yymsp[-2].minor.yy924, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
case 94: /* db_options ::= db_options RETENTIONS retention_list */
-{ yylhsminor.yy924 = setDatabaseOption(pCxt, yymsp[-2].minor.yy924, DB_OPTION_RETENTIONS, yymsp[0].minor.yy776); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_RETENTIONS, yymsp[0].minor.yy684); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
case 95: /* db_options ::= db_options SCHEMALESS NK_INTEGER */
-{ yylhsminor.yy924 = setDatabaseOption(pCxt, yymsp[-2].minor.yy924, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
case 96: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */
-{ yylhsminor.yy924 = setDatabaseOption(pCxt, yymsp[-2].minor.yy924, DB_OPTION_WAL, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_WAL, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
case 97: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */
-{ yylhsminor.yy924 = setDatabaseOption(pCxt, yymsp[-2].minor.yy924, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
case 98: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */
-{ yylhsminor.yy924 = setDatabaseOption(pCxt, yymsp[-2].minor.yy924, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
case 99: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yylhsminor.yy924 = setDatabaseOption(pCxt, yymsp[-3].minor.yy924, DB_OPTION_WAL_RETENTION_PERIOD, &t);
+ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-3].minor.yy44, DB_OPTION_WAL_RETENTION_PERIOD, &t);
}
- yymsp[-3].minor.yy924 = yylhsminor.yy924;
+ yymsp[-3].minor.yy44 = yylhsminor.yy44;
break;
case 100: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */
-{ yylhsminor.yy924 = setDatabaseOption(pCxt, yymsp[-2].minor.yy924, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
case 101: /* db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yylhsminor.yy924 = setDatabaseOption(pCxt, yymsp[-3].minor.yy924, DB_OPTION_WAL_RETENTION_SIZE, &t);
+ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-3].minor.yy44, DB_OPTION_WAL_RETENTION_SIZE, &t);
}
- yymsp[-3].minor.yy924 = yylhsminor.yy924;
+ yymsp[-3].minor.yy44 = yylhsminor.yy44;
break;
case 102: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */
-{ yylhsminor.yy924 = setDatabaseOption(pCxt, yymsp[-2].minor.yy924, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
case 103: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */
-{ yylhsminor.yy924 = setDatabaseOption(pCxt, yymsp[-2].minor.yy924, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
case 104: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */
-{ yylhsminor.yy924 = setDatabaseOption(pCxt, yymsp[-2].minor.yy924, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
case 105: /* db_options ::= db_options TABLE_PREFIX NK_INTEGER */
-{ yylhsminor.yy924 = setDatabaseOption(pCxt, yymsp[-2].minor.yy924, DB_OPTION_TABLE_PREFIX, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_TABLE_PREFIX, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
case 106: /* db_options ::= db_options TABLE_SUFFIX NK_INTEGER */
-{ yylhsminor.yy924 = setDatabaseOption(pCxt, yymsp[-2].minor.yy924, DB_OPTION_TABLE_SUFFIX, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = setDatabaseOption(pCxt, yymsp[-2].minor.yy44, DB_OPTION_TABLE_SUFFIX, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
case 107: /* alter_db_options ::= alter_db_option */
-{ yylhsminor.yy924 = createAlterDatabaseOptions(pCxt); yylhsminor.yy924 = setAlterDatabaseOption(pCxt, yylhsminor.yy924, &yymsp[0].minor.yy257); }
- yymsp[0].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = createAlterDatabaseOptions(pCxt); yylhsminor.yy44 = setAlterDatabaseOption(pCxt, yylhsminor.yy44, &yymsp[0].minor.yy153); }
+ yymsp[0].minor.yy44 = yylhsminor.yy44;
break;
case 108: /* alter_db_options ::= alter_db_options alter_db_option */
-{ yylhsminor.yy924 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy924, &yymsp[0].minor.yy257); }
- yymsp[-1].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy44, &yymsp[0].minor.yy153); }
+ yymsp[-1].minor.yy44 = yylhsminor.yy44;
break;
case 109: /* alter_db_option ::= BUFFER NK_INTEGER */
-{ yymsp[-1].minor.yy257.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy257.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy153.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy153.val = yymsp[0].minor.yy0; }
break;
case 110: /* alter_db_option ::= CACHEMODEL NK_STRING */
-{ yymsp[-1].minor.yy257.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy257.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy153.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy153.val = yymsp[0].minor.yy0; }
break;
case 111: /* alter_db_option ::= CACHESIZE NK_INTEGER */
-{ yymsp[-1].minor.yy257.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy257.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy153.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy153.val = yymsp[0].minor.yy0; }
break;
case 112: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */
-{ yymsp[-1].minor.yy257.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy257.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy153.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy153.val = yymsp[0].minor.yy0; }
break;
case 113: /* alter_db_option ::= KEEP integer_list */
case 114: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==114);
-{ yymsp[-1].minor.yy257.type = DB_OPTION_KEEP; yymsp[-1].minor.yy257.pList = yymsp[0].minor.yy776; }
+{ yymsp[-1].minor.yy153.type = DB_OPTION_KEEP; yymsp[-1].minor.yy153.pList = yymsp[0].minor.yy684; }
break;
case 115: /* alter_db_option ::= PAGES NK_INTEGER */
-{ yymsp[-1].minor.yy257.type = DB_OPTION_PAGES; yymsp[-1].minor.yy257.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy153.type = DB_OPTION_PAGES; yymsp[-1].minor.yy153.val = yymsp[0].minor.yy0; }
break;
case 116: /* alter_db_option ::= REPLICA NK_INTEGER */
-{ yymsp[-1].minor.yy257.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy257.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy153.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy153.val = yymsp[0].minor.yy0; }
break;
case 117: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */
-{ yymsp[-1].minor.yy257.type = DB_OPTION_WAL; yymsp[-1].minor.yy257.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy153.type = DB_OPTION_WAL; yymsp[-1].minor.yy153.val = yymsp[0].minor.yy0; }
break;
case 118: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */
-{ yymsp[-1].minor.yy257.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy257.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy153.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy153.val = yymsp[0].minor.yy0; }
break;
case 119: /* integer_list ::= NK_INTEGER */
-{ yylhsminor.yy776 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy684 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy684 = yylhsminor.yy684;
break;
case 120: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */
- case 327: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==327);
-{ yylhsminor.yy776 = addNodeToList(pCxt, yymsp[-2].minor.yy776, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+ case 328: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==328);
+{ yylhsminor.yy684 = addNodeToList(pCxt, yymsp[-2].minor.yy684, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy684 = yylhsminor.yy684;
break;
case 121: /* variable_list ::= NK_VARIABLE */
-{ yylhsminor.yy776 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy684 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy684 = yylhsminor.yy684;
break;
case 122: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */
-{ yylhsminor.yy776 = addNodeToList(pCxt, yymsp[-2].minor.yy776, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy684 = addNodeToList(pCxt, yymsp[-2].minor.yy684, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy684 = yylhsminor.yy684;
break;
case 123: /* retention_list ::= retention */
case 145: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==145);
@@ -4145,14 +4177,14 @@ static YYACTIONTYPE yy_reduce(
case 204: /* col_name_list ::= col_name */ yytestcase(yyruleno==204);
case 255: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==255);
case 269: /* func_list ::= func */ yytestcase(yyruleno==269);
- case 355: /* literal_list ::= signed_literal */ yytestcase(yyruleno==355);
- case 422: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==422);
- case 428: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==428);
- case 483: /* select_list ::= select_item */ yytestcase(yyruleno==483);
- case 494: /* partition_list ::= partition_item */ yytestcase(yyruleno==494);
- case 547: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==547);
-{ yylhsminor.yy776 = createNodeList(pCxt, yymsp[0].minor.yy924); }
- yymsp[0].minor.yy776 = yylhsminor.yy776;
+ case 357: /* literal_list ::= signed_literal */ yytestcase(yyruleno==357);
+ case 424: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==424);
+ case 430: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==430);
+ case 485: /* select_list ::= select_item */ yytestcase(yyruleno==485);
+ case 496: /* partition_list ::= partition_item */ yytestcase(yyruleno==496);
+ case 549: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==549);
+{ yylhsminor.yy684 = createNodeList(pCxt, yymsp[0].minor.yy44); }
+ yymsp[0].minor.yy684 = yylhsminor.yy684;
break;
case 124: /* retention_list ::= retention_list NK_COMMA retention */
case 156: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==156);
@@ -4160,276 +4192,277 @@ static YYACTIONTYPE yy_reduce(
case 205: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==205);
case 256: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==256);
case 270: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==270);
- case 356: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==356);
- case 423: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==423);
- case 484: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==484);
- case 495: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==495);
- case 548: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==548);
-{ yylhsminor.yy776 = addNodeToList(pCxt, yymsp[-2].minor.yy776, yymsp[0].minor.yy924); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+ case 358: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==358);
+ case 425: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==425);
+ case 486: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==486);
+ case 497: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==497);
+ case 550: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==550);
+{ yylhsminor.yy684 = addNodeToList(pCxt, yymsp[-2].minor.yy684, yymsp[0].minor.yy44); }
+ yymsp[-2].minor.yy684 = yylhsminor.yy684;
break;
case 125: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */
-{ yylhsminor.yy924 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
case 126: /* speed_opt ::= */
- case 301: /* bufsize_opt ::= */ yytestcase(yyruleno==301);
+ case 302: /* bufsize_opt ::= */ yytestcase(yyruleno==302);
{ yymsp[1].minor.yy832 = 0; }
break;
case 127: /* speed_opt ::= MAX_SPEED NK_INTEGER */
- case 302: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==302);
+ case 303: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==303);
{ yymsp[-1].minor.yy832 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); }
break;
case 128: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */
case 130: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==130);
-{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy397, yymsp[-5].minor.yy924, yymsp[-3].minor.yy776, yymsp[-1].minor.yy776, yymsp[0].minor.yy924); }
+{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy163, yymsp[-5].minor.yy44, yymsp[-3].minor.yy684, yymsp[-1].minor.yy684, yymsp[0].minor.yy44); }
break;
case 129: /* cmd ::= CREATE TABLE multi_create_clause */
-{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy776); }
+{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy684); }
break;
case 131: /* cmd ::= DROP TABLE multi_drop_clause */
-{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy776); }
+{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy684); }
break;
case 132: /* cmd ::= DROP STABLE exists_opt full_table_name */
-{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy397, yymsp[0].minor.yy924); }
+{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy163, yymsp[0].minor.yy44); }
break;
case 133: /* cmd ::= ALTER TABLE alter_table_clause */
- case 329: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==329);
-{ pCxt->pRootNode = yymsp[0].minor.yy924; }
+ case 330: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==330);
+ case 331: /* cmd ::= insert_query */ yytestcase(yyruleno==331);
+{ pCxt->pRootNode = yymsp[0].minor.yy44; }
break;
case 134: /* cmd ::= ALTER STABLE alter_table_clause */
-{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy924); }
+{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy44); }
break;
case 135: /* alter_table_clause ::= full_table_name alter_table_options */
-{ yylhsminor.yy924 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy924, yymsp[0].minor.yy924); }
- yymsp[-1].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy44, yymsp[0].minor.yy44); }
+ yymsp[-1].minor.yy44 = yylhsminor.yy44;
break;
case 136: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */
-{ yylhsminor.yy924 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy924, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy233, yymsp[0].minor.yy852); }
- yymsp[-4].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy44, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy455, yymsp[0].minor.yy260); }
+ yymsp[-4].minor.yy44 = yylhsminor.yy44;
break;
case 137: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */
-{ yylhsminor.yy924 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy924, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy233); }
- yymsp[-3].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy44, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy455); }
+ yymsp[-3].minor.yy44 = yylhsminor.yy44;
break;
case 138: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */
-{ yylhsminor.yy924 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy924, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy233, yymsp[0].minor.yy852); }
- yymsp[-4].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy44, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy455, yymsp[0].minor.yy260); }
+ yymsp[-4].minor.yy44 = yylhsminor.yy44;
break;
case 139: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */
-{ yylhsminor.yy924 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy924, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy233, &yymsp[0].minor.yy233); }
- yymsp[-4].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy44, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy455, &yymsp[0].minor.yy455); }
+ yymsp[-4].minor.yy44 = yylhsminor.yy44;
break;
case 140: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */
-{ yylhsminor.yy924 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy924, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy233, yymsp[0].minor.yy852); }
- yymsp[-4].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy44, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy455, yymsp[0].minor.yy260); }
+ yymsp[-4].minor.yy44 = yylhsminor.yy44;
break;
case 141: /* alter_table_clause ::= full_table_name DROP TAG column_name */
-{ yylhsminor.yy924 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy924, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy233); }
- yymsp[-3].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy44, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy455); }
+ yymsp[-3].minor.yy44 = yylhsminor.yy44;
break;
case 142: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
-{ yylhsminor.yy924 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy924, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy233, yymsp[0].minor.yy852); }
- yymsp[-4].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy44, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy455, yymsp[0].minor.yy260); }
+ yymsp[-4].minor.yy44 = yylhsminor.yy44;
break;
case 143: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
-{ yylhsminor.yy924 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy924, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy233, &yymsp[0].minor.yy233); }
- yymsp[-4].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy44, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy455, &yymsp[0].minor.yy455); }
+ yymsp[-4].minor.yy44 = yylhsminor.yy44;
break;
case 144: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */
-{ yylhsminor.yy924 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy924, &yymsp[-2].minor.yy233, yymsp[0].minor.yy924); }
- yymsp[-5].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy44, &yymsp[-2].minor.yy455, yymsp[0].minor.yy44); }
+ yymsp[-5].minor.yy44 = yylhsminor.yy44;
break;
case 146: /* multi_create_clause ::= multi_create_clause create_subtable_clause */
case 149: /* multi_drop_clause ::= multi_drop_clause drop_table_clause */ yytestcase(yyruleno==149);
- case 429: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==429);
-{ yylhsminor.yy776 = addNodeToList(pCxt, yymsp[-1].minor.yy776, yymsp[0].minor.yy924); }
- yymsp[-1].minor.yy776 = yylhsminor.yy776;
+ case 431: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==431);
+{ yylhsminor.yy684 = addNodeToList(pCxt, yymsp[-1].minor.yy684, yymsp[0].minor.yy44); }
+ yymsp[-1].minor.yy684 = yylhsminor.yy684;
break;
case 147: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */
-{ yylhsminor.yy924 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy397, yymsp[-8].minor.yy924, yymsp[-6].minor.yy924, yymsp[-5].minor.yy776, yymsp[-2].minor.yy776, yymsp[0].minor.yy924); }
- yymsp[-9].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy163, yymsp[-8].minor.yy44, yymsp[-6].minor.yy44, yymsp[-5].minor.yy684, yymsp[-2].minor.yy684, yymsp[0].minor.yy44); }
+ yymsp[-9].minor.yy44 = yylhsminor.yy44;
break;
case 150: /* drop_table_clause ::= exists_opt full_table_name */
-{ yylhsminor.yy924 = createDropTableClause(pCxt, yymsp[-1].minor.yy397, yymsp[0].minor.yy924); }
- yymsp[-1].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = createDropTableClause(pCxt, yymsp[-1].minor.yy163, yymsp[0].minor.yy44); }
+ yymsp[-1].minor.yy44 = yylhsminor.yy44;
break;
case 151: /* specific_cols_opt ::= */
case 182: /* tags_def_opt ::= */ yytestcase(yyruleno==182);
case 254: /* tag_list_opt ::= */ yytestcase(yyruleno==254);
- case 305: /* col_list_opt ::= */ yytestcase(yyruleno==305);
- case 307: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==307);
- case 492: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==492);
- case 515: /* group_by_clause_opt ::= */ yytestcase(yyruleno==515);
- case 534: /* order_by_clause_opt ::= */ yytestcase(yyruleno==534);
-{ yymsp[1].minor.yy776 = NULL; }
+ case 306: /* col_list_opt ::= */ yytestcase(yyruleno==306);
+ case 308: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==308);
+ case 494: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==494);
+ case 517: /* group_by_clause_opt ::= */ yytestcase(yyruleno==517);
+ case 536: /* order_by_clause_opt ::= */ yytestcase(yyruleno==536);
+{ yymsp[1].minor.yy684 = NULL; }
break;
case 152: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */
- case 306: /* col_list_opt ::= NK_LP col_name_list NK_RP */ yytestcase(yyruleno==306);
-{ yymsp[-2].minor.yy776 = yymsp[-1].minor.yy776; }
+ case 307: /* col_list_opt ::= NK_LP col_name_list NK_RP */ yytestcase(yyruleno==307);
+{ yymsp[-2].minor.yy684 = yymsp[-1].minor.yy684; }
break;
case 153: /* full_table_name ::= table_name */
-{ yylhsminor.yy924 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy233, NULL); }
- yymsp[0].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy455, NULL); }
+ yymsp[0].minor.yy44 = yylhsminor.yy44;
break;
case 154: /* full_table_name ::= db_name NK_DOT table_name */
-{ yylhsminor.yy924 = createRealTableNode(pCxt, &yymsp[-2].minor.yy233, &yymsp[0].minor.yy233, NULL); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = createRealTableNode(pCxt, &yymsp[-2].minor.yy455, &yymsp[0].minor.yy455, NULL); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
case 157: /* column_def ::= column_name type_name */
-{ yylhsminor.yy924 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy233, yymsp[0].minor.yy852, NULL); }
- yymsp[-1].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy455, yymsp[0].minor.yy260, NULL); }
+ yymsp[-1].minor.yy44 = yylhsminor.yy44;
break;
case 158: /* column_def ::= column_name type_name COMMENT NK_STRING */
-{ yylhsminor.yy924 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy233, yymsp[-2].minor.yy852, &yymsp[0].minor.yy0); }
- yymsp[-3].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy455, yymsp[-2].minor.yy260, &yymsp[0].minor.yy0); }
+ yymsp[-3].minor.yy44 = yylhsminor.yy44;
break;
case 159: /* type_name ::= BOOL */
-{ yymsp[0].minor.yy852 = createDataType(TSDB_DATA_TYPE_BOOL); }
+{ yymsp[0].minor.yy260 = createDataType(TSDB_DATA_TYPE_BOOL); }
break;
case 160: /* type_name ::= TINYINT */
-{ yymsp[0].minor.yy852 = createDataType(TSDB_DATA_TYPE_TINYINT); }
+{ yymsp[0].minor.yy260 = createDataType(TSDB_DATA_TYPE_TINYINT); }
break;
case 161: /* type_name ::= SMALLINT */
-{ yymsp[0].minor.yy852 = createDataType(TSDB_DATA_TYPE_SMALLINT); }
+{ yymsp[0].minor.yy260 = createDataType(TSDB_DATA_TYPE_SMALLINT); }
break;
case 162: /* type_name ::= INT */
case 163: /* type_name ::= INTEGER */ yytestcase(yyruleno==163);
-{ yymsp[0].minor.yy852 = createDataType(TSDB_DATA_TYPE_INT); }
+{ yymsp[0].minor.yy260 = createDataType(TSDB_DATA_TYPE_INT); }
break;
case 164: /* type_name ::= BIGINT */
-{ yymsp[0].minor.yy852 = createDataType(TSDB_DATA_TYPE_BIGINT); }
+{ yymsp[0].minor.yy260 = createDataType(TSDB_DATA_TYPE_BIGINT); }
break;
case 165: /* type_name ::= FLOAT */
-{ yymsp[0].minor.yy852 = createDataType(TSDB_DATA_TYPE_FLOAT); }
+{ yymsp[0].minor.yy260 = createDataType(TSDB_DATA_TYPE_FLOAT); }
break;
case 166: /* type_name ::= DOUBLE */
-{ yymsp[0].minor.yy852 = createDataType(TSDB_DATA_TYPE_DOUBLE); }
+{ yymsp[0].minor.yy260 = createDataType(TSDB_DATA_TYPE_DOUBLE); }
break;
case 167: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy852 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); }
+{ yymsp[-3].minor.yy260 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); }
break;
case 168: /* type_name ::= TIMESTAMP */
-{ yymsp[0].minor.yy852 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); }
+{ yymsp[0].minor.yy260 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); }
break;
case 169: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy852 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); }
+{ yymsp[-3].minor.yy260 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); }
break;
case 170: /* type_name ::= TINYINT UNSIGNED */
-{ yymsp[-1].minor.yy852 = createDataType(TSDB_DATA_TYPE_UTINYINT); }
+{ yymsp[-1].minor.yy260 = createDataType(TSDB_DATA_TYPE_UTINYINT); }
break;
case 171: /* type_name ::= SMALLINT UNSIGNED */
-{ yymsp[-1].minor.yy852 = createDataType(TSDB_DATA_TYPE_USMALLINT); }
+{ yymsp[-1].minor.yy260 = createDataType(TSDB_DATA_TYPE_USMALLINT); }
break;
case 172: /* type_name ::= INT UNSIGNED */
-{ yymsp[-1].minor.yy852 = createDataType(TSDB_DATA_TYPE_UINT); }
+{ yymsp[-1].minor.yy260 = createDataType(TSDB_DATA_TYPE_UINT); }
break;
case 173: /* type_name ::= BIGINT UNSIGNED */
-{ yymsp[-1].minor.yy852 = createDataType(TSDB_DATA_TYPE_UBIGINT); }
+{ yymsp[-1].minor.yy260 = createDataType(TSDB_DATA_TYPE_UBIGINT); }
break;
case 174: /* type_name ::= JSON */
-{ yymsp[0].minor.yy852 = createDataType(TSDB_DATA_TYPE_JSON); }
+{ yymsp[0].minor.yy260 = createDataType(TSDB_DATA_TYPE_JSON); }
break;
case 175: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy852 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); }
+{ yymsp[-3].minor.yy260 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); }
break;
case 176: /* type_name ::= MEDIUMBLOB */
-{ yymsp[0].minor.yy852 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); }
+{ yymsp[0].minor.yy260 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); }
break;
case 177: /* type_name ::= BLOB */
-{ yymsp[0].minor.yy852 = createDataType(TSDB_DATA_TYPE_BLOB); }
+{ yymsp[0].minor.yy260 = createDataType(TSDB_DATA_TYPE_BLOB); }
break;
case 178: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy852 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); }
+{ yymsp[-3].minor.yy260 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); }
break;
case 179: /* type_name ::= DECIMAL */
-{ yymsp[0].minor.yy852 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
+{ yymsp[0].minor.yy260 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
break;
case 180: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy852 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
+{ yymsp[-3].minor.yy260 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
break;
case 181: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
-{ yymsp[-5].minor.yy852 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
+{ yymsp[-5].minor.yy260 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
break;
case 183: /* tags_def_opt ::= tags_def */
- case 308: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==308);
- case 421: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==421);
-{ yylhsminor.yy776 = yymsp[0].minor.yy776; }
- yymsp[0].minor.yy776 = yylhsminor.yy776;
+ case 309: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==309);
+ case 423: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==423);
+{ yylhsminor.yy684 = yymsp[0].minor.yy684; }
+ yymsp[0].minor.yy684 = yylhsminor.yy684;
break;
case 184: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */
- case 309: /* tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ yytestcase(yyruleno==309);
-{ yymsp[-3].minor.yy776 = yymsp[-1].minor.yy776; }
+ case 310: /* tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ yytestcase(yyruleno==310);
+{ yymsp[-3].minor.yy684 = yymsp[-1].minor.yy684; }
break;
case 185: /* table_options ::= */
-{ yymsp[1].minor.yy924 = createDefaultTableOptions(pCxt); }
+{ yymsp[1].minor.yy44 = createDefaultTableOptions(pCxt); }
break;
case 186: /* table_options ::= table_options COMMENT NK_STRING */
-{ yylhsminor.yy924 = setTableOption(pCxt, yymsp[-2].minor.yy924, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = setTableOption(pCxt, yymsp[-2].minor.yy44, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
case 187: /* table_options ::= table_options MAX_DELAY duration_list */
-{ yylhsminor.yy924 = setTableOption(pCxt, yymsp[-2].minor.yy924, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy776); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = setTableOption(pCxt, yymsp[-2].minor.yy44, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy684); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
case 188: /* table_options ::= table_options WATERMARK duration_list */
-{ yylhsminor.yy924 = setTableOption(pCxt, yymsp[-2].minor.yy924, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy776); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = setTableOption(pCxt, yymsp[-2].minor.yy44, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy684); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
case 189: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */
-{ yylhsminor.yy924 = setTableOption(pCxt, yymsp[-4].minor.yy924, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy776); }
- yymsp[-4].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = setTableOption(pCxt, yymsp[-4].minor.yy44, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy684); }
+ yymsp[-4].minor.yy44 = yylhsminor.yy44;
break;
case 190: /* table_options ::= table_options TTL NK_INTEGER */
-{ yylhsminor.yy924 = setTableOption(pCxt, yymsp[-2].minor.yy924, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = setTableOption(pCxt, yymsp[-2].minor.yy44, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
case 191: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */
-{ yylhsminor.yy924 = setTableOption(pCxt, yymsp[-4].minor.yy924, TABLE_OPTION_SMA, yymsp[-1].minor.yy776); }
- yymsp[-4].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = setTableOption(pCxt, yymsp[-4].minor.yy44, TABLE_OPTION_SMA, yymsp[-1].minor.yy684); }
+ yymsp[-4].minor.yy44 = yylhsminor.yy44;
break;
case 192: /* table_options ::= table_options DELETE_MARK duration_list */
-{ yylhsminor.yy924 = setTableOption(pCxt, yymsp[-2].minor.yy924, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy776); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = setTableOption(pCxt, yymsp[-2].minor.yy44, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy684); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
case 193: /* alter_table_options ::= alter_table_option */
-{ yylhsminor.yy924 = createAlterTableOptions(pCxt); yylhsminor.yy924 = setTableOption(pCxt, yylhsminor.yy924, yymsp[0].minor.yy257.type, &yymsp[0].minor.yy257.val); }
- yymsp[0].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = createAlterTableOptions(pCxt); yylhsminor.yy44 = setTableOption(pCxt, yylhsminor.yy44, yymsp[0].minor.yy153.type, &yymsp[0].minor.yy153.val); }
+ yymsp[0].minor.yy44 = yylhsminor.yy44;
break;
case 194: /* alter_table_options ::= alter_table_options alter_table_option */
-{ yylhsminor.yy924 = setTableOption(pCxt, yymsp[-1].minor.yy924, yymsp[0].minor.yy257.type, &yymsp[0].minor.yy257.val); }
- yymsp[-1].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = setTableOption(pCxt, yymsp[-1].minor.yy44, yymsp[0].minor.yy153.type, &yymsp[0].minor.yy153.val); }
+ yymsp[-1].minor.yy44 = yylhsminor.yy44;
break;
case 195: /* alter_table_option ::= COMMENT NK_STRING */
-{ yymsp[-1].minor.yy257.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy257.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy153.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy153.val = yymsp[0].minor.yy0; }
break;
case 196: /* alter_table_option ::= TTL NK_INTEGER */
-{ yymsp[-1].minor.yy257.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy257.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy153.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy153.val = yymsp[0].minor.yy0; }
break;
case 197: /* duration_list ::= duration_literal */
- case 385: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==385);
-{ yylhsminor.yy776 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy924)); }
- yymsp[0].minor.yy776 = yylhsminor.yy776;
+ case 387: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==387);
+{ yylhsminor.yy684 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy44)); }
+ yymsp[0].minor.yy684 = yylhsminor.yy684;
break;
case 198: /* duration_list ::= duration_list NK_COMMA duration_literal */
- case 386: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==386);
-{ yylhsminor.yy776 = addNodeToList(pCxt, yymsp[-2].minor.yy776, releaseRawExprNode(pCxt, yymsp[0].minor.yy924)); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+ case 388: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==388);
+{ yylhsminor.yy684 = addNodeToList(pCxt, yymsp[-2].minor.yy684, releaseRawExprNode(pCxt, yymsp[0].minor.yy44)); }
+ yymsp[-2].minor.yy684 = yylhsminor.yy684;
break;
case 201: /* rollup_func_name ::= function_name */
-{ yylhsminor.yy924 = createFunctionNode(pCxt, &yymsp[0].minor.yy233, NULL); }
- yymsp[0].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = createFunctionNode(pCxt, &yymsp[0].minor.yy455, NULL); }
+ yymsp[0].minor.yy44 = yylhsminor.yy44;
break;
case 202: /* rollup_func_name ::= FIRST */
case 203: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==203);
case 258: /* tag_item ::= QTAGS */ yytestcase(yyruleno==258);
-{ yylhsminor.yy924 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); }
- yymsp[0].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); }
+ yymsp[0].minor.yy44 = yylhsminor.yy44;
break;
case 206: /* col_name ::= column_name */
case 259: /* tag_item ::= column_name */ yytestcase(yyruleno==259);
-{ yylhsminor.yy924 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy233); }
- yymsp[0].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy455); }
+ yymsp[0].minor.yy44 = yylhsminor.yy44;
break;
case 207: /* cmd ::= SHOW DNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); }
@@ -4444,13 +4477,13 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); }
break;
case 211: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy924, yymsp[0].minor.yy924, OP_TYPE_LIKE); }
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy44, yymsp[0].minor.yy44, OP_TYPE_LIKE); }
break;
case 212: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy924, yymsp[0].minor.yy924, OP_TYPE_LIKE); }
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy44, yymsp[0].minor.yy44, OP_TYPE_LIKE); }
break;
case 213: /* cmd ::= SHOW db_name_cond_opt VGROUPS */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy924, NULL, OP_TYPE_LIKE); }
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy44, NULL, OP_TYPE_LIKE); }
break;
case 214: /* cmd ::= SHOW MNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); }
@@ -4462,7 +4495,7 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); }
break;
case 217: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy924, yymsp[-1].minor.yy924, OP_TYPE_EQUAL); }
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy44, yymsp[-1].minor.yy44, OP_TYPE_EQUAL); }
break;
case 218: /* cmd ::= SHOW STREAMS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); }
@@ -4481,13 +4514,13 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); }
break;
case 224: /* cmd ::= SHOW CREATE DATABASE db_name */
-{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy233); }
+{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy455); }
break;
case 225: /* cmd ::= SHOW CREATE TABLE full_table_name */
-{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy924); }
+{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy44); }
break;
case 226: /* cmd ::= SHOW CREATE STABLE full_table_name */
-{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy924); }
+{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy44); }
break;
case 227: /* cmd ::= SHOW QUERIES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); }
@@ -4506,7 +4539,7 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); }
break;
case 233: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */
-{ pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy924); }
+{ pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy44); }
break;
case 234: /* cmd ::= SHOW BNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); }
@@ -4521,7 +4554,7 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); }
break;
case 238: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */
-{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy924); }
+{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy44); }
break;
case 239: /* cmd ::= SHOW CONSUMERS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); }
@@ -4530,10 +4563,10 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); }
break;
case 241: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy924, yymsp[-1].minor.yy924, OP_TYPE_EQUAL); }
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy44, yymsp[-1].minor.yy44, OP_TYPE_EQUAL); }
break;
case 242: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */
-{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy924, yymsp[0].minor.yy924, yymsp[-3].minor.yy776); }
+{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy44, yymsp[0].minor.yy44, yymsp[-3].minor.yy684); }
break;
case 243: /* cmd ::= SHOW VNODES NK_INTEGER */
{ pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); }
@@ -4542,755 +4575,756 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, createValueNode(pCxt, TSDB_DATA_TYPE_VARCHAR, &yymsp[0].minor.yy0)); }
break;
case 245: /* cmd ::= SHOW db_name_cond_opt ALIVE */
-{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy924, QUERY_NODE_SHOW_DB_ALIVE_STMT); }
+{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy44, QUERY_NODE_SHOW_DB_ALIVE_STMT); }
break;
case 246: /* cmd ::= SHOW CLUSTER ALIVE */
{ pCxt->pRootNode = createShowAliveStmt(pCxt, NULL, QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT); }
break;
case 247: /* db_name_cond_opt ::= */
case 252: /* from_db_opt ::= */ yytestcase(yyruleno==252);
-{ yymsp[1].minor.yy924 = createDefaultDatabaseCondValue(pCxt); }
+{ yymsp[1].minor.yy44 = createDefaultDatabaseCondValue(pCxt); }
break;
case 248: /* db_name_cond_opt ::= db_name NK_DOT */
-{ yylhsminor.yy924 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy233); }
- yymsp[-1].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy455); }
+ yymsp[-1].minor.yy44 = yylhsminor.yy44;
break;
case 249: /* like_pattern_opt ::= */
- case 317: /* subtable_opt ::= */ yytestcase(yyruleno==317);
- case 431: /* case_when_else_opt ::= */ yytestcase(yyruleno==431);
- case 461: /* from_clause_opt ::= */ yytestcase(yyruleno==461);
- case 490: /* where_clause_opt ::= */ yytestcase(yyruleno==490);
- case 499: /* twindow_clause_opt ::= */ yytestcase(yyruleno==499);
- case 505: /* sliding_opt ::= */ yytestcase(yyruleno==505);
- case 507: /* fill_opt ::= */ yytestcase(yyruleno==507);
- case 519: /* having_clause_opt ::= */ yytestcase(yyruleno==519);
- case 521: /* range_opt ::= */ yytestcase(yyruleno==521);
- case 523: /* every_opt ::= */ yytestcase(yyruleno==523);
- case 536: /* slimit_clause_opt ::= */ yytestcase(yyruleno==536);
- case 540: /* limit_clause_opt ::= */ yytestcase(yyruleno==540);
-{ yymsp[1].minor.yy924 = NULL; }
+ case 318: /* subtable_opt ::= */ yytestcase(yyruleno==318);
+ case 433: /* case_when_else_opt ::= */ yytestcase(yyruleno==433);
+ case 463: /* from_clause_opt ::= */ yytestcase(yyruleno==463);
+ case 492: /* where_clause_opt ::= */ yytestcase(yyruleno==492);
+ case 501: /* twindow_clause_opt ::= */ yytestcase(yyruleno==501);
+ case 507: /* sliding_opt ::= */ yytestcase(yyruleno==507);
+ case 509: /* fill_opt ::= */ yytestcase(yyruleno==509);
+ case 521: /* having_clause_opt ::= */ yytestcase(yyruleno==521);
+ case 523: /* range_opt ::= */ yytestcase(yyruleno==523);
+ case 525: /* every_opt ::= */ yytestcase(yyruleno==525);
+ case 538: /* slimit_clause_opt ::= */ yytestcase(yyruleno==538);
+ case 542: /* limit_clause_opt ::= */ yytestcase(yyruleno==542);
+{ yymsp[1].minor.yy44 = NULL; }
break;
case 250: /* like_pattern_opt ::= LIKE NK_STRING */
-{ yymsp[-1].minor.yy924 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
+{ yymsp[-1].minor.yy44 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
break;
case 251: /* table_name_cond ::= table_name */
-{ yylhsminor.yy924 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy233); }
- yymsp[0].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy455); }
+ yymsp[0].minor.yy44 = yylhsminor.yy44;
break;
case 253: /* from_db_opt ::= FROM db_name */
-{ yymsp[-1].minor.yy924 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy233); }
+{ yymsp[-1].minor.yy44 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy455); }
break;
case 257: /* tag_item ::= TBNAME */
-{ yylhsminor.yy924 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy44 = yylhsminor.yy44;
break;
case 260: /* tag_item ::= column_name column_alias */
-{ yylhsminor.yy924 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy233), &yymsp[0].minor.yy233); }
- yymsp[-1].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy455), &yymsp[0].minor.yy455); }
+ yymsp[-1].minor.yy44 = yylhsminor.yy44;
break;
case 261: /* tag_item ::= column_name AS column_alias */
-{ yylhsminor.yy924 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy233), &yymsp[0].minor.yy233); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy455), &yymsp[0].minor.yy455); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
case 262: /* cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */
-{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy397, yymsp[-3].minor.yy924, yymsp[-1].minor.yy924, NULL, yymsp[0].minor.yy924); }
+{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy163, yymsp[-3].minor.yy44, yymsp[-1].minor.yy44, NULL, yymsp[0].minor.yy44); }
break;
case 263: /* cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP */
-{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy397, yymsp[-5].minor.yy924, yymsp[-3].minor.yy924, yymsp[-1].minor.yy776, NULL); }
+{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy163, yymsp[-5].minor.yy44, yymsp[-3].minor.yy44, yymsp[-1].minor.yy684, NULL); }
break;
case 264: /* cmd ::= DROP INDEX exists_opt full_index_name */
-{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy397, yymsp[0].minor.yy924); }
+{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy163, yymsp[0].minor.yy44); }
break;
case 265: /* full_index_name ::= index_name */
-{ yylhsminor.yy924 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy233); }
- yymsp[0].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy455); }
+ yymsp[0].minor.yy44 = yylhsminor.yy44;
break;
case 266: /* full_index_name ::= db_name NK_DOT index_name */
-{ yylhsminor.yy924 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy233, &yymsp[0].minor.yy233); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy455, &yymsp[0].minor.yy455); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
case 267: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */
-{ yymsp[-9].minor.yy924 = createIndexOption(pCxt, yymsp[-7].minor.yy776, releaseRawExprNode(pCxt, yymsp[-3].minor.yy924), NULL, yymsp[-1].minor.yy924, yymsp[0].minor.yy924); }
+{ yymsp[-9].minor.yy44 = createIndexOption(pCxt, yymsp[-7].minor.yy684, releaseRawExprNode(pCxt, yymsp[-3].minor.yy44), NULL, yymsp[-1].minor.yy44, yymsp[0].minor.yy44); }
break;
case 268: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */
-{ yymsp[-11].minor.yy924 = createIndexOption(pCxt, yymsp[-9].minor.yy776, releaseRawExprNode(pCxt, yymsp[-5].minor.yy924), releaseRawExprNode(pCxt, yymsp[-3].minor.yy924), yymsp[-1].minor.yy924, yymsp[0].minor.yy924); }
+{ yymsp[-11].minor.yy44 = createIndexOption(pCxt, yymsp[-9].minor.yy684, releaseRawExprNode(pCxt, yymsp[-5].minor.yy44), releaseRawExprNode(pCxt, yymsp[-3].minor.yy44), yymsp[-1].minor.yy44, yymsp[0].minor.yy44); }
break;
case 271: /* func ::= sma_func_name NK_LP expression_list NK_RP */
-{ yylhsminor.yy924 = createFunctionNode(pCxt, &yymsp[-3].minor.yy233, yymsp[-1].minor.yy776); }
- yymsp[-3].minor.yy924 = yylhsminor.yy924;
+{ yylhsminor.yy44 = createFunctionNode(pCxt, &yymsp[-3].minor.yy455, yymsp[-1].minor.yy684); }
+ yymsp[-3].minor.yy44 = yylhsminor.yy44;
break;
case 277: /* sma_stream_opt ::= */
- case 310: /* stream_options ::= */ yytestcase(yyruleno==310);
-{ yymsp[1].minor.yy924 = createStreamOptions(pCxt); }
+ case 311: /* stream_options ::= */ yytestcase(yyruleno==311);
+{ yymsp[1].minor.yy44 = createStreamOptions(pCxt); }
break;
case 278: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */
- case 314: /* stream_options ::= stream_options WATERMARK duration_literal */ yytestcase(yyruleno==314);
-{ ((SStreamOptions*)yymsp[-2].minor.yy924)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy924); yylhsminor.yy924 = yymsp[-2].minor.yy924; }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+ case 315: /* stream_options ::= stream_options WATERMARK duration_literal */ yytestcase(yyruleno==315);
+{ ((SStreamOptions*)yymsp[-2].minor.yy44)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy44); yylhsminor.yy44 = yymsp[-2].minor.yy44; }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
case 279: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */
-{ ((SStreamOptions*)yymsp[-2].minor.yy924)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy924); yylhsminor.yy924 = yymsp[-2].minor.yy924; }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+{ ((SStreamOptions*)yymsp[-2].minor.yy44)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy44); yylhsminor.yy44 = yymsp[-2].minor.yy44; }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
case 280: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */
-{ ((SStreamOptions*)yymsp[-2].minor.yy924)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy924); yylhsminor.yy924 = yymsp[-2].minor.yy924; }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+{ ((SStreamOptions*)yymsp[-2].minor.yy44)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy44); yylhsminor.yy44 = yymsp[-2].minor.yy44; }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
case 281: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */
-{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy397, &yymsp[-2].minor.yy233, yymsp[0].minor.yy924); }
+{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy163, &yymsp[-2].minor.yy455, yymsp[0].minor.yy44); }
break;
case 282: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */
-{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy397, &yymsp[-3].minor.yy233, &yymsp[0].minor.yy233, false); }
+{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy163, &yymsp[-3].minor.yy455, &yymsp[0].minor.yy455, false); }
break;
case 283: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */
-{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy397, &yymsp[-5].minor.yy233, &yymsp[0].minor.yy233, true); }
+{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy163, &yymsp[-5].minor.yy455, &yymsp[0].minor.yy455, true); }
break;
case 284: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */
-{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy397, &yymsp[-3].minor.yy233, yymsp[0].minor.yy924, false); }
+{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy163, &yymsp[-3].minor.yy455, yymsp[0].minor.yy44, false); }
break;
case 285: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */
-{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy397, &yymsp[-5].minor.yy233, yymsp[0].minor.yy924, true); }
+{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy163, &yymsp[-5].minor.yy455, yymsp[0].minor.yy44, true); }
break;
case 286: /* cmd ::= DROP TOPIC exists_opt topic_name */
-{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy397, &yymsp[0].minor.yy233); }
+{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy163, &yymsp[0].minor.yy455); }
break;
case 287: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */
-{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy397, &yymsp[-2].minor.yy233, &yymsp[0].minor.yy233); }
+{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy163, &yymsp[-2].minor.yy455, &yymsp[0].minor.yy455); }
break;
case 288: /* cmd ::= DESC full_table_name */
case 289: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==289);
-{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy924); }
+{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy44); }
break;
case 290: /* cmd ::= RESET QUERY CACHE */
{ pCxt->pRootNode = createResetQueryCacheStmt(pCxt); }
break;
case 291: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */
-{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy397, yymsp[-1].minor.yy924, yymsp[0].minor.yy924); }
+ case 292: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==292);
+{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy163, yymsp[-1].minor.yy44, yymsp[0].minor.yy44); }
break;
- case 294: /* explain_options ::= */
-{ yymsp[1].minor.yy924 = createDefaultExplainOptions(pCxt); }
+ case 295: /* explain_options ::= */
+{ yymsp[1].minor.yy44 = createDefaultExplainOptions(pCxt); }
break;
- case 295: /* explain_options ::= explain_options VERBOSE NK_BOOL */
-{ yylhsminor.yy924 = setExplainVerbose(pCxt, yymsp[-2].minor.yy924, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+ case 296: /* explain_options ::= explain_options VERBOSE NK_BOOL */
+{ yylhsminor.yy44 = setExplainVerbose(pCxt, yymsp[-2].minor.yy44, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
- case 296: /* explain_options ::= explain_options RATIO NK_FLOAT */
-{ yylhsminor.yy924 = setExplainRatio(pCxt, yymsp[-2].minor.yy924, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+ case 297: /* explain_options ::= explain_options RATIO NK_FLOAT */
+{ yylhsminor.yy44 = setExplainRatio(pCxt, yymsp[-2].minor.yy44, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
- case 297: /* cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */
-{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-6].minor.yy397, yymsp[-8].minor.yy397, &yymsp[-5].minor.yy233, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy852, yymsp[0].minor.yy832); }
+ case 298: /* cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */
+{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-6].minor.yy163, yymsp[-8].minor.yy163, &yymsp[-5].minor.yy455, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy260, yymsp[0].minor.yy832); }
break;
- case 298: /* cmd ::= DROP FUNCTION exists_opt function_name */
-{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy397, &yymsp[0].minor.yy233); }
+ case 299: /* cmd ::= DROP FUNCTION exists_opt function_name */
+{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy163, &yymsp[0].minor.yy455); }
break;
- case 303: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */
-{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy397, &yymsp[-8].minor.yy233, yymsp[-5].minor.yy924, yymsp[-7].minor.yy924, yymsp[-3].minor.yy776, yymsp[-2].minor.yy924, yymsp[0].minor.yy924, yymsp[-4].minor.yy776); }
+ case 304: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */
+{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy163, &yymsp[-8].minor.yy455, yymsp[-5].minor.yy44, yymsp[-7].minor.yy44, yymsp[-3].minor.yy684, yymsp[-2].minor.yy44, yymsp[0].minor.yy44, yymsp[-4].minor.yy684); }
break;
- case 304: /* cmd ::= DROP STREAM exists_opt stream_name */
-{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy397, &yymsp[0].minor.yy233); }
+ case 305: /* cmd ::= DROP STREAM exists_opt stream_name */
+{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy163, &yymsp[0].minor.yy455); }
break;
- case 311: /* stream_options ::= stream_options TRIGGER AT_ONCE */
-{ ((SStreamOptions*)yymsp[-2].minor.yy924)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy924 = yymsp[-2].minor.yy924; }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+ case 312: /* stream_options ::= stream_options TRIGGER AT_ONCE */
+{ ((SStreamOptions*)yymsp[-2].minor.yy44)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy44 = yymsp[-2].minor.yy44; }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
- case 312: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */
-{ ((SStreamOptions*)yymsp[-2].minor.yy924)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy924 = yymsp[-2].minor.yy924; }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+ case 313: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */
+{ ((SStreamOptions*)yymsp[-2].minor.yy44)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy44 = yymsp[-2].minor.yy44; }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
- case 313: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
-{ ((SStreamOptions*)yymsp[-3].minor.yy924)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy924)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy924); yylhsminor.yy924 = yymsp[-3].minor.yy924; }
- yymsp[-3].minor.yy924 = yylhsminor.yy924;
+ case 314: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
+{ ((SStreamOptions*)yymsp[-3].minor.yy44)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy44)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy44); yylhsminor.yy44 = yymsp[-3].minor.yy44; }
+ yymsp[-3].minor.yy44 = yylhsminor.yy44;
break;
- case 315: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */
-{ ((SStreamOptions*)yymsp[-3].minor.yy924)->ignoreExpired = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy924 = yymsp[-3].minor.yy924; }
- yymsp[-3].minor.yy924 = yylhsminor.yy924;
+ case 316: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */
+{ ((SStreamOptions*)yymsp[-3].minor.yy44)->ignoreExpired = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy44 = yymsp[-3].minor.yy44; }
+ yymsp[-3].minor.yy44 = yylhsminor.yy44;
break;
- case 316: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */
-{ ((SStreamOptions*)yymsp[-2].minor.yy924)->fillHistory = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy924 = yymsp[-2].minor.yy924; }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+ case 317: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */
+{ ((SStreamOptions*)yymsp[-2].minor.yy44)->fillHistory = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy44 = yymsp[-2].minor.yy44; }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
- case 318: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */
- case 506: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ yytestcase(yyruleno==506);
- case 524: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==524);
-{ yymsp[-3].minor.yy924 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy924); }
+ case 319: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */
+ case 508: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ yytestcase(yyruleno==508);
+ case 526: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==526);
+{ yymsp[-3].minor.yy44 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy44); }
break;
- case 319: /* cmd ::= KILL CONNECTION NK_INTEGER */
+ case 320: /* cmd ::= KILL CONNECTION NK_INTEGER */
{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); }
break;
- case 320: /* cmd ::= KILL QUERY NK_STRING */
+ case 321: /* cmd ::= KILL QUERY NK_STRING */
{ pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); }
break;
- case 321: /* cmd ::= KILL TRANSACTION NK_INTEGER */
+ case 322: /* cmd ::= KILL TRANSACTION NK_INTEGER */
{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); }
break;
- case 322: /* cmd ::= BALANCE VGROUP */
+ case 323: /* cmd ::= BALANCE VGROUP */
{ pCxt->pRootNode = createBalanceVgroupStmt(pCxt); }
break;
- case 323: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
+ case 324: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
{ pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
break;
- case 324: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
-{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy776); }
+ case 325: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
+{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy684); }
break;
- case 325: /* cmd ::= SPLIT VGROUP NK_INTEGER */
+ case 326: /* cmd ::= SPLIT VGROUP NK_INTEGER */
{ pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); }
break;
- case 326: /* dnode_list ::= DNODE NK_INTEGER */
-{ yymsp[-1].minor.yy776 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
+ case 327: /* dnode_list ::= DNODE NK_INTEGER */
+{ yymsp[-1].minor.yy684 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
break;
- case 328: /* cmd ::= DELETE FROM full_table_name where_clause_opt */
-{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy924, yymsp[0].minor.yy924); }
+ case 329: /* cmd ::= DELETE FROM full_table_name where_clause_opt */
+{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy44, yymsp[0].minor.yy44); }
break;
- case 330: /* cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */
-{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-4].minor.yy924, yymsp[-2].minor.yy776, yymsp[0].minor.yy924); }
+ case 332: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */
+{ yymsp[-6].minor.yy44 = createInsertStmt(pCxt, yymsp[-4].minor.yy44, yymsp[-2].minor.yy684, yymsp[0].minor.yy44); }
break;
- case 331: /* cmd ::= INSERT INTO full_table_name query_or_subquery */
-{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-1].minor.yy924, NULL, yymsp[0].minor.yy924); }
+ case 333: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */
+{ yymsp[-3].minor.yy44 = createInsertStmt(pCxt, yymsp[-1].minor.yy44, NULL, yymsp[0].minor.yy44); }
break;
- case 332: /* literal ::= NK_INTEGER */
-{ yylhsminor.yy924 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy924 = yylhsminor.yy924;
+ case 334: /* literal ::= NK_INTEGER */
+{ yylhsminor.yy44 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy44 = yylhsminor.yy44;
break;
- case 333: /* literal ::= NK_FLOAT */
-{ yylhsminor.yy924 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy924 = yylhsminor.yy924;
+ case 335: /* literal ::= NK_FLOAT */
+{ yylhsminor.yy44 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy44 = yylhsminor.yy44;
break;
- case 334: /* literal ::= NK_STRING */
-{ yylhsminor.yy924 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy924 = yylhsminor.yy924;
+ case 336: /* literal ::= NK_STRING */
+{ yylhsminor.yy44 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy44 = yylhsminor.yy44;
break;
- case 335: /* literal ::= NK_BOOL */
-{ yylhsminor.yy924 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy924 = yylhsminor.yy924;
+ case 337: /* literal ::= NK_BOOL */
+{ yylhsminor.yy44 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy44 = yylhsminor.yy44;
break;
- case 336: /* literal ::= TIMESTAMP NK_STRING */
-{ yylhsminor.yy924 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); }
- yymsp[-1].minor.yy924 = yylhsminor.yy924;
+ case 338: /* literal ::= TIMESTAMP NK_STRING */
+{ yylhsminor.yy44 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); }
+ yymsp[-1].minor.yy44 = yylhsminor.yy44;
break;
- case 337: /* literal ::= duration_literal */
- case 347: /* signed_literal ::= signed */ yytestcase(yyruleno==347);
- case 368: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==368);
- case 369: /* expression ::= literal */ yytestcase(yyruleno==369);
- case 370: /* expression ::= pseudo_column */ yytestcase(yyruleno==370);
- case 371: /* expression ::= column_reference */ yytestcase(yyruleno==371);
- case 372: /* expression ::= function_expression */ yytestcase(yyruleno==372);
- case 373: /* expression ::= case_when_expression */ yytestcase(yyruleno==373);
- case 404: /* function_expression ::= literal_func */ yytestcase(yyruleno==404);
- case 453: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==453);
- case 457: /* boolean_primary ::= predicate */ yytestcase(yyruleno==457);
- case 459: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==459);
- case 460: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==460);
- case 463: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==463);
- case 465: /* table_reference ::= table_primary */ yytestcase(yyruleno==465);
- case 466: /* table_reference ::= joined_table */ yytestcase(yyruleno==466);
- case 470: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==470);
- case 526: /* query_simple ::= query_specification */ yytestcase(yyruleno==526);
- case 527: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==527);
- case 530: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==530);
- case 532: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==532);
-{ yylhsminor.yy924 = yymsp[0].minor.yy924; }
- yymsp[0].minor.yy924 = yylhsminor.yy924;
+ case 339: /* literal ::= duration_literal */
+ case 349: /* signed_literal ::= signed */ yytestcase(yyruleno==349);
+ case 370: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==370);
+ case 371: /* expression ::= literal */ yytestcase(yyruleno==371);
+ case 372: /* expression ::= pseudo_column */ yytestcase(yyruleno==372);
+ case 373: /* expression ::= column_reference */ yytestcase(yyruleno==373);
+ case 374: /* expression ::= function_expression */ yytestcase(yyruleno==374);
+ case 375: /* expression ::= case_when_expression */ yytestcase(yyruleno==375);
+ case 406: /* function_expression ::= literal_func */ yytestcase(yyruleno==406);
+ case 455: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==455);
+ case 459: /* boolean_primary ::= predicate */ yytestcase(yyruleno==459);
+ case 461: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==461);
+ case 462: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==462);
+ case 465: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==465);
+ case 467: /* table_reference ::= table_primary */ yytestcase(yyruleno==467);
+ case 468: /* table_reference ::= joined_table */ yytestcase(yyruleno==468);
+ case 472: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==472);
+ case 528: /* query_simple ::= query_specification */ yytestcase(yyruleno==528);
+ case 529: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==529);
+ case 532: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==532);
+ case 534: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==534);
+{ yylhsminor.yy44 = yymsp[0].minor.yy44; }
+ yymsp[0].minor.yy44 = yylhsminor.yy44;
break;
- case 338: /* literal ::= NULL */
-{ yylhsminor.yy924 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy924 = yylhsminor.yy924;
+ case 340: /* literal ::= NULL */
+{ yylhsminor.yy44 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy44 = yylhsminor.yy44;
break;
- case 339: /* literal ::= NK_QUESTION */
-{ yylhsminor.yy924 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy924 = yylhsminor.yy924;
+ case 341: /* literal ::= NK_QUESTION */
+{ yylhsminor.yy44 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy44 = yylhsminor.yy44;
break;
- case 340: /* duration_literal ::= NK_VARIABLE */
-{ yylhsminor.yy924 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy924 = yylhsminor.yy924;
+ case 342: /* duration_literal ::= NK_VARIABLE */
+{ yylhsminor.yy44 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy44 = yylhsminor.yy44;
break;
- case 341: /* signed ::= NK_INTEGER */
-{ yylhsminor.yy924 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy924 = yylhsminor.yy924;
+ case 343: /* signed ::= NK_INTEGER */
+{ yylhsminor.yy44 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy44 = yylhsminor.yy44;
break;
- case 342: /* signed ::= NK_PLUS NK_INTEGER */
-{ yymsp[-1].minor.yy924 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
+ case 344: /* signed ::= NK_PLUS NK_INTEGER */
+{ yymsp[-1].minor.yy44 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
break;
- case 343: /* signed ::= NK_MINUS NK_INTEGER */
+ case 345: /* signed ::= NK_MINUS NK_INTEGER */
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yylhsminor.yy924 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t);
+ yylhsminor.yy44 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t);
}
- yymsp[-1].minor.yy924 = yylhsminor.yy924;
+ yymsp[-1].minor.yy44 = yylhsminor.yy44;
break;
- case 344: /* signed ::= NK_FLOAT */
-{ yylhsminor.yy924 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy924 = yylhsminor.yy924;
+ case 346: /* signed ::= NK_FLOAT */
+{ yylhsminor.yy44 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy44 = yylhsminor.yy44;
break;
- case 345: /* signed ::= NK_PLUS NK_FLOAT */
-{ yymsp[-1].minor.yy924 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
+ case 347: /* signed ::= NK_PLUS NK_FLOAT */
+{ yymsp[-1].minor.yy44 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
break;
- case 346: /* signed ::= NK_MINUS NK_FLOAT */
+ case 348: /* signed ::= NK_MINUS NK_FLOAT */
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yylhsminor.yy924 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t);
+ yylhsminor.yy44 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t);
}
- yymsp[-1].minor.yy924 = yylhsminor.yy924;
+ yymsp[-1].minor.yy44 = yylhsminor.yy44;
break;
- case 348: /* signed_literal ::= NK_STRING */
-{ yylhsminor.yy924 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy924 = yylhsminor.yy924;
+ case 350: /* signed_literal ::= NK_STRING */
+{ yylhsminor.yy44 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy44 = yylhsminor.yy44;
break;
- case 349: /* signed_literal ::= NK_BOOL */
-{ yylhsminor.yy924 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy924 = yylhsminor.yy924;
+ case 351: /* signed_literal ::= NK_BOOL */
+{ yylhsminor.yy44 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy44 = yylhsminor.yy44;
break;
- case 350: /* signed_literal ::= TIMESTAMP NK_STRING */
-{ yymsp[-1].minor.yy924 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
+ case 352: /* signed_literal ::= TIMESTAMP NK_STRING */
+{ yymsp[-1].minor.yy44 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
break;
- case 351: /* signed_literal ::= duration_literal */
- case 353: /* signed_literal ::= literal_func */ yytestcase(yyruleno==353);
- case 424: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==424);
- case 486: /* select_item ::= common_expression */ yytestcase(yyruleno==486);
- case 496: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==496);
- case 531: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==531);
- case 533: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==533);
- case 546: /* search_condition ::= common_expression */ yytestcase(yyruleno==546);
-{ yylhsminor.yy924 = releaseRawExprNode(pCxt, yymsp[0].minor.yy924); }
- yymsp[0].minor.yy924 = yylhsminor.yy924;
+ case 353: /* signed_literal ::= duration_literal */
+ case 355: /* signed_literal ::= literal_func */ yytestcase(yyruleno==355);
+ case 426: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==426);
+ case 488: /* select_item ::= common_expression */ yytestcase(yyruleno==488);
+ case 498: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==498);
+ case 533: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==533);
+ case 535: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==535);
+ case 548: /* search_condition ::= common_expression */ yytestcase(yyruleno==548);
+{ yylhsminor.yy44 = releaseRawExprNode(pCxt, yymsp[0].minor.yy44); }
+ yymsp[0].minor.yy44 = yylhsminor.yy44;
break;
- case 352: /* signed_literal ::= NULL */
-{ yylhsminor.yy924 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy924 = yylhsminor.yy924;
+ case 354: /* signed_literal ::= NULL */
+{ yylhsminor.yy44 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy44 = yylhsminor.yy44;
break;
- case 354: /* signed_literal ::= NK_QUESTION */
-{ yylhsminor.yy924 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy924 = yylhsminor.yy924;
+ case 356: /* signed_literal ::= NK_QUESTION */
+{ yylhsminor.yy44 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy44 = yylhsminor.yy44;
break;
- case 374: /* expression ::= NK_LP expression NK_RP */
- case 458: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==458);
- case 545: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==545);
-{ yylhsminor.yy924 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy924)); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+ case 376: /* expression ::= NK_LP expression NK_RP */
+ case 460: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==460);
+ case 547: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==547);
+{ yylhsminor.yy44 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy44)); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
- case 375: /* expression ::= NK_PLUS expr_or_subquery */
+ case 377: /* expression ::= NK_PLUS expr_or_subquery */
{
- SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy924);
- yylhsminor.yy924 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy924));
+ SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy44);
+ yylhsminor.yy44 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy44));
}
- yymsp[-1].minor.yy924 = yylhsminor.yy924;
+ yymsp[-1].minor.yy44 = yylhsminor.yy44;
break;
- case 376: /* expression ::= NK_MINUS expr_or_subquery */
+ case 378: /* expression ::= NK_MINUS expr_or_subquery */
{
- SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy924);
- yylhsminor.yy924 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy924), NULL));
+ SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy44);
+ yylhsminor.yy44 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy44), NULL));
}
- yymsp[-1].minor.yy924 = yylhsminor.yy924;
+ yymsp[-1].minor.yy44 = yylhsminor.yy44;
break;
- case 377: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */
+ case 379: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy924);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy924);
- yylhsminor.yy924 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy924), releaseRawExprNode(pCxt, yymsp[0].minor.yy924)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy44);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy44);
+ yylhsminor.yy44 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy44), releaseRawExprNode(pCxt, yymsp[0].minor.yy44)));
}
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
- case 378: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */
+ case 380: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy924);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy924);
- yylhsminor.yy924 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy924), releaseRawExprNode(pCxt, yymsp[0].minor.yy924)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy44);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy44);
+ yylhsminor.yy44 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy44), releaseRawExprNode(pCxt, yymsp[0].minor.yy44)));
}
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
- case 379: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */
+ case 381: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy924);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy924);
- yylhsminor.yy924 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy924), releaseRawExprNode(pCxt, yymsp[0].minor.yy924)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy44);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy44);
+ yylhsminor.yy44 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy44), releaseRawExprNode(pCxt, yymsp[0].minor.yy44)));
}
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
- case 380: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */
+ case 382: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy924);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy924);
- yylhsminor.yy924 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy924), releaseRawExprNode(pCxt, yymsp[0].minor.yy924)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy44);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy44);
+ yylhsminor.yy44 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy44), releaseRawExprNode(pCxt, yymsp[0].minor.yy44)));
}
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
- case 381: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */
+ case 383: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy924);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy924);
- yylhsminor.yy924 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy924), releaseRawExprNode(pCxt, yymsp[0].minor.yy924)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy44);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy44);
+ yylhsminor.yy44 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy44), releaseRawExprNode(pCxt, yymsp[0].minor.yy44)));
}
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
- case 382: /* expression ::= column_reference NK_ARROW NK_STRING */
+ case 384: /* expression ::= column_reference NK_ARROW NK_STRING */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy924);
- yylhsminor.yy924 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy924), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy44);
+ yylhsminor.yy44 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy44), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)));
}
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
- case 383: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */
+ case 385: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy924);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy924);
- yylhsminor.yy924 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy924), releaseRawExprNode(pCxt, yymsp[0].minor.yy924)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy44);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy44);
+ yylhsminor.yy44 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy44), releaseRawExprNode(pCxt, yymsp[0].minor.yy44)));
}
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
- case 384: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */
+ case 386: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy924);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy924);
- yylhsminor.yy924 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy924), releaseRawExprNode(pCxt, yymsp[0].minor.yy924)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy44);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy44);
+ yylhsminor.yy44 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy44), releaseRawExprNode(pCxt, yymsp[0].minor.yy44)));
}
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
- case 387: /* column_reference ::= column_name */
-{ yylhsminor.yy924 = createRawExprNode(pCxt, &yymsp[0].minor.yy233, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy233)); }
- yymsp[0].minor.yy924 = yylhsminor.yy924;
+ case 389: /* column_reference ::= column_name */
+{ yylhsminor.yy44 = createRawExprNode(pCxt, &yymsp[0].minor.yy455, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy455)); }
+ yymsp[0].minor.yy44 = yylhsminor.yy44;
break;
- case 388: /* column_reference ::= table_name NK_DOT column_name */
-{ yylhsminor.yy924 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy233, &yymsp[0].minor.yy233, createColumnNode(pCxt, &yymsp[-2].minor.yy233, &yymsp[0].minor.yy233)); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+ case 390: /* column_reference ::= table_name NK_DOT column_name */
+{ yylhsminor.yy44 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy455, &yymsp[0].minor.yy455, createColumnNode(pCxt, &yymsp[-2].minor.yy455, &yymsp[0].minor.yy455)); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
- case 389: /* pseudo_column ::= ROWTS */
- case 390: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==390);
- case 392: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==392);
- case 393: /* pseudo_column ::= QEND */ yytestcase(yyruleno==393);
- case 394: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==394);
- case 395: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==395);
- case 396: /* pseudo_column ::= WEND */ yytestcase(yyruleno==396);
- case 397: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==397);
- case 398: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==398);
- case 399: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==399);
- case 400: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==400);
- case 406: /* literal_func ::= NOW */ yytestcase(yyruleno==406);
-{ yylhsminor.yy924 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); }
- yymsp[0].minor.yy924 = yylhsminor.yy924;
+ case 391: /* pseudo_column ::= ROWTS */
+ case 392: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==392);
+ case 394: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==394);
+ case 395: /* pseudo_column ::= QEND */ yytestcase(yyruleno==395);
+ case 396: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==396);
+ case 397: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==397);
+ case 398: /* pseudo_column ::= WEND */ yytestcase(yyruleno==398);
+ case 399: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==399);
+ case 400: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==400);
+ case 401: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==401);
+ case 402: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==402);
+ case 408: /* literal_func ::= NOW */ yytestcase(yyruleno==408);
+{ yylhsminor.yy44 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); }
+ yymsp[0].minor.yy44 = yylhsminor.yy44;
break;
- case 391: /* pseudo_column ::= table_name NK_DOT TBNAME */
-{ yylhsminor.yy924 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy233, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy233)))); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+ case 393: /* pseudo_column ::= table_name NK_DOT TBNAME */
+{ yylhsminor.yy44 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy455, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy455)))); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
- case 401: /* function_expression ::= function_name NK_LP expression_list NK_RP */
- case 402: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==402);
-{ yylhsminor.yy924 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy233, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy233, yymsp[-1].minor.yy776)); }
- yymsp[-3].minor.yy924 = yylhsminor.yy924;
+ case 403: /* function_expression ::= function_name NK_LP expression_list NK_RP */
+ case 404: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==404);
+{ yylhsminor.yy44 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy455, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy455, yymsp[-1].minor.yy684)); }
+ yymsp[-3].minor.yy44 = yylhsminor.yy44;
break;
- case 403: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */
-{ yylhsminor.yy924 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy924), yymsp[-1].minor.yy852)); }
- yymsp[-5].minor.yy924 = yylhsminor.yy924;
+ case 405: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */
+{ yylhsminor.yy44 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy44), yymsp[-1].minor.yy260)); }
+ yymsp[-5].minor.yy44 = yylhsminor.yy44;
break;
- case 405: /* literal_func ::= noarg_func NK_LP NK_RP */
-{ yylhsminor.yy924 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy233, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy233, NULL)); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+ case 407: /* literal_func ::= noarg_func NK_LP NK_RP */
+{ yylhsminor.yy44 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy455, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy455, NULL)); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
- case 420: /* star_func_para_list ::= NK_STAR */
-{ yylhsminor.yy776 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy776 = yylhsminor.yy776;
+ case 422: /* star_func_para_list ::= NK_STAR */
+{ yylhsminor.yy684 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy684 = yylhsminor.yy684;
break;
- case 425: /* star_func_para ::= table_name NK_DOT NK_STAR */
- case 489: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==489);
-{ yylhsminor.yy924 = createColumnNode(pCxt, &yymsp[-2].minor.yy233, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+ case 427: /* star_func_para ::= table_name NK_DOT NK_STAR */
+ case 491: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==491);
+{ yylhsminor.yy44 = createColumnNode(pCxt, &yymsp[-2].minor.yy455, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
- case 426: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */
-{ yylhsminor.yy924 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy776, yymsp[-1].minor.yy924)); }
- yymsp[-3].minor.yy924 = yylhsminor.yy924;
+ case 428: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */
+{ yylhsminor.yy44 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy684, yymsp[-1].minor.yy44)); }
+ yymsp[-3].minor.yy44 = yylhsminor.yy44;
break;
- case 427: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */
-{ yylhsminor.yy924 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy924), yymsp[-2].minor.yy776, yymsp[-1].minor.yy924)); }
- yymsp[-4].minor.yy924 = yylhsminor.yy924;
+ case 429: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */
+{ yylhsminor.yy44 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy44), yymsp[-2].minor.yy684, yymsp[-1].minor.yy44)); }
+ yymsp[-4].minor.yy44 = yylhsminor.yy44;
break;
- case 430: /* when_then_expr ::= WHEN common_expression THEN common_expression */
-{ yymsp[-3].minor.yy924 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy924), releaseRawExprNode(pCxt, yymsp[0].minor.yy924)); }
+ case 432: /* when_then_expr ::= WHEN common_expression THEN common_expression */
+{ yymsp[-3].minor.yy44 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy44), releaseRawExprNode(pCxt, yymsp[0].minor.yy44)); }
break;
- case 432: /* case_when_else_opt ::= ELSE common_expression */
-{ yymsp[-1].minor.yy924 = releaseRawExprNode(pCxt, yymsp[0].minor.yy924); }
+ case 434: /* case_when_else_opt ::= ELSE common_expression */
+{ yymsp[-1].minor.yy44 = releaseRawExprNode(pCxt, yymsp[0].minor.yy44); }
break;
- case 433: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */
- case 438: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==438);
+ case 435: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */
+ case 440: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==440);
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy924);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy924);
- yylhsminor.yy924 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy856, releaseRawExprNode(pCxt, yymsp[-2].minor.yy924), releaseRawExprNode(pCxt, yymsp[0].minor.yy924)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy44);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy44);
+ yylhsminor.yy44 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy704, releaseRawExprNode(pCxt, yymsp[-2].minor.yy44), releaseRawExprNode(pCxt, yymsp[0].minor.yy44)));
}
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
- case 434: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */
+ case 436: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy924);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy924);
- yylhsminor.yy924 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy924), releaseRawExprNode(pCxt, yymsp[-2].minor.yy924), releaseRawExprNode(pCxt, yymsp[0].minor.yy924)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy44);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy44);
+ yylhsminor.yy44 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy44), releaseRawExprNode(pCxt, yymsp[-2].minor.yy44), releaseRawExprNode(pCxt, yymsp[0].minor.yy44)));
}
- yymsp[-4].minor.yy924 = yylhsminor.yy924;
+ yymsp[-4].minor.yy44 = yylhsminor.yy44;
break;
- case 435: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */
+ case 437: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy924);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy924);
- yylhsminor.yy924 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy924), releaseRawExprNode(pCxt, yymsp[-2].minor.yy924), releaseRawExprNode(pCxt, yymsp[0].minor.yy924)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy44);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy44);
+ yylhsminor.yy44 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy44), releaseRawExprNode(pCxt, yymsp[-2].minor.yy44), releaseRawExprNode(pCxt, yymsp[0].minor.yy44)));
}
- yymsp[-5].minor.yy924 = yylhsminor.yy924;
+ yymsp[-5].minor.yy44 = yylhsminor.yy44;
break;
- case 436: /* predicate ::= expr_or_subquery IS NULL */
+ case 438: /* predicate ::= expr_or_subquery IS NULL */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy924);
- yylhsminor.yy924 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy924), NULL));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy44);
+ yylhsminor.yy44 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy44), NULL));
}
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
- case 437: /* predicate ::= expr_or_subquery IS NOT NULL */
+ case 439: /* predicate ::= expr_or_subquery IS NOT NULL */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy924);
- yylhsminor.yy924 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy924), NULL));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy44);
+ yylhsminor.yy44 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy44), NULL));
}
- yymsp[-3].minor.yy924 = yylhsminor.yy924;
+ yymsp[-3].minor.yy44 = yylhsminor.yy44;
break;
- case 439: /* compare_op ::= NK_LT */
-{ yymsp[0].minor.yy856 = OP_TYPE_LOWER_THAN; }
+ case 441: /* compare_op ::= NK_LT */
+{ yymsp[0].minor.yy704 = OP_TYPE_LOWER_THAN; }
break;
- case 440: /* compare_op ::= NK_GT */
-{ yymsp[0].minor.yy856 = OP_TYPE_GREATER_THAN; }
+ case 442: /* compare_op ::= NK_GT */
+{ yymsp[0].minor.yy704 = OP_TYPE_GREATER_THAN; }
break;
- case 441: /* compare_op ::= NK_LE */
-{ yymsp[0].minor.yy856 = OP_TYPE_LOWER_EQUAL; }
+ case 443: /* compare_op ::= NK_LE */
+{ yymsp[0].minor.yy704 = OP_TYPE_LOWER_EQUAL; }
break;
- case 442: /* compare_op ::= NK_GE */
-{ yymsp[0].minor.yy856 = OP_TYPE_GREATER_EQUAL; }
+ case 444: /* compare_op ::= NK_GE */
+{ yymsp[0].minor.yy704 = OP_TYPE_GREATER_EQUAL; }
break;
- case 443: /* compare_op ::= NK_NE */
-{ yymsp[0].minor.yy856 = OP_TYPE_NOT_EQUAL; }
+ case 445: /* compare_op ::= NK_NE */
+{ yymsp[0].minor.yy704 = OP_TYPE_NOT_EQUAL; }
break;
- case 444: /* compare_op ::= NK_EQ */
-{ yymsp[0].minor.yy856 = OP_TYPE_EQUAL; }
+ case 446: /* compare_op ::= NK_EQ */
+{ yymsp[0].minor.yy704 = OP_TYPE_EQUAL; }
break;
- case 445: /* compare_op ::= LIKE */
-{ yymsp[0].minor.yy856 = OP_TYPE_LIKE; }
+ case 447: /* compare_op ::= LIKE */
+{ yymsp[0].minor.yy704 = OP_TYPE_LIKE; }
break;
- case 446: /* compare_op ::= NOT LIKE */
-{ yymsp[-1].minor.yy856 = OP_TYPE_NOT_LIKE; }
+ case 448: /* compare_op ::= NOT LIKE */
+{ yymsp[-1].minor.yy704 = OP_TYPE_NOT_LIKE; }
break;
- case 447: /* compare_op ::= MATCH */
-{ yymsp[0].minor.yy856 = OP_TYPE_MATCH; }
+ case 449: /* compare_op ::= MATCH */
+{ yymsp[0].minor.yy704 = OP_TYPE_MATCH; }
break;
- case 448: /* compare_op ::= NMATCH */
-{ yymsp[0].minor.yy856 = OP_TYPE_NMATCH; }
+ case 450: /* compare_op ::= NMATCH */
+{ yymsp[0].minor.yy704 = OP_TYPE_NMATCH; }
break;
- case 449: /* compare_op ::= CONTAINS */
-{ yymsp[0].minor.yy856 = OP_TYPE_JSON_CONTAINS; }
+ case 451: /* compare_op ::= CONTAINS */
+{ yymsp[0].minor.yy704 = OP_TYPE_JSON_CONTAINS; }
break;
- case 450: /* in_op ::= IN */
-{ yymsp[0].minor.yy856 = OP_TYPE_IN; }
+ case 452: /* in_op ::= IN */
+{ yymsp[0].minor.yy704 = OP_TYPE_IN; }
break;
- case 451: /* in_op ::= NOT IN */
-{ yymsp[-1].minor.yy856 = OP_TYPE_NOT_IN; }
+ case 453: /* in_op ::= NOT IN */
+{ yymsp[-1].minor.yy704 = OP_TYPE_NOT_IN; }
break;
- case 452: /* in_predicate_value ::= NK_LP literal_list NK_RP */
-{ yylhsminor.yy924 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy776)); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+ case 454: /* in_predicate_value ::= NK_LP literal_list NK_RP */
+{ yylhsminor.yy44 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy684)); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
- case 454: /* boolean_value_expression ::= NOT boolean_primary */
+ case 456: /* boolean_value_expression ::= NOT boolean_primary */
{
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy924);
- yylhsminor.yy924 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy924), NULL));
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy44);
+ yylhsminor.yy44 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy44), NULL));
}
- yymsp[-1].minor.yy924 = yylhsminor.yy924;
+ yymsp[-1].minor.yy44 = yylhsminor.yy44;
break;
- case 455: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
+ case 457: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy924);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy924);
- yylhsminor.yy924 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy924), releaseRawExprNode(pCxt, yymsp[0].minor.yy924)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy44);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy44);
+ yylhsminor.yy44 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy44), releaseRawExprNode(pCxt, yymsp[0].minor.yy44)));
}
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
- case 456: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
+ case 458: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy924);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy924);
- yylhsminor.yy924 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy924), releaseRawExprNode(pCxt, yymsp[0].minor.yy924)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy44);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy44);
+ yylhsminor.yy44 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy44), releaseRawExprNode(pCxt, yymsp[0].minor.yy44)));
}
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
- case 462: /* from_clause_opt ::= FROM table_reference_list */
- case 491: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==491);
- case 520: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==520);
-{ yymsp[-1].minor.yy924 = yymsp[0].minor.yy924; }
+ case 464: /* from_clause_opt ::= FROM table_reference_list */
+ case 493: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==493);
+ case 522: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==522);
+{ yymsp[-1].minor.yy44 = yymsp[0].minor.yy44; }
break;
- case 464: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */
-{ yylhsminor.yy924 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy924, yymsp[0].minor.yy924, NULL); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+ case 466: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */
+{ yylhsminor.yy44 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy44, yymsp[0].minor.yy44, NULL); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
- case 467: /* table_primary ::= table_name alias_opt */
-{ yylhsminor.yy924 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy233, &yymsp[0].minor.yy233); }
- yymsp[-1].minor.yy924 = yylhsminor.yy924;
+ case 469: /* table_primary ::= table_name alias_opt */
+{ yylhsminor.yy44 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy455, &yymsp[0].minor.yy455); }
+ yymsp[-1].minor.yy44 = yylhsminor.yy44;
break;
- case 468: /* table_primary ::= db_name NK_DOT table_name alias_opt */
-{ yylhsminor.yy924 = createRealTableNode(pCxt, &yymsp[-3].minor.yy233, &yymsp[-1].minor.yy233, &yymsp[0].minor.yy233); }
- yymsp[-3].minor.yy924 = yylhsminor.yy924;
+ case 470: /* table_primary ::= db_name NK_DOT table_name alias_opt */
+{ yylhsminor.yy44 = createRealTableNode(pCxt, &yymsp[-3].minor.yy455, &yymsp[-1].minor.yy455, &yymsp[0].minor.yy455); }
+ yymsp[-3].minor.yy44 = yylhsminor.yy44;
break;
- case 469: /* table_primary ::= subquery alias_opt */
-{ yylhsminor.yy924 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy924), &yymsp[0].minor.yy233); }
- yymsp[-1].minor.yy924 = yylhsminor.yy924;
+ case 471: /* table_primary ::= subquery alias_opt */
+{ yylhsminor.yy44 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy44), &yymsp[0].minor.yy455); }
+ yymsp[-1].minor.yy44 = yylhsminor.yy44;
break;
- case 471: /* alias_opt ::= */
-{ yymsp[1].minor.yy233 = nil_token; }
+ case 473: /* alias_opt ::= */
+{ yymsp[1].minor.yy455 = nil_token; }
break;
- case 473: /* alias_opt ::= AS table_alias */
-{ yymsp[-1].minor.yy233 = yymsp[0].minor.yy233; }
+ case 475: /* alias_opt ::= AS table_alias */
+{ yymsp[-1].minor.yy455 = yymsp[0].minor.yy455; }
break;
- case 474: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */
- case 475: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==475);
-{ yymsp[-2].minor.yy924 = yymsp[-1].minor.yy924; }
+ case 476: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */
+ case 477: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==477);
+{ yymsp[-2].minor.yy44 = yymsp[-1].minor.yy44; }
break;
- case 476: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
-{ yylhsminor.yy924 = createJoinTableNode(pCxt, yymsp[-4].minor.yy428, yymsp[-5].minor.yy924, yymsp[-2].minor.yy924, yymsp[0].minor.yy924); }
- yymsp[-5].minor.yy924 = yylhsminor.yy924;
+ case 478: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
+{ yylhsminor.yy44 = createJoinTableNode(pCxt, yymsp[-4].minor.yy724, yymsp[-5].minor.yy44, yymsp[-2].minor.yy44, yymsp[0].minor.yy44); }
+ yymsp[-5].minor.yy44 = yylhsminor.yy44;
break;
- case 477: /* join_type ::= */
-{ yymsp[1].minor.yy428 = JOIN_TYPE_INNER; }
+ case 479: /* join_type ::= */
+{ yymsp[1].minor.yy724 = JOIN_TYPE_INNER; }
break;
- case 478: /* join_type ::= INNER */
-{ yymsp[0].minor.yy428 = JOIN_TYPE_INNER; }
+ case 480: /* join_type ::= INNER */
+{ yymsp[0].minor.yy724 = JOIN_TYPE_INNER; }
break;
- case 479: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */
+ case 481: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */
{
- yymsp[-11].minor.yy924 = createSelectStmt(pCxt, yymsp[-10].minor.yy397, yymsp[-9].minor.yy776, yymsp[-8].minor.yy924);
- yymsp[-11].minor.yy924 = addWhereClause(pCxt, yymsp[-11].minor.yy924, yymsp[-7].minor.yy924);
- yymsp[-11].minor.yy924 = addPartitionByClause(pCxt, yymsp[-11].minor.yy924, yymsp[-6].minor.yy776);
- yymsp[-11].minor.yy924 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy924, yymsp[-2].minor.yy924);
- yymsp[-11].minor.yy924 = addGroupByClause(pCxt, yymsp[-11].minor.yy924, yymsp[-1].minor.yy776);
- yymsp[-11].minor.yy924 = addHavingClause(pCxt, yymsp[-11].minor.yy924, yymsp[0].minor.yy924);
- yymsp[-11].minor.yy924 = addRangeClause(pCxt, yymsp[-11].minor.yy924, yymsp[-5].minor.yy924);
- yymsp[-11].minor.yy924 = addEveryClause(pCxt, yymsp[-11].minor.yy924, yymsp[-4].minor.yy924);
- yymsp[-11].minor.yy924 = addFillClause(pCxt, yymsp[-11].minor.yy924, yymsp[-3].minor.yy924);
+ yymsp[-11].minor.yy44 = createSelectStmt(pCxt, yymsp[-10].minor.yy163, yymsp[-9].minor.yy684, yymsp[-8].minor.yy44);
+ yymsp[-11].minor.yy44 = addWhereClause(pCxt, yymsp[-11].minor.yy44, yymsp[-7].minor.yy44);
+ yymsp[-11].minor.yy44 = addPartitionByClause(pCxt, yymsp[-11].minor.yy44, yymsp[-6].minor.yy684);
+ yymsp[-11].minor.yy44 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy44, yymsp[-2].minor.yy44);
+ yymsp[-11].minor.yy44 = addGroupByClause(pCxt, yymsp[-11].minor.yy44, yymsp[-1].minor.yy684);
+ yymsp[-11].minor.yy44 = addHavingClause(pCxt, yymsp[-11].minor.yy44, yymsp[0].minor.yy44);
+ yymsp[-11].minor.yy44 = addRangeClause(pCxt, yymsp[-11].minor.yy44, yymsp[-5].minor.yy44);
+ yymsp[-11].minor.yy44 = addEveryClause(pCxt, yymsp[-11].minor.yy44, yymsp[-4].minor.yy44);
+ yymsp[-11].minor.yy44 = addFillClause(pCxt, yymsp[-11].minor.yy44, yymsp[-3].minor.yy44);
}
break;
- case 482: /* set_quantifier_opt ::= ALL */
-{ yymsp[0].minor.yy397 = false; }
+ case 484: /* set_quantifier_opt ::= ALL */
+{ yymsp[0].minor.yy163 = false; }
break;
- case 485: /* select_item ::= NK_STAR */
-{ yylhsminor.yy924 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy924 = yylhsminor.yy924;
+ case 487: /* select_item ::= NK_STAR */
+{ yylhsminor.yy44 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy44 = yylhsminor.yy44;
break;
- case 487: /* select_item ::= common_expression column_alias */
- case 497: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==497);
-{ yylhsminor.yy924 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy924), &yymsp[0].minor.yy233); }
- yymsp[-1].minor.yy924 = yylhsminor.yy924;
+ case 489: /* select_item ::= common_expression column_alias */
+ case 499: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==499);
+{ yylhsminor.yy44 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy44), &yymsp[0].minor.yy455); }
+ yymsp[-1].minor.yy44 = yylhsminor.yy44;
break;
- case 488: /* select_item ::= common_expression AS column_alias */
- case 498: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==498);
-{ yylhsminor.yy924 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy924), &yymsp[0].minor.yy233); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+ case 490: /* select_item ::= common_expression AS column_alias */
+ case 500: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==500);
+{ yylhsminor.yy44 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy44), &yymsp[0].minor.yy455); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
- case 493: /* partition_by_clause_opt ::= PARTITION BY partition_list */
- case 516: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==516);
- case 535: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==535);
-{ yymsp[-2].minor.yy776 = yymsp[0].minor.yy776; }
+ case 495: /* partition_by_clause_opt ::= PARTITION BY partition_list */
+ case 518: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==518);
+ case 537: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==537);
+{ yymsp[-2].minor.yy684 = yymsp[0].minor.yy684; }
break;
- case 500: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */
-{ yymsp[-5].minor.yy924 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy924), releaseRawExprNode(pCxt, yymsp[-1].minor.yy924)); }
+ case 502: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */
+{ yymsp[-5].minor.yy44 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy44), releaseRawExprNode(pCxt, yymsp[-1].minor.yy44)); }
break;
- case 501: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */
-{ yymsp[-3].minor.yy924 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy924)); }
+ case 503: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */
+{ yymsp[-3].minor.yy44 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy44)); }
break;
- case 502: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
-{ yymsp[-5].minor.yy924 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy924), NULL, yymsp[-1].minor.yy924, yymsp[0].minor.yy924); }
+ case 504: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
+{ yymsp[-5].minor.yy44 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy44), NULL, yymsp[-1].minor.yy44, yymsp[0].minor.yy44); }
break;
- case 503: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
-{ yymsp[-7].minor.yy924 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy924), releaseRawExprNode(pCxt, yymsp[-3].minor.yy924), yymsp[-1].minor.yy924, yymsp[0].minor.yy924); }
+ case 505: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
+{ yymsp[-7].minor.yy44 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy44), releaseRawExprNode(pCxt, yymsp[-3].minor.yy44), yymsp[-1].minor.yy44, yymsp[0].minor.yy44); }
break;
- case 504: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */
-{ yymsp[-6].minor.yy924 = createEventWindowNode(pCxt, yymsp[-3].minor.yy924, yymsp[0].minor.yy924); }
+ case 506: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */
+{ yymsp[-6].minor.yy44 = createEventWindowNode(pCxt, yymsp[-3].minor.yy44, yymsp[0].minor.yy44); }
break;
- case 508: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */
-{ yymsp[-3].minor.yy924 = createFillNode(pCxt, yymsp[-1].minor.yy646, NULL); }
+ case 510: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */
+{ yymsp[-3].minor.yy44 = createFillNode(pCxt, yymsp[-1].minor.yy22, NULL); }
break;
- case 509: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
-{ yymsp[-5].minor.yy924 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy776)); }
+ case 511: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
+{ yymsp[-5].minor.yy44 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy684)); }
break;
- case 510: /* fill_mode ::= NONE */
-{ yymsp[0].minor.yy646 = FILL_MODE_NONE; }
+ case 512: /* fill_mode ::= NONE */
+{ yymsp[0].minor.yy22 = FILL_MODE_NONE; }
break;
- case 511: /* fill_mode ::= PREV */
-{ yymsp[0].minor.yy646 = FILL_MODE_PREV; }
+ case 513: /* fill_mode ::= PREV */
+{ yymsp[0].minor.yy22 = FILL_MODE_PREV; }
break;
- case 512: /* fill_mode ::= NULL */
-{ yymsp[0].minor.yy646 = FILL_MODE_NULL; }
+ case 514: /* fill_mode ::= NULL */
+{ yymsp[0].minor.yy22 = FILL_MODE_NULL; }
break;
- case 513: /* fill_mode ::= LINEAR */
-{ yymsp[0].minor.yy646 = FILL_MODE_LINEAR; }
+ case 515: /* fill_mode ::= LINEAR */
+{ yymsp[0].minor.yy22 = FILL_MODE_LINEAR; }
break;
- case 514: /* fill_mode ::= NEXT */
-{ yymsp[0].minor.yy646 = FILL_MODE_NEXT; }
+ case 516: /* fill_mode ::= NEXT */
+{ yymsp[0].minor.yy22 = FILL_MODE_NEXT; }
break;
- case 517: /* group_by_list ::= expr_or_subquery */
-{ yylhsminor.yy776 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy924))); }
- yymsp[0].minor.yy776 = yylhsminor.yy776;
+ case 519: /* group_by_list ::= expr_or_subquery */
+{ yylhsminor.yy684 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy44))); }
+ yymsp[0].minor.yy684 = yylhsminor.yy684;
break;
- case 518: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */
-{ yylhsminor.yy776 = addNodeToList(pCxt, yymsp[-2].minor.yy776, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy924))); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+ case 520: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */
+{ yylhsminor.yy684 = addNodeToList(pCxt, yymsp[-2].minor.yy684, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy44))); }
+ yymsp[-2].minor.yy684 = yylhsminor.yy684;
break;
- case 522: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */
-{ yymsp[-5].minor.yy924 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy924), releaseRawExprNode(pCxt, yymsp[-1].minor.yy924)); }
+ case 524: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */
+{ yymsp[-5].minor.yy44 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy44), releaseRawExprNode(pCxt, yymsp[-1].minor.yy44)); }
break;
- case 525: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
+ case 527: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
{
- yylhsminor.yy924 = addOrderByClause(pCxt, yymsp[-3].minor.yy924, yymsp[-2].minor.yy776);
- yylhsminor.yy924 = addSlimitClause(pCxt, yylhsminor.yy924, yymsp[-1].minor.yy924);
- yylhsminor.yy924 = addLimitClause(pCxt, yylhsminor.yy924, yymsp[0].minor.yy924);
+ yylhsminor.yy44 = addOrderByClause(pCxt, yymsp[-3].minor.yy44, yymsp[-2].minor.yy684);
+ yylhsminor.yy44 = addSlimitClause(pCxt, yylhsminor.yy44, yymsp[-1].minor.yy44);
+ yylhsminor.yy44 = addLimitClause(pCxt, yylhsminor.yy44, yymsp[0].minor.yy44);
}
- yymsp[-3].minor.yy924 = yylhsminor.yy924;
+ yymsp[-3].minor.yy44 = yylhsminor.yy44;
break;
- case 528: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */
-{ yylhsminor.yy924 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy924, yymsp[0].minor.yy924); }
- yymsp[-3].minor.yy924 = yylhsminor.yy924;
+ case 530: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */
+{ yylhsminor.yy44 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy44, yymsp[0].minor.yy44); }
+ yymsp[-3].minor.yy44 = yylhsminor.yy44;
break;
- case 529: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */
-{ yylhsminor.yy924 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy924, yymsp[0].minor.yy924); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+ case 531: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */
+{ yylhsminor.yy44 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy44, yymsp[0].minor.yy44); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
- case 537: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */
- case 541: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==541);
-{ yymsp[-1].minor.yy924 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); }
+ case 539: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */
+ case 543: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==543);
+{ yymsp[-1].minor.yy44 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); }
break;
- case 538: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
- case 542: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==542);
-{ yymsp[-3].minor.yy924 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); }
+ case 540: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
+ case 544: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==544);
+{ yymsp[-3].minor.yy44 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); }
break;
- case 539: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
- case 543: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==543);
-{ yymsp[-3].minor.yy924 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); }
+ case 541: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ case 545: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==545);
+{ yymsp[-3].minor.yy44 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); }
break;
- case 544: /* subquery ::= NK_LP query_expression NK_RP */
-{ yylhsminor.yy924 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy924); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+ case 546: /* subquery ::= NK_LP query_expression NK_RP */
+{ yylhsminor.yy44 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy44); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
- case 549: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */
-{ yylhsminor.yy924 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy924), yymsp[-1].minor.yy870, yymsp[0].minor.yy89); }
- yymsp[-2].minor.yy924 = yylhsminor.yy924;
+ case 551: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */
+{ yylhsminor.yy44 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy44), yymsp[-1].minor.yy490, yymsp[0].minor.yy23); }
+ yymsp[-2].minor.yy44 = yylhsminor.yy44;
break;
- case 550: /* ordering_specification_opt ::= */
-{ yymsp[1].minor.yy870 = ORDER_ASC; }
+ case 552: /* ordering_specification_opt ::= */
+{ yymsp[1].minor.yy490 = ORDER_ASC; }
break;
- case 551: /* ordering_specification_opt ::= ASC */
-{ yymsp[0].minor.yy870 = ORDER_ASC; }
+ case 553: /* ordering_specification_opt ::= ASC */
+{ yymsp[0].minor.yy490 = ORDER_ASC; }
break;
- case 552: /* ordering_specification_opt ::= DESC */
-{ yymsp[0].minor.yy870 = ORDER_DESC; }
+ case 554: /* ordering_specification_opt ::= DESC */
+{ yymsp[0].minor.yy490 = ORDER_DESC; }
break;
- case 553: /* null_ordering_opt ::= */
-{ yymsp[1].minor.yy89 = NULL_ORDER_DEFAULT; }
+ case 555: /* null_ordering_opt ::= */
+{ yymsp[1].minor.yy23 = NULL_ORDER_DEFAULT; }
break;
- case 554: /* null_ordering_opt ::= NULLS FIRST */
-{ yymsp[-1].minor.yy89 = NULL_ORDER_FIRST; }
+ case 556: /* null_ordering_opt ::= NULLS FIRST */
+{ yymsp[-1].minor.yy23 = NULL_ORDER_FIRST; }
break;
- case 555: /* null_ordering_opt ::= NULLS LAST */
-{ yymsp[-1].minor.yy89 = NULL_ORDER_LAST; }
+ case 557: /* null_ordering_opt ::= NULLS LAST */
+{ yymsp[-1].minor.yy23 = NULL_ORDER_LAST; }
break;
default:
break;
diff --git a/source/libs/planner/src/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c
index fef5bd654e..208f548457 100644
--- a/source/libs/planner/src/planLogicCreater.c
+++ b/source/libs/planner/src/planLogicCreater.c
@@ -374,6 +374,20 @@ static int32_t createScanLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect
code = addDefaultScanCol(pRealTable->pMeta, &pScan->pScanCols);
}
+ if (TSDB_CODE_SUCCESS == code && NULL != pSelect->pTags && NULL == pSelect->pPartitionByList) {
+ pScan->pTags = nodesCloneList(pSelect->pTags);
+ if (NULL == pScan->pTags) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ }
+ }
+
+ if (TSDB_CODE_SUCCESS == code && NULL != pSelect->pSubtable && NULL == pSelect->pPartitionByList) {
+ pScan->pSubtable = nodesCloneNode(pSelect->pSubtable);
+ if (NULL == pScan->pSubtable) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ }
+ }
+
// set output
if (TSDB_CODE_SUCCESS == code) {
code = createColumnByRewriteExprs(pScan->pScanCols, &pScan->node.pTargets);
@@ -1041,7 +1055,7 @@ static int32_t createProjectLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSel
TSWAP(pProject->node.pLimit, pSelect->pLimit);
TSWAP(pProject->node.pSlimit, pSelect->pSlimit);
- pProject->ignoreGroupId = (NULL == pSelect->pPartitionByList);
+ pProject->ignoreGroupId = pSelect->isSubquery ? true : (NULL == pSelect->pPartitionByList);
pProject->node.groupAction =
(!pSelect->isSubquery && pCxt->pPlanCxt->streamQuery) ? GROUP_ACTION_KEEP : GROUP_ACTION_CLEAR;
pProject->node.requireDataOrder = DATA_ORDER_LEVEL_NONE;
diff --git a/source/libs/planner/src/planSpliter.c b/source/libs/planner/src/planSpliter.c
index 6208fc172a..361cf33d58 100644
--- a/source/libs/planner/src/planSpliter.c
+++ b/source/libs/planner/src/planSpliter.c
@@ -348,7 +348,8 @@ static bool stbSplIsPartTableAgg(SAggLogicNode* pAgg) {
return false;
}
if (NULL != pAgg->pGroupKeys) {
- return stbSplHasPartTbname(pAgg->pGroupKeys) && stbSplNotSystemScan((SLogicNode*)nodesListGetNode(pAgg->node.pChildren, 0));
+ return stbSplHasPartTbname(pAgg->pGroupKeys) &&
+ stbSplNotSystemScan((SLogicNode*)nodesListGetNode(pAgg->node.pChildren, 0));
}
return stbSplHasPartTbname(stbSplGetPartKeys((SLogicNode*)nodesListGetNode(pAgg->node.pChildren, 0)));
}
@@ -559,6 +560,8 @@ static int32_t stbSplCreateMergeNode(SSplitContext* pCxt, SLogicSubplan* pSubpla
if (NULL == pMerge->node.pLimit) {
code = TSDB_CODE_OUT_OF_MEMORY;
}
+ ((SLimitNode*)pSplitNode->pLimit)->limit += ((SLimitNode*)pSplitNode->pLimit)->offset;
+ ((SLimitNode*)pSplitNode->pLimit)->offset = 0;
}
if (TSDB_CODE_SUCCESS == code) {
if (NULL == pSubplan) {
@@ -1039,21 +1042,29 @@ static int32_t stbSplSplitSortNode(SSplitContext* pCxt, SStableSplitInfo* pInfo)
return code;
}
-static int32_t stbSplSplitScanNodeWithoutPartTags(SSplitContext* pCxt, SStableSplitInfo* pInfo) {
- SLogicNode* pSplitNode = pInfo->pSplitNode;
+static int32_t stbSplGetSplitNodeForScan(SStableSplitInfo* pInfo, SLogicNode** pSplitNode) {
+ *pSplitNode = pInfo->pSplitNode;
if (NULL != pInfo->pSplitNode->pParent && QUERY_NODE_LOGIC_PLAN_PROJECT == nodeType(pInfo->pSplitNode->pParent) &&
NULL == pInfo->pSplitNode->pParent->pLimit && NULL == pInfo->pSplitNode->pParent->pSlimit) {
- pSplitNode = pInfo->pSplitNode->pParent;
+ *pSplitNode = pInfo->pSplitNode->pParent;
if (NULL != pInfo->pSplitNode->pLimit) {
- pSplitNode->pLimit = nodesCloneNode(pInfo->pSplitNode->pLimit);
- if (NULL == pSplitNode->pLimit) {
+ (*pSplitNode)->pLimit = nodesCloneNode(pInfo->pSplitNode->pLimit);
+ if (NULL == (*pSplitNode)->pLimit) {
return TSDB_CODE_OUT_OF_MEMORY;
}
((SLimitNode*)pInfo->pSplitNode->pLimit)->limit += ((SLimitNode*)pInfo->pSplitNode->pLimit)->offset;
((SLimitNode*)pInfo->pSplitNode->pLimit)->offset = 0;
}
}
- int32_t code = splCreateExchangeNodeForSubplan(pCxt, pInfo->pSubplan, pSplitNode, SUBPLAN_TYPE_MERGE);
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t stbSplSplitScanNodeWithoutPartTags(SSplitContext* pCxt, SStableSplitInfo* pInfo) {
+ SLogicNode* pSplitNode = NULL;
+ int32_t code = stbSplGetSplitNodeForScan(pInfo, &pSplitNode);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = splCreateExchangeNodeForSubplan(pCxt, pInfo->pSubplan, pSplitNode, SUBPLAN_TYPE_MERGE);
+ }
if (TSDB_CODE_SUCCESS == code) {
code = nodesListMakeStrictAppend(&pInfo->pSubplan->pChildren,
(SNode*)splCreateScanSubplan(pCxt, pSplitNode, SPLIT_FLAG_STABLE_SPLIT));
@@ -1063,12 +1074,11 @@ static int32_t stbSplSplitScanNodeWithoutPartTags(SSplitContext* pCxt, SStableSp
}
static int32_t stbSplSplitScanNodeWithPartTags(SSplitContext* pCxt, SStableSplitInfo* pInfo) {
- SLogicNode* pSplitNode = pInfo->pSplitNode;
- if (NULL != pInfo->pSplitNode->pParent && QUERY_NODE_LOGIC_PLAN_PROJECT == nodeType(pInfo->pSplitNode->pParent) &&
- NULL == pInfo->pSplitNode->pParent->pLimit && NULL == pInfo->pSplitNode->pParent->pSlimit) {
- pSplitNode = pInfo->pSplitNode->pParent;
+ SLogicNode* pSplitNode = NULL;
+ int32_t code = stbSplGetSplitNodeForScan(pInfo, &pSplitNode);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = stbSplCreateMergeNode(pCxt, pInfo->pSubplan, pSplitNode, NULL, pSplitNode, true);
}
- int32_t code = stbSplCreateMergeNode(pCxt, pInfo->pSubplan, pSplitNode, NULL, pSplitNode, true);
if (TSDB_CODE_SUCCESS == code) {
code = nodesListMakeStrictAppend(&pInfo->pSubplan->pChildren,
(SNode*)splCreateScanSubplan(pCxt, pSplitNode, SPLIT_FLAG_STABLE_SPLIT));
diff --git a/source/libs/qworker/inc/qwInt.h b/source/libs/qworker/inc/qwInt.h
index 787ef7501d..9553cb97b5 100644
--- a/source/libs/qworker/inc/qwInt.h
+++ b/source/libs/qworker/inc/qwInt.h
@@ -194,6 +194,8 @@ typedef struct SQWorker {
SMsgCb msgCb;
SQWStat stat;
int32_t *destroyed;
+
+ int8_t nodeStopped;
} SQWorker;
typedef struct SQWorkerMgmt {
diff --git a/source/libs/qworker/src/qwUtil.c b/source/libs/qworker/src/qwUtil.c
index fdd2775daa..7ee7c50c96 100644
--- a/source/libs/qworker/src/qwUtil.c
+++ b/source/libs/qworker/src/qwUtil.c
@@ -213,9 +213,15 @@ int32_t qwAcquireTaskCtx(QW_FPARAMS_DEF, SQWTaskCtx **ctx) {
QW_SET_QTID(id, qId, tId, eId);
*ctx = taosHashAcquire(mgmt->ctxHash, id, sizeof(id));
+ int8_t nodeStopped = atomic_load_8(&mgmt->nodeStopped);
if (NULL == (*ctx)) {
- QW_TASK_DLOG_E("task ctx not exist, may be dropped");
- QW_ERR_RET(TSDB_CODE_QRY_TASK_CTX_NOT_EXIST);
+ if (!nodeStopped) {
+ QW_TASK_DLOG_E("task ctx not exist, may be dropped");
+ QW_ERR_RET(TSDB_CODE_QRY_TASK_CTX_NOT_EXIST);
+ } else {
+ QW_TASK_DLOG_E("node stopped");
+ QW_ERR_RET(TSDB_CODE_VND_STOPPED);
+ }
}
return TSDB_CODE_SUCCESS;
@@ -226,9 +232,16 @@ int32_t qwGetTaskCtx(QW_FPARAMS_DEF, SQWTaskCtx **ctx) {
QW_SET_QTID(id, qId, tId, eId);
*ctx = taosHashGet(mgmt->ctxHash, id, sizeof(id));
+ int8_t nodeStopped = atomic_load_8(&mgmt->nodeStopped);
+
if (NULL == (*ctx)) {
- QW_TASK_DLOG_E("task ctx not exist, may be dropped");
- QW_ERR_RET(TSDB_CODE_QRY_TASK_CTX_NOT_EXIST);
+ if (!nodeStopped) {
+ QW_TASK_DLOG_E("task ctx not exist, may be dropped");
+ QW_ERR_RET(TSDB_CODE_QRY_TASK_CTX_NOT_EXIST);
+ } else {
+ QW_TASK_DLOG_E("node stopped");
+ QW_ERR_RET(TSDB_CODE_VND_STOPPED);
+ }
}
return TSDB_CODE_SUCCESS;
diff --git a/source/libs/qworker/src/qworker.c b/source/libs/qworker/src/qworker.c
index 2f712e6eba..1e35529d27 100644
--- a/source/libs/qworker/src/qworker.c
+++ b/source/libs/qworker/src/qworker.c
@@ -1187,6 +1187,9 @@ void qWorkerStopAllTasks(void *qWorkerMgmt) {
uint64_t qId, tId, sId;
int32_t eId;
int64_t rId = 0;
+
+ atomic_store_8(&mgmt->nodeStopped, 1);
+
void *pIter = taosHashIterate(mgmt->ctxHash, NULL);
while (pIter) {
SQWTaskCtx *ctx = (SQWTaskCtx *)pIter;
diff --git a/source/libs/scheduler/src/schJob.c b/source/libs/scheduler/src/schJob.c
index 6a8f81f8c7..1bfbab0591 100644
--- a/source/libs/scheduler/src/schJob.c
+++ b/source/libs/scheduler/src/schJob.c
@@ -234,7 +234,7 @@ int32_t schBuildTaskRalation(SSchJob *pJob, SHashObj *planToTask) {
}
SSchTask *pTask = taosArrayGet(pLevel->subTasks, 0);
- if (SUBPLAN_TYPE_MODIFY != pTask->plan->subplanType) {
+ if (SUBPLAN_TYPE_MODIFY != pTask->plan->subplanType || EXPLAIN_MODE_DISABLE != pJob->attr.explainMode) {
pJob->attr.needFetch = true;
}
}
@@ -484,7 +484,7 @@ int32_t schProcessOnJobFailure(SSchJob *pJob, int32_t errCode) {
if (TSDB_CODE_SCH_IGNORE_ERROR == errCode) {
return TSDB_CODE_SCH_IGNORE_ERROR;
}
-
+
schUpdateJobErrCode(pJob, errCode);
int32_t code = atomic_load_32(&pJob->errCode);
diff --git a/source/libs/stream/src/streamState.c b/source/libs/stream/src/streamState.c
index e26c8a5c5b..56c3c3ebef 100644
--- a/source/libs/stream/src/streamState.c
+++ b/source/libs/stream/src/streamState.c
@@ -199,7 +199,7 @@ void streamStateClose(SStreamState* pState) {
}
int32_t streamStateBegin(SStreamState* pState) {
- if (tdbBegin(pState->pTdbState->db, &pState->pTdbState->txn, tdbDefaultMalloc, tdbDefaultFree, NULL,
+ if (tdbBegin(pState->pTdbState->db, &pState->pTdbState->txn, NULL, NULL, NULL,
TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED) < 0) {
tdbAbort(pState->pTdbState->db, pState->pTdbState->txn);
return -1;
@@ -215,7 +215,7 @@ int32_t streamStateCommit(SStreamState* pState) {
return -1;
}
- if (tdbBegin(pState->pTdbState->db, &pState->pTdbState->txn, tdbDefaultMalloc, tdbDefaultFree, NULL,
+ if (tdbBegin(pState->pTdbState->db, &pState->pTdbState->txn, NULL, NULL, NULL,
TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED) < 0) {
return -1;
}
@@ -227,7 +227,7 @@ int32_t streamStateAbort(SStreamState* pState) {
return -1;
}
- if (tdbBegin(pState->pTdbState->db, &pState->pTdbState->txn, tdbDefaultMalloc, tdbDefaultFree, NULL,
+ if (tdbBegin(pState->pTdbState->db, &pState->pTdbState->txn, NULL, NULL, NULL,
TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED) < 0) {
return -1;
}
diff --git a/source/libs/sync/inc/syncSnapshot.h b/source/libs/sync/inc/syncSnapshot.h
index 5277e7818f..063b4f51f5 100644
--- a/source/libs/sync/inc/syncSnapshot.h
+++ b/source/libs/sync/inc/syncSnapshot.h
@@ -24,7 +24,7 @@ extern "C" {
#define SYNC_SNAPSHOT_SEQ_INVALID -2
#define SYNC_SNAPSHOT_SEQ_FORCE_CLOSE -3
-#define SYNC_SNAPSHOT_SEQ_PRE_SNAPSHOT -1
+#define SYNC_SNAPSHOT_SEQ_PREP_SNAPSHOT -1
#define SYNC_SNAPSHOT_SEQ_BEGIN 0
#define SYNC_SNAPSHOT_SEQ_END 0x7FFFFFFF
diff --git a/source/libs/sync/src/syncAppendEntries.c b/source/libs/sync/src/syncAppendEntries.c
index 948d2f53e7..835e5d248e 100644
--- a/source/libs/sync/src/syncAppendEntries.c
+++ b/source/libs/sync/src/syncAppendEntries.c
@@ -89,45 +89,6 @@
// /\ UNCHANGED <>
//
-int32_t syncNodeFollowerCommit(SSyncNode* ths, SyncIndex newCommitIndex) {
- ASSERT(false && "deprecated");
- if (ths->state != TAOS_SYNC_STATE_FOLLOWER) {
- sNTrace(ths, "can not do follower commit");
- return -1;
- }
-
- // maybe update commit index, leader notice me
- if (newCommitIndex > ths->commitIndex) {
- // has commit entry in local
- if (newCommitIndex <= ths->pLogStore->syncLogLastIndex(ths->pLogStore)) {
- // advance commit index to sanpshot first
- SSnapshot snapshot;
- ths->pFsm->FpGetSnapshotInfo(ths->pFsm, &snapshot);
- if (snapshot.lastApplyIndex >= 0 && snapshot.lastApplyIndex > ths->commitIndex) {
- SyncIndex commitBegin = ths->commitIndex;
- SyncIndex commitEnd = snapshot.lastApplyIndex;
- ths->commitIndex = snapshot.lastApplyIndex;
- sNTrace(ths, "commit by snapshot from index:%" PRId64 " to index:%" PRId64, commitBegin, commitEnd);
- }
-
- SyncIndex beginIndex = ths->commitIndex + 1;
- SyncIndex endIndex = newCommitIndex;
-
- // update commit index
- ths->commitIndex = newCommitIndex;
-
- // call back Wal
- int32_t code = ths->pLogStore->syncLogUpdateCommitIndex(ths->pLogStore, ths->commitIndex);
- ASSERT(code == 0);
-
- code = syncNodeDoCommit(ths, beginIndex, endIndex, ths->state);
- ASSERT(code == 0);
- }
- }
-
- return 0;
-}
-
SSyncRaftEntry* syncBuildRaftEntryFromAppendEntries(const SyncAppendEntries* pMsg) {
SSyncRaftEntry* pEntry = taosMemoryMalloc(pMsg->dataLen);
if (pEntry == NULL) {
@@ -232,256 +193,3 @@ _IGNORE:
rpcFreeCont(rpcRsp.pCont);
return 0;
}
-
-int32_t syncNodeOnAppendEntriesOld(SSyncNode* ths, const SRpcMsg* pRpcMsg) {
- SyncAppendEntries* pMsg = pRpcMsg->pCont;
- SRpcMsg rpcRsp = {0};
-
- // if already drop replica, do not process
- if (!syncNodeInRaftGroup(ths, &(pMsg->srcId))) {
- syncLogRecvAppendEntries(ths, pMsg, "not in my config");
- goto _IGNORE;
- }
-
- // prepare response msg
- int32_t code = syncBuildAppendEntriesReply(&rpcRsp, ths->vgId);
- if (code != 0) {
- syncLogRecvAppendEntries(ths, pMsg, "build rsp error");
- goto _IGNORE;
- }
-
- SyncAppendEntriesReply* pReply = rpcRsp.pCont;
- pReply->srcId = ths->myRaftId;
- pReply->destId = pMsg->srcId;
- pReply->term = ths->raftStore.currentTerm;
- pReply->success = false;
- // pReply->matchIndex = ths->pLogStore->syncLogLastIndex(ths->pLogStore);
- pReply->matchIndex = SYNC_INDEX_INVALID;
- pReply->lastSendIndex = pMsg->prevLogIndex + 1;
- pReply->startTime = ths->startTime;
-
- if (pMsg->term < ths->raftStore.currentTerm) {
- syncLogRecvAppendEntries(ths, pMsg, "reject, small term");
- goto _SEND_RESPONSE;
- }
-
- if (pMsg->term > ths->raftStore.currentTerm) {
- pReply->term = pMsg->term;
- }
-
- syncNodeStepDown(ths, pMsg->term);
- syncNodeResetElectTimer(ths);
-
- SyncIndex startIndex = ths->pLogStore->syncLogBeginIndex(ths->pLogStore);
- SyncIndex lastIndex = ths->pLogStore->syncLogLastIndex(ths->pLogStore);
-
- if (pMsg->prevLogIndex > lastIndex) {
- syncLogRecvAppendEntries(ths, pMsg, "reject, index not match");
- goto _SEND_RESPONSE;
- }
-
- if (pMsg->prevLogIndex >= startIndex) {
- SyncTerm myPreLogTerm = syncNodeGetPreTerm(ths, pMsg->prevLogIndex + 1);
- // ASSERT(myPreLogTerm != SYNC_TERM_INVALID);
- if (myPreLogTerm == SYNC_TERM_INVALID) {
- syncLogRecvAppendEntries(ths, pMsg, "reject, pre-term invalid");
- goto _SEND_RESPONSE;
- }
-
- if (myPreLogTerm != pMsg->prevLogTerm) {
- syncLogRecvAppendEntries(ths, pMsg, "reject, pre-term not match");
- goto _SEND_RESPONSE;
- }
- }
-
- // accept
- pReply->success = true;
- bool hasAppendEntries = pMsg->dataLen > 0;
- if (hasAppendEntries) {
- SSyncRaftEntry* pAppendEntry = syncEntryBuildFromAppendEntries(pMsg);
- ASSERT(pAppendEntry != NULL);
-
- SyncIndex appendIndex = pMsg->prevLogIndex + 1;
-
- LRUHandle* hLocal = NULL;
- LRUHandle* hAppend = NULL;
-
- int32_t code = 0;
- SSyncRaftEntry* pLocalEntry = NULL;
- SLRUCache* pCache = ths->pLogStore->pCache;
- hLocal = taosLRUCacheLookup(pCache, &appendIndex, sizeof(appendIndex));
- if (hLocal) {
- pLocalEntry = (SSyncRaftEntry*)taosLRUCacheValue(pCache, hLocal);
- code = 0;
-
- ths->pLogStore->cacheHit++;
- sNTrace(ths, "hit cache index:%" PRId64 ", bytes:%u, %p", appendIndex, pLocalEntry->bytes, pLocalEntry);
-
- } else {
- ths->pLogStore->cacheMiss++;
- sNTrace(ths, "miss cache index:%" PRId64, appendIndex);
-
- code = ths->pLogStore->syncLogGetEntry(ths->pLogStore, appendIndex, &pLocalEntry);
- }
-
- if (code == 0) {
- // get local entry success
-
- if (pLocalEntry->term == pAppendEntry->term) {
- // do nothing
- sNTrace(ths, "log match, do nothing, index:%" PRId64, appendIndex);
-
- } else {
- // truncate
- code = ths->pLogStore->syncLogTruncate(ths->pLogStore, appendIndex);
- if (code != 0) {
- char logBuf[128];
- snprintf(logBuf, sizeof(logBuf), "ignore, truncate error, append-index:%" PRId64, appendIndex);
- syncLogRecvAppendEntries(ths, pMsg, logBuf);
-
- if (hLocal) {
- taosLRUCacheRelease(ths->pLogStore->pCache, hLocal, false);
- } else {
- syncEntryDestroy(pLocalEntry);
- }
-
- if (hAppend) {
- taosLRUCacheRelease(ths->pLogStore->pCache, hAppend, false);
- } else {
- syncEntryDestroy(pAppendEntry);
- }
-
- goto _IGNORE;
- }
-
- ASSERT(pAppendEntry->index == appendIndex);
-
- // append
- code = ths->pLogStore->syncLogAppendEntry(ths->pLogStore, pAppendEntry, false);
- if (code != 0) {
- char logBuf[128];
- snprintf(logBuf, sizeof(logBuf), "ignore, append error, append-index:%" PRId64, appendIndex);
- syncLogRecvAppendEntries(ths, pMsg, logBuf);
-
- if (hLocal) {
- taosLRUCacheRelease(ths->pLogStore->pCache, hLocal, false);
- } else {
- syncEntryDestroy(pLocalEntry);
- }
-
- if (hAppend) {
- taosLRUCacheRelease(ths->pLogStore->pCache, hAppend, false);
- } else {
- syncEntryDestroy(pAppendEntry);
- }
-
- goto _IGNORE;
- }
-
- syncCacheEntry(ths->pLogStore, pAppendEntry, &hAppend);
- }
-
- } else {
- if (terrno == TSDB_CODE_WAL_LOG_NOT_EXIST) {
- // log not exist
-
- // truncate
- code = ths->pLogStore->syncLogTruncate(ths->pLogStore, appendIndex);
- if (code != 0) {
- char logBuf[128];
- snprintf(logBuf, sizeof(logBuf), "ignore, log not exist, truncate error, append-index:%" PRId64, appendIndex);
- syncLogRecvAppendEntries(ths, pMsg, logBuf);
-
- syncEntryDestroy(pLocalEntry);
- syncEntryDestroy(pAppendEntry);
- goto _IGNORE;
- }
-
- // append
- code = ths->pLogStore->syncLogAppendEntry(ths->pLogStore, pAppendEntry, false);
- if (code != 0) {
- char logBuf[128];
- snprintf(logBuf, sizeof(logBuf), "ignore, log not exist, append error, append-index:%" PRId64, appendIndex);
- syncLogRecvAppendEntries(ths, pMsg, logBuf);
-
- if (hLocal) {
- taosLRUCacheRelease(ths->pLogStore->pCache, hLocal, false);
- } else {
- syncEntryDestroy(pLocalEntry);
- }
-
- if (hAppend) {
- taosLRUCacheRelease(ths->pLogStore->pCache, hAppend, false);
- } else {
- syncEntryDestroy(pAppendEntry);
- }
-
- goto _IGNORE;
- }
-
- syncCacheEntry(ths->pLogStore, pAppendEntry, &hAppend);
-
- } else {
- // get local entry success
- char logBuf[128];
- snprintf(logBuf, sizeof(logBuf), "ignore, get local entry error, append-index:%" PRId64 " err:%d", appendIndex,
- terrno);
- syncLogRecvAppendEntries(ths, pMsg, logBuf);
-
- if (hLocal) {
- taosLRUCacheRelease(ths->pLogStore->pCache, hLocal, false);
- } else {
- syncEntryDestroy(pLocalEntry);
- }
-
- if (hAppend) {
- taosLRUCacheRelease(ths->pLogStore->pCache, hAppend, false);
- } else {
- syncEntryDestroy(pAppendEntry);
- }
-
- goto _IGNORE;
- }
- }
-
- // update match index
- pReply->matchIndex = pAppendEntry->index;
-
- if (hLocal) {
- taosLRUCacheRelease(ths->pLogStore->pCache, hLocal, false);
- } else {
- syncEntryDestroy(pLocalEntry);
- }
-
- if (hAppend) {
- taosLRUCacheRelease(ths->pLogStore->pCache, hAppend, false);
- } else {
- syncEntryDestroy(pAppendEntry);
- }
-
- } else {
- // no append entries, do nothing
- // maybe has extra entries, no harm
-
- // update match index
- pReply->matchIndex = pMsg->prevLogIndex;
- }
-
- // maybe update commit index, leader notice me
- syncNodeFollowerCommit(ths, pMsg->commitIndex);
-
- syncLogRecvAppendEntries(ths, pMsg, "accept");
- goto _SEND_RESPONSE;
-
-_IGNORE:
- rpcFreeCont(rpcRsp.pCont);
- return 0;
-
-_SEND_RESPONSE:
- // msg event log
- syncLogSendAppendEntriesReply(ths, pReply, "");
-
- // send response
- syncNodeSendMsgById(&pReply->destId, ths, &rpcRsp);
- return 0;
-}
diff --git a/source/libs/sync/src/syncAppendEntriesReply.c b/source/libs/sync/src/syncAppendEntriesReply.c
index 8157a5a14f..44a29da3ea 100644
--- a/source/libs/sync/src/syncAppendEntriesReply.c
+++ b/source/libs/sync/src/syncAppendEntriesReply.c
@@ -89,63 +89,3 @@ int32_t syncNodeOnAppendEntriesReply(SSyncNode* ths, const SRpcMsg* pRpcMsg) {
}
return 0;
}
-
-int32_t syncNodeOnAppendEntriesReplyOld(SSyncNode* ths, SyncAppendEntriesReply* pMsg) {
- int32_t ret = 0;
-
- // if already drop replica, do not process
- if (!syncNodeInRaftGroup(ths, &(pMsg->srcId))) {
- syncLogRecvAppendEntriesReply(ths, pMsg, "not in my config");
- return 0;
- }
-
- // drop stale response
- if (pMsg->term < ths->raftStore.currentTerm) {
- syncLogRecvAppendEntriesReply(ths, pMsg, "drop stale response");
- return 0;
- }
-
- if (ths->state == TAOS_SYNC_STATE_LEADER) {
- if (pMsg->term > ths->raftStore.currentTerm) {
- syncLogRecvAppendEntriesReply(ths, pMsg, "error term");
- syncNodeStepDown(ths, pMsg->term);
- return -1;
- }
-
- ASSERT(pMsg->term == ths->raftStore.currentTerm);
-
- if (pMsg->success) {
- SyncIndex oldMatchIndex = syncIndexMgrGetIndex(ths->pMatchIndex, &(pMsg->srcId));
- if (pMsg->matchIndex > oldMatchIndex) {
- syncIndexMgrSetIndex(ths->pMatchIndex, &(pMsg->srcId), pMsg->matchIndex);
- syncMaybeAdvanceCommitIndex(ths);
-
- // maybe update minMatchIndex
- ths->minMatchIndex = syncMinMatchIndex(ths);
- }
- syncIndexMgrSetIndex(ths->pNextIndex, &(pMsg->srcId), pMsg->matchIndex + 1);
-
- } else {
- SyncIndex nextIndex = syncIndexMgrGetIndex(ths->pNextIndex, &(pMsg->srcId));
- if (nextIndex > SYNC_INDEX_BEGIN) {
- --nextIndex;
- }
- syncIndexMgrSetIndex(ths->pNextIndex, &(pMsg->srcId), nextIndex);
- }
-
- // send next append entries
- SPeerState* pState = syncNodeGetPeerState(ths, &(pMsg->srcId));
- ASSERT(pState != NULL);
-
- if (pMsg->lastSendIndex == pState->lastSendIndex) {
- int64_t timeNow = taosGetTimestampMs();
- int64_t elapsed = timeNow - pState->lastSendTime;
- sNTrace(ths, "sync-append-entries rtt elapsed:%" PRId64 ", index:%" PRId64, elapsed, pState->lastSendIndex);
-
- syncNodeReplicateOne(ths, &(pMsg->srcId), true);
- }
- }
-
- syncLogRecvAppendEntriesReply(ths, pMsg, "process");
- return 0;
-}
diff --git a/source/libs/sync/src/syncCommit.c b/source/libs/sync/src/syncCommit.c
index 286cf4daf5..67ed1e0701 100644
--- a/source/libs/sync/src/syncCommit.c
+++ b/source/libs/sync/src/syncCommit.c
@@ -43,148 +43,6 @@
// IN commitIndex' = [commitIndex EXCEPT ![i] = newCommitIndex]
// /\ UNCHANGED <>
//
-void syncOneReplicaAdvance(SSyncNode* pSyncNode) {
- ASSERT(false && "deprecated");
- if (pSyncNode == NULL) {
- sError("pSyncNode is NULL");
- return;
- }
-
- if (pSyncNode->state != TAOS_SYNC_STATE_LEADER) {
- sNError(pSyncNode, "not leader, can not advance commit index");
- return;
- }
-
- if (pSyncNode->replicaNum != 1) {
- sNError(pSyncNode, "not one replica, can not advance commit index");
- return;
- }
-
- // advance commit index to snapshot first
- SSnapshot snapshot;
- pSyncNode->pFsm->FpGetSnapshotInfo(pSyncNode->pFsm, &snapshot);
- if (snapshot.lastApplyIndex > 0 && snapshot.lastApplyIndex > pSyncNode->commitIndex) {
- SyncIndex commitBegin = pSyncNode->commitIndex;
- SyncIndex commitEnd = snapshot.lastApplyIndex;
- pSyncNode->commitIndex = snapshot.lastApplyIndex;
- sNTrace(pSyncNode, "commit by snapshot from index:%" PRId64 " to index:%" PRId64, commitBegin, commitEnd);
- }
-
- // advance commit index as large as possible
- SyncIndex lastIndex = syncNodeGetLastIndex(pSyncNode);
- if (lastIndex > pSyncNode->commitIndex) {
- sNTrace(pSyncNode, "commit by wal from index:%" PRId64 " to index:%" PRId64, pSyncNode->commitIndex + 1, lastIndex);
- pSyncNode->commitIndex = lastIndex;
- }
-
- // call back Wal
- SyncIndex walCommitVer = logStoreWalCommitVer(pSyncNode->pLogStore);
- if (pSyncNode->commitIndex > walCommitVer) {
- pSyncNode->pLogStore->syncLogUpdateCommitIndex(pSyncNode->pLogStore, pSyncNode->commitIndex);
- }
-}
-
-void syncMaybeAdvanceCommitIndex(SSyncNode* pSyncNode) {
- ASSERTS(false, "deprecated");
- if (pSyncNode == NULL) {
- sError("pSyncNode is NULL");
- return;
- }
-
- if (pSyncNode->state != TAOS_SYNC_STATE_LEADER) {
- sNError(pSyncNode, "not leader, can not advance commit index");
- return;
- }
-
- // advance commit index to sanpshot first
- SSnapshot snapshot;
- pSyncNode->pFsm->FpGetSnapshotInfo(pSyncNode->pFsm, &snapshot);
- if (snapshot.lastApplyIndex > 0 && snapshot.lastApplyIndex > pSyncNode->commitIndex) {
- SyncIndex commitBegin = pSyncNode->commitIndex;
- SyncIndex commitEnd = snapshot.lastApplyIndex;
- pSyncNode->commitIndex = snapshot.lastApplyIndex;
- sNTrace(pSyncNode, "commit by snapshot from index:%" PRId64 " to index:%" PRId64, commitBegin, commitEnd);
- }
-
- // update commit index
- SyncIndex newCommitIndex = pSyncNode->commitIndex;
- for (SyncIndex index = syncNodeGetLastIndex(pSyncNode); index > pSyncNode->commitIndex; --index) {
- bool agree = syncAgree(pSyncNode, index);
-
- if (agree) {
- // term
- SSyncRaftEntry* pEntry = NULL;
- SLRUCache* pCache = pSyncNode->pLogStore->pCache;
- LRUHandle* h = taosLRUCacheLookup(pCache, &index, sizeof(index));
- if (h) {
- pEntry = (SSyncRaftEntry*)taosLRUCacheValue(pCache, h);
-
- pSyncNode->pLogStore->cacheHit++;
- sNTrace(pSyncNode, "hit cache index:%" PRId64 ", bytes:%u, %p", index, pEntry->bytes, pEntry);
-
- } else {
- pSyncNode->pLogStore->cacheMiss++;
- sNTrace(pSyncNode, "miss cache index:%" PRId64, index);
-
- int32_t code = pSyncNode->pLogStore->syncLogGetEntry(pSyncNode->pLogStore, index, &pEntry);
- if (code != 0) {
- sNError(pSyncNode, "advance commit index error, read wal index:%" PRId64, index);
- return;
- }
- }
- // cannot commit, even if quorum agree. need check term!
- if (pEntry->term <= pSyncNode->raftStore.currentTerm) {
- // update commit index
- newCommitIndex = index;
-
- if (h) {
- taosLRUCacheRelease(pCache, h, false);
- } else {
- syncEntryDestroy(pEntry);
- }
-
- break;
- } else {
- sNTrace(pSyncNode, "can not commit due to term not equal, index:%" PRId64 ", term:%" PRIu64, pEntry->index,
- pEntry->term);
- }
-
- if (h) {
- taosLRUCacheRelease(pCache, h, false);
- } else {
- syncEntryDestroy(pEntry);
- }
- }
- }
-
- // advance commit index as large as possible
- SyncIndex walCommitVer = logStoreWalCommitVer(pSyncNode->pLogStore);
- if (walCommitVer > newCommitIndex) {
- newCommitIndex = walCommitVer;
- }
-
- // maybe execute fsm
- if (newCommitIndex > pSyncNode->commitIndex) {
- SyncIndex beginIndex = pSyncNode->commitIndex + 1;
- SyncIndex endIndex = newCommitIndex;
-
- // update commit index
- pSyncNode->commitIndex = newCommitIndex;
-
- // call back Wal
- pSyncNode->pLogStore->syncLogUpdateCommitIndex(pSyncNode->pLogStore, pSyncNode->commitIndex);
-
- // execute fsm
- if (pSyncNode != NULL && pSyncNode->pFsm != NULL) {
- int32_t code = syncNodeDoCommit(pSyncNode, beginIndex, endIndex, pSyncNode->state);
- if (code != 0) {
- sNError(pSyncNode, "advance commit index error, do commit begin:%" PRId64 ", end:%" PRId64, beginIndex,
- endIndex);
- return;
- }
- }
- }
-}
bool syncAgreeIndex(SSyncNode* pSyncNode, SRaftId* pRaftId, SyncIndex index) {
// I am leader, I agree
@@ -210,83 +68,7 @@ static inline int64_t syncNodeAbs64(int64_t a, int64_t b) {
return c;
}
-int32_t syncNodeDynamicQuorum(const SSyncNode* pSyncNode) {
- return pSyncNode->quorum;
-
-#if 0
- int32_t quorum = 1; // self
-
- int64_t timeNow = taosGetTimestampMs();
- for (int i = 0; i < pSyncNode->peersNum; ++i) {
- int64_t peerStartTime = syncIndexMgrGetStartTime(pSyncNode->pNextIndex, &(pSyncNode->peersId)[i]);
- int64_t peerRecvTime = syncIndexMgrGetRecvTime(pSyncNode->pNextIndex, &(pSyncNode->peersId)[i]);
- SyncIndex peerMatchIndex = syncIndexMgrGetIndex(pSyncNode->pMatchIndex, &(pSyncNode->peersId)[i]);
-
- int64_t recvTimeDiff = TABS(peerRecvTime - timeNow);
- int64_t startTimeDiff = TABS(peerStartTime - pSyncNode->startTime);
- int64_t logDiff = TABS(peerMatchIndex - syncNodeGetLastIndex(pSyncNode));
-
- /*
- int64_t recvTimeDiff = syncNodeAbs64(peerRecvTime, timeNow);
- int64_t startTimeDiff = syncNodeAbs64(peerStartTime, pSyncNode->startTime);
- int64_t logDiff = syncNodeAbs64(peerMatchIndex, syncNodeGetLastIndex(pSyncNode));
- */
-
- int32_t addQuorum = 0;
-
- if (recvTimeDiff < SYNC_MAX_RECV_TIME_RANGE_MS) {
- if (startTimeDiff < SYNC_MAX_START_TIME_RANGE_MS) {
- addQuorum = 1;
- } else {
- if (logDiff < SYNC_ADD_QUORUM_COUNT) {
- addQuorum = 1;
- } else {
- addQuorum = 0;
- }
- }
- } else {
- addQuorum = 0;
- }
-
- /*
- if (recvTimeDiff < SYNC_MAX_RECV_TIME_RANGE_MS) {
- addQuorum = 1;
- } else {
- addQuorum = 0;
- }
-
- if (startTimeDiff > SYNC_MAX_START_TIME_RANGE_MS) {
- addQuorum = 0;
- }
- */
-
- quorum += addQuorum;
- }
-
- ASSERT(quorum <= pSyncNode->replicaNum);
-
- if (quorum < pSyncNode->quorum) {
- quorum = pSyncNode->quorum;
- }
-
- return quorum;
-#endif
-}
-
-/*
-bool syncAgree(SSyncNode* pSyncNode, SyncIndex index) {
- int agreeCount = 0;
- for (int i = 0; i < pSyncNode->replicaNum; ++i) {
- if (syncAgreeIndex(pSyncNode, &(pSyncNode->replicasId[i]), index)) {
- ++agreeCount;
- }
- if (agreeCount >= syncNodeDynamicQuorum(pSyncNode)) {
- return true;
- }
- }
- return false;
-}
-*/
+int32_t syncNodeDynamicQuorum(const SSyncNode* pSyncNode) { return pSyncNode->quorum; }
bool syncNodeAgreedUpon(SSyncNode* pNode, SyncIndex index) {
int count = 0;
diff --git a/source/libs/sync/src/syncElection.c b/source/libs/sync/src/syncElection.c
index cd3ffc33e3..682ace83ec 100644
--- a/source/libs/sync/src/syncElection.c
+++ b/source/libs/sync/src/syncElection.c
@@ -43,7 +43,10 @@ static int32_t syncNodeRequestVotePeers(SSyncNode* pNode) {
for (int i = 0; i < pNode->peersNum; ++i) {
SRpcMsg rpcMsg = {0};
ret = syncBuildRequestVote(&rpcMsg, pNode->vgId);
- ASSERT(ret == 0);
+ if (ret < 0) {
+ sError("vgId:%d, failed to build request-vote msg since %s", pNode->vgId, terrstr());
+ continue;
+ }
SyncRequestVote* pMsg = rpcMsg.pCont;
pMsg->srcId = pNode->myRaftId;
@@ -51,13 +54,18 @@ static int32_t syncNodeRequestVotePeers(SSyncNode* pNode) {
pMsg->term = pNode->raftStore.currentTerm;
ret = syncNodeGetLastIndexTerm(pNode, &pMsg->lastLogIndex, &pMsg->lastLogTerm);
- ASSERT(ret == 0);
+ if (ret < 0) {
+ sError("vgId:%d, failed to get index and term of last log since %s", pNode->vgId, terrstr());
+ continue;
+ }
ret = syncNodeSendMsgById(&pNode->peersId[i], pNode, &rpcMsg);
- ASSERT(ret == 0);
+ if (ret < 0) {
+ sError("vgId:%d, failed to send msg to peerId:%" PRId64, pNode->vgId, pNode->peersId[i].addr);
+ continue;
+ }
}
-
- return ret;
+ return 0;
}
int32_t syncNodeElect(SSyncNode* pSyncNode) {
diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c
index 11067d43aa..77b87a885b 100644
--- a/source/libs/sync/src/syncMain.c
+++ b/source/libs/sync/src/syncMain.c
@@ -292,8 +292,6 @@ int32_t syncBeginSnapshot(int64_t rid, int64_t lastApplyIndex) {
goto _DEL_WAL;
} else {
- lastApplyIndex -= SYNC_VNODE_LOG_RETENTION;
-
SyncIndex beginIndex = pSyncNode->pLogStore->syncLogBeginIndex(pSyncNode->pLogStore);
SyncIndex endIndex = pSyncNode->pLogStore->syncLogEndIndex(pSyncNode->pLogStore);
bool isEmpty = pSyncNode->pLogStore->syncLogIsEmpty(pSyncNode->pLogStore);
@@ -308,6 +306,8 @@ int32_t syncBeginSnapshot(int64_t rid, int64_t lastApplyIndex) {
if (pSyncNode->replicaNum > 1) {
// multi replicas
+ lastApplyIndex = TMAX(lastApplyIndex - SYNC_VNODE_LOG_RETENTION, beginIndex - 1);
+
if (pSyncNode->state == TAOS_SYNC_STATE_LEADER) {
pSyncNode->minMatchIndex = syncMinMatchIndex(pSyncNode);
@@ -586,78 +586,6 @@ SSyncState syncGetState(int64_t rid) {
return state;
}
-#if 0
-int32_t syncGetSnapshotByIndex(int64_t rid, SyncIndex index, SSnapshot* pSnapshot) {
- if (index < SYNC_INDEX_BEGIN) {
- return -1;
- }
-
- SSyncNode* pSyncNode = syncNodeAcquire(rid);
- if (pSyncNode == NULL) {
- return -1;
- }
- ASSERT(rid == pSyncNode->rid);
-
- SSyncRaftEntry* pEntry = NULL;
- int32_t code = pSyncNode->pLogStore->syncLogGetEntry(pSyncNode->pLogStore, index, &pEntry);
- if (code != 0) {
- if (pEntry != NULL) {
- syncEntryDestroy(pEntry);
- }
- syncNodeRelease(pSyncNode);
- return -1;
- }
- ASSERT(pEntry != NULL);
-
- pSnapshot->data = NULL;
- pSnapshot->lastApplyIndex = index;
- pSnapshot->lastApplyTerm = pEntry->term;
- pSnapshot->lastConfigIndex = syncNodeGetSnapshotConfigIndex(pSyncNode, index);
-
- syncEntryDestroy(pEntry);
- syncNodeRelease(pSyncNode);
- return 0;
-}
-
-int32_t syncGetSnapshotMeta(int64_t rid, struct SSnapshotMeta* sMeta) {
- SSyncNode* pSyncNode = syncNodeAcquire(rid);
- if (pSyncNode == NULL) {
- return -1;
- }
- ASSERT(rid == pSyncNode->rid);
- sMeta->lastConfigIndex = pSyncNode->raftCfg.lastConfigIndex;
-
- sTrace("vgId:%d, get snapshot meta, lastConfigIndex:%" PRId64, pSyncNode->vgId, pSyncNode->raftCfg.lastConfigIndex);
-
- syncNodeRelease(pSyncNode);
- return 0;
-}
-
-int32_t syncGetSnapshotMetaByIndex(int64_t rid, SyncIndex snapshotIndex, struct SSnapshotMeta* sMeta) {
- SSyncNode* pSyncNode = syncNodeAcquire(rid);
- if (pSyncNode == NULL) {
- return -1;
- }
- ASSERT(rid == pSyncNode->rid);
-
- ASSERT(pSyncNode->raftCfg.configIndexCount >= 1);
- SyncIndex lastIndex = (pSyncNode->raftCfg.configIndexArr)[0];
-
- for (int32_t i = 0; i < pSyncNode->raftCfg.configIndexCount; ++i) {
- if ((pSyncNode->raftCfg.configIndexArr)[i] > lastIndex &&
- (pSyncNode->raftCfg.configIndexArr)[i] <= snapshotIndex) {
- lastIndex = (pSyncNode->raftCfg.configIndexArr)[i];
- }
- }
- sMeta->lastConfigIndex = lastIndex;
- sTrace("vgId:%d, get snapshot meta by index:%" PRId64 " lcindex:%" PRId64, pSyncNode->vgId, snapshotIndex,
- sMeta->lastConfigIndex);
-
- syncNodeRelease(pSyncNode);
- return 0;
-}
-#endif
-
SyncIndex syncNodeGetSnapshotConfigIndex(SSyncNode* pSyncNode, SyncIndex snapshotLastApplyIndex) {
ASSERT(pSyncNode->raftCfg.configIndexCount >= 1);
SyncIndex lastIndex = (pSyncNode->raftCfg.configIndexArr)[0];
@@ -1042,9 +970,12 @@ SSyncNode* syncNodeOpen(SSyncInfo* pSyncInfo) {
pSyncNode->commitIndex = commitIndex;
sInfo("vgId:%d, sync node commitIndex initialized as %" PRId64, pSyncNode->vgId, pSyncNode->commitIndex);
+ // restore log store on need
if (syncNodeLogStoreRestoreOnNeed(pSyncNode) < 0) {
+ sError("vgId:%d, failed to restore log store since %s.", pSyncNode->vgId, terrstr());
goto _error;
}
+
// timer ms init
pSyncNode->pingBaseLine = PING_TIMER_MS;
pSyncNode->electBaseLine = tsElectInterval;
@@ -1107,10 +1038,16 @@ SSyncNode* syncNodeOpen(SSyncInfo* pSyncInfo) {
pSyncNode->changing = false;
// replication mgr
- syncNodeLogReplMgrInit(pSyncNode);
+ if (syncNodeLogReplMgrInit(pSyncNode) < 0) {
+ sError("vgId:%d, failed to init repl mgr since %s.", pSyncNode->vgId, terrstr());
+ goto _error;
+ }
// peer state
- syncNodePeerStateInit(pSyncNode);
+ if (syncNodePeerStateInit(pSyncNode) < 0) {
+ sError("vgId:%d, failed to init peer stat since %s.", pSyncNode->vgId, terrstr());
+ goto _error;
+ }
//
// min match index
@@ -1205,27 +1142,10 @@ int32_t syncNodeStart(SSyncNode* pSyncNode) {
int32_t ret = 0;
ret = syncNodeStartPingTimer(pSyncNode);
- ASSERT(ret == 0);
- return ret;
-}
-
-void syncNodeStartOld(SSyncNode* pSyncNode) {
- // start raft
- if (pSyncNode->replicaNum == 1) {
- raftStoreNextTerm(pSyncNode);
- syncNodeBecomeLeader(pSyncNode, "one replica start");
-
- // Raft 3.6.2 Committing entries from previous terms
- syncNodeAppendNoop(pSyncNode);
- syncMaybeAdvanceCommitIndex(pSyncNode);
-
- } else {
- syncNodeBecomeFollower(pSyncNode, "first start");
+ if (ret != 0) {
+ sError("vgId:%d, failed to start ping timer since %s", pSyncNode->vgId, terrstr());
}
-
- int32_t ret = 0;
- ret = syncNodeStartPingTimer(pSyncNode);
- ASSERT(ret == 0);
+ return ret;
}
int32_t syncNodeStartStandBy(SSyncNode* pSyncNode) {
@@ -1236,11 +1156,16 @@ int32_t syncNodeStartStandBy(SSyncNode* pSyncNode) {
// reset elect timer, long enough
int32_t electMS = TIMER_MAX_MS;
int32_t ret = syncNodeRestartElectTimer(pSyncNode, electMS);
- ASSERT(ret == 0);
+ if (ret < 0) {
+ sError("vgId:%d, failed to restart elect timer since %s", pSyncNode->vgId, terrstr());
+ return -1;
+ }
- ret = 0;
ret = syncNodeStartPingTimer(pSyncNode);
- ASSERT(ret == 0);
+ if (ret < 0) {
+ sError("vgId:%d, failed to start ping timer since %s", pSyncNode->vgId, terrstr());
+ return -1;
+ }
return ret;
}
@@ -1829,12 +1754,6 @@ void syncNodeBecomeLeader(SSyncNode* pSyncNode, const char* debugStr) {
pSyncNode->leaderCache = pSyncNode->myRaftId;
for (int32_t i = 0; i < pSyncNode->pNextIndex->replicaNum; ++i) {
- // maybe overwrite myself, no harm
- // just do it!
-
- // pSyncNode->pNextIndex->index[i] = pSyncNode->pLogStore->getLastIndex(pSyncNode->pLogStore) + 1;
-
- // maybe wal is deleted
SyncIndex lastIndex;
SyncTerm lastTerm;
int32_t code = syncNodeGetLastIndexTerm(pSyncNode, &lastIndex, &lastTerm);
@@ -1896,7 +1815,11 @@ void syncNodeBecomeLeader(SSyncNode* pSyncNode, const char* debugStr) {
void syncNodeCandidate2Leader(SSyncNode* pSyncNode) {
ASSERT(pSyncNode->state == TAOS_SYNC_STATE_CANDIDATE);
- ASSERT(voteGrantedMajority(pSyncNode->pVotesGranted));
+ bool granted = voteGrantedMajority(pSyncNode->pVotesGranted);
+ if (!granted) {
+ sError("vgId:%d, not granted by majority.", pSyncNode->vgId);
+ return;
+ }
syncNodeBecomeLeader(pSyncNode, "candidate to leader");
sNTrace(pSyncNode, "state change syncNodeCandidate2Leader");
@@ -1912,20 +1835,6 @@ void syncNodeCandidate2Leader(SSyncNode* pSyncNode) {
pSyncNode->vgId, pSyncNode->raftStore.currentTerm, pSyncNode->commitIndex, lastIndex);
}
-void syncNodeCandidate2LeaderOld(SSyncNode* pSyncNode) {
- ASSERT(pSyncNode->state == TAOS_SYNC_STATE_CANDIDATE);
- ASSERT(voteGrantedMajority(pSyncNode->pVotesGranted));
- syncNodeBecomeLeader(pSyncNode, "candidate to leader");
-
- // Raft 3.6.2 Committing entries from previous terms
- syncNodeAppendNoop(pSyncNode);
- syncMaybeAdvanceCommitIndex(pSyncNode);
-
- if (pSyncNode->replicaNum > 1) {
- syncNodeReplicate(pSyncNode);
- }
-}
-
bool syncNodeIsMnode(SSyncNode* pSyncNode) { return (pSyncNode->vgId == 1); }
int32_t syncNodePeerStateInit(SSyncNode* pSyncNode) {
@@ -1971,7 +1880,8 @@ void syncNodeCandidate2Follower(SSyncNode* pSyncNode) {
// need assert
void syncNodeVoteForTerm(SSyncNode* pSyncNode, SyncTerm term, SRaftId* pRaftId) {
ASSERT(term == pSyncNode->raftStore.currentTerm);
- ASSERT(!raftStoreHasVoted(pSyncNode));
+ bool voted = raftStoreHasVoted(pSyncNode);
+ ASSERT(!voted);
raftStoreVote(pSyncNode, pRaftId);
}
@@ -2649,24 +2559,6 @@ int32_t syncNodeOnLocalCmd(SSyncNode* ths, const SRpcMsg* pRpcMsg) {
return 0;
}
-int32_t syncNodeOnLocalCmdOld(SSyncNode* ths, const SRpcMsg* pRpcMsg) {
- ASSERT(false && "deprecated");
- SyncLocalCmd* pMsg = pRpcMsg->pCont;
- syncLogRecvLocalCmd(ths, pMsg, "");
-
- if (pMsg->cmd == SYNC_LOCAL_CMD_STEP_DOWN) {
- syncNodeStepDown(ths, pMsg->currentTerm);
-
- } else if (pMsg->cmd == SYNC_LOCAL_CMD_FOLLOWER_CMT) {
- syncNodeFollowerCommit(ths, pMsg->commitIndex);
-
- } else {
- sError("error local cmd");
- }
-
- return 0;
-}
-
// TLA+ Spec
// ClientRequest(i, v) ==
// /\ state[i] = Leader
@@ -2711,96 +2603,6 @@ int32_t syncNodeOnClientRequest(SSyncNode* ths, SRpcMsg* pMsg, SyncIndex* pRetIn
}
}
-int32_t syncNodeOnClientRequestOld(SSyncNode* ths, SRpcMsg* pMsg, SyncIndex* pRetIndex) {
- sNTrace(ths, "on client request");
-
- int32_t ret = 0;
- int32_t code = 0;
-
- SyncIndex index = ths->pLogStore->syncLogWriteIndex(ths->pLogStore);
- SyncTerm term = ths->raftStore.currentTerm;
- SSyncRaftEntry* pEntry;
-
- if (pMsg->msgType == TDMT_SYNC_CLIENT_REQUEST) {
- pEntry = syncEntryBuildFromClientRequest(pMsg->pCont, term, index);
- } else {
- pEntry = syncEntryBuildFromRpcMsg(pMsg, term, index);
- }
-
- LRUHandle* h = NULL;
-
- if (ths->state == TAOS_SYNC_STATE_LEADER) {
- // append entry
- code = ths->pLogStore->syncLogAppendEntry(ths->pLogStore, pEntry, false);
- if (code != 0) {
- if (ths->replicaNum == 1) {
- if (h) {
- taosLRUCacheRelease(ths->pLogStore->pCache, h, false);
- } else {
- syncEntryDestroy(pEntry);
- }
-
- return -1;
-
- } else {
- // del resp mgr, call FpCommitCb
- SFsmCbMeta cbMeta = {
- .index = pEntry->index,
- .lastConfigIndex = SYNC_INDEX_INVALID,
- .isWeak = pEntry->isWeak,
- .code = -1,
- .state = ths->state,
- .seqNum = pEntry->seqNum,
- .term = pEntry->term,
- .currentTerm = ths->raftStore.currentTerm,
- .flag = 0,
- };
- ths->pFsm->FpCommitCb(ths->pFsm, pMsg, &cbMeta);
-
- if (h) {
- taosLRUCacheRelease(ths->pLogStore->pCache, h, false);
- } else {
- syncEntryDestroy(pEntry);
- }
-
- return -1;
- }
- }
-
- syncCacheEntry(ths->pLogStore, pEntry, &h);
-
- // if mulit replica, start replicate right now
- if (ths->replicaNum > 1) {
- syncNodeReplicate(ths);
- }
-
- // if only myself, maybe commit right now
- if (ths->replicaNum == 1) {
- if (syncNodeIsMnode(ths)) {
- syncMaybeAdvanceCommitIndex(ths);
- } else {
- syncOneReplicaAdvance(ths);
- }
- }
- }
-
- if (pRetIndex != NULL) {
- if (ret == 0 && pEntry != NULL) {
- *pRetIndex = pEntry->index;
- } else {
- *pRetIndex = SYNC_INDEX_INVALID;
- }
- }
-
- if (h) {
- taosLRUCacheRelease(ths->pLogStore->pCache, h, false);
- } else {
- syncEntryDestroy(pEntry);
- }
-
- return ret;
-}
-
const char* syncStr(ESyncState state) {
switch (state) {
case TAOS_SYNC_STATE_FOLLOWER:
@@ -2905,129 +2707,6 @@ bool syncNodeIsOptimizedOneReplica(SSyncNode* ths, SRpcMsg* pMsg) {
return (ths->replicaNum == 1 && syncUtilUserCommit(pMsg->msgType) && ths->vgId != 1);
}
-int32_t syncNodeDoCommit(SSyncNode* ths, SyncIndex beginIndex, SyncIndex endIndex, uint64_t flag) {
- ASSERT(false);
- if (beginIndex > endIndex) {
- return 0;
- }
-
- if (ths == NULL) {
- return -1;
- }
-
- if (ths->pFsm != NULL && ths->pFsm->FpGetSnapshotInfo != NULL) {
- // advance commit index to sanpshot first
- SSnapshot snapshot = {0};
- ths->pFsm->FpGetSnapshotInfo(ths->pFsm, &snapshot);
- if (snapshot.lastApplyIndex >= 0 && snapshot.lastApplyIndex >= beginIndex) {
- sNTrace(ths, "commit by snapshot from index:%" PRId64 " to index:%" PRId64, beginIndex, snapshot.lastApplyIndex);
-
- // update begin index
- beginIndex = snapshot.lastApplyIndex + 1;
- }
- }
-
- int32_t code = 0;
- ESyncState state = flag;
-
- sNTrace(ths, "commit by wal from index:%" PRId64 " to index:%" PRId64, beginIndex, endIndex);
-
- // execute fsm
- if (ths->pFsm != NULL) {
- for (SyncIndex i = beginIndex; i <= endIndex; ++i) {
- if (i != SYNC_INDEX_INVALID) {
- SSyncRaftEntry* pEntry;
- SLRUCache* pCache = ths->pLogStore->pCache;
- LRUHandle* h = taosLRUCacheLookup(pCache, &i, sizeof(i));
- if (h) {
- pEntry = (SSyncRaftEntry*)taosLRUCacheValue(pCache, h);
-
- ths->pLogStore->cacheHit++;
- sNTrace(ths, "hit cache index:%" PRId64 ", bytes:%u, %p", i, pEntry->bytes, pEntry);
-
- } else {
- ths->pLogStore->cacheMiss++;
- sNTrace(ths, "miss cache index:%" PRId64, i);
-
- code = ths->pLogStore->syncLogGetEntry(ths->pLogStore, i, &pEntry);
- // ASSERT(code == 0);
- // ASSERT(pEntry != NULL);
- if (code != 0 || pEntry == NULL) {
- sNError(ths, "get log entry error");
- sFatal("vgId:%d, get log entry %" PRId64 " error when commit since %s", ths->vgId, i, terrstr());
- continue;
- }
- }
-
- SRpcMsg rpcMsg = {0};
- syncEntry2OriginalRpc(pEntry, &rpcMsg);
-
- sTrace("do commit index:%" PRId64 ", type:%s", i, TMSG_INFO(pEntry->msgType));
-
- // user commit
- if ((ths->pFsm->FpCommitCb != NULL) && syncUtilUserCommit(pEntry->originalRpcType)) {
- bool internalExecute = true;
- if ((ths->replicaNum == 1) && ths->restoreFinish && ths->vgId != 1) {
- internalExecute = false;
- }
-
- sNTrace(ths, "user commit index:%" PRId64 ", internal:%d, type:%s", i, internalExecute,
- TMSG_INFO(pEntry->msgType));
-
- // execute fsm in apply thread, or execute outside syncPropose
- if (internalExecute) {
- SFsmCbMeta cbMeta = {
- .index = pEntry->index,
- .lastConfigIndex = syncNodeGetSnapshotConfigIndex(ths, pEntry->index),
- .isWeak = pEntry->isWeak,
- .code = 0,
- .state = ths->state,
- .seqNum = pEntry->seqNum,
- .term = pEntry->term,
- .currentTerm = ths->raftStore.currentTerm,
- .flag = flag,
- };
-
- syncRespMgrGetAndDel(ths->pSyncRespMgr, cbMeta.seqNum, &rpcMsg.info);
- ths->pFsm->FpCommitCb(ths->pFsm, &rpcMsg, &cbMeta);
- }
- }
-
-#if 0
- // execute in pre-commit
- // leader transfer
- if (pEntry->originalRpcType == TDMT_SYNC_LEADER_TRANSFER) {
- code = syncDoLeaderTransfer(ths, &rpcMsg, pEntry);
- ASSERT(code == 0);
- }
-#endif
-
- // restore finish
- // if only snapshot, a noop entry will be append, so syncLogLastIndex is always ok
- if (pEntry->index == ths->pLogStore->syncLogLastIndex(ths->pLogStore)) {
- if (ths->restoreFinish == false) {
- if (ths->pFsm->FpRestoreFinishCb != NULL) {
- ths->pFsm->FpRestoreFinishCb(ths->pFsm);
- }
- ths->restoreFinish = true;
-
- int64_t restoreDelay = taosGetTimestampMs() - ths->leaderTime;
- sNTrace(ths, "restore finish, index:%" PRId64 ", elapsed:%" PRId64 " ms", pEntry->index, restoreDelay);
- }
- }
-
- rpcFreeCont(rpcMsg.pCont);
- if (h) {
- taosLRUCacheRelease(pCache, h, false);
- } else {
- syncEntryDestroy(pEntry);
- }
- }
- }
- }
- return 0;
-}
-
bool syncNodeInRaftGroup(SSyncNode* ths, SRaftId* pRaftId) {
for (int32_t i = 0; i < ths->replicaNum; ++i) {
if (syncUtilSameId(&((ths->replicasId)[i]), pRaftId)) {
diff --git a/source/libs/sync/src/syncPipeline.c b/source/libs/sync/src/syncPipeline.c
index 1d2b0b57fe..bb3bb0d6a4 100644
--- a/source/libs/sync/src/syncPipeline.c
+++ b/source/libs/sync/src/syncPipeline.c
@@ -830,7 +830,7 @@ int32_t syncLogReplMgrReplicateProbe(SSyncLogReplMgr* pMgr, SSyncNode* pNode, Sy
pMgr->endIndex = index + 1;
SSyncLogBuffer* pBuf = pNode->pLogBuf;
- sInfo("vgId:%d, probe peer:%" PRIx64 " with msg of index:%" PRId64 " term: %" PRId64 ". mgr (rs:%d): [%" PRId64
+ sTrace("vgId:%d, probe peer:%" PRIx64 " with msg of index:%" PRId64 " term: %" PRId64 ". mgr (rs:%d): [%" PRId64
" %" PRId64 ", %" PRId64 "), buffer: [%" PRId64 " %" PRId64 " %" PRId64 ", %" PRId64 ")",
pNode->vgId, pDestId->addr, index, term, pMgr->restored, pMgr->startIndex, pMgr->matchIndex, pMgr->endIndex,
pBuf->startIndex, pBuf->commitIndex, pBuf->matchIndex, pBuf->endIndex);
@@ -945,8 +945,11 @@ int32_t syncNodeLogReplMgrInit(SSyncNode* pNode) {
for (int i = 0; i < TSDB_MAX_REPLICA; i++) {
ASSERT(pNode->logReplMgrs[i] == NULL);
pNode->logReplMgrs[i] = syncLogReplMgrCreate();
+ if (pNode->logReplMgrs[i] == NULL) {
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ return -1;
+ }
pNode->logReplMgrs[i]->peerId = i;
- ASSERTS(pNode->logReplMgrs[i] != NULL, "Out of memory.");
}
return 0;
}
diff --git a/source/libs/sync/src/syncReplication.c b/source/libs/sync/src/syncReplication.c
index 1aa476e84e..3df203221b 100644
--- a/source/libs/sync/src/syncReplication.c
+++ b/source/libs/sync/src/syncReplication.c
@@ -48,92 +48,6 @@
int32_t syncNodeMaybeSendAppendEntries(SSyncNode* pSyncNode, const SRaftId* destRaftId, SRpcMsg* pRpcMsg);
-int32_t syncNodeReplicateOne(SSyncNode* pSyncNode, SRaftId* pDestId, bool snapshot) {
- ASSERT(false && "deprecated");
- // next index
- SyncIndex nextIndex = syncIndexMgrGetIndex(pSyncNode->pNextIndex, pDestId);
-
- if (snapshot) {
- // maybe start snapshot
- SyncIndex logStartIndex = pSyncNode->pLogStore->syncLogBeginIndex(pSyncNode->pLogStore);
- SyncIndex logEndIndex = pSyncNode->pLogStore->syncLogEndIndex(pSyncNode->pLogStore);
- if (nextIndex < logStartIndex || nextIndex - 1 > logEndIndex) {
- sNTrace(pSyncNode, "maybe start snapshot for next-index:%" PRId64 ", start:%" PRId64 ", end:%" PRId64, nextIndex,
- logStartIndex, logEndIndex);
- // start snapshot
- int32_t code = syncNodeStartSnapshot(pSyncNode, pDestId);
- }
- }
-
- // pre index, pre term
- SyncIndex preLogIndex = syncNodeGetPreIndex(pSyncNode, nextIndex);
- SyncTerm preLogTerm = syncNodeGetPreTerm(pSyncNode, nextIndex);
-
- // prepare entry
- SRpcMsg rpcMsg = {0};
- SyncAppendEntries* pMsg = NULL;
-
- SSyncRaftEntry* pEntry = NULL;
- SLRUCache* pCache = pSyncNode->pLogStore->pCache;
- LRUHandle* h = taosLRUCacheLookup(pCache, &nextIndex, sizeof(nextIndex));
- int32_t code = 0;
- if (h) {
- pEntry = (SSyncRaftEntry*)taosLRUCacheValue(pCache, h);
- code = 0;
-
- pSyncNode->pLogStore->cacheHit++;
- sNTrace(pSyncNode, "hit cache index:%" PRId64 ", bytes:%u, %p", nextIndex, pEntry->bytes, pEntry);
-
- } else {
- pSyncNode->pLogStore->cacheMiss++;
- sNTrace(pSyncNode, "miss cache index:%" PRId64, nextIndex);
-
- code = pSyncNode->pLogStore->syncLogGetEntry(pSyncNode->pLogStore, nextIndex, &pEntry);
- }
-
- if (code == 0) {
- ASSERT(pEntry != NULL);
-
- code = syncBuildAppendEntries(&rpcMsg, (int32_t)(pEntry->bytes), pSyncNode->vgId);
- ASSERT(code == 0);
-
- pMsg = rpcMsg.pCont;
- memcpy(pMsg->data, pEntry, pEntry->bytes);
- } else {
- if (terrno == TSDB_CODE_WAL_LOG_NOT_EXIST) {
- // no entry in log
- code = syncBuildAppendEntries(&rpcMsg, 0, pSyncNode->vgId);
- ASSERT(code == 0);
-
- pMsg = rpcMsg.pCont;
- } else {
- sNError(pSyncNode, "replicate to dnode:%d error, next-index:%" PRId64, DID(pDestId), nextIndex);
- return -1;
- }
- }
-
- if (h) {
- taosLRUCacheRelease(pCache, h, false);
- } else {
- syncEntryDestroy(pEntry);
- }
-
- // prepare msg
- ASSERT(pMsg != NULL);
- pMsg->srcId = pSyncNode->myRaftId;
- pMsg->destId = *pDestId;
- pMsg->term = pSyncNode->raftStore.currentTerm;
- pMsg->prevLogIndex = preLogIndex;
- pMsg->prevLogTerm = preLogTerm;
- pMsg->commitIndex = pSyncNode->commitIndex;
- pMsg->privateTerm = 0;
- // pMsg->privateTerm = syncIndexMgrGetTerm(pSyncNode->pNextIndex, pDestId);
-
- // send msg
- syncNodeMaybeSendAppendEntries(pSyncNode, pDestId, &rpcMsg);
- return 0;
-}
-
int32_t syncNodeReplicate(SSyncNode* pNode) {
SSyncLogBuffer* pBuf = pNode->pLogBuf;
taosThreadMutexLock(&pBuf->mutex);
@@ -156,25 +70,6 @@ int32_t syncNodeReplicateWithoutLock(SSyncNode* pNode) {
return 0;
}
-int32_t syncNodeReplicateOld(SSyncNode* pSyncNode) {
- if (pSyncNode->state != TAOS_SYNC_STATE_LEADER) {
- return -1;
- }
-
- sNTrace(pSyncNode, "do replicate");
-
- int32_t ret = 0;
- for (int i = 0; i < pSyncNode->peersNum; ++i) {
- SRaftId* pDestId = &(pSyncNode->peersId[i]);
- ret = syncNodeReplicateOne(pSyncNode, pDestId, true);
- if (ret != 0) {
- sError("vgId:%d, do append entries error for dnode:%d", pSyncNode->vgId, DID(pDestId));
- }
- }
-
- return 0;
-}
-
int32_t syncNodeSendAppendEntries(SSyncNode* pSyncNode, const SRaftId* destRaftId, SRpcMsg* pRpcMsg) {
SyncAppendEntries* pMsg = pRpcMsg->pCont;
pMsg->destId = *destRaftId;
@@ -182,39 +77,6 @@ int32_t syncNodeSendAppendEntries(SSyncNode* pSyncNode, const SRaftId* destRaftI
return 0;
}
-int32_t syncNodeSendAppendEntriesOld(SSyncNode* pSyncNode, const SRaftId* destRaftId, SRpcMsg* pRpcMsg) {
- int32_t ret = 0;
- SyncAppendEntries* pMsg = pRpcMsg->pCont;
- if (pMsg == NULL) {
- sError("vgId:%d, sync-append-entries msg is NULL", pSyncNode->vgId);
- return 0;
- }
-
- SPeerState* pState = syncNodeGetPeerState(pSyncNode, destRaftId);
- if (pState == NULL) {
- sError("vgId:%d, replica maybe dropped", pSyncNode->vgId);
- return 0;
- }
-
- // save index, otherwise pMsg will be free by rpc
- SyncIndex saveLastSendIndex = pState->lastSendIndex;
- bool update = false;
- if (pMsg->dataLen > 0) {
- saveLastSendIndex = pMsg->prevLogIndex + 1;
- update = true;
- }
-
- syncLogSendAppendEntries(pSyncNode, pMsg, "");
- syncNodeSendMsgById(destRaftId, pSyncNode, pRpcMsg);
-
- if (update) {
- pState->lastSendIndex = saveLastSendIndex;
- pState->lastSendTime = taosGetTimestampMs();
- }
-
- return ret;
-}
-
int32_t syncNodeMaybeSendAppendEntries(SSyncNode* pSyncNode, const SRaftId* destRaftId, SRpcMsg* pRpcMsg) {
int32_t ret = 0;
SyncAppendEntries* pMsg = pRpcMsg->pCont;
diff --git a/source/libs/sync/src/syncSnapshot.c b/source/libs/sync/src/syncSnapshot.c
index 880c76e4dd..e61bcc9ffc 100644
--- a/source/libs/sync/src/syncSnapshot.c
+++ b/source/libs/sync/src/syncSnapshot.c
@@ -112,7 +112,7 @@ int32_t snapshotSenderStart(SSyncSnapshotSender *pSender) {
pMsg->lastConfigIndex = pSender->snapshot.lastConfigIndex;
pMsg->lastConfig = pSender->lastConfig;
pMsg->startTime = pSender->startTime;
- pMsg->seq = SYNC_SNAPSHOT_SEQ_PRE_SNAPSHOT;
+ pMsg->seq = SYNC_SNAPSHOT_SEQ_PREP_SNAPSHOT;
// event log
syncLogSendSyncSnapshotSend(pSender->pSyncNode, pMsg, "snapshot sender start");
@@ -379,7 +379,7 @@ void snapshotReceiverStart(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *p
}
pReceiver->start = true;
- pReceiver->ack = SYNC_SNAPSHOT_SEQ_PRE_SNAPSHOT;
+ pReceiver->ack = SYNC_SNAPSHOT_SEQ_PREP_SNAPSHOT;
pReceiver->term = pReceiver->pSyncNode->raftStore.currentTerm;
pReceiver->fromId = pPreMsg->srcId;
pReceiver->startTime = pPreMsg->startTime;
@@ -527,7 +527,7 @@ SyncIndex syncNodeGetSnapBeginIndex(SSyncNode *ths) {
return snapStart;
}
-static int32_t syncNodeOnSnapshotPre(SSyncNode *pSyncNode, SyncSnapshotSend *pMsg) {
+static int32_t syncNodeOnSnapshotPrep(SSyncNode *pSyncNode, SyncSnapshotSend *pMsg) {
SSyncSnapshotReceiver *pReceiver = pSyncNode->pNewNodeReceiver;
int64_t timeNow = taosGetTimestampMs();
int32_t code = 0;
@@ -565,7 +565,7 @@ _START_RECEIVER:
} else {
// waiting for clock match
while (timeNow < pMsg->startTime) {
- sRInfo(pReceiver, "snapshot receiver pre waitting for true time, now:%" PRId64 ", stime:%" PRId64, timeNow,
+ sRInfo(pReceiver, "snapshot receiver pre waitting for true time, now:%" PRId64 ", startTime:%" PRId64, timeNow,
pMsg->startTime);
taosMsleep(10);
timeNow = taosGetTimestampMs();
@@ -765,7 +765,7 @@ static int32_t syncNodeOnSnapshotEnd(SSyncNode *pSyncNode, SyncSnapshotSend *pMs
// receiver on message
//
-// condition 1, recv SYNC_SNAPSHOT_SEQ_PRE_SNAPSHOT
+// condition 1, recv SYNC_SNAPSHOT_SEQ_PREP_SNAPSHOT
// if receiver already start
// if sender.start-time > receiver.start-time, restart receiver(reply snapshot start)
// if sender.start-time = receiver.start-time, maybe duplicate msg
@@ -809,9 +809,9 @@ int32_t syncNodeOnSnapshot(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) {
int32_t code = 0;
if (pSyncNode->state == TAOS_SYNC_STATE_FOLLOWER) {
if (pMsg->term == pSyncNode->raftStore.currentTerm) {
- if (pMsg->seq == SYNC_SNAPSHOT_SEQ_PRE_SNAPSHOT) {
+ if (pMsg->seq == SYNC_SNAPSHOT_SEQ_PREP_SNAPSHOT) {
syncLogRecvSyncSnapshotSend(pSyncNode, pMsg, "process seq pre-snapshot");
- code = syncNodeOnSnapshotPre(pSyncNode, pMsg);
+ code = syncNodeOnSnapshotPrep(pSyncNode, pMsg);
} else if (pMsg->seq == SYNC_SNAPSHOT_SEQ_BEGIN) {
syncLogRecvSyncSnapshotSend(pSyncNode, pMsg, "process seq begin");
code = syncNodeOnSnapshotBegin(pSyncNode, pMsg);
@@ -848,7 +848,7 @@ int32_t syncNodeOnSnapshot(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) {
return code;
}
-static int32_t syncNodeOnSnapshotPreRsp(SSyncNode *pSyncNode, SSyncSnapshotSender *pSender, SyncSnapshotRsp *pMsg) {
+static int32_t syncNodeOnSnapshotPrepRsp(SSyncNode *pSyncNode, SSyncSnapshotSender *pSender, SyncSnapshotRsp *pMsg) {
SSnapshot snapshot = {0};
pSyncNode->pFsm->FpGetSnapshotInfo(pSyncNode->pFsm, &snapshot);
@@ -945,8 +945,8 @@ int32_t syncNodeOnSnapshotRsp(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) {
if (pMsg->startTime != pSender->startTime) {
syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "snapshot sender and receiver time not match");
- sSError(pSender, "sender:%" PRId64 " receiver:%" PRId64 " time not match, code:0x%x", pMsg->startTime,
- pSender->startTime, pMsg->code);
+ sSError(pSender, "sender:%" PRId64 " receiver:%" PRId64 " time not match, error:%s 0x%x", pMsg->startTime,
+ pSender->startTime, tstrerror(pMsg->code), pMsg->code);
terrno = TSDB_CODE_SYN_INTERNAL_ERROR;
goto _ERROR;
}
@@ -961,15 +961,15 @@ int32_t syncNodeOnSnapshotRsp(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) {
if (pMsg->code != 0) {
syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "receive error code");
- sSError(pSender, "snapshot sender receive error code:0x%x and stop sender", pMsg->code);
+ sSError(pSender, "snapshot sender receive error:%s 0x%x and stop sender", tstrerror(pMsg->code), pMsg->code);
terrno = pMsg->code;
goto _ERROR;
}
// prepare , send begin msg
- if (pMsg->ack == SYNC_SNAPSHOT_SEQ_PRE_SNAPSHOT) {
+ if (pMsg->ack == SYNC_SNAPSHOT_SEQ_PREP_SNAPSHOT) {
syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "process seq pre-snapshot");
- return syncNodeOnSnapshotPreRsp(pSyncNode, pSender, pMsg);
+ return syncNodeOnSnapshotPrepRsp(pSyncNode, pSender, pMsg);
}
if (pSender->pReader == NULL || pSender->finish) {
diff --git a/source/libs/sync/src/syncUtil.c b/source/libs/sync/src/syncUtil.c
index b246d9a79d..6a50572cba 100644
--- a/source/libs/sync/src/syncUtil.c
+++ b/source/libs/sync/src/syncUtil.c
@@ -141,20 +141,15 @@ static void syncLogReplMgrStates2Str(SSyncNode* pSyncNode, char* buf, int32_t bu
}
static void syncPeerState2Str(SSyncNode* pSyncNode, char* buf, int32_t bufLen) {
- int32_t len = 1;
-
+ int32_t len = 0;
+ len += snprintf(buf + len, bufLen - len, "%s", "{");
for (int32_t i = 0; i < pSyncNode->replicaNum; ++i) {
SPeerState* pState = syncNodeGetPeerState(pSyncNode, &(pSyncNode->replicasId[i]));
if (pState == NULL) break;
-
- if (i < pSyncNode->replicaNum - 1) {
- len += snprintf(buf + len, bufLen - len, "%d:%" PRId64 " %" PRId64 ", ", i, pState->lastSendIndex,
- pState->lastSendTime);
- } else {
- len += snprintf(buf + len, bufLen - len, "%d:%" PRId64 " %" PRId64 "}", i, pState->lastSendIndex,
- pState->lastSendTime);
- }
+ len += snprintf(buf + len, bufLen - len, "%d:%" PRId64 " %" PRId64 "%s", i, pState->lastSendIndex,
+ pState->lastSendTime, (i < pSyncNode->replicaNum - 1) ? ", " : "");
}
+ len += snprintf(buf + len, bufLen - len, "%s", "}");
}
void syncPrintNodeLog(const char* flags, ELogLevel level, int32_t dflag, SSyncNode* pNode, const char* format, ...) {
@@ -245,7 +240,7 @@ void syncPrintSnapshotSenderLog(const char* flags, ELogLevel level, int32_t dfla
char cfgStr[1024] = "";
syncCfg2SimpleStr(&pNode->raftCfg.cfg, cfgStr, sizeof(cfgStr));
- char peerStr[1024] = "{";
+ char peerStr[1024] = "";
syncPeerState2Str(pNode, peerStr, sizeof(peerStr));
char eventLog[512]; // {0};
@@ -255,20 +250,21 @@ void syncPrintSnapshotSenderLog(const char* flags, ELogLevel level, int32_t dfla
va_end(argpointer);
taosPrintLog(flags, level, dflag,
- "vgId:%d, %s, sync:%s, {%p s-param:%" PRId64 " e-param:%" PRId64 " laindex:%" PRId64 " laterm:%" PRIu64
- " lcindex:%" PRId64
- " seq:%d ack:%d finish:%d replica-index:%d dnode:%d}"
- ", tm:%" PRIu64 ", cmt:%" PRId64 ", fst:%" PRId64 ", lst:%" PRId64 ", min:%" PRId64 ", snap:%" PRId64
- ", snap-tm:%" PRIu64 ", sby:%d, stgy:%d, bch:%d, r-num:%d, lcfg:%" PRId64
- ", chging:%d, rsto:%d, dquorum:%d, elt:%" PRId64 ", hb:%" PRId64 ", %s, %s",
+ "vgId:%d, %s, sync:%s, snap-sender:{%p start:%" PRId64 " end:%" PRId64 " last-index:%" PRId64
+ " last-term:%" PRIu64 " last-cfg:%" PRId64
+ ", seq:%d ack:%d finish:%d, as:%d dnode:%d}"
+ ", term:%" PRIu64 ", commit-index:%" PRId64 ", firstver:%" PRId64 ", lastver:%" PRId64
+ ", min-match:%" PRId64 ", snap:{last-index:%" PRId64 ", term:%" PRIu64
+ "}, standby:%d, batch-sz:%d, replicas:%d, last-cfg:%" PRId64
+ ", chging:%d, restore:%d, quorum:%d, lc-timer:{elect:%" PRId64 ", hb:%" PRId64 "}, peer:%s, cfg:%s",
pNode->vgId, eventLog, syncStr(pNode->state), pSender, pSender->snapshotParam.start,
pSender->snapshotParam.end, pSender->snapshot.lastApplyIndex, pSender->snapshot.lastApplyTerm,
pSender->snapshot.lastConfigIndex, pSender->seq, pSender->ack, pSender->finish, pSender->replicaIndex,
DID(&pNode->replicasId[pSender->replicaIndex]), pNode->raftStore.currentTerm, pNode->commitIndex,
logBeginIndex, logLastIndex, pNode->minMatchIndex, snapshot.lastApplyIndex, snapshot.lastApplyTerm,
- pNode->raftCfg.isStandBy, pNode->raftCfg.snapshotStrategy, pNode->raftCfg.batchSize, pNode->replicaNum,
- pNode->raftCfg.lastConfigIndex, pNode->changing, pNode->restoreFinish, syncNodeDynamicQuorum(pNode),
- pNode->electTimerLogicClock, pNode->heartbeatTimerLogicClockUser, peerStr, cfgStr);
+ pNode->raftCfg.isStandBy, pNode->raftCfg.batchSize, pNode->replicaNum, pNode->raftCfg.lastConfigIndex,
+ pNode->changing, pNode->restoreFinish, syncNodeDynamicQuorum(pNode), pNode->electTimerLogicClock,
+ pNode->heartbeatTimerLogicClockUser, peerStr, cfgStr);
}
void syncPrintSnapshotReceiverLog(const char* flags, ELogLevel level, int32_t dflag, SSyncSnapshotReceiver* pReceiver,
@@ -291,7 +287,7 @@ void syncPrintSnapshotReceiverLog(const char* flags, ELogLevel level, int32_t df
char cfgStr[1024] = "";
syncCfg2SimpleStr(&pNode->raftCfg.cfg, cfgStr, sizeof(cfgStr));
- char peerStr[1024] = "{";
+ char peerStr[1024] = "";
syncPeerState2Str(pNode, peerStr, sizeof(peerStr));
char eventLog[512]; // {0};
@@ -300,22 +296,22 @@ void syncPrintSnapshotReceiverLog(const char* flags, ELogLevel level, int32_t df
int32_t writeLen = vsnprintf(eventLog, sizeof(eventLog), format, argpointer);
va_end(argpointer);
- taosPrintLog(flags, level, dflag,
- "vgId:%d, %s, sync:%s,"
- " {%p start:%d ack:%d term:%" PRIu64 " start-time:%" PRId64 " from dnode:%d s-param:%" PRId64
- " e-param:%" PRId64 " laindex:%" PRId64 " laterm:%" PRIu64 " lcindex:%" PRId64
- "}"
- ", tm:%" PRIu64 ", cmt:%" PRId64 ", fst:%" PRId64 ", lst:%" PRId64 ", min:%" PRId64 ", snap:%" PRId64
- ", snap-tm:%" PRIu64 ", sby:%d, stgy:%d, bch:%d, r-num:%d, lcfg:%" PRId64
- ", chging:%d, rsto:%d, dquorum:%d, elt:%" PRId64 ", hb:%" PRId64 ", %s, %s",
- pNode->vgId, eventLog, syncStr(pNode->state), pReceiver, pReceiver->start, pReceiver->ack,
- pReceiver->term, pReceiver->startTime, DID(&pReceiver->fromId), pReceiver->snapshotParam.start,
- pReceiver->snapshotParam.end, pReceiver->snapshot.lastApplyIndex, pReceiver->snapshot.lastApplyTerm,
- pReceiver->snapshot.lastConfigIndex, pNode->raftStore.currentTerm, pNode->commitIndex, logBeginIndex,
- logLastIndex, pNode->minMatchIndex, snapshot.lastApplyIndex, snapshot.lastApplyTerm,
- pNode->raftCfg.isStandBy, pNode->raftCfg.snapshotStrategy, pNode->raftCfg.batchSize, pNode->replicaNum,
- pNode->raftCfg.lastConfigIndex, pNode->changing, pNode->restoreFinish, syncNodeDynamicQuorum(pNode),
- pNode->electTimerLogicClock, pNode->heartbeatTimerLogicClockUser, peerStr, cfgStr);
+ taosPrintLog(
+ flags, level, dflag,
+ "vgId:%d, %s, sync:%s,"
+ " snap-receiver:{%p started:%d acked:%d term:%" PRIu64 " start-time:%" PRId64 " from-dnode:%d, start:%" PRId64
+ " end:%" PRId64 " last-index:%" PRId64 " last-term:%" PRIu64 " last-cfg:%" PRId64
+ "}"
+ ", term:%" PRIu64 ", commit-index:%" PRId64 ", firstver:%" PRId64 ", lastver:%" PRId64 ", min-match:%" PRId64
+ ", snap:{last-index:%" PRId64 ", last-term:%" PRIu64 "}, standby:%d, batch-sz:%d, replicas:%d, last-cfg:%" PRId64
+ ", chging:%d, restore:%d, quorum:%d, lc-timers:{elect:%" PRId64 ", hb:%" PRId64 "}, peer:%s, cfg:%s",
+ pNode->vgId, eventLog, syncStr(pNode->state), pReceiver, pReceiver->start, pReceiver->ack, pReceiver->term,
+ pReceiver->startTime, DID(&pReceiver->fromId), pReceiver->snapshotParam.start, pReceiver->snapshotParam.end,
+ pReceiver->snapshot.lastApplyIndex, pReceiver->snapshot.lastApplyTerm, pReceiver->snapshot.lastConfigIndex,
+ pNode->raftStore.currentTerm, pNode->commitIndex, logBeginIndex, logLastIndex, pNode->minMatchIndex,
+ snapshot.lastApplyIndex, snapshot.lastApplyTerm, pNode->raftCfg.isStandBy, pNode->raftCfg.batchSize,
+ pNode->replicaNum, pNode->raftCfg.lastConfigIndex, pNode->changing, pNode->restoreFinish,
+ syncNodeDynamicQuorum(pNode), pNode->electTimerLogicClock, pNode->heartbeatTimerLogicClockUser, peerStr, cfgStr);
}
void syncLogRecvTimer(SSyncNode* pSyncNode, const SyncTimeout* pMsg, const char* s) {
@@ -351,13 +347,13 @@ void syncLogSendHeartbeat(SSyncNode* pSyncNode, const SyncHeartbeat* pMsg, bool
int64_t execTime) {
if (printX) {
sNTrace(pSyncNode,
- "send sync-heartbeat to dnode:%d {term:%" PRId64 ", cmt:%" PRId64 ", min-match:%" PRId64 ", ts:%" PRId64
- "}, x",
+ "send sync-heartbeat to dnode:%d {term:%" PRId64 ", commit-index:%" PRId64 ", min-match:%" PRId64
+ ", ts:%" PRId64 "}, x",
DID(&pMsg->destId), pMsg->term, pMsg->commitIndex, pMsg->minMatchIndex, pMsg->timeStamp);
} else {
sNTrace(pSyncNode,
- "send sync-heartbeat to dnode:%d {term:%" PRId64 ", cmt:%" PRId64 ", min-match:%" PRId64 ", ts:%" PRId64
- "}, timer-elapsed:%" PRId64 ", next-exec:%" PRId64,
+ "send sync-heartbeat to dnode:%d {term:%" PRId64 ", commit-index:%" PRId64 ", min-match:%" PRId64
+ ", ts:%" PRId64 "}, timer-elapsed:%" PRId64 ", next-exec:%" PRId64,
DID(&pMsg->destId), pMsg->term, pMsg->commitIndex, pMsg->minMatchIndex, pMsg->timeStamp, timerElapsed,
execTime);
}
@@ -368,14 +364,14 @@ void syncLogRecvHeartbeat(SSyncNode* pSyncNode, const SyncHeartbeat* pMsg, int64
pSyncNode->hbSlowNum++;
sNInfo(pSyncNode,
- "recv sync-heartbeat from dnode:%d slow {term:%" PRId64 ", cmt:%" PRId64 ", min-match:%" PRId64
+ "recv sync-heartbeat from dnode:%d slow {term:%" PRId64 ", commit-index:%" PRId64 ", min-match:%" PRId64
", ts:%" PRId64 "}, %s, net elapsed:%" PRId64,
DID(&pMsg->srcId), pMsg->term, pMsg->commitIndex, pMsg->minMatchIndex, pMsg->timeStamp, s, timeDiff);
}
sNTrace(pSyncNode,
- "recv sync-heartbeat from dnode:%d {term:%" PRId64 ", cmt:%" PRId64 ", min-match:%" PRId64 ", ts:%" PRId64
- "}, %s, net elapsed:%" PRId64,
+ "recv sync-heartbeat from dnode:%d {term:%" PRId64 ", commit-index:%" PRId64 ", min-match:%" PRId64
+ ", ts:%" PRId64 "}, %s, net elapsed:%" PRId64,
DID(&pMsg->srcId), pMsg->term, pMsg->commitIndex, pMsg->minMatchIndex, pMsg->timeStamp, s, timeDiff);
}
@@ -400,67 +396,64 @@ void syncLogRecvHeartbeatReply(SSyncNode* pSyncNode, const SyncHeartbeatReply* p
void syncLogSendSyncSnapshotSend(SSyncNode* pSyncNode, const SyncSnapshotSend* pMsg, const char* s) {
sNDebug(pSyncNode,
- "send sync-snapshot-send to dnode:%d, %s, seq:%d, term:%" PRId64 ", begin:%" PRId64 ", end:%" PRId64
- ", lterm:%" PRId64 ", stime:%" PRId64,
+ "send sync-snapshot-send to dnode:%d, %s, seq:%d, term:%" PRId64 ", begin-index:%" PRId64
+ ", last-index:%" PRId64 ", last-term:%" PRId64 ", start-time:%" PRId64,
DID(&pMsg->destId), s, pMsg->seq, pMsg->term, pMsg->beginIndex, pMsg->lastIndex, pMsg->lastTerm,
pMsg->startTime);
}
void syncLogRecvSyncSnapshotSend(SSyncNode* pSyncNode, const SyncSnapshotSend* pMsg, const char* s) {
sNDebug(pSyncNode,
- "recv sync-snapshot-send from dnode:%d, %s, seq:%d, term:%" PRId64 ", begin:%" PRId64 ", lst:%" PRId64
- ", lterm:%" PRId64 ", stime:%" PRId64 ", len:%u",
+ "recv sync-snapshot-send from dnode:%d, %s, seq:%d, term:%" PRId64 ", begin-index:%" PRId64
+ ", last-index:%" PRId64 ", last-term:%" PRId64 ", start-time:%" PRId64 ", data-len:%u",
DID(&pMsg->srcId), s, pMsg->seq, pMsg->term, pMsg->beginIndex, pMsg->lastIndex, pMsg->lastTerm,
pMsg->startTime, pMsg->dataLen);
}
void syncLogSendSyncSnapshotRsp(SSyncNode* pSyncNode, const SyncSnapshotRsp* pMsg, const char* s) {
sNDebug(pSyncNode,
- "send sync-snapshot-rsp to dnode:%d, %s, ack:%d, term:%" PRId64 ", begin:%" PRId64 ", lst:%" PRId64
- ", lterm:%" PRId64 ", stime:%" PRId64,
+ "send sync-snapshot-rsp to dnode:%d, %s, acked:%d, term:%" PRId64 ", begin-index:%" PRId64
+ ", last-index:%" PRId64 ", last-term:%" PRId64 ", start-time:%" PRId64,
DID(&pMsg->destId), s, pMsg->ack, pMsg->term, pMsg->snapBeginIndex, pMsg->lastIndex, pMsg->lastTerm,
pMsg->startTime);
}
void syncLogRecvSyncSnapshotRsp(SSyncNode* pSyncNode, const SyncSnapshotRsp* pMsg, const char* s) {
sNDebug(pSyncNode,
- "recv sync-snapshot-rsp from dnode:%d, %s, ack:%d, term:%" PRId64 ", begin:%" PRId64 ", lst:%" PRId64
- ", lterm:%" PRId64 ", stime:%" PRId64,
+ "recv sync-snapshot-rsp from dnode:%d, %s, ack:%d, term:%" PRId64 ", begin-index:%" PRId64
+ ", last-index:%" PRId64 ", last-term:%" PRId64 ", start-time:%" PRId64,
DID(&pMsg->srcId), s, pMsg->ack, pMsg->term, pMsg->snapBeginIndex, pMsg->lastIndex, pMsg->lastTerm,
pMsg->startTime);
}
void syncLogRecvAppendEntries(SSyncNode* pSyncNode, const SyncAppendEntries* pMsg, const char* s) {
sNTrace(pSyncNode,
- "recv sync-append-entries from dnode:%d {term:%" PRId64 ", pre-index:%" PRId64 ", pre-term:%" PRId64
- ", cmt:%" PRId64 ", pterm:%" PRId64 ", datalen:%d}, %s",
- DID(&pMsg->srcId), pMsg->term, pMsg->prevLogIndex, pMsg->prevLogTerm, pMsg->commitIndex, pMsg->privateTerm,
- pMsg->dataLen, s);
+ "recv sync-append-entries from dnode:%d {term:%" PRId64 ", prev-log:{index:%" PRId64 ", term:%" PRId64
+ "}, commit-index:%" PRId64 ", datalen:%d}, %s",
+ DID(&pMsg->srcId), pMsg->term, pMsg->prevLogIndex, pMsg->prevLogTerm, pMsg->commitIndex, pMsg->dataLen, s);
}
void syncLogSendAppendEntries(SSyncNode* pSyncNode, const SyncAppendEntries* pMsg, const char* s) {
sNTrace(pSyncNode,
- "send sync-append-entries to dnode:%d, {term:%" PRId64 ", pre-index:%" PRId64 ", pre-term:%" PRId64
- ", lsend-index:%" PRId64 ", cmt:%" PRId64 ", datalen:%d}, %s",
+ "send sync-append-entries to dnode:%d, {term:%" PRId64 ", prev-log:{index:%" PRId64 ", term:%" PRId64
+ "}, index:%" PRId64 ", commit-index:%" PRId64 ", datalen:%d}, %s",
DID(&pMsg->destId), pMsg->term, pMsg->prevLogIndex, pMsg->prevLogTerm, (pMsg->prevLogIndex + 1),
pMsg->commitIndex, pMsg->dataLen, s);
}
-void syncLogRecvRequestVote(SSyncNode* pSyncNode, const SyncRequestVote* pMsg, int32_t voteGranted, const char* s) {
- if (voteGranted == -1) {
- sNInfo(pSyncNode,
- "recv sync-request-vote from dnode:%d, {term:%" PRId64 ", lindex:%" PRId64 ", lterm:%" PRId64 "}, %s",
- DID(&pMsg->srcId), pMsg->term, pMsg->lastLogIndex, pMsg->lastLogTerm, s);
- } else {
- sNInfo(pSyncNode,
- "recv sync-request-vote from dnode:%d, {term:%" PRId64 ", lindex:%" PRId64 ", lterm:%" PRId64
- "}, granted:%d",
- DID(&pMsg->srcId), pMsg->term, pMsg->lastLogIndex, pMsg->lastLogTerm, voteGranted);
- }
+void syncLogRecvRequestVote(SSyncNode* pSyncNode, const SyncRequestVote* pMsg, int32_t voteGranted,
+ const char* errmsg) {
+ char statusMsg[64];
+ snprintf(statusMsg, sizeof(statusMsg), "granted:%d", voteGranted);
+ sNInfo(pSyncNode,
+ "recv sync-request-vote from dnode:%d, {term:%" PRId64 ", last-index:%" PRId64 ", last-term:%" PRId64 "}, %s",
+ DID(&pMsg->srcId), pMsg->term, pMsg->lastLogIndex, pMsg->lastLogTerm,
+ (voteGranted != -1) ? statusMsg : errmsg);
}
void syncLogSendRequestVote(SSyncNode* pNode, const SyncRequestVote* pMsg, const char* s) {
- sNInfo(pNode, "send sync-request-vote to dnode:%d {term:%" PRId64 ", lindex:%" PRId64 ", lterm:%" PRId64 "}, %s",
+ sNInfo(pNode,
+ "send sync-request-vote to dnode:%d {term:%" PRId64 ", last-index:%" PRId64 ", last-term:%" PRId64 "}, %s",
DID(&pMsg->destId), pMsg->term, pMsg->lastLogIndex, pMsg->lastLogTerm, s);
}
diff --git a/source/libs/tdb/src/db/tdbPager.c b/source/libs/tdb/src/db/tdbPager.c
index ced867e938..29b7fa740c 100644
--- a/source/libs/tdb/src/db/tdbPager.c
+++ b/source/libs/tdb/src/db/tdbPager.c
@@ -445,6 +445,11 @@ int tdbPagerAbort(SPager *pPager, TXN *pTxn) {
SPgno journalSize = 0;
int ret;
+ if (pTxn->jfd == 0) {
+ // txn is commited
+ return 0;
+ }
+
// sync the journal file
ret = tdbOsFSync(pTxn->jfd);
if (ret < 0) {
diff --git a/source/libs/tfs/src/tfs.c b/source/libs/tfs/src/tfs.c
index 9a71fc7f30..d73b65c3b5 100644
--- a/source/libs/tfs/src/tfs.c
+++ b/source/libs/tfs/src/tfs.c
@@ -303,7 +303,7 @@ int32_t tfsRmdir(STfs *pTfs, const char *rname) {
return 0;
}
-int32_t tfsRename(STfs *pTfs, char *orname, char *nrname) {
+int32_t tfsRename(STfs *pTfs, const char *orname, const char *nrname) {
char oaname[TMPNAME_LEN] = "\0";
char naname[TMPNAME_LEN] = "\0";
diff --git a/source/libs/wal/src/walMeta.c b/source/libs/wal/src/walMeta.c
index 4a0570bee3..07109883db 100644
--- a/source/libs/wal/src/walMeta.c
+++ b/source/libs/wal/src/walMeta.c
@@ -322,6 +322,35 @@ bool walLogEntriesComplete(const SWal* pWal) {
return complete;
}
+int walTrimIdxFile(SWal* pWal, int32_t fileIdx) {
+ SWalFileInfo* pFileInfo = taosArrayGet(pWal->fileInfoSet, fileIdx);
+ ASSERT(pFileInfo != NULL);
+ char fnameStr[WAL_FILE_LEN];
+ walBuildIdxName(pWal, pFileInfo->firstVer, fnameStr);
+
+ int64_t fileSize = 0;
+ taosStatFile(fnameStr, &fileSize, NULL);
+ int64_t records = TMAX(0, pFileInfo->lastVer - pFileInfo->firstVer + 1);
+ int64_t lastEndOffset = records * sizeof(SWalIdxEntry);
+
+ if (fileSize <= lastEndOffset) {
+ return 0;
+ }
+
+ TdFilePtr pFile = taosOpenFile(fnameStr, TD_FILE_READ | TD_FILE_WRITE);
+ if (pFile == NULL) {
+ terrno = TAOS_SYSTEM_ERROR(errno);
+ return -1;
+ }
+
+ wInfo("vgId:%d, trim idx file. file: %s, size: %" PRId64 ", offset: %" PRId64, pWal->cfg.vgId, fnameStr, fileSize,
+ lastEndOffset);
+
+ taosFtruncateFile(pFile, lastEndOffset);
+ taosCloseFile(&pFile);
+ return 0;
+}
+
int walCheckAndRepairMeta(SWal* pWal) {
// load log files, get first/snapshot/last version info
const char* logPattern = "^[0-9]+.log$";
@@ -396,6 +425,8 @@ int walCheckAndRepairMeta(SWal* pWal) {
}
updateMeta = true;
+ (void)walTrimIdxFile(pWal, fileIdx);
+
int64_t lastVer = walScanLogGetLastVer(pWal, fileIdx);
if (lastVer < 0) {
if (terrno != TSDB_CODE_WAL_LOG_NOT_EXIST) {
@@ -558,6 +589,7 @@ int walCheckAndRepairIdxFile(SWal* pWal, int32_t fileIdx) {
goto _err;
}
+ int64_t count = 0;
while (idxEntry.ver < pFileInfo->lastVer) {
/*A(idxEntry.ver == ckHead.head.version);*/
@@ -569,11 +601,11 @@ int walCheckAndRepairIdxFile(SWal* pWal, int32_t fileIdx) {
idxEntry.offset, fLogNameStr);
goto _err;
}
- wWarn("vgId:%d, wal idx append new entry %" PRId64 " %" PRId64, pWal->cfg.vgId, idxEntry.ver, idxEntry.offset);
if (taosWriteFile(pIdxFile, &idxEntry, sizeof(SWalIdxEntry)) < 0) {
wError("vgId:%d, failed to append file since %s. file:%s", pWal->cfg.vgId, terrstr(), fnameStr);
goto _err;
}
+ count++;
}
if (taosFsyncFile(pIdxFile) < 0) {
@@ -581,6 +613,11 @@ int walCheckAndRepairIdxFile(SWal* pWal, int32_t fileIdx) {
goto _err;
}
+ if (count > 0) {
+ wInfo("vgId:%d, rebuilt %" PRId64 " wal idx entries until lastVer: %" PRId64, pWal->cfg.vgId, count,
+ pFileInfo->lastVer);
+ }
+
(void)taosCloseFile(&pLogFile);
(void)taosCloseFile(&pIdxFile);
return 0;
diff --git a/source/libs/wal/src/walRef.c b/source/libs/wal/src/walRef.c
index fa04ba3e58..d3c03c335b 100644
--- a/source/libs/wal/src/walRef.c
+++ b/source/libs/wal/src/walRef.c
@@ -77,6 +77,31 @@ void walUnrefVer(SWalRef *pRef) {
}
#endif
+SWalRef *walRefFirstVer(SWal *pWal, SWalRef *pRef) {
+ if (pRef == NULL) {
+ pRef = walOpenRef(pWal);
+ if (pRef == NULL) {
+ return NULL;
+ }
+ }
+ taosThreadMutexLock(&pWal->mutex);
+
+ int64_t ver = walGetFirstVer(pWal);
+
+ wDebug("vgId:%d, wal ref version %" PRId64 " for first", 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;
+}
+
SWalRef *walRefCommittedVer(SWal *pWal) {
SWalRef *pRef = walOpenRef(pWal);
if (pRef == NULL) {
@@ -87,6 +112,8 @@ SWalRef *walRefCommittedVer(SWal *pWal) {
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;
diff --git a/source/os/CMakeLists.txt b/source/os/CMakeLists.txt
index 3aac5e9775..2a4fcbcf76 100644
--- a/source/os/CMakeLists.txt
+++ b/source/os/CMakeLists.txt
@@ -41,7 +41,7 @@ target_link_libraries(
)
if(TD_WINDOWS)
target_link_libraries(
- os PUBLIC ws2_32 iconv msvcregex wcwidth winmm crashdump dbghelp
+ os PUBLIC ws2_32 iconv msvcregex wcwidth winmm crashdump dbghelp version
)
elseif(TD_DARWIN_64)
find_library(CORE_FOUNDATION_FRAMEWORK CoreFoundation)
diff --git a/source/os/src/osMath.c b/source/os/src/osMath.c
index 8f49a3d917..3b42c141df 100644
--- a/source/os/src/osMath.c
+++ b/source/os/src/osMath.c
@@ -15,8 +15,8 @@
#define ALLOW_FORBID_FUNC
#define _DEFAULT_SOURCE
-#include "os.h"
#include
+#include "os.h"
#ifdef WINDOWS
void swapStr(char* j, char* J, int width) {
diff --git a/source/os/src/osSysinfo.c b/source/os/src/osSysinfo.c
index 9ba8468438..b5c6edc829 100644
--- a/source/os/src/osSysinfo.c
+++ b/source/os/src/osSysinfo.c
@@ -280,11 +280,46 @@ int32_t taosGetEmail(char *email, int32_t maxLen) {
#endif
}
+#ifdef WINDOWS
+bool getWinVersionReleaseName(char *releaseName, int32_t maxLen) {
+ TCHAR szFileName[MAX_PATH];
+ DWORD dwHandle;
+ DWORD dwLen;
+ LPVOID lpData;
+ UINT uLen;
+ VS_FIXEDFILEINFO *pFileInfo;
+ GetWindowsDirectory(szFileName, MAX_PATH);
+ wsprintf(szFileName, L"%s%s", szFileName, L"\\explorer.exe");
+ dwLen = GetFileVersionInfoSize(szFileName, &dwHandle);
+ if (dwLen == 0) {
+ return false;
+ }
+
+ lpData = malloc(dwLen);
+ if (lpData == NULL) return false;
+ if (!GetFileVersionInfo(szFileName, dwHandle, dwLen, lpData)) {
+ free(lpData);
+ return false;
+ }
+
+ if (!VerQueryValue(lpData, L"\\", (LPVOID *)&pFileInfo, &uLen)) {
+ free(lpData);
+ return false;
+ }
+
+ snprintf(releaseName, maxLen, "Windows %d.%d", HIWORD(pFileInfo->dwProductVersionMS),
+ LOWORD(pFileInfo->dwProductVersionMS));
+ free(lpData);
+ return true;
+}
+#endif
int32_t taosGetOsReleaseName(char *releaseName, int32_t maxLen) {
#ifdef WINDOWS
- snprintf(releaseName, maxLen, "Windows");
+ if (!getWinVersionReleaseName(releaseName, maxLen)) {
+ snprintf(releaseName, maxLen, "Windows");
+ }
return 0;
#elif defined(_TD_DARWIN_64)
char osversion[32];
diff --git a/source/os/test/osTests.cpp b/source/os/test/osTests.cpp
index 2e24bb0526..1d6542e78c 100644
--- a/source/os/test/osTests.cpp
+++ b/source/os/test/osTests.cpp
@@ -34,6 +34,12 @@ TEST(osTest, osSystem) {
ELogLevel level = DEBUG_FATAL;
int32_t dflag = 255; // tsLogEmbedded ? 255 : uDebugFlag
taosPrintTrace(flags, level, dflag, 0);
+
+ const int sysLen = 64;
+ char osSysName[sysLen];
+ int ret = taosGetOsReleaseName(osSysName, sysLen);
+ printf("os systeme name:%s\n", osSysName);
+ ASSERT_EQ(ret, 0);
}
void fileOperateOnFree(void *param) {
diff --git a/source/util/src/talgo.c b/source/util/src/talgo.c
index d9319485b7..e373850b3c 100644
--- a/source/util/src/talgo.c
+++ b/source/util/src/talgo.c
@@ -28,32 +28,26 @@ static void median(void *src, int64_t size, int64_t s, int64_t e, const void *pa
void *buf) {
int32_t mid = ((int32_t)(e - s) >> 1u) + (int32_t)s;
- if (comparFn(elePtrAt(src, size, mid), elePtrAt(src, size, s), param) == 1) {
+ if (comparFn(elePtrAt(src, size, mid), elePtrAt(src, size, s), param) > 0) {
doswap(elePtrAt(src, size, mid), elePtrAt(src, size, s), size, buf);
}
- if (comparFn(elePtrAt(src, size, mid), elePtrAt(src, size, e), param) == 1) {
+ if (comparFn(elePtrAt(src, size, mid), elePtrAt(src, size, e), param) > 0) {
doswap(elePtrAt(src, size, mid), elePtrAt(src, size, s), size, buf);
doswap(elePtrAt(src, size, mid), elePtrAt(src, size, e), size, buf);
- } else if (comparFn(elePtrAt(src, size, s), elePtrAt(src, size, e), param) == 1) {
+ } else if (comparFn(elePtrAt(src, size, s), elePtrAt(src, size, e), param) > 0) {
doswap(elePtrAt(src, size, s), elePtrAt(src, size, e), size, buf);
}
ASSERT(comparFn(elePtrAt(src, size, mid), elePtrAt(src, size, s), param) <= 0 &&
comparFn(elePtrAt(src, size, s), elePtrAt(src, size, e), param) <= 0);
-
-#ifdef _DEBUG_VIEW
-// tTagsPrints(src[s], pOrderDesc->pColumnModel, &pOrderDesc->orderIdx);
-// tTagsPrints(src[mid], pOrderDesc->pColumnModel, &pOrderDesc->orderIdx);
-// tTagsPrints(src[e], pOrderDesc->pColumnModel, &pOrderDesc->orderIdx);
-#endif
}
static void tInsertSort(void *src, int64_t size, int32_t s, int32_t e, const void *param, __ext_compar_fn_t comparFn,
void *buf) {
for (int32_t i = s + 1; i <= e; ++i) {
for (int32_t j = i; j > s; --j) {
- if (comparFn(elePtrAt(src, size, j), elePtrAt(src, size, j - 1), param) == -1) {
+ if (comparFn(elePtrAt(src, size, j), elePtrAt(src, size, j - 1), param) < 0) {
doswap(elePtrAt(src, size, j), elePtrAt(src, size, j - 1), size, buf);
} else {
break;
@@ -278,14 +272,4 @@ void taosheapsort(void *base, int32_t size, int32_t len, const void *parcompar,
}
taosMemoryFree(buf);
- /*
- char *buf = taosMemoryCalloc(1, size);
-
- for (i = len - 1; i > 0; i--) {
- doswap(elePtrAt(base, size, 0), elePtrAt(base, size, i));
- taosheapadjust(base, size, 0, i - 1, parcompar, compar, parswap, swap, maxroot);
- }
-
- taosMemoryFreeClear(buf);
- */
}
diff --git a/tests/ci/Dockerfile b/tests/ci/Dockerfile
new file mode 100644
index 0000000000..594bcc902d
--- /dev/null
+++ b/tests/ci/Dockerfile
@@ -0,0 +1,48 @@
+FROM python:3.8
+RUN pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
+RUN pip3 install pandas psutil fabric2 requests faker simplejson toml pexpect tzlocal distro
+RUN apt-get update
+RUN apt-get install -y psmisc sudo tree libjansson-dev libsnappy-dev liblzma-dev libz-dev zlib1g pkg-config build-essential valgrind \
+ vim libjemalloc-dev openssh-server screen sshpass net-tools dirmngr gnupg apt-transport-https ca-certificates software-properties-common r-base iputils-ping
+RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
+RUN add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/'
+RUN apt install -y r-base
+ADD go1.17.6.linux-amd64.tar.gz /usr/local/
+ADD jdk-8u144-linux-x64.tar.gz /usr/local/
+ADD apache-maven-3.8.4-bin.tar.gz /usr/local/
+RUN apt-get install wget -y \
+ && wget https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \
+ && dpkg -i packages-microsoft-prod.deb \
+ && rm packages-microsoft-prod.deb \
+ && apt-get update && apt-get install -y dotnet-sdk-5.0 && apt-get install -y dotnet-sdk-6.0
+ADD node-v12.20.0-linux-x64.tar.gz /usr/local/
+RUN sh -c "rm -f /etc/localtime;ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime;echo \"Asia/Shanghai\" >/etc/timezone"
+COPY id_rsa /root/.ssh/id_rsa
+COPY .m2 /root/.m2
+COPY .nuget /root/.nuget
+COPY .dotnet /root/.dotnet
+COPY .cargo /root/.cargo
+COPY go /root/go
+ADD cmake-3.21.5-linux-x86_64.tar.gz /usr/local/
+RUN echo " export RUSTUP_DIST_SERVER=\"https://rsproxy.cn\" " >> /root/.bashrc
+RUN echo " export RUSTUP_UPDATE_ROOT=\"https://rsproxy.cn/rustup\" " >> /root/.bashrc
+RUN curl https://sh.rustup.rs -o /tmp/rustup-init.sh
+RUN sh /tmp/rustup-init.sh -y
+ENV PATH /usr/local/go/bin:/usr/local/node-v12.20.0-linux-x64/bin:/usr/local/apache-maven-3.8.4/bin:/usr/local/jdk1.8.0_144/bin:/usr/local/cmake-3.21.5-linux-x86_64/bin:/root/.cargo/bin:$PATH
+ENV JAVA_HOME /usr/local/jdk1.8.0_144
+RUN go env -w GOPROXY=https://goproxy.cn
+RUN echo "StrictHostKeyChecking no" >>/etc/ssh/ssh_config
+RUN npm config -g set unsafe-perm
+RUN npm config -g set registry https://registry.npm.taobao.org
+COPY .npm /root/.npm
+RUN R CMD javareconf JAVA_HOME=${JAVA_HOME} JAVA=${JAVA_HOME}/bin/java JAVAC=${JAVA_HOME}/bin/javac JAVAH=${JAVA_HOME}/bin/javah JAR=${JAVA_HOME}/bin/jar
+RUN echo "install.packages(\"RJDBC\", repos=\"http://cran.us.r-project.org\")"|R --no-save
+COPY .gitconfig /root/.gitconfig
+RUN mkdir -p /run/sshd
+COPY id_rsa.pub /root/.ssh/id_rsa.pub
+COPY id_rsa.pub /root/.ssh/authorized_keys
+RUN pip3 uninstall -y taostest
+COPY repository/TDinternal /home/TDinternal
+COPY repository/taos-connector-python /home/taos-connector-python
+RUN sh -c "cd /home/taos-connector-python; pip3 install ."
+COPY setup.sh /home/setup.sh
\ No newline at end of file
diff --git a/tests/ci/build_image.sh b/tests/ci/build_image.sh
new file mode 100755
index 0000000000..1864df35db
--- /dev/null
+++ b/tests/ci/build_image.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+docker build --no-cache -t taos_test:v1.0 .
+
diff --git a/tests/ci/daily_build_image.sh b/tests/ci/daily_build_image.sh
new file mode 100755
index 0000000000..01148a3aae
--- /dev/null
+++ b/tests/ci/daily_build_image.sh
@@ -0,0 +1,60 @@
+#!/bin/bash
+
+set -x
+
+script_dir=`dirname $0`
+cd $script_dir
+script_dir=`pwd`
+cd $script_dir/repository/taos-connector-python
+git pull
+
+cd $script_dir/repository/TDinternal
+git clean -fxd
+git pull
+
+cd $script_dir/repository/TDinternal/community
+git clean -fxd
+git checkout main
+git pull origin main
+git submodule update --init --recursive
+
+cd $script_dir
+cp $script_dir/repository/TDinternal/community/tests/ci/build_image.sh .
+cp $script_dir/repository/TDinternal/community/tests/ci/daily_build_image.sh .
+
+./build_image.sh || exit 1
+docker image prune -f
+ips="\
+192.168.1.47 \
+192.168.1.48 \
+192.168.1.49 \
+192.168.1.52 \
+192.168.0.215 \
+192.168.0.217 \
+192.168.0.219 \
+"
+
+image=taos_image.tar
+
+docker save taos_test:v1.0 -o $image
+
+for ip in $ips; do
+ echo "scp $image root@$ip:/home/ &"
+ scp $image root@$ip:/home/ &
+done
+wait
+
+for ip in $ips; do
+ echo "ssh root@$ip docker load -i /home/$image &"
+ ssh root@$ip docker load -i /home/$image &
+done
+wait
+
+for ip in $ips; do
+ echo "ssh root@$ip rm -f /home/$image &"
+ ssh root@$ip rm -f /home/$image &
+done
+wait
+
+rm -rf taos_image.tar
+
diff --git a/tests/develop-test/5-taos-tools/taosbenchmark/json/sml_json_alltypes.json b/tests/develop-test/5-taos-tools/taosbenchmark/json/sml_json_alltypes.json
index 62ec0ff9bf..26a08b3fee 100644
--- a/tests/develop-test/5-taos-tools/taosbenchmark/json/sml_json_alltypes.json
+++ b/tests/develop-test/5-taos-tools/taosbenchmark/json/sml_json_alltypes.json
@@ -16,13 +16,7 @@
"databases": [{
"dbinfo": {
"name": "db",
- "drop": "yes",
- "replica": 1,
- "precision": "ms",
- "keep": 36500,
- "minRows": 100,
- "maxRows": 4096,
- "comp":2
+ "drop": "yes"
},
"super_tables": [{
"name": "stb1",
@@ -37,7 +31,7 @@
"line_protocol": "json",
"childtable_limit": 0,
"childtable_offset": 0,
- "insert_rows": 10,
+ "insert_rows": 20,
"insert_interval": 0,
"interlace_rows": 0,
"disorder_ratio": 0,
@@ -62,7 +56,7 @@
"line_protocol": "json",
"childtable_limit": 0,
"childtable_offset": 0,
- "insert_rows": 10,
+ "insert_rows": 20,
"insert_interval": 0,
"interlace_rows": 0,
"disorder_ratio": 0,
@@ -87,7 +81,7 @@
"line_protocol": "json",
"childtable_limit": 0,
"childtable_offset": 0,
- "insert_rows": 10,
+ "insert_rows": 20,
"insert_interval": 0,
"interlace_rows": 0,
"disorder_ratio": 0,
@@ -112,7 +106,7 @@
"line_protocol": "json",
"childtable_limit": 0,
"childtable_offset": 0,
- "insert_rows": 10,
+ "insert_rows": 20,
"insert_interval": 0,
"interlace_rows": 0,
"disorder_ratio": 0,
@@ -137,7 +131,7 @@
"line_protocol": "json",
"childtable_limit": 0,
"childtable_offset": 0,
- "insert_rows": 10,
+ "insert_rows": 20,
"insert_interval": 0,
"interlace_rows": 0,
"disorder_ratio": 0,
@@ -162,7 +156,7 @@
"line_protocol": "json",
"childtable_limit": 0,
"childtable_offset": 0,
- "insert_rows": 10,
+ "insert_rows": 20,
"insert_interval": 0,
"interlace_rows": 0,
"disorder_ratio": 0,
@@ -187,7 +181,7 @@
"line_protocol": "json",
"childtable_limit": 0,
"childtable_offset": 0,
- "insert_rows": 10,
+ "insert_rows": 20,
"insert_interval": 0,
"interlace_rows": 0,
"disorder_ratio": 0,
@@ -212,7 +206,7 @@
"line_protocol": "json",
"childtable_limit": 0,
"childtable_offset": 0,
- "insert_rows": 10,
+ "insert_rows": 20,
"insert_interval": 0,
"interlace_rows": 0,
"disorder_ratio": 0,
@@ -237,7 +231,7 @@
"line_protocol": "json",
"childtable_limit": 0,
"childtable_offset": 0,
- "insert_rows": 10,
+ "insert_rows": 20,
"insert_interval": 0,
"interlace_rows": 0,
"disorder_ratio": 0,
diff --git a/tests/develop-test/5-taos-tools/taosbenchmark/sml_json_alltypes.py b/tests/develop-test/5-taos-tools/taosbenchmark/sml_json_alltypes.py
index 789a0ce0a2..0d10741331 100644
--- a/tests/develop-test/5-taos-tools/taosbenchmark/sml_json_alltypes.py
+++ b/tests/develop-test/5-taos-tools/taosbenchmark/sml_json_alltypes.py
@@ -19,32 +19,38 @@ from util.dnodes import *
class TDTestCase:
def caseDescription(self):
- '''
+ """
[TD-11510] taosBenchmark test cases
- '''
- return
+ """
def init(self, conn, logSql, replicaVar=1):
- self.replicaVar = int(replicaVar)
tdLog.debug("start to execute %s" % __file__)
+ self.replicaVar = int(replicaVar)
tdSql.init(conn.cursor(), logSql)
def getPath(self, tool="taosBenchmark"):
selfPath = os.path.dirname(os.path.realpath(__file__))
- if ("community" in selfPath):
- projPath = selfPath[:selfPath.find("community")]
+ if "community" in selfPath:
+ projPath = selfPath[: selfPath.find("community")]
+ elif "src" in selfPath:
+ projPath = selfPath[: selfPath.find("src")]
+ elif "/tools/" in selfPath:
+ projPath = selfPath[: selfPath.find("/tools/")]
+ elif "/tests/" in selfPath:
+ projPath = selfPath[: selfPath.find("/tests/")]
else:
- projPath = selfPath[:selfPath.find("tests")]
+ tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath))
+ projPath = "/usr/local/taos/bin/"
paths = []
- for root, dirs, files in os.walk(projPath):
- if ((tool) in files):
+ for root, dummy, files in os.walk(projPath):
+ if (tool) in files:
rootRealPath = os.path.dirname(os.path.realpath(root))
- if ("packaging" not in rootRealPath):
+ if "packaging" not in rootRealPath:
paths.append(os.path.join(root, tool))
break
- if (len(paths) == 0):
+ if len(paths) == 0:
tdLog.exit("taosBenchmark not found!")
return
else:
@@ -52,49 +58,63 @@ class TDTestCase:
return paths[0]
def run(self):
+ tdSql.query("select client_version()")
+ client_ver = "".join(tdSql.queryResult[0])
+ major_ver = client_ver.split(".")[0]
+
binPath = self.getPath()
- cmd = "%s -f ./5-taos-tools/taosbenchmark/json/sml_json_alltypes.json" %binPath
+ cmd = "%s -f ./5-taos-tools/taosbenchmark/json/sml_json_alltypes.json" % binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.execute("reset query cache")
tdSql.query("describe db.stb1")
tdSql.checkData(1, 1, "BOOL")
tdSql.query("describe db.stb2")
- tdSql.checkData(1, 1, "TINYINT")
+ tdSql.checkData(1, 1, "DOUBLE")
tdSql.query("describe db.stb3")
- tdSql.checkData(1, 1, "SMALLINT")
+ tdSql.checkData(1, 1, "DOUBLE")
tdSql.query("describe db.stb4")
- tdSql.checkData(1, 1, "INT")
+ tdSql.checkData(1, 1, "DOUBLE")
tdSql.query("describe db.stb5")
- tdSql.checkData(1, 1, "BIGINT")
+ tdSql.checkData(1, 1, "DOUBLE")
tdSql.query("describe db.stb6")
- tdSql.checkData(1, 1, "FLOAT")
+ tdSql.checkData(1, 1, "DOUBLE")
tdSql.query("describe db.stb7")
tdSql.checkData(1, 1, "DOUBLE")
tdSql.query("describe db.stb8")
- tdSql.checkData(1, 1, "VARCHAR")
- tdSql.checkData(1, 2, 16)
+ if major_ver == "3":
+ tdSql.checkData(1, 1, "VARCHAR")
+ tdSql.checkData(1, 2, 16)
+ else:
+ tdSql.checkData(1, 1, "NCHAR")
+ tdSql.checkData(1, 2, 8)
+
tdSql.query("describe db.stb9")
- tdSql.checkData(1, 1, "NCHAR")
- tdSql.checkData(1, 2, 16)
+ if major_ver == "3":
+ tdSql.checkData(1, 1, "VARCHAR")
+ tdSql.checkData(1, 2, 16)
+ else:
+ tdSql.checkData(1, 1, "NCHAR")
+ tdSql.checkData(1, 2, 8)
+
tdSql.query("select count(*) from db.stb1")
- tdSql.checkData(0, 0, 80)
+ tdSql.checkData(0, 0, 160)
tdSql.query("select count(*) from db.stb2")
- tdSql.checkData(0, 0, 80)
+ tdSql.checkData(0, 0, 160)
tdSql.query("select count(*) from db.stb3")
- tdSql.checkData(0, 0, 80)
+ tdSql.checkData(0, 0, 160)
tdSql.query("select count(*) from db.stb4")
- tdSql.checkData(0, 0, 80)
+ tdSql.checkData(0, 0, 160)
tdSql.query("select count(*) from db.stb5")
- tdSql.checkData(0, 0, 80)
+ tdSql.checkData(0, 0, 160)
tdSql.query("select count(*) from db.stb6")
- tdSql.checkData(0, 0, 80)
+ tdSql.checkData(0, 0, 160)
tdSql.query("select count(*) from db.stb7")
- tdSql.checkData(0, 0, 80)
+ tdSql.checkData(0, 0, 160)
tdSql.query("select count(*) from db.stb8")
- tdSql.checkData(0, 0, 80)
+ tdSql.checkData(0, 0, 160)
tdSql.query("select count(*) from db.stb9")
- tdSql.checkData(0, 0, 80)
+ tdSql.checkData(0, 0, 160)
def stop(self):
tdSql.close()
diff --git a/tests/docs-examples-test/python.sh b/tests/docs-examples-test/python.sh
index 140d05395b..ccb391b752 100644
--- a/tests/docs-examples-test/python.sh
+++ b/tests/docs-examples-test/python.sh
@@ -23,7 +23,7 @@ python3 bind_param_example.py
# 4
taos -s "drop database power"
-python3 multi_bind_example.py
+python3 multi_bind_example.py
# 5
python3 query_example.py
@@ -44,4 +44,43 @@ taos -s "drop database test"
python3 json_protocol_example.py
# 10
-# python3 subscribe_demo.py
+pip install SQLAlchemy
+pip install pandas
+taosBenchmark -y -d power -t 10 -n 10
+python3 conn_native_pandas.py
+python3 conn_rest_pandas.py
+taos -s "drop database if exists power"
+
+# 11
+taos -s "create database if not exists test"
+python3 connect_native_reference.py
+
+# 12
+python3 connect_rest_examples.py
+
+# 13
+python3 handle_exception.py
+
+# 14
+taosBenchmark -y -d power -t 2 -n 10
+python3 rest_client_example.py
+taos -s "drop database if exists power"
+
+# 15
+python3 result_set_examples.py
+
+# 16
+python3 tmq_example.py
+
+# 17
+python3 sql_writer.py
+
+# 18
+python3 mockdatasource.py
+
+# 19
+python3 fast_write_example.py
+
+# 20
+pip3 install kafka-python
+python3 kafka_example.py
diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task
index 94d87c705c..3b4f61daee 100644
--- a/tests/parallel_test/cases.task
+++ b/tests/parallel_test/cases.task
@@ -179,6 +179,7 @@
,,y,script,./test.sh -f tsim/query/udf_with_const.sim
,,y,script,./test.sh -f tsim/query/sys_tbname.sim
,,y,script,./test.sh -f tsim/query/groupby.sim
+,,y,script,./test.sh -f tsim/query/event.sim
,,y,script,./test.sh -f tsim/qnode/basic1.sim
,,y,script,./test.sh -f tsim/snode/basic1.sim
,,y,script,./test.sh -f tsim/mnode/basic1.sim
diff --git a/tests/parallel_test/container_build.sh b/tests/parallel_test/container_build.sh
index 221e549056..ff854449bb 100755
--- a/tests/parallel_test/container_build.sh
+++ b/tests/parallel_test/container_build.sh
@@ -55,7 +55,7 @@ fi
date
docker run \
-v $REP_MOUNT_PARAM \
- --rm --ulimit core=-1 taos_test:v1.0 sh -c "cd $REP_DIR;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DBUILD_TEST=true -DWEBSOCKET=true;make -j || exit 1"
+ --rm --ulimit core=-1 taos_test:v1.0 sh -c "cd $REP_DIR;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DBUILD_TEST=true -DWEBSOCKET=true -DBUILD_TAOSX=true;make -j || exit 1"
if [[ -d ${WORKDIR}/debugNoSan ]] ;then
echo "delete ${WORKDIR}/debugNoSan"
@@ -70,7 +70,7 @@ mv ${REP_REAL_PATH}/debug ${WORKDIR}/debugNoSan
date
docker run \
-v $REP_MOUNT_PARAM \
- --rm --ulimit core=-1 taos_test:v1.0 sh -c "cd $REP_DIR;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DBUILD_TEST=true -DWEBSOCKET=true -DBUILD_SANITIZER=1 -DTOOLS_SANITIZE=true -DTOOLS_BUILD_TYPE=Debug;make -j || exit 1 "
+ --rm --ulimit core=-1 taos_test:v1.0 sh -c "cd $REP_DIR;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DBUILD_TEST=true -DWEBSOCKET=true -DBUILD_SANITIZER=1 -DTOOLS_SANITIZE=true -DTOOLS_BUILD_TYPE=Debug -DBUILD_TAOSX=true;make -j || exit 1 "
mv ${REP_REAL_PATH}/debug ${WORKDIR}/debugSan
diff --git a/tests/requirements.txt b/tests/requirements.txt
index ce459414c4..cebe5b9d36 100644
--- a/tests/requirements.txt
+++ b/tests/requirements.txt
@@ -3,3 +3,4 @@ numpy
fabric2
psutil
pandas
+toml
diff --git a/tests/script/tsim/db/alter_replica_13.sim b/tests/script/tsim/db/alter_replica_13.sim
index d75acb50ad..a9dc1741a1 100644
--- a/tests/script/tsim/db/alter_replica_13.sim
+++ b/tests/script/tsim/db/alter_replica_13.sim
@@ -79,6 +79,7 @@ sql insert into db.ctb6 values(now, 6, "6")
sql insert into db.ctb7 values(now, 7, "7")
sql insert into db.ctb8 values(now, 8, "8")
sql insert into db.ctb9 values(now, 9, "9")
+sql flush database db;
print =============== step3: create dnodes
sql create dnode $hostname port 7300
diff --git a/tests/script/tsim/dnode/split_vgroup_replica1.sim b/tests/script/tsim/dnode/split_vgroup_replica1.sim
index 1bdd322714..51d63d25f4 100644
--- a/tests/script/tsim/dnode/split_vgroup_replica1.sim
+++ b/tests/script/tsim/dnode/split_vgroup_replica1.sim
@@ -11,7 +11,6 @@ system sh/cfg.sh -n dnode1 -c supportVnodes -v 0
system sh/exec.sh -n dnode1 -s start
system sh/exec.sh -n dnode2 -s start
sql connect
-sql create user u1 pass 'taosdata'
print =============== step1 create dnode2
sql create dnode $hostname port 7200
@@ -73,8 +72,21 @@ print =============== step3: create database
sql use d1
sql create table d1.st (ts timestamp, i int) tags (j int)
sql create table d1.c1 using st tags(1)
+sql create table d1.c2 using st tags(2)
+sql create table d1.c3 using st tags(3)
+sql create table d1.c4 using st tags(4)
+sql create table d1.c5 using st tags(5)
+sql insert into d1.c1 values (now, 1);
+sql insert into d1.c2 values (now, 2);
+sql insert into d1.c3 values (now, 3);
+sql insert into d1.c4 values (now, 4);
+sql insert into d1.c5 values (now, 5);
sql show d1.tables
-if $rows != 1 then
+if $rows != 5 then
+ return -1
+endi
+sql select * from d1.st
+if $rows != 5 then
return -1
endi
@@ -82,6 +94,34 @@ print =============== step4: split
print split vgroup 2
sql split vgroup 2
+print =============== step5: check split result
+sql show d1.tables
+#if $rows != 5 then
+# return -1
+#endi
+#sql select * from d1.st
+#if $rows != 5 then
+# return -1
+#endi
+
+print =============== step6: create tables
+sql create table d1.c6 using st tags(6)
+sql create table d1.c7 using st tags(7)
+sql create table d1.c8 using st tags(8)
+sql create table d1.c9 using st tags(9)
+sql insert into d1.c6 values (now, 6);
+sql insert into d1.c7 values (now, 7);
+sql insert into d1.c8 values (now, 8);
+sql insert into d1.c9 values (now, 9);
+sql show d1.tables
+#if $rows != 9 then
+# return -1
+#endi
+#sql select * from d1.st
+#if $rows != 9 then
+# return -1
+#endi
+
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode2 -s stop -x SIGINT
system sh/exec.sh -n dnode3 -s stop -x SIGINT
diff --git a/tests/script/tsim/parser/interp.sim b/tests/script/tsim/parser/interp.sim
index 1b7878178c..e6512a22d7 100644
--- a/tests/script/tsim/parser/interp.sim
+++ b/tests/script/tsim/parser/interp.sim
@@ -72,4 +72,33 @@ sql_error select interp(*) from nt5931 where ts=now
sql_error select interp(*) from st5931 where ts=now
sql_error select interp(*) from ct5931 where ts=now
+sql create stable sta (ts timestamp, f1 double, f2 binary(200)) tags(t1 int);
+sql create table tba1 using sta tags(1);
+sql insert into tba1 values ('2022-04-26 15:15:01', -3.0, "a");
+sql insert into tba1 values ('2022-04-26 15:15:05', 3.0, "b");
+sql select a from (select interp(f1) as a from tba1 where ts >= '2022-04-26 15:15:01' and ts <= '2022-04-26 15:15:05' range('2022-04-26 15:15:01','2022-04-26 15:15:05') every(1s) fill(linear)) where a > 0;
+if $rows != 2 then
+ return -1
+endi
+if $data00 != 1.500000000 then
+ return -1
+endi
+if $data10 != 3.000000000 then
+ return -1
+endi
+
+sql select a from (select interp(f1+1) as a from tba1 where ts >= '2022-04-26 15:15:01' and ts <= '2022-04-26 15:15:05' range('2022-04-26 15:15:01','2022-04-26 15:15:05') every(1s) fill(linear)) where a > 0;
+if $rows != 3 then
+ return -1
+endi
+if $data00 != 1.000000000 then
+ return -1
+endi
+if $data10 != 2.500000000 then
+ return -1
+endi
+if $data20 != 4.000000000 then
+ return -1
+endi
+
system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/parser/regressiontest.sim b/tests/script/tsim/parser/regressiontest.sim
index 1b127155cb..3ce2b47b44 100644
--- a/tests/script/tsim/parser/regressiontest.sim
+++ b/tests/script/tsim/parser/regressiontest.sim
@@ -63,4 +63,38 @@ if $rows != 8198 then
return -1
endi
+print ===========================> TD-22077 && TD-21877
+sql drop database if exists $db -x step1
+sql create database $db vgroups 1;
+
+sql use $db
+sql create stable st1 (ts timestamp, c int) tags(a int);
+sql create table t1 using st1 tags(1);
+sql create table t2 using st1 tags(2);
+
+$i = 0
+$ts = 1674977959000
+$rowNum = 200
+
+$x = 0
+while $x < $rowNum
+$xs = $x * $delta
+$ts = $ts0 + $xs
+sql insert into t1 values ( $ts , $x )
+sql insert into t2 values ( $ts + 1000a, $x )
+$x = $x + 1
+$ts = $ts + 1000
+endw
+
+sql flush database $db
+
+sql insert into t1 values('2018-09-17 09:00:26', 26);
+sql insert into t2 values('2018-09-17 09:00:25', 25);
+
+sql insert into t2 values('2018-09-17 09:00:30', 30);
+sql flush database reg_db0;
+
+sql delete from st1 where ts<='2018-9-17 09:00:26';
+sql select * from st1;
+
system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/query/event.sim b/tests/script/tsim/query/event.sim
index adc94a34de..16fe0f4a13 100644
--- a/tests/script/tsim/query/event.sim
+++ b/tests/script/tsim/query/event.sim
@@ -11,20 +11,18 @@ sql use db1;
sql create stable sta (ts timestamp, f1 int, f2 binary(10), f3 bool) tags(t1 int, t2 bool, t3 binary(10));
sql create table tba1 using sta tags(0, false, '0');
sql create table tba2 using sta tags(1, true, '1');
-sql create table tba3 using sta tags(null, null, '');
-sql create table tba4 using sta tags(1, false, null);
-sql create table tba5 using sta tags(3, true, 'aa');
sql insert into tba1 values ('2022-09-26 15:15:01', 0, "a", false);
sql insert into tba1 values ('2022-09-26 15:15:02', 1, "0", true);
sql insert into tba1 values ('2022-09-26 15:15:03', 5, "5", false);
sql insert into tba1 values ('2022-09-26 15:15:04', 3, 'b', false);
sql insert into tba1 values ('2022-09-26 15:15:05', 0, '1', false);
sql insert into tba1 values ('2022-09-26 15:15:06', 2, 'd', true);
-
-sql insert into tba2 values ('2022-09-27 15:15:01', 0, "a", false);
-sql insert into tba2 values ('2022-09-27 15:15:02', 1, "0", true);
-sql insert into tba2 values ('2022-09-27 15:15:03', 5, "5", false);
-sql insert into tba2 values ('2022-09-27 15:15:04', null, null, null);
+sql insert into tba2 values ('2022-09-26 15:15:01', 0, "a", false);
+sql insert into tba2 values ('2022-09-26 15:15:02', 1, "0", true);
+sql insert into tba2 values ('2022-09-26 15:15:03', 5, "5", false);
+sql insert into tba2 values ('2022-09-26 15:15:04', 3, 'b', false);
+sql insert into tba2 values ('2022-09-26 15:15:05', 0, '1', false);
+sql insert into tba2 values ('2022-09-26 15:15:06', 2, 'd', true);
# child table: no window
print ====> select count(*) from tba1 event_window start with f1 = 0 end with f2 = 'c';
@@ -35,7 +33,7 @@ endi
# child table: single row window
print ====> select count(*) from tba1 event_window start with f1 = 0 end with f3 = false;
-sql select count(*) from tba1 event_window start with f1 = 0 end with f3 = false
+sql select count(*) from tba1 event_window start with f1 = 0 end with f3 = false;
if $rows != 2 then
return -1
endi
@@ -66,4 +64,176 @@ if $data10 != 4 then
return -1
endi
+# super table: no window
+print ====> select count(*) from sta event_window start with f1 = 0 end with f2 = 'c';
+sql select count(*) from sta event_window start with f1 = 0 end with f2 = 'c';
+if $rows != 0 then
+ return -1
+endi
+
+# super table: single row window
+print ====> select count(*) from sta event_window start with f1 = 0 end with f3 = false;
+sql select count(*) from sta event_window start with f1 = 0 end with f3 = false;
+if $rows != 4 then
+ return -1
+endi
+if $data00 != 1 then
+ return -1
+endi
+
+# super table: multi rows window
+print ====> select count(*) from sta event_window start with f1 = 0 end with f2 = 'b';
+sql select count(*) from sta event_window start with f1 = 0 end with f2 = 'b';
+if $rows != 1 then
+ return -1
+endi
+if $data00 != 7 then
+ return -1
+endi
+
+# super table: multi windows
+print ====> select count(*) from sta event_window start with f1 >= 0 end with f3 = true;
+sql select count(*) from sta event_window start with f1 >= 0 end with f3 = true;
+if $rows != 4 then
+ return -1
+endi
+if $data00 != 3 then
+ return -1
+endi
+if $data10 != 1 then
+ return -1
+endi
+if $data20 != 7 then
+ return -1
+endi
+if $data30 != 1 then
+ return -1
+endi
+
+# multi-child table: no window
+print ====> select tbname, count(*) from sta partition by tbname event_window start with f1 = 0 end with f2 = 'c';
+sql select tbname, count(*) from sta partition by tbname event_window start with f1 = 0 end with f2 = 'c';
+if $rows != 0 then
+ return -1
+endi
+
+# multi-child table: single row window
+print ====> select tbname, count(*) from sta partition by tbname event_window start with f1 = 0 end with f3 = false;
+sql select tbname, count(*) from sta partition by tbname event_window start with f1 = 0 end with f3 = false;
+if $rows != 4 then
+ return -1
+endi
+if $data01 != 1 then
+ return -1
+endi
+
+# multi-child table: multi rows window
+print ====> select tbname, count(*) from sta partition by tbname event_window start with f1 = 0 end with f2 = 'b';
+sql select tbname, count(*) from sta partition by tbname event_window start with f1 = 0 end with f2 = 'b';
+if $rows != 2 then
+ return -1
+endi
+if $data01 != 4 then
+ return -1
+endi
+if $data11 != 4 then
+ return -1
+endi
+
+# multi-child table: multi windows
+print ====> select tbname, count(*) from sta partition by tbname event_window start with f1 >= 0 end with f3 = true;
+sql select tbname, count(*) from sta partition by tbname event_window start with f1 >= 0 end with f3 = true;
+if $rows != 4 then
+ return -1
+endi
+if $data01 != 2 then
+ return -1
+endi
+if $data11 != 4 then
+ return -1
+endi
+
+# where + partition by
+print ====> select tbname, count(*) from sta where f3 = false partition by tbname event_window start with f1 >0 end with f2 > 0;
+sql select tbname, count(*) from sta where f3 = false partition by tbname event_window start with f1 >0 end with f2 > 0;
+if $rows != 4 then
+ return -1
+endi
+if $data01 != 1 then
+ return -1
+endi
+if $data11 != 2 then
+ return -1
+endi
+
+# where + order by
+print ====> select count(*) cnt from tba1 where f3 = false event_window start with f1 >0 end with f2 > 0 order by cnt desc;
+sql select count(*) cnt from tba1 where f3 = false event_window start with f1 >0 end with f2 > 0 order by cnt desc;
+if $rows != 2 then
+ return -1
+endi
+if $data00 != 2 then
+ return -1
+endi
+if $data10 != 1 then
+ return -1
+endi
+
+# where + partition by + order by
+print ====> select tbname, count(*) cnt from sta where f3 = false partition by tbname event_window start with f1 >0 end with f2 > 0 order by cnt;
+sql select tbname, count(*) cnt from sta where f3 = false partition by tbname event_window start with f1 >0 end with f2 > 0 order by cnt;
+if $rows != 4 then
+ return -1
+endi
+if $data01 != 1 then
+ return -1
+endi
+if $data11 != 1 then
+ return -1
+endi
+
+# where + partition by + order by + limit
+print ====> select tbname, count(*) cnt from sta where f3 = false partition by tbname event_window start with f1 >0 end with f2 > 0 order by cnt limit 2 offset 2;
+sql select tbname, count(*) cnt from sta where f3 = false partition by tbname event_window start with f1 >0 end with f2 > 0 order by cnt limit 2 offset 2;
+if $rows != 2 then
+ return -1
+endi
+if $data01 != 2 then
+ return -1
+endi
+if $data11 != 2 then
+ return -1
+endi
+
+# subquery(where + partition by + order by + limit)
+print ====> select * from (select tbname tname, count(*) cnt from sta where f3 = false partition by tbname event_window start with f1 >0 end with f2 > 0 order by cnt limit 2 offset 2);
+sql select * from (select tbname tname, count(*) cnt from sta where f3 = false partition by tbname event_window start with f1 >0 end with f2 > 0 order by cnt limit 2 offset 2);
+if $rows != 2 then
+ return -1
+endi
+if $data01 != 2 then
+ return -1
+endi
+if $data11 != 2 then
+ return -1
+endi
+
+# subquery + where + partition by + order by + limit
+print ====> select tname, count(*) cnt from (select tbname tname, * from sta) where f3 = false partition by tname event_window start with f1 >0 end with f2 > 0 order by cnt limit 2 offset 2;
+sql select tname, count(*) cnt from (select tbname tname, * from sta) where f3 = false partition by tname event_window start with f1 >0 end with f2 > 0 order by cnt limit 2 offset 2;
+if $rows != 2 then
+ return -1
+endi
+if $data01 != 2 then
+ return -1
+endi
+if $data11 != 2 then
+ return -1
+endi
+
+sql_error select f1, f2 from sta event_window start with f1 >0 end with f2 > 0;
+sql_error select count(*) from sta event_window start with f1 >0 end with f2 > 0 partition by tbname;
+sql_error select count(*) from sta event_window start with f1 >0 end with f2 > 0 group by tbname;
+sql_error select count(*) from sta event_window start with f1 >0 end with f2 > 0 fill(NULL);
+
system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/sma/rsmaCreateInsertQuery.sim b/tests/script/tsim/sma/rsmaCreateInsertQuery.sim
index 508e6f88c1..b3144e4e0d 100644
--- a/tests/script/tsim/sma/rsmaCreateInsertQuery.sim
+++ b/tests/script/tsim/sma/rsmaCreateInsertQuery.sim
@@ -81,8 +81,60 @@ if $data01 != 10 then
endi
#===================================================================
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
+system sh/exec.sh -n dnode1 -s start
+print =============== wait maxdelay 15+2 seconds for results after reboot
+sleep 17000
-#==================== reboot to trigger commit data to file
+print =============== select * from retention level 2 from memory after reboot
+sql select * from ct1;
+print $data00 $data01
+if $rows > 2 then
+ print retention level 2 file rows $rows > 2
+ return -1
+endi
+
+
+if $data01 != 1 then
+ if $data01 != 10 then
+ print =============> $data01
+ print retention level 2 file result $data01 != 1 or 10
+ return -1
+ endi
+endi
+
+print =============== select * from retention level 1 from memory after reboot
+sql select * from ct1 where ts > now-8d;
+print $data00 $data01
+if $rows > 2 then
+ print retention level 1 file rows $rows > 2
+ return -1
+endi
+
+if $data01 != 1 then
+ if $data01 != 10 then
+ print retention level 1 file result $data01 != 1 or 10
+ return -1
+ endi
+endi
+
+print =============== select * from retention level 0 from memory after reboot
+sql select * from ct1 where ts > now-3d;
+print $data00 $data01
+print $data10 $data11
+print $data20 $data21
+
+if $rows < 1 then
+ print retention level 0 file rows $rows < 1
+ return -1
+endi
+
+if $data01 != 10 then
+ print retention level 0 file result $data01 != 10
+ return -1
+endi
+
+#==================== flush database to trigger commit data to file
sql flush database d0;
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s start
diff --git a/tests/script/tsim/sma/rsmaPersistenceRecovery.sim b/tests/script/tsim/sma/rsmaPersistenceRecovery.sim
index 4117a2403d..0c9d23335e 100644
--- a/tests/script/tsim/sma/rsmaPersistenceRecovery.sim
+++ b/tests/script/tsim/sma/rsmaPersistenceRecovery.sim
@@ -82,9 +82,62 @@ if $data01 != 10 then
endi
#===================================================================
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
+system sh/exec.sh -n dnode1 -s start
+print =============== wait maxdelay 5+2 seconds for results after reboot
+sleep 7000
+
+print =============== select * from retention level 2 from memory after reboot
+sql select * from ct1;
+print $data00 $data01 $data02
+print $data10 $data11 $data12
+if $rows > 2 then
+ print retention level 2 file rows $rows > 2
+ return -1
+endi
-#==================== reboot to trigger commit data to file
+if $data01 != 100 then
+ if $data01 != 10 then
+ print retention level 2 file result $data01 != 100 or 10
+ return -1
+ endi
+endi
+
+print =============== select * from retention level 1 from memory after reboot
+sql select * from ct1 where ts > now-8d;
+print $data00 $data01 $data02
+print $data10 $data11 $data12
+if $rows > 2 then
+ print retention level 1 file rows $rows > 2
+ return -1
+endi
+
+if $data01 != 100 then
+ if $data01 != 10 then
+ print retention level 1 file result $data01 != 100 or 10
+ return -1
+ endi
+endi
+
+print =============== select * from retention level 0 from memory after reboot
+sql select * from ct1 where ts > now-3d;
+print $data00 $data01 $data02
+print $data10 $data11 $data12
+print $data20 $data21 $data22
+
+if $rows < 1 then
+ print retention level 0 file rows $rows < 1
+ return -1
+endi
+
+if $data01 != 10 then
+ print retention level 0 file result $data01 != 10
+ return -1
+endi
+
+
+#==================== flush database to trigger commit data to file
sql flush database d0;
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s start
diff --git a/tests/script/tsim/sma/tsmaCreateInsertQuery.sim b/tests/script/tsim/sma/tsmaCreateInsertQuery.sim
index 27f4a475d2..9b6fc96bc0 100644
--- a/tests/script/tsim/sma/tsmaCreateInsertQuery.sim
+++ b/tests/script/tsim/sma/tsmaCreateInsertQuery.sim
@@ -136,7 +136,76 @@ system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s start
sleep 50
+print =============== select * from ct1 from memory after reboot
+sql select * from ct1;
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+print $data40 $data41 $data42 $data43
+if $rows != 5 then
+ print rows $rows != 5
+ return -1
+endi
+print =============== select * from stb from memory in designated vgroup after reboot
+sql select _wstart, _wend, min(c1),max(c2),max(c1) from stb interval(5m,10s) sliding(5m);
+print $data00 $data01 $data02 $data03 $data04
+print $data10 $data11 $data12 $data13 $data14
+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 * from stb from memory in common vgroups after reboot
+sql select _wstart, _wend, min(c1),max(c2),max(c1),max(c3) from stb interval(5m,10s) sliding(5m);
+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
+
+
+#==================== flush database to trigger commit data to file
+sql flush database d1;
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
+system sh/exec.sh -n dnode1 -s start
+sleep 50
print =============== select * from ct1 from file
sql select * from ct1;
print $data00 $data01 $data02 $data03
diff --git a/tests/script/tsim/stream/basic1.sim b/tests/script/tsim/stream/basic1.sim
index 7bf10df637..c61c7667f8 100644
--- a/tests/script/tsim/stream/basic1.sim
+++ b/tests/script/tsim/stream/basic1.sim
@@ -834,4 +834,57 @@ endi
print ====== test _wstart end
+print insert into ts1 values(-1648791211000,1,2,3)
+
+sql create database test7 vgroups 1;
+sql use test7;
+sql create stable st(ts timestamp, a int, b int , c int) tags(ta int,tb int,tc int);
+sql create table ts1 using st tags(1,1,1);
+sql create stream streams7 trigger at_once into streamt7 as select _wstart, count(*) from ts1 interval(10s) ;
+
+sql insert into ts1 values(1648791211000,1,2,3);
+sql_error insert into ts1 values(-1648791211000,1,2,3);
+
+loop18:
+
+sleep 200
+sql select * from streamt7;
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $rows != 1 then
+ print =====rows=$rows
+ goto loop18
+endi
+
+if $data01 != 1 then
+ print =====data01=$data01
+ goto loop18
+endi
+
+sql_error insert into ts1 values(-1648791211001,1,2,3) (1648791211001,1,2,3);
+
+sql select _wstart, count(*) from ts1 interval(10s) ;
+
+print $data00 $data01
+print $data10 $data11
+
+loop19:
+
+sleep 200
+sql select * from streamt7;
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $rows != 1 then
+ print =====rows=$rows
+ goto loop19
+endi
+
system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/stream/checkStreamSTable.sim b/tests/script/tsim/stream/checkStreamSTable.sim
index 2ed6958196..b60ab0ac05 100644
--- a/tests/script/tsim/stream/checkStreamSTable.sim
+++ b/tests/script/tsim/stream/checkStreamSTable.sim
@@ -19,9 +19,9 @@ sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int);
sql create table t1 using st tags(1,1,1);
sql create table t2 using st tags(2,2,2);
-sql create stable result.streamt0(ts timestamp,a int,b int) tags(ta int,tb int,tc int);
+sql create stable result.streamt0(ts timestamp,a int,b int) tags(ta int,tb varchar(100),tc int);
-sql create stream streams0 trigger at_once into result.streamt0 as select _wstart, count(*) c1, max(a) c2 from st partition by tbname interval(10s);
+sql create stream streams0 trigger at_once into result.streamt0 tags(tb) as select _wstart, count(*) c1, max(a) c2 from st partition by tbname tb interval(10s);
sql insert into t1 values(1648791213000,1,2,3);
sql insert into t2 values(1648791213000,2,2,3);
@@ -61,6 +61,16 @@ if $data02 != 1 then
goto loop0
endi
+if $data03 != NULL then
+ print =====data03=$data03
+ goto loop0
+endi
+
+if $data04 != t1 then
+ print =====data04=$data04
+ goto loop0
+endi
+
if $data11 != 1 then
print =====data11=$data11
goto loop0
@@ -71,6 +81,16 @@ if $data12 != 2 then
goto loop0
endi
+if $data13 != NULL then
+ print =====data13=$data13
+ goto loop0
+endi
+
+if $data14 != t2 then
+ print =====data14=$data14
+ goto loop0
+endi
+
print ===== step3
sql create database result1 vgroups 1;
@@ -83,9 +103,9 @@ sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int);
sql create table t1 using st tags(1,1,1);
sql create table t2 using st tags(2,2,2);
-sql create stable result1.streamt1(ts timestamp,a int,b int,c int) tags(ta bigint unsigned,tb int,tc int);
+sql create stable result1.streamt1(ts timestamp,a int,b int,c int) tags(ta varchar(100),tb int,tc int);
-sql create stream streams1 trigger at_once into result1.streamt1(ts,c,a,b) as select _wstart, count(*) c1, max(a),min(b) c2 from st partition by tbname interval(10s);
+sql create stream streams1 trigger at_once into result1.streamt1(ts,c,a,b) tags(ta) as select _wstart, count(*) c1, max(a),min(b) c2 from st partition by tbname as ta interval(10s);
sql insert into t1 values(1648791213000,10,20,30);
sql insert into t2 values(1648791213000,40,50,60);
@@ -161,7 +181,7 @@ sql create table t2 using st tags(2,2,2);
sql create stable result2.streamt2(ts timestamp, a int , b int) tags(ta varchar(20));
# tag dest 1, source 2
-##sql_error create stream streams2 trigger at_once into result2.streamt2 TAGS(aa varchar(100), ta int) as select _wstart, count(*) c1, max(a) from st partition by tbname as aa, ta interval(10s);
+sql_error create stream streams2 trigger at_once into result2.streamt2 TAGS(aa varchar(100), ta int) as select _wstart, count(*) c1, max(a) from st partition by tbname as aa, ta interval(10s);
# column dest 3, source 4
sql_error create stream streams2 trigger at_once into result2.streamt2 as select _wstart, count(*) c1, max(a), max(b) from st partition by tbname interval(10s);
@@ -173,7 +193,7 @@ sql_error create stream streams2 trigger at_once into result2.streamt2(ts, a, b
sql_error create stream streams2 trigger at_once into result2.streamt2 as select _wstart, count(*) c1 from st partition by tbname interval(10s);
# column dest 3, source 2
-sql create stream streams2 trigger at_once into result2.streamt2(ts, a) as select _wstart, count(*) c1 from st partition by tbname interval(10s);
+sql create stream streams2 trigger at_once into result2.streamt2(ts, a) tags(ta) as select _wstart, count(*) c1 from st partition by tbname as ta interval(10s);
print ===== step5
@@ -252,16 +272,16 @@ sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int);
sql create table t1 using st tags(1,2,3);
sql create table t2 using st tags(4,5,6);
-sql create stable result4.streamt4(ts timestamp,a int,b int,c int, d int) tags(ta int,tb int,tc int);
+sql create stable result4.streamt4(ts timestamp,a int,b int,c int, d int) tags(tg1 int,tg2 int,tg3 int);
-sql create stream streams4 trigger at_once into result4.streamt4(ts,c,a,b) tags(tg2 int, tg3 varchar(100), tg1 bigint) subtable(concat("tbl-", tg1)) as select _wstart, count(*) c1, max(a),min(b) c2 from st partition by ta+1 as tg1, cast(tb as bigint) as tg2, tc as tg3 interval(10s);
+sql create stream streams4 trigger at_once into result4.streamt4(ts,c,a,b) tags(tg2, tg3, tg1) subtable( concat("tbl-", cast(tg1 as varchar(10)) ) ) as select _wstart, count(*) c1, max(a),min(b) c2 from st partition by ta+1 as tg1, cast(tb as bigint) as tg2, tc as tg3 interval(10s);
sql insert into t1 values(1648791213000,10,20,30);
sql insert into t2 values(1648791213000,40,50,60);
$loop_count = 0
-sql select _wstart, count(*) c1, max(a),min(b) c2 from st interval(10s);
+sql select _wstart, count(*) c1, max(a),min(b) c2 from st partition by ta+1 as tg1, cast(tb as bigint) as tg2, tc as tg3 interval(10s);
print $data00, $data01, $data02, $data03
print $data10, $data11, $data12, $data13
print $data20, $data21, $data22, $data23
@@ -275,7 +295,7 @@ if $loop_count == 10 then
return -1
endi
-sql select * from result4.streamt4;
+sql select * from result4.streamt4 order by tg1;
if $rows != 2 then
print =====rows=$rows
@@ -285,7 +305,7 @@ if $rows != 2 then
goto loop2
endi
-if $data01 != 40 then
+if $data01 != 10 then
print =====data01=$data01
goto loop2
endi
@@ -295,7 +315,7 @@ if $data02 != 20 then
goto loop2
endi
-if $data03 != 2 then
+if $data03 != 1 then
print =====data03=$data03
goto loop2
endi
@@ -305,6 +325,26 @@ if $data04 != NULL then
goto loop2
endi
+if $data11 != 40 then
+ print =====data11=$data11
+ goto loop2
+endi
+
+if $data12 != 50 then
+ print =====data12=$data12
+ goto loop2
+endi
+
+if $data13 != 1 then
+ print =====data13=$data13
+ goto loop2
+endi
+
+if $data14 != NULL then
+ print =====data14=$data14
+ goto loop2
+endi
+
print ======over
system sh/stop_dnodes.sh
diff --git a/tests/script/tsim/stream/triggerInterval0.sim b/tests/script/tsim/stream/triggerInterval0.sim
index 7353f026bb..b522dcf035 100644
--- a/tests/script/tsim/stream/triggerInterval0.sim
+++ b/tests/script/tsim/stream/triggerInterval0.sim
@@ -29,69 +29,119 @@ sql insert into t1 values(1648791223001,2,2,3,1.1);
sql insert into t1 values(1648791223002,2,2,3,1.1);
sql insert into t1 values(1648791223003,2,2,3,1.1);
sql insert into t1 values(1648791223001,2,2,3,1.1);
+
+print step 0
+
+$loop_count = 0
+
+loop0:
sleep 300
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
sql select * from streamt;
+
if $rows != 1 then
print ======$rows
- return -1
+ goto loop0
endi
if $data01 != 1 then
print ======$data01
- return -1
+ goto loop0
endi
sql insert into t1 values(1648791233001,2,2,3,1.1);
+
+print step 1
+
+$loop_count = 0
+
+loop1:
sleep 300
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
sql select * from streamt;
if $rows != 2 then
print ======$rows
- return -1
+ goto loop1
endi
if $data01 != 1 then
print ======$data01
- return -1
+ goto loop1
endi
if $data11 != 3 then
print ======$data11
- return -1
+ goto loop1
endi
sql insert into t1 values(1648791223004,2,2,3,1.1);
sql insert into t1 values(1648791223004,2,2,3,1.1);
sql insert into t1 values(1648791223005,2,2,3,1.1);
+
+print step 2
+
+$loop_count = 0
+
+loop2:
sleep 300
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
sql select * from streamt;
if $rows != 2 then
print ======$rows
- return -1
+ goto loop2
endi
+
if $data01 != 1 then
print ======$data01
- return -1
+ goto loop2
endi
if $data11 != 5 then
print ======$data11
- return -1
+ goto loop2
endi
sql insert into t1 values(1648791233002,3,2,3,2.1);
sql insert into t1 values(1648791213002,4,2,3,3.1)
sql insert into t1 values(1648791213002,4,2,3,4.1);
+
+print step 3
+
+$loop_count = 0
+
+loop3:
sleep 300
-sql select * from streamt;
-if $rows != 2 then
- print ======$rows
- return -1
-endi
-if $data01 != 2 then
- print ======$data01
- return -1
-endi
-if $data11 != 5 then
- print ======$data11
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
return -1
endi
+sql select * from streamt;
+if $rows != 2 then
+ print ======$rows
+ goto loop3
+endi
+if $data01 != 2 then
+ print ======$data01
+ goto loop3
+endi
+if $data11 != 5 then
+ print ======$data11
+ goto loop3
+endi
+
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
diff --git a/tests/script/tsim/stream/udTableAndTag0.sim b/tests/script/tsim/stream/udTableAndTag0.sim
index 5cb5c2dd8b..bfc299df0f 100644
--- a/tests/script/tsim/stream/udTableAndTag0.sim
+++ b/tests/script/tsim/stream/udTableAndTag0.sim
@@ -367,6 +367,77 @@ if $data22 != tag-t3 then
goto loop8
endi
+print ===== step6
+print ===== transform tag value
+
+sql drop stream if exists streams1;
+sql drop stream if exists streams2;
+sql drop stream if exists streams3;
+sql drop stream if exists streams4;
+sql drop stream if exists streams5;
+
+sql drop database if exists test1;
+sql drop database if exists test2;
+sql drop database if exists test3;
+sql drop database if exists test4;
+sql drop database if exists test5;
+
+sql drop database if exists result1;
+sql drop database if exists result2;
+sql drop database if exists result3;
+sql drop database if exists result4;
+sql drop database if exists result5;
+
+
+
+sql create database result6 vgroups 1;
+
+sql create database test6 vgroups 4;
+sql use test6;
+
+
+sql create stable st(ts timestamp,a int,b int,c int) tags(ta varchar(20), tb int, tc int);
+sql create table t1 using st tags("1",1,1);
+sql create table t2 using st tags("2",2,2);
+sql create table t3 using st tags("3",3,3);
+
+sql create stream streams6 trigger at_once into result6.streamt6 TAGS(dd int) as select _wstart, count(*) c1 from st partition by concat(ta, "0") as dd, tbname interval(10s);
+sql insert into t1 values(1648791213000,1,1,1) t2 values(1648791213000,2,2,2) t3 values(1648791213000,3,3,3);
+
+
+$loop_count = 0
+loop9:
+
+sleep 300
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+sql select * from result6.streamt6 order by 3;
+
+if $rows != 3 then
+ print =====rows=$rows
+ print $data00 $data10
+ goto loop9
+endi
+
+if $data02 != 10 then
+ print =====data02=$data02
+ goto loop9
+endi
+
+if $data12 != 20 then
+ print =====data12=$data12
+ goto loop9
+endi
+
+if $data22 != 30 then
+ print =====data22=$data22
+ goto loop8
+endi
+
print ======over
system sh/stop_dnodes.sh
diff --git a/tests/script/tsim/stream/udTableAndTag2.sim b/tests/script/tsim/stream/udTableAndTag2.sim
new file mode 100644
index 0000000000..bacc301ad0
--- /dev/null
+++ b/tests/script/tsim/stream/udTableAndTag2.sim
@@ -0,0 +1,515 @@
+system sh/stop_dnodes.sh
+system sh/deploy.sh -n dnode1 -i 1
+
+print ===== step1
+
+system sh/exec.sh -n dnode1 -s start
+sleep 50
+sql connect
+
+print ===== step2
+print ===== table name
+
+sql create database result vgroups 1;
+
+sql create database test vgroups 4;
+sql use test;
+
+
+sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int);
+sql create table t1 using st tags(1,1,1);
+sql create table t2 using st tags(2,2,2);
+
+sql create stream streams1 trigger at_once into result.streamt SUBTABLE("aaa") as select _wstart, count(*) c1 from st interval(10s);
+print ===== insert into 1
+sql insert into t1 values(1648791213000,1,2,3);
+sql insert into t2 values(1648791213000,2,2,3);
+
+$loop_count = 0
+loop0:
+
+sleep 300
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+sql select table_name from information_schema.ins_tables where db_name="result" order by 1;
+
+if $rows != 1 then
+ print =====rows=$rows
+ print $data00
+ print $data10
+ goto loop0
+endi
+
+if $data00 != aaa then
+ print =====data00=$data00
+ goto loop0
+endi
+
+
+$loop_count = 0
+loop1:
+
+sleep 300
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+sql select * from result.streamt;
+
+if $rows != 1 then
+ print =====rows=$rows
+ print $data00 $data10
+ goto loop1
+endi
+
+if $data01 != 2 then
+ print =====data01=$data01
+ goto loop1
+endi
+
+# group id
+if $data02 == NULL then
+ print =====data02=$data02
+ goto loop1
+endi
+
+
+print ===== step3
+print ===== column name
+
+sql create database result2 vgroups 1;
+
+sql create database test2 vgroups 4;
+sql use test2;
+
+
+sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int);
+sql create table t1 using st tags(1,1,1);
+sql create table t2 using st tags(2,2,2);
+
+sql create stream streams2 trigger at_once into result2.streamt2 TAGS(cc varchar(100)) as select _wstart, count(*) c1 from st interval(10s);
+print ===== insert into 2
+sql insert into t1 values(1648791213000,1,2,3);
+sql insert into t2 values(1648791213000,2,2,3);
+
+
+$loop_count = 0
+loop2:
+
+sleep 300
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+print select tag_name from information_schema.ins_tags where db_name="result2" and stable_name = "streamt2" order by 1;
+
+sql select tag_name from information_schema.ins_tags where db_name="result2" and stable_name = "streamt2" order by 1;
+
+if $rows != 1 then
+ print =====rows=$rows
+ print $data00
+ print $data10
+ goto loop2
+endi
+
+if $data00 != cc then
+ print =====data00=$data00
+ goto loop2
+endi
+
+print sql select cc from result2.streamt2 order by 1;
+
+$loop_count = 0
+loop21:
+
+sleep 300
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+sql select cc from result2.streamt2 order by 1;
+
+if $rows != 1 then
+ print =====rows=$rows
+ print $data00
+ print $data10
+ goto loop21
+endi
+
+if $data00 != NULL then
+ print =====data00=$data00
+ goto loop21
+endi
+
+
+$loop_count = 0
+loop3:
+
+sleep 300
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+sql select * from result2.streamt2;
+
+if $rows != 1 then
+ print =====rows=$rows
+ print $data00
+ print $data10
+ goto loop3
+endi
+
+if $data01 != 2 then
+ print =====data01=$data01
+ goto loop3
+endi
+
+if $data02 != NULL then
+ print =====data02=$data02
+ goto loop3
+endi
+
+
+print ===== step4
+print ===== column name + table name
+
+sql create database result3 vgroups 1;
+
+sql create database test3 vgroups 4;
+sql use test3;
+
+
+sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int);
+sql create table t1 using st tags(1,1,1);
+sql create table t2 using st tags(2,2,2);
+
+sql create stream streams3 trigger at_once into result3.streamt3 TAGS(dd varchar(100)) SUBTABLE(concat("tbn-", "1") ) as select _wstart, count(*) c1 from st interval(10s);
+print ===== insert into 3
+sql insert into t1 values(1648791213000,1,2,3);
+sql insert into t2 values(1648791213000,2,2,3);
+
+
+$loop_count = 0
+loop4:
+
+sleep 300
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+sql select tag_name from information_schema.ins_tags where db_name="result3" and stable_name = "streamt3" order by 1;
+
+if $rows != 1 then
+ print =====rows=$rows
+ print $data00
+ print $data10
+ goto loop4
+endi
+
+if $data00 != dd then
+ print =====data00=$data00
+ goto loop4
+endi
+
+sql select dd from result3.streamt3 order by 1;
+
+if $rows != 1 then
+ print =====rows=$rows
+ print $data00 $data10
+ goto loop4
+endi
+
+if $data00 != NULL then
+ print =====data00=$data00
+ goto loop4
+endi
+
+$loop_count = 0
+loop5:
+
+sleep 300
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+sql select * from result3.streamt3;
+
+if $rows != 1 then
+ print =====rows=$rows
+ print $data00
+ print $data10
+ goto loop5
+endi
+
+if $data01 != 2 then
+ print =====data01=$data01
+ goto loop5
+endi
+
+if $data02 != NULL then
+ print =====data02=$data02
+ goto loop5
+endi
+
+$loop_count = 0
+loop6:
+
+sleep 300
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+sql select table_name from information_schema.ins_tables where db_name="result3" order by 1;
+
+if $rows != 1 then
+ print =====rows=$rows
+ print $data00
+ print $data10
+ goto loop6
+endi
+
+if $data00 != tbn-1 then
+ print =====data00=$data00
+ goto loop6
+endi
+
+print ===== step5
+print ===== tag name + table name
+
+sql create database result4 vgroups 1;
+
+sql create database test4 vgroups 1;
+sql use test4;
+
+
+sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int);
+sql create table t1 using st tags(1,1,1);
+sql create table t2 using st tags(2,2,2);
+sql create table t3 using st tags(3,3,3);
+
+sql create stream streams4 trigger at_once into result4.streamt4 TAGS(dd varchar(100)) SUBTABLE(concat("tbn-", "1")) as select _wstart, count(*) c1 from st interval(10s);
+sql insert into t1 values(1648791213000,1,1,1) t2 values(1648791213000,2,2,2) t3 values(1648791213000,3,3,3);
+
+
+$loop_count = 0
+loop7:
+
+sleep 300
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+sql select table_name from information_schema.ins_tables where db_name="result4" order by 1;
+
+if $rows != 1 then
+ print =====rows=$rows
+ print $data00
+ print $data10
+ goto loop7
+endi
+
+if $data00 != tbn-1 then
+ print =====data00=$data00
+ goto loop7
+endi
+
+$loop_count = 0
+loop8:
+
+sleep 300
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+sql select * from result4.streamt4 order by 3;
+
+if $rows != 1 then
+ print =====rows=$rows
+ print $data00 $data10
+ goto loop8
+endi
+
+if $data01 != 3 then
+ print =====data01=$data01
+ goto loop8
+endi
+
+if $data02 != NULL then
+ print =====data02=$data02
+ goto loop8
+endi
+
+
+print ===== step6
+print ===== table name
+
+sql create database result5 vgroups 1;
+
+sql create database test5 vgroups 1;
+sql use test5;
+
+
+sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int);
+sql create table t1 using st tags(1,1,1);
+sql create table t2 using st tags(2,2,2);
+
+sql create stream streams51 trigger at_once into result5.streamt51 SUBTABLE("aaa") as select _wstart, count(*) c1 from st interval(10s);
+sql create stream streams52 trigger at_once into result5.streamt52 TAGS(cc varchar(100)) as select _wstart, count(*) c1 from st interval(10s);
+sql create stream streams53 trigger at_once into result5.streamt53 TAGS(dd varchar(100)) SUBTABLE(concat("aaa-", "1") ) as select _wstart, count(*) c1 from st interval(10s);
+
+sql insert into t1 values(1648791213000,1,2,3);
+sql insert into t2 values(1648791213000,2,2,3);
+
+$loop_count = 0
+loop9:
+
+sleep 300
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+print select table_name from information_schema.ins_tables where db_name="result5" order by 1;
+
+sql select table_name from information_schema.ins_tables where db_name="result5" order by 1;
+
+if $rows != 3 then
+ print =====rows=$rows
+ print $data00
+ print $data10
+ print $data20
+ print $data40
+ goto loop9
+endi
+
+if $data00 != aaa then
+ print =====data00=$data00
+ goto loop9
+endi
+
+if $data10 != aaa-1 then
+ print =====data00=$data00
+ goto loop9
+endi
+
+$loop_count = 0
+loop10:
+
+sleep 300
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+print sql select tag_name from information_schema.ins_tags where db_name="result5" and stable_name = "streamt52" order by 1;
+
+sql select tag_name from information_schema.ins_tags where db_name="result5" and stable_name = "streamt52" order by 1;
+
+if $rows != 1 then
+ print =====rows=$rows
+ print $data00
+ print $data10
+ goto loop10
+endi
+
+if $data00 != cc then
+ print =====data00=$data00
+ goto loop10
+endi
+
+print sql select tag_name from information_schema.ins_tags where db_name="result5" and stable_name = "streamt53" order by 1;
+
+sql select tag_name from information_schema.ins_tags where db_name="result5" and stable_name = "streamt53" order by 1;
+
+if $rows != 1 then
+ print =====rows=$rows
+ print $data00
+ print $data10
+ goto loop10
+endi
+
+if $data00 != dd then
+ print =====data00=$data00
+ goto loop10
+endi
+
+
+
+
+
+$loop_count = 0
+loop11:
+
+sleep 300
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+sql select * from result5.streamt51;
+
+if $rows != 1 then
+ print =====rows=$rows
+ print $data00 $data10
+ goto loop11
+endi
+
+if $data01 != 2 then
+ print =====data01=$data01
+ goto loop11
+endi
+
+sql select * from result5.streamt52;
+
+if $rows != 1 then
+ print =====rows=$rows
+ print $data00 $data10
+ goto loop11
+endi
+
+if $data01 != 2 then
+ print =====data01=$data01
+ goto loop11
+endi
+
+sql select * from result5.streamt53;
+
+if $rows != 1 then
+ print =====rows=$rows
+ print $data00 $data10
+ goto loop11
+endi
+
+if $data01 != 2 then
+ print =====data01=$data01
+ goto loop11
+endi
+
+print ======over
+
+system sh/stop_dnodes.sh
diff --git a/tests/system-test/7-tmq/tmqUpdate-1ctb.py b/tests/system-test/7-tmq/tmqUpdate-1ctb.py
index b974e4a41a..db2ec3285d 100644
--- a/tests/system-test/7-tmq/tmqUpdate-1ctb.py
+++ b/tests/system-test/7-tmq/tmqUpdate-1ctb.py
@@ -206,7 +206,7 @@ class TDTestCase:
paraDict['rowsPerTbl'] = self.rowsPerTbl
consumerId = 1
if self.snapshot == 0:
- expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * (2))
+ expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * (1/2))
elif self.snapshot == 1:
expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * (1))
diff --git a/tests/system-test/7-tmq/tmqUpdate-multiCtb-snapshot0.py b/tests/system-test/7-tmq/tmqUpdate-multiCtb-snapshot0.py
index d5df88cf43..daffff44c1 100644
--- a/tests/system-test/7-tmq/tmqUpdate-multiCtb-snapshot0.py
+++ b/tests/system-test/7-tmq/tmqUpdate-multiCtb-snapshot0.py
@@ -213,9 +213,9 @@ class TDTestCase:
paraDict['rowsPerTbl'] = self.rowsPerTbl
consumerId = 1
if self.snapshot == 0:
- expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * (2 + 1/2*1/2*2 + 1/2*1/2))
+ expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * (1/2) * (1/2*3))
elif self.snapshot == 1:
- expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * (2 + 1/2*1/2))
+ expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * (1 + 1/2))
topicList = topicFromStb1
ifcheckdata = 1