diff --git a/docs/en/08-develop/09-udf.md b/docs/en/08-develop/09-udf.md index 4105a89bcf..bf016e8765 100644 --- a/docs/en/08-develop/09-udf.md +++ b/docs/en/08-develop/09-udf.md @@ -585,7 +585,7 @@ def process(block): return result ``` -Crate and test the UDF: +Create and test the UDF: ```sql create function nsum as '/root/udf/nsum.py' outputtype double language 'Python'; diff --git a/docs/en/14-reference/01-components/03-taosadapter.md b/docs/en/14-reference/01-components/03-taosadapter.md index b257633d3b..50b4019fd7 100644 --- a/docs/en/14-reference/01-components/03-taosadapter.md +++ b/docs/en/14-reference/01-components/03-taosadapter.md @@ -66,7 +66,8 @@ Usage of taosAdapter: --cors.allowCredentials cors allow credentials. Env "TAOS_ADAPTER_CORS_ALLOW_Credentials" --cors.allowHeaders stringArray cors allow HEADERS. Env "TAOS_ADAPTER_ALLOW_HEADERS" --cors.allowOrigins stringArray cors allow origins. Env "TAOS_ADAPTER_ALLOW_ORIGINS" - --cors.allowWebSockets cors allow WebSockets. Env "TAOS_ADAPTER_CORS_ALLOW_WebSockets" --cors.exposeHeaders stringArray cors expose headers. Env "TAOS_ADAPTER_Expose_Headers" + --cors.allowWebSockets cors allow WebSockets. Env "TAOS_ADAPTER_CORS_ALLOW_WebSockets" + --cors.exposeHeaders stringArray cors expose headers. Env "TAOS_ADAPTER_Expose_Headers" --debug enable debug mode. Env "TAOS_ADAPTER_DEBUG" (default true) --help Print this help message and exit --httpCodeServerError Use a non-200 http status code when server returns an error. Env "TAOS_ADAPTER_HTTP_CODE_SERVER_ERROR" @@ -87,7 +88,8 @@ Usage of taosAdapter: --monitor.password string TDengine password. Env "TAOS_ADAPTER_MONITOR_PASSWORD" (default "taosdata") --monitor.pauseAllMemoryThreshold float Memory percentage threshold for pause all. Env "TAOS_ADAPTER_MONITOR_PAUSE_ALL_MEMORY_THRESHOLD" (default 80) --monitor.pauseQueryMemoryThreshold float Memory percentage threshold for pause query. Env "TAOS_ADAPTER_MONITOR_PAUSE_QUERY_MEMORY_THRESHOLD" (default 70) - --monitor.user string TDengine user. Env "TAOS_ADAPTER_MONITOR_USER" (default "root") --monitor.writeInterval duration Set write to TDengine interval. Env "TAOS_ADAPTER_MONITOR_WRITE_INTERVAL" (default 30s) + --monitor.user string TDengine user. Env "TAOS_ADAPTER_MONITOR_USER" (default "root") + --monitor.writeInterval duration Set write to TDengine interval. Env "TAOS_ADAPTER_MONITOR_WRITE_INTERVAL" (default 30s) --monitor.writeToTD Whether write metrics to TDengine. Env "TAOS_ADAPTER_MONITOR_WRITE_TO_TD" --node_exporter.caCertFile string node_exporter ca cert file path. Env "TAOS_ADAPTER_NODE_EXPORTER_CA_CERT_FILE" --node_exporter.certFile string node_exporter cert file path. Env "TAOS_ADAPTER_NODE_EXPORTER_CERT_FILE" @@ -123,7 +125,8 @@ Usage of taosAdapter: --restfulRowLimit int restful returns the maximum number of rows (-1 means no limit). Env "TAOS_ADAPTER_RESTFUL_ROW_LIMIT" (default -1) --smlAutoCreateDB Whether to automatically create db when writing with schemaless. Env "TAOS_ADAPTER_SML_AUTO_CREATE_DB" --statsd.allowPendingMessages int statsd allow pending messages. Env "TAOS_ADAPTER_STATSD_ALLOW_PENDING_MESSAGES" (default 50000) - --statsd.db string statsd db name. Env "TAOS_ADAPTER_STATSD_DB" (default "statsd") --statsd.deleteCounters statsd delete counter cache after gather. Env "TAOS_ADAPTER_STATSD_DELETE_COUNTERS" (default true) + --statsd.db string statsd db name. Env "TAOS_ADAPTER_STATSD_DB" (default "statsd") + --statsd.deleteCounters statsd delete counter cache after gather. Env "TAOS_ADAPTER_STATSD_DELETE_COUNTERS" (default true) --statsd.deleteGauges statsd delete gauge cache after gather. Env "TAOS_ADAPTER_STATSD_DELETE_GAUGES" (default true) --statsd.deleteSets statsd delete set cache after gather. Env "TAOS_ADAPTER_STATSD_DELETE_SETS" (default true) --statsd.deleteTimings statsd delete timing cache after gather. Env "TAOS_ADAPTER_STATSD_DELETE_TIMINGS" (default true) @@ -133,7 +136,8 @@ Usage of taosAdapter: --statsd.password string statsd password. Env "TAOS_ADAPTER_STATSD_PASSWORD" (default "taosdata") --statsd.port int statsd server port. Env "TAOS_ADAPTER_STATSD_PORT" (default 6044) --statsd.protocol string statsd protocol [tcp or udp]. Env "TAOS_ADAPTER_STATSD_PROTOCOL" (default "udp") - --statsd.tcpKeepAlive enable tcp keep alive. Env "TAOS_ADAPTER_STATSD_TCP_KEEP_ALIVE" --statsd.ttl int statsd data ttl. Env "TAOS_ADAPTER_STATSD_TTL" + --statsd.tcpKeepAlive enable tcp keep alive. Env "TAOS_ADAPTER_STATSD_TCP_KEEP_ALIVE" + --statsd.ttl int statsd data ttl. Env "TAOS_ADAPTER_STATSD_TTL" --statsd.user string statsd user. Env "TAOS_ADAPTER_STATSD_USER" (default "root") --statsd.worker int statsd write worker. Env "TAOS_ADAPTER_STATSD_WORKER" (default 10) --taosConfigDir string load taos client config path. Env "TAOS_ADAPTER_TAOS_CONFIG_FILE" @@ -168,17 +172,17 @@ See [example/config/taosadapter.toml](https://github.com/taosdata/taosadapter/bl - Compatible with OpenTSDB JSON and telnet format writes - [http://opentsdb.net/docs/build/html/api_http/put.html](http://opentsdb.net/docs/build/html/api_http/put.html) - [http://opentsdb.net/docs/build/html/api_telnet/put.html](http://opentsdb.net/docs/build/html/api_telnet/put.html) -- Seamless connection to collectd +- Seamless connection to collectd. collectd is a system statistics collection daemon, please visit [https://collectd.org/](https://collectd.org/) for more information. -- Seamless connection with StatsD +- Seamless connection with StatsD. StatsD is a simple yet powerful daemon for aggregating statistical information. Please visit [https://github.com/statsd/statsd](https://github.com/statsd/statsd) for more information. -- Seamless connection with icinga2 +- Seamless connection with icinga2. icinga2 is a software that collects inspection result metrics and performance data. Please visit [https://icinga.com/docs/icinga-2/latest/doc/14-features/#opentsdb-writer](https://icinga.com/docs/icinga-2/latest/doc/14-features/#opentsdb-writer) for more information. -- Seamless connection to TCollector +- Seamless connection to TCollector. TCollector is a client process that collects data from a local collector and pushes the data to OpenTSDB. Please visit [http://opentsdb.net/docs/build/html/user_guide/utilities/tcollector.html](http://opentsdb.net/docs/build/html/user_guide/utilities/tcollector.html) for more information. -- Seamless connection to node_exporter +- Seamless connection to node_exporter. node_export is an exporter for machine metrics. Please visit [https://github.com/prometheus/node_exporter](https://github.com/prometheus/node_exporter) for more information. -- Support for Prometheus remote_read and remote_write +- Support for Prometheus remote_read and remote_write. remote_read and remote_write are interfaces for Prometheus data read and write from/to other data storage solution. Please visit [https://prometheus.io/blog/2019/10/10/remote-read-meets-streaming/#remote-apis](https://prometheus.io/blog/2019/10/10/remote-read-meets-streaming/#remote-apis) for more information. - Get table's VGroup ID. diff --git a/docs/en/20-third-party/11-kafka.md b/docs/en/20-third-party/11-kafka.md index b742b334d3..d8d8960392 100644 --- a/docs/en/20-third-party/11-kafka.md +++ b/docs/en/20-third-party/11-kafka.md @@ -231,8 +231,9 @@ Input following content: "config":{ "connector.class": "com.taosdata.kafka.connect.source.TDengineSourceConnector", "tasks.max": 1, + "subscription.group.id": "source-demo", "connection.url": "jdbc:TAOS://127.0.0.1:6030", - "connection.username": "root", + "connection.user": "root", "connection.password": "taosdata", "connection.database": "test", "connection.attempts": 3, diff --git a/docs/examples/JDBC/consumer-demo/pom.xml b/docs/examples/JDBC/consumer-demo/pom.xml index 6199efb76e..ad0f6cd6a1 100644 --- a/docs/examples/JDBC/consumer-demo/pom.xml +++ b/docs/examples/JDBC/consumer-demo/pom.xml @@ -17,7 +17,7 @@ com.taosdata.jdbc taos-jdbcdriver - 3.2.1 + 3.3.0 com.google.guava diff --git a/docs/examples/c/with_reqid_demo.c b/docs/examples/c/with_reqid_demo.c index 0cfedf3b3d..2e1cc50e2b 100644 --- a/docs/examples/c/with_reqid_demo.c +++ b/docs/examples/c/with_reqid_demo.c @@ -45,7 +45,7 @@ static int DemoWithReqId() { TAOS_RES *result = taos_query_with_reqid(taos, sql, reqid); code = taos_errno(result); if (code != 0) { - fprintf(stderr, "Failed to execute sql with qid: %ld, ErrCode: 0x%x, ErrMessage: %s\n.", reqid, code, + fprintf(stderr, "Failed to execute sql withQID: %ld, ErrCode: 0x%x, ErrMessage: %s\n.", reqid, code, taos_errstr(result)); taos_close(taos); taos_cleanup(); diff --git a/docs/zh/14-reference/01-components/01-taosd.md b/docs/zh/14-reference/01-components/01-taosd.md index ba17126a92..004116b478 100644 --- a/docs/zh/14-reference/01-components/01-taosd.md +++ b/docs/zh/14-reference/01-components/01-taosd.md @@ -51,7 +51,7 @@ taosd 命令行参数如下 | 参数名称 | 参数说明 | | :--------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | -| queryPolicy | 查询策略,1: 只使用 vnode,不使用 qnode; 2: 没有扫描算子的子任务在 qnode 执行,带扫描算子的子任务在 vnode 执行; 3: vnode 只运行扫描算子,其余算子均在 qnode 执行 ;缺省值:1 | +| queryPolicy | 查询策略,1: 只使用 vnode,不使用 qnode; 2: 没有扫描算子的子任务在 qnode 执行,带扫描算子的子任务在 vnode 执行; 3: vnode 只运行扫描算子,其余算子均在 qnode 执行 ;4: 使用客户端聚合模式;缺省值:1 | | maxNumOfDistinctRes | 允许返回的 distinct 结果最大行数,默认值 10 万,最大允许值 1 亿 | | countAlwaysReturnValue | count/hyperloglog函数在输入数据为空或者NULL的情况下是否返回值,0: 返回空行,1: 返回;该参数设置为 1 时,如果查询中含有 INTERVAL 子句或者该查询使用了TSMA时, 且相应的组或窗口内数据为空或者NULL, 对应的组或窗口将不返回查询结果. 注意此参数客户端和服务端值应保持一致. | diff --git a/docs/zh/14-reference/01-components/02-taosc.md b/docs/zh/14-reference/01-components/02-taosc.md index d198890bd9..dfcdf22aac 100644 --- a/docs/zh/14-reference/01-components/02-taosc.md +++ b/docs/zh/14-reference/01-components/02-taosc.md @@ -41,4 +41,4 @@ TDengine 客户端驱动提供了应用编程所需要的全部 API,并且在 ## API -请参考[连接器] \ No newline at end of file +请参考[连接器](../../connector) \ No newline at end of file diff --git a/docs/zh/14-reference/01-components/03-taosadapter.md b/docs/zh/14-reference/01-components/03-taosadapter.md index 97f2ab4074..ed90f54bca 100644 --- a/docs/zh/14-reference/01-components/03-taosadapter.md +++ b/docs/zh/14-reference/01-components/03-taosadapter.md @@ -66,13 +66,15 @@ Usage of taosAdapter: --cors.allowCredentials cors allow credentials. Env "TAOS_ADAPTER_CORS_ALLOW_Credentials" --cors.allowHeaders stringArray cors allow HEADERS. Env "TAOS_ADAPTER_ALLOW_HEADERS" --cors.allowOrigins stringArray cors allow origins. Env "TAOS_ADAPTER_ALLOW_ORIGINS" - --cors.allowWebSockets cors allow WebSockets. Env "TAOS_ADAPTER_CORS_ALLOW_WebSockets" --cors.exposeHeaders stringArray cors expose headers. Env "TAOS_ADAPTER_Expose_Headers" + --cors.allowWebSockets cors allow WebSockets. Env "TAOS_ADAPTER_CORS_ALLOW_WebSockets" + --cors.exposeHeaders stringArray cors expose headers. Env "TAOS_ADAPTER_Expose_Headers" --debug enable debug mode. Env "TAOS_ADAPTER_DEBUG" (default true) --help Print this help message and exit --httpCodeServerError Use a non-200 http status code when server returns an error. Env "TAOS_ADAPTER_HTTP_CODE_SERVER_ERROR" --influxdb.enable enable influxdb. Env "TAOS_ADAPTER_INFLUXDB_ENABLE" (default true) --log.enableRecordHttpSql whether to record http sql. Env "TAOS_ADAPTER_LOG_ENABLE_RECORD_HTTP_SQL" - --log.path string log path. Env "TAOS_ADAPTER_LOG_PATH" (default "/var/log/taos") --log.rotationCount uint log rotation count. Env "TAOS_ADAPTER_LOG_ROTATION_COUNT" (default 30) + --log.path string log path. Env "TAOS_ADAPTER_LOG_PATH" (default "/var/log/taos") + --log.rotationCount uint log rotation count. Env "TAOS_ADAPTER_LOG_ROTATION_COUNT" (default 30) --log.rotationSize string log rotation size(KB MB GB), must be a positive integer. Env "TAOS_ADAPTER_LOG_ROTATION_SIZE" (default "1GB") --log.rotationTime duration log rotation time. Env "TAOS_ADAPTER_LOG_ROTATION_TIME" (default 24h0m0s) --log.sqlRotationCount uint record sql log rotation count. Env "TAOS_ADAPTER_LOG_SQL_ROTATION_COUNT" (default 2) @@ -87,7 +89,8 @@ Usage of taosAdapter: --monitor.password string TDengine password. Env "TAOS_ADAPTER_MONITOR_PASSWORD" (default "taosdata") --monitor.pauseAllMemoryThreshold float Memory percentage threshold for pause all. Env "TAOS_ADAPTER_MONITOR_PAUSE_ALL_MEMORY_THRESHOLD" (default 80) --monitor.pauseQueryMemoryThreshold float Memory percentage threshold for pause query. Env "TAOS_ADAPTER_MONITOR_PAUSE_QUERY_MEMORY_THRESHOLD" (default 70) - --monitor.user string TDengine user. Env "TAOS_ADAPTER_MONITOR_USER" (default "root") --monitor.writeInterval duration Set write to TDengine interval. Env "TAOS_ADAPTER_MONITOR_WRITE_INTERVAL" (default 30s) + --monitor.user string TDengine user. Env "TAOS_ADAPTER_MONITOR_USER" (default "root") + --monitor.writeInterval duration Set write to TDengine interval. Env "TAOS_ADAPTER_MONITOR_WRITE_INTERVAL" (default 30s) --monitor.writeToTD Whether write metrics to TDengine. Env "TAOS_ADAPTER_MONITOR_WRITE_TO_TD" --node_exporter.caCertFile string node_exporter ca cert file path. Env "TAOS_ADAPTER_NODE_EXPORTER_CA_CERT_FILE" --node_exporter.certFile string node_exporter cert file path. Env "TAOS_ADAPTER_NODE_EXPORTER_CERT_FILE" @@ -123,7 +126,8 @@ Usage of taosAdapter: --restfulRowLimit int restful returns the maximum number of rows (-1 means no limit). Env "TAOS_ADAPTER_RESTFUL_ROW_LIMIT" (default -1) --smlAutoCreateDB Whether to automatically create db when writing with schemaless. Env "TAOS_ADAPTER_SML_AUTO_CREATE_DB" --statsd.allowPendingMessages int statsd allow pending messages. Env "TAOS_ADAPTER_STATSD_ALLOW_PENDING_MESSAGES" (default 50000) - --statsd.db string statsd db name. Env "TAOS_ADAPTER_STATSD_DB" (default "statsd") --statsd.deleteCounters statsd delete counter cache after gather. Env "TAOS_ADAPTER_STATSD_DELETE_COUNTERS" (default true) + --statsd.db string statsd db name. Env "TAOS_ADAPTER_STATSD_DB" (default "statsd") + --statsd.deleteCounters statsd delete counter cache after gather. Env "TAOS_ADAPTER_STATSD_DELETE_COUNTERS" (default true) --statsd.deleteGauges statsd delete gauge cache after gather. Env "TAOS_ADAPTER_STATSD_DELETE_GAUGES" (default true) --statsd.deleteSets statsd delete set cache after gather. Env "TAOS_ADAPTER_STATSD_DELETE_SETS" (default true) --statsd.deleteTimings statsd delete timing cache after gather. Env "TAOS_ADAPTER_STATSD_DELETE_TIMINGS" (default true) @@ -133,7 +137,8 @@ Usage of taosAdapter: --statsd.password string statsd password. Env "TAOS_ADAPTER_STATSD_PASSWORD" (default "taosdata") --statsd.port int statsd server port. Env "TAOS_ADAPTER_STATSD_PORT" (default 6044) --statsd.protocol string statsd protocol [tcp or udp]. Env "TAOS_ADAPTER_STATSD_PROTOCOL" (default "udp") - --statsd.tcpKeepAlive enable tcp keep alive. Env "TAOS_ADAPTER_STATSD_TCP_KEEP_ALIVE" --statsd.ttl int statsd data ttl. Env "TAOS_ADAPTER_STATSD_TTL" + --statsd.tcpKeepAlive enable tcp keep alive. Env "TAOS_ADAPTER_STATSD_TCP_KEEP_ALIVE" + --statsd.ttl int statsd data ttl. Env "TAOS_ADAPTER_STATSD_TTL" --statsd.user string statsd user. Env "TAOS_ADAPTER_STATSD_USER" (default "root") --statsd.worker int statsd write worker. Env "TAOS_ADAPTER_STATSD_WORKER" (default 10) --taosConfigDir string load taos client config path. Env "TAOS_ADAPTER_TAOS_CONFIG_FILE" @@ -166,19 +171,19 @@ AllowWebSockets - 兼容 InfluxDB v1 写接口 [https://docs.influxdata.com/influxdb/v2.0/reference/api/influxdb-1x/write/](https://docs.influxdata.com/influxdb/v2.0/reference/api/influxdb-1x/write/) - 兼容 OpenTSDB JSON 和 telnet 格式写入 - - \ - - \ -- 与 collectd 无缝连接 + - \ + - \ +- 与 collectd 无缝连接。 collectd 是一个系统统计收集守护程序,请访问 [https://collectd.org/](https://collectd.org/) 了解更多信息。 -- Seamless connection with StatsD +- Seamless connection with StatsD。 StatsD 是一个简单而强大的统计信息汇总的守护程序。请访问 [https://github.com/statsd/statsd](https://github.com/statsd/statsd) 了解更多信息。 -- 与 icinga2 的无缝连接 +- 与 icinga2 的无缝连接。 icinga2 是一个收集检查结果指标和性能数据的软件。请访问 [https://icinga.com/docs/icinga-2/latest/doc/14-features/#opentsdb-writer](https://icinga.com/docs/icinga-2/latest/doc/14-features/#opentsdb-writer) 了解更多信息。 -- 与 tcollector 无缝连接 +- 与 tcollector 无缝连接。 TCollector是一个客户端进程,从本地收集器收集数据,并将数据推送到 OpenTSDB。请访问 [http://opentsdb.net/docs/build/html/user_guide/utilities/tcollector.html](http://opentsdb.net/docs/build/html/user_guide/utilities/tcollector.html) 了解更多信息。 -- 无缝连接 node_exporter +- 无缝连接 node_exporter。 node_export 是一个机器指标的导出器。请访问 [https://github.com/prometheus/node_exporter](https://github.com/prometheus/node_exporter) 了解更多信息。 -- 支持 Prometheus remote_read 和 remote_write +- 支持 Prometheus remote_read 和 remote_write。 remote_read 和 remote_write 是 Prometheus 数据读写分离的集群方案。请访问[https://prometheus.io/blog/2019/10/10/remote-read-meets-streaming/#remote-apis](https://prometheus.io/blog/2019/10/10/remote-read-meets-streaming/#remote-apis) 了解更多信息。 - 获取 table 所在的虚拟节点组(VGroup)的 VGroup ID。 @@ -186,15 +191,11 @@ AllowWebSockets ### TDengine RESTful 接口 -您可以使用任何支持 http 协议的客户端通过访问 RESTful 接口地址 `http://:6041/rest/sql` 来写入数据到 TDengine 或从 TDengine 中查询数据。细节请参考[官方文档](../../connector/rest-api/)。 +您可以使用任何支持 http 协议的客户端通过访问 RESTful 接口地址 `http://:6041/rest/sql` 来写入数据到 TDengine 或从 TDengine 中查询数据。细节请参考[REST API 文档](../../connector/rest-api/)。 ### InfluxDB -您可以使用任何支持 http 协议的客户端访问 Restful 接口地址 `http://:6041/` 来写入 InfluxDB 兼容格式的数据到 TDengine。EndPoint 如下: - -```text -/influxdb/v1/write -``` +您可以使用任何支持 http 协议的客户端访问 Restful 接口地址 `http://:6041/influxdb/v1/write` 来写入 InfluxDB 兼容格式的数据到 TDengine。 支持 InfluxDB 参数如下: diff --git a/docs/zh/14-reference/01-components/06-taoskeeper.md b/docs/zh/14-reference/01-components/06-taoskeeper.md index f40b34ebeb..6f0684bcbc 100644 --- a/docs/zh/14-reference/01-components/06-taoskeeper.md +++ b/docs/zh/14-reference/01-components/06-taoskeeper.md @@ -293,6 +293,212 @@ taos_cluster_info_first_ep{cluster_id="554014120921134497",value="tdengine:6030" taos_cluster_info_first_ep_dnode_id{cluster_id="554014120921134497"} 1 ``` +### 监控指标详情 + +#### taosd 集群 + +##### 监控信息支持的标签 +- `cluster_id`: 集群 id + +##### 相关指标及其含义 +| 指标名称 | 类型 | 含义 | +| ----------------------------------- | ------- | ------------------------------------- | +| taos_cluster_info_connections_total | counter | 总连接数 | +| taos_cluster_info_dbs_total | counter | 数据库总数 | +| taos_cluster_info_dnodes_alive | counter | 存活的 dnode 数量 | +| taos_cluster_info_dnodes_total | counter | dnode 总数 | +| taos_cluster_info_first_ep | gauge | 第一个端点,标签 value 表示端点值 | +| taos_cluster_info_first_ep_dnode_id | counter | 第一个端点的 dnode id | +| taos_cluster_info_master_uptime | gauge | 主节点运行时间,单位天 | +| taos_cluster_info_mnodes_alive | counter | 存活的 mnode 数量 | +| taos_cluster_info_mnodes_total | counter | mnode 总数 | +| taos_cluster_info_stbs_total | counter | 超级表总数 | +| taos_cluster_info_streams_total | counter | 流总数 | +| taos_cluster_info_tbs_total | counter | 表总数 | +| taos_cluster_info_topics_total | counter | 主题总数 | +| taos_cluster_info_version | gauge | 版本信息,标签 value 表示版本号 | +| taos_cluster_info_vgroups_alive | counter | 存活的虚拟组数量 | +| taos_cluster_info_vgroups_total | counter | 虚拟组总数 | +| taos_cluster_info_vnodes_alive | counter | 存活的虚拟节点数量 | +| taos_cluster_info_vnodes_total | counter | 虚拟节点总数 | +| taos_grants_info_expire_time | counter | 集群授权过期剩余时间(单位 秒) | +| taos_grants_info_timeseries_total | counter | 集群授权允许使用 time series 的总数量 | +| taos_grants_info_timeseries_used | counter | 集群已拥有的 time series 的数量 | + +#### dnode + +##### 监控信息支持的标签 +- `cluster_id`: 集群 id +- `dnode_ep`: dnode 端点 +- `dnode_id`:dnode id + +##### 相关指标及其含义 +| 指标名称 | 类型 | 含义 | +| ------------------------------ | ------- | ---------------------------------------------------------------------------------------- | +| taos_d_info_status | gauge | dnode 状态,标签 value 表示状态, ready 表示正常, offline 表示下线, unknown 表示未知。 | +| taos_dnodes_info_cpu_cores | gauge | CPU 核心数 | +| taos_dnodes_info_cpu_engine | gauge | 该 dnode 的进程所使用的 CPU 百分比(取值范围 0~100) | +| taos_dnodes_info_cpu_system | gauge | 该 dnode 所在节点的系统使用的 CPU 百分比(取值范围 0~100) | +| taos_dnodes_info_disk_engine | counter | 该 dnode 的进程使用的磁盘容量(单位 Byte) | +| taos_dnodes_info_disk_total | counter | 该 dnode 所在节点的磁盘总容量(单位 Byte) | +| taos_dnodes_info_disk_used | counter | 该 dnode 所在节点的磁盘已使用的容量(单位 Byte) | +| taos_dnodes_info_has_mnode | counter | 是否有 mnode | +| taos_dnodes_info_has_qnode | counter | 是否有 qnode | +| taos_dnodes_info_has_snode | counter | 是否有 snode | +| taos_dnodes_info_io_read | gauge | 该 dnode 所在节点的 io 读取速率(单位 Byte/s) | +| taos_dnodes_info_io_read_disk | gauge | 该 dnode 所在节点的磁盘 io 写入取速率(单位 Byte/s) | +| taos_dnodes_info_io_write | gauge | 该 dnode 所在节点的 io 写入取速率(单位 Byte/s) | +| taos_dnodes_info_io_write_disk | gauge | 该 dnode 所在节点的磁盘 io 写入取速率(单位 Byte/s) | +| taos_dnodes_info_masters | counter | 主节点数量 | +| taos_dnodes_info_mem_engine | counter | 该 dnode 的进程所使用的内存(单位 KB) | +| taos_dnodes_info_mem_system | counter | 该 dnode 所在节的系统所使用的内存(单位 KB) | +| taos_dnodes_info_mem_total | counter | 该 dnode 所在节点的总内存(单位 KB) | +| taos_dnodes_info_net_in | gauge | 该 dnode 所在节点的网络传入速率(单位 Byte/s) | +| taos_dnodes_info_net_out | gauge | 该 dnode 所在节点的网络传出速率(单位 Byte/s) | +| taos_dnodes_info_uptime | gauge | 该 dnode 的启动时间(单位 秒) | +| taos_dnodes_info_vnodes_num | counter | 该 dnode 所在节点的 vnode 数量 | + +#### 数据目录 + +##### 监控信息支持的标签 +- `cluster_id`: 集群 id +- `dnode_ep`: dnode 端点 +- `dnode_id`:dnode id +- `data_dir_name`:数据目录名 +- `data_dir_level`:数据目录级别 + +##### 相关指标及其含义 +| 指标名称 | 类型 | 含义 | +| --------------------------------- | ----- | -------------------- | +| taos_taosd_dnodes_data_dirs_avail | gauge | 可用空间(单位 Byte) | +| taos_taosd_dnodes_data_dirs_total | gauge | 总空间(单位 Byte) | +| taos_taosd_dnodes_data_dirs_used | gauge | 已用空间(单位 Byte) | + +#### 日志目录 + +##### 监控信息支持的标签 +- `cluster_id`: 集群 id +- `dnode_ep`: dnode 端点 +- `dnode_id`:dnode id +- `log_dir_name`:日志目录名 + +##### 相关指标及其含义 +| 指标名称 | 类型 | 含义 | +| -------------------------------- | ----- | -------------------- | +| taos_taosd_dnodes_log_dirs_avail | gauge | 可用空间(单位 Byte) | +| taos_taosd_dnodes_log_dirs_total | gauge | 总空间(单位 Byte) | +| taos_taosd_dnodes_log_dirs_used | gauge | 已用空间(单位 Byte) | + +#### 日志数量 + +##### 监控信息支持的标签 +- `cluster_id`: 集群 id +- `dnode_ep`: dnode 端点 +- `dnode_id`:dnode id + +##### 相关指标及其含义 +| 指标名称 | 类型 | 含义 | +| ---------------------- | ------- | ------------ | +| taos_log_summary_debug | counter | 调试日志数量 | +| taos_log_summary_error | counter | 错误日志数量 | +| taos_log_summary_info | counter | 信息日志数量 | +| taos_log_summary_trace | counter | 跟踪日志数量 | + + +#### taosadapter + +##### 监控信息支持的标签 +- `endpoint`:端点 +- `req_type`:请求类型,0 表示 rest,1 表示 websocket + +##### 相关指标及其含义 +| 指标名称 | 类型 | 含义 | +| -------------------------------------- | ------- | -------------------- | +| taos_adapter_requests_fail | counter | 失败的请求数 | +| taos_adapter_requests_in_process | counter | 正在处理的请求数 | +| taos_adapter_requests_other | counter | 其他类型的请求数 | +| taos_adapter_requests_other_fail | counter | 其他类型的失败请求数 | +| taos_adapter_requests_other_success | counter | 其他类型的成功请求数 | +| taos_adapter_requests_query | counter | 查询请求数 | +| taos_adapter_requests_query_fail | counter | 查询失败请求数 | +| taos_adapter_requests_query_in_process | counter | 正在处理的查询请求数 | +| taos_adapter_requests_query_success | counter | 查询成功请求数 | +| taos_adapter_requests_success | counter | 成功的请求数 | +| taos_adapter_requests_total | counter | 总请求数 | +| taos_adapter_requests_write | counter | 写请求数 | +| taos_adapter_requests_write_fail | counter | 写失败请求数 | +| taos_adapter_requests_write_in_process | counter | 正在处理的写请求数 | +| taos_adapter_requests_write_success | counter | 写成功请求数 | + +#### taoskeeper + +##### 监控信息支持的标签 +- `identify`: 节点 endpoint + +##### 相关指标及其含义 +| 指标名称 | 类型 | 含义 | +| ----------------------- | ----- | ------------------------------------- | +| taos_keeper_monitor_cpu | gauge | taoskeeper CPU 使用率(取值范围 0~1) | +| taos_keeper_monitor_mem | gauge | taoskeeper 内存使用率(取值范围 0~1) | + +#### 其他 taosd 集群监控项 + +##### taos_m_info_role +- **标签**: + - `cluster_id`: 集群 id + - `mnode_ep`: mnode 端点 + - `mnode_id`: mnode id + - `value`: 角色值(该 mnode 的状态,取值范围:offline, follower, candidate, leader, error, learner) +- **类型**: gauge +- **含义**: mnode 角色 + +##### taos_taos_sql_req_count +- **标签**: + - `cluster_id`: 集群 id + - `result`: 请求结果(取值范围: Success, Failed) + - `sql_type`: SQL 类型(取值范围:select, insert,inserted_rows, delete) + - `username`: 用户名 +- **类型**: gauge +- **含义**: SQL 请求数量 + +##### taos_taosd_sql_req_count +- **标签**: + - `cluster_id`: 集群 id + - `dnode_ep`: dnode 端点 + - `dnode_id`: dnode id + - `result`: 请求结果(取值范围: Success, Failed) + - `sql_type`: SQL 类型(取值范围:select, insert,inserted_rows, delete) + - `username`: 用户名 + - `vgroup_id`: 虚拟组 id +- **类型**: gauge +- **含义**: SQL 请求数量 + +##### taos_taosd_vgroups_info_status +- **标签**: + - `cluster_id`: 集群 id + - `database_name`: 数据库名称 + - `vgroup_id`: 虚拟组 id +- **类型**: gauge +- **含义**: 虚拟组状态。 0 为 unsynced,表示没有leader选出;1 为 ready。 + +##### taos_taosd_vgroups_info_tables_num +- **标签**: + - `cluster_id`: 集群 id + - `database_name`: 数据库名称 + - `vgroup_id`: 虚拟组 id +- **类型**: gauge +- **含义**: 虚拟组表数量 + +##### taos_taosd_vnodes_info_role +- **标签**: + - `cluster_id`: 集群 id + - `database_name`: 数据库名称 + - `dnode_id`: dnode id + - `value`: 角色值(取值范围:offline, follower, candidate, leader, error, learner) + - `vgroup_id`: 虚拟组 id +- **类型**: gauge +- **含义**: 虚拟节点角色 + ### 抽取配置 diff --git a/docs/zh/20-third-party/01-collection/11-kafka.md b/docs/zh/20-third-party/01-collection/11-kafka.md index e9ac68251c..d9a416aa40 100644 --- a/docs/zh/20-third-party/01-collection/11-kafka.md +++ b/docs/zh/20-third-party/01-collection/11-kafka.md @@ -229,8 +229,9 @@ vi source-demo.json "config":{ "connector.class": "com.taosdata.kafka.connect.source.TDengineSourceConnector", "tasks.max": 1, + "subscription.group.id": "source-demo", "connection.url": "jdbc:TAOS://127.0.0.1:6030", - "connection.username": "root", + "connection.user": "root", "connection.password": "taosdata", "connection.database": "test", "connection.attempts": 3, @@ -389,12 +390,12 @@ curl -X DELETE http://localhost:8083/connectors/TDengineSourceConnector ## 其他说明 -1. 关于如何在独立安装的 Kafka 环境使用 Kafka Connect 插件, 请参考官方文档:\。 +1. 关于如何在独立安装的 Kafka 环境使用 Kafka Connect 插件, 请参考官方文档:[https://kafka.apache.org/documentation/#connect](https://kafka.apache.org/documentation/#connect)。 ## 问题反馈 -无论遇到任何问题,都欢迎在本项目的 Github 仓库反馈:\。 +无论遇到任何问题,都欢迎在本项目的 Github 仓库反馈:[https://github.com/taosdata/kafka-connect-tdengine/issues](https://github.com/taosdata/kafka-connect-tdengine/issues)。 ## 参考 -1. \ +1. [https://kafka.apache.org/documentation/](https://kafka.apache.org/documentation/) diff --git a/docs/zh/26-tdinternal/11-compress.md b/docs/zh/26-tdinternal/11-compress.md index 05ad2d60f6..10625a3606 100644 --- a/docs/zh/26-tdinternal/11-compress.md +++ b/docs/zh/26-tdinternal/11-compress.md @@ -4,8 +4,6 @@ title: 数据压缩 toc_max_heading_level: 4 --- -## 概述 - 数据压缩是一种在不损失数据有效信息的前提下,利用特定算法对数据进行重新组织和处理,以减少数据占用的存储空间和提高数据传输效率的技术。TDengine 在数据的存储和传输过程中均采用了这一技术,旨在优化存储资源的使用并加快数据交换的速度。 @@ -58,4 +56,4 @@ TDengine 在数据传输过程中提供了压缩功能,以减少网络带宽 下图展示了 TDengine 引擎在时序数据的整个传输及存储过程中的压缩及解压过程,以更好地理解整个处理过程。 -![TDengine 针对时序数据的压缩及解压过程](./compression.png) \ No newline at end of file +![TDengine 针对时序数据的压缩及解压过程](./compression.png) diff --git a/include/client/taos.h b/include/client/taos.h index 6a352de0ff..11785dc40c 100644 --- a/include/client/taos.h +++ b/include/client/taos.h @@ -253,6 +253,7 @@ DLL_EXPORT int taos_select_db(TAOS *taos, const char *db); DLL_EXPORT int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int num_fields); DLL_EXPORT void taos_stop_query(TAOS_RES *res); DLL_EXPORT bool taos_is_null(TAOS_RES *res, int32_t row, int32_t col); +DLL_EXPORT int taos_is_null_by_column(TAOS_RES *res, int columnIndex, bool result[], int *rows); DLL_EXPORT bool taos_is_update_query(TAOS_RES *res); DLL_EXPORT int taos_fetch_block(TAOS_RES *res, TAOS_ROW *rows); DLL_EXPORT int taos_fetch_block_s(TAOS_RES *res, int *numOfRows, TAOS_ROW *rows); diff --git a/include/common/tcol.h b/include/common/tcol.h index 38f7130cbf..cbe72bbc94 100644 --- a/include/common/tcol.h +++ b/include/common/tcol.h @@ -59,6 +59,7 @@ #define TSDB_CL_COMMENT_LEN 1025 #define TSDB_CL_COMPRESS_OPTION_LEN 12 +#define TSDB_CL_OPTION_LEN 9 extern const char* supportedEncode[5]; extern const char* supportedCompress[6]; diff --git a/include/common/tdatablock.h b/include/common/tdatablock.h index 080416ca2e..b4dd6d61e4 100644 --- a/include/common/tdatablock.h +++ b/include/common/tdatablock.h @@ -113,10 +113,8 @@ static FORCE_INLINE bool colDataIsNull(const SColumnInfoData* pColumnInfoData, u if (pColAgg != NULL && pColAgg->colId != -1) { if (pColAgg->numOfNull == totalRows) { - ASSERT(pColumnInfoData->nullbitmap == NULL); return true; } else if (pColAgg->numOfNull == 0) { - ASSERT(pColumnInfoData->nullbitmap == NULL); return false; } } @@ -159,40 +157,32 @@ static FORCE_INLINE void colDataSetNNULL(SColumnInfoData* pColumnInfoData, uint3 } static FORCE_INLINE void colDataSetInt8(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, int8_t* v) { - ASSERT(pColumnInfoData->info.type == TSDB_DATA_TYPE_TINYINT || - pColumnInfoData->info.type == TSDB_DATA_TYPE_UTINYINT || pColumnInfoData->info.type == TSDB_DATA_TYPE_BOOL); char* p = pColumnInfoData->pData + pColumnInfoData->info.bytes * rowIndex; *(int8_t*)p = *(int8_t*)v; } static FORCE_INLINE void colDataSetInt16(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, int16_t* v) { - ASSERT(pColumnInfoData->info.type == TSDB_DATA_TYPE_SMALLINT || - pColumnInfoData->info.type == TSDB_DATA_TYPE_USMALLINT); char* p = pColumnInfoData->pData + pColumnInfoData->info.bytes * rowIndex; *(int16_t*)p = *(int16_t*)v; } static FORCE_INLINE void colDataSetInt32(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, int32_t* v) { - ASSERT(pColumnInfoData->info.type == TSDB_DATA_TYPE_INT || pColumnInfoData->info.type == TSDB_DATA_TYPE_UINT); char* p = pColumnInfoData->pData + pColumnInfoData->info.bytes * rowIndex; *(int32_t*)p = *(int32_t*)v; } static FORCE_INLINE void colDataSetInt64(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, int64_t* v) { int32_t type = pColumnInfoData->info.type; - ASSERT(type == TSDB_DATA_TYPE_BIGINT || type == TSDB_DATA_TYPE_UBIGINT || type == TSDB_DATA_TYPE_TIMESTAMP); char* p = pColumnInfoData->pData + pColumnInfoData->info.bytes * rowIndex; *(int64_t*)p = *(int64_t*)v; } static FORCE_INLINE void colDataSetFloat(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, float* v) { - ASSERT(pColumnInfoData->info.type == TSDB_DATA_TYPE_FLOAT); char* p = pColumnInfoData->pData + pColumnInfoData->info.bytes * rowIndex; *(float*)p = *(float*)v; } static FORCE_INLINE void colDataSetDouble(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, double* v) { - ASSERT(pColumnInfoData->info.type == TSDB_DATA_TYPE_DOUBLE); char* p = pColumnInfoData->pData + pColumnInfoData->info.bytes * rowIndex; *(double*)p = *(double*)v; } diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index c22808e033..09408a9826 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -397,9 +397,6 @@ #define TK_VALUES 379 #define TK_VARIABLE 380 #define TK_WAL 381 -#define TK_ENCODE 382 -#define TK_COMPRESS 383 -#define TK_LEVEL 384 #define TK_NK_SPACE 600 #define TK_NK_COMMENT 601 diff --git a/include/libs/nodes/querynodes.h b/include/libs/nodes/querynodes.h index 4bf0663def..b1d8be2f0e 100644 --- a/include/libs/nodes/querynodes.h +++ b/include/libs/nodes/querynodes.h @@ -61,6 +61,7 @@ typedef struct SExprNode { bool asAlias; bool asParam; bool asPosition; + int32_t projIdx; } SExprNode; typedef enum EColumnType { @@ -91,6 +92,8 @@ typedef struct SColumnNode { int16_t numOfPKs; bool tableHasPk; bool isPk; + int32_t projRefIdx; + int32_t resIdx; } SColumnNode; typedef struct SColumnRefNode { @@ -214,6 +217,7 @@ typedef struct SRealTableNode { double ratio; SArray* pSmaIndexes; int8_t cacheLastMode; + int8_t stbRewrite; SArray* pTsmas; SArray* tsmaTargetTbVgInfo; // SArray, used for child table or normal table only SArray* tsmaTargetTbInfo; // SArray, used for child table or normal table only diff --git a/include/libs/stream/tstream.h b/include/libs/stream/tstream.h index b0b5a64a50..20f91106a5 100644 --- a/include/libs/stream/tstream.h +++ b/include/libs/stream/tstream.h @@ -272,24 +272,35 @@ typedef struct SCheckpointInfo { int64_t processedVer; int64_t nextProcessVer; // current offset in WAL, not serialize it int64_t msgVer; - int32_t consensusTransId; // consensus checkpoint id SActiveCheckpointInfo* pActiveInfo; } SCheckpointInfo; +typedef enum { + TASK_CONSEN_CHKPT_REQ = 0x1, + TASK_CONSEN_CHKPT_SEND = 0x2, + TASK_CONSEN_CHKPT_RECV = 0x3, +} EConsenChkptStatus; + +typedef struct SConsenChkptInfo { +// bool alreadySendChkptId; + EConsenChkptStatus status; + int64_t statusTs; + int32_t consenChkptTransId; +} SConsenChkptInfo; + typedef struct SStreamStatus { - SStreamTaskSM* pSM; - int8_t taskStatus; - int8_t downstreamReady; // downstream tasks are all ready now, if this flag is set - int8_t schedStatus; - int8_t statusBackup; - int32_t schedIdleTime; // idle time before invoke again - int32_t timerActive; // timer is active - int64_t lastExecTs; // last exec time stamp - int32_t inScanHistorySentinel; - bool appendTranstateBlock; // has append the transfer state data block already - bool removeBackendFiles; // remove backend files on disk when free stream tasks - bool sendConsensusChkptId; - bool requireConsensusChkptId; + SStreamTaskSM* pSM; + int8_t taskStatus; + int8_t downstreamReady; // downstream tasks are all ready now, if this flag is set + int8_t schedStatus; + int8_t statusBackup; + int32_t schedIdleTime; // idle time before invoke again + int32_t timerActive; // timer is active + int64_t lastExecTs; // last exec time stamp + int32_t inScanHistorySentinel; + bool appendTranstateBlock; // has append the transfer state data block already + bool removeBackendFiles; // remove backend files on disk when free stream tasks + SConsenChkptInfo consenChkptInfo; } SStreamStatus; typedef struct SDataRange { @@ -774,6 +785,9 @@ int32_t streamMetaStopAllTasks(SStreamMeta* pMeta); int32_t streamMetaStartOneTask(SStreamMeta* pMeta, int64_t streamId, int32_t taskId); bool streamMetaAllTasksReady(const SStreamMeta* pMeta); int32_t streamTaskSendNegotiateChkptIdMsg(SStreamTask* pTask); +int32_t streamTaskCheckIfReqConsenChkptId(SStreamTask* pTask, int64_t ts); +void streamTaskSetConsenChkptIdRecv(SStreamTask* pTask, int32_t transId, int64_t ts); +void streamTaskSetReqConsenChkptId(SStreamTask* pTask, int64_t ts); // timer int32_t streamTimerGetInstance(tmr_h* pTmr); diff --git a/include/os/osThread.h b/include/os/osThread.h index 38c1b366f0..73c499b1dc 100644 --- a/include/os/osThread.h +++ b/include/os/osThread.h @@ -22,8 +22,12 @@ extern "C" { #endif -#if defined(WINDOWS) && !defined(__USE_PTHREAD) +#ifdef WINDOWS +#include #include +#endif + +#if defined(WINDOWS) && !defined(__USE_PTHREAD) #define __USE_WIN_THREAD // https://learn.microsoft.com/en-us/windows/win32/winprog/using-the-windows-headers // #ifndef _WIN32_WINNT @@ -275,6 +279,10 @@ int32_t taosThreadSpinUnlock(TdThreadSpinlock *lock); void taosThreadTestCancel(void); void taosThreadClear(TdThread *thread); +#ifdef WINDOWS +bool taosThreadIsMain(); +#endif + #ifdef __cplusplus } #endif diff --git a/include/util/taoserror.h b/include/util/taoserror.h index 02e6a49bb6..4591c7fbcc 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -969,7 +969,8 @@ int32_t taosGetErrSize(); #define TSDB_CODE_STREAM_INVALID_STATETRANS TAOS_DEF_ERROR_CODE(0, 0x4103) #define TSDB_CODE_STREAM_TASK_IVLD_STATUS TAOS_DEF_ERROR_CODE(0, 0x4104) #define TSDB_CODE_STREAM_NOT_LEADER TAOS_DEF_ERROR_CODE(0, 0x4105) -#define TSDB_CODE_STREAM_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x4106) +#define TSDB_CODE_STREAM_CONFLICT_EVENT TAOS_DEF_ERROR_CODE(0, 0x4106) +#define TSDB_CODE_STREAM_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x4107) // TDLite #define TSDB_CODE_TDLITE_IVLD_OPEN_FLAGS TAOS_DEF_ERROR_CODE(0, 0x5100) diff --git a/include/util/tgeosctx.h b/include/util/tgeosctx.h index 267ba9e049..6c27d24dac 100644 --- a/include/util/tgeosctx.h +++ b/include/util/tgeosctx.h @@ -32,14 +32,15 @@ typedef struct SGeosContext { GEOSWKBReader *WKBReader; GEOSWKBWriter *WKBWriter; - pcre2_code *WKTRegex; + pcre2_code *WKTRegex; pcre2_match_data *WKTMatchData; char errMsg[512]; } SGeosContext; -SGeosContext* getThreadLocalGeosCtx(); -void destroyThreadLocalGeosCtx(); +SGeosContext *acquireThreadLocalGeosCtx(); +int32_t getThreadLocalGeosCtx(SGeosContext **ppCtx); +const char *getGeosErrMsg(int32_t code); #ifdef __cplusplus } diff --git a/include/util/tlockfree.h b/include/util/tlockfree.h index 1a575f8ea1..24e83f23ca 100644 --- a/include/util/tlockfree.h +++ b/include/util/tlockfree.h @@ -39,7 +39,6 @@ typedef void (*_ref_fn_t)(const void *pObj); // set the initial reference count value #define T_REF_INIT_VAL(x, _v) \ do { \ - assert(_v >= 0); \ atomic_store_32(&((x)->_ref.val), (_v)); \ } while (0) @@ -64,8 +63,6 @@ typedef void (*_ref_fn_t)(const void *pObj); } \ } while (0) -#define T_REF_VAL_CHECK(x) assert((x)->_ref.val >= 0); - #define T_REF_VAL_GET(x) (x)->_ref.val // single writer multiple reader lock diff --git a/packaging/cfg/taosd.service b/packaging/cfg/taosd.service index bfa330f6cb..09a5fd61a8 100644 --- a/packaging/cfg/taosd.service +++ b/packaging/cfg/taosd.service @@ -1,5 +1,5 @@ [Unit] -Description=server service +Description=taosd - TDengine time series database core service After=network-online.target Wants=network-online.target diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index 46216e7789..3c2729c029 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -94,7 +94,7 @@ static int32_t registerRequest(SRequestObj *pRequest, STscObj *pTscObj) { int32_t total = atomic_add_fetch_64((int64_t *)&pSummary->totalRequests, 1); int32_t currentInst = atomic_add_fetch_64((int64_t *)&pSummary->currentRequests, 1); tscDebug("0x%" PRIx64 " new Request from connObj:0x%" PRIx64 - ", current:%d, app current:%d, total:%d, qid:0x%" PRIx64, + ", current:%d, app current:%d, total:%d,QID:0x%" PRIx64, pRequest->self, pRequest->pTscObj->id, num, currentInst, total, pRequest->requestId); } @@ -249,7 +249,7 @@ static void deregisterRequest(SRequestObj *pRequest) { int32_t reqType = SLOW_LOG_TYPE_OTHERS; int64_t duration = taosGetTimestampUs() - pRequest->metric.start; - tscDebug("0x%" PRIx64 " free Request from connObj: 0x%" PRIx64 ", qid:0x%" PRIx64 + tscDebug("0x%" PRIx64 " free Request from connObj: 0x%" PRIx64 ",QID:0x%" PRIx64 " elapsed:%.2f ms, " "current:%d, app current:%d", pRequest->self, pTscObj->id, pRequest->requestId, duration / 1000.0, num, currentInst); @@ -294,7 +294,7 @@ static void deregisterRequest(SRequestObj *pRequest) { checkSlowLogExceptDb(pRequest, pTscObj->pAppInfo->monitorParas.tsSlowLogExceptDb)) { (void)atomic_add_fetch_64((int64_t *)&pActivity->numOfSlowQueries, 1); if (pTscObj->pAppInfo->monitorParas.tsSlowLogScope & reqType) { - taosPrintSlowLog("PID:%d, Conn:%u, qid:0x%" PRIx64 ", Start:%" PRId64 " us, Duration:%" PRId64 "us, SQL:%s", + taosPrintSlowLog("PID:%d, Conn:%u,QID:0x%" PRIx64 ", Start:%" PRId64 " us, Duration:%" PRId64 "us, SQL:%s", taosGetPId(), pTscObj->connId, pRequest->requestId, pRequest->metric.start, duration, pRequest->sqlstr); if (pTscObj->pAppInfo->monitorParas.tsEnableMonitor) { @@ -933,7 +933,7 @@ void taos_init_imp(void) { appInfo.pInstMapByClusterId = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_ENTRY_LOCK); if (NULL == appInfo.pInstMap || NULL == appInfo.pInstMapByClusterId) { - tscError("failed to allocate memory when init appInfo"); + (void)printf("failed to allocate memory when init appInfo\n"); tscInitRes = TSDB_CODE_OUT_OF_MEMORY; return; } @@ -961,7 +961,7 @@ void taos_init_imp(void) { if (InitRegexCache() != 0) { tscInitRes = -1; - tscError("failed to init regex cache"); + (void)printf("failed to init regex cache\n"); return; } diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 926f56e432..d1ee26423c 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -232,7 +232,7 @@ int32_t buildRequest(uint64_t connId, const char* sql, int sqlLen, void* param, int32_t err = taosHashPut(pTscObj->pRequests, &(*pRequest)->self, sizeof((*pRequest)->self), &(*pRequest)->self, sizeof((*pRequest)->self)); if (err) { - tscError("%" PRId64 " failed to add to request container, qid:0x%" PRIx64 ", conn:%" PRId64 ", %s", + tscError("%" PRId64 " failed to add to request container,QID:0x%" PRIx64 ", conn:%" PRId64 ", %s", (*pRequest)->self, (*pRequest)->requestId, pTscObj->id, sql); destroyRequest(*pRequest); *pRequest = NULL; @@ -243,15 +243,15 @@ int32_t buildRequest(uint64_t connId, const char* sql, int sqlLen, void* param, if (tsQueryUseNodeAllocator && !qIsInsertValuesSql((*pRequest)->sqlstr, (*pRequest)->sqlLen)) { if (TSDB_CODE_SUCCESS != nodesCreateAllocator((*pRequest)->requestId, tsQueryNodeChunkSize, &((*pRequest)->allocatorRefId))) { - tscError("%" PRId64 " failed to create node allocator, qid:0x%" PRIx64 ", conn:%" PRId64 ", %s", - (*pRequest)->self, (*pRequest)->requestId, pTscObj->id, sql); + tscError("%" PRId64 " failed to create node allocator,QID:0x%" PRIx64 ", conn:%" PRId64 ", %s", (*pRequest)->self, + (*pRequest)->requestId, pTscObj->id, sql); destroyRequest(*pRequest); *pRequest = NULL; return TSDB_CODE_OUT_OF_MEMORY; } } - tscDebugL("0x%" PRIx64 " SQL: %s, qid:0x%" PRIx64, (*pRequest)->self, (*pRequest)->sqlstr, (*pRequest)->requestId); + tscDebugL("0x%" PRIx64 " SQL: %s,QID:0x%" PRIx64, (*pRequest)->self, (*pRequest)->sqlstr, (*pRequest)->requestId); return TSDB_CODE_SUCCESS; } @@ -365,10 +365,10 @@ void asyncExecLocalCmd(SRequestObj* pRequest, SQuery* pQuery) { if (pRequest->code != TSDB_CODE_SUCCESS) { pResultInfo->numOfRows = 0; - tscError("0x%" PRIx64 " fetch results failed, code:%s, qid:0x%" PRIx64, pRequest->self, tstrerror(code), + tscError("0x%" PRIx64 " fetch results failed, code:%s,QID:0x%" PRIx64, pRequest->self, tstrerror(code), pRequest->requestId); } else { - tscDebug("0x%" PRIx64 " fetch results, numOfRows:%" PRId64 " total Rows:%" PRId64 ", complete:%d, qid:0x%" PRIx64, + tscDebug("0x%" PRIx64 " fetch results, numOfRows:%" PRId64 " total Rows:%" PRId64 ", complete:%d,QID:0x%" PRIx64, pRequest->self, pResultInfo->numOfRows, pResultInfo->totalRows, pResultInfo->completed, pRequest->requestId); } @@ -513,7 +513,7 @@ int32_t setResSchemaInfo(SReqResultInfo* pResInfo, const SSchema* pSchema, int32 taosMemoryFree(pResInfo->userFields); } pResInfo->fields = taosMemoryCalloc(numOfCols, sizeof(TAOS_FIELD)); - if(NULL == pResInfo->fields) return terrno; + if (NULL == pResInfo->fields) return terrno; pResInfo->userFields = taosMemoryCalloc(numOfCols, sizeof(TAOS_FIELD)); if (NULL == pResInfo->userFields) { taosMemoryFree(pResInfo->fields); @@ -976,7 +976,7 @@ int32_t handleQueryExecRsp(SRequestObj* pRequest) { break; } default: - tscError("0x%" PRIx64 ", invalid exec result for request type %d, qid:0x%" PRIx64, pRequest->self, pRequest->type, + tscError("0x%" PRIx64 ", invalid exec result for request type %d,QID:0x%" PRIx64, pRequest->self, pRequest->type, pRequest->requestId); code = TSDB_CODE_APP_ERROR; } @@ -1021,7 +1021,7 @@ void returnToUser(SRequestObj* pRequest) { (void)releaseRequest(pRequest->relation.userRefId); return; } else { - tscError("0x%" PRIx64 ", user ref 0x%" PRIx64 " is not there, qid:0x%" PRIx64, pRequest->self, + tscError("0x%" PRIx64 ", user ref 0x%" PRIx64 " is not there,QID:0x%" PRIx64, pRequest->self, pRequest->relation.userRefId, pRequest->requestId); } } @@ -1053,11 +1053,11 @@ static int32_t createResultBlock(TAOS_RES* pRes, int32_t numOfRows, SSDataBlock* for (int32_t i = 0; i < numOfRows; ++i) { TAOS_ROW pRow = taos_fetch_row(pRes); - if(NULL == pRow[0] || NULL == pRow[1] || NULL == pRow[2]) { + if (NULL == pRow[0] || NULL == pRow[1] || NULL == pRow[2]) { tscError("invalid data from vnode"); return TSDB_CODE_TSC_INTERNAL_ERROR; } - int64_t ts = *(int64_t*)pRow[0]; + int64_t ts = *(int64_t*)pRow[0]; if (lastTs < ts) { lastTs = ts; } @@ -1090,7 +1090,7 @@ void postSubQueryFetchCb(void* param, TAOS_RES* res, int32_t rowNum) { SSDataBlock* pBlock = NULL; if (TSDB_CODE_SUCCESS != createResultBlock(res, rowNum, &pBlock)) { - tscError("0x%" PRIx64 ", create result block failed, qid:0x%" PRIx64, pRequest->self, pRequest->requestId); + tscError("0x%" PRIx64 ", create result block failed,QID:0x%" PRIx64, pRequest->self, pRequest->requestId); return; } @@ -1099,7 +1099,7 @@ void postSubQueryFetchCb(void* param, TAOS_RES* res, int32_t rowNum) { continuePostSubQuery(pNextReq, pBlock); (void)releaseRequest(pRequest->relation.nextRefId); } else { - tscError("0x%" PRIx64 ", next req ref 0x%" PRIx64 " is not there, qid:0x%" PRIx64, pRequest->self, + tscError("0x%" PRIx64 ", next req ref 0x%" PRIx64 " is not there,QID:0x%" PRIx64, pRequest->self, pRequest->relation.nextRefId, pRequest->requestId); } @@ -1118,7 +1118,7 @@ void handlePostSubQuery(SSqlCallbackWrapper* pWrapper) { continuePostSubQuery(pNextReq, NULL); (void)releaseRequest(pRequest->relation.nextRefId); } else { - tscError("0x%" PRIx64 ", next req ref 0x%" PRIx64 " is not there, qid:0x%" PRIx64, pRequest->self, + tscError("0x%" PRIx64 ", next req ref 0x%" PRIx64 " is not there,QID:0x%" PRIx64, pRequest->self, pRequest->relation.nextRefId, pRequest->requestId); } } @@ -1149,11 +1149,11 @@ void schedulerExecCb(SExecResult* pResult, void* param, int32_t code) { } taosMemoryFree(pResult); - tscDebug("0x%" PRIx64 " enter scheduler exec cb, code:%s, qid:0x%" PRIx64, pRequest->self, tstrerror(code), + tscDebug("0x%" PRIx64 " enter scheduler exec cb, code:%s,QID:0x%" PRIx64, pRequest->self, tstrerror(code), pRequest->requestId); if (code != TSDB_CODE_SUCCESS && NEED_CLIENT_HANDLE_ERROR(code) && pRequest->sqlstr != NULL) { - tscDebug("0x%" PRIx64 " client retry to handle the error, code:%s, tryCount:%d, qid:0x%" PRIx64, pRequest->self, + tscDebug("0x%" PRIx64 " client retry to handle the error, code:%s, tryCount:%d,QID:0x%" PRIx64, pRequest->self, tstrerror(code), pRequest->retry, pRequest->requestId); (void)removeMeta(pTscObj, pRequest->targetTableList, IS_VIEW_REQUEST(pRequest->type)); restartAsyncQuery(pRequest, code); @@ -1586,7 +1586,7 @@ int32_t taosConnectImpl(const char* user, const char* auth, const char* db, __ta *pTscObj = NULL; return terrno; } else { - tscDebug("0x%" PRIx64 " connection is opening, connId:%u, dnodeConn:%p, qid:0x%" PRIx64, (*pTscObj)->id, + tscDebug("0x%" PRIx64 " connection is opening, connId:%u, dnodeConn:%p,QID:0x%" PRIx64, (*pTscObj)->id, (*pTscObj)->connId, (*pTscObj)->pAppInfo->pTransporter, pRequest->requestId); destroyRequest(pRequest); } @@ -1717,7 +1717,7 @@ int32_t doProcessMsgFromServer(void* param) { char tbuf[40] = {0}; TRACE_TO_STR(trace, tbuf); - tscDebug("processMsgFromServer handle %p, message: %s, size:%d, code: %s, qid:%s", pMsg->info.handle, + tscDebug("processMsgFromServer handle %p, message: %s, size:%d, code: %s,QID:%s", pMsg->info.handle, TMSG_INFO(pMsg->msgType), pMsg->contLen, tstrerror(pMsg->code), tbuf); if (pSendInfo->requestObjRefId != 0) { @@ -1915,7 +1915,7 @@ void* doFetchRows(SRequestObj* pRequest, bool setupOneRowPtr, bool convertUcs4) return NULL; } - tscDebug("0x%" PRIx64 " fetch results, numOfRows:%" PRId64 " total Rows:%" PRId64 ", complete:%d, qid:0x%" PRIx64, + tscDebug("0x%" PRIx64 " fetch results, numOfRows:%" PRId64 " total Rows:%" PRId64 ", complete:%d,QID:0x%" PRIx64, pRequest->self, pResInfo->numOfRows, pResInfo->totalRows, pResInfo->completed, pRequest->requestId); STscObj* pTscObj = pRequest->pTscObj; @@ -2869,8 +2869,8 @@ static void fetchCallback(void* pResult, void* param, int32_t code) { SReqResultInfo* pResultInfo = &pRequest->body.resInfo; - tscDebug("0x%" PRIx64 " enter scheduler fetch cb, code:%d - %s, qid:0x%" PRIx64, pRequest->self, code, - tstrerror(code), pRequest->requestId); + tscDebug("0x%" PRIx64 " enter scheduler fetch cb, code:%d - %s,QID:0x%" PRIx64, pRequest->self, code, tstrerror(code), + pRequest->requestId); pResultInfo->pData = pResult; pResultInfo->numOfRows = 0; @@ -2892,10 +2892,10 @@ static void fetchCallback(void* pResult, void* param, int32_t code) { setQueryResultFromRsp(pResultInfo, (const SRetrieveTableRsp*)pResultInfo->pData, pResultInfo->convertUcs4); if (pRequest->code != TSDB_CODE_SUCCESS) { pResultInfo->numOfRows = 0; - tscError("0x%" PRIx64 " fetch results failed, code:%s, qid:0x%" PRIx64, pRequest->self, tstrerror(pRequest->code), + tscError("0x%" PRIx64 " fetch results failed, code:%s,QID:0x%" PRIx64, pRequest->self, tstrerror(pRequest->code), pRequest->requestId); } else { - tscDebug("0x%" PRIx64 " fetch results, numOfRows:%" PRId64 " total Rows:%" PRId64 ", complete:%d, qid:0x%" PRIx64, + tscDebug("0x%" PRIx64 " fetch results, numOfRows:%" PRId64 " total Rows:%" PRId64 ", complete:%d,QID:0x%" PRIx64, pRequest->self, pResultInfo->numOfRows, pResultInfo->totalRows, pResultInfo->completed, pRequest->requestId); diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index 0ac712bdeb..471e051094 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -861,6 +861,44 @@ int *taos_get_column_data_offset(TAOS_RES *res, int columnIndex) { return pResInfo->pCol[columnIndex].offset; } +int taos_is_null_by_column(TAOS_RES *res, int columnIndex, bool result[], int *rows){ + if (res == NULL || result == NULL || rows == NULL || *rows <= 0 || + columnIndex < 0 || TD_RES_TMQ_META(res) || TD_RES_TMQ_BATCH_META(res)) { + return TSDB_CODE_INVALID_PARA; + } + + int32_t numOfFields = taos_num_fields(res); + if (columnIndex >= numOfFields || numOfFields == 0) { + return TSDB_CODE_INVALID_PARA; + } + + SReqResultInfo *pResInfo = tscGetCurResInfo(res); + TAOS_FIELD *pField = &pResInfo->userFields[columnIndex]; + SResultColumn *pCol = &pResInfo->pCol[columnIndex]; + + if (*rows > pResInfo->numOfRows){ + *rows = pResInfo->numOfRows; + } + if (IS_VAR_DATA_TYPE(pField->type)) { + for(int i = 0; i < *rows; i++){ + if(pCol->offset[i] == -1){ + result[i] = true; + }else{ + result[i] = false; + } + } + }else{ + for(int i = 0; i < *rows; i++){ + if (colDataIsNull_f(pCol->nullbitmap, i)){ + result[i] = true; + }else{ + result[i] = false; + } + } + } + return 0; +} + int taos_validate_sql(TAOS *taos, const char *sql) { TAOS_RES *pObj = taosQueryImpl(taos, sql, true, TD_REQ_FROM_APP); @@ -942,7 +980,7 @@ static void doAsyncQueryFromAnalyse(SMetaData *pResultMeta, void *param, int32_t SRequestObj *pRequest = pWrapper->pRequest; SQuery *pQuery = pRequest->pQuery; - qDebug("0x%" PRIx64 " start to semantic analysis, qid:0x%" PRIx64, pRequest->self, pRequest->requestId); + qDebug("0x%" PRIx64 " start to semantic analysis,QID:0x%" PRIx64, pRequest->self, pRequest->requestId); int64_t analyseStart = taosGetTimestampUs(); pRequest->metric.ctgCostUs = analyseStart - pRequest->metric.ctgStart; @@ -1061,14 +1099,14 @@ void handleQueryAnslyseRes(SSqlCallbackWrapper *pWrapper, SMetaData *pResultMeta pRequest->pQuery = NULL; if (NEED_CLIENT_HANDLE_ERROR(code)) { - tscDebug("0x%" PRIx64 " client retry to handle the error, code:%d - %s, tryCount:%d, qid:0x%" PRIx64, + tscDebug("0x%" PRIx64 " client retry to handle the error, code:%d - %s, tryCount:%d,QID:0x%" PRIx64, pRequest->self, code, tstrerror(code), pRequest->retry, pRequest->requestId); restartAsyncQuery(pRequest, code); return; } // return to app directly - tscError("0x%" PRIx64 " error occurs, code:%s, return to user app, qid:0x%" PRIx64, pRequest->self, tstrerror(code), + tscError("0x%" PRIx64 " error occurs, code:%s, return to user app,QID:0x%" PRIx64, pRequest->self, tstrerror(code), pRequest->requestId); pRequest->code = code; returnToUser(pRequest); @@ -1118,7 +1156,7 @@ static void doAsyncQueryFromParse(SMetaData *pResultMeta, void *param, int32_t c SQuery *pQuery = pRequest->pQuery; pRequest->metric.ctgCostUs += taosGetTimestampUs() - pRequest->metric.ctgStart; - qDebug("0x%" PRIx64 " start to continue parse, qid:0x%" PRIx64 ", code:%s", pRequest->self, pRequest->requestId, + qDebug("0x%" PRIx64 " start to continue parse,QID:0x%" PRIx64 ", code:%s", pRequest->self, pRequest->requestId, tstrerror(code)); if (code == TSDB_CODE_SUCCESS) { @@ -1131,7 +1169,7 @@ static void doAsyncQueryFromParse(SMetaData *pResultMeta, void *param, int32_t c } if (TSDB_CODE_SUCCESS != code) { - tscError("0x%" PRIx64 " error happens, code:%d - %s, qid:0x%" PRIx64, pWrapper->pRequest->self, code, + tscError("0x%" PRIx64 " error happens, code:%d - %s,QID:0x%" PRIx64, pWrapper->pRequest->self, code, tstrerror(code), pWrapper->pRequest->requestId); destorySqlCallbackWrapper(pWrapper); pRequest->pWrapper = NULL; @@ -1148,7 +1186,7 @@ void continueInsertFromCsv(SSqlCallbackWrapper *pWrapper, SRequestObj *pRequest) } if (TSDB_CODE_SUCCESS != code) { - tscError("0x%" PRIx64 " error happens, code:%d - %s, qid:0x%" PRIx64, pWrapper->pRequest->self, code, + tscError("0x%" PRIx64 " error happens, code:%d - %s,QID:0x%" PRIx64, pWrapper->pRequest->self, code, tstrerror(code), pWrapper->pRequest->requestId); destorySqlCallbackWrapper(pWrapper); pRequest->pWrapper = NULL; @@ -1266,7 +1304,7 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) { } if (TSDB_CODE_SUCCESS != code) { - tscError("0x%" PRIx64 " error happens, code:%d - %s, qid:0x%" PRIx64, pRequest->self, code, tstrerror(code), + tscError("0x%" PRIx64 " error happens, code:%d - %s,QID:0x%" PRIx64, pRequest->self, code, tstrerror(code), pRequest->requestId); destorySqlCallbackWrapper(pWrapper); pRequest->pWrapper = NULL; @@ -1274,7 +1312,7 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) { pRequest->pQuery = NULL; if (NEED_CLIENT_HANDLE_ERROR(code)) { - tscDebug("0x%" PRIx64 " client retry to handle the error, code:%d - %s, tryCount:%d, qid:0x%" PRIx64, + tscDebug("0x%" PRIx64 " client retry to handle the error, code:%d - %s, tryCount:%d,QID:0x%" PRIx64, pRequest->self, code, tstrerror(code), pRequest->retry, pRequest->requestId); (void)refreshMeta(pRequest->pTscObj, pRequest); // ignore return code,try again pRequest->prevCode = code; diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index c8fd5281ef..05678e1cbf 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -168,7 +168,7 @@ int64_t smlGetTimeValue(const char *value, int32_t len, uint8_t fromPrecision, u int32_t smlBuildTableInfo(int numRows, const char *measure, int32_t measureLen, SSmlTableInfo** tInfo) { SSmlTableInfo *tag = (SSmlTableInfo *)taosMemoryCalloc(sizeof(SSmlTableInfo), 1); if (!tag) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } tag->sTableName = measure; @@ -609,7 +609,7 @@ int32_t getTableUid(SSmlHandle *info, SSmlLineInfo *currElement, SSmlTableInfo * int32_t smlBuildSTableMeta(bool isDataFormat, SSmlSTableMeta **sMeta) { SSmlSTableMeta *meta = (SSmlSTableMeta *)taosMemoryCalloc(sizeof(SSmlSTableMeta), 1); if (!meta) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } if (unlikely(!isDataFormat)) { @@ -1625,7 +1625,7 @@ int32_t smlBuildSmlInfo(TAOS *taos, SSmlHandle **handle) { int32_t code = TSDB_CODE_SUCCESS; SSmlHandle *info = (SSmlHandle *)taosMemoryCalloc(1, sizeof(SSmlHandle)); if (NULL == info) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } if (taos != NULL) { info->taos = acquireTscObj(*(int64_t *)taos); diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index 5aa2d4ebab..3927172b61 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -1570,7 +1570,7 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { if (msgEpoch < clientEpoch) { // do not write into queue since updating epoch reset tscWarn("consumer:0x%" PRIx64 - " msg discard from vgId:%d since from earlier epoch, rsp epoch %d, current epoch %d, qid:0x%" PRIx64, + " msg discard from vgId:%d since from earlier epoch, rsp epoch %d, current epoch %d,QID:0x%" PRIx64, tmq->consumerId, vgId, msgEpoch, clientEpoch, requestId); code = TSDB_CODE_TMQ_CONSUMER_MISMATCH; goto END; @@ -1603,7 +1603,7 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { char buf[TSDB_OFFSET_LEN] = {0}; tFormatOffset(buf, TSDB_OFFSET_LEN, &pRspWrapper->dataRsp.common.rspOffset); - tscDebug("consumer:0x%" PRIx64 " recv poll rsp, vgId:%d, req ver:%" PRId64 ", rsp:%s type %d, qid:0x%" PRIx64, + tscDebug("consumer:0x%" PRIx64 " recv poll rsp, vgId:%d, req ver:%" PRId64 ", rsp:%s type %d,QID:0x%" PRIx64, tmq->consumerId, vgId, pRspWrapper->dataRsp.common.reqOffset.version, buf, rspType, requestId); } else if (rspType == TMQ_MSG_TYPE__POLL_META_RSP) { SDecoder decoder = {0}; @@ -1635,7 +1635,7 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { } tDecoderClear(&decoder); (void)memcpy(&pRspWrapper->batchMetaRsp, pMsg->pData, sizeof(SMqRspHead)); - tscDebug("consumer:0x%" PRIx64 " recv poll batchmeta rsp, vgId:%d, qid:0x%" PRIx64, tmq->consumerId, vgId, + tscDebug("consumer:0x%" PRIx64 " recv poll batchmeta rsp, vgId:%d,QID:0x%" PRIx64, tmq->consumerId, vgId, requestId); } else { // invalid rspType tscError("consumer:0x%" PRIx64 " invalid rsp msg received, type:%d ignored", tmq->consumerId, rspType); @@ -1652,7 +1652,7 @@ END: } } int32_t total = taosQueueItemSize(tmq->mqueue); - tscDebug("consumer:0x%" PRIx64 " put poll res into mqueue, type:%d, vgId:%d, total in queue:%d, qid:0x%" PRIx64, + tscDebug("consumer:0x%" PRIx64 " put poll res into mqueue, type:%d, vgId:%d, total in queue:%d,QID:0x%" PRIx64, tmq ? tmq->consumerId : 0, rspType, vgId, total, requestId); if (tmq) (void)tsem2_post(&tmq->rspSem); @@ -2048,8 +2048,8 @@ static int32_t doTmqPollImpl(tmq_t* pTmq, SMqClientTopic* pTopic, SMqClientVg* p char offsetFormatBuf[TSDB_OFFSET_LEN] = {0}; tFormatOffset(offsetFormatBuf, tListLen(offsetFormatBuf), &pVg->offsetInfo.endOffset); code = asyncSendMsgToServer(pTmq->pTscObj->pAppInfo->pTransporter, &pVg->epSet, &transporterId, sendInfo); - tscDebug("consumer:0x%" PRIx64 " send poll to %s vgId:%d, code:%d, epoch %d, req:%s, qid:0x%" PRIx64, - pTmq->consumerId, pTopic->topicName, pVg->vgId, code, pTmq->epoch, offsetFormatBuf, req.reqId); + tscDebug("consumer:0x%" PRIx64 " send poll to %s vgId:%d, code:%d, epoch %d, req:%s,QID:0x%" PRIx64, pTmq->consumerId, + pTopic->topicName, pVg->vgId, code, pTmq->epoch, offsetFormatBuf, req.reqId); if (code != 0) { return code; } @@ -2183,6 +2183,7 @@ static void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout) { taosWUnLockLatch(&tmq->lock); } setVgIdle(tmq, pollRspWrapper->topicName, pollRspWrapper->vgId); + taosMemoryFreeClear(pollRspWrapper->pEpset); tmqFreeRspWrapper(pRspWrapper); taosFreeQitem(pRspWrapper); } else if (pRspWrapper->tmqRspType == TMQ_MSG_TYPE__POLL_DATA_RSP) { @@ -2221,7 +2222,7 @@ static void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout) { tFormatOffset(buf, TSDB_OFFSET_LEN, &pDataRsp->rspOffset); if (pDataRsp->blockNum == 0) { tscDebug("consumer:0x%" PRIx64 " empty block received, vgId:%d, offset:%s, vg total:%" PRId64 - ", total:%" PRId64 ", qid:0x%" PRIx64, + ", total:%" PRId64 ",QID:0x%" PRIx64, tmq->consumerId, pVg->vgId, buf, pVg->numOfRows, tmq->totalRows, pollRspWrapper->reqId); pVg->emptyBlockReceiveTs = taosGetTimestampMs(); tmqFreeRspWrapper(pRspWrapper); @@ -2244,9 +2245,10 @@ static void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout) { } } tscDebug("consumer:0x%" PRIx64 " process poll rsp, vgId:%d, offset:%s, blocks:%d, rows:%" PRId64 - ", vg total:%" PRId64 ", total:%" PRId64 ", qid:0x%" PRIx64, + ", vg total:%" PRId64 ", total:%" PRId64 ",QID:0x%" PRIx64, tmq->consumerId, pVg->vgId, buf, pDataRsp->blockNum, numOfRows, pVg->numOfRows, tmq->totalRows, pollRspWrapper->reqId); + taosMemoryFreeClear(pollRspWrapper->pEpset); taosFreeQitem(pRspWrapper); taosWUnLockLatch(&tmq->lock); return pRsp; @@ -2284,6 +2286,7 @@ static void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout) { // build rsp SMqMetaRspObj* pRsp = NULL; (void)tmqBuildMetaRspFromWrapper(pollRspWrapper, &pRsp); + taosMemoryFreeClear(pollRspWrapper->pEpset); taosFreeQitem(pRspWrapper); taosWUnLockLatch(&tmq->lock); return pRsp; @@ -2321,6 +2324,7 @@ static void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout) { tmq->consumerId, true); SMqBatchMetaRspObj* pRsp = NULL; (void)tmqBuildBatchMetaRspFromWrapper(pollRspWrapper, &pRsp); + taosMemoryFreeClear(pollRspWrapper->pEpset); taosFreeQitem(pRspWrapper); taosWUnLockLatch(&tmq->lock); return pRsp; @@ -2355,7 +2359,7 @@ static void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout) { tmq->consumerId, pDataRsp->blockNum != 0); if (pDataRsp->blockNum == 0) { - tscDebug("consumer:0x%" PRIx64 " taosx empty block received, vgId:%d, vg total:%" PRId64 ", qid:0x%" PRIx64, + tscDebug("consumer:0x%" PRIx64 " taosx empty block received, vgId:%d, vg total:%" PRId64 ",QID:0x%" PRIx64, tmq->consumerId, pVg->vgId, pVg->numOfRows, pollRspWrapper->reqId); pVg->emptyBlockReceiveTs = taosGetTimestampMs(); tmqFreeRspWrapper(pRspWrapper); @@ -2377,10 +2381,11 @@ static void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout) { char buf[TSDB_OFFSET_LEN] = {0}; tFormatOffset(buf, TSDB_OFFSET_LEN, &pVg->offsetInfo.endOffset); tscDebug("consumer:0x%" PRIx64 " process taosx poll rsp, vgId:%d, offset:%s, blocks:%d, rows:%" PRId64 - ", vg total:%" PRId64 ", total:%" PRId64 ", qid:0x%" PRIx64, + ", vg total:%" PRId64 ", total:%" PRId64 ",QID:0x%" PRIx64, tmq->consumerId, pVg->vgId, buf, pDataRsp->blockNum, numOfRows, pVg->numOfRows, tmq->totalRows, pollRspWrapper->reqId); + taosMemoryFreeClear(pollRspWrapper->pEpset); taosFreeQitem(pRspWrapper); taosWUnLockLatch(&tmq->lock); return pRsp; @@ -2990,7 +2995,7 @@ int32_t askEp(tmq_t* pTmq, void* param, bool sync, bool updateEpSet) { sendInfo->msgType = TDMT_MND_TMQ_ASK_EP; SEpSet epSet = getEpSet_s(&pTmq->pTscObj->pAppInfo->mgmtEp); - tscDebug("consumer:0x%" PRIx64 " ask ep from mnode, qid:0x%" PRIx64, pTmq->consumerId, sendInfo->requestId); + tscDebug("consumer:0x%" PRIx64 " ask ep from mnode,QID:0x%" PRIx64, pTmq->consumerId, sendInfo->requestId); return asyncSendMsgToServer(pTmq->pTscObj->pAppInfo->pTransporter, &epSet, NULL, sendInfo); } @@ -3497,7 +3502,7 @@ int32_t tmq_get_topic_assignment(tmq_t* tmq, const char* pTopicName, tmq_topic_a char offsetFormatBuf[TSDB_OFFSET_LEN] = {0}; tFormatOffset(offsetFormatBuf, tListLen(offsetFormatBuf), &pClientVg->offsetInfo.beginOffset); - tscInfo("consumer:0x%" PRIx64 " %s retrieve wal info vgId:%d, epoch %d, req:%s, qid:0x%" PRIx64, tmq->consumerId, + tscInfo("consumer:0x%" PRIx64 " %s retrieve wal info vgId:%d, epoch %d, req:%s,QID:0x%" PRIx64, tmq->consumerId, pTopic->topicName, pClientVg->vgId, tmq->epoch, offsetFormatBuf, req.reqId); code = asyncSendMsgToServer(tmq->pTscObj->pAppInfo->pTransporter, &pClientVg->epSet, &transporterId, sendInfo); if (code != 0) { diff --git a/source/common/src/cos.c b/source/common/src/cos.c index 3b5fca0fea..f02130d468 100644 --- a/source/common/src/cos.c +++ b/source/common/src/cos.c @@ -72,23 +72,42 @@ void s3CleanUp() { /*s3End();*/ static int32_t s3ListBucket(char const *bucketname); +static void s3DumpCfgByEp(int8_t epIndex) { + // clang-format off + (void)fprintf(stdout, + "%-24s %s\n" + "%-24s %s\n" + "%-24s %s\n" + "%-24s %s\n" + "%-24s %s\n" + "%-24s %s\n", + "hostName", tsS3Hostname[epIndex], + "bucketName", tsS3BucketName, + "protocol", (protocolG[epIndex] == S3ProtocolHTTPS ? "https" : "http"), + "uristyle", (uriStyleG[epIndex] == S3UriStyleVirtualHost ? "virtualhost" : "path"), + "accessKey", tsS3AccessKeyId[epIndex], + "accessKeySecret", tsS3AccessKeySecret[epIndex]); + // clang-format on +} + int32_t s3CheckCfg() { int32_t code = 0, lino = 0; int8_t i = 0; if (!tsS3Enabled) { (void)fprintf(stderr, "s3 not configured.\n"); - goto _exit; + TAOS_RETURN(code); } code = s3Begin(); if (code != 0) { (void)fprintf(stderr, "failed to initialize s3.\n"); - TAOS_CHECK_GOTO(code, &lino, _exit); + TAOS_RETURN(code); } for (; i < tsS3EpNum; i++) { - (void)fprintf(stdout, "test s3 ep: %d/%d.\n", i + 1, tsS3EpNum); + (void)fprintf(stdout, "test s3 ep (%d/%d):\n", i + 1, tsS3EpNum); + s3DumpCfgByEp(i); // test put char testdata[17] = "0123456789abcdef"; @@ -109,15 +128,15 @@ int32_t s3CheckCfg() { if (!fp) { (void)fprintf(stderr, "failed to open test file: %s.\n", path); // uError("ERROR: %s Failed to open %s", __func__, path); - TAOS_CHECK_GOTO(TAOS_SYSTEM_ERROR(errno), &lino, _exit); + TAOS_CHECK_GOTO(TAOS_SYSTEM_ERROR(errno), &lino, _next); } if (taosWriteFile(fp, testdata, strlen(testdata)) < 0) { (void)fprintf(stderr, "failed to write test file: %s.\n", path); - TAOS_CHECK_GOTO(TAOS_SYSTEM_ERROR(errno), &lino, _exit); + TAOS_CHECK_GOTO(TAOS_SYSTEM_ERROR(errno), &lino, _next); } if (taosFsyncFile(fp) < 0) { (void)fprintf(stderr, "failed to fsync test file: %s.\n", path); - TAOS_CHECK_GOTO(TAOS_SYSTEM_ERROR(errno), &lino, _exit); + TAOS_CHECK_GOTO(TAOS_SYSTEM_ERROR(errno), &lino, _next); } (void)taosCloseFile(&fp); @@ -125,7 +144,7 @@ int32_t s3CheckCfg() { code = s3PutObjectFromFileOffsetByEp(path, objectname[0], 0, 16, i); if (code != 0) { (void)fprintf(stderr, "put object %s : failed.\n", objectname[0]); - TAOS_CHECK_GOTO(code, &lino, _exit); + TAOS_CHECK_GOTO(code, &lino, _next); } (void)fprintf(stderr, "put object %s: success.\n\n", objectname[0]); @@ -134,7 +153,7 @@ int32_t s3CheckCfg() { code = s3ListBucketByEp(tsS3BucketName, i); if (code != 0) { (void)fprintf(stderr, "listing bucket %s : failed.\n", tsS3BucketName); - TAOS_CHECK_GOTO(code, &lino, _exit); + TAOS_CHECK_GOTO(code, &lino, _next); } (void)fprintf(stderr, "listing bucket %s: success.\n\n", tsS3BucketName); @@ -147,7 +166,7 @@ int32_t s3CheckCfg() { code = s3GetObjectBlockByEp(objectname[0], c_offset, c_len, true, &pBlock, i); if (code != 0) { (void)fprintf(stderr, "get object %s : failed.\n", objectname[0]); - TAOS_CHECK_GOTO(code, &lino, _exit); + TAOS_CHECK_GOTO(code, &lino, _next); } char buf[7] = {0}; (void)memcpy(buf, pBlock, c_len); @@ -160,18 +179,24 @@ int32_t s3CheckCfg() { code = s3DeleteObjectsByEp(objectname, 1, i); if (code != 0) { (void)fprintf(stderr, "delete object %s : failed.\n", objectname[0]); - TAOS_CHECK_GOTO(code, &lino, _exit); + TAOS_CHECK_GOTO(code, &lino, _next); } (void)fprintf(stderr, "delete object %s: success.\n\n", objectname[0]); + + _next: + if (fp) { + (void)taosCloseFile(&fp); + } + + if (TSDB_CODE_SUCCESS != code) { + (void)fprintf(stderr, "s3 check failed, code: %d, line: %d, index: %d.\n", code, lino, i); + } + + (void)fprintf(stdout, "=================================================================\n"); } s3End(); -_exit: - if (TSDB_CODE_SUCCESS != code) { - (void)fprintf(stderr, "s3 check failed, code: %d, line: %d, index: %d.\n", code, lino, i); - } - TAOS_RETURN(code); } @@ -679,7 +704,7 @@ static int32_t s3PutObjectFromFileWithoutCp(S3BucketContext *bucket_context, cha manager.etags = (char **)taosMemoryCalloc(totalSeq, sizeof(char *)); if (!manager.etags) { - TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); + TAOS_CHECK_GOTO(terrno, &lino, _exit); } manager.next_etags_pos = 0; do { @@ -785,7 +810,7 @@ static int32_t s3PutObjectFromFileWithCp(S3BucketContext *bucket_context, const SCheckpoint cp = {0}; cp.parts = taosMemoryCalloc(max_part_num, sizeof(SCheckpointPart)); if (!cp.parts) { - TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); + TAOS_CHECK_GOTO(terrno, &lino, _exit); } if (taosCheckExistFile(file_cp_path)) { @@ -833,7 +858,7 @@ static int32_t s3PutObjectFromFileWithCp(S3BucketContext *bucket_context, const manager.etags = (char **)taosMemoryCalloc(totalSeq, sizeof(char *)); if (!manager.etags) { - TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); + TAOS_CHECK_GOTO(terrno, &lino, _exit); } manager.next_etags_pos = 0; @@ -1806,7 +1831,7 @@ int32_t s3GetObjectBlock(const char *object_name, int64_t offset, int64_t block_ // char *buf = cos_pcalloc(p, (apr_size_t)(len + 1)); char *buf = taosMemoryCalloc(1, (apr_size_t)(len)); if (!buf) { - TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); + TAOS_CHECK_GOTO(terrno, &lino, _exit); } // buf[len] = '\0'; diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index 16710d9555..8e50c943b9 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -81,7 +81,7 @@ int32_t getJsonValueLen(const char* data) { } else if (tTagIsJson(data)) { // json string dataLen = ((STag*)(data))->len; } else { - ASSERT(0); + uError("Invalid data type:%d in Json", *data); } return dataLen; } @@ -801,7 +801,7 @@ int32_t blockDataSplitRows(SSDataBlock* pBlock, bool hasVarCol, int32_t startInd size_t rowSize = blockDataGetRowSize(pBlock); int32_t capacity = blockDataGetCapacityInRow(pBlock, pageSize, headerSize + colHeaderSize); if (capacity <= 0) { - return TSDB_CODE_FAILED; + return terrno; } *stopIndex = startIndex + capacity - 1; @@ -835,7 +835,7 @@ int32_t blockDataSplitRows(SSDataBlock* pBlock, bool hasVarCol, int32_t startInd if (size > pageSize) { // pageSize must be able to hold one row *stopIndex = j - 1; if (*stopIndex < startIndex) { - return TSDB_CODE_FAILED; + return TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR; } return TSDB_CODE_SUCCESS; @@ -2060,7 +2060,7 @@ int32_t blockDataAppendColInfo(SSDataBlock* pBlock, SColumnInfoData* pColInfoDat } // todo disable it temporarily - // ASSERT(pColInfoData->info.type != 0); + // A S S E R T(pColInfoData->info.type != 0); if (IS_VAR_DATA_TYPE(pColInfoData->info.type)) { pBlock->info.hasVarCol = true; } @@ -2100,14 +2100,18 @@ size_t blockDataGetCapacityInRow(const SSDataBlock* pBlock, size_t pageSize, int int32_t payloadSize = pageSize - extraSize; int32_t rowSize = pBlock->info.rowSize; int32_t nRows = payloadSize / rowSize; - ASSERT(nRows >= 1); + if (nRows < 1) { + uError("rows %d in page is too small, payloadSize:%d, rowSize:%d", nRows, payloadSize, rowSize); + terrno = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR; + return -1; + } int32_t numVarCols = 0; int32_t numFixCols = 0; for (int32_t i = 0; i < numOfCols; ++i) { SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, i); if (pCol == NULL) { - return terrno; + return -1; } if (IS_VAR_DATA_TYPE(pCol->info.type)) { @@ -2135,7 +2139,11 @@ size_t blockDataGetCapacityInRow(const SSDataBlock* pBlock, size_t pageSize, int int32_t newRows = (result != -1) ? result - 1 : nRows; // the true value must be less than the value of nRows - ASSERT(newRows <= nRows && newRows >= 1); + if (newRows > nRows || newRows < 1) { + uError("invalid newRows:%d, nRows:%d", newRows, nRows); + terrno = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR; + return -1; + } return newRows; } @@ -2616,7 +2624,11 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq2** ppReq, const SSDataBlock* pDat } // the rsma result should has the same column number with schema. - ASSERT(colNum == pTSchema->numOfCols); + if (colNum != pTSchema->numOfCols) { + uError("colNum %d is not equal to numOfCols %d", colNum, pTSchema->numOfCols); + code = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR; + goto _end; + } SSubmitTbData tbData = {0}; @@ -2652,10 +2664,18 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq2** ppReq, const SSDataBlock* pDat switch (pColInfoData->info.type) { case TSDB_DATA_TYPE_TIMESTAMP: - ASSERT(pColInfoData->info.type == pCol->type); + if (pColInfoData->info.type != pCol->type) { + uError("colType:%d mismatch with sechma colType:%d", pColInfoData->info.type, pCol->type); + terrno = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR; + return terrno; + } if (!isStartKey) { isStartKey = true; - ASSERT(PRIMARYKEY_TIMESTAMP_COL_ID == pCol->colId); + if (PRIMARYKEY_TIMESTAMP_COL_ID != pCol->colId) { + uError("the first timestamp colId %d is not primary colId", pCol->colId); + terrno = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR; + return terrno; + } SColVal cv = COL_VAL_VALUE(pCol->colId, ((SValue){.type = pCol->type, .val = *(TSKEY*)var})); void* px = taosArrayPush(pVals, &cv); if (px == NULL) { @@ -2679,7 +2699,11 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq2** ppReq, const SSDataBlock* pDat case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_VARCHAR: { // TSDB_DATA_TYPE_BINARY - ASSERT(pColInfoData->info.type == pCol->type); + if (pColInfoData->info.type != pCol->type) { + uError("colType:%d mismatch with sechma colType:%d", pColInfoData->info.type, pCol->type); + terrno = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR; + return terrno; + } if (colDataIsNull_s(pColInfoData, j)) { SColVal cv = COL_VAL_NULL(pCol->colId, pCol->type); void* px = taosArrayPush(pVals, &cv); @@ -2704,7 +2728,8 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq2** ppReq, const SSDataBlock* pDat case TSDB_DATA_TYPE_JSON: case TSDB_DATA_TYPE_MEDIUMBLOB: uError("the column type %" PRIi16 " is defined but not implemented yet", pColInfoData->info.type); - ASSERT(0); + terrno = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR; + return terrno; break; default: if (pColInfoData->info.type < TSDB_DATA_TYPE_MAX && pColInfoData->info.type > TSDB_DATA_TYPE_NULL) { @@ -2752,7 +2777,8 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq2** ppReq, const SSDataBlock* pDat } } else { uError("the column type %" PRIi16 " is undefined\n", pColInfoData->info.type); - ASSERT(0); + terrno = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR; + return terrno; } break; } @@ -2763,7 +2789,6 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq2** ppReq, const SSDataBlock* pDat goto _end; } - ASSERT(pRow); void* px = taosArrayPush(tbData.aRowP, &pRow); if (px == NULL) { code = terrno; @@ -2902,7 +2927,11 @@ int32_t blockEncode(const SSDataBlock* pBlock, char* data, int32_t numOfCols) { int32_t* rows = (int32_t*)data; *rows = pBlock->info.rows; data += sizeof(int32_t); - ASSERT(*rows > 0); + if (*rows <= 0) { + uError("Invalid rows %d in block", *rows); + terrno = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR; + return -1; + } int32_t* cols = (int32_t*)data; *cols = numOfCols; @@ -3055,7 +3084,11 @@ int32_t blockDecode(SSDataBlock* pBlock, const char* pData, const char** pEndPos for (int32_t i = 0; i < numOfCols; ++i) { colLen[i] = htonl(colLen[i]); - ASSERT(colLen[i] >= 0); + if (colLen[i] < 0) { + uError("block decode colLen:%d error, colIdx:%d", colLen[i], i); + terrno = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR; + return terrno; + } SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, i); if (pColInfoData == NULL) { @@ -3099,7 +3132,11 @@ int32_t blockDecode(SSDataBlock* pBlock, const char* pData, const char** pEndPos pBlock->info.dataLoad = 1; pBlock->info.rows = numOfRows; pBlock->info.blankFill = blankFill; - ASSERT(pStart - pData == dataLen); + if (pStart - pData != dataLen) { + uError("block decode msg len error, pStart:%p, pData:%p, dataLen:%d", pStart, pData, dataLen); + terrno = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR; + return terrno; + } *pEndPos = pStart; return code; diff --git a/source/common/src/tdataformat.c b/source/common/src/tdataformat.c index 23239934e4..24e669577a 100644 --- a/source/common/src/tdataformat.c +++ b/source/common/src/tdataformat.c @@ -271,7 +271,7 @@ static int32_t tRowBuildTupleRow(SArray *aColVal, const SRowBuildScanInfo *sinfo *ppRow = (SRow *)taosMemoryCalloc(1, sinfo->tupleRowSize); if (*ppRow == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } (*ppRow)->flag = sinfo->tupleFlag; (*ppRow)->numOfPKs = sinfo->numOfPKs; @@ -354,7 +354,7 @@ static int32_t tRowBuildKVRow(SArray *aColVal, const SRowBuildScanInfo *sinfo, c *ppRow = (SRow *)taosMemoryCalloc(1, sinfo->kvRowSize); if (*ppRow == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } (*ppRow)->flag = sinfo->kvFlag; (*ppRow)->numOfPKs = sinfo->numOfPKs; @@ -663,7 +663,7 @@ static int32_t tRowMergeImpl(SArray *aRowP, STSchema *pTSchema, int32_t iStart, aIter = taosMemoryCalloc(nRow, sizeof(SRowIter *)); if (aIter == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto _exit; } @@ -799,7 +799,7 @@ int32_t tRowIterOpen(SRow *pRow, STSchema *pTSchema, SRowIter **ppIter) { SRowIter *pIter = taosMemoryCalloc(1, sizeof(*pIter)); if (pIter == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto _exit; } @@ -1600,7 +1600,7 @@ int32_t tTagNew(SArray *pArray, int32_t version, int8_t isJson, STag **ppTag) { // build tag (*ppTag) = (STag *)taosMemoryCalloc(szTag, 1); if ((*ppTag) == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto _err; } (*ppTag)->flags = 0; @@ -3423,7 +3423,7 @@ static int32_t tColDataMergeSortMerge(SColData *aColData, int32_t start, int32_t if (end > start) { aDstColData = taosMemoryCalloc(1, sizeof(SColData) * nColData); if (aDstColData == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } for (int c = 0; c < nColData; ++c) { tColDataInit(&aDstColData[c], aColData[c].cid, aColData[c].type, aColData[c].cflag); diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index a96bac8d42..100a24f44d 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -485,27 +485,27 @@ static int32_t taosLoadCfg(SConfig *pCfg, const char **envCmd, const char *input } if ((code = cfgLoad(pCfg, CFG_STYPE_APOLLO_URL, apolloUrl)) != 0) { - uError("failed to load from apollo url:%s since %s", apolloUrl, tstrerror(code)); + (void)printf("failed to load from apollo url:%s since %s\n", apolloUrl, tstrerror(code)); TAOS_RETURN(code); } if ((code = cfgLoad(pCfg, CFG_STYPE_CFG_FILE, cfgFile)) != 0) { - uError("failed to load from cfg file:%s since %s", cfgFile, tstrerror(code)); + (void)printf("failed to load from cfg file:%s since %s\n", cfgFile, tstrerror(code)); TAOS_RETURN(code); } if ((code = cfgLoad(pCfg, CFG_STYPE_ENV_FILE, envFile)) != 0) { - uError("failed to load from env file:%s since %s", envFile, tstrerror(code)); + (void)printf("failed to load from env file:%s since %s\n", envFile, tstrerror(code)); TAOS_RETURN(code); } if ((code = cfgLoad(pCfg, CFG_STYPE_ENV_VAR, NULL)) != 0) { - uError("failed to load from global env variables since %s", tstrerror(code)); + (void)printf("failed to load from global env variables since %s\n", tstrerror(code)); TAOS_RETURN(code); } if ((code = cfgLoad(pCfg, CFG_STYPE_ENV_CMD, envCmd)) != 0) { - uError("failed to load from cmd env variables since %s", tstrerror(code)); + (void)printf("failed to load from cmd env variables since %s\n", tstrerror(code)); TAOS_RETURN(code); } @@ -515,7 +515,7 @@ static int32_t taosLoadCfg(SConfig *pCfg, const char **envCmd, const char *input int32_t taosAddClientLogCfg(SConfig *pCfg) { TAOS_CHECK_RETURN(cfgAddDir(pCfg, "configDir", configDir, CFG_SCOPE_BOTH, CFG_DYN_NONE)); TAOS_CHECK_RETURN(cfgAddDir(pCfg, "scriptDir", configDir, CFG_SCOPE_BOTH, CFG_DYN_NONE)); - TAOS_CHECK_RETURN(cfgAddDir(pCfg, "logDir", tsLogDir, CFG_SCOPE_BOTH, CFG_DYN_CLIENT)); + TAOS_CHECK_RETURN(cfgAddDir(pCfg, "logDir", tsLogDir, CFG_SCOPE_BOTH, CFG_DYN_NONE)); TAOS_CHECK_RETURN(cfgAddFloat(pCfg, "minimalLogDirGB", 1.0f, 0.001f, 10000000, CFG_SCOPE_BOTH, CFG_DYN_CLIENT)); TAOS_CHECK_RETURN( cfgAddInt32(pCfg, "numOfLogLines", tsNumOfLogLines, 1000, 2000000000, CFG_SCOPE_BOTH, CFG_DYN_ENT_BOTH)); @@ -1648,12 +1648,12 @@ int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDi } if ((code = taosLoadCfg(pCfg, envCmd, cfgDir, envFile, apolloUrl)) != TSDB_CODE_SUCCESS) { - printf("failed to load cfg since %s\n", tstrerror(code)); + (void)printf("failed to load cfg since %s\n", tstrerror(code)); goto _exit; } if ((code = cfgLoadFromArray(pCfg, pArgs)) != TSDB_CODE_SUCCESS) { - printf("failed to load cfg from array since %s\n", tstrerror(code)); + (void)printf("failed to load cfg from array since %s\n", tstrerror(code)); goto _exit; } @@ -1669,18 +1669,18 @@ int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDi TAOS_CHECK_GOTO(taosSetAllDebugFlag(pCfg, pDebugItem->i32), &lino, _exit); if ((code = taosMulModeMkDir(tsLogDir, 0777, true)) != TSDB_CODE_SUCCESS) { - printf("failed to create dir:%s since %s\n", tsLogDir, tstrerror(code)); + (void)printf("failed to create dir:%s since %s\n", tsLogDir, tstrerror(code)); goto _exit; } if ((code = taosInitLog(logname, logFileNum, tsc)) != 0) { - printf("failed to init log file since %s\n", tstrerror(code)); + (void)printf("failed to init log file since %s\n", tstrerror(code)); goto _exit; } _exit: if (TSDB_CODE_SUCCESS != code) { - printf("failed to create log at %d since %s:", lino, tstrerror(code)); + (void)printf("failed to create log at %d since %s\n", lino, tstrerror(code)); } cfgCleanup(pCfg); @@ -1700,12 +1700,12 @@ int32_t taosReadDataFolder(const char *cfgDir, const char **envCmd, const char * TAOS_CHECK_GOTO(cfgAddInt32(pCfg, "dDebugFlag", dDebugFlag, 0, 255, CFG_SCOPE_SERVER, CFG_DYN_SERVER) ,NULL, _exit); if ((code = taosLoadCfg(pCfg, envCmd, cfgDir, envFile, apolloUrl)) != 0) { - printf("failed to load cfg since %s\n", tstrerror(code)); + (void)printf("failed to load cfg since %s\n", tstrerror(code)); goto _exit; } if ((code = cfgLoadFromArray(pCfg, pArgs)) != 0) { - printf("failed to load cfg from array since %s\n", tstrerror(code)); + (void)printf("failed to load cfg from array since %s\n", tstrerror(code)); goto _exit; } @@ -1769,14 +1769,14 @@ int32_t taosInitCfg(const char *cfgDir, const char **envCmd, const char *envFile TAOS_CHECK_GOTO(taosAddSystemCfg(tsCfg), &lino, _exit); if ((code = taosLoadCfg(tsCfg, envCmd, cfgDir, envFile, apolloUrl)) != 0) { - uError("failed to load cfg since %s", tstrerror(code)); + (void)printf("failed to load cfg since %s\n", tstrerror(code)); cfgCleanup(tsCfg); tsCfg = NULL; TAOS_RETURN(code); } if ((code = cfgLoadFromArray(tsCfg, pArgs)) != 0) { - uError("failed to load cfg from array since %s", tstrerror(code)); + (void)printf("failed to load cfg from array since %s\n", tstrerror(code)); cfgCleanup(tsCfg); tsCfg = NULL; TAOS_RETURN(code); @@ -1798,7 +1798,7 @@ int32_t taosInitCfg(const char *cfgDir, const char **envCmd, const char *envFile SConfigItem *pItem = cfgGetItem(tsCfg, "debugFlag"); if (NULL == pItem) { - uError("debugFlag not found in cfg"); + (void)printf("debugFlag not found in cfg\n"); TAOS_RETURN(TSDB_CODE_CFG_NOT_FOUND); } TAOS_CHECK_GOTO(taosSetAllDebugFlag(tsCfg, pItem->i32), &lino, _exit); @@ -1811,7 +1811,7 @@ _exit: if (TSDB_CODE_SUCCESS != code) { cfgCleanup(tsCfg); tsCfg = NULL; - uError("failed to init cfg at %d since %s", lino, tstrerror(code)); + (void)printf("failed to init cfg at %d since %s\n", lino, tstrerror(code)); } TAOS_RETURN(code); @@ -2095,11 +2095,6 @@ static int32_t taosCfgDynamicOptionsForClient(SConfig *pCfg, const char *name) { osSetSystemLocale(locale, charset); uInfo("locale set to '%s', charset set to '%s'", locale, charset); matched = true; - } else if (strcasecmp("logDir", name) == 0) { - uInfo("%s set from '%s' to '%s'", name, tsLogDir, pItem->str); - tstrncpy(tsLogDir, pItem->str, PATH_MAX); - TAOS_CHECK_GOTO(taosExpandDir(tsLogDir, tsLogDir, PATH_MAX), &lino, _out); - matched = true; } break; } diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 58a7f8f448..7018dc5696 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -153,7 +153,9 @@ int32_t tGetSubmitMsgNext(SSubmitMsgIter *pIter, SSubmitBlk **pPBlock) { } int32_t tInitSubmitBlkIter(SSubmitMsgIter *pMsgIter, SSubmitBlk *pBlock, SSubmitBlkIter *pIter) { - if (pMsgIter->dataLen <= 0) return -1; + if (pMsgIter->dataLen <= 0) { + return TSDB_CODE_INVALID_PARA; + } pIter->totalLen = pMsgIter->dataLen; pIter->len = 0; pIter->row = (STSRow *)(pBlock->data + pMsgIter->schemaLen); @@ -174,27 +176,6 @@ STSRow *tGetSubmitBlkNext(SSubmitBlkIter *pIter) { } } -#ifdef BUILD_NO_CALL -int32_t tPrintFixedSchemaSubmitReq(SSubmitReq *pReq, STSchema *pTschema) { - SSubmitMsgIter msgIter = {0}; - if (tInitSubmitMsgIter(pReq, &msgIter) < 0) return -1; - while (true) { - SSubmitBlk *pBlock = NULL; - if (tGetSubmitMsgNext(&msgIter, &pBlock) < 0) return -1; - if (pBlock == NULL) break; - SSubmitBlkIter blkIter = {0}; - tInitSubmitBlkIter(&msgIter, pBlock, &blkIter); - STSRowIter rowIter = {0}; - tdSTSRowIterInit(&rowIter, pTschema); - STSRow *row; - while ((row = tGetSubmitBlkNext(&blkIter)) != NULL) { - tdSRowPrint(row, pTschema, "stream"); - } - } - return 0; -} -#endif - int32_t tEncodeSEpSet(SEncoder *pEncoder, const SEpSet *pEp) { TAOS_CHECK_RETURN(tEncodeI8(pEncoder, pEp->inUse)); TAOS_CHECK_RETURN(tEncodeI8(pEncoder, pEp->numOfEps)); @@ -346,14 +327,18 @@ static int32_t tDeserializeSClientHbReq(SDecoder *pDecoder, SClientHbReq *pReq) TAOS_CHECK_RETURN(tDecodeI32(pDecoder, &queryNum)); if (queryNum) { pReq->query = taosMemoryCalloc(1, sizeof(*pReq->query)); - if (NULL == pReq->query) return -1; + if (NULL == pReq->query) { + return terrno; + } TAOS_CHECK_RETURN(tDecodeU32(pDecoder, &pReq->query->connId)); int32_t num = 0; TAOS_CHECK_RETURN(tDecodeI32(pDecoder, &num)); if (num > 0) { pReq->query->queryDesc = taosArrayInit(num, sizeof(SQueryDesc)); - if (NULL == pReq->query->queryDesc) return -1; + if (NULL == pReq->query->queryDesc) { + return terrno; + } for (int32_t i = 0; i < num; ++i) { SQueryDesc desc = {0}; @@ -371,7 +356,9 @@ static int32_t tDeserializeSClientHbReq(SDecoder *pDecoder, SClientHbReq *pReq) TAOS_CHECK_RETURN(tDecodeI32(pDecoder, &snum)); if (snum > 0) { desc.subDesc = taosArrayInit(snum, sizeof(SQuerySubDesc)); - if (NULL == desc.subDesc) return -1; + if (NULL == desc.subDesc) { + return terrno; + } for (int32_t m = 0; m < snum; ++m) { SQuerySubDesc sDesc = {0}; @@ -457,7 +444,9 @@ static int32_t tDeserializeSClientHbRsp(SDecoder *pDecoder, SClientHbRsp *pRsp) TAOS_CHECK_RETURN(tDecodeI32(pDecoder, &queryNum)); if (queryNum) { pRsp->query = taosMemoryCalloc(1, sizeof(*pRsp->query)); - if (NULL == pRsp->query) return -1; + if (NULL == pRsp->query) { + return terrno; + } TAOS_CHECK_RETURN(tDecodeU32(pDecoder, &pRsp->query->connId)); TAOS_CHECK_RETURN(tDecodeU64(pDecoder, &pRsp->query->killRid)); TAOS_CHECK_RETURN(tDecodeI32(pDecoder, &pRsp->query->totalDnodes)); @@ -480,7 +469,9 @@ static int32_t tDeserializeSClientHbRsp(SDecoder *pDecoder, SClientHbRsp *pRsp) int32_t kvNum = 0; TAOS_CHECK_RETURN(tDecodeI32(pDecoder, &kvNum)); pRsp->info = taosArrayInit(kvNum, sizeof(SKv)); - if (pRsp->info == NULL) return -1; + if (pRsp->info == NULL) { + return terrno; + } for (int32_t i = 0; i < kvNum; i++) { SKv kv = {0}; TAOS_CHECK_RETURN(tDecodeSKv(pDecoder, &kv)); @@ -492,262 +483,318 @@ static int32_t tDeserializeSClientHbRsp(SDecoder *pDecoder, SClientHbRsp *pRsp) int32_t tSerializeSClientHbBatchReq(void *buf, int32_t bufLen, const SClientHbBatchReq *pBatchReq) { SEncoder encoder = {0}; + int32_t code = 0; + int32_t lino; + int32_t tlen = 0; tEncoderInit(&encoder, buf, bufLen); - if (tStartEncode(&encoder) < 0) return -1; - if (tEncodeI64(&encoder, pBatchReq->reqId) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pBatchReq->reqId)); int32_t reqNum = taosArrayGetSize(pBatchReq->reqs); - if (tEncodeI32(&encoder, reqNum) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, reqNum)); for (int32_t i = 0; i < reqNum; i++) { SClientHbReq *pReq = taosArrayGet(pBatchReq->reqs, i); - if (tSerializeSClientHbReq(&encoder, pReq) < 0) return -1; + TAOS_CHECK_EXIT(tSerializeSClientHbReq(&encoder, pReq)); } - if (tEncodeI64(&encoder, pBatchReq->ipWhiteList) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pBatchReq->ipWhiteList)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSClientHbBatchReq(void *buf, int32_t bufLen, SClientHbBatchReq *pBatchReq) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeI64(&decoder, &pBatchReq->reqId) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pBatchReq->reqId)); int32_t reqNum = 0; - if (tDecodeI32(&decoder, &reqNum) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &reqNum)); if (reqNum > 0) { pBatchReq->reqs = taosArrayInit(reqNum, sizeof(SClientHbReq)); - if (NULL == pBatchReq->reqs) return -1; + if (NULL == pBatchReq->reqs) { + return terrno; + } } for (int32_t i = 0; i < reqNum; i++) { SClientHbReq req = {0}; - if (tDeserializeSClientHbReq(&decoder, &req) < 0) return -1; - if (!taosArrayPush(pBatchReq->reqs, &req)) return -1; + TAOS_CHECK_EXIT(tDeserializeSClientHbReq(&decoder, &req)); + if (!taosArrayPush(pBatchReq->reqs, &req)) { + TAOS_CHECK_EXIT(terrno); + } } if (!tDecodeIsEnd(&decoder)) { - if (tDecodeI64(&decoder, &pBatchReq->ipWhiteList) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pBatchReq->ipWhiteList)); } tEndDecode(&decoder); + +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSClientHbBatchRsp(void *buf, int32_t bufLen, const SClientHbBatchRsp *pBatchRsp) { SEncoder encoder = {0}; + int32_t code = 0; + int32_t lino; + int32_t tlen; tEncoderInit(&encoder, buf, bufLen); - if (tStartEncode(&encoder) < 0) return -1; - if (tEncodeI64(&encoder, pBatchRsp->reqId) < 0) return -1; - if (tEncodeI64(&encoder, pBatchRsp->rspId) < 0) return -1; - if (tEncodeI32(&encoder, pBatchRsp->svrTimestamp) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pBatchRsp->reqId)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pBatchRsp->rspId)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pBatchRsp->svrTimestamp)); int32_t rspNum = taosArrayGetSize(pBatchRsp->rsps); - if (tEncodeI32(&encoder, rspNum) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, rspNum)); for (int32_t i = 0; i < rspNum; i++) { SClientHbRsp *pRsp = taosArrayGet(pBatchRsp->rsps, i); - if (tSerializeSClientHbRsp(&encoder, pRsp) < 0) return -1; + TAOS_CHECK_EXIT(tSerializeSClientHbRsp(&encoder, pRsp)); } - if (tSerializeSMonitorParas(&encoder, &pBatchRsp->monitorParas) < 0) return -1; + TAOS_CHECK_EXIT(tSerializeSMonitorParas(&encoder, &pBatchRsp->monitorParas)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSClientHbBatchRsp(void *buf, int32_t bufLen, SClientHbBatchRsp *pBatchRsp) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeI64(&decoder, &pBatchRsp->reqId) < 0) return -1; - if (tDecodeI64(&decoder, &pBatchRsp->rspId) < 0) return -1; - if (tDecodeI32(&decoder, &pBatchRsp->svrTimestamp) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pBatchRsp->reqId)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pBatchRsp->rspId)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pBatchRsp->svrTimestamp)); int32_t rspNum = 0; - if (tDecodeI32(&decoder, &rspNum) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &rspNum)); if (pBatchRsp->rsps == NULL) { - if ((pBatchRsp->rsps = taosArrayInit(rspNum, sizeof(SClientHbRsp))) == NULL) return -1; + if ((pBatchRsp->rsps = taosArrayInit(rspNum, sizeof(SClientHbRsp))) == NULL) { + TAOS_CHECK_EXIT(terrno); + } } for (int32_t i = 0; i < rspNum; i++) { SClientHbRsp rsp = {0}; - if (tDeserializeSClientHbRsp(&decoder, &rsp) < 0) return -1; - if (taosArrayPush(pBatchRsp->rsps, &rsp) == NULL) return -1; + TAOS_CHECK_EXIT(tDeserializeSClientHbRsp(&decoder, &rsp)); + if (taosArrayPush(pBatchRsp->rsps, &rsp) == NULL) { + TAOS_CHECK_EXIT(terrno); + } } if (!tDecodeIsEnd(&decoder)) { - if (tDeserializeSMonitorParas(&decoder, &pBatchRsp->monitorParas) < 0) return -1; + TAOS_CHECK_EXIT(tDeserializeSMonitorParas(&decoder, &pBatchRsp->monitorParas)); } tEndDecode(&decoder); + +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSMCreateStbReq(void *buf, int32_t bufLen, SMCreateStbReq *pReq) { SEncoder encoder = {0}; + int32_t code = 0; + int32_t lino; + int32_t tlen; tEncoderInit(&encoder, buf, bufLen); - if (tStartEncode(&encoder) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->name) < 0) return -1; - if (tEncodeI8(&encoder, pReq->igExists) < 0) return -1; - if (tEncodeI8(&encoder, pReq->source) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->name)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->igExists)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->source)); for (int32_t i = 0; i < sizeof(pReq->reserved) / sizeof(int8_t); ++i) { - if (tEncodeI8(&encoder, pReq->reserved[i]) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->reserved[i])); } - if (tEncodeI64(&encoder, pReq->suid) < 0) return -1; - if (tEncodeI64(&encoder, pReq->delay1) < 0) return -1; - if (tEncodeI64(&encoder, pReq->delay2) < 0) return -1; - if (tEncodeI64(&encoder, pReq->watermark1) < 0) return -1; - if (tEncodeI64(&encoder, pReq->watermark2) < 0) return -1; - if (tEncodeI32(&encoder, pReq->ttl) < 0) return -1; - if (tEncodeI32(&encoder, pReq->colVer) < 0) return -1; - if (tEncodeI32(&encoder, pReq->tagVer) < 0) return -1; - if (tEncodeI32(&encoder, pReq->numOfColumns) < 0) return -1; - if (tEncodeI32(&encoder, pReq->numOfTags) < 0) return -1; - if (tEncodeI32(&encoder, pReq->numOfFuncs) < 0) return -1; - if (tEncodeI32(&encoder, pReq->commentLen) < 0) return -1; - if (tEncodeI32(&encoder, pReq->ast1Len) < 0) return -1; - if (tEncodeI32(&encoder, pReq->ast2Len) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->suid)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->delay1)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->delay2)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->watermark1)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->watermark2)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->ttl)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->colVer)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->tagVer)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->numOfColumns)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->numOfTags)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->numOfFuncs)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->commentLen)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->ast1Len)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->ast2Len)); for (int32_t i = 0; i < pReq->numOfColumns; ++i) { SFieldWithOptions *pField = taosArrayGet(pReq->pColumns, i); - if (tEncodeI8(&encoder, pField->type) < 0) return -1; - if (tEncodeI8(&encoder, pField->flags) < 0) return -1; - if (tEncodeI32(&encoder, pField->bytes) < 0) return -1; - if (tEncodeCStr(&encoder, pField->name) < 0) return -1; - if (tEncodeU32(&encoder, pField->compress) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pField->type)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pField->flags)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pField->bytes)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pField->name)); + TAOS_CHECK_EXIT(tEncodeU32(&encoder, pField->compress)); } for (int32_t i = 0; i < pReq->numOfTags; ++i) { SField *pField = taosArrayGet(pReq->pTags, i); - if (tEncodeI8(&encoder, pField->type) < 0) return -1; - if (tEncodeI8(&encoder, pField->flags) < 0) return -1; - if (tEncodeI32(&encoder, pField->bytes) < 0) return -1; - if (tEncodeCStr(&encoder, pField->name) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pField->type)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pField->flags)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pField->bytes)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pField->name)); } for (int32_t i = 0; i < pReq->numOfFuncs; ++i) { const char *pFunc = taosArrayGet(pReq->pFuncs, i); - if (tEncodeCStr(&encoder, pFunc) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pFunc)); } if (pReq->commentLen > 0) { - if (tEncodeCStr(&encoder, pReq->pComment) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->pComment)); } if (pReq->ast1Len > 0) { - if (tEncodeBinary(&encoder, pReq->pAst1, pReq->ast1Len) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeBinary(&encoder, pReq->pAst1, pReq->ast1Len)); } if (pReq->ast2Len > 0) { - if (tEncodeBinary(&encoder, pReq->pAst2, pReq->ast2Len) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeBinary(&encoder, pReq->pAst2, pReq->ast2Len)); } - if (tEncodeI64(&encoder, pReq->deleteMark1) < 0) return -1; - if (tEncodeI64(&encoder, pReq->deleteMark2) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->deleteMark1)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->deleteMark2)); ENCODESQL(); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSMCreateStbReq(void *buf, int32_t bufLen, SMCreateStbReq *pReq) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->name) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->igExists) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->source) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->name)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->igExists)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->source)); for (int32_t i = 0; i < sizeof(pReq->reserved) / sizeof(int8_t); ++i) { - if (tDecodeI8(&decoder, &pReq->reserved[i]) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->reserved[i])); } - if (tDecodeI64(&decoder, &pReq->suid) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->delay1) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->delay2) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->watermark1) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->watermark2) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->ttl) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->colVer) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->tagVer) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->numOfColumns) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->numOfTags) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->numOfFuncs) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->commentLen) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->ast1Len) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->ast2Len) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->suid)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->delay1)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->delay2)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->watermark1)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->watermark2)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->ttl)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->colVer)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->tagVer)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->numOfColumns)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->numOfTags)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->numOfFuncs)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->commentLen)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->ast1Len)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->ast2Len)); - if ((pReq->pColumns = taosArrayInit(pReq->numOfColumns, sizeof(SFieldWithOptions))) == NULL) return -1; - if ((pReq->pTags = taosArrayInit(pReq->numOfTags, sizeof(SField))) == NULL) return -1; - if ((pReq->pFuncs = taosArrayInit(pReq->numOfFuncs, TSDB_FUNC_NAME_LEN)) == NULL) return -1; + if ((pReq->pColumns = taosArrayInit(pReq->numOfColumns, sizeof(SFieldWithOptions))) == NULL) { + TAOS_CHECK_EXIT(terrno); + } + if ((pReq->pTags = taosArrayInit(pReq->numOfTags, sizeof(SField))) == NULL) { + TAOS_CHECK_EXIT(terrno); + } + if ((pReq->pFuncs = taosArrayInit(pReq->numOfFuncs, TSDB_FUNC_NAME_LEN)) == NULL) { + TAOS_CHECK_EXIT(terrno); + } for (int32_t i = 0; i < pReq->numOfColumns; ++i) { SFieldWithOptions field = {0}; - if (tDecodeI8(&decoder, &field.type) < 0) return -1; - if (tDecodeI8(&decoder, &field.flags) < 0) return -1; - if (tDecodeI32(&decoder, &field.bytes) < 0) return -1; - if (tDecodeCStrTo(&decoder, field.name) < 0) return -1; - if (tDecodeU32(&decoder, &field.compress) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &field.type)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &field.flags)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &field.bytes)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, field.name)); + TAOS_CHECK_EXIT(tDecodeU32(&decoder, &field.compress)); if (taosArrayPush(pReq->pColumns, &field) == NULL) { - return -1; + TAOS_CHECK_EXIT(terrno); } } for (int32_t i = 0; i < pReq->numOfTags; ++i) { SField field = {0}; - if (tDecodeI8(&decoder, &field.type) < 0) return -1; - if (tDecodeI8(&decoder, &field.flags) < 0) return -1; - if (tDecodeI32(&decoder, &field.bytes) < 0) return -1; - if (tDecodeCStrTo(&decoder, field.name) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &field.type)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &field.flags)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &field.bytes)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, field.name)); if (taosArrayPush(pReq->pTags, &field) == NULL) { - return -1; + TAOS_CHECK_EXIT(terrno); } } for (int32_t i = 0; i < pReq->numOfFuncs; ++i) { char pFunc[TSDB_FUNC_NAME_LEN] = {0}; - if (tDecodeCStrTo(&decoder, pFunc) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pFunc)); if (taosArrayPush(pReq->pFuncs, pFunc) == NULL) { - return -1; + TAOS_CHECK_EXIT(terrno); } } if (pReq->commentLen > 0) { pReq->pComment = taosMemoryMalloc(pReq->commentLen + 1); - if (pReq->pComment == NULL) return -1; - if (tDecodeCStrTo(&decoder, pReq->pComment) < 0) return -1; + if (pReq->pComment == NULL) { + TAOS_CHECK_EXIT(terrno); + } + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->pComment)); } if (pReq->ast1Len > 0) { pReq->pAst1 = taosMemoryMalloc(pReq->ast1Len); - if (pReq->pAst1 == NULL) return -1; - if (tDecodeCStrTo(&decoder, pReq->pAst1) < 0) return -1; + if (pReq->pAst1 == NULL) { + TAOS_CHECK_EXIT(terrno); + } + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->pAst1)); } if (pReq->ast2Len > 0) { pReq->pAst2 = taosMemoryMalloc(pReq->ast2Len); - if (pReq->pAst2 == NULL) return -1; - if (tDecodeCStrTo(&decoder, pReq->pAst2) < 0) return -1; + if (pReq->pAst2 == NULL) { + TAOS_CHECK_EXIT(terrno); + } + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->pAst2)); } - if (tDecodeI64(&decoder, &pReq->deleteMark1) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->deleteMark2) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->deleteMark1)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->deleteMark2)); DECODESQL(); tEndDecode(&decoder); + +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSMCreateStbReq(SMCreateStbReq *pReq) { @@ -762,134 +809,161 @@ void tFreeSMCreateStbReq(SMCreateStbReq *pReq) { int32_t tSerializeSMDropStbReq(void *buf, int32_t bufLen, SMDropStbReq *pReq) { SEncoder encoder = {0}; + int32_t code = 0; + int32_t lino; + int32_t tlen; tEncoderInit(&encoder, buf, bufLen); - if (tStartEncode(&encoder) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->name) < 0) return -1; - if (tEncodeI8(&encoder, pReq->igNotExists) < 0) return -1; - if (tEncodeI8(&encoder, pReq->source) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->name)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->igNotExists)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->source)); for (int32_t i = 0; i < sizeof(pReq->reserved) / sizeof(int8_t); ++i) { - if (tEncodeI8(&encoder, pReq->reserved[i]) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->reserved[i])); } - if (tEncodeI64(&encoder, pReq->suid) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->suid)); ENCODESQL(); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSMDropStbReq(void *buf, int32_t bufLen, SMDropStbReq *pReq) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->name) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->igNotExists) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->source) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->name)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->igNotExists)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->source)); for (int32_t i = 0; i < sizeof(pReq->reserved) / sizeof(int8_t); ++i) { - if (tDecodeI8(&decoder, &pReq->reserved[i]) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->reserved[i])); } - if (tDecodeI64(&decoder, &pReq->suid) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->suid)); DECODESQL(); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSMDropStbReq(SMDropStbReq *pReq) { FREESQL(); } int32_t tSerializeSMAlterStbReq(void *buf, int32_t bufLen, SMAlterStbReq *pReq) { SEncoder encoder = {0}; + int32_t code = 0; + int32_t lino; + int32_t tlen; tEncoderInit(&encoder, buf, bufLen); - if (tStartEncode(&encoder) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->name) < 0) return -1; - if (tEncodeI8(&encoder, pReq->alterType) < 0) return -1; - if (tEncodeI32(&encoder, pReq->numOfFields) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->name)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->alterType)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->numOfFields)); // if (pReq->alterType == ) for (int32_t i = 0; i < pReq->numOfFields; ++i) { if (pReq->alterType == TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION) { SFieldWithOptions *pField = taosArrayGet(pReq->pFields, i); - if (tEncodeI8(&encoder, pField->type) < 0) return -1; - if (tEncodeI32(&encoder, pField->bytes) < 0) return -1; - if (tEncodeCStr(&encoder, pField->name) < 0) return -1; - if (tEncodeU32(&encoder, pField->compress) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pField->type)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pField->bytes)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pField->name)); + TAOS_CHECK_EXIT(tEncodeU32(&encoder, pField->compress)); } else { SField *pField = taosArrayGet(pReq->pFields, i); - if (tEncodeI8(&encoder, pField->type) < 0) return -1; - if (tEncodeI32(&encoder, pField->bytes) < 0) return -1; - if (tEncodeCStr(&encoder, pField->name) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pField->type)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pField->bytes)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pField->name)); } } - if (tEncodeI32(&encoder, pReq->ttl) < 0) return -1; - if (tEncodeI32(&encoder, pReq->commentLen) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->ttl)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->commentLen)); if (pReq->commentLen > 0) { - if (tEncodeCStr(&encoder, pReq->comment) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->comment)); } ENCODESQL(); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSMAlterStbReq(void *buf, int32_t bufLen, SMAlterStbReq *pReq) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->name) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->alterType) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->numOfFields) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->name)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->alterType)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->numOfFields)); pReq->pFields = taosArrayInit(pReq->numOfFields, sizeof(SField)); if (pReq->pFields == NULL) { - return -1; + TAOS_CHECK_EXIT(terrno); } for (int32_t i = 0; i < pReq->numOfFields; ++i) { if (pReq->alterType == TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION) { taosArrayDestroy(pReq->pFields); - if ((pReq->pFields = taosArrayInit(pReq->numOfFields, sizeof(SFieldWithOptions))) == NULL) return -1; + if ((pReq->pFields = taosArrayInit(pReq->numOfFields, sizeof(SFieldWithOptions))) == NULL) { + TAOS_CHECK_EXIT(terrno); + } SFieldWithOptions field = {0}; - if (tDecodeI8(&decoder, &field.type) < 0) return -1; - if (tDecodeI32(&decoder, &field.bytes) < 0) return -1; - if (tDecodeCStrTo(&decoder, field.name) < 0) return -1; - if (tDecodeU32(&decoder, &field.compress) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &field.type)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &field.bytes)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, field.name)); + TAOS_CHECK_EXIT(tDecodeU32(&decoder, &field.compress)); if (taosArrayPush(pReq->pFields, &field) == NULL) { - return -1; + TAOS_CHECK_EXIT(terrno); } } else { SField field = {0}; - if (tDecodeI8(&decoder, &field.type) < 0) return -1; - if (tDecodeI32(&decoder, &field.bytes) < 0) return -1; - if (tDecodeCStrTo(&decoder, field.name) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &field.type)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &field.bytes)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, field.name)); if (taosArrayPush(pReq->pFields, &field) == NULL) { - return -1; + TAOS_CHECK_EXIT(terrno); } } } - if (tDecodeI32(&decoder, &pReq->ttl) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->commentLen) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->ttl)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->commentLen)); if (pReq->commentLen > 0) { pReq->comment = taosMemoryMalloc(pReq->commentLen + 1); - if (pReq->comment == NULL) return -1; - if (tDecodeCStrTo(&decoder, pReq->comment) < 0) return -1; + if (pReq->comment == NULL) { + TAOS_CHECK_EXIT(terrno); + } + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->comment)); } DECODESQL(); tEndDecode(&decoder); + +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSMAltertbReq(SMAlterStbReq *pReq) { @@ -901,146 +975,181 @@ void tFreeSMAltertbReq(SMAlterStbReq *pReq) { int32_t tSerializeSEpSet(void *buf, int32_t bufLen, const SEpSet *pEpset) { SEncoder encoder = {0}; + int32_t code = 0; + int32_t lino; + int32_t tlen; tEncoderInit(&encoder, buf, bufLen); - if (tStartEncode(&encoder) < 0) return -1; - if (tEncodeSEpSet(&encoder, pEpset) < 0) return -1; + + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeSEpSet(&encoder, pEpset)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; + +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSEpSet(void *buf, int32_t bufLen, SEpSet *pEpset) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; + tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeSEpSet(&decoder, pEpset) < 0) return -1; + + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeSEpSet(&decoder, pEpset)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSMCreateSmaReq(void *buf, int32_t bufLen, SMCreateSmaReq *pReq) { SEncoder encoder = {0}; + int32_t code = 0; + int32_t lino; + int32_t tlen; tEncoderInit(&encoder, buf, bufLen); - if (tStartEncode(&encoder) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->name) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->stb) < 0) return -1; - if (tEncodeI8(&encoder, pReq->igExists) < 0) return -1; - if (tEncodeI8(&encoder, pReq->intervalUnit) < 0) return -1; - if (tEncodeI8(&encoder, pReq->slidingUnit) < 0) return -1; - if (tEncodeI8(&encoder, pReq->timezone) < 0) return -1; - if (tEncodeI32(&encoder, pReq->dstVgId) < 0) return -1; - if (tEncodeI64(&encoder, pReq->interval) < 0) return -1; - if (tEncodeI64(&encoder, pReq->offset) < 0) return -1; - if (tEncodeI64(&encoder, pReq->sliding) < 0) return -1; - if (tEncodeI64(&encoder, pReq->watermark) < 0) return -1; - if (tEncodeI64(&encoder, pReq->maxDelay) < 0) return -1; - if (tEncodeI32(&encoder, pReq->exprLen) < 0) return -1; - if (tEncodeI32(&encoder, pReq->tagsFilterLen) < 0) return -1; - if (tEncodeI32(&encoder, pReq->sqlLen) < 0) return -1; - if (tEncodeI32(&encoder, pReq->astLen) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->name)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->stb)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->igExists)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->intervalUnit)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->slidingUnit)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->timezone)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->dstVgId)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->interval)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->offset)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->sliding)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->watermark)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->maxDelay)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->exprLen)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->tagsFilterLen)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->sqlLen)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->astLen)); if (pReq->exprLen > 0) { - if (tEncodeBinary(&encoder, pReq->expr, pReq->exprLen) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeBinary(&encoder, pReq->expr, pReq->exprLen)); } if (pReq->tagsFilterLen > 0) { - if (tEncodeBinary(&encoder, pReq->tagsFilter, pReq->tagsFilterLen) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeBinary(&encoder, pReq->tagsFilter, pReq->tagsFilterLen)); } if (pReq->sqlLen > 0) { - if (tEncodeBinary(&encoder, pReq->sql, pReq->sqlLen) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeBinary(&encoder, pReq->sql, pReq->sqlLen)); } if (pReq->astLen > 0) { - if (tEncodeBinary(&encoder, pReq->ast, pReq->astLen) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeBinary(&encoder, pReq->ast, pReq->astLen)); } - if (tEncodeI64(&encoder, pReq->deleteMark) < 0) return -1; - if (tEncodeI64(&encoder, pReq->lastTs) < 0) return -1; - if (tEncodeI64(&encoder, pReq->normSourceTbUid) < 0) return -1; - if (tEncodeI32(&encoder, taosArrayGetSize(pReq->pVgroupVerList)) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->deleteMark)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->lastTs)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->normSourceTbUid)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, taosArrayGetSize(pReq->pVgroupVerList))); for (int32_t i = 0; i < taosArrayGetSize(pReq->pVgroupVerList); ++i) { SVgroupVer *p = taosArrayGet(pReq->pVgroupVerList, i); - if (tEncodeI32(&encoder, p->vgId) < 0) return -1; - if (tEncodeI64(&encoder, p->ver) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, p->vgId)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, p->ver)); } - if (tEncodeI8(&encoder, pReq->recursiveTsma) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->baseTsmaName) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->recursiveTsma)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->baseTsmaName)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSMCreateSmaReq(void *buf, int32_t bufLen, SMCreateSmaReq *pReq) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->name) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->stb) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->igExists) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->intervalUnit) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->slidingUnit) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->timezone) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->dstVgId) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->interval) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->offset) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->sliding) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->watermark) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->maxDelay) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->exprLen) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->tagsFilterLen) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->sqlLen) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->astLen) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->name)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->stb)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->igExists)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->intervalUnit)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->slidingUnit)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->timezone)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->dstVgId)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->interval)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->offset)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->sliding)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->watermark)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->maxDelay)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->exprLen)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->tagsFilterLen)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->sqlLen)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->astLen)); if (pReq->exprLen > 0) { pReq->expr = taosMemoryMalloc(pReq->exprLen); - if (pReq->expr == NULL) return -1; - if (tDecodeCStrTo(&decoder, pReq->expr) < 0) return -1; + if (pReq->expr == NULL) { + TAOS_CHECK_EXIT(terrno); + } + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->expr)); } if (pReq->tagsFilterLen > 0) { pReq->tagsFilter = taosMemoryMalloc(pReq->tagsFilterLen); - if (pReq->tagsFilter == NULL) return -1; - if (tDecodeCStrTo(&decoder, pReq->tagsFilter) < 0) return -1; + if (pReq->tagsFilter == NULL) { + TAOS_CHECK_EXIT(terrno); + } + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->tagsFilter)); } if (pReq->sqlLen > 0) { pReq->sql = taosMemoryMalloc(pReq->sqlLen); - if (pReq->sql == NULL) return -1; - if (tDecodeCStrTo(&decoder, pReq->sql) < 0) return -1; + if (pReq->sql == NULL) { + TAOS_CHECK_EXIT(terrno); + } + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->sql)); } if (pReq->astLen > 0) { pReq->ast = taosMemoryMalloc(pReq->astLen); - if (pReq->ast == NULL) return -1; - if (tDecodeCStrTo(&decoder, pReq->ast) < 0) return -1; + if (pReq->ast == NULL) { + TAOS_CHECK_EXIT(terrno); + } + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->ast)); } - if (tDecodeI64(&decoder, &pReq->deleteMark) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->lastTs) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->normSourceTbUid) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->deleteMark)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->lastTs)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->normSourceTbUid)); int32_t numOfVgVer; - if (tDecodeI32(&decoder, &numOfVgVer) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &numOfVgVer)); if (numOfVgVer > 0) { pReq->pVgroupVerList = taosArrayInit(numOfVgVer, sizeof(SVgroupVer)); if (pReq->pVgroupVerList == NULL) { - return -1; + TAOS_CHECK_EXIT(terrno); } for (int32_t i = 0; i < numOfVgVer; ++i) { SVgroupVer v = {0}; - if (tDecodeI32(&decoder, &v.vgId) < 0) return -1; - if (tDecodeI64(&decoder, &v.ver) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &v.vgId)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &v.ver)); if (taosArrayPush(pReq->pVgroupVerList, &v) == NULL) { - return -1; + TAOS_CHECK_EXIT(terrno); } } } - if (tDecodeI8(&decoder, &pReq->recursiveTsma) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->baseTsmaName) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->recursiveTsma)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->baseTsmaName)); tEndDecode(&decoder); + +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSMCreateSmaReq(SMCreateSmaReq *pReq) { @@ -1053,63 +1162,86 @@ void tFreeSMCreateSmaReq(SMCreateSmaReq *pReq) { int32_t tSerializeSMDropSmaReq(void *buf, int32_t bufLen, SMDropSmaReq *pReq) { SEncoder encoder = {0}; + int32_t code = 0; + int32_t lino; + int32_t tlen; tEncoderInit(&encoder, buf, bufLen); - if (tStartEncode(&encoder) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->name) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->name)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->igNotExists)); - if (tEncodeI8(&encoder, pReq->igNotExists) < 0) return -1; tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSMDropSmaReq(void *buf, int32_t bufLen, SMDropSmaReq *pReq) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->name) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->igNotExists) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->name)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->igNotExists)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSCreateTagIdxReq(void *buf, int32_t bufLen, SCreateTagIndexReq *pReq) { SEncoder encoder = {0}; + int32_t code = 0; + int32_t lino; + int32_t tlen; tEncoderInit(&encoder, buf, bufLen); - if (tStartEncode(&encoder) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->dbFName) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->stbName) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->colName) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->idxName) < 0) return -1; - if (tEncodeI8(&encoder, pReq->idxType) < 0) return -1; + + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->dbFName)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->stbName)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->colName)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->idxName)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->idxType)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } + int32_t tDeserializeSCreateTagIdxReq(void *buf, int32_t bufLen, SCreateTagIndexReq *pReq) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - - if (tDecodeCStrTo(&decoder, pReq->dbFName) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->stbName) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->colName) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->idxName) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->idxType) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->dbFName)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->stbName)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->colName)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->idxName)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->idxType)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } // int32_t tSerializeSDropTagIdxReq(void *buf, int32_t bufLen, SDropTagIndexReq *pReq) { // SEncoder encoder = {0}; @@ -1126,37 +1258,50 @@ int32_t tDeserializeSCreateTagIdxReq(void *buf, int32_t bufLen, SCreateTagIndexR // } int32_t tDeserializeSDropTagIdxReq(void *buf, int32_t bufLen, SDropTagIndexReq *pReq) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->name) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->igNotExists) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->name)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->igNotExists)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - - return 0; + return code; } int32_t tSerializeSMCreateFullTextReq(void *buf, int32_t bufLen, SMCreateFullTextReq *pReq) { SEncoder encoder = {0}; + int32_t code = 0; + int32_t lino; + int32_t tlen; tEncoderInit(&encoder, buf, bufLen); - if (tStartEncode(&encoder) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } + int32_t tDeserializeSMCreateFullTextReq(void *buf, int32_t bufLen, SMCreateFullTextReq *pReq) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - + TAOS_CHECK_EXIT(tStartDecode(&decoder)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSMCreateFullTextReq(SMCreateFullTextReq *pReq) { // impl later @@ -1191,55 +1336,61 @@ void tFreeSMCreateFullTextReq(SMCreateFullTextReq *pReq) { int32_t tSerializeSNotifyReq(void *buf, int32_t bufLen, SNotifyReq *pReq) { SEncoder encoder = {0}; + int32_t code = 0; + int32_t lino; + int32_t tlen; tEncoderInit(&encoder, buf, bufLen); - if (tStartEncode(&encoder) < 0) return -1; - - if (tEncodeI32(&encoder, pReq->dnodeId) < 0) return -1; - if (tEncodeI64(&encoder, pReq->clusterId) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->dnodeId)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->clusterId)); int32_t nVgroup = taosArrayGetSize(pReq->pVloads); - if (tEncodeI32(&encoder, nVgroup) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, nVgroup)); for (int32_t i = 0; i < nVgroup; ++i) { SVnodeLoadLite *vload = TARRAY_GET_ELEM(pReq->pVloads, i); - if (tEncodeI32(&encoder, vload->vgId) < 0) return -1; - if (tEncodeI64(&encoder, vload->nTimeSeries) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, vload->vgId)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, vload->nTimeSeries)); } tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSNotifyReq(void *buf, int32_t bufLen, SNotifyReq *pReq) { - int32_t code = TSDB_CODE_INVALID_MSG; + int32_t code = 0; + int32_t lino; SDecoder decoder = {0}; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) goto _exit; - if (tDecodeI32(&decoder, &pReq->dnodeId) < 0) goto _exit; - if (tDecodeI64(&decoder, &pReq->clusterId) < 0) goto _exit; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->dnodeId)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->clusterId)); int32_t nVgroup = 0; - if (tDecodeI32(&decoder, &nVgroup) < 0) goto _exit; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &nVgroup)); if (nVgroup > 0) { pReq->pVloads = taosArrayInit_s(sizeof(SVnodeLoadLite), nVgroup); if (!pReq->pVloads) { - code = terrno; - goto _exit; + TAOS_CHECK_EXIT(terrno); } for (int32_t i = 0; i < nVgroup; ++i) { SVnodeLoadLite *vload = TARRAY_GET_ELEM(pReq->pVloads, i); - if (tDecodeI32(&decoder, &(vload->vgId)) < 0) goto _exit; - if (tDecodeI64(&decoder, &(vload->nTimeSeries)) < 0) goto _exit; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &(vload->vgId))); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &(vload->nTimeSeries))); } } - code = 0; + tEndDecode(&decoder); _exit: - tEndDecode(&decoder); tDecoderClear(&decoder); return code; } @@ -1252,193 +1403,200 @@ void tFreeSNotifyReq(SNotifyReq *pReq) { int32_t tSerializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) { SEncoder encoder = {0}; + int32_t code = 0; + int32_t lino; + int32_t tlen; tEncoderInit(&encoder, buf, bufLen); - if (tStartEncode(&encoder) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); // status - if (tEncodeI32(&encoder, pReq->sver) < 0) return -1; - if (tEncodeI64(&encoder, pReq->dnodeVer) < 0) return -1; - if (tEncodeI32(&encoder, pReq->dnodeId) < 0) return -1; - if (tEncodeI64(&encoder, pReq->clusterId) < 0) return -1; - if (tEncodeI64(&encoder, pReq->rebootTime) < 0) return -1; - if (tEncodeI64(&encoder, pReq->updateTime) < 0) return -1; - if (tEncodeFloat(&encoder, pReq->numOfCores) < 0) return -1; - if (tEncodeI32(&encoder, pReq->numOfSupportVnodes) < 0) return -1; - if (tEncodeI32v(&encoder, pReq->numOfDiskCfg) < 0) return -1; - if (tEncodeI64(&encoder, pReq->memTotal) < 0) return -1; - if (tEncodeI64(&encoder, pReq->memAvail) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->dnodeEp) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->machineId) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->sver)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->dnodeVer)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->dnodeId)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->clusterId)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->rebootTime)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->updateTime)); + TAOS_CHECK_EXIT(tEncodeFloat(&encoder, pReq->numOfCores)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->numOfSupportVnodes)); + TAOS_CHECK_EXIT(tEncodeI32v(&encoder, pReq->numOfDiskCfg)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->memTotal)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->memAvail)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->dnodeEp)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->machineId)); // cluster cfg - if (tEncodeI32(&encoder, pReq->clusterCfg.statusInterval) < 0) return -1; - if (tEncodeI64(&encoder, pReq->clusterCfg.checkTime) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->clusterCfg.timezone) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->clusterCfg.locale) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->clusterCfg.charset) < 0) return -1; - if (tEncodeI8(&encoder, pReq->clusterCfg.enableWhiteList) < 0) return -1; - if (tEncodeI8(&encoder, pReq->clusterCfg.encryptionKeyStat) < 0) return -1; - if (tEncodeU32(&encoder, pReq->clusterCfg.encryptionKeyChksum) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->clusterCfg.statusInterval)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->clusterCfg.checkTime)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->clusterCfg.timezone)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->clusterCfg.locale)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->clusterCfg.charset)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->clusterCfg.enableWhiteList)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->clusterCfg.encryptionKeyStat)); + TAOS_CHECK_EXIT(tEncodeU32(&encoder, pReq->clusterCfg.encryptionKeyChksum)); // vnode loads int32_t vlen = (int32_t)taosArrayGetSize(pReq->pVloads); - if (tEncodeI32(&encoder, vlen) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, vlen)); for (int32_t i = 0; i < vlen; ++i) { SVnodeLoad *pload = taosArrayGet(pReq->pVloads, i); int64_t reserved = 0; - if (tEncodeI32(&encoder, pload->vgId) < 0) return -1; - if (tEncodeI8(&encoder, pload->syncState) < 0) return -1; - if (tEncodeI8(&encoder, pload->syncRestore) < 0) return -1; - if (tEncodeI8(&encoder, pload->syncCanRead) < 0) return -1; - if (tEncodeI64(&encoder, pload->cacheUsage) < 0) return -1; - if (tEncodeI64(&encoder, pload->numOfTables) < 0) return -1; - if (tEncodeI64(&encoder, pload->numOfTimeSeries) < 0) return -1; - if (tEncodeI64(&encoder, pload->totalStorage) < 0) return -1; - if (tEncodeI64(&encoder, pload->compStorage) < 0) return -1; - if (tEncodeI64(&encoder, pload->pointsWritten) < 0) return -1; - if (tEncodeI32(&encoder, pload->numOfCachedTables) < 0) return -1; - if (tEncodeI32(&encoder, pload->learnerProgress) < 0) return -1; - if (tEncodeI64(&encoder, pload->roleTimeMs) < 0) return -1; - if (tEncodeI64(&encoder, pload->startTimeMs) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pload->vgId)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pload->syncState)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pload->syncRestore)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pload->syncCanRead)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pload->cacheUsage)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pload->numOfTables)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pload->numOfTimeSeries)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pload->totalStorage)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pload->compStorage)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pload->pointsWritten)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pload->numOfCachedTables)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pload->learnerProgress)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pload->roleTimeMs)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pload->startTimeMs)); } // mnode loads - if (tEncodeI8(&encoder, pReq->mload.syncState) < 0) return -1; - if (tEncodeI8(&encoder, pReq->mload.syncRestore) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->mload.syncState)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->mload.syncRestore)); - if (tEncodeI32(&encoder, pReq->qload.dnodeId) < 0) return -1; - if (tEncodeI64(&encoder, pReq->qload.numOfProcessedQuery) < 0) return -1; - if (tEncodeI64(&encoder, pReq->qload.numOfProcessedCQuery) < 0) return -1; - if (tEncodeI64(&encoder, pReq->qload.numOfProcessedFetch) < 0) return -1; - if (tEncodeI64(&encoder, pReq->qload.numOfProcessedDrop) < 0) return -1; - if (tEncodeI64(&encoder, pReq->qload.numOfProcessedNotify) < 0) return -1; - if (tEncodeI64(&encoder, pReq->qload.numOfProcessedHb) < 0) return -1; - if (tEncodeI64(&encoder, pReq->qload.numOfProcessedDelete) < 0) return -1; - if (tEncodeI64(&encoder, pReq->qload.cacheDataSize) < 0) return -1; - if (tEncodeI64(&encoder, pReq->qload.numOfQueryInQueue) < 0) return -1; - if (tEncodeI64(&encoder, pReq->qload.numOfFetchInQueue) < 0) return -1; - if (tEncodeI64(&encoder, pReq->qload.timeInQueryQueue) < 0) return -1; - if (tEncodeI64(&encoder, pReq->qload.timeInFetchQueue) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->qload.dnodeId)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->qload.numOfProcessedQuery)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->qload.numOfProcessedCQuery)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->qload.numOfProcessedFetch)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->qload.numOfProcessedDrop)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->qload.numOfProcessedNotify)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->qload.numOfProcessedHb)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->qload.numOfProcessedDelete)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->qload.cacheDataSize)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->qload.numOfQueryInQueue)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->qload.numOfFetchInQueue)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->qload.timeInQueryQueue)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->qload.timeInFetchQueue)); - if (tEncodeI32(&encoder, pReq->statusSeq) < 0) return -1; - if (tEncodeI64(&encoder, pReq->mload.syncTerm) < 0) return -1; - if (tEncodeI64(&encoder, pReq->mload.roleTimeMs) < 0) return -1; - if (tEncodeI8(&encoder, pReq->clusterCfg.ttlChangeOnWrite) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->statusSeq)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->mload.syncTerm)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->mload.roleTimeMs)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->clusterCfg.ttlChangeOnWrite)); // vnode extra for (int32_t i = 0; i < vlen; ++i) { SVnodeLoad *pload = taosArrayGet(pReq->pVloads, i); int64_t reserved = 0; - if (tEncodeI64(&encoder, pload->syncTerm) < 0) return -1; - if (tEncodeI64(&encoder, reserved) < 0) return -1; - if (tEncodeI64(&encoder, reserved) < 0) return -1; - if (tEncodeI64(&encoder, reserved) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pload->syncTerm)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, reserved)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, reserved)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, reserved)); } - if (tEncodeI64(&encoder, pReq->ipWhiteVer) < 0) return -1; - - if (tSerializeSMonitorParas(&encoder, &pReq->clusterCfg.monitorParas) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->ipWhiteVer)); + TAOS_CHECK_EXIT(tSerializeSMonitorParas(&encoder, &pReq->clusterCfg.monitorParas)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); // status - if (tDecodeI32(&decoder, &pReq->sver) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->dnodeVer) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->dnodeId) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->clusterId) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->rebootTime) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->updateTime) < 0) return -1; - if (tDecodeFloat(&decoder, &pReq->numOfCores) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->numOfSupportVnodes) < 0) return -1; - if (tDecodeI32v(&decoder, &pReq->numOfDiskCfg) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->memTotal) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->memAvail) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->dnodeEp) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->machineId) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->sver)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->dnodeVer)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->dnodeId)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->clusterId)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->rebootTime)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->updateTime)); + TAOS_CHECK_EXIT(tDecodeFloat(&decoder, &pReq->numOfCores)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->numOfSupportVnodes)); + TAOS_CHECK_EXIT(tDecodeI32v(&decoder, &pReq->numOfDiskCfg)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->memTotal)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->memAvail)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->dnodeEp)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->machineId)); // cluster cfg - if (tDecodeI32(&decoder, &pReq->clusterCfg.statusInterval) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->clusterCfg.checkTime) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->clusterCfg.timezone) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->clusterCfg.locale) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->clusterCfg.charset) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->clusterCfg.enableWhiteList) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->clusterCfg.encryptionKeyStat) < 0) return -1; - if (tDecodeU32(&decoder, &pReq->clusterCfg.encryptionKeyChksum) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->clusterCfg.statusInterval)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->clusterCfg.checkTime)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->clusterCfg.timezone)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->clusterCfg.locale)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->clusterCfg.charset)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->clusterCfg.enableWhiteList)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->clusterCfg.encryptionKeyStat)); + TAOS_CHECK_EXIT(tDecodeU32(&decoder, &pReq->clusterCfg.encryptionKeyChksum)); // vnode loads int32_t vlen = 0; - if (tDecodeI32(&decoder, &vlen) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &vlen)); pReq->pVloads = taosArrayInit(vlen, sizeof(SVnodeLoad)); if (pReq->pVloads == NULL) { - return -1; + TAOS_CHECK_EXIT(terrno); } for (int32_t i = 0; i < vlen; ++i) { SVnodeLoad vload = {0}; vload.syncTerm = -1; - if (tDecodeI32(&decoder, &vload.vgId) < 0) return -1; - if (tDecodeI8(&decoder, &vload.syncState) < 0) return -1; - if (tDecodeI8(&decoder, &vload.syncRestore) < 0) return -1; - if (tDecodeI8(&decoder, &vload.syncCanRead) < 0) return -1; - if (tDecodeI64(&decoder, &vload.cacheUsage) < 0) return -1; - if (tDecodeI64(&decoder, &vload.numOfTables) < 0) return -1; - if (tDecodeI64(&decoder, &vload.numOfTimeSeries) < 0) return -1; - if (tDecodeI64(&decoder, &vload.totalStorage) < 0) return -1; - if (tDecodeI64(&decoder, &vload.compStorage) < 0) return -1; - if (tDecodeI64(&decoder, &vload.pointsWritten) < 0) return -1; - if (tDecodeI32(&decoder, &vload.numOfCachedTables) < 0) return -1; - if (tDecodeI32(&decoder, &vload.learnerProgress) < 0) return -1; - if (tDecodeI64(&decoder, &vload.roleTimeMs) < 0) return -1; - if (tDecodeI64(&decoder, &vload.startTimeMs) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &vload.vgId)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &vload.syncState)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &vload.syncRestore)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &vload.syncCanRead)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &vload.cacheUsage)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &vload.numOfTables)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &vload.numOfTimeSeries)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &vload.totalStorage)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &vload.compStorage)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &vload.pointsWritten)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &vload.numOfCachedTables)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &vload.learnerProgress)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &vload.roleTimeMs)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &vload.startTimeMs)); if (taosArrayPush(pReq->pVloads, &vload) == NULL) { - return -1; + TAOS_CHECK_EXIT(terrno); } } // mnode loads - if (tDecodeI8(&decoder, &pReq->mload.syncState) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->mload.syncRestore) < 0) return -1; - - if (tDecodeI32(&decoder, &pReq->qload.dnodeId) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->qload.numOfProcessedQuery) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->qload.numOfProcessedCQuery) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->qload.numOfProcessedFetch) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->qload.numOfProcessedDrop) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->qload.numOfProcessedNotify) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->qload.numOfProcessedHb) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->qload.numOfProcessedDelete) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->qload.cacheDataSize) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->qload.numOfQueryInQueue) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->qload.numOfFetchInQueue) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->qload.timeInQueryQueue) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->qload.timeInFetchQueue) < 0) return -1; - - if (tDecodeI32(&decoder, &pReq->statusSeq) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->mload.syncState)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->mload.syncRestore)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->qload.dnodeId)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->qload.numOfProcessedQuery)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->qload.numOfProcessedCQuery)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->qload.numOfProcessedFetch)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->qload.numOfProcessedDrop)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->qload.numOfProcessedNotify)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->qload.numOfProcessedHb)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->qload.numOfProcessedDelete)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->qload.cacheDataSize)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->qload.numOfQueryInQueue)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->qload.numOfFetchInQueue)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->qload.timeInQueryQueue)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->qload.timeInFetchQueue)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->statusSeq)); pReq->mload.syncTerm = -1; pReq->mload.roleTimeMs = 0; if (!tDecodeIsEnd(&decoder)) { - if (tDecodeI64(&decoder, &pReq->mload.syncTerm) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->mload.roleTimeMs) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->mload.syncTerm)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->mload.roleTimeMs)); } pReq->clusterCfg.ttlChangeOnWrite = false; if (!tDecodeIsEnd(&decoder)) { - if (tDecodeI8(&decoder, &pReq->clusterCfg.ttlChangeOnWrite) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->clusterCfg.ttlChangeOnWrite)); } // vnode extra @@ -1446,23 +1604,25 @@ int32_t tDeserializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) { for (int32_t i = 0; i < vlen; ++i) { SVnodeLoad *pLoad = taosArrayGet(pReq->pVloads, i); int64_t reserved = 0; - if (tDecodeI64(&decoder, &pLoad->syncTerm) < 0) return -1; - if (tDecodeI64(&decoder, &reserved) < 0) return -1; - if (tDecodeI64(&decoder, &reserved) < 0) return -1; - if (tDecodeI64(&decoder, &reserved) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pLoad->syncTerm)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &reserved)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &reserved)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &reserved)); } } if (!tDecodeIsEnd(&decoder)) { - if (tDecodeI64(&decoder, &pReq->ipWhiteVer) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->ipWhiteVer)); } if (!tDecodeIsEnd(&decoder)) { - if (tDeserializeSMonitorParas(&decoder, &pReq->clusterCfg.monitorParas) < 0) return -1; + TAOS_CHECK_EXIT(tDeserializeSMonitorParas(&decoder, &pReq->clusterCfg.monitorParas)); } tEndDecode(&decoder); + +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSStatusReq(SStatusReq *pReq) { taosArrayDestroy(pReq->pVloads); } @@ -1825,7 +1985,7 @@ int32_t cloneSUpdateIpWhiteReq(SUpdateIpWhite *pReq, SUpdateIpWhite **pUpdateMsg } SUpdateIpWhite *pClone = taosMemoryCalloc(1, sizeof(SUpdateIpWhite)); if (pClone == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } pClone->numOfUser = pReq->numOfUser; @@ -1833,7 +1993,7 @@ int32_t cloneSUpdateIpWhiteReq(SUpdateIpWhite *pReq, SUpdateIpWhite **pUpdateMsg pClone->pUserIpWhite = taosMemoryCalloc(1, sizeof(SUpdateUserIpWhite) * pReq->numOfUser); if (pClone->pUserIpWhite == NULL) { taosMemoryFree(pClone); - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } for (int i = 0; i < pReq->numOfUser; i++) { @@ -1847,7 +2007,7 @@ int32_t cloneSUpdateIpWhiteReq(SUpdateIpWhite *pReq, SUpdateIpWhite **pUpdateMsg int32_t sz = pOld->numOfRange * sizeof(SIpV4Range); pNew->pIpRanges = taosMemoryCalloc(1, sz); if (pNew->pIpRanges == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; break; } memcpy(pNew->pIpRanges, pOld->pIpRanges, sz); @@ -5258,44 +5418,47 @@ int32_t tSerializeSConnectRsp(void *buf, int32_t bufLen, SConnectRsp *pRsp) { int32_t tDeserializeSConnectRsp(void *buf, int32_t bufLen, SConnectRsp *pRsp) { SDecoder decoder = {0}; tDecoderInit(&decoder, buf, bufLen); + int32_t ret = -1; - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeI32(&decoder, &pRsp->acctId) < 0) return -1; - if (tDecodeI64(&decoder, &pRsp->clusterId) < 0) return -1; - if (tDecodeU32(&decoder, &pRsp->connId) < 0) return -1; - if (tDecodeI32(&decoder, &pRsp->dnodeNum) < 0) return -1; - if (tDecodeI8(&decoder, &pRsp->superUser) < 0) return -1; - if (tDecodeI8(&decoder, &pRsp->sysInfo) < 0) return -1; - if (tDecodeI8(&decoder, &pRsp->connType) < 0) return -1; - if (tDecodeSEpSet(&decoder, &pRsp->epSet) < 0) return -1; - if (tDecodeI32(&decoder, &pRsp->svrTimestamp) < 0) return -1; - if (tDecodeCStrTo(&decoder, pRsp->sVer) < 0) return -1; - if (tDecodeCStrTo(&decoder, pRsp->sDetailVer) < 0) return -1; + if (tStartDecode(&decoder) < 0) goto _END; + if (tDecodeI32(&decoder, &pRsp->acctId) < 0) goto _END; + if (tDecodeI64(&decoder, &pRsp->clusterId) < 0) goto _END; + if (tDecodeU32(&decoder, &pRsp->connId) < 0) goto _END; + if (tDecodeI32(&decoder, &pRsp->dnodeNum) < 0) goto _END; + if (tDecodeI8(&decoder, &pRsp->superUser) < 0) goto _END; + if (tDecodeI8(&decoder, &pRsp->sysInfo) < 0) goto _END; + if (tDecodeI8(&decoder, &pRsp->connType) < 0) goto _END; + if (tDecodeSEpSet(&decoder, &pRsp->epSet) < 0) goto _END; + if (tDecodeI32(&decoder, &pRsp->svrTimestamp) < 0) goto _END; + if (tDecodeCStrTo(&decoder, pRsp->sVer) < 0) goto _END; + if (tDecodeCStrTo(&decoder, pRsp->sDetailVer) < 0) goto _END; if (!tDecodeIsEnd(&decoder)) { - if (tDecodeI32(&decoder, &pRsp->passVer) < 0) return -1; + if (tDecodeI32(&decoder, &pRsp->passVer) < 0) goto _END; } else { pRsp->passVer = 0; } // since 3.0.7.0 if (!tDecodeIsEnd(&decoder)) { - if (tDecodeI32(&decoder, &pRsp->authVer) < 0) return -1; + if (tDecodeI32(&decoder, &pRsp->authVer) < 0) goto _END; } else { pRsp->authVer = 0; } if (!tDecodeIsEnd(&decoder)) { - if (tDecodeI64(&decoder, &pRsp->whiteListVer) < 0) return -1; + if (tDecodeI64(&decoder, &pRsp->whiteListVer) < 0) goto _END; } else { pRsp->whiteListVer = 0; } if (!tDecodeIsEnd(&decoder)) { - if (tDeserializeSMonitorParas(&decoder, &pRsp->monitorParas) < 0) return -1; + if (tDeserializeSMonitorParas(&decoder, &pRsp->monitorParas) < 0) goto _END; } tEndDecode(&decoder); + ret = 0; +_END: tDecoderClear(&decoder); - return 0; + return ret; } int32_t tSerializeSMTimerMsg(void *buf, int32_t bufLen, SMTimerReq *pReq) { @@ -10662,7 +10825,7 @@ int32_t tCloneTbTSMAInfo(STableTSMAInfo *pInfo, STableTSMAInfo **pRes) { return TSDB_CODE_SUCCESS; } STableTSMAInfo *pRet = taosMemoryCalloc(1, sizeof(STableTSMAInfo)); - if (!pRet) return TSDB_CODE_OUT_OF_MEMORY; + if (!pRet) return terrno; *pRet = *pInfo; if (pInfo->pFuncs) { diff --git a/source/common/src/trow.c b/source/common/src/trow.c index 3e0e52a860..760b86dee1 100644 --- a/source/common/src/trow.c +++ b/source/common/src/trow.c @@ -473,7 +473,7 @@ int32_t tdSTSRowNew(SArray *pArray, STSchema *pTSchema, STSRow **ppRow, int8_t r } if (!(*ppRow)) { - TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY); + TAOS_RETURN(terrno); } if (maxVarDataLen > 0) { diff --git a/source/common/src/ttime.c b/source/common/src/ttime.c index 79847d4e4a..d771830d3f 100644 --- a/source/common/src/ttime.c +++ b/source/common/src/ttime.c @@ -539,7 +539,7 @@ int32_t convertStringToTimestamp(int16_t type, char* inputData, int64_t timePrec if (type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_VARBINARY) { newColData = taosMemoryCalloc(1, charLen + 1); if (NULL == newColData) { - TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY); + TAOS_RETURN(terrno); } (void)memcpy(newColData, varDataVal(inputData), charLen); int32_t ret = taosParseTime(newColData, timeVal, charLen, (int32_t)timePrec, tsDaylight); @@ -551,7 +551,7 @@ int32_t convertStringToTimestamp(int16_t type, char* inputData, int64_t timePrec } else if (type == TSDB_DATA_TYPE_NCHAR) { newColData = taosMemoryCalloc(1, charLen + TSDB_NCHAR_SIZE); if (NULL == newColData) { - TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY); + TAOS_RETURN(terrno); } int len = taosUcs4ToMbs((TdUcs4*)varDataVal(inputData), charLen, newColData); if (len < 0) { diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c index 0de0a34c25..9c22a11674 100644 --- a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c +++ b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c @@ -365,7 +365,7 @@ int32_t dmBuildVariablesBlock(SSDataBlock **ppBlock) { SSDataBlock *pBlock = taosMemoryCalloc(1, sizeof(SSDataBlock)); if (pBlock == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } size_t size = 0; diff --git a/source/dnode/mgmt/mgmt_mnode/src/mmInt.c b/source/dnode/mgmt/mgmt_mnode/src/mmInt.c index 48606b2ed9..b1b7a90db8 100644 --- a/source/dnode/mgmt/mgmt_mnode/src/mmInt.c +++ b/source/dnode/mgmt/mgmt_mnode/src/mmInt.c @@ -97,7 +97,7 @@ static int32_t mmOpen(SMgmtInputOpt *pInput, SMgmtOutputOpt *pOutput) { SMnodeMgmt *pMgmt = taosMemoryCalloc(1, sizeof(SMnodeMgmt)); if (pMgmt == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; return code; } diff --git a/source/dnode/mgmt/mgmt_qnode/src/qmInt.c b/source/dnode/mgmt/mgmt_qnode/src/qmInt.c index 3138614189..100a11f532 100644 --- a/source/dnode/mgmt/mgmt_qnode/src/qmInt.c +++ b/source/dnode/mgmt/mgmt_qnode/src/qmInt.c @@ -41,7 +41,7 @@ static int32_t qmOpen(SMgmtInputOpt *pInput, SMgmtOutputOpt *pOutput) { int32_t code = 0; SQnodeMgmt *pMgmt = taosMemoryCalloc(1, sizeof(SQnodeMgmt)); if (pMgmt == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } pMgmt->pData = pInput->pData; diff --git a/source/dnode/mgmt/mgmt_snode/src/smInt.c b/source/dnode/mgmt/mgmt_snode/src/smInt.c index 6bc0131e63..eea3585c72 100644 --- a/source/dnode/mgmt/mgmt_snode/src/smInt.c +++ b/source/dnode/mgmt/mgmt_snode/src/smInt.c @@ -44,7 +44,7 @@ int32_t smOpen(SMgmtInputOpt *pInput, SMgmtOutputOpt *pOutput) { int32_t code = 0; SSnodeMgmt *pMgmt = taosMemoryCalloc(1, sizeof(SSnodeMgmt)); if (pMgmt == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; return code; } diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmFile.c b/source/dnode/mgmt/mgmt_vnode/src/vmFile.c index 4f2c04c6a5..8513d31695 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmFile.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmFile.c @@ -27,7 +27,7 @@ int32_t vmGetVnodeListFromHash(SVnodeMgmt *pMgmt, int32_t *numOfVnodes, SVnodeOb SVnodeObj **pVnodes = taosMemoryCalloc(size, sizeof(SVnodeObj *)); if (pVnodes == NULL) { (void)taosThreadRwlockUnlock(&pMgmt->lock); - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } void *pIter = taosHashIterate(pMgmt->hash, NULL); @@ -62,7 +62,7 @@ static int32_t vmDecodeVnodeList(SJson *pJson, SVnodeMgmt *pMgmt, SWrapperCfg ** int32_t vnodesNum = cJSON_GetArraySize(vnodes); if (vnodesNum > 0) { pCfgs = taosMemoryCalloc(vnodesNum, sizeof(SWrapperCfg)); - if (pCfgs == NULL) return TSDB_CODE_OUT_OF_MEMORY; + if (pCfgs == NULL) return terrno; } for (int32_t i = 0; i < vnodesNum; ++i) { diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmInt.c b/source/dnode/mgmt/mgmt_vnode/src/vmInt.c index e85794b568..488a4d3b99 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmInt.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmInt.c @@ -592,7 +592,7 @@ static int32_t vmInit(SMgmtInputOpt *pInput, SMgmtOutputOpt *pOutput) { SVnodeMgmt *pMgmt = taosMemoryCalloc(1, sizeof(SVnodeMgmt)); if (pMgmt == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto _OVER; } @@ -727,7 +727,7 @@ static int32_t vmStartVnodes(SVnodeMgmt *pMgmt) { SVnodeThread *threads = taosMemoryCalloc(threadNum, sizeof(SVnodeThread)); if (threads == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } for (int32_t t = 0; t < threadNum; ++t) { @@ -735,7 +735,7 @@ static int32_t vmStartVnodes(SVnodeMgmt *pMgmt) { threads[t].pMgmt = pMgmt; threads[t].ppVnodes = taosMemoryCalloc(vnodesPerThread, sizeof(SVnode *)); if (threads[t].ppVnodes == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; break; } } diff --git a/source/dnode/mgmt/node_util/inc/dmUtil.h b/source/dnode/mgmt/node_util/inc/dmUtil.h index 95556bba86..4ad4ea7c30 100644 --- a/source/dnode/mgmt/node_util/inc/dmUtil.h +++ b/source/dnode/mgmt/node_util/inc/dmUtil.h @@ -83,12 +83,12 @@ extern "C" { }\ } -#define dGFatal(param, ...) {if (dDebugFlag & DEBUG_FATAL) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); dFatal(param ", qid:%s", __VA_ARGS__, buf);}} -#define dGError(param, ...) {if (dDebugFlag & DEBUG_ERROR) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); dError(param ", qid:%s", __VA_ARGS__, buf);}} -#define dGWarn(param, ...) {if (dDebugFlag & DEBUG_WARN) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); dWarn(param ", qid:%s", __VA_ARGS__, buf);}} -#define dGInfo(param, ...) {if (dDebugFlag & DEBUG_INFO) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); dInfo(param ", qid:%s", __VA_ARGS__, buf);}} -#define dGDebug(param, ...) {if (dDebugFlag & DEBUG_DEBUG) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); dDebug(param ", qid:%s", __VA_ARGS__, buf);}} -#define dGTrace(param, ...) {if (dDebugFlag & DEBUG_TRACE) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); dTrace(param ", qid:%s", __VA_ARGS__, buf);}} +#define dGFatal(param, ...) {if (dDebugFlag & DEBUG_FATAL) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); dFatal(param ",QID:%s", __VA_ARGS__, buf);}} +#define dGError(param, ...) {if (dDebugFlag & DEBUG_ERROR) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); dError(param ",QID:%s", __VA_ARGS__, buf);}} +#define dGWarn(param, ...) {if (dDebugFlag & DEBUG_WARN) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); dWarn(param ",QID:%s", __VA_ARGS__, buf);}} +#define dGInfo(param, ...) {if (dDebugFlag & DEBUG_INFO) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); dInfo(param ",QID:%s", __VA_ARGS__, buf);}} +#define dGDebug(param, ...) {if (dDebugFlag & DEBUG_DEBUG) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); dDebug(param ",QID:%s", __VA_ARGS__, buf);}} +#define dGTrace(param, ...) {if (dDebugFlag & DEBUG_TRACE) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); dTrace(param ",QID:%s", __VA_ARGS__, buf);}} // clang-format on diff --git a/source/dnode/mnode/impl/inc/mndInt.h b/source/dnode/mnode/impl/inc/mndInt.h index 5a4062daf6..fff88e547c 100644 --- a/source/dnode/mnode/impl/inc/mndInt.h +++ b/source/dnode/mnode/impl/inc/mndInt.h @@ -41,12 +41,12 @@ extern "C" { #define mDebug(...) { if (mDebugFlag & DEBUG_DEBUG) { taosPrintLog("MND ", DEBUG_DEBUG, mDebugFlag, __VA_ARGS__); }} #define mTrace(...) { if (mDebugFlag & DEBUG_TRACE) { taosPrintLog("MND ", DEBUG_TRACE, mDebugFlag, __VA_ARGS__); }} -#define mGFatal(param, ...) { if (mDebugFlag & DEBUG_FATAL){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); mFatal(param ", qid:%s", __VA_ARGS__, buf);}} -#define mGError(param, ...) { if (mDebugFlag & DEBUG_ERROR){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); mError(param ", qid:%s", __VA_ARGS__, buf);}} -#define mGWarn(param, ...) { if (mDebugFlag & DEBUG_WARN){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); mWarn (param ", qid:%s", __VA_ARGS__, buf);}} -#define mGInfo(param, ...) { if (mDebugFlag & DEBUG_INFO){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); mInfo (param ", qid:%s", __VA_ARGS__, buf);}} -#define mGDebug(param, ...) { if (mDebugFlag & DEBUG_DEBUG){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); mDebug(param ", qid:%s", __VA_ARGS__, buf);}} -#define mGTrace(param, ...) { if (mDebugFlag & DEBUG_TRACE){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); mTrace(param ", qid:%s", __VA_ARGS__, buf);}} +#define mGFatal(param, ...) { if (mDebugFlag & DEBUG_FATAL){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); mFatal(param ",QID:%s", __VA_ARGS__, buf);}} +#define mGError(param, ...) { if (mDebugFlag & DEBUG_ERROR){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); mError(param ",QID:%s", __VA_ARGS__, buf);}} +#define mGWarn(param, ...) { if (mDebugFlag & DEBUG_WARN){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); mWarn (param ",QID:%s", __VA_ARGS__, buf);}} +#define mGInfo(param, ...) { if (mDebugFlag & DEBUG_INFO){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); mInfo (param ",QID:%s", __VA_ARGS__, buf);}} +#define mGDebug(param, ...) { if (mDebugFlag & DEBUG_DEBUG){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); mDebug(param ",QID:%s", __VA_ARGS__, buf);}} +#define mGTrace(param, ...) { if (mDebugFlag & DEBUG_TRACE){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); mTrace(param ",QID:%s", __VA_ARGS__, buf);}} // clang-format on #define SYSTABLE_SCH_TABLE_NAME_LEN ((TSDB_TABLE_NAME_LEN - 1) + VARSTR_HEADER_SIZE) diff --git a/source/dnode/mnode/impl/src/mndArbGroup.c b/source/dnode/mnode/impl/src/mndArbGroup.c index 2411a58a6c..3860f10f8f 100644 --- a/source/dnode/mnode/impl/src/mndArbGroup.c +++ b/source/dnode/mnode/impl/src/mndArbGroup.c @@ -404,7 +404,9 @@ static int32_t mndProcessArbHbTimer(SRpcMsg *pReq) { hbMembers = *(SArray **)pObj; } else { hbMembers = taosArrayInit(16, sizeof(SVArbHbReqMember)); - (void)taosHashPut(pDnodeHash, &dnodeId, sizeof(int32_t), &hbMembers, POINTER_BYTES); + if (taosHashPut(pDnodeHash, &dnodeId, sizeof(int32_t), &hbMembers, POINTER_BYTES) != 0) { + mError("dnodeId:%d, failed to push hb member inty]o hash, but conitnue next at this timer round", dnodeId); + } } SVArbHbReqMember reqMember = {.vgId = pArbGroup->vgId, .hbSeq = pMember->state.nextHbSeq++}; if (taosArrayPush(hbMembers, &reqMember) == NULL) { @@ -1314,7 +1316,7 @@ static int32_t mndRetrieveArbGroups(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock static void mndCancelGetNextArbGroup(SMnode *pMnode, void *pIter) { SSdb *pSdb = pMnode->pSdb; - sdbCancelFetch(pSdb, pIter); + sdbCancelFetchByType(pSdb, pIter, SDB_ARBGROUP); } int32_t mndGetArbGroupSize(SMnode *pMnode) { diff --git a/source/dnode/mnode/impl/src/mndCluster.c b/source/dnode/mnode/impl/src/mndCluster.c index 27bd47c569..5cec3a8f27 100644 --- a/source/dnode/mnode/impl/src/mndCluster.c +++ b/source/dnode/mnode/impl/src/mndCluster.c @@ -346,7 +346,7 @@ _OVER: static void mndCancelGetNextCluster(SMnode *pMnode, void *pIter) { SSdb *pSdb = pMnode->pSdb; - sdbCancelFetch(pSdb, pIter); + sdbCancelFetchByType(pSdb, pIter, SDB_CLUSTER); } static int32_t mndProcessUptimeTimer(SRpcMsg *pReq) { diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c index 1d0dbd1c44..606b93035f 100644 --- a/source/dnode/mnode/impl/src/mndConsumer.c +++ b/source/dnode/mnode/impl/src/mndConsumer.c @@ -297,7 +297,7 @@ static int32_t addEpSetInfo(SMnode *pMnode, SMqConsumerObj *pConsumer, int32_t e taosRUnLockLatch(&pSub->lock); mndReleaseSubscribe(pMnode, pSub); mndReleaseTopic(pMnode, pTopic); - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } (void)memcpy(topicEp.schema.pSchema, pTopic->schema.pSchema, topicEp.schema.nCols * sizeof(SSchema)); } @@ -1003,7 +1003,7 @@ END: static void mndCancelGetNextConsumer(SMnode *pMnode, void *pIter) { SSdb *pSdb = pMnode->pSdb; - sdbCancelFetch(pSdb, pIter); + sdbCancelFetchByType(pSdb, pIter, SDB_CONSUMER); } const char *mndConsumerStatusName(int status) { diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index 0ee265dd74..20c5d09c9e 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -1892,7 +1892,7 @@ int32_t mndValidateDbInfo(SMnode *pMnode, SDbCacheInfo *pDbs, int32_t numOfDbs, mndReleaseDb(pMnode, pDb); continue; } else { - mInfo("db:%s, valid dbinfo, vgVersion:%d cfgVersion:%d stateTs:%" PRId64 + mTrace("db:%s, valid dbinfo, vgVersion:%d cfgVersion:%d stateTs:%" PRId64 " numOfTables:%d, changed to vgVersion:%d cfgVersion:%d stateTs:%" PRId64 " numOfTables:%d", pDbCacheInfo->dbFName, pDbCacheInfo->vgVersion, pDbCacheInfo->cfgVersion, pDbCacheInfo->stateTs, pDbCacheInfo->numOfTable, pDb->vgVersion, pDb->cfgVersion, pDb->stateTs, numOfTable); @@ -2522,5 +2522,5 @@ static int32_t mndRetrieveDbs(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBloc static void mndCancelGetNextDb(SMnode *pMnode, void *pIter) { SSdb *pSdb = pMnode->pSdb; - sdbCancelFetch(pSdb, pIter); + sdbCancelFetchByType(pSdb, pIter, SDB_DB); } diff --git a/source/dnode/mnode/impl/src/mndDef.c b/source/dnode/mnode/impl/src/mndDef.c index c604e58588..d93b275e48 100644 --- a/source/dnode/mnode/impl/src/mndDef.c +++ b/source/dnode/mnode/impl/src/mndDef.c @@ -150,7 +150,7 @@ int32_t tDecodeSStreamObj(SDecoder *pDecoder, SStreamObj *pObj, int32_t sver) { SStreamTask *pTask = taosMemoryCalloc(1, sizeof(SStreamTask)); if (pTask == NULL) { taosArrayDestroy(pArray); - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; TAOS_RETURN(code); } if ((code = tDecodeStreamTask(pDecoder, pTask)) < 0) { @@ -278,7 +278,7 @@ int32_t tNewSMqConsumerObj(int64_t consumerId, char *cgroup, int8_t updateType, int32_t code = 0; SMqConsumerObj *pConsumer = taosMemoryCalloc(1, sizeof(SMqConsumerObj)); if (pConsumer == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto END; } diff --git a/source/dnode/mnode/impl/src/mndDnode.c b/source/dnode/mnode/impl/src/mndDnode.c index ffd8e16468..71952b3bb8 100644 --- a/source/dnode/mnode/impl/src/mndDnode.c +++ b/source/dnode/mnode/impl/src/mndDnode.c @@ -1814,7 +1814,7 @@ static int32_t mndRetrieveDnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB static void mndCancelGetNextDnode(SMnode *pMnode, void *pIter) { SSdb *pSdb = pMnode->pSdb; - sdbCancelFetch(pSdb, pIter); + sdbCancelFetchByType(pSdb, pIter, SDB_DNODE); } // get int32_t value from 'SMCfgDnodeReq' diff --git a/source/dnode/mnode/impl/src/mndFunc.c b/source/dnode/mnode/impl/src/mndFunc.c index f89394ee22..326f2ffa95 100644 --- a/source/dnode/mnode/impl/src/mndFunc.c +++ b/source/dnode/mnode/impl/src/mndFunc.c @@ -719,5 +719,5 @@ static int32_t mndRetrieveFuncs(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl static void mndCancelGetNextFunc(SMnode *pMnode, void *pIter) { SSdb *pSdb = pMnode->pSdb; - sdbCancelFetch(pSdb, pIter); + sdbCancelFetchByType(pSdb, pIter, SDB_FUNC); } diff --git a/source/dnode/mnode/impl/src/mndInfoSchema.c b/source/dnode/mnode/impl/src/mndInfoSchema.c index c811a74782..eb7cb7d505 100644 --- a/source/dnode/mnode/impl/src/mndInfoSchema.c +++ b/source/dnode/mnode/impl/src/mndInfoSchema.c @@ -21,7 +21,7 @@ static int32_t mndInitInfosTableSchema(const SSysDbTableSchema *pSrc, int32_t co int32_t code = 0; SSchema *schema = taosMemoryCalloc(colNum, sizeof(SSchema)); if (NULL == schema) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; TAOS_RETURN(code); } @@ -99,7 +99,7 @@ int32_t mndBuildInsTableSchema(SMnode *pMnode, const char *dbFName, const char * pRsp->pSchemas = taosMemoryCalloc(pMeta->numOfColumns, sizeof(SSchema)); if (pRsp->pSchemas == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; pRsp->pSchemas = NULL; TAOS_RETURN(code); } @@ -131,7 +131,7 @@ int32_t mndBuildInsTableCfg(SMnode *pMnode, const char *dbFName, const char *tbN pRsp->pSchemas = taosMemoryCalloc(pMeta->numOfColumns, sizeof(SSchema)); if (pRsp->pSchemas == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; pRsp->pSchemas = NULL; TAOS_RETURN(code); } diff --git a/source/dnode/mnode/impl/src/mndMnode.c b/source/dnode/mnode/impl/src/mndMnode.c index 67fdcc2466..5315416226 100644 --- a/source/dnode/mnode/impl/src/mndMnode.c +++ b/source/dnode/mnode/impl/src/mndMnode.c @@ -935,7 +935,7 @@ _out: static void mndCancelGetNextMnode(SMnode *pMnode, void *pIter) { SSdb *pSdb = pMnode->pSdb; - sdbCancelFetch(pSdb, pIter); + sdbCancelFetchByType(pSdb, pIter, SDB_MNODE); } static int32_t mndProcessAlterMnodeReq(SRpcMsg *pReq) { diff --git a/source/dnode/mnode/impl/src/mndPerfSchema.c b/source/dnode/mnode/impl/src/mndPerfSchema.c index d54c27ce30..8ff9f8f27e 100644 --- a/source/dnode/mnode/impl/src/mndPerfSchema.c +++ b/source/dnode/mnode/impl/src/mndPerfSchema.c @@ -22,7 +22,7 @@ int32_t mndInitPerfsTableSchema(const SSysDbTableSchema *pSrc, int32_t colNum, S int32_t code = 0; SSchema *schema = taosMemoryCalloc(colNum, sizeof(SSchema)); if (NULL == schema) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; TAOS_RETURN(code); } @@ -84,7 +84,7 @@ int32_t mndBuildPerfsTableSchema(SMnode *pMnode, const char *dbFName, const char pRsp->pSchemas = taosMemoryCalloc(meta->numOfColumns, sizeof(SSchema)); if (pRsp->pSchemas == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; pRsp->pSchemas = NULL; TAOS_RETURN(code); } @@ -116,7 +116,7 @@ int32_t mndBuildPerfsTableCfg(SMnode *pMnode, const char *dbFName, const char *t pRsp->pSchemas = taosMemoryCalloc(pMeta->numOfColumns, sizeof(SSchema)); if (pRsp->pSchemas == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; pRsp->pSchemas = NULL; TAOS_RETURN(code); } diff --git a/source/dnode/mnode/impl/src/mndProfile.c b/source/dnode/mnode/impl/src/mndProfile.c index 7e78a03918..3bdfa236d1 100644 --- a/source/dnode/mnode/impl/src/mndProfile.c +++ b/source/dnode/mnode/impl/src/mndProfile.c @@ -515,7 +515,7 @@ static int32_t mndProcessQueryHeartBeat(SMnode *pMnode, SRpcMsg *pMsg, SClientHb SQueryHbRspBasic *rspBasic = taosMemoryCalloc(1, sizeof(SQueryHbRspBasic)); if (rspBasic == NULL) { mndReleaseConn(pMnode, pConn, true); - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; mError("user:%s, conn:%u failed to process hb while since %s", pConn->user, pBasic->connId, terrstr()); TAOS_RETURN(code); } diff --git a/source/dnode/mnode/impl/src/mndQnode.c b/source/dnode/mnode/impl/src/mndQnode.c index 8210b94b57..54052590a1 100644 --- a/source/dnode/mnode/impl/src/mndQnode.c +++ b/source/dnode/mnode/impl/src/mndQnode.c @@ -582,5 +582,5 @@ static int32_t mndRetrieveQnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB static void mndCancelGetNextQnode(SMnode *pMnode, void *pIter) { SSdb *pSdb = pMnode->pSdb; - sdbCancelFetch(pSdb, pIter); + sdbCancelFetchByType(pSdb, pIter, SDB_QNODE); } diff --git a/source/dnode/mnode/impl/src/mndScheduler.c b/source/dnode/mnode/impl/src/mndScheduler.c index 3f03102a7a..93cd351543 100644 --- a/source/dnode/mnode/impl/src/mndScheduler.c +++ b/source/dnode/mnode/impl/src/mndScheduler.c @@ -634,7 +634,10 @@ static void bindSourceSink(SStreamObj* pStream, SMnode* pMnode, SArray* tasks, b static void bindTwoLevel(SArray* tasks, int32_t begin, int32_t end) { int32_t code = 0; size_t size = taosArrayGetSize(tasks); - ASSERT(size >= 2); + if (size < 2) { + mError("task list size is less than 2"); + return; + } SArray* pDownTaskList = taosArrayGetP(tasks, size - 1); SArray* pUpTaskList = taosArrayGetP(tasks, size - 2); diff --git a/source/dnode/mnode/impl/src/mndSma.c b/source/dnode/mnode/impl/src/mndSma.c index 7467d9bba3..284d65cd9c 100644 --- a/source/dnode/mnode/impl/src/mndSma.c +++ b/source/dnode/mnode/impl/src/mndSma.c @@ -1520,8 +1520,8 @@ static void mndCancelRetrieveIdx(SMnode *pMnode, void *pIter) { SSmaAndTagIter *p = pIter; if (p != NULL) { SSdb *pSdb = pMnode->pSdb; - sdbCancelFetch(pSdb, p->pSmaIter); - sdbCancelFetch(pSdb, p->pIdxIter); + sdbCancelFetchByType(pSdb, p->pSmaIter, SDB_SMA); + sdbCancelFetchByType(pSdb, p->pIdxIter, SDB_IDX); } taosMemoryFree(p); } @@ -1715,7 +1715,7 @@ static int32_t mndCreateTSMATxnPrepare(SCreateTSMACxt* pCxt) { createStreamRedoAction.contLen = tSerializeSCMCreateStreamReq(0, 0, pCxt->pCreateStreamReq); createStreamRedoAction.pCont = taosMemoryCalloc(1, createStreamRedoAction.contLen); if (!createStreamRedoAction.pCont) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto _OVER; } if (createStreamRedoAction.contLen != tSerializeSCMCreateStreamReq(createStreamRedoAction.pCont, createStreamRedoAction.contLen, pCxt->pCreateStreamReq)) { @@ -1730,7 +1730,7 @@ static int32_t mndCreateTSMATxnPrepare(SCreateTSMACxt* pCxt) { createStreamUndoAction.contLen = tSerializeSMDropStreamReq(0, 0, pCxt->pDropStreamReq); createStreamUndoAction.pCont = taosMemoryCalloc(1, createStreamUndoAction.contLen); if (!createStreamUndoAction.pCont) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto _OVER; } if (createStreamUndoAction.contLen != tSerializeSMDropStreamReq(createStreamUndoAction.pCont, createStreamUndoAction.contLen, pCxt->pDropStreamReq)) { @@ -1748,7 +1748,7 @@ static int32_t mndCreateTSMATxnPrepare(SCreateTSMACxt* pCxt) { dropStbUndoAction.contLen = tSerializeSMDropStbReq(0, 0, &dropStbReq); dropStbUndoAction.pCont = taosMemoryCalloc(1, dropStbUndoAction.contLen); if (!dropStbUndoAction.pCont) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto _OVER; } if (dropStbUndoAction.contLen != tSerializeSMDropStbReq(dropStbUndoAction.pCont, dropStbUndoAction.contLen, &dropStbReq)) { @@ -1993,7 +1993,7 @@ static int32_t mndDropTSMA(SCreateTSMACxt* pCxt) { dropStreamRedoAction.contLen = tSerializeSMDropStreamReq(0, 0, pCxt->pDropStreamReq); dropStreamRedoAction.pCont = taosMemoryCalloc(1, dropStreamRedoAction.contLen); if (!dropStreamRedoAction.pCont) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto _OVER; } if (dropStreamRedoAction.contLen != @@ -2017,7 +2017,7 @@ static int32_t mndDropTSMA(SCreateTSMACxt* pCxt) { dropStbRedoAction.contLen = tSerializeSMDropStbReq(0, 0, &dropStbReq); dropStbRedoAction.pCont = taosMemoryCalloc(1, dropStbRedoAction.contLen); if (!dropStbRedoAction.pCont) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto _OVER; } if (dropStbRedoAction.contLen != tSerializeSMDropStbReq(dropStbRedoAction.pCont, dropStbRedoAction.contLen, &dropStbReq)) { @@ -2288,7 +2288,7 @@ static void mndCancelRetrieveTSMA(SMnode *pMnode, void *pIter) { SSmaAndTagIter *p = pIter; if (p != NULL) { SSdb *pSdb = pMnode->pSdb; - sdbCancelFetch(pSdb, p->pSmaIter); + sdbCancelFetchByType(pSdb, p->pSmaIter, SDB_SMA); } taosMemoryFree(p); } @@ -2420,7 +2420,7 @@ static int32_t mndGetTSMA(SMnode *pMnode, char *tsmaFName, STableTSMAInfoRsp *rs STableTSMAInfo *pTsma = taosMemoryCalloc(1, sizeof(STableTSMAInfo)); if (!pTsma) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; sdbRelease(pMnode->pSdb, pSma); mndReleaseStb(pMnode, pDstStb); TAOS_RETURN(code); @@ -2503,7 +2503,7 @@ static int32_t mndGetSomeTsmas(SMnode* pMnode, STableTSMAInfoRsp* pRsp, tsmaFilt STableTSMAInfo *pTsma = taosMemoryCalloc(1, sizeof(STableTSMAInfo)); if (!pTsma) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; mndReleaseStb(pMnode, pStb); sdbRelease(pSdb, pSma); sdbCancelFetch(pSdb, pIter); diff --git a/source/dnode/mnode/impl/src/mndSnode.c b/source/dnode/mnode/impl/src/mndSnode.c index cd5584022f..c5e38ed048 100644 --- a/source/dnode/mnode/impl/src/mndSnode.c +++ b/source/dnode/mnode/impl/src/mndSnode.c @@ -504,5 +504,5 @@ static int32_t mndRetrieveSnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB static void mndCancelGetNextSnode(SMnode *pMnode, void *pIter) { SSdb *pSdb = pMnode->pSdb; - sdbCancelFetch(pSdb, pIter); + sdbCancelFetchByType(pSdb, pIter, SDB_SNODE); } diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index 6384451d86..03ff6d425f 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -877,7 +877,7 @@ int32_t mndBuildStbFromReq(SMnode *pMnode, SStbObj *pDst, SMCreateStbReq *pCreat if (pDst->commentLen > 0) { pDst->comment = taosMemoryCalloc(pDst->commentLen + 1, 1); if (pDst->comment == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; TAOS_RETURN(code); } memcpy(pDst->comment, pCreate->pComment, pDst->commentLen + 1); @@ -887,7 +887,7 @@ int32_t mndBuildStbFromReq(SMnode *pMnode, SStbObj *pDst, SMCreateStbReq *pCreat if (pDst->ast1Len > 0) { pDst->pAst1 = taosMemoryCalloc(pDst->ast1Len, 1); if (pDst->pAst1 == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; TAOS_RETURN(code); } memcpy(pDst->pAst1, pCreate->pAst1, pDst->ast1Len); @@ -897,7 +897,7 @@ int32_t mndBuildStbFromReq(SMnode *pMnode, SStbObj *pDst, SMCreateStbReq *pCreat if (pDst->ast2Len > 0) { pDst->pAst2 = taosMemoryCalloc(pDst->ast2Len, 1); if (pDst->pAst2 == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; TAOS_RETURN(code); } memcpy(pDst->pAst2, pCreate->pAst2, pDst->ast2Len); @@ -906,7 +906,7 @@ int32_t mndBuildStbFromReq(SMnode *pMnode, SStbObj *pDst, SMCreateStbReq *pCreat pDst->pColumns = taosMemoryCalloc(1, pDst->numOfColumns * sizeof(SSchema)); pDst->pTags = taosMemoryCalloc(1, pDst->numOfTags * sizeof(SSchema)); if (pDst->pColumns == NULL || pDst->pTags == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; TAOS_RETURN(code); } @@ -1179,7 +1179,7 @@ static int32_t mndBuildStbFromAlter(SStbObj *pStb, SStbObj *pDst, SMCreateStbReq pDst->pCmpr = taosMemoryCalloc(1, pDst->numOfColumns * sizeof(SColCmpr)); if (pDst->pColumns == NULL || pDst->pTags == NULL || pDst->pCmpr == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; TAOS_RETURN(code); } @@ -1392,7 +1392,7 @@ int32_t mndAllocStbSchemas(const SStbObj *pOld, SStbObj *pNew) { pNew->pColumns = taosMemoryCalloc(pNew->numOfColumns, sizeof(SSchema)); pNew->pCmpr = taosMemoryCalloc(pNew->numOfColumns, sizeof(SColCmpr)); if (pNew->pTags == NULL || pNew->pColumns == NULL || pNew->pCmpr == NULL) { - TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY); + TAOS_RETURN(terrno); } memcpy(pNew->pColumns, pOld->pColumns, sizeof(SSchema) * pOld->numOfColumns); @@ -2096,13 +2096,13 @@ static int32_t mndBuildStbSchemaImp(SDbObj *pDb, SStbObj *pStb, const char *tbNa pRsp->pSchemas = taosMemoryCalloc(totalCols, sizeof(SSchema)); if (pRsp->pSchemas == NULL) { taosRUnLockLatch(&pStb->lock); - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; TAOS_RETURN(code); } pRsp->pSchemaExt = taosMemoryCalloc(pStb->numOfColumns, sizeof(SSchemaExt)); if (pRsp->pSchemaExt == NULL) { taosRUnLockLatch(&pStb->lock); - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; TAOS_RETURN(code); } @@ -2157,7 +2157,7 @@ static int32_t mndBuildStbCfgImp(SDbObj *pDb, SStbObj *pStb, const char *tbName, pRsp->pSchemas = taosMemoryCalloc(totalCols, sizeof(SSchema)); if (pRsp->pSchemas == NULL) { taosRUnLockLatch(&pStb->lock); - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; TAOS_RETURN(code); } @@ -2318,7 +2318,7 @@ static int32_t mndBuildSMAlterStbRsp(SDbObj *pDb, SStbObj *pObj, void **pCont, i alterRsp.pMeta = taosMemoryCalloc(1, sizeof(STableMetaRsp)); if (NULL == alterRsp.pMeta) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; TAOS_RETURN(code); } @@ -2371,7 +2371,7 @@ int32_t mndBuildSMCreateStbRsp(SMnode *pMnode, char *dbFName, char *stbFName, vo stbRsp.pMeta = taosMemoryCalloc(1, sizeof(STableMetaRsp)); if (NULL == stbRsp.pMeta) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto _OVER; } @@ -3832,7 +3832,7 @@ static int32_t mndRetrieveStbCol(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB static void mndCancelGetNextStb(SMnode *pMnode, void *pIter) { SSdb *pSdb = pMnode->pSdb; - sdbCancelFetch(pSdb, pIter); + sdbCancelFetchByType(pSdb, pIter, SDB_STB); } const char *mndGetStbStr(const char *src) { @@ -4063,7 +4063,7 @@ static void mndDestroyDropTbsWithTsmaCtx(SMndDropTbsWithTsmaCtx *p) { static int32_t mndInitDropTbsWithTsmaCtx(SMndDropTbsWithTsmaCtx **ppCtx) { int32_t code = 0; SMndDropTbsWithTsmaCtx *pCtx = taosMemoryCalloc(1, sizeof(SMndDropTbsWithTsmaCtx)); - if (!pCtx) return TSDB_CODE_OUT_OF_MEMORY; + if (!pCtx) return terrno; pCtx->pTsmaMap = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_NO_LOCK); if (!pCtx->pTsmaMap) { code = TSDB_CODE_OUT_OF_MEMORY; diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c index 93397e3a8c..f7b97a2c3c 100644 --- a/source/dnode/mnode/impl/src/mndStream.c +++ b/source/dnode/mnode/impl/src/mndStream.c @@ -523,6 +523,7 @@ int32_t mndPersistTaskDeployReq(STrans *pTrans, SStreamTask *pTask) { int32_t code = tEncodeStreamTask(&encoder, pTask); if (code == -1) { + tEncoderClear(&encoder); return TSDB_CODE_INVALID_MSG; } @@ -532,7 +533,7 @@ int32_t mndPersistTaskDeployReq(STrans *pTrans, SStreamTask *pTask) { void *buf = taosMemoryCalloc(1, tlen); if (buf == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } ((SMsgHead *)buf)->vgId = htonl(pTask->info.nodeId); @@ -775,7 +776,7 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) { } #ifdef WINDOWS - terrno = TSDB_CODE_MND_INVALID_PLATFORM; + code = TSDB_CODE_MND_INVALID_PLATFORM; goto _OVER; #endif @@ -1009,6 +1010,7 @@ static int32_t mndBuildStreamCheckpointSourceReq(void **pBuf, int32_t *pLen, int tEncoderInit(&encoder, abuf, tlen); int32_t pos = tEncodeStreamCheckpointSourceReq(&encoder, &req); if (pos == -1) { + tEncoderClear(&encoder); return TSDB_CODE_INVALID_MSG; } @@ -1208,7 +1210,11 @@ static int32_t mndCheckTaskAndNodeStatus(SMnode *pMnode) { streamMutexLock(&execInfo.lock); if (taosArrayGetSize(execInfo.pNodeList) == 0) { mDebug("stream task node change checking done, no vgroups exist, do nothing"); - ASSERT(taosArrayGetSize(execInfo.pTaskList) == 0); + if (taosArrayGetSize(execInfo.pTaskList) != 0) { + streamMutexUnlock(&execInfo.lock); + mError("stream task node change checking done, no vgroups exist, but task list is not empty"); + return TSDB_CODE_FAILED; + } } SArray *pInvalidList = taosArrayInit(4, sizeof(STaskId)); @@ -1647,7 +1653,7 @@ static int32_t mndRetrieveStream(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB static void mndCancelGetNextStream(SMnode *pMnode, void *pIter) { SSdb *pSdb = pMnode->pSdb; - sdbCancelFetch(pSdb, pIter); + sdbCancelFetchByType(pSdb, pIter, SDB_STREAM); } static int32_t mndRetrieveStreamTask(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rowsCapacity) { @@ -1719,7 +1725,7 @@ static int32_t mndRetrieveStreamTask(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock static void mndCancelGetNextStreamTask(SMnode *pMnode, void *pIter) { SSdb *pSdb = pMnode->pSdb; - sdbCancelFetch(pSdb, pIter); + sdbCancelFetchByType(pSdb, pIter, SDB_STREAM); } static int32_t mndProcessPauseStreamReq(SRpcMsg *pReq) { @@ -2163,7 +2169,9 @@ static int32_t refreshNodeListFromExistedStreams(SMnode *pMnode, SArray *pNodeLi SNodeEntry entry = {.hbTimestamp = -1, .nodeId = pTask->info.nodeId, .lastHbMsgId = -1}; epsetAssign(&entry.epset, &pTask->info.epSet); - (void)taosHashPut(pHash, &entry.nodeId, sizeof(entry.nodeId), &entry, sizeof(entry)); + if (taosHashPut(pHash, &entry.nodeId, sizeof(entry.nodeId), &entry, sizeof(entry)) != 0) { + mError("failed to put entry into hash map, nodeId:%d", entry.nodeId); + } } destroyStreamTaskIter(pTaskIter); @@ -2788,7 +2796,13 @@ int32_t mndProcessConsensusInTmr(SRpcMsg *pMsg) { if (((now - pe->ts) >= 10 * 1000) || allSame) { mDebug("s-task:0x%x sendTs:%" PRId64 " wait %.2fs and all tasks have same checkpointId", pe->req.taskId, pe->req.startTs, (now - pe->ts) / 1000.0); - ASSERT(chkId <= pe->req.checkpointId); + if (chkId > pe->req.checkpointId) { + streamMutexUnlock(&execInfo.lock); + taosArrayDestroy(pStreamList); + mError("s-task:0x%x checkpointId:%" PRId64 " is updated to %" PRId64 ", update it", pe->req.taskId, + pe->req.checkpointId, chkId); + return TSDB_CODE_FAILED; + } code = mndCreateSetConsensusChkptIdTrans(pMnode, pStream, pe->req.taskId, chkId, pe->req.startTs); if (code != TSDB_CODE_SUCCESS && code != TSDB_CODE_ACTION_IN_PROGRESS) { mError("failed to create consensus-checkpoint trans, stream:0x%" PRIx64, pStream->uid); @@ -2828,7 +2842,12 @@ int32_t mndProcessConsensusInTmr(SRpcMsg *pMsg) { if (taosArrayGetSize(pInfo->pTaskList) == 0) { mndClearConsensusRspEntry(pInfo); - ASSERT(streamId != -1); + if (streamId == -1) { + streamMutexUnlock(&execInfo.lock); + taosArrayDestroy(pStreamList); + mError("streamId is -1, streamId:%" PRIx64, pInfo->streamId); + return TSDB_CODE_FAILED; + } void* p = taosArrayPush(pStreamList, &streamId); if (p == NULL) { mError("failed to put into stream list, stream:0x%" PRIx64, streamId); diff --git a/source/dnode/mnode/impl/src/mndStreamUtil.c b/source/dnode/mnode/impl/src/mndStreamUtil.c index 07bba4e1b3..ef91ccef34 100644 --- a/source/dnode/mnode/impl/src/mndStreamUtil.c +++ b/source/dnode/mnode/impl/src/mndStreamUtil.c @@ -13,12 +13,13 @@ * along with this program. If not, see . */ +#include "mndDb.h" +#include "mndStb.h" #include "mndStream.h" #include "mndTrans.h" -#include "tmisce.h" #include "mndVgroup.h" -#include "mndStb.h" -#include "mndDb.h" +#include "taoserror.h" +#include "tmisce.h" struct SStreamTaskIter { SStreamObj *pStream; @@ -304,7 +305,7 @@ static int32_t doSetResumeAction(STrans *pTrans, SMnode *pMnode, SStreamTask *pT if (pReq == NULL) { mError("failed to malloc in resume stream, size:%" PRIzu ", code:%s", sizeof(SVResumeStreamTaskReq), tstrerror(TSDB_CODE_OUT_OF_MEMORY)); - terrno = TSDB_CODE_OUT_OF_MEMORY; + // terrno = TSDB_CODE_OUT_OF_MEMORY; return terrno; } @@ -405,7 +406,7 @@ static int32_t doSetPauseAction(SMnode *pMnode, STrans *pTrans, SStreamTask *pTa if (pReq == NULL) { mError("failed to malloc in pause stream, size:%" PRIzu ", code:%s", sizeof(SVPauseStreamTaskReq), tstrerror(TSDB_CODE_OUT_OF_MEMORY)); - terrno = TSDB_CODE_OUT_OF_MEMORY; + // terrno = TSDB_CODE_OUT_OF_MEMORY; return terrno; } @@ -470,7 +471,7 @@ int32_t mndStreamSetPauseAction(SMnode *pMnode, STrans *pTrans, SStreamObj *pStr static int32_t doSetDropAction(SMnode *pMnode, STrans *pTrans, SStreamTask *pTask) { SVDropStreamTaskReq *pReq = taosMemoryCalloc(1, sizeof(SVDropStreamTaskReq)); if (pReq == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; + // terrno = TSDB_CODE_OUT_OF_MEMORY; return terrno; } @@ -525,7 +526,7 @@ int32_t mndStreamSetDropAction(SMnode *pMnode, STrans *pTrans, SStreamObj *pStre static int32_t doSetDropActionFromId(SMnode *pMnode, STrans *pTrans, SOrphanTask* pTask) { SVDropStreamTaskReq *pReq = taosMemoryCalloc(1, sizeof(SVDropStreamTaskReq)); if (pReq == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; + // terrno = TSDB_CODE_OUT_OF_MEMORY; return terrno; } @@ -905,7 +906,12 @@ void removeStreamTasksInBuf(SStreamObj *pStream, SStreamExecInfo *pExecNode) { } } - ASSERT(taosHashGetSize(pExecNode->pTaskMap) == taosArrayGetSize(pExecNode->pTaskList)); + if (taosHashGetSize(pExecNode->pTaskMap) != taosArrayGetSize(pExecNode->pTaskList)) { + streamMutexUnlock(&pExecNode->lock); + destroyStreamTaskIter(pIter); + mError("task map size, task list size, not equal"); + return; + } // 2. remove stream entry in consensus hash table and checkpoint-report hash table (void) mndClearConsensusCheckpointId(execInfo.pStreamConsensus, pStream->uid); diff --git a/source/dnode/mnode/impl/src/mndSubscribe.c b/source/dnode/mnode/impl/src/mndSubscribe.c index 22ac58c9db..e3bef61bc0 100644 --- a/source/dnode/mnode/impl/src/mndSubscribe.c +++ b/source/dnode/mnode/impl/src/mndSubscribe.c @@ -1484,5 +1484,5 @@ END: void mndCancelGetNextSubscribe(SMnode *pMnode, void *pIter) { SSdb *pSdb = pMnode->pSdb; - sdbCancelFetch(pSdb, pIter); + sdbCancelFetchByType(pSdb, pIter, SDB_SUBSCRIBE); } diff --git a/source/dnode/mnode/impl/src/mndSync.c b/source/dnode/mnode/impl/src/mndSync.c index da5873039b..d669994128 100644 --- a/source/dnode/mnode/impl/src/mndSync.c +++ b/source/dnode/mnode/impl/src/mndSync.c @@ -312,7 +312,12 @@ void mndRestoreFinish(const SSyncFSM *pFsm, const SyncIndex commitIdx) { } (void)mndRefreshUserIpWhiteList(pMnode); - ASSERT(commitIdx == mndSyncAppliedIndex(pFsm)); + SyncIndex fsmIndex = mndSyncAppliedIndex(pFsm); + if (commitIdx != fsmIndex) { + mError("vgId:1, sync restore finished, but commitIdx:%" PRId64 " is not equal to appliedIdx:%" PRId64, commitIdx, + fsmIndex); + mndSetRestored(pMnode, false); + } } int32_t mndSnapshotStartRead(const SSyncFSM *pFsm, void *pParam, void **ppReader) { @@ -470,7 +475,7 @@ int32_t mndInitSync(SMnode *pMnode) { snprintf(syncInfo.path, sizeof(syncInfo.path), "%s%ssync", pMnode->path, TD_DIRSEP); syncInfo.pFsm = mndSyncMakeFsm(pMnode); - mInfo("vgId:1, start to open sync, replica:%d selfIndex:%d", pMgmt->numOfReplicas, pMgmt->selfIndex); + mInfo("vgId:1, start to open mnode sync, replica:%d selfIndex:%d", pMgmt->numOfReplicas, pMgmt->selfIndex); SSyncCfg *pCfg = &syncInfo.syncCfg; pCfg->totalReplicaNum = pMgmt->numOfTotalReplicas; pCfg->replicaNum = pMgmt->numOfReplicas; @@ -497,7 +502,7 @@ int32_t mndInitSync(SMnode *pMnode) { } pMnode->pSdb->sync = pMgmt->sync; - mInfo("mnode-sync is opened, id:%" PRId64, pMgmt->sync); + mInfo("vgId:1, mnode sync is opened, id:%" PRId64, pMgmt->sync); TAOS_RETURN(code); } @@ -601,12 +606,13 @@ int32_t mndSyncPropose(SMnode *pMnode, SSdbRaw *pRaw, int32_t transId) { } void mndSyncStart(SMnode *pMnode) { + mInfo("vgId:1, start to start mnode sync"); SSyncMgmt *pMgmt = &pMnode->syncMgmt; if (syncStart(pMgmt->sync) < 0) { mError("vgId:1, failed to start sync, id:%" PRId64, pMgmt->sync); return; } - mInfo("vgId:1, sync started, id:%" PRId64, pMgmt->sync); + mInfo("vgId:1, mnode sync started, id:%" PRId64, pMgmt->sync); } void mndSyncStop(SMnode *pMnode) { diff --git a/source/dnode/mnode/impl/src/mndTopic.c b/source/dnode/mnode/impl/src/mndTopic.c index 9e06f3b0f2..ed702e7707 100644 --- a/source/dnode/mnode/impl/src/mndTopic.c +++ b/source/dnode/mnode/impl/src/mndTopic.c @@ -934,7 +934,7 @@ END: static void mndCancelGetNextTopic(SMnode *pMnode, void *pIter) { SSdb *pSdb = pMnode->pSdb; - sdbCancelFetch(pSdb, pIter); + sdbCancelFetchByType(pSdb, pIter, SDB_TOPIC); } bool mndTopicExistsForDb(SMnode *pMnode, SDbObj *pDb) { diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c index a9f9d1022a..63cab4168a 100644 --- a/source/dnode/mnode/impl/src/mndTrans.c +++ b/source/dnode/mnode/impl/src/mndTrans.c @@ -768,7 +768,9 @@ void mndTransSetDbName(STrans *pTrans, const char *dbname, const char *stbname) } void mndTransAddArbGroupId(STrans *pTrans, int32_t groupId) { - (void)taosHashPut(pTrans->arbGroupIds, &groupId, sizeof(int32_t), NULL, 0); + if (taosHashPut(pTrans->arbGroupIds, &groupId, sizeof(int32_t), NULL, 0) != 0) { + mError("trans:%d, failed to put groupid into hash, groupId:%d", pTrans->id, groupId); + } } void mndTransSetSerial(STrans *pTrans) { pTrans->exec = TRN_EXEC_SERIAL; } @@ -835,6 +837,9 @@ static bool mndCheckTransConflict(SMnode *pMnode, STrans *pNew) { if (pNew->conflict == TRN_CONFLICT_NOTHING) return conflict; + int32_t size = sdbGetSize(pMnode->pSdb, SDB_TRANS); + mInfo("trans:%d, trans hash size %d", pNew->id, size); + while (1) { pIter = sdbFetch(pMnode->pSdb, SDB_TRANS, pIter, (void **)&pTrans); if (pIter == NULL) break; @@ -903,14 +908,14 @@ int32_t mndTransCheckConflict(SMnode *pMnode, STrans *pTrans) { if (pTrans->conflict == TRN_CONFLICT_DB || pTrans->conflict == TRN_CONFLICT_DB_INSIDE) { if (strlen(pTrans->dbname) == 0 && strlen(pTrans->stbname) == 0) { code = TSDB_CODE_MND_TRANS_CONFLICT; - mError("trans:%d, failed to prepare conflict db not set", pTrans->id); + mError("trans:%d, failed to check tran conflict since db not set", pTrans->id); TAOS_RETURN(code); } } if (mndCheckTransConflict(pMnode, pTrans)) { code = TSDB_CODE_MND_TRANS_CONFLICT; - mError("trans:%d, failed to prepare since %s", pTrans->id, tstrerror(code)); + mError("trans:%d, failed to check tran conflict since %s", pTrans->id, tstrerror(code)); TAOS_RETURN(code); } @@ -946,7 +951,7 @@ int32_t mndTransCheckConflictWithCompact(SMnode *pMnode, STrans *pTrans) { if (conflict) { code = TSDB_CODE_MND_TRANS_CONFLICT_COMPACT; - mError("trans:%d, failed to prepare since %s", pTrans->id, tstrerror(code)); + mError("trans:%d, failed to check tran conflict with compact since %s", pTrans->id, tstrerror(code)); TAOS_RETURN(code); } @@ -1995,5 +2000,5 @@ static int32_t mndRetrieveTrans(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl static void mndCancelGetNextTrans(SMnode *pMnode, void *pIter) { SSdb *pSdb = pMnode->pSdb; - sdbCancelFetch(pSdb, pIter); + sdbCancelFetchByType(pSdb, pIter, SDB_TRANS); } diff --git a/source/dnode/mnode/impl/src/mndUser.c b/source/dnode/mnode/impl/src/mndUser.c index 49cacb3dce..2d979c3327 100644 --- a/source/dnode/mnode/impl/src/mndUser.c +++ b/source/dnode/mnode/impl/src/mndUser.c @@ -355,7 +355,7 @@ int32_t mndUpdateIpWhiteImpl(SHashObj *pIpWhiteTab, char *user, char *fqdn, int8 if (pList == NULL) { SIpWhiteList *pNewList = taosMemoryCalloc(1, sizeof(SIpWhiteList) + sizeof(SIpV4Range)); if (pNewList == NULL) { - TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER); + TAOS_CHECK_GOTO(terrno, &lino, _OVER); } (void)memcpy(pNewList->pIpRange, &range, sizeof(SIpV4Range)); pNewList->num = 1; @@ -370,7 +370,7 @@ int32_t mndUpdateIpWhiteImpl(SHashObj *pIpWhiteTab, char *user, char *fqdn, int8 int32_t sz = sizeof(SIpWhiteList) + sizeof(SIpV4Range) * (pList->num + 1); SIpWhiteList *pNewList = taosMemoryCalloc(1, sz); if (pNewList == NULL) { - TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER); + TAOS_CHECK_GOTO(terrno, &lino, _OVER); } (void)memcpy(pNewList->pIpRange, pList->pIpRange, sizeof(SIpV4Range) * (pList->num)); pNewList->pIpRange[pList->num].ip = range.ip; @@ -397,7 +397,7 @@ int32_t mndUpdateIpWhiteImpl(SHashObj *pIpWhiteTab, char *user, char *fqdn, int8 int32_t sz = sizeof(SIpWhiteList) + sizeof(SIpV4Range) * (pList->num - 1); SIpWhiteList *pNewList = taosMemoryCalloc(1, sz); if (pNewList == NULL) { - TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER); + TAOS_CHECK_GOTO(terrno, &lino, _OVER); } for (int i = 0; i < pList->num; i++) { SIpV4Range *e = &pList->pIpRange[i]; @@ -468,7 +468,7 @@ int32_t mndUpdateIpWhiteForAllUser(SMnode *pMnode, char *user, char *fqdn, int8_ char *keyDup = taosMemoryCalloc(1, klen + 1); if (keyDup == NULL) { - TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER); + TAOS_CHECK_GOTO(terrno, &lino, _OVER); } (void)memcpy(keyDup, key, klen); bool upd = false; @@ -503,7 +503,7 @@ static int64_t ipWhiteMgtFillMsg(SUpdateIpWhite *pUpdate) { pUpdate->pUserIpWhite = taosMemoryCalloc(1, num * sizeof(SUpdateUserIpWhite)); if (pUpdate->pUserIpWhite == NULL) { (void)taosThreadRwlockUnlock(&ipWhiteMgt.rw); - TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY); + TAOS_RETURN(terrno); } void *pIter = taosHashIterate(ipWhiteMgt.pIpWhiteTab, NULL); @@ -521,7 +521,7 @@ static int64_t ipWhiteMgtFillMsg(SUpdateIpWhite *pUpdate) { pUser->pIpRanges = taosMemoryCalloc(1, list->num * sizeof(SIpV4Range)); if (pUser->pIpRanges == NULL) { (void)taosThreadRwlockUnlock(&ipWhiteMgt.rw); - TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY); + TAOS_RETURN(terrno); } (void)memcpy(pUser->pIpRanges, list->pIpRange, list->num * sizeof(SIpV4Range)); i++; @@ -808,7 +808,7 @@ static int32_t createIpWhiteList(void *buf, int32_t len, SIpWhiteList **ppList) p = taosMemoryCalloc(1, sizeof(SIpWhiteList) + num * sizeof(SIpV4Range)); if (p == NULL) { - TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER); + TAOS_CHECK_GOTO(terrno, &lino, _OVER); } TAOS_CHECK_GOTO(tDerializeIpWhileList(buf, len, p), &lino, _OVER); @@ -826,7 +826,7 @@ _OVER: static int32_t createDefaultIpWhiteList(SIpWhiteList **ppWhiteList) { *ppWhiteList = taosMemoryCalloc(1, sizeof(SIpWhiteList) + sizeof(SIpV4Range) * 1); if (*ppWhiteList == NULL) { - TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY); + TAOS_RETURN(terrno); } (*ppWhiteList)->num = 1; SIpV4Range *range = &((*ppWhiteList)->pIpRange[0]); @@ -1739,7 +1739,7 @@ static int32_t mndCreateUser(SMnode *pMnode, char *acct, SCreateUserReq *pCreate SIpWhiteList *p = taosMemoryCalloc(1, sizeof(SIpWhiteList) + numOfRanges * sizeof(SIpV4Range)); if (p == NULL) { taosHashCleanup(pUniqueTab); - TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY); + TAOS_RETURN(terrno); } void *pIter = taosHashIterate(pUniqueTab, NULL); int32_t i = 0; @@ -2357,7 +2357,7 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) { SIpWhiteList *pNew = taosMemoryCalloc(1, sizeof(SIpWhiteList) + sizeof(SIpV4Range) * num); if (pNew == NULL) { - TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER); + TAOS_CHECK_GOTO(terrno, &lino, _OVER); } bool exist = false; @@ -2394,7 +2394,7 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) { SIpWhiteList *pNew = taosMemoryCalloc(1, sizeof(SIpWhiteList) + sizeof(SIpV4Range) * num); if (pNew == NULL) { - TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER); + TAOS_CHECK_GOTO(terrno, &lino, _OVER); } if (pUser->pIpWhiteList->num > 0) { @@ -2772,7 +2772,7 @@ _exit: static void mndCancelGetNextUser(SMnode *pMnode, void *pIter) { SSdb *pSdb = pMnode->pSdb; - sdbCancelFetch(pSdb, pIter); + sdbCancelFetchByType(pSdb, pIter, SDB_USER); } static int32_t mndLoopHash(SHashObj *hash, char *priType, SSDataBlock *pBlock, int32_t *pNumOfRows, SSdb *pSdb, @@ -3124,7 +3124,7 @@ _exit: static void mndCancelGetNextPrivileges(SMnode *pMnode, void *pIter) { SSdb *pSdb = pMnode->pSdb; - sdbCancelFetch(pSdb, pIter); + sdbCancelFetchByType(pSdb, pIter, SDB_USER); } int32_t mndValidateUserAuthInfo(SMnode *pMnode, SUserAuthVersion *pUsers, int32_t numOfUses, void **ppRsp, diff --git a/source/dnode/mnode/impl/src/mndVgroup.c b/source/dnode/mnode/impl/src/mndVgroup.c index 5cfc896a1c..2483c7f0d1 100644 --- a/source/dnode/mnode/impl/src/mndVgroup.c +++ b/source/dnode/mnode/impl/src/mndVgroup.c @@ -838,7 +838,7 @@ int32_t mndAllocVgroup(SMnode *pMnode, SDbObj *pDb, SVgObj **ppVgroups) { pVgroups = taosMemoryCalloc(pDb->cfg.numOfVgroups, sizeof(SVgObj)); if (pVgroups == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto _OVER; } @@ -1077,7 +1077,7 @@ static int32_t mndRetrieveVgroups(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *p static void mndCancelGetNextVgroup(SMnode *pMnode, void *pIter) { SSdb *pSdb = pMnode->pSdb; - sdbCancelFetch(pSdb, pIter); + sdbCancelFetchByType(pSdb, pIter, SDB_VGROUP); } static bool mndGetVnodesNumFp(SMnode *pMnode, void *pObj, void *p1, void *p2, void *p3) { @@ -1212,7 +1212,7 @@ static int32_t mndRetrieveVnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB static void mndCancelGetNextVnode(SMnode *pMnode, void *pIter) { SSdb *pSdb = pMnode->pSdb; - sdbCancelFetch(pSdb, pIter); + sdbCancelFetchByType(pSdb, pIter, SDB_VGROUP); } static int32_t mndAddVnodeToVgroup(SMnode *pMnode, STrans *pTrans, SVgObj *pVgroup, SArray *pArray) { diff --git a/source/dnode/mnode/impl/src/mndView.c b/source/dnode/mnode/impl/src/mndView.c index f4138b2afe..d9e8fb2d15 100755 --- a/source/dnode/mnode/impl/src/mndView.c +++ b/source/dnode/mnode/impl/src/mndView.c @@ -99,5 +99,5 @@ int32_t mndRetrieveView(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int void mndCancelGetNextView(SMnode *pMnode, void *pIter) { SSdb *pSdb = pMnode->pSdb; - sdbCancelFetch(pSdb, pIter); + sdbCancelFetchByType(pSdb, pIter, SDB_VIEW); } diff --git a/source/dnode/mnode/impl/test/stream/stream.cpp b/source/dnode/mnode/impl/test/stream/stream.cpp index 4c63c2ba2c..d508cf7390 100644 --- a/source/dnode/mnode/impl/test/stream/stream.cpp +++ b/source/dnode/mnode/impl/test/stream/stream.cpp @@ -91,6 +91,7 @@ SRpcMsg buildHbReq() { tEncoderInit(&encoder, (uint8_t*)buf, tlen); if ((code = tEncodeStreamHbMsg(&encoder, &msg)) < 0) { rpcFreeCont(buf); + tEncoderClear(&encoder); goto _end; } tEncoderClear(&encoder); diff --git a/source/dnode/mnode/sdb/inc/sdb.h b/source/dnode/mnode/sdb/inc/sdb.h index 5bb8ae2b5e..4584cb817a 100644 --- a/source/dnode/mnode/sdb/inc/sdb.h +++ b/source/dnode/mnode/sdb/inc/sdb.h @@ -334,10 +334,19 @@ void *sdbFetchAll(SSdb *pSdb, ESdbType type, void *pIter, void **ppObj, ESdbStat * @brief Cancel a traversal * * @param pSdb The sdb object. - * @param type The initial iterator of table. + * @param pIter The initial iterator of table. */ void sdbCancelFetch(SSdb *pSdb, void *pIter); +/** + * @brief Cancel a traversal + * + * @param pSdb The sdb object. + * @param pIter The initial iterator of table. + * @param type The type of table. + */ +void sdbCancelFetchByType(SSdb *pSdb, void *pIter, ESdbType type); + /** * @brief Traverse a sdb * diff --git a/source/dnode/mnode/sdb/src/sdbFile.c b/source/dnode/mnode/sdb/src/sdbFile.c index 9073032738..6045ff80f6 100644 --- a/source/dnode/mnode/sdb/src/sdbFile.c +++ b/source/dnode/mnode/sdb/src/sdbFile.c @@ -664,7 +664,7 @@ int32_t sdbDoRead(SSdb *pSdb, SSdbIter *pIter, void **ppBuf, int32_t *len) { int32_t maxlen = 4096; void *pBuf = taosMemoryCalloc(1, maxlen); if (pBuf == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; TAOS_RETURN(code); } diff --git a/source/dnode/mnode/sdb/src/sdbHash.c b/source/dnode/mnode/sdb/src/sdbHash.c index 03b45c25b4..0e41e0732f 100644 --- a/source/dnode/mnode/sdb/src/sdbHash.c +++ b/source/dnode/mnode/sdb/src/sdbHash.c @@ -103,14 +103,14 @@ void sdbPrintOper(SSdb *pSdb, SSdbRow *pRow, const char *oper) { EKeyType keyType = pSdb->keyTypes[pRow->type]; if (keyType == SDB_KEY_BINARY) { - mTrace("%s:%s, ref:%d oper:%s row:%p status:%s", sdbTableName(pRow->type), (char *)pRow->pObj, pRow->refCount, oper, - pRow->pObj, sdbStatusName(pRow->status)); + mTrace("%s:%s, ref:%d oper:%s row:%p row->pObj:%p status:%s", sdbTableName(pRow->type), (char *)pRow->pObj, + pRow->refCount, oper, pRow, pRow->pObj, sdbStatusName(pRow->status)); } else if (keyType == SDB_KEY_INT32) { - mTrace("%s:%d, ref:%d oper:%s row:%p status:%s", sdbTableName(pRow->type), *(int32_t *)pRow->pObj, pRow->refCount, - oper, pRow->pObj, sdbStatusName(pRow->status)); + mTrace("%s:%d, ref:%d oper:%s row:%p row->pObj:%p status:%s", sdbTableName(pRow->type), *(int32_t *)pRow->pObj, + pRow->refCount, oper, pRow, pRow->pObj, sdbStatusName(pRow->status)); } else if (keyType == SDB_KEY_INT64) { - mTrace("%s:%" PRId64 ", ref:%d oper:%s row:%p status:%s", sdbTableName(pRow->type), *(int64_t *)pRow->pObj, - pRow->refCount, oper, pRow->pObj, sdbStatusName(pRow->status)); + mTrace("%s:%" PRId64 ", ref:%d oper:%s row:%p row->pObj:%p status:%s", sdbTableName(pRow->type), + *(int64_t *)pRow->pObj, pRow->refCount, oper, pRow, pRow->pObj, sdbStatusName(pRow->status)); } else { } #endif @@ -242,7 +242,12 @@ static int32_t sdbDeleteRow(SSdb *pSdb, SHashObj *hash, SSdbRaw *pRaw, SSdbRow * (void)atomic_add_fetch_32(&pOldRow->refCount, 1); sdbPrintOper(pSdb, pOldRow, "delete"); - TAOS_CHECK_RETURN(taosHashRemove(hash, pOldRow->pObj, keySize)); + if (taosHashRemove(hash, pOldRow->pObj, keySize) != 0) { + sdbUnLock(pSdb, type); + sdbFreeRow(pSdb, pRow, false); + terrno = TSDB_CODE_SDB_OBJ_NOT_THERE; + return terrno; + } pSdb->tableVer[pOldRow->type]++; sdbUnLock(pSdb, type); @@ -439,6 +444,7 @@ void *sdbFetchAll(SSdb *pSdb, ESdbType type, void *pIter, void **ppObj, ESdbStat void sdbCancelFetch(SSdb *pSdb, void *pIter) { if (pIter == NULL) return; SSdbRow *pRow = *(SSdbRow **)pIter; + mTrace("cancel fetch row:%p", pRow); SHashObj *hash = sdbGetHash(pSdb, pRow->type); if (hash == NULL) return; @@ -448,6 +454,17 @@ void sdbCancelFetch(SSdb *pSdb, void *pIter) { sdbUnLock(pSdb, type); } +void sdbCancelFetchByType(SSdb *pSdb, void *pIter, ESdbType type) { + if (pIter == NULL) return; + if (type >= SDB_MAX || type < 0) return; + SHashObj *hash = sdbGetHash(pSdb, type); + if (hash == NULL) return; + + sdbReadLock(pSdb, type); + taosHashCancelIterate(hash, pIter); + sdbUnLock(pSdb, type); +} + void sdbTraverse(SSdb *pSdb, ESdbType type, sdbTraverseFp fp, void *p1, void *p2, void *p3) { SHashObj *hash = sdbGetHash(pSdb, type); if (hash == NULL) return; diff --git a/source/dnode/vnode/src/inc/vnd.h b/source/dnode/vnode/src/inc/vnd.h index dbcda45ef5..eb1b4c6a9b 100644 --- a/source/dnode/vnode/src/inc/vnd.h +++ b/source/dnode/vnode/src/inc/vnd.h @@ -32,12 +32,12 @@ extern "C" { #define vDebug(...) do { if (vDebugFlag & DEBUG_DEBUG) { taosPrintLog("VND ", DEBUG_DEBUG, vDebugFlag, __VA_ARGS__); }} while(0) #define vTrace(...) do { if (vDebugFlag & DEBUG_TRACE) { taosPrintLog("VND ", DEBUG_TRACE, vDebugFlag, __VA_ARGS__); }} while(0) -#define vGTrace(param, ...) do { if (vDebugFlag & DEBUG_TRACE) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); vTrace(param ", qid:%s", __VA_ARGS__, buf);}} while(0) -#define vGFatal(param, ...) do { if (vDebugFlag & DEBUG_FATAL) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); vFatal(param ", qid:%s", __VA_ARGS__, buf);}} while(0) -#define vGError(param, ...) do { if (vDebugFlag & DEBUG_ERROR) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); vError(param ", qid:%s", __VA_ARGS__, buf);}} while(0) -#define vGWarn(param, ...) do { if (vDebugFlag & DEBUG_WARN) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); vWarn(param ", qid:%s", __VA_ARGS__, buf);}} while(0) -#define vGInfo(param, ...) do { if (vDebugFlag & DEBUG_INFO) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); vInfo(param ", qid:%s", __VA_ARGS__, buf);}} while(0) -#define vGDebug(param, ...) do { if (vDebugFlag & DEBUG_DEBUG) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); vDebug(param ", qid:%s", __VA_ARGS__, buf);}} while(0) +#define vGTrace(param, ...) do { if (vDebugFlag & DEBUG_TRACE) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); vTrace(param ",QID:%s", __VA_ARGS__, buf);}} while(0) +#define vGFatal(param, ...) do { if (vDebugFlag & DEBUG_FATAL) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); vFatal(param ",QID:%s", __VA_ARGS__, buf);}} while(0) +#define vGError(param, ...) do { if (vDebugFlag & DEBUG_ERROR) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); vError(param ",QID:%s", __VA_ARGS__, buf);}} while(0) +#define vGWarn(param, ...) do { if (vDebugFlag & DEBUG_WARN) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); vWarn(param ",QID:%s", __VA_ARGS__, buf);}} while(0) +#define vGInfo(param, ...) do { if (vDebugFlag & DEBUG_INFO) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); vInfo(param ",QID:%s", __VA_ARGS__, buf);}} while(0) +#define vGDebug(param, ...) do { if (vDebugFlag & DEBUG_DEBUG) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); vDebug(param ",QID:%s", __VA_ARGS__, buf);}} while(0) // clang-format on diff --git a/source/dnode/vnode/src/inc/vnodeInt.h b/source/dnode/vnode/src/inc/vnodeInt.h index 820abcaea6..07490989f5 100644 --- a/source/dnode/vnode/src/inc/vnodeInt.h +++ b/source/dnode/vnode/src/inc/vnodeInt.h @@ -242,7 +242,6 @@ int32_t tqProcessTaskResetReq(STQ* pTq, SRpcMsg* pMsg); int32_t tqProcessStreamHbRsp(STQ* pTq, SRpcMsg* pMsg); int32_t tqProcessStreamReqCheckpointRsp(STQ* pTq, SRpcMsg* pMsg); int32_t tqProcessTaskChkptReportRsp(STQ* pTq, SRpcMsg* pMsg); -int32_t tqProcessTaskConsensusChkptRsp(STQ* pTq, SRpcMsg* pMsg); int32_t tqProcessTaskCheckpointReadyRsp(STQ* pTq, SRpcMsg* pMsg); int32_t tqBuildStreamTask(void* pTq, SStreamTask* pTask, int64_t ver); diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index 230c288ceb..07daab4459 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -173,7 +173,7 @@ void tqPushEmptyDataRsp(STqHandle* pHandle, int32_t vgId) { dataRsp.common.blockNum = 0; char buf[TSDB_OFFSET_LEN] = {0}; (void)tFormatOffset(buf, TSDB_OFFSET_LEN, &dataRsp.common.reqOffset); - tqInfo("tqPushEmptyDataRsp to consumer:0x%" PRIx64 " vgId:%d, offset:%s, qid:0x%" PRIx64, req.consumerId, vgId, buf, + tqInfo("tqPushEmptyDataRsp to consumer:0x%" PRIx64 " vgId:%d, offset:%s,QID:0x%" PRIx64, req.consumerId, vgId, buf, req.reqId); code = tqSendDataRsp(pHandle, pHandle->msg, &req, &dataRsp, TMQ_MSG_TYPE__POLL_DATA_RSP, vgId); @@ -193,7 +193,7 @@ int32_t tqSendDataRsp(STqHandle* pHandle, const SRpcMsg* pMsg, const SMqPollReq* (void)tFormatOffset(buf1, TSDB_OFFSET_LEN, &((SMqDataRspCommon*)pRsp)->reqOffset); (void)tFormatOffset(buf2, TSDB_OFFSET_LEN, &((SMqDataRspCommon*)pRsp)->rspOffset); - tqDebug("tmq poll vgId:%d consumer:0x%" PRIx64 " (epoch %d) send rsp, block num:%d, req:%s, rsp:%s, qid:0x%" PRIx64, + tqDebug("tmq poll vgId:%d consumer:0x%" PRIx64 " (epoch %d) send rsp, block num:%d, req:%s, rsp:%s,QID:0x%" PRIx64, vgId, pReq->consumerId, pReq->epoch, ((SMqDataRspCommon*)pRsp)->blockNum, buf1, buf2, pReq->reqId); return tqDoSendDataRsp(&pMsg->info, pRsp, pReq->epoch, pReq->consumerId, type, sver, ever); @@ -421,7 +421,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) { char buf[TSDB_OFFSET_LEN] = {0}; (void)tFormatOffset(buf, TSDB_OFFSET_LEN, &reqOffset); - tqDebug("tmq poll: consumer:0x%" PRIx64 " (epoch %d), subkey %s, recv poll req vgId:%d, req:%s, qid:0x%" PRIx64, + tqDebug("tmq poll: consumer:0x%" PRIx64 " (epoch %d), subkey %s, recv poll req vgId:%d, req:%s,QID:0x%" PRIx64, consumerId, req.epoch, pHandle->subKey, vgId, buf, req.reqId); code = tqExtractDataForMq(pTq, pHandle, &req, pMsg); @@ -1291,6 +1291,3 @@ int32_t tqProcessTaskChkptReportRsp(STQ* pTq, SRpcMsg* pMsg) { return tqStreamProcessChkptReportRsp(pTq->pStreamMeta, pMsg); } -int32_t tqProcessTaskConsensusChkptRsp(STQ* pTq, SRpcMsg* pMsg) { - return tqStreamProcessConsensusChkptRsp2(pTq->pStreamMeta, pMsg); -} diff --git a/source/dnode/vnode/src/tq/tqRead.c b/source/dnode/vnode/src/tq/tqRead.c index 1433dc403f..e85c3a5f3a 100644 --- a/source/dnode/vnode/src/tq/tqRead.c +++ b/source/dnode/vnode/src/tq/tqRead.c @@ -214,12 +214,12 @@ int32_t tqFetchLog(STQ* pTq, STqHandle* pHandle, int64_t* fetchOffset, uint64_t while (offset <= appliedVer) { if (walFetchHead(pHandle->pWalReader, offset) < 0) { tqDebug("tmq poll: consumer:0x%" PRIx64 ", (epoch %d) vgId:%d offset %" PRId64 - ", no more log to return, qid:0x%" PRIx64 " 0x%" PRIx64, + ", no more log to return,QID:0x%" PRIx64 " 0x%" PRIx64, pHandle->consumerId, pHandle->epoch, vgId, offset, reqId, id); goto END; } - tqDebug("vgId:%d, consumer:0x%" PRIx64 " taosx get msg ver %" PRId64 ", type: %s, qid:0x%" PRIx64 " 0x%" PRIx64, + tqDebug("vgId:%d, consumer:0x%" PRIx64 " taosx get msg ver %" PRId64 ", type: %s,QID:0x%" PRIx64 " 0x%" PRIx64, vgId, pHandle->consumerId, offset, TMSG_INFO(pHandle->pWalReader->pHead->head.msgType), reqId, id); if (pHandle->pWalReader->pHead->head.msgType == TDMT_VND_SUBMIT) { diff --git a/source/dnode/vnode/src/tq/tqSink.c b/source/dnode/vnode/src/tq/tqSink.c index 2e22b7524b..c42d5e7de5 100644 --- a/source/dnode/vnode/src/tq/tqSink.c +++ b/source/dnode/vnode/src/tq/tqSink.c @@ -342,7 +342,10 @@ static int32_t doBuildAndSendCreateTableMsg(SVnode* pVnode, char* stbFullName, S // todo remove this void* pGpIdData = colDataGetData(pGpIdColInfo, rowId); - ASSERT(gid == *(int64_t*)pGpIdData); + if (gid != *(int64_t*)pGpIdData) { + tqError("s-task:%s vgId:%d invalid groupId:%" PRId64 " actual:%" PRId64 " in sink task", id, vgId, gid, + *(int64_t*)pGpIdData); + } } code = setCreateTableMsgTableName(pCreateTbReq, pDataBlock, stbFullName, gid, @@ -747,7 +750,6 @@ int32_t doConvertRows(SSubmitTbData* pTableData, const STSchema* pTSchema, SSDat return code; } - ASSERT(pRow); void* p = taosArrayPush(pTableData->aRowP, &pRow); if (p == NULL) { return TSDB_CODE_OUT_OF_MEMORY; @@ -779,8 +781,6 @@ int32_t doWaitForDstTableCreated(SVnode* pVnode, SStreamTask* pTask, STableSinkI bool isValid = isValidDstChildTable(&mr, vgId, dstTableName, suid); if (isValid) { // not valid table, ignore it tqDebug("s-task:%s set uid:%" PRIu64 " for dstTable:%s from meta", id, mr.me.uid, pTableSinkInfo->name.data); - ASSERT(terrno == 0); - // set the destination table uid (*uid) = mr.me.uid; pTableSinkInfo->uid = mr.me.uid; diff --git a/source/dnode/vnode/src/tq/tqStreamTask.c b/source/dnode/vnode/src/tq/tqStreamTask.c index 4b206fc04f..6463a59dfb 100644 --- a/source/dnode/vnode/src/tq/tqStreamTask.c +++ b/source/dnode/vnode/src/tq/tqStreamTask.c @@ -46,7 +46,10 @@ int32_t tqScanWal(STQ* pTq) { streamMetaWLock(pMeta); int32_t times = (--pMeta->scanInfo.scanCounter); - ASSERT(pMeta->scanInfo.scanCounter >= 0); + if (times < 0) { + tqError("vgId:%d invalid scan counter:%d, reset to 0", vgId, times); + times = 0; + } numOfTasks = taosArrayGetSize(pMeta->pTaskList); streamMetaWUnLock(pMeta); @@ -138,6 +141,12 @@ int32_t tqScanWalAsync(STQ* pTq, bool ckPause) { return 0; } + if (pMeta->startInfo.startAllTasks) { + tqTrace("vgId:%d in restart procedure, not scan wal", vgId); + streamMetaWUnLock(pMeta); + return 0; + } + pMeta->scanInfo.scanCounter += 1; if (pMeta->scanInfo.scanCounter > MAX_REPEAT_SCAN_THRESHOLD) { pMeta->scanInfo.scanCounter = MAX_REPEAT_SCAN_THRESHOLD; @@ -263,7 +272,6 @@ bool taskReadyForDataFromWal(SStreamTask* pTask) { // fill-history task has entered into the last phase, no need to anything if ((pTask->info.fillHistory == 1) && pTask->status.appendTranstateBlock) { - ASSERT(pState.state == TASK_STATUS__READY); // the maximum version of data in the WAL has reached already, the step2 is done tqDebug("s-task:%s fill-history reach the maximum ver:%" PRId64 ", not scan wal anymore", pTask->id.idStr, pTask->dataRange.range.maxVer); diff --git a/source/dnode/vnode/src/tq/tqUtil.c b/source/dnode/vnode/src/tq/tqUtil.c index fc97a542a7..ff9f1e524e 100644 --- a/source/dnode/vnode/src/tq/tqUtil.c +++ b/source/dnode/vnode/src/tq/tqUtil.c @@ -92,7 +92,7 @@ static int32_t extractResetOffsetVal(STqOffsetVal* pOffsetVal, STQ* pTq, STqHand char formatBuf[TSDB_OFFSET_LEN] = {0}; tFormatOffset(formatBuf, TSDB_OFFSET_LEN, pOffsetVal); tqDebug("tmq poll: consumer:0x%" PRIx64 - ", subkey %s, vgId:%d, existed offset found, offset reset to %s and continue. qid:0x%" PRIx64, + ", subkey %s, vgId:%d, existed offset found, offset reset to %s and continue.QID:0x%" PRIx64, consumerId, pHandle->subKey, vgId, formatBuf, pRequest->reqId); return 0; } else { @@ -176,7 +176,7 @@ static int32_t extractDataAndRspForNormalSubscribe(STQ* pTq, STqHandle* pHandle, end : { char buf[TSDB_OFFSET_LEN] = {0}; tFormatOffset(buf, TSDB_OFFSET_LEN, &dataRsp.common.rspOffset); - tqDebug("tmq poll: consumer:0x%" PRIx64 ", subkey %s, vgId:%d, rsp block:%d, rsp offset type:%s, qid:0x%" PRIx64 + tqDebug("tmq poll: consumer:0x%" PRIx64 ", subkey %s, vgId:%d, rsp block:%d, rsp offset type:%s,QID:0x%" PRIx64 " code:%d", consumerId, pHandle->subKey, vgId, dataRsp.common.blockNum, buf, pRequest->reqId, code); tDeleteMqDataRsp(&dataRsp); diff --git a/source/dnode/vnode/src/tqCommon/tqCommon.c b/source/dnode/vnode/src/tqCommon/tqCommon.c index 32249f61ac..44b3f75289 100644 --- a/source/dnode/vnode/src/tqCommon/tqCommon.c +++ b/source/dnode/vnode/src/tqCommon/tqCommon.c @@ -339,13 +339,15 @@ int32_t tqStreamTaskProcessDispatchReq(SStreamMeta* pMeta, SRpcMsg* pMsg) { SMsgHead* pRspHead = rpcMallocCont(sizeof(SMsgHead) + sizeof(SStreamDispatchRsp)); if (pRspHead == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; tqError("s-task:0x%x send dispatch error rsp, out of memory", req.taskId); - return -1; + return terrno; } pRspHead->vgId = htonl(req.upstreamNodeId); - ASSERT(pRspHead->vgId != 0); + if(pRspHead->vgId == 0) { + tqError("vgId:%d invalid dispatch msg from upstream to task:0x%x", pMeta->vgId, req.taskId); + return TSDB_CODE_INVALID_MSG; + } SStreamDispatchRsp* pRsp = POINTER_SHIFT(pRspHead, sizeof(SMsgHead)); pRsp->streamId = htobe64(req.streamId); @@ -926,7 +928,6 @@ int32_t tqStreamTaskProcessTaskResetReq(SStreamMeta* pMeta, char* pMsg) { streamTaskSetStatusReady(pTask); } else if (pState.state == TASK_STATUS__UNINIT) { // tqDebug("s-task:%s start task by checking downstream tasks", pTask->id.idStr); - // ASSERT(pTask->status.downstreamReady == 0); // tqStreamTaskRestoreCheckpoint(pMeta, pTask->id.streamId, pTask->id.taskId); tqDebug("s-task:%s status:%s do nothing after receiving reset-task from mnode", pTask->id.idStr, pState.name); } else { @@ -1000,7 +1001,10 @@ int32_t tqStreamTaskProcessRetrieveTriggerReq(SStreamMeta* pMeta, SRpcMsg* pMsg) TSDB_CODE_ACTION_IN_PROGRESS); } } else { // upstream not recv the checkpoint-source/trigger till now - ASSERT(pState.state == TASK_STATUS__READY || pState.state == TASK_STATUS__HALT); + if (!(pState.state == TASK_STATUS__READY || pState.state == TASK_STATUS__HALT)) { + tqFatal("s-task:%s invalid task status:%s", pTask->id.idStr, pState.name); + } + tqWarn( "s-task:%s not recv checkpoint-source from mnode or checkpoint-trigger from upstream yet, wait for all " "upstream sending checkpoint-source/trigger", @@ -1109,9 +1113,7 @@ static int32_t tqProcessTaskResumeImpl(void* handle, SStreamTask* pTask, int64_t } else { code = streamTrySchedExec(pTask); } - } /*else { - ASSERT(status != TASK_STATUS__UNINIT); - }*/ + } streamMetaReleaseTask(pMeta, pTask); return code; @@ -1191,14 +1193,13 @@ int32_t tqStreamProcessCheckpointReadyRsp(SStreamMeta* pMeta, SRpcMsg* pMsg) { } int32_t tqStreamTaskProcessConsenChkptIdReq(SStreamMeta* pMeta, SRpcMsg* pMsg) { - int32_t vgId = pMeta->vgId; - int32_t code = 0; - - char* msg = POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead)); - int32_t len = pMsg->contLen - sizeof(SMsgHead); - int64_t now = taosGetTimestampMs(); - + int32_t vgId = pMeta->vgId; + int32_t code = 0; + SStreamTask* pTask = NULL; SRestoreCheckpointInfo req = {0}; + char* msg = POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead)); + int32_t len = pMsg->contLen - sizeof(SMsgHead); + int64_t now = taosGetTimestampMs(); SDecoder decoder; tDecoderInit(&decoder, (uint8_t*)msg, len); @@ -1211,7 +1212,6 @@ int32_t tqStreamTaskProcessConsenChkptIdReq(SStreamMeta* pMeta, SRpcMsg* pMsg) { tDecoderClear(&decoder); - SStreamTask* pTask = NULL; code = streamMetaAcquireTask(pMeta, req.streamId, req.taskId, &pTask); if (pTask == NULL || (code != 0)) { tqError( @@ -1236,11 +1236,19 @@ int32_t tqStreamTaskProcessConsenChkptIdReq(SStreamMeta* pMeta, SRpcMsg* pMsg) { pTask->id.idStr, vgId, pTask->chkInfo.checkpointId, req.checkpointId); streamMutexLock(&pTask->lock); - ASSERT(pTask->chkInfo.checkpointId >= req.checkpointId); + if (pTask->chkInfo.checkpointId < req.checkpointId) { + tqFatal("s-task:%s vgId:%d invalid consensus-checkpointId:%" PRId64 ", greater than existed checkpointId:%"PRId64, + pTask->id.idStr, vgId, req.checkpointId, pTask->chkInfo.checkpointId); - if (pTask->chkInfo.consensusTransId >= req.transId) { + streamMutexUnlock(&pTask->lock); + streamMetaReleaseTask(pMeta, pTask); + return TSDB_CODE_STREAM_INTERNAL_ERROR; + } + + SConsenChkptInfo* pConsenInfo = &pTask->status.consenChkptInfo; + if (pConsenInfo->consenChkptTransId >= req.transId) { tqDebug("s-task:%s vgId:%d latest consensus transId:%d, expired consensus trans:%d, discard", pTask->id.idStr, vgId, - pTask->chkInfo.consensusTransId, req.transId); + pConsenInfo->consenChkptTransId, req.transId); streamMutexUnlock(&pTask->lock); streamMetaReleaseTask(pMeta, pTask); return TSDB_CODE_SUCCESS; @@ -1256,7 +1264,7 @@ int32_t tqStreamTaskProcessConsenChkptIdReq(SStreamMeta* pMeta, SRpcMsg* pMsg) { pTask->id.idStr, vgId, req.checkpointId, req.transId); } - pTask->chkInfo.consensusTransId = req.transId; + streamTaskSetConsenChkptIdRecv(pTask, req.transId, now); streamMutexUnlock(&pTask->lock); if (pMeta->role == NODE_ROLE_LEADER) { diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index 46fb9cd1c7..114a1f7b89 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCache.c +++ b/source/dnode/vnode/src/tsdb/tsdbCache.c @@ -757,24 +757,12 @@ static int32_t tsdbCacheDropTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid, rocksdb_free(values_list[0]); rocksdb_free(values_list[1]); - bool erase = false; - LRUHandle *h = taosLRUCacheLookup(pTsdb->lruCache, keys_list[0], klen); - if (h) { - erase = true; - (void)taosLRUCacheRelease(pTsdb->lruCache, h, erase); - } - if (erase) { - taosLRUCacheErase(pTsdb->lruCache, keys_list[0], klen); - } - - erase = false; - h = taosLRUCacheLookup(pTsdb->lruCache, keys_list[1], klen); - if (h) { - erase = true; - (void)taosLRUCacheRelease(pTsdb->lruCache, h, erase); - } - if (erase) { - taosLRUCacheErase(pTsdb->lruCache, keys_list[1], klen); + for (int i = 0; i < 2; i++) { + LRUHandle *h = taosLRUCacheLookup(pTsdb->lruCache, keys_list[i], klen); + if (h) { + (void)taosLRUCacheRelease(pTsdb->lruCache, h, true); + taosLRUCacheErase(pTsdb->lruCache, keys_list[i], klen); + } } } @@ -1027,6 +1015,7 @@ static int32_t tsdbCacheUpdateValue(SValue *pOld, SValue *pNew) { TAOS_RETURN(TSDB_CODE_SUCCESS); } +#ifdef BUILD_NO_CALL static void tsdbCacheUpdateLastCol(SLastCol *pLastCol, SRowKey *pRowKey, SColVal *pColVal) { // update rowkey pLastCol->rowKey.ts = pRowKey->ts; @@ -1047,6 +1036,7 @@ static void tsdbCacheUpdateLastCol(SLastCol *pLastCol, SRowKey *pRowKey, SColVal pLastCol->dirty = 1; } } +#endif static void tsdbCacheUpdateLastColToNone(SLastCol *pLastCol, ELastCacheStatus cacheStatus) { // update rowkey @@ -1108,11 +1098,12 @@ static int32_t tsdbCachePutToLRU(STsdb *pTsdb, SLastKey *pLastKey, SLastCol *pLa size_t charge = 0; *pLRULastCol = *pLastCol; + pLRULastCol->dirty = 1; TAOS_CHECK_EXIT(tsdbCacheReallocSLastCol(pLRULastCol, &charge)); LRUStatus status = taosLRUCacheInsert(pTsdb->lruCache, pLastKey, ROCKS_KEY_LEN, pLRULastCol, charge, tsdbCacheDeleter, NULL, TAOS_LRU_PRIORITY_LOW, &pTsdb->flushState); - if (TAOS_LRU_STATUS_OK != status) { + if (TAOS_LRU_STATUS_OK != status && TAOS_LRU_STATUS_OK_OVERWRITTEN != status) { tsdbError("tsdb/cache/putlru: vgId:%d, failed to insert status %d.", TD_VID(pTsdb->pVnode), status); code = TSDB_CODE_INVALID_DATA_FMT; } @@ -1157,12 +1148,13 @@ static int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, SArray if (pLastCol->cacheStatus != TSDB_LAST_CACHE_NO_CACHE) { int32_t cmp_res = tRowKeyCompare(&pLastCol->rowKey, pRowKey); if (cmp_res < 0 || (cmp_res == 0 && !COL_VAL_IS_NONE(pColVal))) { - tsdbCacheUpdateLastCol(pLastCol, pRowKey, pColVal); - pLastCol->cacheStatus = TSDB_LAST_CACHE_VALID; + SLastCol newLastCol = {.rowKey = *pRowKey, .colVal = *pColVal, .cacheStatus = TSDB_LAST_CACHE_VALID}; + code = tsdbCachePutToLRU(pTsdb, key, &newLastCol); } } (void)taosLRUCacheRelease(pCache, h, false); + TAOS_CHECK_EXIT(code); } else { if (!remainCols) { remainCols = taosArrayInit(num_keys * 2, sizeof(SIdxKey)); @@ -1880,9 +1872,13 @@ int32_t tsdbCacheDel(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKE if (h) { SLastCol *pLastCol = (SLastCol *)taosLRUCacheValue(pTsdb->lruCache, h); if (pLastCol->rowKey.ts <= eKey && pLastCol->rowKey.ts >= sKey) { - tsdbCacheUpdateLastColToNone(pLastCol, TSDB_LAST_CACHE_NO_CACHE); + SLastCol noneCol = {.rowKey.ts = TSKEY_MIN, + .colVal = COL_VAL_NONE(cid, pTSchema->columns[i].type), + .cacheStatus = TSDB_LAST_CACHE_NO_CACHE}; + code = tsdbCachePutToLRU(pTsdb, &lastKey, &noneCol); } (void)taosLRUCacheRelease(pTsdb->lruCache, h, false); + TAOS_CHECK_EXIT(code); } else { if (!remainCols) { remainCols = taosArrayInit(numCols * 2, sizeof(SLastKey)); @@ -2258,6 +2254,7 @@ static int32_t lastIterOpen(SFSLastIter *iter, STFileSet *pFileSet, STsdb *pTsdb int32_t code = 0; destroySttBlockReader(pr->pLDataIterArray, NULL); pr->pLDataIterArray = taosArrayInit(4, POINTER_BYTES); + if (pr->pLDataIterArray == NULL) return terrno; SMergeTreeConf conf = { .uid = uid, diff --git a/source/dnode/vnode/src/tsdb/tsdbFS2.c b/source/dnode/vnode/src/tsdb/tsdbFS2.c index 7e79a618a8..24916bf47c 100644 --- a/source/dnode/vnode/src/tsdb/tsdbFS2.c +++ b/source/dnode/vnode/src/tsdb/tsdbFS2.c @@ -1020,7 +1020,10 @@ int32_t tsdbFSCreateRefSnapshotWithoutLock(STFileSystem *fs, TFileSetArray **fse if (code) break; code = TARRAY2_APPEND(fsetArr[0], fset1); - if (code) break; + if (code) { + tsdbTFileSetClear(&fset1); + break; + } } if (code) { @@ -1219,4 +1222,4 @@ int32_t tsdbFinishTaskOnFileSet(STsdb *tsdb, int32_t fid) { } return 0; -} \ No newline at end of file +} diff --git a/source/dnode/vnode/src/tsdb/tsdbRead2.c b/source/dnode/vnode/src/tsdb/tsdbRead2.c index 0e7607425d..d4e0eb6221 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead2.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead2.c @@ -723,6 +723,7 @@ static int32_t loadFileBlockBrinInfo(STsdbReader* pReader, SArray* pIndexList, S while (1) { int32_t code = getNextBrinRecord(&iter, &pRecord); if (code != TSDB_CODE_SUCCESS) { + clearBrinBlockIter(&iter); return code; } @@ -757,12 +758,14 @@ static int32_t loadFileBlockBrinInfo(STsdbReader* pReader, SArray* pIndexList, S if (!(pRecord->suid == pReader->info.suid && uid == pRecord->uid)) { tsdbError("tsdb failed at: %s:%d", __func__, __LINE__); + clearBrinBlockIter(&iter); return TSDB_CODE_INTERNAL_ERROR; } STableBlockScanInfo* pScanInfo = NULL; code = getTableBlockScanInfo(pReader->status.pTableMap, uid, &pScanInfo, pReader->idStr); if (code != TSDB_CODE_SUCCESS) { + clearBrinBlockIter(&iter); return code; } @@ -807,6 +810,7 @@ static int32_t loadFileBlockBrinInfo(STsdbReader* pReader, SArray* pIndexList, S if (pScanInfo->pBlockList == NULL) { pScanInfo->pBlockList = taosArrayInit(4, sizeof(SFileDataBlockInfo)); if (pScanInfo->pBlockList == NULL) { + clearBrinBlockIter(&iter); return TSDB_CODE_OUT_OF_MEMORY; } } @@ -814,6 +818,7 @@ static int32_t loadFileBlockBrinInfo(STsdbReader* pReader, SArray* pIndexList, S if (pScanInfo->pBlockIdxList == NULL) { pScanInfo->pBlockIdxList = taosArrayInit(4, sizeof(STableDataBlockIdx)); if (pScanInfo->pBlockIdxList == NULL) { + clearBrinBlockIter(&iter); return TSDB_CODE_OUT_OF_MEMORY; } } @@ -822,6 +827,7 @@ static int32_t loadFileBlockBrinInfo(STsdbReader* pReader, SArray* pIndexList, S recordToBlockInfo(&blockInfo, pRecord); void* p1 = taosArrayPush(pScanInfo->pBlockList, &blockInfo); if (p1 == NULL) { + clearBrinBlockIter(&iter); return TSDB_CODE_OUT_OF_MEMORY; } @@ -840,6 +846,7 @@ static int32_t loadFileBlockBrinInfo(STsdbReader* pReader, SArray* pIndexList, S } else { STableBlockScanInfo** p = taosArrayGetLast(pTableScanInfoList); if (p == NULL) { + clearBrinBlockIter(&iter); return TSDB_CODE_INVALID_PARA; } @@ -849,6 +856,7 @@ static int32_t loadFileBlockBrinInfo(STsdbReader* pReader, SArray* pIndexList, S } if (p1 == NULL) { + clearBrinBlockIter(&iter); return TSDB_CODE_OUT_OF_MEMORY; } } @@ -1726,14 +1734,35 @@ static bool isCleanFileDataBlock(STsdbReader* pReader, SFileDataBlockInfo* pBloc return isCleanFileBlock; } +static int32_t initRowMergeIfNeeded(STsdbReader* pReader, int64_t uid) { + SRowMerger* pMerger = &pReader->status.merger; + int32_t code = 0; + + if (pMerger->pArray == NULL) { + STSchema* ps = getTableSchemaImpl(pReader, uid); + if (ps == NULL) { + return terrno; + } + + code = tsdbRowMergerInit(pMerger, ps); + } + + return code; +} + static int32_t buildDataBlockFromBuf(STsdbReader* pReader, STableBlockScanInfo* pBlockScanInfo, int64_t endKey) { if (!(pBlockScanInfo->iiter.hasVal || pBlockScanInfo->iter.hasVal)) { return TSDB_CODE_SUCCESS; } + int32_t code = initRowMergeIfNeeded(pReader, pBlockScanInfo->uid); + if (code != 0) { + return code; + } + int64_t st = taosGetTimestampUs(); SSDataBlock* pBlock = pReader->resBlockInfo.pResBlock; - int32_t code = buildDataBlockFromBufImpl(pBlockScanInfo, endKey, pReader->resBlockInfo.capacity, pReader); + code = buildDataBlockFromBufImpl(pBlockScanInfo, endKey, pReader->resBlockInfo.capacity, pReader); double el = (taosGetTimestampUs() - st) / 1000.0; updateComposedBlockInfo(pReader, el, pBlockScanInfo); @@ -1935,19 +1964,9 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo* TSDBROW fRow = tsdbRowFromBlockData(pBlockData, pDumpInfo->rowIndex); // merge is not initialized yet, due to the fact that the pReader->info.pSchema is not initialized - if (pMerger->pArray == NULL) { - if (pReader->info.pSchema != NULL) { - tsdbError("tsdb failed at %s:%d", __func__, __LINE__); - return TSDB_CODE_INTERNAL_ERROR; - } - STSchema* ps = getTableSchemaImpl(pReader, pBlockScanInfo->uid); - if (ps == NULL) { - return terrno; - } - int32_t code = tsdbRowMergerInit(pMerger, ps); - if (code != TSDB_CODE_SUCCESS) { - return code; - } + int32_t code = initRowMergeIfNeeded(pReader, pBlockScanInfo->uid); + if (code != 0) { + return code; } SRowKey minKey = k; @@ -1975,7 +1994,7 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo* // file block ---> stt block -----> mem if (pkCompEx(&minKey, pfKey) == 0) { - int32_t code = tsdbRowMergerAdd(pMerger, &fRow, NULL); + code = tsdbRowMergerAdd(pMerger, &fRow, NULL); if (code != TSDB_CODE_SUCCESS) { return code; } @@ -1988,7 +2007,7 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo* if (pkCompEx(&minKey, pSttKey) == 0) { TSDBROW* fRow1 = tMergeTreeGetRow(&pSttBlockReader->mergeTree); - int32_t code = tsdbRowMergerAdd(pMerger, fRow1, NULL); + code = tsdbRowMergerAdd(pMerger, fRow1, NULL); if (code != TSDB_CODE_SUCCESS) { return code; } @@ -1999,7 +2018,7 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo* } if (pkCompEx(&minKey, &k) == 0) { - int32_t code = tsdbRowMergerAdd(pMerger, pRow, pSchema); + code = tsdbRowMergerAdd(pMerger, pRow, pSchema); if (code != TSDB_CODE_SUCCESS) { return code; } @@ -2010,7 +2029,7 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo* } } - int32_t code = tsdbRowMergerGetRow(pMerger, &pTSRow); + code = tsdbRowMergerGetRow(pMerger, &pTSRow); if (code != TSDB_CODE_SUCCESS) { return code; } @@ -2031,19 +2050,9 @@ static int32_t mergeFileBlockAndSttBlock(STsdbReader* pReader, SSttBlockReader* int32_t pkSrcSlot = pReader->suppInfo.pkSrcSlot; // merge is not initialized yet, due to the fact that the pReader->info.pSchema is not initialized - if (pMerger->pArray == NULL) { - if (pReader->info.pSchema) { - tsdbError("tsdb failed at %s %d", __func__, __LINE__); - return TSDB_CODE_INTERNAL_ERROR; - } - STSchema* ps = getTableSchemaImpl(pReader, pBlockScanInfo->uid); - if (ps == NULL) { - return terrno; - } - code = tsdbRowMergerInit(pMerger, ps); - if (code != TSDB_CODE_SUCCESS) { - return code; - } + code = initRowMergeIfNeeded(pReader, pBlockScanInfo->uid); + if (code != 0) { + return code; } bool dataInDataFile = hasDataInFileBlock(pBlockData, pDumpInfo); @@ -2167,20 +2176,9 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo* } // merge is not initialized yet, due to the fact that the pReader->info.pSchema is not initialized - if (pMerger->pArray == NULL) { - if (pReader->info.pSchema != NULL) { - tsdbError("tsdb read failed at: %s:%d", __func__, __LINE__); - return TSDB_CODE_INTERNAL_ERROR; - } - STSchema* ps = getTableSchemaImpl(pReader, pBlockScanInfo->uid); - if (ps == NULL) { - return terrno; - } - - code = tsdbRowMergerInit(pMerger, ps); - if (code != TSDB_CODE_SUCCESS) { - return code; - } + code = initRowMergeIfNeeded(pReader, pBlockScanInfo->uid); + if (code != 0) { + return code; } SRowKey minKey = k; @@ -2571,20 +2569,9 @@ int32_t mergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pBloc } // merge is not initialized yet, due to the fact that the pReader->info.pSchema is not initialized - if (pMerger->pArray == NULL) { - if (pReader->info.pSchema != NULL) { - tsdbError("tsdb reader failed at: %s:%d", __func__, __LINE__); - return TSDB_CODE_INTERNAL_ERROR; - } - STSchema* ps = getTableSchemaImpl(pReader, pBlockScanInfo->uid); - if (ps == NULL) { - return terrno; - } - - code = tsdbRowMergerInit(pMerger, ps); - if (code != TSDB_CODE_SUCCESS) { - return code; - } + code = initRowMergeIfNeeded(pReader, pBlockScanInfo->uid); + if (code != 0) { + return code; } tRowKeyAssign(&pBlockScanInfo->lastProcKey, pKey); @@ -4809,7 +4796,7 @@ int32_t tsdbReaderOpen2(void* pVnode, SQueryTableDataCond* pCond, void* pTableLi return code; _err: - tsdbError("failed to create data reader, code:%s %s", tstrerror(code), idstr); + tsdbError("failed to create data reader, error at:%d code:%s %s", lino, tstrerror(code), idstr); tsdbReaderClose2(*ppReader); *ppReader = NULL; // reset the pointer value. return code; diff --git a/source/dnode/vnode/src/tsdb/tsdbReadUtil.c b/source/dnode/vnode/src/tsdb/tsdbReadUtil.c index 374520b483..9d58e2c7bd 100644 --- a/source/dnode/vnode/src/tsdb/tsdbReadUtil.c +++ b/source/dnode/vnode/src/tsdb/tsdbReadUtil.c @@ -524,22 +524,12 @@ static void cleanupBlockOrderSupporter(SBlockOrderSupporter* pSup) { } static int32_t initBlockOrderSupporter(SBlockOrderSupporter* pSup, int32_t numOfTables) { - pSup->numOfBlocksPerTable = taosMemoryCalloc(1, sizeof(int32_t) * numOfTables); - if(pSup->numOfBlocksPerTable == NULL) { - cleanupBlockOrderSupporter(pSup); - return terrno; - } - pSup->indexPerTable = taosMemoryCalloc(1, sizeof(int32_t) * numOfTables); - if(pSup->indexPerTable == NULL) { - taosMemoryFree(pSup->numOfBlocksPerTable); - cleanupBlockOrderSupporter(pSup); - return terrno; - } pSup->pDataBlockInfo = taosMemoryCalloc(1, POINTER_BYTES * numOfTables); - if (pSup->pDataBlockInfo == NULL) { + pSup->indexPerTable = taosMemoryCalloc(1, sizeof(int32_t) * numOfTables); + pSup->numOfBlocksPerTable = taosMemoryCalloc(1, sizeof(int32_t) * numOfTables); + pSup->numOfTables = 0; + if (pSup->pDataBlockInfo == NULL || pSup->indexPerTable == NULL || pSup->numOfBlocksPerTable == NULL) { cleanupBlockOrderSupporter(pSup); - taosMemoryFree(pSup->numOfBlocksPerTable); - taosMemoryFree(pSup->indexPerTable); return terrno; } diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index 057ff0f7c1..c02ff465c6 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -759,8 +759,7 @@ int32_t vnodePreprocessQueryMsg(SVnode *pVnode, SRpcMsg *pMsg) { int32_t vnodeProcessQueryMsg(SVnode *pVnode, SRpcMsg *pMsg, SQueueInfo *pInfo) { vTrace("message in vnode query queue is processing"); - if ((pMsg->msgType == TDMT_SCH_QUERY || pMsg->msgType == TDMT_VND_TMQ_CONSUME || - pMsg->msgType == TDMT_VND_TMQ_CONSUME_PUSH) && + if ((pMsg->msgType == TDMT_SCH_QUERY || pMsg->msgType == TDMT_VND_TMQ_CONSUME) && !syncIsReadyForRead(pVnode->sync)) { vnodeRedirectRpcMsg(pVnode, pMsg, terrno); return 0; diff --git a/source/libs/catalog/src/catalog.c b/source/libs/catalog/src/catalog.c index 334dce9c1a..0b0cb6dc91 100644 --- a/source/libs/catalog/src/catalog.c +++ b/source/libs/catalog/src/catalog.c @@ -110,7 +110,7 @@ int32_t ctgRefreshTbMeta(SCatalog* pCtg, SRequestConnInfo* pConn, SCtgTbMetaCtx* STableMetaOutput* output = taosMemoryCalloc(1, sizeof(STableMetaOutput)); if (NULL == output) { ctgError("malloc %d failed", (int32_t)sizeof(STableMetaOutput)); - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } if (CTG_FLAG_IS_SYS_DB(ctx->flag)) { @@ -278,7 +278,7 @@ int32_t ctgUpdateTbMeta(SCatalog* pCtg, STableMetaRsp* rspMsg, bool syncOp) { STableMetaOutput* output = taosMemoryCalloc(1, sizeof(STableMetaOutput)); if (NULL == output) { ctgError("malloc %d failed", (int32_t)sizeof(STableMetaOutput)); - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } int32_t code = 0; @@ -379,7 +379,7 @@ int32_t ctgGetTbIndex(SCatalog* pCtg, SRequestConnInfo* pConn, SName* pTableName STableIndex* pIndex = taosMemoryCalloc(1, sizeof(STableIndex)); if (NULL == pIndex) { - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } int32_t code = ctgGetTbIndexFromMnode(pCtg, pConn, (SName*)pTableName, pIndex, NULL); @@ -856,7 +856,7 @@ int32_t catalogInit(SCatalogCfg* cfg) { gCtgMgmt.queue.head = taosMemoryCalloc(1, sizeof(SCtgQNode)); if (NULL == gCtgMgmt.queue.head) { qError("calloc %d failed", (int32_t)sizeof(SCtgQNode)); - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } gCtgMgmt.queue.tail = gCtgMgmt.queue.head; @@ -916,7 +916,7 @@ int32_t catalogGetHandle(int64_t clusterId, SCatalog** catalogHandle) { clusterCtg = taosMemoryCalloc(1, sizeof(SCatalog)); if (NULL == clusterCtg) { qError("calloc %d failed", (int32_t)sizeof(SCatalog)); - CTG_API_LEAVE(TSDB_CODE_OUT_OF_MEMORY); + CTG_API_LEAVE(terrno); } clusterCtg->clusterId = clusterId; @@ -1065,7 +1065,7 @@ int32_t catalogGetDBVgInfo(SCatalog* pCtg, SRequestConnInfo* pConn, const char* pInfo->vgHash = taosMemoryCalloc(pInfo->vgNum, sizeof(TAOS_VGROUP_HASH_INFO)); if (NULL == pInfo->vgHash) { - CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_JRET(terrno); } SVgroupInfo* vgInfo = NULL; @@ -1178,7 +1178,7 @@ int32_t catalogUpdateTableIndex(SCatalog* pCtg, STableIndexRsp* pRsp) { STableIndex* pIndex = taosMemoryCalloc(1, sizeof(STableIndex)); if (NULL == pIndex) { - CTG_API_LEAVE(TSDB_CODE_OUT_OF_MEMORY); + CTG_API_LEAVE(terrno); } TAOS_MEMCPY(pIndex, pRsp, sizeof(STableIndex)); @@ -1613,7 +1613,7 @@ int32_t catalogGetExpiredUsers(SCatalog* pCtg, SUserAuthVersion** users, uint32_ *users = taosMemoryCalloc(*num, sizeof(SUserAuthVersion)); if (NULL == *users) { ctgError("calloc %d userAuthVersion failed", *num); - CTG_API_LEAVE(TSDB_CODE_OUT_OF_MEMORY); + CTG_API_LEAVE(terrno); } uint32_t i = 0; diff --git a/source/libs/catalog/src/ctgAsync.c b/source/libs/catalog/src/ctgAsync.c index 7e15fd5f4f..e35aaeb0b1 100644 --- a/source/libs/catalog/src/ctgAsync.c +++ b/source/libs/catalog/src/ctgAsync.c @@ -54,7 +54,7 @@ int32_t ctgInitGetTbMetaTask(SCtgJob* pJob, int32_t taskIdx, void* param) { task.taskCtx = taosMemoryCalloc(1, sizeof(SCtgTbMetaCtx)); if (NULL == task.taskCtx) { - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } SCtgTbMetaCtx* ctx = task.taskCtx; @@ -87,7 +87,7 @@ int32_t ctgInitGetTbMetasTask(SCtgJob* pJob, int32_t taskIdx, void* param) { task.taskCtx = taosMemoryCalloc(1, sizeof(SCtgTbMetasCtx)); if (NULL == task.taskCtx) { - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } SCtgTbMetasCtx* ctx = task.taskCtx; @@ -121,7 +121,7 @@ int32_t ctgInitGetDbVgTask(SCtgJob* pJob, int32_t taskIdx, void* param) { task.taskCtx = taosMemoryCalloc(1, sizeof(SCtgDbVgCtx)); if (NULL == task.taskCtx) { - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } SCtgDbVgCtx* ctx = task.taskCtx; @@ -149,7 +149,7 @@ int32_t ctgInitGetDbCfgTask(SCtgJob* pJob, int32_t taskIdx, void* param) { task.taskCtx = taosMemoryCalloc(1, sizeof(SCtgDbCfgCtx)); if (NULL == task.taskCtx) { - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } SCtgDbCfgCtx* ctx = task.taskCtx; @@ -177,7 +177,7 @@ int32_t ctgInitGetDbInfoTask(SCtgJob* pJob, int32_t taskIdx, void* param) { task.taskCtx = taosMemoryCalloc(1, sizeof(SCtgDbInfoCtx)); if (NULL == task.taskCtx) { - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } SCtgDbInfoCtx* ctx = task.taskCtx; @@ -205,7 +205,7 @@ int32_t ctgInitGetTbHashTask(SCtgJob* pJob, int32_t taskIdx, void* param) { task.taskCtx = taosMemoryCalloc(1, sizeof(SCtgTbHashCtx)); if (NULL == task.taskCtx) { - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } SCtgTbHashCtx* ctx = task.taskCtx; @@ -238,7 +238,7 @@ int32_t ctgInitGetTbHashsTask(SCtgJob* pJob, int32_t taskIdx, void* param) { task.taskCtx = taosMemoryCalloc(1, sizeof(SCtgTbHashsCtx)); if (NULL == task.taskCtx) { - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } SCtgTbHashsCtx* ctx = task.taskCtx; @@ -308,7 +308,7 @@ int32_t ctgInitGetIndexTask(SCtgJob* pJob, int32_t taskIdx, void* param) { task.taskCtx = taosMemoryCalloc(1, sizeof(SCtgIndexCtx)); if (NULL == task.taskCtx) { - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } SCtgIndexCtx* ctx = task.taskCtx; @@ -336,7 +336,7 @@ int32_t ctgInitGetUdfTask(SCtgJob* pJob, int32_t taskIdx, void* param) { task.taskCtx = taosMemoryCalloc(1, sizeof(SCtgUdfCtx)); if (NULL == task.taskCtx) { - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } SCtgUdfCtx* ctx = task.taskCtx; @@ -364,7 +364,7 @@ int32_t ctgInitGetUserTask(SCtgJob* pJob, int32_t taskIdx, void* param) { task.taskCtx = taosMemoryCalloc(1, sizeof(SCtgUserCtx)); if (NULL == task.taskCtx) { - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } SCtgUserCtx* ctx = task.taskCtx; @@ -409,7 +409,7 @@ int32_t ctgInitGetTbIndexTask(SCtgJob* pJob, int32_t taskIdx, void* param) { task.taskCtx = taosMemoryCalloc(1, sizeof(SCtgTbIndexCtx)); if (NULL == task.taskCtx) { - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } SCtgTbIndexCtx* ctx = task.taskCtx; @@ -442,7 +442,7 @@ int32_t ctgInitGetTbCfgTask(SCtgJob* pJob, int32_t taskIdx, void* param) { task.taskCtx = taosMemoryCalloc(1, sizeof(SCtgTbCfgCtx)); if (NULL == task.taskCtx) { - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } SCtgTbCfgCtx* ctx = task.taskCtx; @@ -475,7 +475,7 @@ int32_t ctgInitGetTbTagTask(SCtgJob* pJob, int32_t taskIdx, void* param) { task.taskCtx = taosMemoryCalloc(1, sizeof(SCtgTbTagCtx)); if (NULL == task.taskCtx) { - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } SCtgTbTagCtx* ctx = task.taskCtx; @@ -507,7 +507,7 @@ int32_t ctgInitGetViewsTask(SCtgJob* pJob, int32_t taskIdx, void* param) { task.taskCtx = taosMemoryCalloc(1, sizeof(SCtgViewsCtx)); if (NULL == task.taskCtx) { - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } SCtgViewsCtx* ctx = task.taskCtx; @@ -539,7 +539,7 @@ int32_t ctgInitGetTbTSMATask(SCtgJob* pJob, int32_t taskId, void* param) { SCtgTbTSMACtx* pTaskCtx = taosMemoryCalloc(1, sizeof(SCtgTbTSMACtx)); if (NULL == pTaskCtx) { - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } task.taskCtx = pTaskCtx; @@ -568,7 +568,7 @@ int32_t ctgInitGetTSMATask(SCtgJob* pJob, int32_t taskId, void* param) { SCtgTbTSMACtx* pTaskCtx = taosMemoryCalloc(1, sizeof(SCtgTbTSMACtx)); if (NULL == pTaskCtx) { - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } task.taskCtx = pTaskCtx; pTaskCtx->pNames = param; @@ -828,8 +828,8 @@ int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo* pConn, SCtgJob** job, const *job = taosMemoryCalloc(1, sizeof(SCtgJob)); if (NULL == *job) { - ctgError("failed to calloc, size:%d, qid:0x%" PRIx64, (int32_t)sizeof(SCtgJob), pConn->requestId); - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + ctgError("failed to calloc, size:%d,QID:0x%" PRIx64, (int32_t)sizeof(SCtgJob), pConn->requestId); + CTG_ERR_RET(terrno); } SCtgJob* pJob = *job; @@ -1340,7 +1340,7 @@ int32_t ctgDumpSvrVer(SCtgTask* pTask) { if (NULL == pJob->jobRes.pSvrVer) { pJob->jobRes.pSvrVer = taosMemoryCalloc(1, sizeof(SMetaRes)); if (NULL == pJob->jobRes.pSvrVer) { - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } } @@ -2289,7 +2289,7 @@ int32_t ctgHandleGetViewsRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf* SViewMetaRsp* pRsp = *(SViewMetaRsp**)pMsgCtx->out; SViewMeta* pViewMeta = taosMemoryCalloc(1, sizeof(SViewMeta)); if (NULL == pViewMeta) { - CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_JRET(terrno); } code = dupViewMetaFromRsp(pRsp, pViewMeta); @@ -3271,7 +3271,7 @@ int32_t ctgLaunchGetDbCfgTask(SCtgTask* pTask) { } else { pTask->res = taosMemoryCalloc(1, sizeof(SDbCfgInfo)); if (NULL == pTask->res) { - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } TAOS_MEMCPY(pTask->res, &cfgInfo, sizeof(cfgInfo)); @@ -3299,7 +3299,7 @@ int32_t ctgLaunchGetDbInfoTask(SCtgTask* pTask) { pTask->res = taosMemoryCalloc(1, sizeof(SDbInfo)); if (NULL == pTask->res) { - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } SDbInfo* pInfo = (SDbInfo*)pTask->res; @@ -3392,7 +3392,7 @@ int32_t ctgLaunchGetUserTask(SCtgTask* pTask) { rsp.pRawRes = taosMemoryCalloc(1, sizeof(SUserAuthRes)); if (NULL == rsp.pRawRes) { - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } if (TSDB_CODE_SUCCESS != pCtx->subTaskCode) { diff --git a/source/libs/catalog/src/ctgCache.c b/source/libs/catalog/src/ctgCache.c index 689bf900e2..01201a2480 100644 --- a/source/libs/catalog/src/ctgCache.c +++ b/source/libs/catalog/src/ctgCache.c @@ -546,7 +546,7 @@ int32_t ctgCopyTbMeta(SCatalog *pCtg, SCtgTbMetaCtx *ctx, SCtgDBCache **pDb, SCt } *pTableMeta = taosMemoryCalloc(1, metaSize + schemaExtSize); if (NULL == *pTableMeta) { - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } TAOS_MEMCPY(*pTableMeta, tbMeta, metaSize); @@ -566,7 +566,7 @@ int32_t ctgCopyTbMeta(SCatalog *pCtg, SCtgTbMetaCtx *ctx, SCtgDBCache **pDb, SCt int32_t metaSize = sizeof(SCTableMeta); *pTableMeta = taosMemoryCalloc(1, metaSize); if (NULL == *pTableMeta) { - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } TAOS_MEMCPY(*pTableMeta, tbMeta, metaSize); @@ -884,7 +884,7 @@ int32_t ctgEnqueue(SCatalog *pCtg, SCtgCacheOperation *operation) { qError("calloc %d failed", (int32_t)sizeof(SCtgQNode)); taosMemoryFree(operation->data); taosMemoryFree(operation); - CTG_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_RET(terrno); } node->op = operation; @@ -946,7 +946,7 @@ int32_t ctgDropDbCacheEnqueue(SCatalog *pCtg, const char *dbFName, int64_t dbId) SCtgCacheOperation *op = taosMemoryCalloc(1, sizeof(SCtgCacheOperation)); if (NULL == op) { ctgError("malloc %d failed", (int32_t)sizeof(SCtgCacheOperation)); - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } op->opId = CTG_OP_DROP_DB_CACHE; @@ -984,7 +984,7 @@ int32_t ctgDropDbVgroupEnqueue(SCatalog *pCtg, const char *dbFName, bool syncOp) SCtgCacheOperation *op = taosMemoryCalloc(1, sizeof(SCtgCacheOperation)); if (NULL == op) { ctgError("malloc %d failed", (int32_t)sizeof(SCtgCacheOperation)); - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } op->opId = CTG_OP_DROP_DB_VGROUP; @@ -994,7 +994,7 @@ int32_t ctgDropDbVgroupEnqueue(SCatalog *pCtg, const char *dbFName, bool syncOp) if (NULL == msg) { ctgError("malloc %d failed", (int32_t)sizeof(SCtgDropDbVgroupMsg)); taosMemoryFree(op); - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } char *p = strchr(dbFName, '.'); @@ -1022,7 +1022,7 @@ int32_t ctgDropStbMetaEnqueue(SCatalog *pCtg, const char *dbFName, int64_t dbId, SCtgCacheOperation *op = taosMemoryCalloc(1, sizeof(SCtgCacheOperation)); if (NULL == op) { ctgError("malloc %d failed", (int32_t)sizeof(SCtgCacheOperation)); - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } op->opId = CTG_OP_DROP_STB_META; @@ -1057,7 +1057,7 @@ int32_t ctgDropTbMetaEnqueue(SCatalog *pCtg, const char *dbFName, int64_t dbId, SCtgCacheOperation *op = taosMemoryCalloc(1, sizeof(SCtgCacheOperation)); if (NULL == op) { ctgError("malloc %d failed", (int32_t)sizeof(SCtgCacheOperation)); - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } op->opId = CTG_OP_DROP_TB_META; @@ -1091,7 +1091,7 @@ int32_t ctgUpdateVgroupEnqueue(SCatalog *pCtg, const char *dbFName, int64_t dbId SCtgCacheOperation *op = taosMemoryCalloc(1, sizeof(SCtgCacheOperation)); if (NULL == op) { ctgError("malloc %d failed", (int32_t)sizeof(SCtgCacheOperation)); - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } op->opId = CTG_OP_UPDATE_VGROUP; @@ -1141,7 +1141,7 @@ int32_t ctgUpdateDbCfgEnqueue(SCatalog *pCtg, const char *dbFName, int64_t dbId, SCtgCacheOperation *op = taosMemoryCalloc(1, sizeof(SCtgCacheOperation)); if (NULL == op) { ctgError("malloc %d failed", (int32_t)sizeof(SCtgCacheOperation)); - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } op->opId = CTG_OP_UPDATE_DB_CFG; @@ -1183,7 +1183,7 @@ int32_t ctgUpdateTbMetaEnqueue(SCatalog *pCtg, STableMetaOutput *output, bool sy SCtgCacheOperation *op = taosMemoryCalloc(1, sizeof(SCtgCacheOperation)); if (NULL == op) { ctgError("malloc %d failed", (int32_t)sizeof(SCtgCacheOperation)); - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } op->opId = CTG_OP_UPDATE_TB_META; @@ -1226,7 +1226,7 @@ int32_t ctgUpdateVgEpsetEnqueue(SCatalog *pCtg, char *dbFName, int32_t vgId, SEp SCtgCacheOperation *op = taosMemoryCalloc(1, sizeof(SCtgCacheOperation)); if (NULL == op) { ctgError("malloc %d failed", (int32_t)sizeof(SCtgCacheOperation)); - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } op->opId = CTG_OP_UPDATE_VG_EPSET; @@ -1259,7 +1259,7 @@ int32_t ctgUpdateUserEnqueue(SCatalog *pCtg, SGetUserAuthRsp *pAuth, bool syncOp SCtgCacheOperation *op = taosMemoryCalloc(1, sizeof(SCtgCacheOperation)); if (NULL == op) { ctgError("malloc %d failed", (int32_t)sizeof(SCtgCacheOperation)); - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } op->opId = CTG_OP_UPDATE_USER; @@ -1293,7 +1293,7 @@ int32_t ctgUpdateTbIndexEnqueue(SCatalog *pCtg, STableIndex **pIndex, bool syncO SCtgCacheOperation *op = taosMemoryCalloc(1, sizeof(SCtgCacheOperation)); if (NULL == op) { ctgError("malloc %d failed", (int32_t)sizeof(SCtgCacheOperation)); - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } op->opId = CTG_OP_UPDATE_TB_INDEX; @@ -1329,7 +1329,7 @@ int32_t ctgDropTbIndexEnqueue(SCatalog *pCtg, SName *pName, bool syncOp) { SCtgCacheOperation *op = taosMemoryCalloc(1, sizeof(SCtgCacheOperation)); if (NULL == op) { ctgError("malloc %d failed", (int32_t)sizeof(SCtgCacheOperation)); - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } op->opId = CTG_OP_DROP_TB_INDEX; @@ -1362,7 +1362,7 @@ int32_t ctgClearCacheEnqueue(SCatalog *pCtg, bool clearMeta, bool freeCtg, bool SCtgCacheOperation *op = taosMemoryCalloc(1, sizeof(SCtgCacheOperation)); if (NULL == op) { ctgError("malloc %d failed", (int32_t)sizeof(SCtgCacheOperation)); - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } op->opId = CTG_OP_CLEAR_CACHE; @@ -1396,7 +1396,7 @@ int32_t ctgUpdateViewMetaEnqueue(SCatalog *pCtg, SViewMetaRsp *pRsp, bool syncOp SCtgCacheOperation *op = taosMemoryCalloc(1, sizeof(SCtgCacheOperation)); if (NULL == op) { ctgError("malloc %d failed", (int32_t)sizeof(SCtgCacheOperation)); - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } op->opId = CTG_OP_UPDATE_VIEW_META; @@ -1440,7 +1440,7 @@ int32_t ctgDropViewMetaEnqueue(SCatalog *pCtg, const char *dbFName, uint64_t dbI SCtgCacheOperation *op = taosMemoryCalloc(1, sizeof(SCtgCacheOperation)); if (NULL == op) { ctgError("malloc %d failed", (int32_t)sizeof(SCtgCacheOperation)); - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } op->opId = CTG_OP_DROP_VIEW_META; @@ -1475,7 +1475,7 @@ int32_t ctgUpdateTbTSMAEnqueue(SCatalog *pCtg, STSMACache **pTsma, int32_t tsmaV SCtgCacheOperation *op = taosMemoryCalloc(1, sizeof(SCtgCacheOperation)); if (NULL == op) { ctgError("malloc %d failed", (int32_t)sizeof(SCtgCacheOperation)); - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } op->opId = CTG_OP_UPDATE_TB_TSMA; @@ -1510,7 +1510,7 @@ int32_t ctgDropTbTSMAEnqueue(SCatalog* pCtg, const STSMACache* pTsma, bool sync SCtgCacheOperation* op = taosMemoryCalloc(1, sizeof(SCtgCacheOperation)); if (NULL == op) { ctgError("malloc %d failed", (int32_t)sizeof(SCtgCacheOperation)); - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } op->opId = CTG_OP_DROP_TB_TSMA; @@ -1520,7 +1520,7 @@ int32_t ctgDropTbTSMAEnqueue(SCatalog* pCtg, const STSMACache* pTsma, bool sync if (!msg) { ctgError("malloc %d failed", (int32_t)sizeof(SCtgDropTbTSMAMsg)); taosMemoryFree(op); - CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_JRET(terrno); } msg->pCtg = pCtg; @@ -1546,14 +1546,14 @@ static int32_t createDropAllTbTsmaCtgCacheOp(SCatalog* pCtg, const STSMACache* p SCtgCacheOperation* pOp = taosMemoryCalloc(1, sizeof(SCtgCacheOperation)); if (NULL == pOp) { ctgError("malloc %d failed", (int32_t)sizeof(SCtgCacheOperation)); - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } SCtgDropTbTSMAMsg* pMsg = taosMemoryCalloc(1, sizeof(SCtgDropTbTSMAMsg)); if (NULL == pMsg) { ctgError("malloc %d failed", (int32_t)sizeof(SCtgDropTbTSMAMsg)); taosMemoryFree(pOp); - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } pOp->opId = CTG_OP_DROP_TB_TSMA; @@ -1634,7 +1634,7 @@ int32_t ctgUpdateDbTsmaVersionEnqueue(SCatalog* pCtg, int32_t tsmaVersion, const SCtgCacheOperation *op = taosMemoryCalloc(1, sizeof(SCtgCacheOperation)); if (NULL == op) { ctgError("malloc %d failed", (int32_t)sizeof(SCtgCacheOperation)); - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } op->opId = CTG_OP_UPDATE_DB_TSMA_VERSION; @@ -2753,7 +2753,7 @@ int32_t ctgOpDropTbIndex(SCtgCacheOperation *operation) { STableIndex *pIndex = taosMemoryCalloc(1, sizeof(STableIndex)); if (NULL == pIndex) { - CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_JRET(terrno); } TAOS_STRCPY(pIndex->tbName, msg->tbName); TAOS_STRCPY(pIndex->dbFName, msg->dbFName); @@ -2796,7 +2796,7 @@ int32_t ctgOpUpdateViewMeta(SCtgCacheOperation *operation) { pMeta = taosMemoryCalloc(1, sizeof(SViewMeta)); if (NULL == pMeta) { - CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_JRET(terrno); } CTG_ERR_JRET(dupViewMetaFromRsp(pRsp, pMeta)); @@ -3473,7 +3473,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe pTableMeta = taosMemoryCalloc(1, metaSize + schemaExtSize); if (NULL == pTableMeta) { ctgReleaseTbMetaToCache(pCtg, dbCache, pCache); - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } TAOS_MEMCPY(pTableMeta, tbMeta, metaSize); @@ -3526,7 +3526,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe pTableMeta = taosMemoryCalloc(1, metaSize); if (NULL == pTableMeta) { ctgReleaseTbMetaToCache(pCtg, dbCache, pCache); - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } TAOS_MEMCPY(pTableMeta, tbMeta, metaSize); @@ -3785,7 +3785,7 @@ int32_t ctgGetViewsFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgViewsC SViewMeta *pViewMeta = taosMemoryCalloc(1, sizeof(SViewMeta)); if (NULL == pViewMeta) { ctgReleaseViewMetaToCache(pCtg, dbCache, pCache); - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } TAOS_MEMCPY(pViewMeta, pCache->pMeta, sizeof(*pViewMeta)); @@ -3952,7 +3952,7 @@ int32_t ctgGetTbTSMAFromCache(SCatalog* pCtg, SCtgTbTSMACtx* pCtx, int32_t dbIdx STableTSMAInfoRsp *pRsp = taosMemoryCalloc(1, sizeof(STableTSMAInfoRsp)); if (!pRsp) { ctgReleaseTSMAToCache(pCtg, dbCache, pCache); - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } pRsp->pTsmas = taosArrayInit(pCache->pTsmas->size, POINTER_BYTES); @@ -4048,7 +4048,7 @@ int32_t ctgGetTSMAFromCache(SCatalog* pCtg, SCtgTbTSMACtx* pCtx, SName* pTsmaNam res.pRes = taosMemoryCalloc(1, sizeof(STableTSMAInfoRsp)); if (!res.pRes) { tFreeAndClearTableTSMAInfo(pTsmaOut); - CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_JRET(terrno); } STableTSMAInfoRsp* pRsp = res.pRes; diff --git a/source/libs/catalog/src/ctgRemote.c b/source/libs/catalog/src/ctgRemote.c index fb444ed9d9..4d96283e52 100644 --- a/source/libs/catalog/src/ctgRemote.c +++ b/source/libs/catalog/src/ctgRemote.c @@ -482,14 +482,14 @@ int32_t ctgMakeMsgSendInfo(SCtgJob* pJob, SArray* pTaskId, int32_t batchId, SArr SMsgSendInfo* msgSendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo)); if (NULL == msgSendInfo) { qError("calloc %d failed", (int32_t)sizeof(SMsgSendInfo)); - CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_JRET(terrno); } SCtgTaskCallbackParam* param = taosMemoryCalloc(1, sizeof(SCtgTaskCallbackParam)); if (NULL == param) { qError("calloc %d failed", (int32_t)sizeof(SCtgTaskCallbackParam)); taosMemoryFree(msgSendInfo); - CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_JRET(terrno); } param->reqType = msgType; @@ -538,7 +538,7 @@ int32_t ctgAsyncSendMsg(SCatalog* pCtg, SRequestConnInfo* pConn, SCtgJob* pJob, CTG_ERR_JRET(code); } - ctgDebug("ctg req msg sent, qid:0x%" PRIx64 ", msg type:%d, %s", pJob->queryId, msgType, TMSG_INFO(msgType)); + ctgDebug("ctg req msg sent,QID:0x%" PRIx64 ", msg type:%d, %s", pJob->queryId, msgType, TMSG_INFO(msgType)); return TSDB_CODE_SUCCESS; _return: @@ -753,7 +753,7 @@ int32_t ctgBuildBatchReqMsg(SCtgBatch* pBatch, int32_t vgId, void** msg, int32_t *msg = taosMemoryCalloc(1, msgSize); if (NULL == (*msg)) { qError("calloc batchReq msg failed, size:%d", msgSize); - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } if (tSerializeSBatchReq(*msg, msgSize, &batchReq) < 0) { qError("tSerializeSBatchReq failed"); @@ -928,7 +928,7 @@ int32_t ctgGetDBVgInfoFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, SBuildU if (pTask) { void* pOut = taosMemoryCalloc(1, sizeof(SUseDbOutput)); if (NULL == pOut) { - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } CTG_ERR_RET(ctgUpdateMsgCtx(CTG_GET_TASK_MSGCTX(pTask, tReq->msgIdx), reqType, pOut, input->db)); @@ -983,7 +983,7 @@ int32_t ctgGetDBCfgFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, const char if (pTask) { void* pOut = taosMemoryCalloc(1, sizeof(SDbCfgInfo)); if (NULL == pOut) { - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } CTG_ERR_RET(ctgUpdateMsgCtx(CTG_GET_TASK_MSGCTX(pTask, -1), reqType, pOut, (char*)dbFName)); @@ -1041,7 +1041,7 @@ int32_t ctgGetIndexInfoFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, const if (pTask) { void* pOut = taosMemoryCalloc(1, sizeof(SIndexInfo)); if (NULL == pOut) { - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } CTG_ERR_RET(ctgUpdateMsgCtx(CTG_GET_TASK_MSGCTX(pTask, -1), reqType, pOut, (char*)indexName)); @@ -1101,7 +1101,7 @@ int32_t ctgGetTbIndexFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, SName* n if (pTask) { void* pOut = taosMemoryCalloc(1, sizeof(STableIndex)); if (NULL == pOut) { - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } CTG_ERR_RET(ctgUpdateMsgCtx(CTG_GET_TASK_MSGCTX(pTask, -1), reqType, pOut, (char*)tbFName)); @@ -1159,7 +1159,7 @@ int32_t ctgGetUdfInfoFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, const ch if (pTask) { void* pOut = taosMemoryCalloc(1, sizeof(SFuncInfo)); if (NULL == pOut) { - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } CTG_ERR_RET(ctgUpdateMsgCtx(CTG_GET_TASK_MSGCTX(pTask, -1), reqType, pOut, (char*)funcName)); @@ -1217,7 +1217,7 @@ int32_t ctgGetUserDbAuthFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, const if (pTask) { void* pOut = taosMemoryCalloc(1, sizeof(SGetUserAuthRsp)); if (NULL == pOut) { - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } CTG_ERR_RET(ctgUpdateMsgCtx(CTG_GET_TASK_MSGCTX(pTask, -1), reqType, pOut, (char*)user)); @@ -1280,7 +1280,7 @@ int32_t ctgGetTbMetaFromMnodeImpl(SCatalog* pCtg, SRequestConnInfo* pConn, const if (pTask) { void* pOut = taosMemoryCalloc(1, sizeof(STableMetaOutput)); if (NULL == pOut) { - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } CTG_ERR_RET(ctgUpdateMsgCtx(CTG_GET_TASK_MSGCTX(pTask, tReq->msgIdx), reqType, pOut, tbFName)); @@ -1353,7 +1353,7 @@ int32_t ctgGetTbMetaFromVnode(SCatalog* pCtg, SRequestConnInfo* pConn, const SNa if (pTask) { void* pOut = taosMemoryCalloc(1, sizeof(STableMetaOutput)); if (NULL == pOut) { - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } SRequestConnInfo vConn = {.pTrans = pConn->pTrans, @@ -1597,7 +1597,7 @@ int32_t ctgGetViewInfoFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, SName* if (pTask) { void* pOut = taosMemoryCalloc(1, POINTER_BYTES); if (NULL == pOut) { - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } CTG_ERR_RET(ctgUpdateMsgCtx(CTG_GET_TASK_MSGCTX(pTask, tReq->msgIdx), reqType, pOut, fullName)); @@ -1654,7 +1654,7 @@ int32_t ctgGetTbTSMAFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, const SNa if (pTask) { void* pOut = taosMemoryCalloc(1, sizeof(STableTSMAInfoRsp)); if (NULL == pOut) { - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } CTG_ERR_RET(ctgUpdateMsgCtx(CTG_GET_TASK_MSGCTX(pTask, tReq->msgIdx), reqType, pOut, (char*)tbFName)); @@ -1715,7 +1715,7 @@ int32_t ctgGetStreamProgressFromVnode(SCatalog* pCtg, SRequestConnInfo* pConn, c if (pTask) { SStreamProgressRsp* pOut = taosMemoryCalloc(1, sizeof(SStreamProgressRsp)); if (!pOut) { - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } CTG_ERR_RET(ctgUpdateMsgCtx(CTG_GET_TASK_MSGCTX(pTask, tReq->msgIdx), reqType, pOut, (char*)tbFName)); diff --git a/source/libs/catalog/src/ctgRent.c b/source/libs/catalog/src/ctgRent.c index 329aee1703..b4dfd0ebee 100755 --- a/source/libs/catalog/src/ctgRent.c +++ b/source/libs/catalog/src/ctgRent.c @@ -30,7 +30,7 @@ int32_t ctgMetaRentInit(SCtgRentMgmt *mgmt, uint32_t rentSec, int8_t type, int32 mgmt->slots = taosMemoryCalloc(1, msgSize); if (NULL == mgmt->slots) { qError("calloc %d failed", (int32_t)msgSize); - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + CTG_ERR_RET(terrno); } mgmt->rentCacheSize = msgSize; diff --git a/source/libs/command/src/explain.c b/source/libs/command/src/explain.c index b9f79d1e00..886425c69b 100644 --- a/source/libs/command/src/explain.c +++ b/source/libs/command/src/explain.c @@ -123,13 +123,13 @@ int32_t qExplainInitCtx(SExplainCtx **pCtx, SHashObj *groupHash, bool verbose, d SExplainCtx *ctx = taosMemoryCalloc(1, sizeof(SExplainCtx)); if (NULL == ctx) { qError("calloc SExplainCtx failed"); - QRY_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); + QRY_ERR_JRET(terrno); } SArray *rows = taosArrayInit(10, sizeof(SQueryExplainRowInfo)); if (NULL == rows) { qError("taosArrayInit SQueryExplainRowInfo failed"); - QRY_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); + QRY_ERR_JRET(terrno); } char *tbuf = taosMemoryMalloc(TSDB_EXPLAIN_RESULT_ROW_SIZE); diff --git a/source/libs/executor/inc/executil.h b/source/libs/executor/inc/executil.h index e35b26627b..95035dd96f 100644 --- a/source/libs/executor/inc/executil.h +++ b/source/libs/executor/inc/executil.h @@ -32,7 +32,6 @@ #define SET_RES_WINDOW_KEY(_k, _ori, _len, _uid) \ do { \ - assert(sizeof(_uid) == sizeof(uint64_t)); \ *(uint64_t*)(_k) = (_uid); \ (void)memcpy((_k) + sizeof(uint64_t), (_ori), (_len)); \ } while (0) diff --git a/source/libs/executor/inc/mergejoin.h b/source/libs/executor/inc/mergejoin.h index 64db1a57a0..ceb0037b8d 100755 --- a/source/libs/executor/inc/mergejoin.h +++ b/source/libs/executor/inc/mergejoin.h @@ -357,7 +357,6 @@ typedef struct SMJoinOperatorInfo { #define MJOIN_PUSH_BLK_TO_CACHE(_cache, _blk) \ do { \ - ASSERT(taosArrayGetSize((_cache)->grps) <= 1); \ SMJoinGrpRows* pGrp = (SMJoinGrpRows*)taosArrayReserve((_cache)->grps, 1); \ (_cache)->rowNum += (_blk)->info.rows; \ pGrp->blk = (_blk); \ @@ -381,7 +380,6 @@ typedef struct SMJoinOperatorInfo { do { \ SMJoinGrpRows* pGrp = taosArrayGet((_cache)->grps, 0); \ if (NULL != pGrp) { \ - ASSERT(pGrp->blk == (_tb)->blk); \ pGrp->beginIdx = (_tb)->blkRowIdx; \ pGrp->readIdx = pGrp->beginIdx; \ } \ diff --git a/source/libs/executor/inc/operator.h b/source/libs/executor/inc/operator.h index 7d09be3300..0df676c6e2 100644 --- a/source/libs/executor/inc/operator.h +++ b/source/libs/executor/inc/operator.h @@ -182,6 +182,7 @@ int16_t getOperatorResultBlockId(struct SOperatorInfo* pOperator, int32_t int32_t createOperator(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo, SReadHandle* pHandle, SNode* pTagCond, SNode* pTagIndexCond, const char* pUser, const char* dbname, SOperatorInfo** pOptrInfo); void destroyOperator(SOperatorInfo* pOperator); +void destroyOperatorAndDownstreams(SOperatorInfo* pOperator, SOperatorInfo** stream, int32_t num); int32_t extractOperatorInTree(SOperatorInfo* pOperator, int32_t type, const char* id, SOperatorInfo** pOptrInfo); int32_t getTableScanInfo(SOperatorInfo* pOperator, int32_t* order, int32_t* scanFlag, bool inheritUsOrder); diff --git a/source/libs/executor/src/aggregateoperator.c b/source/libs/executor/src/aggregateoperator.c index b5a3f2f484..f0e0f81cf5 100644 --- a/source/libs/executor/src/aggregateoperator.c +++ b/source/libs/executor/src/aggregateoperator.c @@ -137,22 +137,14 @@ int32_t createAggregateOperatorInfo(SOperatorInfo* downstream, SAggPhysiNode* pA } *pOptrInfo = pOperator; - return code; + return TSDB_CODE_SUCCESS; _error: - if (code != TSDB_CODE_SUCCESS) { - qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); - } + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); if (pInfo != NULL) { destroyAggOperatorInfo(pInfo); } - if (pOperator != NULL) { - pOperator->info = NULL; - if (pOperator->pDownstream == NULL && downstream != NULL) { - destroyOperator(downstream); - } - destroyOperator(pOperator); - } + destroyOperatorAndDownstreams(pOperator, &downstream, 1); pTaskInfo->code = code; return code; } @@ -193,8 +185,9 @@ static bool nextGroupedResult(SOperatorInfo* pOperator) { pAggInfo->pNewGroupBlock = NULL; tSimpleHashClear(pAggInfo->aggSup.pResultRowHashTable); setExecutionContext(pOperator, pOperator->exprSupp.numOfExprs, pBlock->info.id.groupId); - QUERY_CHECK_CODE(code, lino, _end); code = setInputDataBlock(pSup, pBlock, order, pBlock->info.scanFlag, true); + QUERY_CHECK_CODE(code, lino, _end); + code = doAggregateImpl(pOperator, pSup->pCtx); QUERY_CHECK_CODE(code, lino, _end); } diff --git a/source/libs/executor/src/countwindowoperator.c b/source/libs/executor/src/countwindowoperator.c index 1d72b0bb58..28b2c22053 100644 --- a/source/libs/executor/src/countwindowoperator.c +++ b/source/libs/executor/src/countwindowoperator.c @@ -378,20 +378,14 @@ int32_t createCountwindowOperatorInfo(SOperatorInfo* downstream, SPhysiNode* phy } *pOptrInfo = pOperator; - return code; + return TSDB_CODE_SUCCESS; _error: if (pInfo != NULL) { destroyCountWindowOperatorInfo(pInfo); } - if (pOperator != NULL) { - pOperator->info = NULL; - if (pOperator->pDownstream == NULL && downstream != NULL) { - destroyOperator(downstream); - } - destroyOperator(pOperator); - } + destroyOperatorAndDownstreams(pOperator, &downstream, 1); pTaskInfo->code = code; return code; } diff --git a/source/libs/executor/src/dynqueryctrloperator.c b/source/libs/executor/src/dynqueryctrloperator.c index a75bfb8f4b..8058fa9afe 100644 --- a/source/libs/executor/src/dynqueryctrloperator.c +++ b/source/libs/executor/src/dynqueryctrloperator.c @@ -1006,14 +1006,14 @@ int32_t createDynQueryCtrlOperatorInfo(SOperatorInfo** pDownstream, int32_t numO NULL, optrDefaultGetNextExtFn, NULL); *pOptrInfo = pOperator; - return code; + return TSDB_CODE_SUCCESS; _error: if (pInfo != NULL) { destroyDynQueryCtrlOperator(pInfo); } - taosMemoryFree(pOperator); + destroyOperatorAndDownstreams(pOperator, pDownstream, numOfDownstream); pTaskInfo->code = code; return code; } diff --git a/source/libs/executor/src/eventwindowoperator.c b/source/libs/executor/src/eventwindowoperator.c index 0b5fd074b0..591590a261 100644 --- a/source/libs/executor/src/eventwindowoperator.c +++ b/source/libs/executor/src/eventwindowoperator.c @@ -140,20 +140,14 @@ int32_t createEventwindowOperatorInfo(SOperatorInfo* downstream, SPhysiNode* phy } *pOptrInfo = pOperator; - return code; + return TSDB_CODE_SUCCESS; _error: if (pInfo != NULL) { destroyEWindowOperatorInfo(pInfo); } - if (pOperator != NULL) { - pOperator->info = NULL; - if (pOperator->pDownstream == NULL && downstream != NULL) { - destroyOperator(downstream); - } - destroyOperator(pOperator); - } + destroyOperatorAndDownstreams(pOperator, &downstream, 1); pTaskInfo->code = code; return code; } diff --git a/source/libs/executor/src/exchangeoperator.c b/source/libs/executor/src/exchangeoperator.c index 4315624d97..120dcbc205 100644 --- a/source/libs/executor/src/exchangeoperator.c +++ b/source/libs/executor/src/exchangeoperator.c @@ -444,7 +444,7 @@ int32_t createExchangeOperatorInfo(void* pTransporter, SExchangePhysiNode* pExNo pOperator->fpSet = createOperatorFpSet(prepareLoadRemoteData, loadRemoteDataNext, NULL, destroyExchangeOperatorInfo, optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL); *pOptrInfo = pOperator; - return code; + return TSDB_CODE_SUCCESS; _error: if (code != TSDB_CODE_SUCCESS) { diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c index 757192b9b0..ea05ba6581 100644 --- a/source/libs/executor/src/executil.c +++ b/source/libs/executor/src/executil.c @@ -56,6 +56,7 @@ static int32_t getTableList(void* pVnode, SScanPhysiNode* pScanNode, SNode* pTag static int64_t getLimit(const SNode* pLimit) { return NULL == pLimit ? -1 : ((SLimitNode*)pLimit)->limit; } static int64_t getOffset(const SNode* pLimit) { return NULL == pLimit ? -1 : ((SLimitNode*)pLimit)->offset; } +static void releaseColInfoData(void* pCol); void initResultRowInfo(SResultRowInfo* pResultRowInfo) { pResultRowInfo->size = 0; @@ -531,7 +532,7 @@ static int32_t createResultData(SDataType* pType, int32_t numOfRows, SScalarPara int32_t code = colInfoDataEnsureCapacity(pColumnData, numOfRows, true); if (code != TSDB_CODE_SUCCESS) { terrno = code; - taosMemoryFree(pColumnData); + releaseColInfoData(pColumnData); return terrno; } diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index e641e151b7..65273487f6 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -601,7 +601,7 @@ int32_t qCreateExecTask(SReadHandle* readHandle, int32_t vgId, uint64_t taskId, SExecTaskInfo** pTask = (SExecTaskInfo**)pTaskInfo; (void)taosThreadOnce(&initPoolOnce, initRefPool); - qDebug("start to create task, TID:0x%" PRIx64 " qid:0x%" PRIx64 ", vgId:%d", taskId, pSubplan->id.queryId, vgId); + qDebug("start to create task, TID:0x%" PRIx64 "QID:0x%" PRIx64 ", vgId:%d", taskId, pSubplan->id.queryId, vgId); int32_t code = createExecTaskInfo(pSubplan, pTask, readHandle, taskId, vgId, sql, model); if (code != TSDB_CODE_SUCCESS || NULL == *pTask) { @@ -630,7 +630,7 @@ int32_t qCreateExecTask(SReadHandle* readHandle, int32_t vgId, uint64_t taskId, code = dsCreateDataSinker(pSinkManager, pSubplan->pDataSink, handle, pSinkParam, (*pTask)->id.str); } - qDebug("subplan task create completed, TID:0x%" PRIx64 " qid:0x%" PRIx64, taskId, pSubplan->id.queryId); + qDebug("subplan task create completed, TID:0x%" PRIx64 "QID:0x%" PRIx64, taskId, pSubplan->id.queryId); _error: // if failed to add ref for all tables in this query, abort current query @@ -1611,6 +1611,8 @@ int32_t getTableListInfo(const SExecTaskInfo* pTaskInfo, SArray** pList) { int32_t code = extractTableList(pArray, pTaskInfo->pRoot); if (code == 0) { *pList = pArray; + } else { + taosArrayDestroy(pArray); } return code; } diff --git a/source/libs/executor/src/executorInt.c b/source/libs/executor/src/executorInt.c index 42e7fbee1f..b48bacd50d 100644 --- a/source/libs/executor/src/executorInt.c +++ b/source/libs/executor/src/executorInt.c @@ -551,6 +551,8 @@ int32_t setResultRowInitCtx(SResultRow* pResult, SqlFunctionCtx* pCtx, int32_t n if (code != TSDB_CODE_SUCCESS && fmIsUserDefinedFunc(pCtx[i].functionId)) { pResInfo->initialized = false; return TSDB_CODE_UDF_FUNC_EXEC_FAILURE; + } else if (code != TSDB_CODE_SUCCESS) { + return code; } } else { pResInfo->initialized = true; @@ -1105,7 +1107,8 @@ int32_t createDataSinkParam(SDataSinkNode* pNode, void** pParam, SExecTaskInfo* SArray* pInfoList = NULL; int32_t code = getTableListInfo(pTask, &pInfoList); - if (code || pInfoList == NULL) { + if (code != TSDB_CODE_SUCCESS || pInfoList == NULL) { + taosMemoryFree(pDeleterParam); return code; } diff --git a/source/libs/executor/src/filloperator.c b/source/libs/executor/src/filloperator.c index 4ae3226f48..246a5e2a6d 100644 --- a/source/libs/executor/src/filloperator.c +++ b/source/libs/executor/src/filloperator.c @@ -511,26 +511,21 @@ int32_t createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode* pPhyFi optrDefaultGetNextExtFn, NULL); code = appendDownstream(pOperator, &downstream, 1); + if (code != TSDB_CODE_SUCCESS) { + goto _error; + } *pOptrInfo = pOperator; - return code; + return TSDB_CODE_SUCCESS; _error: - if (code != TSDB_CODE_SUCCESS) { - qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); - } + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + if (pInfo != NULL) { destroyFillOperatorInfo(pInfo); } - + destroyOperatorAndDownstreams(pOperator, &downstream, 1); pTaskInfo->code = code; - if (pOperator != NULL) { - pOperator->info = NULL; - if (pOperator->pDownstream == NULL && downstream != NULL) { - destroyOperator(downstream); - } - destroyOperator(pOperator); - } return code; } diff --git a/source/libs/executor/src/groupcacheoperator.c b/source/libs/executor/src/groupcacheoperator.c index 9b213487ed..f0e0894bd2 100644 --- a/source/libs/executor/src/groupcacheoperator.c +++ b/source/libs/executor/src/groupcacheoperator.c @@ -1510,20 +1510,14 @@ int32_t createGroupCacheOperatorInfo(SOperatorInfo** pDownstream, int32_t numOfD qTrace("new group cache operator, maxCacheSize:%" PRId64 ", globalGrp:%d, batchFetch:%d", pInfo->maxCacheSize, pInfo->globalGrp, pInfo->batchFetch); *pOptrInfo = pOperator; - return code; + return TSDB_CODE_SUCCESS; _error: if (pInfo != NULL) { destroyGroupCacheOperator(pInfo); } - if (pOperator != NULL) { - pOperator->info = NULL; - if (pOperator->pDownstream == NULL && pDownstream != NULL && (*pDownstream) != NULL) { - destroyOperator(*pDownstream); - } - destroyOperator(pOperator); - } + destroyOperatorAndDownstreams(pOperator, pDownstream, numOfDownstream); pTaskInfo->code = code; return code; } diff --git a/source/libs/executor/src/groupoperator.c b/source/libs/executor/src/groupoperator.c index f0a4914c24..9b46db609f 100644 --- a/source/libs/executor/src/groupoperator.c +++ b/source/libs/executor/src/groupoperator.c @@ -600,22 +600,12 @@ int32_t createGroupOperatorInfo(SOperatorInfo* downstream, SAggPhysiNode* pAggNo QUERY_CHECK_CODE(code, lino, _error); *pOptrInfo = pOperator; - return code; + return TSDB_CODE_SUCCESS; _error: + if (pInfo != NULL) destroyGroupOperatorInfo(pInfo); + destroyOperatorAndDownstreams(pOperator, &downstream, 1); pTaskInfo->code = code; - if (pInfo != NULL) { - destroyGroupOperatorInfo(pInfo); - } - - if (pOperator) { - pOperator->info = NULL; - if (pOperator->pDownstream == NULL && downstream != NULL) { - destroyOperator(downstream); - } - destroyOperator(pOperator); - } - return code; } @@ -1209,6 +1199,11 @@ int32_t createPartitionOperatorInfo(SOperatorInfo* downstream, SPartitionPhysiNo pInfo->rowCapacity = blockDataGetCapacityInRow(pInfo->binfo.pRes, getBufPageSize(pInfo->pBuf), blockDataGetSerialMetaSize(taosArrayGetSize(pInfo->binfo.pRes->pDataBlock))); + if (pInfo->rowCapacity < 0) { + code = terrno; + goto _error; + } + pInfo->columnOffset = setupColumnOffset(pInfo->binfo.pRes, pInfo->rowCapacity); QUERY_CHECK_NULL(pInfo->columnOffset, code, lino, _error, terrno); @@ -1229,20 +1224,14 @@ int32_t createPartitionOperatorInfo(SOperatorInfo* downstream, SPartitionPhysiNo } *pOptrInfo = pOperator; - return code; + return TSDB_CODE_SUCCESS; _error: if (pInfo != NULL) { destroyPartitionOperatorInfo(pInfo); } pTaskInfo->code = code; - if (pOperator != NULL) { - pOperator->info = NULL; - if (pOperator->pDownstream == NULL && downstream != NULL) { - destroyOperator(downstream); - } - destroyOperator(pOperator); - } + destroyOperatorAndDownstreams(pOperator, &downstream, 1); TAOS_RETURN(code); } @@ -1778,18 +1767,12 @@ int32_t createStreamPartitionOperatorInfo(SOperatorInfo* downstream, SStreamPart QUERY_CHECK_CODE(code, lino, _error); *pOptrInfo = pOperator; - return code; + return TSDB_CODE_SUCCESS; _error: pTaskInfo->code = code; if (pInfo != NULL) destroyStreamPartitionOperatorInfo(pInfo); - if (pOperator != NULL) { - pOperator->info = NULL; - if (pOperator->pDownstream == NULL && downstream != NULL) { - destroyOperator(downstream); - } - destroyOperator(pOperator); - } + destroyOperatorAndDownstreams(pOperator, &downstream, 1); qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); return code; } diff --git a/source/libs/executor/src/hashjoinoperator.c b/source/libs/executor/src/hashjoinoperator.c index 55620defba..f253aefe95 100644 --- a/source/libs/executor/src/hashjoinoperator.c +++ b/source/libs/executor/src/hashjoinoperator.c @@ -1228,15 +1228,14 @@ int32_t createHashJoinOperatorInfo(SOperatorInfo** pDownstream, int32_t numOfDow qDebug("create hash Join operator done"); *pOptrInfo = pOperator; - return code; + return TSDB_CODE_SUCCESS; _return: if (pInfo != NULL) { destroyHashJoinOperator(pInfo); } - - taosMemoryFree(pOperator); + destroyOperatorAndDownstreams(pOperator, pDownstream, numOfDownstream); pTaskInfo->code = code; return code; } diff --git a/source/libs/executor/src/mergejoinoperator.c b/source/libs/executor/src/mergejoinoperator.c index 808aac66c2..14f3a08e17 100644 --- a/source/libs/executor/src/mergejoinoperator.c +++ b/source/libs/executor/src/mergejoinoperator.c @@ -1869,6 +1869,7 @@ int32_t createMergeJoinOperatorInfo(SOperatorInfo** pDownstream, int32_t numOfDo SSortMergeJoinPhysiNode* pJoinNode, SExecTaskInfo* pTaskInfo, SOperatorInfo** pOptrInfo) { QRY_OPTR_CHECK(pOptrInfo); + int32_t oldNum = numOfDownstream; bool newDownstreams = false; int32_t code = TSDB_CODE_SUCCESS; SOperatorInfo* pOperator = NULL; @@ -1921,8 +1922,7 @@ _return: if (newDownstreams) { taosMemoryFree(pDownstream); } - - taosMemoryFree(pOperator); + destroyOperatorAndDownstreams(pOperator, pDownstream, oldNum); pTaskInfo->code = code; return code; diff --git a/source/libs/executor/src/mergeoperator.c b/source/libs/executor/src/mergeoperator.c index 9e0ad5f497..c12bfd8798 100644 --- a/source/libs/executor/src/mergeoperator.c +++ b/source/libs/executor/src/mergeoperator.c @@ -649,14 +649,13 @@ int32_t createMultiwayMergeOperatorInfo(SOperatorInfo** downStreams, size_t numS } *pOptrInfo = pOperator; - return code; + return TSDB_CODE_SUCCESS; _error: if (pInfo != NULL) { destroyMultiwayMergeOperatorInfo(pInfo); } - pTaskInfo->code = code; - taosMemoryFree(pOperator); + destroyOperatorAndDownstreams(pOperator, downStreams, numStreams); return code; } diff --git a/source/libs/executor/src/operator.c b/source/libs/executor/src/operator.c index fc52b97388..3f48d0f0a8 100644 --- a/source/libs/executor/src/operator.c +++ b/source/libs/executor/src/operator.c @@ -633,7 +633,11 @@ int32_t createOperator(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo, SReadHand } else { code = TSDB_CODE_INVALID_PARA; pTaskInfo->code = code; + for (int32_t i = 0; i < size; ++i) { + destroyOperator(ops[i]); + } taosMemoryFree(ops); + qError("invalid operator type %d", type); return code; } @@ -672,6 +676,23 @@ void destroyOperator(SOperatorInfo* pOperator) { taosMemoryFreeClear(pOperator); } +void destroyOperatorAndDownstreams(SOperatorInfo* pOperator, SOperatorInfo** downstreams, int32_t num) { + if (downstreams != NULL) { + for (int i = 0; i < num; i++) { + destroyOperator(downstreams[i]); + } + } + + if (pOperator != NULL) { + pOperator->info = NULL; + if (pOperator->pDownstream != NULL) { + taosMemoryFreeClear(pOperator->pDownstream); + pOperator->pDownstream = NULL; + } + destroyOperator(pOperator); + } +} + int32_t getOperatorExplainExecInfo(SOperatorInfo* operatorInfo, SArray* pExecInfoList) { SExplainExecInfo execInfo = {0}; SExplainExecInfo* pExplainInfo = taosArrayPush(pExecInfoList, &execInfo); diff --git a/source/libs/executor/src/projectoperator.c b/source/libs/executor/src/projectoperator.c index 7e06c083ed..a9ba57e1d4 100644 --- a/source/libs/executor/src/projectoperator.c +++ b/source/libs/executor/src/projectoperator.c @@ -177,17 +177,11 @@ int32_t createProjectOperatorInfo(SOperatorInfo* downstream, SProjectPhysiNode* } *pOptrInfo = pOperator; - return code; + return TSDB_CODE_SUCCESS; _error: if (pInfo != NULL) destroyProjectOperatorInfo(pInfo); - if (pOperator != NULL) { - pOperator->info = NULL; - if (pOperator->pDownstream == NULL && downstream != NULL) { - destroyOperator(downstream); - } - destroyOperator(pOperator); - } + destroyOperatorAndDownstreams(pOperator, &downstream, 1); pTaskInfo->code = code; return code; } @@ -525,17 +519,11 @@ int32_t createIndefinitOutputOperatorInfo(SOperatorInfo* downstream, SPhysiNode* } *pOptrInfo = pOperator; - return code; + return TSDB_CODE_SUCCESS; _error: if (pInfo != NULL) destroyIndefinitOperatorInfo(pInfo); - if (pOperator != NULL) { - pOperator->info = NULL; - if (pOperator->pDownstream == NULL && downstream != NULL) { - destroyOperator(downstream); - } - destroyOperator(pOperator); - } + destroyOperatorAndDownstreams(pOperator, &downstream, 1); pTaskInfo->code = code; return code; } diff --git a/source/libs/executor/src/querytask.c b/source/libs/executor/src/querytask.c index c39ccd6ba5..b050143ac0 100644 --- a/source/libs/executor/src/querytask.c +++ b/source/libs/executor/src/querytask.c @@ -287,7 +287,7 @@ void buildTaskId(uint64_t taskId, uint64_t queryId, char* dst) { memcpy(p, "TID:0x", offset); offset += tintToHex(taskId, &p[offset]); - memcpy(&p[offset], " qid:0x", 7); + memcpy(&p[offset], "QID:0x", 7); offset += 7; offset += tintToHex(queryId, &p[offset]); diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 557794a062..7c016d8c2a 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -744,12 +744,10 @@ _end: insertRet = taosLRUCacheInsert(pCache->pTableMetaEntryCache, &pBlock->info.id.uid, sizeof(uint64_t), pVal, sizeof(STableCachedVal), freeCachedMetaItem, NULL, TAOS_LRU_PRIORITY_LOW, NULL); if (insertRet != TAOS_LRU_STATUS_OK) { - qError("failed to put meta into lru cache, code:%d, %s", insertRet, idStr); - taosMemoryFreeClear(pVal); - freeTableCachedValObj(&val); + qWarn("failed to put meta into lru cache, code:%d, %s", insertRet, idStr); } } - + if (freeReader) { pHandle->api.metaReaderFn.clearReader(&mr); } @@ -1528,7 +1526,7 @@ int32_t createTableScanOperatorInfo(STableScanPhysiNode* pTableScanNode, SReadHa // for non-blocking operator, the open cost is always 0 pOperator->cost.openCost = 0; *pOptrInfo = pOperator; - return code; + return TSDB_CODE_SUCCESS; _error: if (pInfo != NULL) { @@ -5548,7 +5546,7 @@ static int32_t getBlockForTableMergeScan(void* param, SSDataBlock** ppBlock) { pOperator->resultInfo.totalRows += pBlock->info.rows; pInfo->base.readRecorder.elapsedTime += (taosGetTimestampUs() - st) / 1000.0; *ppBlock = pBlock; - + return code; } @@ -5703,7 +5701,7 @@ void startGroupTableMergeScan(SOperatorInfo* pOperator) { int32_t numOfTables = 0; code = tableListGetSize(pInfo->base.pTableListInfo, &numOfTables); QUERY_CHECK_CODE(code, lino, _end); - + int32_t i = pInfo->tableStartIndex + 1; for (; i < numOfTables; ++i) { STableKeyInfo* tableKeyInfo = tableListGetInfo(pInfo->base.pTableListInfo, i); diff --git a/source/libs/executor/src/sortoperator.c b/source/libs/executor/src/sortoperator.c index fb4b61c7a8..8b50cd20ae 100644 --- a/source/libs/executor/src/sortoperator.c +++ b/source/libs/executor/src/sortoperator.c @@ -155,20 +155,13 @@ int32_t createSortOperatorInfo(SOperatorInfo* downstream, SSortPhysiNode* pSortN } *pOptrInfo = pOperator; - return code; + return TSDB_CODE_SUCCESS; _error: if (pInfo != NULL) { destroySortOperatorInfo(pInfo); } - - if (pOperator != NULL) { - pOperator->info = NULL; - if (pOperator->pDownstream == NULL && downstream != NULL) { - destroyOperator(downstream); - } - destroyOperator(pOperator); - } + destroyOperatorAndDownstreams(pOperator, &downstream, 1); pTaskInfo->code = code; return code; } @@ -261,17 +254,17 @@ static int32_t getSortedBlockData(SSortHandle* pHandle, SSDataBlock* pDataBlock, SSortOperatorInfo* pInfo, SSDataBlock** pResBlock) { QRY_OPTR_CHECK(pResBlock); blockDataCleanup(pDataBlock); + int32_t lino = 0; + int32_t code = 0; SSDataBlock* p = NULL; - int32_t code = tsortGetSortedDataBlock(pHandle, &p); + code = tsortGetSortedDataBlock(pHandle, &p); if (p == NULL || (code != 0)) { return code; } code = blockDataEnsureCapacity(p, capacity); - if (code) { - return code; - } + QUERY_CHECK_CODE(code, lino, _error); STupleHandle* pTupleHandle; while (1) { @@ -280,51 +273,40 @@ static int32_t getSortedBlockData(SSortHandle* pHandle, SSDataBlock* pDataBlock, } else { code = tsortNextTuple(pHandle, &pTupleHandle); } + if (pTupleHandle == NULL || code != 0) { + lino = __LINE__; break; } code = appendOneRowToDataBlock(p, pTupleHandle); - if (code) { - return code; - } + QUERY_CHECK_CODE(code, lino, _error); if (p->info.rows >= capacity) { break; } } - if (TSDB_CODE_SUCCESS != code) { - return code; - } + + QUERY_CHECK_CODE(code, lino, _error); if (p->info.rows > 0) { code = blockDataEnsureCapacity(pDataBlock, capacity); - if (code) { - return code; - } + QUERY_CHECK_CODE(code, lino, _error); // todo extract function to handle this int32_t numOfCols = taosArrayGetSize(pColMatchInfo); for (int32_t i = 0; i < numOfCols; ++i) { SColMatchItem* pmInfo = taosArrayGet(pColMatchInfo, i); - if (pmInfo == NULL) { - return terrno; - } + QUERY_CHECK_NULL(pmInfo, code, lino, _error, terrno); SColumnInfoData* pSrc = taosArrayGet(p->pDataBlock, pmInfo->srcSlotId); - if (pSrc == NULL) { - return terrno; - } + QUERY_CHECK_NULL(pSrc, code, lino, _error, terrno); SColumnInfoData* pDst = taosArrayGet(pDataBlock->pDataBlock, pmInfo->dstSlotId); - if (pDst == NULL) { - return terrno; - } + QUERY_CHECK_NULL(pDst, code, lino, _error, terrno); code = colDataAssign(pDst, pSrc, p->info.rows, &pDataBlock->info); - if (code) { - return code; - } + QUERY_CHECK_CODE(code, lino, _error); } pDataBlock->info.dataLoad = 1; @@ -336,6 +318,12 @@ static int32_t getSortedBlockData(SSortHandle* pHandle, SSDataBlock* pDataBlock, blockDataDestroy(p); *pResBlock = (pDataBlock->info.rows > 0) ? pDataBlock : NULL; return code; + + _error: + qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(code)); + + blockDataDestroy(p); + return code; } int32_t loadNextDataBlock(void* param, SSDataBlock** ppBlock) { @@ -391,13 +379,13 @@ int32_t doOpenSortOperator(SOperatorInfo* pOperator) { code = tsortOpen(pInfo->pSortHandle); if (code != TSDB_CODE_SUCCESS) { - T_LONG_JMP(pTaskInfo->env, code); + pTaskInfo->code = code; + } else { + pOperator->cost.openCost = (taosGetTimestampUs() - pInfo->startTs) / 1000.0; + pOperator->status = OP_RES_TO_RETURN; + OPTR_SET_OPENED(pOperator); } - pOperator->cost.openCost = (taosGetTimestampUs() - pInfo->startTs) / 1000.0; - pOperator->status = OP_RES_TO_RETURN; - - OPTR_SET_OPENED(pOperator); return code; } @@ -742,6 +730,7 @@ int32_t doGroupSort(SOperatorInfo* pOperator, SSDataBlock** pResBlock) { qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(code)); T_LONG_JMP(pOperator->pTaskInfo->env, code); } + code = getGroupSortedBlockData(pInfo->pCurrSortHandle, pInfo->binfo.pRes, pOperator->resultInfo.capacity, pInfo->matchInfo.pList, pInfo, &pBlock); if (pBlock != NULL && (code == 0)) { @@ -841,19 +830,13 @@ int32_t createGroupSortOperatorInfo(SOperatorInfo* downstream, SGroupSortPhysiNo } *pOptrInfo = pOperator; - return code; + return TSDB_CODE_SUCCESS; _error: pTaskInfo->code = code; if (pInfo != NULL) { destroyGroupSortOperatorInfo(pInfo); } - if (pOperator != NULL) { - pOperator->info = NULL; - if (pOperator->pDownstream == NULL && downstream != NULL) { - destroyOperator(downstream); - } - destroyOperator(pOperator); - } + destroyOperatorAndDownstreams(pOperator, &downstream, 1); return code; } diff --git a/source/libs/executor/src/streamcountwindowoperator.c b/source/libs/executor/src/streamcountwindowoperator.c index 54ad12cff0..4f11afd35a 100644 --- a/source/libs/executor/src/streamcountwindowoperator.c +++ b/source/libs/executor/src/streamcountwindowoperator.c @@ -920,20 +920,14 @@ int32_t createStreamCountAggOperatorInfo(SOperatorInfo* downstream, SPhysiNode* } *pOptrInfo = pOperator; - return code; + return TSDB_CODE_SUCCESS; _error: if (pInfo != NULL) { destroyStreamCountAggOperatorInfo(pInfo); } - if (pOperator != NULL) { - pOperator->info = NULL; - if (pOperator->pDownstream == NULL && downstream != NULL) { - destroyOperator(downstream); - } - destroyOperator(pOperator); - } + destroyOperatorAndDownstreams(pOperator, &downstream, 1); pTaskInfo->code = code; qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); return code; diff --git a/source/libs/executor/src/streameventwindowoperator.c b/source/libs/executor/src/streameventwindowoperator.c index a8e14bce68..d7519d90e9 100644 --- a/source/libs/executor/src/streameventwindowoperator.c +++ b/source/libs/executor/src/streameventwindowoperator.c @@ -982,17 +982,11 @@ int32_t createStreamEventAggOperatorInfo(SOperatorInfo* downstream, SPhysiNode* QUERY_CHECK_CODE(code, lino, _error); *pOptrInfo = pOperator; - return code; + return TSDB_CODE_SUCCESS; _error: if (pInfo != NULL) destroyStreamEventOperatorInfo(pInfo); - if (pOperator != NULL) { - pOperator->info = NULL; - if (pOperator->pDownstream == NULL && downstream != NULL) { - destroyOperator(downstream); - } - destroyOperator(pOperator); - } + destroyOperatorAndDownstreams(pOperator, &downstream, 1); pTaskInfo->code = code; qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); return code; diff --git a/source/libs/executor/src/streamfilloperator.c b/source/libs/executor/src/streamfilloperator.c index 3a6d0c709c..9a66f6d688 100644 --- a/source/libs/executor/src/streamfilloperator.c +++ b/source/libs/executor/src/streamfilloperator.c @@ -1451,20 +1451,13 @@ int32_t createStreamFillOperatorInfo(SOperatorInfo* downstream, SStreamFillPhysi QUERY_CHECK_CODE(code, lino, _error); *pOptrInfo = pOperator; - return code; + return TSDB_CODE_SUCCESS; _error: - if (code != TSDB_CODE_SUCCESS) { - qError("%s failed at line %d since %s. task:%s", __func__, lino, tstrerror(code), GET_TASKID(pTaskInfo)); - } + qError("%s failed at line %d since %s. task:%s", __func__, lino, tstrerror(code), GET_TASKID(pTaskInfo)); + if (pInfo != NULL) destroyStreamFillOperatorInfo(pInfo); - if (pOperator != NULL) { - pOperator->info = NULL; - if (pOperator->pDownstream == NULL && downstream != NULL) { - destroyOperator(downstream); - } - destroyOperator(pOperator); - } + destroyOperatorAndDownstreams(pOperator, &downstream, 1); pTaskInfo->code = code; return code; } diff --git a/source/libs/executor/src/streamtimewindowoperator.c b/source/libs/executor/src/streamtimewindowoperator.c index 0651e2dbf6..8d5aa7104f 100644 --- a/source/libs/executor/src/streamtimewindowoperator.c +++ b/source/libs/executor/src/streamtimewindowoperator.c @@ -49,6 +49,8 @@ #define STREAM_SESSION_OP_CHECKPOINT_NAME "StreamSessionOperator_Checkpoint" #define STREAM_STATE_OP_CHECKPOINT_NAME "StreamStateOperator_Checkpoint" +#define MAX_STREAM_HISTORY_RESULT 100000000 + typedef struct SStateWindowInfo { SResultWindowInfo winInfo; SStateKeys* pStateKey; @@ -161,11 +163,19 @@ static int32_t savePullWindow(SPullWindowInfo* pPullInfo, SArray* pPullWins) { } int32_t saveResult(SResultWindowInfo winInfo, SSHashObj* pStUpdated) { + if (tSimpleHashGetSize(pStUpdated) > MAX_STREAM_HISTORY_RESULT) { + qError("%s failed at line %d since too many history result. ", __func__, __LINE__); + return TSDB_CODE_STREAM_INTERNAL_ERROR; + } winInfo.sessionWin.win.ekey = winInfo.sessionWin.win.skey; return tSimpleHashPut(pStUpdated, &winInfo.sessionWin, sizeof(SSessionKey), &winInfo, sizeof(SResultWindowInfo)); } static int32_t saveWinResult(SWinKey* pKey, SRowBuffPos* pPos, SSHashObj* pUpdatedMap) { + if (tSimpleHashGetSize(pUpdatedMap) > MAX_STREAM_HISTORY_RESULT) { + qError("%s failed at line %d since too many history result. ", __func__, __LINE__); + return TSDB_CODE_STREAM_INTERNAL_ERROR; + } return tSimpleHashPut(pUpdatedMap, pKey, sizeof(SWinKey), &pPos, POINTER_BYTES); } @@ -481,6 +491,12 @@ void destroyStreamFinalIntervalOperatorInfo(void* param) { blockDataDestroy(pInfo->pDelRes); blockDataDestroy(pInfo->pMidRetriveRes); blockDataDestroy(pInfo->pMidPulloverRes); + if (pInfo->pUpdatedMap != NULL) { + tSimpleHashSetFreeFp(pInfo->pUpdatedMap, destroyFlusedppPos); + tSimpleHashCleanup(pInfo->pUpdatedMap); + pInfo->pUpdatedMap = NULL; + } + if (pInfo->stateStore.streamFileStateDestroy != NULL) { pInfo->stateStore.streamFileStateDestroy(pInfo->pState->pFileState); } @@ -495,11 +511,6 @@ void destroyStreamFinalIntervalOperatorInfo(void* param) { nodesDestroyNode((SNode*)pInfo->pPhyNode); colDataDestroy(&pInfo->twAggSup.timeWindowData); cleanupExprSupp(&pInfo->scalarSupp); - if (pInfo->pUpdatedMap != NULL) { - tSimpleHashSetFreeFp(pInfo->pUpdatedMap, destroyFlusedppPos); - tSimpleHashCleanup(pInfo->pUpdatedMap); - pInfo->pUpdatedMap = NULL; - } tSimpleHashCleanup(pInfo->pDeletedMap); blockDataDestroy(pInfo->pCheckpointRes); @@ -994,7 +1005,7 @@ static int32_t getNextQualifiedFinalWindow(SInterval* pInterval, STimeWindow* pN bool hasSrcPrimaryKeyCol(SSteamOpBasicInfo* pInfo) { return pInfo->primaryPkIndex != -1; } -static void doStreamIntervalAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDataBlock, uint64_t groupId, +static int32_t doStreamIntervalAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDataBlock, uint64_t groupId, SSHashObj* pUpdatedMap, SSHashObj* pDeletedMap) { int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; @@ -1166,6 +1177,7 @@ _end: if (code != TSDB_CODE_SUCCESS) { qError("%s failed at line %d since %s. task:%s", __func__, lino, tstrerror(code), GET_TASKID(pTaskInfo)); } + return code; } static inline int winPosCmprImpl(const void* pKey1, const void* pKey2) { @@ -1718,7 +1730,12 @@ static int32_t doStreamFinalIntervalAggNext(SOperatorInfo* pOperator, SSDataBloc code = setInputDataBlock(pSup, pBlock, TSDB_ORDER_ASC, MAIN_SCAN, true); QUERY_CHECK_CODE(code, lino, _end); - doStreamIntervalAggImpl(pOperator, pBlock, pBlock->info.id.groupId, pInfo->pUpdatedMap, pInfo->pDeletedMap); + code = doStreamIntervalAggImpl(pOperator, pBlock, pBlock->info.id.groupId, pInfo->pUpdatedMap, pInfo->pDeletedMap); + if (code == TSDB_CODE_STREAM_INTERNAL_ERROR) { + code = TSDB_CODE_SUCCESS; + pOperator->status = OP_RES_TO_RETURN; + break; + } pInfo->twAggSup.maxTs = TMAX(pInfo->twAggSup.maxTs, pBlock->info.window.ekey); pInfo->twAggSup.maxTs = TMAX(pInfo->twAggSup.maxTs, pBlock->info.watermark); pInfo->twAggSup.minTs = TMIN(pInfo->twAggSup.minTs, pBlock->info.window.skey); @@ -2024,17 +2041,11 @@ int32_t createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, SPhysiN } *pOptrInfo = pOperator; - return code; + return TSDB_CODE_SUCCESS; _error: if (pInfo != NULL) destroyStreamFinalIntervalOperatorInfo(pInfo); - if (pOperator != NULL) { - pOperator->info = NULL; - if (pOperator->pDownstream == NULL && downstream != NULL) { - destroyOperator(downstream); - } - destroyOperator(pOperator); - } + destroyOperatorAndDownstreams(pOperator, &downstream, 1); pTaskInfo->code = code; return code; } @@ -3858,20 +3869,13 @@ int32_t createStreamSessionAggOperatorInfo(SOperatorInfo* downstream, SPhysiNode } *pOptrInfo = pOperator; - return code; + return TSDB_CODE_SUCCESS; _error: if (pInfo != NULL) { destroyStreamSessionAggOperatorInfo(pInfo); } - - if (pOperator != NULL) { - pOperator->info = NULL; - if (pOperator->pDownstream == NULL && downstream != NULL) { - destroyOperator(downstream); - } - destroyOperator(pOperator); - } + destroyOperatorAndDownstreams(pOperator, &downstream, 1); pTaskInfo->code = code; qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); return code; @@ -4074,6 +4078,7 @@ int32_t createStreamFinalSessionAggOperatorInfo(SOperatorInfo* downstream, SPhys SOperatorInfo* pOperator = NULL; code = createStreamSessionAggOperatorInfo(downstream, pPhyNode, pTaskInfo, pHandle, &pOperator); if (pOperator == NULL || code != 0) { + downstream = NULL; QUERY_CHECK_CODE(code, lino, _error); } @@ -4135,9 +4140,6 @@ _error: } if (pOperator != NULL) { pOperator->info = NULL; - if (pOperator->pDownstream == NULL && downstream != NULL) { - destroyOperator(downstream); - } destroyOperator(pOperator); } pTaskInfo->code = code; @@ -5035,17 +5037,11 @@ int32_t createStreamStateAggOperatorInfo(SOperatorInfo* downstream, SPhysiNode* QUERY_CHECK_CODE(code, lino, _error); *pOptrInfo = pOperator; - return code; + return TSDB_CODE_SUCCESS; _error: if (pInfo != NULL) destroyStreamStateOperatorInfo(pInfo); - if (pOperator != NULL) { - pOperator->info = NULL; - if (pOperator->pDownstream == NULL && downstream != NULL) { - destroyOperator(downstream); - } - destroyOperator(pOperator); - } + destroyOperatorAndDownstreams(pOperator, &downstream, 1); pTaskInfo->code = code; qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); return code; @@ -5184,7 +5180,12 @@ static int32_t doStreamIntervalAggNext(SOperatorInfo* pOperator, SSDataBlock** p } #endif - doStreamIntervalAggImpl(pOperator, pBlock, pBlock->info.id.groupId, pInfo->pUpdatedMap, pInfo->pDeletedMap); + code = doStreamIntervalAggImpl(pOperator, pBlock, pBlock->info.id.groupId, pInfo->pUpdatedMap, pInfo->pDeletedMap); + if (code == TSDB_CODE_STREAM_INTERNAL_ERROR) { + pOperator->status = OP_RES_TO_RETURN; + code = TSDB_CODE_SUCCESS; + break; + } pInfo->twAggSup.maxTs = TMAX(pInfo->twAggSup.maxTs, pBlock->info.window.ekey); pInfo->twAggSup.minTs = TMIN(pInfo->twAggSup.minTs, pBlock->info.window.skey); } @@ -5376,17 +5377,11 @@ int32_t createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SPhysiNode* QUERY_CHECK_CODE(code, lino, _error); *pOptrInfo = pOperator; - return code; + return TSDB_CODE_SUCCESS; _error: if (pInfo != NULL) destroyStreamFinalIntervalOperatorInfo(pInfo); - if (pOperator != NULL) { - pOperator->info = NULL; - if (pOperator->pDownstream == NULL && downstream != NULL) { - destroyOperator(downstream); - } - destroyOperator(pOperator); - } + destroyOperatorAndDownstreams(pOperator, &downstream, 1); pTaskInfo->code = code; return code; } diff --git a/source/libs/executor/src/sysscanoperator.c b/source/libs/executor/src/sysscanoperator.c index 5838e833f1..439782253f 100644 --- a/source/libs/executor/src/sysscanoperator.c +++ b/source/libs/executor/src/sysscanoperator.c @@ -1012,7 +1012,7 @@ static int32_t sysTableGetGeomText(char* iGeom, int32_t nGeom, char** output, in if (TSDB_CODE_SUCCESS != (code = initCtxAsText()) || TSDB_CODE_SUCCESS != (code = doAsText(iGeom, nGeom, &outputWKT))) { - qError("geo text for systable failed:%s", getThreadLocalGeosCtx()->errMsg); + qError("geo text for systable failed:%s", getGeosErrMsg(code)); *output = NULL; *nOutput = 0; return code; diff --git a/source/libs/executor/src/timesliceoperator.c b/source/libs/executor/src/timesliceoperator.c index 1b8e6709d1..d57a8c7c5b 100644 --- a/source/libs/executor/src/timesliceoperator.c +++ b/source/libs/executor/src/timesliceoperator.c @@ -1192,22 +1192,17 @@ int32_t createTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pPhyN // int32_t code = initKeeperInfo(pSliceInfo, pBlock, &pOperator->exprSupp); code = appendDownstream(pOperator, &downstream, 1); + QUERY_CHECK_CODE(code, lino, _error); *pOptrInfo = pOperator; - return code; + return TSDB_CODE_SUCCESS; _error: if (code != TSDB_CODE_SUCCESS) { qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); } if (pInfo != NULL) destroyTimeSliceOperatorInfo(pInfo); - if (pOperator != NULL) { - pOperator->info = NULL; - if (pOperator->pDownstream == NULL && downstream != NULL) { - destroyOperator(downstream); - } - destroyOperator(pOperator); - } + destroyOperatorAndDownstreams(pOperator, &downstream, 1); pTaskInfo->code = code; return code; } diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index 024e0393f0..5499fa3026 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -1428,19 +1428,13 @@ int32_t createIntervalOperatorInfo(SOperatorInfo* downstream, SIntervalPhysiNode } *pOptrInfo = pOperator; - return code; + return TSDB_CODE_SUCCESS; _error: if (pInfo != NULL) { destroyIntervalOperatorInfo(pInfo); } - if (pOperator != NULL) { - pOperator->info = NULL; - if (pOperator->pDownstream == NULL && downstream != NULL) { - destroyOperator(downstream); - } - destroyOperator(pOperator); - } + destroyOperatorAndDownstreams(pOperator, &downstream, 1); pTaskInfo->code = code; return code; } @@ -1703,20 +1697,14 @@ int32_t createStatewindowOperatorInfo(SOperatorInfo* downstream, SStateWinodwPhy } *pOptrInfo = pOperator; - return code; + return TSDB_CODE_SUCCESS; _error: if (pInfo != NULL) { destroyStateWindowOperatorInfo(pInfo); } - if (pOperator != NULL) { - pOperator->info = NULL; - if (pOperator->pDownstream == NULL && downstream != NULL) { - destroyOperator(downstream); - } - destroyOperator(pOperator); - } + destroyOperatorAndDownstreams(pOperator, &downstream, 1); pTaskInfo->code = code; return code; } @@ -1805,17 +1793,11 @@ int32_t createSessionAggOperatorInfo(SOperatorInfo* downstream, SSessionWinodwPh QUERY_CHECK_CODE(code, lino, _error); *pOptrInfo = pOperator; - return code; + return TSDB_CODE_SUCCESS; _error: if (pInfo != NULL) destroySWindowOperatorInfo(pInfo); - if (pOperator != NULL) { - pOperator->info = NULL; - if (pOperator->pDownstream == NULL && downstream != NULL) { - destroyOperator(downstream); - } - destroyOperator(pOperator); - } + destroyOperatorAndDownstreams(pOperator, &downstream, 1); pTaskInfo->code = code; return code; } @@ -2122,17 +2104,11 @@ int32_t createMergeAlignedIntervalOperatorInfo(SOperatorInfo* downstream, SMerge QUERY_CHECK_CODE(code, lino, _error); *pOptrInfo = pOperator; - return code; + return TSDB_CODE_SUCCESS; _error: if (miaInfo != NULL) destroyMAIOperatorInfo(miaInfo); - if (pOperator != NULL) { - pOperator->info = NULL; - if (pOperator->pDownstream == NULL && downstream != NULL) { - destroyOperator(downstream); - } - destroyOperator(pOperator); - } + destroyOperatorAndDownstreams(pOperator, &downstream, 1); pTaskInfo->code = code; return code; } @@ -2462,19 +2438,12 @@ int32_t createMergeIntervalOperatorInfo(SOperatorInfo* downstream, SMergeInterva } *pOptrInfo = pOperator; - return code; + return TSDB_CODE_SUCCESS; _error: if (pMergeIntervalInfo != NULL) { destroyMergeIntervalOperatorInfo(pMergeIntervalInfo); } - - if (pOperator != NULL) { - pOperator->info = NULL; - if (pOperator->pDownstream == NULL && downstream != NULL) { - destroyOperator(downstream); - } - destroyOperator(pOperator); - } + destroyOperatorAndDownstreams(pOperator, &downstream, 1); pTaskInfo->code = code; return code; } diff --git a/source/libs/executor/src/tlinearhash.c b/source/libs/executor/src/tlinearhash.c index 55628c18f9..83716d72ad 100644 --- a/source/libs/executor/src/tlinearhash.c +++ b/source/libs/executor/src/tlinearhash.c @@ -183,7 +183,7 @@ static void doTrimBucketPages(SLHashObj* pHashObj, SLHashBucket* pBucket) { setBufPageDirty(pFirst, true); setBufPageDirty(pLast, true); - // ASSERT(pLast->num >= nodeSize + sizeof(SFilePage)); + // A S S E R T(pLast->num >= nodeSize + sizeof(SFilePage)); pFirst->num += nodeSize; pLast->num -= nodeSize; diff --git a/source/libs/executor/src/tsort.c b/source/libs/executor/src/tsort.c index 621d643361..5a6428a30e 100644 --- a/source/libs/executor/src/tsort.c +++ b/source/libs/executor/src/tsort.c @@ -286,23 +286,19 @@ int32_t tsortCreateSortHandle(SArray* pSortInfo, int32_t type, int32_t pageSize, SSDataBlock* pBlock, const char* idstr, uint64_t pqMaxRows, uint32_t pqMaxTupleLength, uint32_t pqSortBufSize, SSortHandle** pHandle) { int32_t code = 0; - *pHandle = NULL; + int32_t lino = 0; + QRY_OPTR_CHECK(pHandle); SSortHandle* pSortHandle = taosMemoryCalloc(1, sizeof(SSortHandle)); - if (pSortHandle == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; - } + QUERY_CHECK_NULL(pSortHandle, code, lino, _err, terrno); pSortHandle->type = type; pSortHandle->pageSize = pageSize; pSortHandle->numOfPages = numOfPages; pSortHandle->pSortInfo = taosArrayDup(pSortInfo, NULL); - if (pSortHandle->pSortInfo == NULL) { - return terrno; - } + QUERY_CHECK_NULL(pSortHandle->pSortInfo, code, lino, _err, terrno); pSortHandle->loops = 0; - pSortHandle->pqMaxTupleLength = pqMaxTupleLength; if (pqMaxRows != 0) { pSortHandle->pqSortBufSize = pqSortBufSize; @@ -312,18 +308,13 @@ int32_t tsortCreateSortHandle(SArray* pSortInfo, int32_t type, int32_t pageSize, pSortHandle->forceUsePQSort = false; if (pBlock != NULL) { code = createOneDataBlock(pBlock, false, &pSortHandle->pDataBlock); - if (code) { - goto _err; - } + QUERY_CHECK_CODE(code, lino, _err); } pSortHandle->mergeLimit = -1; pSortHandle->pOrderedSource = taosArrayInit(4, POINTER_BYTES); - if (pSortHandle->pOrderedSource == NULL) { - code = terrno; - goto _err; - } + QUERY_CHECK_NULL(pSortHandle->pOrderedSource, code, lino, _err, terrno); pSortHandle->cmpParam.orderInfo = pSortInfo; pSortHandle->cmpParam.cmpGroupId = false; @@ -346,17 +337,17 @@ int32_t tsortCreateSortHandle(SArray* pSortInfo, int32_t type, int32_t pageSize, if (idstr != NULL) { pSortHandle->idStr = taosStrdup(idstr); - if (pSortHandle->idStr == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - goto _err; - } + QUERY_CHECK_NULL(pSortHandle->idStr, code, lino, _err, terrno); } *pHandle = pSortHandle; return code; _err: - tsortDestroySortHandle(pSortHandle); + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + if (pSortHandle) { + tsortDestroySortHandle(pSortHandle); + } return code; } @@ -970,6 +961,10 @@ static int32_t doInternalMergeSort(SSortHandle* pHandle) { int32_t numOfRows = blockDataGetCapacityInRow(pHandle->pDataBlock, pHandle->pageSize, blockDataGetSerialMetaSize(taosArrayGetSize(pHandle->pDataBlock->pDataBlock))); + if (numOfRows < 0) { + return terrno; + } + int32_t code = blockDataEnsureCapacity(pHandle->pDataBlock, numOfRows); if (code) { return code; @@ -1999,6 +1994,9 @@ static int32_t sortBlocksToExtSource(SSortHandle* pHandle, SArray* aBlk, SArray* int32_t code = TSDB_CODE_SUCCESS; int32_t pageHeaderSize = sizeof(int32_t) + sizeof(int32_t) * blockDataGetNumOfCols(pHandle->pDataBlock); int32_t rowCap = blockDataGetCapacityInRow(pHandle->pDataBlock, pHandle->pageSize, pageHeaderSize); + if (rowCap < 0) { + return terrno; + } code = blockDataEnsureCapacity(pHandle->pDataBlock, rowCap); if (code) { diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index a93ae8e574..4bc86eb0c6 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -234,7 +234,7 @@ static int32_t addTimezoneParam(SNodeList* pList) { pVal->datum.p = taosMemoryCalloc(1, len + VARSTR_HEADER_SIZE + 1); if (pVal->datum.p == NULL) { nodesDestroyNode((SNode*)pVal); - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } varDataSetLen(pVal->datum.p, len); (void)strncpy(varDataVal(pVal->datum.p), pVal->literal, len); @@ -1266,7 +1266,7 @@ static int32_t validateHistogramBinDesc(char* binDescStr, int8_t binType, char* if (intervals == NULL) { (void)snprintf(errMsg, msgLen, "%s", msg9); cJSON_Delete(binDesc); - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } cJSON* bin = binDesc->child; if (bin == NULL) { @@ -2426,8 +2426,12 @@ static int32_t translateToIso8601(SFunctionNode* pFunc, char* pErrBuf, int32_t l // param1 if (numOfParams == 2) { - SValueNode* pValue = (SValueNode*)nodesListGetNode(pFunc->pParameterList, 1); - + SNode* pNode = (SNode*)nodesListGetNode(pFunc->pParameterList, 1); + if (QUERY_NODE_VALUE != nodeType(pNode)) { + return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, "Not supported timzone format"); + } + + SValueNode* pValue = (SValueNode*)pNode; if (!validateTimezoneFormat(pValue)) { return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, "Invalid timzone format"); } diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index 08abf41973..fa8cf243c4 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -1685,7 +1685,7 @@ int32_t stdPartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { char* res = taosMemoryCalloc(resultBytes + VARSTR_HEADER_SIZE, sizeof(char)); if (NULL == res) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } (void)memcpy(varDataVal(res), pInfo, resultBytes); varDataSetLen(res, resultBytes); @@ -2447,7 +2447,7 @@ int32_t apercentilePartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { int32_t resultBytes = getApercentileMaxSize(); char* res = taosMemoryCalloc(resultBytes + VARSTR_HEADER_SIZE, sizeof(char)); if (NULL == res) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } if (pInfo->algo == APERCT_ALGO_TDIGEST) { @@ -3107,7 +3107,7 @@ int32_t firstLastPartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { // todo check for failure char* res = taosMemoryCalloc(resultBytes + VARSTR_HEADER_SIZE, sizeof(char)); if (NULL == res) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } (void)memcpy(varDataVal(res), pRes, resultBytes); @@ -4358,7 +4358,7 @@ int32_t spreadPartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { char* res = taosMemoryCalloc(resultBytes + VARSTR_HEADER_SIZE, sizeof(char)); if (NULL == res) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } (void)memcpy(varDataVal(res), pInfo, resultBytes); varDataSetLen(res, resultBytes); @@ -4548,7 +4548,7 @@ int32_t elapsedPartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { char* res = taosMemoryCalloc(resultBytes + VARSTR_HEADER_SIZE, sizeof(char)); if (NULL == res) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } (void)memcpy(varDataVal(res), pInfo, resultBytes); varDataSetLen(res, resultBytes); @@ -4654,7 +4654,7 @@ static int32_t getHistogramBinDesc(SHistoFuncInfo* pInfo, char* binDescStr, int8 if (NULL == intervals) { cJSON_Delete(binDesc); qError("histogram function out of memory"); - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } if (cJSON_IsNumber(width) && factor == NULL && binType == LINEAR_BIN) { // linear bin process @@ -4720,7 +4720,7 @@ static int32_t getHistogramBinDesc(SHistoFuncInfo* pInfo, char* binDescStr, int8 if (NULL == intervals) { cJSON_Delete(binDesc); qError("histogram function out of memory"); - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } cJSON* bin = binDesc->child; if (bin == NULL) { @@ -4925,7 +4925,7 @@ int32_t histogramPartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { char* res = taosMemoryCalloc(resultBytes + VARSTR_HEADER_SIZE, sizeof(char)); if (NULL == res) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } (void)memcpy(varDataVal(res), pInfo, resultBytes); varDataSetLen(res, resultBytes); @@ -5158,7 +5158,7 @@ int32_t hllPartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { char* res = taosMemoryCalloc(resultBytes + VARSTR_HEADER_SIZE, sizeof(char)); if (NULL == res) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } (void)memcpy(varDataVal(res), pInfo, resultBytes); varDataSetLen(res, resultBytes); @@ -6007,6 +6007,7 @@ int32_t modeFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResInfo) { pInfo->buf = taosMemoryMalloc(pInfo->colBytes); if (NULL == pInfo->buf) { + taosHashCleanup(pInfo->pHash); return TSDB_CODE_OUT_OF_MEMORY; } @@ -6114,6 +6115,7 @@ int32_t modeFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, slotId); int32_t currentRow = pBlock->info.rows; if (NULL == pCol) { + modeFunctionCleanup(pInfo); return TSDB_CODE_OUT_OF_RANGE; } @@ -6145,6 +6147,7 @@ int32_t modeFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { code = colDataSetVal(pCol, currentRow, pData, false); if (TSDB_CODE_SUCCESS != code) { + modeFunctionCleanup(pInfo); return code; } code = setSelectivityValue(pCtx, pBlock, &resTuplePos, currentRow); @@ -6990,7 +6993,7 @@ int32_t iratePartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { char* res = taosMemoryCalloc(resultBytes + VARSTR_HEADER_SIZE, sizeof(char)); if (NULL == res) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } (void)memcpy(varDataVal(res), pInfo, resultBytes); varDataSetLen(res, resultBytes); diff --git a/source/libs/function/src/detail/tavgfunction.c b/source/libs/function/src/detail/tavgfunction.c index df9edb9948..854260c354 100644 --- a/source/libs/function/src/detail/tavgfunction.c +++ b/source/libs/function/src/detail/tavgfunction.c @@ -854,7 +854,7 @@ int32_t avgPartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { char* res = taosMemoryCalloc(resultBytes + VARSTR_HEADER_SIZE, sizeof(char)); int32_t code = TSDB_CODE_SUCCESS; if (NULL == res) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } (void)memcpy(varDataVal(res), pInfo, resultBytes); varDataSetLen(res, resultBytes); diff --git a/source/libs/function/src/thistogram.c b/source/libs/function/src/thistogram.c index 8594b0584c..6dfad36542 100644 --- a/source/libs/function/src/thistogram.c +++ b/source/libs/function/src/thistogram.c @@ -594,7 +594,7 @@ int32_t tHistogramMerge(SHistogramInfo* pHisto1, SHistogramInfo* pHisto2, int32_ SHistBin* pHistoBins = taosMemoryCalloc(1, sizeof(SHistBin) * (pHisto1->numOfEntries + pHisto2->numOfEntries)); if (NULL == pHistoBins) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } int32_t i = 0, j = 0, k = 0; diff --git a/source/libs/function/src/tpercentile.c b/source/libs/function/src/tpercentile.c index ae0459427e..cc618f3f65 100644 --- a/source/libs/function/src/tpercentile.c +++ b/source/libs/function/src/tpercentile.c @@ -33,7 +33,7 @@ static int32_t loadDataFromFilePage(tMemBucket *pMemBucket, int32_t slotIdx, SFi *buffer = (SFilePage *)taosMemoryCalloc(1, pMemBucket->bytes * pMemBucket->pSlots[slotIdx].info.size + sizeof(SFilePage)); if (NULL == *buffer) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } int32_t groupId = getGroupId(pMemBucket->numOfSlots, slotIdx, pMemBucket->times); @@ -271,7 +271,7 @@ int32_t tMemBucketCreate(int32_t nElemSize, int16_t dataType, double minval, dou tMemBucket **pBucket) { *pBucket = (tMemBucket *)taosMemoryCalloc(1, sizeof(tMemBucket)); if (*pBucket == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } if (hasWindowOrGroup) { @@ -313,7 +313,7 @@ int32_t tMemBucketCreate(int32_t nElemSize, int16_t dataType, double minval, dou (*pBucket)->pSlots = (tMemBucketSlot *)taosMemoryCalloc((*pBucket)->numOfSlots, sizeof(tMemBucketSlot)); if ((*pBucket)->pSlots == NULL) { tMemBucketDestroy(*pBucket); - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } resetSlotInfo((*pBucket)); diff --git a/source/libs/function/src/tudf.c b/source/libs/function/src/tudf.c index 44b6ba4722..d0b3b191ad 100644 --- a/source/libs/function/src/tudf.c +++ b/source/libs/function/src/tudf.c @@ -1071,8 +1071,8 @@ int32_t acquireUdfFuncHandle(char *udfName, UdfcFuncHandle *pHandle) { if (stubIndex != -1) { SUdfcFuncStub *foundStub = taosArrayGet(gUdfcProxy.udfStubs, stubIndex); UdfcFuncHandle handle = foundStub->handle; - int64_t currUs = taosGetTimestampUs(); - bool expired = (currUs - foundStub->createTime) >= 10 * 1000 * 1000; + int64_t currUs = taosGetTimestampUs(); + bool expired = (currUs - foundStub->createTime) >= 10 * 1000 * 1000; if (!expired) { if (handle != NULL && ((SUdfcUvSession *)handle)->udfUvPipe != NULL) { *pHandle = foundStub->handle; @@ -1086,14 +1086,15 @@ int32_t acquireUdfFuncHandle(char *udfName, UdfcFuncHandle *pHandle) { } } else { fnInfo("udf handle expired for %s, will setup udf. move it to expired list", udfName); - taosArrayRemove(gUdfcProxy.udfStubs, stubIndex); - if(taosArrayPush(gUdfcProxy.expiredUdfStubs, foundStub) == NULL) { + if (taosArrayPush(gUdfcProxy.expiredUdfStubs, foundStub) == NULL) { fnError("acquireUdfFuncHandle: failed to push udf stub to array"); - goto _exit; + } else { + taosArrayRemove(gUdfcProxy.udfStubs, stubIndex); + taosArraySort(gUdfcProxy.expiredUdfStubs, compareUdfcFuncSub); } - taosArraySort(gUdfcProxy.expiredUdfStubs, compareUdfcFuncSub); } } + uv_mutex_unlock(&gUdfcProxy.udfStubsMutex); *pHandle = NULL; code = doSetupUdf(udfName, pHandle); if (code == TSDB_CODE_SUCCESS) { @@ -1102,17 +1103,20 @@ int32_t acquireUdfFuncHandle(char *udfName, UdfcFuncHandle *pHandle) { stub.handle = *pHandle; ++stub.refCount; stub.createTime = taosGetTimestampUs(); - if(taosArrayPush(gUdfcProxy.udfStubs, &stub) == NULL) { + uv_mutex_lock(&gUdfcProxy.udfStubsMutex); + if (taosArrayPush(gUdfcProxy.udfStubs, &stub) == NULL) { fnError("acquireUdfFuncHandle: failed to push udf stub to array"); + uv_mutex_unlock(&gUdfcProxy.udfStubsMutex); goto _exit; + } else { + taosArraySort(gUdfcProxy.udfStubs, compareUdfcFuncSub); } - taosArraySort(gUdfcProxy.udfStubs, compareUdfcFuncSub); + uv_mutex_unlock(&gUdfcProxy.udfStubsMutex); } else { *pHandle = NULL; } _exit: - uv_mutex_unlock(&gUdfcProxy.udfStubsMutex); return code; } diff --git a/source/libs/function/src/udfd.c b/source/libs/function/src/udfd.c index 2d8a926c72..adcce879eb 100644 --- a/source/libs/function/src/udfd.c +++ b/source/libs/function/src/udfd.c @@ -474,7 +474,7 @@ void udfdDeinitPythonPlugin(SUdfScriptPlugin *plugin) { int32_t udfdInitScriptPlugin(int8_t scriptType) { SUdfScriptPlugin *plugin = taosMemoryCalloc(1, sizeof(SUdfScriptPlugin)); if (plugin == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } int32_t err = 0; switch (scriptType) { diff --git a/source/libs/geometry/src/geosWrapper.c b/source/libs/geometry/src/geosWrapper.c index b349ab5cbe..5eeea54715 100644 --- a/source/libs/geometry/src/geosWrapper.c +++ b/source/libs/geometry/src/geosWrapper.c @@ -14,7 +14,7 @@ */ #include "geosWrapper.h" -#include "tdef.h" +#include "tutil.h" #include "types.h" typedef char (*_geosRelationFunc_t)(GEOSContextHandle_t handle, const GEOSGeometry *g1, const GEOSGeometry *g2); @@ -23,7 +23,8 @@ typedef char (*_geosPreparedRelationFunc_t)(GEOSContextHandle_t handle, const GE void geosFreeBuffer(void *buffer) { if (buffer) { - GEOSFree_r(getThreadLocalGeosCtx()->handle, buffer); + SGeosContext *pCtx = acquireThreadLocalGeosCtx(); + if (pCtx) GEOSFree_r(pCtx->handle, buffer); } } @@ -34,7 +35,9 @@ void geosErrMsgeHandler(const char *errMsg, void *userData) { int32_t initCtxMakePoint() { int32_t code = TSDB_CODE_FAILED; - SGeosContext *geosCtx = getThreadLocalGeosCtx(); + SGeosContext *geosCtx = NULL; + + TAOS_CHECK_RETURN(getThreadLocalGeosCtx(&geosCtx)); if (geosCtx->handle == NULL) { geosCtx->handle = GEOS_init_r(); @@ -59,7 +62,9 @@ int32_t initCtxMakePoint() { // need to call geosFreeBuffer(*outputGeom) later int32_t doMakePoint(double x, double y, unsigned char **outputGeom, size_t *size) { int32_t code = TSDB_CODE_FAILED; - SGeosContext *geosCtx = getThreadLocalGeosCtx(); + SGeosContext *geosCtx = NULL; + + TAOS_CHECK_RETURN(getThreadLocalGeosCtx(&geosCtx)); GEOSGeometry *geom = NULL; unsigned char *wkb = NULL; @@ -164,7 +169,9 @@ static int32_t initWktRegex(pcre2_code **ppRegex, pcre2_match_data **ppMatchData int32_t initCtxGeomFromText() { int32_t code = TSDB_CODE_FAILED; - SGeosContext *geosCtx = getThreadLocalGeosCtx(); + SGeosContext *geosCtx = NULL; + + TAOS_CHECK_RETURN(getThreadLocalGeosCtx(&geosCtx)); if (geosCtx->handle == NULL) { geosCtx->handle = GEOS_init_r(); @@ -200,7 +207,9 @@ int32_t initCtxGeomFromText() { // need to call geosFreeBuffer(*outputGeom) later int32_t doGeomFromText(const char *inputWKT, unsigned char **outputGeom, size_t *size) { int32_t code = TSDB_CODE_FAILED; - SGeosContext *geosCtx = getThreadLocalGeosCtx(); + SGeosContext *geosCtx = NULL; + + TAOS_CHECK_RETURN(getThreadLocalGeosCtx(&geosCtx)); GEOSGeometry *geom = NULL; unsigned char *wkb = NULL; @@ -235,7 +244,9 @@ _exit: int32_t initCtxAsText() { int32_t code = TSDB_CODE_FAILED; - SGeosContext *geosCtx = getThreadLocalGeosCtx(); + SGeosContext *geosCtx = NULL; + + TAOS_CHECK_RETURN(getThreadLocalGeosCtx(&geosCtx)); if (geosCtx->handle == NULL) { geosCtx->handle = GEOS_init_r(); @@ -271,7 +282,9 @@ int32_t initCtxAsText() { // need to call geosFreeBuffer(*outputWKT) later int32_t doAsText(const unsigned char *inputGeom, size_t size, char **outputWKT) { int32_t code = TSDB_CODE_FAILED; - SGeosContext *geosCtx = getThreadLocalGeosCtx(); + SGeosContext *geosCtx = NULL; + + TAOS_CHECK_RETURN(getThreadLocalGeosCtx(&geosCtx)); GEOSGeometry *geom = NULL; char *wkt = NULL; @@ -302,7 +315,9 @@ _exit: int32_t initCtxRelationFunc() { int32_t code = TSDB_CODE_FAILED; - SGeosContext *geosCtx = getThreadLocalGeosCtx(); + SGeosContext *geosCtx = NULL; + + TAOS_CHECK_RETURN(getThreadLocalGeosCtx(&geosCtx)); if (geosCtx->handle == NULL) { geosCtx->handle = GEOS_init_r(); @@ -327,7 +342,9 @@ int32_t doGeosRelation(const GEOSGeometry *geom1, const GEOSPreparedGeometry *pr bool swapped, char *res, _geosRelationFunc_t relationFn, _geosRelationFunc_t swappedRelationFn, _geosPreparedRelationFunc_t preparedRelationFn, _geosPreparedRelationFunc_t swappedPreparedRelationFn) { - SGeosContext *geosCtx = getThreadLocalGeosCtx(); + SGeosContext *geosCtx = NULL; + + TAOS_CHECK_RETURN(getThreadLocalGeosCtx(&geosCtx)); if (!preparedGeom1) { if (!swapped) { @@ -397,11 +414,10 @@ int32_t doContainsProperly(const GEOSGeometry *geom1, const GEOSPreparedGeometry // need to call destroyGeometry(outputGeom, outputPreparedGeom) later int32_t readGeometry(const unsigned char *input, GEOSGeometry **outputGeom, const GEOSPreparedGeometry **outputPreparedGeom) { - SGeosContext *geosCtx = getThreadLocalGeosCtx(); - if (!outputGeom) { return TSDB_CODE_FUNC_FUNTION_PARA_VALUE; } + *outputGeom = NULL; if (outputPreparedGeom) { // it means not to generate PreparedGeometry if outputPreparedGeom is NULL @@ -412,6 +428,8 @@ int32_t readGeometry(const unsigned char *input, GEOSGeometry **outputGeom, return TSDB_CODE_SUCCESS; } + SGeosContext *geosCtx = NULL; + TAOS_CHECK_RETURN(getThreadLocalGeosCtx(&geosCtx)); *outputGeom = GEOSWKBReader_read_r(geosCtx->handle, geosCtx->WKBReader, varDataVal(input), varDataLen(input)); if (*outputGeom == NULL) { return TSDB_CODE_FUNC_FUNTION_PARA_VALUE; @@ -428,7 +446,8 @@ int32_t readGeometry(const unsigned char *input, GEOSGeometry **outputGeom, } void destroyGeometry(GEOSGeometry **geom, const GEOSPreparedGeometry **preparedGeom) { - SGeosContext *geosCtx = getThreadLocalGeosCtx(); + SGeosContext *geosCtx = acquireThreadLocalGeosCtx(); + if (!geosCtx) return; if (preparedGeom && *preparedGeom) { GEOSPreparedGeom_destroy_r(geosCtx->handle, *preparedGeom); diff --git a/source/libs/geometry/test/geomIoFuncTest.cpp b/source/libs/geometry/test/geomIoFuncTest.cpp index fcb7a4d12a..2eff1bf0ea 100644 --- a/source/libs/geometry/test/geomIoFuncTest.cpp +++ b/source/libs/geometry/test/geomIoFuncTest.cpp @@ -115,7 +115,7 @@ void callMakePointAndCompareResult(int32_t type1, void *valueArray1, TDRowValT v #define MAKE_POINT_FIRST_COLUMN_VALUES {2, 3, -4} #define MAKE_POINT_SECOND_COLUMN_VALUES {5, -6, -7} -TEST(GeomIoFuncTest, makePointFunctionTwoColumns) { +void geomIoFuncTestMakePointFunctionTwoColumns() { const int32_t rowNum = 3; SScalarParam *pExpectedResult; TDRowValT valTypeArray[rowNum] = {TD_VTYPE_NORM, TD_VTYPE_NORM, TD_VTYPE_NORM}; @@ -151,7 +151,7 @@ TEST(GeomIoFuncTest, makePointFunctionTwoColumns) { destroyScalarParam(pExpectedResult, 1); } -TEST(GeomIoFuncTest, makePointFunctionConstant) { +void geomIoFuncTestMakePointFunctionConstant() { const int32_t rowNum = 3; SScalarParam *pExpectedResult; TDRowValT valTypeArray[rowNum] = {TD_VTYPE_NORM, TD_VTYPE_NORM, TD_VTYPE_NORM}; @@ -188,7 +188,7 @@ TEST(GeomIoFuncTest, makePointFunctionConstant) { destroyScalarParam(pExpectedResult, 1); } -TEST(GeomIoFuncTest, makePointFunctionWithNull) { +void geomIoFuncTestMakePointFunctionWithNull() { const int32_t rowNum = 3; SScalarParam *pExpectedResult; TDRowValT valTypeNormArray[rowNum] = {TD_VTYPE_NORM, TD_VTYPE_NORM, TD_VTYPE_NORM}; @@ -244,7 +244,7 @@ TEST(GeomIoFuncTest, makePointFunctionWithNull) { destroyScalarParam(pExpectedResult, 1); } -TEST(GeomIoFuncTest, geomFromTextFunction) { +void geomIoFuncTestGeomFromTextFunction() { const int32_t rowNum = 4; char strArray[rowNum][TSDB_MAX_BINARY_LEN]; TDRowValT valTypeNormArray[rowNum] = {TD_VTYPE_NORM, TD_VTYPE_NORM, TD_VTYPE_NORM, TD_VTYPE_NORM}; @@ -293,7 +293,7 @@ TEST(GeomIoFuncTest, geomFromTextFunction) { callGeomFromTextWrapper4(strArray, valTypeNormArray, 1, TSDB_CODE_FUNC_FUNTION_PARA_VALUE); } -TEST(GeomIoFuncTest, asTextFunction) { +void geomIoFuncTestAsTextFunction() { // column input has been tested in geomFromTextFunction TDRowValT valTypeArray[1] = {TD_VTYPE_NORM}; @@ -319,3 +319,27 @@ TEST(GeomIoFuncTest, asTextFunction) { STR_TO_VARSTR(strInput, "XXX"); callAsTextWrapper2(TSDB_DATA_TYPE_GEOMETRY, strInput, valTypeArray, 1, TSDB_CODE_FUNC_FUNTION_PARA_VALUE); } + +static void geomIoFuncTestImpl() { + geomIoFuncTestMakePointFunctionTwoColumns(); + geomIoFuncTestMakePointFunctionConstant(); + geomIoFuncTestMakePointFunctionWithNull(); + geomIoFuncTestGeomFromTextFunction(); + geomIoFuncTestAsTextFunction(); +} + +static void *geomIoFuncTestFunc(void *arg) { + geomIoFuncTestImpl(); + return nullptr; +} + +static void geomIoFuncTestInThread() { + TdThread thread; + ASSERT_EQ(taosThreadCreate(&thread, nullptr, geomIoFuncTestFunc, NULL), 0); + ASSERT_EQ(taosThreadJoin(thread, nullptr), 0); +} + +TEST(threadGeomFuncTest, threadFuncTest) { + geomIoFuncTestImpl(); + geomIoFuncTestInThread(); +} \ No newline at end of file diff --git a/source/libs/geometry/test/geomRelationFuncTest.cpp b/source/libs/geometry/test/geomRelationFuncTest.cpp index 1084c94178..4563d443cb 100644 --- a/source/libs/geometry/test/geomRelationFuncTest.cpp +++ b/source/libs/geometry/test/geomRelationFuncTest.cpp @@ -154,7 +154,7 @@ void geomRelationFuncTest(FScalarExecProcess geomRelationFunc, int8_t expectedRe callGeomRelationFuncAndCompareResult(geomRelationFunc, pInput, rowNum, TSDB_CODE_FUNC_FUNTION_PARA_VALUE, 0); } -TEST(GeomRelationFuncTest, intersectsFunction) { +void geomRelationFuncTestIntersectsFunction() { // 1: true, 0: false, -1: null int8_t expectedResults[6][6] = { {1, 0, 1, 1, 1, 1}, // two columns @@ -168,7 +168,7 @@ TEST(GeomRelationFuncTest, intersectsFunction) { geomRelationFuncTest(intersectsFunction, expectedResults); } -TEST(GeomRelationFuncTest, equalsFunction) { +void geomRelationFuncTestEqualsFunction() { // 1: true, 0: false, -1: null int8_t expectedResults[6][6] = { {1, 0, 0, 0, 0, 0}, // two columns @@ -182,7 +182,7 @@ TEST(GeomRelationFuncTest, equalsFunction) { geomRelationFuncTest(equalsFunction, expectedResults); } -TEST(GeomRelationFuncTest, touchesFunction) { +void geomRelationFuncTestTouchesFunction() { // 1: true, 0: false, -1: null int8_t expectedResults[6][6] = { {0, 0, 1, 0, 0, 1}, // two columns @@ -196,7 +196,7 @@ TEST(GeomRelationFuncTest, touchesFunction) { geomRelationFuncTest(touchesFunction, expectedResults); } -TEST(GeomRelationFuncTest, coversFunction) { +void geomRelationFuncTestCoversFunction() { // 1: true, 0: false, -1: null int8_t expectedResults[6][6] = { {1, 0, 0, 0, 0, 0}, // two columns @@ -210,7 +210,7 @@ TEST(GeomRelationFuncTest, coversFunction) { geomRelationFuncTest(coversFunction, expectedResults); } -TEST(GeomRelationFuncTest, containsFunction) { +void geomRelationFuncTestContainsFunction() { // 1: true, 0: false, -1: null int8_t expectedResults[6][6] = { {1, 0, 0, 0, 0, 0}, // two columns @@ -224,7 +224,7 @@ TEST(GeomRelationFuncTest, containsFunction) { geomRelationFuncTest(containsFunction, expectedResults); } -TEST(GeomRelationFuncTest, containsProperlyFunction) { +void geomRelationFuncTestContainsProperlyFunction() { // 1: true, 0: false, -1: null int8_t expectedResults[6][6] = { {1, 0, 0, 0, 0, 0}, // two columns @@ -237,3 +237,28 @@ TEST(GeomRelationFuncTest, containsProperlyFunction) { geomRelationFuncTest(containsProperlyFunction, expectedResults); } + +static void geomRelationFuncTestImpl() { + geomRelationFuncTestIntersectsFunction(); + geomRelationFuncTestEqualsFunction(); + geomRelationFuncTestTouchesFunction(); + geomRelationFuncTestCoversFunction(); + geomRelationFuncTestContainsFunction(); + geomRelationFuncTestContainsProperlyFunction(); +} + +static void *geomRelationFuncTestFunc(void *arg) { + geomRelationFuncTestImpl(); + return nullptr; +} + +static void geomRelationFuncTestInThread() { + TdThread thread; + ASSERT_EQ(taosThreadCreate(&thread, nullptr, geomRelationFuncTestFunc, NULL), 0); + ASSERT_EQ(taosThreadJoin(thread, nullptr), 0); +} + +TEST(threadGeomRelationFuncTest, threadGeomRelationFuncTest) { + geomRelationFuncTestImpl(); + geomRelationFuncTestInThread(); +} \ No newline at end of file diff --git a/source/libs/index/inc/indexFstNode.h b/source/libs/index/inc/indexFstNode.h index 5bdb2acb32..a6f1662cb3 100644 --- a/source/libs/index/inc/indexFstNode.h +++ b/source/libs/index/inc/indexFstNode.h @@ -44,7 +44,7 @@ FstBuilderNode* fstBuilderNodeDefault(); FstBuilderNode* fstBuilderNodeClone(FstBuilderNode* src); -void fstBuilderNodeCloneFrom(FstBuilderNode* dst, FstBuilderNode* src); +int32_t fstBuilderNodeCloneFrom(FstBuilderNode* dst, FstBuilderNode* src); // bool fstBuilderNodeCompileTo(FstBuilderNode *b, IdxFile' *wrt, // CompiledAddr lastAddr, CompiledAddr startAddr); diff --git a/source/libs/index/inc/indexTfile.h b/source/libs/index/inc/indexTfile.h index 115d5b3894..e769ea2393 100644 --- a/source/libs/index/inc/indexTfile.h +++ b/source/libs/index/inc/indexTfile.h @@ -18,7 +18,7 @@ #include "indexFst.h" #include "indexFstFile.h" #include "indexInt.h" -#include "indexTfile.h" +//#include "indexTfile.h" #include "indexUtil.h" #include "tlockfree.h" @@ -129,8 +129,8 @@ void tfileIteratorDestroy(Iterate* iterator); TFileValue* tfileValueCreate(char* val); -int tfileValuePush(TFileValue* tf, uint64_t val); -void tfileValueDestroy(TFileValue* tf); +int32_t tfileValuePush(TFileValue* tf, uint64_t val); +void tfileValueDestroy(TFileValue* tf); #ifdef __cplusplus } diff --git a/source/libs/index/inc/indexUtil.h b/source/libs/index/inc/indexUtil.h index 6b016900c2..9eb8001d17 100644 --- a/source/libs/index/inc/indexUtil.h +++ b/source/libs/index/inc/indexUtil.h @@ -46,17 +46,17 @@ extern "C" { buf += len; \ } while (0) -#define INDEX_MERGE_ADD_DEL(src, dst, tgt) \ - { \ - bool f = false; \ - for (int i = 0; i < taosArrayGetSize(src); i++) { \ - if (*(uint64_t *)taosArrayGet(src, i) == tgt) { \ - f = true; \ - } \ - } \ - if (f == false) { \ - (void)taosArrayPush(dst, &tgt); \ - } \ +#define INDEX_MERGE_ADD_DEL(src, dst, tgt) \ + { \ + bool f = false; \ + for (int i = 0; i < taosArrayGetSize(src); i++) { \ + if (*(uint64_t *)taosArrayGet(src, i) == tgt) { \ + f = true; \ + } \ + } \ + if (f == false) { \ + if (taosArrayPush(dst, &tgt) == NULL) code = TSDB_CODE_OUT_OF_MEMORY; \ + } \ } /* multi sorted result intersection @@ -65,7 +65,7 @@ extern "C" { * [1, 4, 5] * output:[4, 5] */ -void iIntersection(SArray *in, SArray *out); +int32_t iIntersection(SArray *in, SArray *out); /* multi sorted result union * input: [1, 2, 4, 5] @@ -73,7 +73,7 @@ void iIntersection(SArray *in, SArray *out); * [1, 4, 5] * output:[1, 2, 3, 4, 5] */ -void iUnion(SArray *in, SArray *out); +int32_t iUnion(SArray *in, SArray *out); /* see example * total: [1, 2, 4, 5, 7, 8] @@ -81,7 +81,7 @@ void iUnion(SArray *in, SArray *out); * return: [1, 2, 7, 8] saved in total */ -void iExcept(SArray *total, SArray *except); +int32_t iExcept(SArray *total, SArray *except); int uidCompare(const void *a, const void *b); @@ -107,7 +107,7 @@ void idxTRsltClear(SIdxTRslt *tr); void idxTRsltDestroy(SIdxTRslt *tr); -void idxTRsltMergeTo(SIdxTRslt *tr, SArray *out); +int32_t idxTRsltMergeTo(SIdxTRslt *tr, SArray *out); #ifdef __cplusplus } diff --git a/source/libs/index/src/index.c b/source/libs/index/src/index.c index e2c74f0dbb..0d834a68cb 100644 --- a/source/libs/index/src/index.c +++ b/source/libs/index/src/index.c @@ -92,7 +92,7 @@ static int32_t idxMergeFinalResults(SArray* in, EIndexOperatorType oType, SArray static int32_t idxGenTFile(SIndex* index, IndexCache* cache, SArray* batch); // merge cache and tfile by opera type -static void idxMergeCacheAndTFile(SArray* result, IterateValue* icache, IterateValue* iTfv, SIdxTRslt* helper); +static int32_t idxMergeCacheAndTFile(SArray* result, IterateValue* icache, IterateValue* iTfv, SIdxTRslt* helper); // static int32_t indexSerialTermKey(SIndexTerm* itm, char* buf); // int32_t indexSerialKey(ICacheKey* key, char* buf); @@ -212,6 +212,7 @@ void idxReleaseRef(int64_t ref) { int32_t indexPut(SIndex* index, SIndexMultiTerm* fVals, uint64_t uid) { // TODO(yihao): reduce the lock range + int32_t code = 0; (void)taosThreadMutexLock(&index->mtx); for (int i = 0; i < taosArrayGetSize(fVals); i++) { SIndexTerm* p = taosArrayGetP(fVals, i); @@ -223,11 +224,19 @@ int32_t indexPut(SIndex* index, SIndexMultiTerm* fVals, uint64_t uid) { IndexCache** cache = taosHashGet(index->colObj, buf, sz); if (cache == NULL) { IndexCache* pCache = idxCacheCreate(index, p->suid, p->colName, p->colType); - (void)taosHashPut(index->colObj, buf, sz, &pCache, sizeof(void*)); + code = taosHashPut(index->colObj, buf, sz, &pCache, sizeof(void*)); + if (code != 0) { + idxCacheDestroy(pCache); + break; + } } } (void)taosThreadMutexUnlock(&index->mtx); + if (code != 0) { + return code; + } + for (int i = 0; i < taosArrayGetSize(fVals); i++) { SIndexTerm* p = taosArrayGetP(fVals, i); @@ -247,15 +256,27 @@ int32_t indexPut(SIndex* index, SIndexMultiTerm* fVals, uint64_t uid) { return 0; } int32_t indexSearch(SIndex* index, SIndexMultiTermQuery* multiQuerys, SArray* result) { + int32_t code = 0; EIndexOperatorType opera = multiQuerys->opera; // relation of querys SArray* iRslts = taosArrayInit(4, POINTER_BYTES); - int nQuery = taosArrayGetSize(multiQuerys->query); + if (iRslts == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } + + int nQuery = taosArrayGetSize(multiQuerys->query); for (size_t i = 0; i < nQuery; i++) { SIndexTermQuery* qterm = taosArrayGet(multiQuerys->query, i); SArray* trslt = NULL; - (void)idxTermSearch(index, qterm, &trslt); - (void)taosArrayPush(iRslts, (void*)&trslt); + code = idxTermSearch(index, qterm, &trslt); + if (code != 0) { + idxInterRsltDestroy(iRslts); + return code; + } + if (taosArrayPush(iRslts, (void*)&trslt) == NULL) { + idxInterRsltDestroy(iRslts); + return TSDB_CODE_OUT_OF_MEMORY; + } } (void)idxMergeFinalResults(iRslts, opera, result); idxInterRsltDestroy(iRslts); @@ -267,6 +288,9 @@ int indexDelete(SIndex* index, SIndexMultiTermQuery* query) { return 1; } SIndexOpts* indexOptsCreate(int32_t cacheSize) { SIndexOpts* opts = taosMemoryCalloc(1, sizeof(SIndexOpts)); + if (opts == NULL) { + return NULL; + } opts->cacheSize = cacheSize; return opts; } @@ -295,7 +319,7 @@ void indexMultiTermQueryDestroy(SIndexMultiTermQuery* pQuery) { int32_t indexMultiTermQueryAdd(SIndexMultiTermQuery* pQuery, SIndexTerm* term, EIndexQueryType qType) { SIndexTermQuery q = {.qType = qType, .term = term}; if (taosArrayPush(pQuery->query, &q) == NULL) { - return terrno; + return TSDB_CODE_OUT_OF_MEMORY; } return 0; } @@ -362,7 +386,9 @@ void indexTermDestroy(SIndexTerm* p) { SIndexMultiTerm* indexMultiTermCreate() { return taosArrayInit(4, sizeof(SIndexTerm*)); } int32_t indexMultiTermAdd(SIndexMultiTerm* terms, SIndexTerm* term) { - (void)taosArrayPush(terms, &term); + if (taosArrayPush(terms, &term) == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } return 0; } void indexMultiTermDestroy(SIndexMultiTerm* terms) { @@ -422,6 +448,7 @@ bool indexJsonIsRebuild(SIndexJson* idx) { } static int32_t idxTermSearch(SIndex* sIdx, SIndexTermQuery* query, SArray** result) { + int32_t code = 0; SIndexTerm* term = query->term; const char* colName = term->colName; int32_t nColName = term->nColName; @@ -452,6 +479,10 @@ static int32_t idxTermSearch(SIndex* sIdx, SIndexTermQuery* query, SArray** resu int64_t st = taosGetTimestampUs(); SIdxTRslt* tr = idxTRsltCreate(); + if (tr == NULL) { + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, END); + } + if (0 == idxCacheSearch(cache, query, tr, &s)) { if (s == kTypeDeletion) { indexInfo("col: %s already drop by", term->colName); @@ -473,13 +504,14 @@ static int32_t idxTermSearch(SIndex* sIdx, SIndexTermQuery* query, SArray** resu int64_t cost = taosGetTimestampUs() - st; indexInfo("search cost: %" PRIu64 "us", cost); - idxTRsltMergeTo(tr, *result); + code = idxTRsltMergeTo(tr, *result); + TAOS_CHECK_GOTO(code, NULL, END); idxTRsltDestroy(tr); return 0; END: idxTRsltDestroy(tr); - return 0; + return code; } static void idxInterRsltDestroy(SArray* results) { if (results == NULL) { @@ -503,9 +535,9 @@ static int32_t idxMergeFinalResults(SArray* in, EIndexOperatorType oType, SArray } if (oType == MUST) { - iIntersection(in, out); + return iIntersection(in, out); } else if (oType == SHOULD) { - iUnion(in, out); + return iUnion(in, out); } else if (oType == NOT) { // just one column index, enhance later // taosArrayAddAll(fResults, interResults); @@ -514,30 +546,53 @@ static int32_t idxMergeFinalResults(SArray* in, EIndexOperatorType oType, SArray return 0; } -static void idxMayMergeTempToFinalRslt(SArray* result, TFileValue* tfv, SIdxTRslt* tr) { +static int32_t idxMayMergeTempToFinalRslt(SArray* result, TFileValue* tfv, SIdxTRslt* tr) { + int32_t code = 0; int32_t sz = taosArrayGetSize(result); if (sz > 0) { TFileValue* lv = taosArrayGetP(result, sz - 1); if (tfv != NULL && strcmp(lv->colVal, tfv->colVal) != 0) { - idxTRsltMergeTo(tr, lv->tableId); + code = idxTRsltMergeTo(tr, lv->tableId); + if (code != 0) { + indexFatal("failed to merge result since %s", tstrerror(code)); + return code; + } idxTRsltClear(tr); - (void)taosArrayPush(result, &tfv); + if (taosArrayPush(result, &tfv) == NULL) { + indexFatal("failed to merge result since %s", tstrerror(TSDB_CODE_OUT_OF_MEMORY)); + } } else if (tfv == NULL) { // handle last iterator - idxTRsltMergeTo(tr, lv->tableId); + code = idxTRsltMergeTo(tr, lv->tableId); + if (code != 0) { + indexFatal("failed to merge result since %s", tstrerror(code)); + } } else { tfileValueDestroy(tfv); + return 0; } } else { - (void)taosArrayPush(result, &tfv); + if (taosArrayPush(result, &tfv) == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } } + return code; } -static void idxMergeCacheAndTFile(SArray* result, IterateValue* cv, IterateValue* tv, SIdxTRslt* tr) { +static int32_t idxMergeCacheAndTFile(SArray* result, IterateValue* cv, IterateValue* tv, SIdxTRslt* tr) { + int32_t code = 0; char* colVal = (cv != NULL) ? cv->colVal : tv->colVal; TFileValue* tfv = tfileValueCreate(colVal); + if (tfv == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } - idxMayMergeTempToFinalRslt(result, tfv, tr); + code = idxMayMergeTempToFinalRslt(result, tfv, tr); + if (code != 0) { + tfileValueDestroy(tfv); + return code; + } + tfv = NULL; if (cv != NULL) { uint64_t id = *(uint64_t*)taosArrayGet(cv->val, 0); @@ -549,8 +604,11 @@ static void idxMergeCacheAndTFile(SArray* result, IterateValue* cv, IterateValue } } if (tv != NULL) { - (void)taosArrayAddAll(tr->total, tv->val); + if (taosArrayAddAll(tr->total, tv->val) == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } } + return 0; } static void idxDestroyFinalRslt(SArray* result) { int32_t sz = result ? taosArrayGetSize(result) : 0; @@ -562,6 +620,7 @@ static void idxDestroyFinalRslt(SArray* result) { } int32_t idxFlushCacheToTFile(SIndex* sIdx, void* cache, bool quit) { + int32_t code = 0; if (sIdx == NULL) { return TSDB_CODE_INVALID_PTR; } @@ -598,12 +657,16 @@ int32_t idxFlushCacheToTFile(SIndex* sIdx, void* cache, bool quit) { } SArray* result = taosArrayInit(1024, sizeof(void*)); + if (result == NULL) { + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _exception); + } bool cn = cacheIter ? cacheIter->next(cacheIter) : false; bool tn = tfileIter ? tfileIter->next(tfileIter) : false; SIdxTRslt* tr = idxTRsltCreate(); if (tr == NULL) { + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _exception); } while (cn == true || tn == true) { IterateValue* cv = (cn == true) ? cacheIter->getValue(cacheIter) : NULL; @@ -618,27 +681,42 @@ int32_t idxFlushCacheToTFile(SIndex* sIdx, void* cache, bool quit) { comp = 1; } if (comp == 0) { - idxMergeCacheAndTFile(result, cv, tv, tr); + code = idxMergeCacheAndTFile(result, cv, tv, tr); + if (code != 0) { + TAOS_CHECK_GOTO(code, NULL, _exception); + } + cn = cacheIter->next(cacheIter); tn = tfileIter->next(tfileIter); } else if (comp < 0) { - idxMergeCacheAndTFile(result, cv, NULL, tr); + code = idxMergeCacheAndTFile(result, cv, NULL, tr); + if (code != 0) { + TAOS_CHECK_GOTO(code, NULL, _exception); + } cn = cacheIter->next(cacheIter); } else { - idxMergeCacheAndTFile(result, NULL, tv, tr); + code = idxMergeCacheAndTFile(result, NULL, tv, tr); + if (code != 0) { + TAOS_CHECK_GOTO(code, NULL, _exception); + } tn = tfileIter->next(tfileIter); } } - idxMayMergeTempToFinalRslt(result, NULL, tr); + if ((code = idxMayMergeTempToFinalRslt(result, NULL, tr)) != 0) { + idxTRsltDestroy(tr); + TAOS_CHECK_GOTO(code, NULL, _exception); + } idxTRsltDestroy(tr); - int ret = idxGenTFile(sIdx, pCache, result); - if (ret != 0) { - indexError("failed to merge"); + code = idxGenTFile(sIdx, pCache, result); + if (code != 0) { + indexError("failed to merge since %s", tstrerror(code)); } else { int64_t cost = taosGetTimestampUs() - st; indexInfo("success to merge , time cost: %" PRId64 "ms", cost / 1000); } + +_exception: idxDestroyFinalRslt(result); idxCacheDestroyImm(pCache); @@ -654,8 +732,11 @@ int32_t idxFlushCacheToTFile(SIndex* sIdx, void* cache, bool quit) { idxPost(sIdx); } idxReleaseRef(sIdx->refId); + if (code != 0) { + indexError("failed to merge since %s", tstrerror(code)); + } - return ret; + return code; } void iterateValueDestroy(IterateValue* value, bool destroy) { if (destroy) { diff --git a/source/libs/index/src/indexCache.c b/source/libs/index/src/indexCache.c index 734c4067c6..a89cc47925 100644 --- a/source/libs/index/src/indexCache.c +++ b/source/libs/index/src/indexCache.c @@ -75,6 +75,7 @@ static int32_t cacheSearchTerm(void* cache, SIndexTerm* term, SIdxTRslt* tr, STe if (cache == NULL) { return 0; } + int32_t code = 0; MemTable* mem = cache; IndexCache* pCache = mem->pCache; @@ -98,6 +99,10 @@ static int32_t cacheSearchTerm(void* cache, SIndexTerm* term, SIdxTRslt* tr, STe } else if (c->operaType == DEL_VALUE) { INDEX_MERGE_ADD_DEL(tr->add, tr->del, c->uid) } + + if (code != 0) { + break; + } } else { break; } @@ -105,7 +110,7 @@ static int32_t cacheSearchTerm(void* cache, SIndexTerm* term, SIdxTRslt* tr, STe taosMemoryFree(pCt); (void)tSkipListDestroyIter(iter); - return 0; + return code; } static int32_t cacheSearchPrefix(void* cache, SIndexTerm* term, SIdxTRslt* tr, STermValueType* s) { // impl later @@ -123,6 +128,7 @@ static int32_t cacheSearchCompareFunc(void* cache, SIndexTerm* term, SIdxTRslt* if (cache == NULL) { return 0; } + int32_t code = TSDB_CODE_SUCCESS; MemTable* mem = cache; IndexCache* pCache = mem->pCache; @@ -148,7 +154,7 @@ static int32_t cacheSearchCompareFunc(void* cache, SIndexTerm* term, SIdxTRslt* } CacheTerm* c = (CacheTerm*)SL_GET_NODE_DATA(node); terrno = TSDB_CODE_SUCCESS; - TExeCond cond = cmpFn(c->colVal, pCt->colVal, pCt->colType); + TExeCond cond = cmpFn(c->colVal, pCt->colVal, pCt->colType); if (terrno != TSDB_CODE_SUCCESS) { code = terrno; goto _return; @@ -156,11 +162,14 @@ static int32_t cacheSearchCompareFunc(void* cache, SIndexTerm* term, SIdxTRslt* if (cond == MATCH) { if (c->operaType == ADD_VALUE) { INDEX_MERGE_ADD_DEL(tr->del, tr->add, c->uid) - // taosArrayPush(result, &c->uid); *s = kTypeValue; } else if (c->operaType == DEL_VALUE) { INDEX_MERGE_ADD_DEL(tr->add, tr->del, c->uid) } + + if (code != 0) { + break; + } } else if (cond == CONTINUE) { continue; } else if (cond == BREAK) { @@ -190,6 +199,8 @@ static int32_t cacheSearchTerm_JSON(void* cache, SIndexTerm* term, SIdxTRslt* tr if (cache == NULL) { return 0; } + + int32_t code = 0; MemTable* mem = cache; IndexCache* pCache = mem->pCache; @@ -223,6 +234,10 @@ static int32_t cacheSearchTerm_JSON(void* cache, SIndexTerm* term, SIdxTRslt* tr } else if (c->operaType == DEL_VALUE) { INDEX_MERGE_ADD_DEL(tr->add, tr->del, c->uid) } + + if (code != 0) { + break; + } } else { break; } @@ -231,9 +246,7 @@ static int32_t cacheSearchTerm_JSON(void* cache, SIndexTerm* term, SIdxTRslt* tr taosMemoryFree(pCt); taosMemoryFree(exBuf); (void)tSkipListDestroyIter(iter); - return 0; - - return TSDB_CODE_SUCCESS; + return code; } static int32_t cacheSearchSuffix_JSON(void* cache, SIndexTerm* term, SIdxTRslt* tr, STermValueType* s) { return TSDB_CODE_SUCCESS; @@ -338,6 +351,10 @@ static int32_t cacheSearchCompareFunc_JSON(void* cache, SIndexTerm* term, SIdxTR } else if (c->operaType == DEL_VALUE) { INDEX_MERGE_ADD_DEL(tr->add, tr->del, c->uid) } + + if (code != 0) { + break; + } } else if (cond == CONTINUE) { continue; } else if (cond == BREAK) { @@ -800,7 +817,13 @@ static bool idxCacheIteratorNext(Iterate* itera) { iv->type = ct->operaType; iv->ver = ct->version; iv->colVal = taosStrdup(ct->colVal); - (void)taosArrayPush(iv->val, &ct->uid); + if (iv->colVal == NULL) { + return false; + } + if (taosArrayPush(iv->val, &ct->uid) == NULL) { + taosMemoryFree(iv->colVal); + return false; + } } return next; } diff --git a/source/libs/index/src/indexFst.c b/source/libs/index/src/indexFst.c index 3edd61bd08..aa617c2de2 100644 --- a/source/libs/index/src/indexFst.c +++ b/source/libs/index/src/indexFst.c @@ -62,7 +62,9 @@ void fstUnFinishedNodesPushEmpty(FstUnFinishedNodes* nodes, bool isFinal) { node->trans = taosArrayInit(16, sizeof(FstTransition)); FstBuilderNodeUnfinished un = {.node = node, .last = NULL}; - (void)taosArrayPush(nodes->stack, &un); + if (taosArrayPush(nodes->stack, &un) == NULL) { + fstBuilderNodeDestroy(node); + } } FstBuilderNode* fstUnFinishedNodesPopRoot(FstUnFinishedNodes* nodes) { FstBuilderNodeUnfinished* un = taosArrayPop(nodes->stack); @@ -120,7 +122,10 @@ void fstUnFinishedNodesAddSuffix(FstUnFinishedNodes* nodes, FstSlice bs, Output FstLastTransition* trn = fstLastTransitionCreate(data[i], 0); FstBuilderNodeUnfinished un = {.node = n, .last = trn}; - (void)taosArrayPush(nodes->stack, &un); + if (taosArrayPush(nodes->stack, &un) == NULL) { + fstBuilderNodeDestroy(n); + taosMemoryFree(trn); + } } fstUnFinishedNodesPushEmpty(nodes, true); } @@ -892,7 +897,9 @@ void fstBuilderNodeUnfinishedLastCompiled(FstBuilderNodeUnfinished* unNode, Comp return; } FstTransition t = {.inp = trn->inp, .out = trn->out, .addr = addr}; - (void)taosArrayPush(unNode->node->trans, &t); + if (taosArrayPush(unNode->node->trans, &t) == NULL) { + return; + } fstLastTransitionDestroy(trn); unNode->last = NULL; return; @@ -997,7 +1004,12 @@ bool fstGet(Fst* fst, FstSlice* b, Output* out) { uint8_t* data = fstSliceData(b, &len); SArray* nodes = (SArray*)taosArrayInit(len, sizeof(FstNode*)); - (void)taosArrayPush(nodes, &root); + if (nodes == NULL) { + return false; + } + if (taosArrayPush(nodes, &root) == NULL) { + goto _return; + } for (uint32_t i = 0; i < len; i++) { uint8_t inp = data[i]; Output res = 0; @@ -1009,7 +1021,9 @@ bool fstGet(Fst* fst, FstSlice* b, Output* out) { (void)fstNodeGetTransitionAt(root, res, &trn); tOut += trn.out; root = fstGetNode(fst, trn.addr); - (void)taosArrayPush(nodes, &root); + if (taosArrayPush(nodes, &root) == NULL) { + goto _return; + } } if (!FST_NODE_IS_FINAL(root)) { goto _return; @@ -1156,7 +1170,9 @@ bool stmStSeekMin(FStmSt* sws, FstBoundWithData* min) { .trans = 0, .out = {.null = false, .out = 0}, .autState = automFuncs[aut->type].start(aut)}; // auto.start callback - (void)taosArrayPush(sws->stack, &s); + if (taosArrayPush(sws->stack, &s) == NULL) { + return false; + } return true; } FstSlice* key = NULL; @@ -1185,12 +1201,16 @@ bool stmStSeekMin(FStmSt* sws, FstBoundWithData* min) { (void)fstNodeGetTransitionAt(node, res, &trn); void* preState = autState; autState = automFuncs[aut->type].accept(aut, preState, b); - (void)taosArrayPush(sws->inp, &b); + if (taosArrayPush(sws->inp, &b) == NULL) { + return false; + } FstStreamState s = {.node = node, .trans = res + 1, .out = {.null = false, .out = out}, .autState = preState}; node = NULL; - (void)taosArrayPush(sws->stack, &s); + if (taosArrayPush(sws->stack, &s) == NULL) { + return false; + } out += trn.out; node = fstGetNode(sws->fst, trn.addr); } else { @@ -1209,7 +1229,9 @@ bool stmStSeekMin(FStmSt* sws, FstBoundWithData* min) { } FstStreamState s = {.node = node, .trans = i, .out = {.null = false, .out = out}, .autState = autState}; - (void)taosArrayPush(sws->stack, &s); + if (taosArrayPush(sws->stack, &s) == NULL) { + return false; + } taosMemoryFree(trans); return true; } @@ -1230,7 +1252,9 @@ bool stmStSeekMin(FStmSt* sws, FstBoundWithData* min) { (void)fstNodeGetTransitionAt(n, trans - 1, &trn); FstStreamState s = { .node = fstGetNode(sws->fst, trn.addr), .trans = 0, .out = {.null = false, .out = out}, .autState = autState}; - (void)taosArrayPush(sws->stack, &s); + if (taosArrayPush(sws->stack, &s) == NULL) { + return false; + } return true; } return false; @@ -1273,8 +1297,14 @@ FStmStRslt* stmStNextWith(FStmSt* sws, streamCallback__fn callback) { bool isMatch = automFuncs[aut->type].isMatch(aut, nextState); FstNode* nextNode = fstGetNode(sws->fst, trn.addr); - (void)taosArrayPush(nodes, &nextNode); - (void)taosArrayPush(sws->inp, &(trn.inp)); + if (taosArrayPush(nodes, &nextNode) == NULL) { + taosArrayDestroy(nodes); + return NULL; + } + if (taosArrayPush(sws->inp, &(trn.inp)) == NULL) { + taosArrayDestroy(nodes); + return NULL; + } if (FST_NODE_IS_FINAL(nextNode)) { void* eofState = automFuncs[aut->type].acceptEof(aut, nextState); @@ -1283,10 +1313,16 @@ FStmStRslt* stmStNextWith(FStmSt* sws, streamCallback__fn callback) { } } FstStreamState s1 = {.node = p->node, .trans = p->trans + 1, .out = p->out, .autState = p->autState}; - (void)taosArrayPush(sws->stack, &s1); + if (taosArrayPush(sws->stack, &s1) == NULL) { + taosArrayDestroy(nodes); + return NULL; + } FstStreamState s2 = {.node = nextNode, .trans = 0, .out = {.null = false, .out = out}, .autState = nextState}; - (void)taosArrayPush(sws->stack, &s2); + if (taosArrayPush(sws->stack, &s2) == NULL) { + taosArrayDestroy(nodes); + return NULL; + } int32_t isz = taosArrayGetSize(sws->inp); uint8_t* buf = (uint8_t*)taosMemoryMalloc(isz * sizeof(uint8_t)); @@ -1357,11 +1393,18 @@ FStmBuilder* stmBuilderCreate(Fst* fst, FAutoCtx* aut) { b->aut = aut; b->min = fstBoundStateCreate(Unbounded, NULL); b->max = fstBoundStateCreate(Unbounded, NULL); + + if (b->min == NULL || b->max == NULL) { + stmBuilderDestroy(b); + return NULL; + } + return b; } void stmBuilderDestroy(FStmBuilder* b) { - fstSliceDestroy(&b->min->data); - fstSliceDestroy(&b->max->data); + if (b->min) fstSliceDestroy(&b->min->data); + if (b->max) fstSliceDestroy(&b->max->data); + taosMemoryFreeClear(b->min); taosMemoryFreeClear(b->max); taosMemoryFree(b); diff --git a/source/libs/index/src/indexFstDfa.c b/source/libs/index/src/indexFstDfa.c index f552d5feba..c95847525f 100644 --- a/source/libs/index/src/indexFstDfa.c +++ b/source/libs/index/src/indexFstDfa.c @@ -14,6 +14,7 @@ */ #include "indexFstDfa.h" +#include "indexInt.h" #include "thash.h" const static uint32_t STATE_LIMIT = 1000; @@ -68,23 +69,41 @@ FstDfa *dfaBuilderBuild(FstDfaBuilder *builder) { uint32_t sz = taosArrayGetSize(builder->dfa->insts); FstSparseSet *cur = sparSetCreate(sz); FstSparseSet *nxt = sparSetCreate(sz); + if (cur == NULL || nxt == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return NULL; + } dfaAdd(builder->dfa, cur, 0); uint32_t result; SArray *states = taosArrayInit(0, sizeof(uint32_t)); + if (states == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return NULL; + } if (dfaBuilderCacheState(builder, cur, &result)) { - (void)taosArrayPush(states, &result); + if (taosArrayPush(states, &result) == NULL) { + goto _exception; + } } SHashObj *seen = taosHashInit(12, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK); + if (seen == NULL) { + goto _exception; + } + while (taosArrayGetSize(states) != 0) { result = *(uint32_t *)taosArrayPop(states); for (int i = 0; i < 256; i++) { uint32_t ns, dummpy = 0; if (dfaBuilderRunState(builder, cur, nxt, result, i, &ns)) { if (taosHashGet(seen, &ns, sizeof(ns)) == NULL) { - (void)taosHashPut(seen, &ns, sizeof(ns), &dummpy, sizeof(dummpy)); - (void)taosArrayPush(states, &ns); + if (taosHashPut(seen, &ns, sizeof(ns), &dummpy, sizeof(dummpy)) != 0) { + goto _exception; + } + if (taosArrayPush(states, &ns) == NULL) { + goto _exception; + } } } if (taosArrayGetSize(builder->dfa->states) > STATE_LIMIT) { @@ -96,6 +115,11 @@ FstDfa *dfaBuilderBuild(FstDfaBuilder *builder) { taosArrayDestroy(states); taosHashCleanup(seen); return builder->dfa; +_exception: + taosArrayDestroy(states); + taosHashCleanup(seen); + indexError("failed to build dfa since %s", tstrerror(terrno)); + return NULL; } bool dfaBuilderRunState(FstDfaBuilder *builder, FstSparseSet *cur, FstSparseSet *next, uint32_t state, uint8_t byte, @@ -122,8 +146,13 @@ bool dfaBuilderRunState(FstDfaBuilder *builder, FstSparseSet *cur, FstSparseSet } bool dfaBuilderCacheState(FstDfaBuilder *builder, FstSparseSet *set, uint32_t *result) { + int32_t code = 0; SArray *tinsts = taosArrayInit(4, sizeof(uint32_t)); - bool isMatch = false; + if (tinsts == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto _exception; + } + bool isMatch = false; for (int i = 0; i < sparSetLen(set); i++) { int32_t ip; @@ -133,10 +162,16 @@ bool dfaBuilderCacheState(FstDfaBuilder *builder, FstSparseSet *set, uint32_t *r if (inst->ty == JUMP || inst->ty == SPLIT) { continue; } else if (inst->ty == RANGE) { - (void)taosArrayPush(tinsts, &ip); + if (taosArrayPush(tinsts, &ip) == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto _exception; + } } else if (inst->ty == MATCH) { isMatch = true; - (void)taosArrayPush(tinsts, &ip); + if (taosArrayPush(tinsts, &ip) == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto _exception; + } } } if (taosArrayGetSize(tinsts) == 0) { @@ -149,13 +184,23 @@ bool dfaBuilderCacheState(FstDfaBuilder *builder, FstSparseSet *set, uint32_t *r taosArrayDestroy(tinsts); } else { DfaState st = {.insts = tinsts, .isMatch = isMatch}; - (void)taosArrayPush(builder->dfa->states, &st); + if (taosArrayPush(builder->dfa->states, &st) == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto _exception; + } int32_t sz = taosArrayGetSize(builder->dfa->states) - 1; - (void)taosHashPut(builder->cache, &tinsts, sizeof(POINTER_BYTES), &sz, sizeof(sz)); + if ((code = taosHashPut(builder->cache, &tinsts, sizeof(POINTER_BYTES), &sz, sizeof(sz))) != 0) { + goto _exception; + } + *result = sz; } return true; +_exception: + indexError("failed to create dfa state, code:%d", code); + taosArrayDestroy(tinsts); + return false; } FstDfa *dfaCreate(SArray *insts, SArray *states) { diff --git a/source/libs/index/src/indexFstNode.c b/source/libs/index/src/indexFstNode.c index 7f1a86bc55..245f5cf5fc 100644 --- a/source/libs/index/src/indexFstNode.c +++ b/source/libs/index/src/indexFstNode.c @@ -16,9 +16,14 @@ FstBuilderNode* fstBuilderNodeDefault() { FstBuilderNode* bn = taosMemoryMalloc(sizeof(FstBuilderNode)); + if (bn == NULL) return NULL; bn->isFinal = false; bn->finalOutput = 0; bn->trans = taosArrayInit(16, sizeof(FstTransition)); + if (bn->trans == NULL) { + taosMemoryFree(bn); + return NULL; + } return bn; } void fstBuilderNodeDestroy(FstBuilderNode* node) { @@ -56,30 +61,11 @@ bool fstBuilderNodeEqual(FstBuilderNode* n1, FstBuilderNode* n2) { return true; } -FstBuilderNode* fstBuilderNodeClone(FstBuilderNode* src) { - FstBuilderNode* node = taosMemoryMalloc(sizeof(FstBuilderNode)); - if (node == NULL) { - return NULL; - } - // - size_t sz = taosArrayGetSize(src->trans); - SArray* trans = taosArrayInit(sz, sizeof(FstTransition)); - - for (size_t i = 0; i < sz; i++) { - FstTransition* tran = taosArrayGet(src->trans, i); - (void)taosArrayPush(trans, tran); - } - - node->trans = trans; - node->isFinal = src->isFinal; - node->finalOutput = src->finalOutput; - return node; -} // not destroy src, User's bussiness -void fstBuilderNodeCloneFrom(FstBuilderNode* dst, FstBuilderNode* src) { +int32_t fstBuilderNodeCloneFrom(FstBuilderNode* dst, FstBuilderNode* src) { if (dst == NULL || src == NULL) { - return; + return TSDB_CODE_INVALID_PARA; } dst->isFinal = src->isFinal; @@ -89,10 +75,18 @@ void fstBuilderNodeCloneFrom(FstBuilderNode* dst, FstBuilderNode* src) { taosArrayDestroy(dst->trans); size_t sz = taosArrayGetSize(src->trans); dst->trans = taosArrayInit(sz, sizeof(FstTransition)); + if (dst->trans == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } for (size_t i = 0; i < sz; i++) { FstTransition* trn = taosArrayGet(src->trans, i); - (void)taosArrayPush(dst->trans, trn); + if (taosArrayPush(dst->trans, trn) == NULL) { + taosArrayDestroy(dst->trans); + dst->trans = NULL; + return TSDB_CODE_OUT_OF_MEMORY; + } } + return 0; } // bool fstBuilderNodeCompileTo(FstBuilderNode *b, IdxFile *wrt, CompiledAddr lastAddr, CompiledAddr diff --git a/source/libs/index/src/indexFstRegex.c b/source/libs/index/src/indexFstRegex.c index c6ceb1d965..941cb82e90 100644 --- a/source/libs/index/src/indexFstRegex.c +++ b/source/libs/index/src/indexFstRegex.c @@ -39,7 +39,12 @@ FstRegex *regexCreate(const char *str) { for (int i = 0; i < strlen(str); i++) { uint8_t v = str[i]; - (void)taosArrayPush(insts, &v); + if (taosArrayPush(insts, &v) == NULL) { + taosArrayDestroy(insts); + taosMemoryFree(regex->orig); + taosMemoryFree(regex); + return NULL; + } } FstDfaBuilder *builder = dfaBuilderCreate(insts); regex->dfa = dfaBuilderBuild(builder); diff --git a/source/libs/index/src/indexFstRegister.c b/source/libs/index/src/indexFstRegister.c index a8c4365a44..cc069c5d0f 100644 --- a/source/libs/index/src/indexFstRegister.c +++ b/source/libs/index/src/indexFstRegister.c @@ -84,7 +84,10 @@ FstRegistry* fstRegistryCreate(uint64_t tableSize, uint64_t mruSize) { for (uint64_t i = 0; i < nCells; i++) { FstRegistryCell cell = {.addr = NONE_ADDRESS, .node = fstBuilderNodeDefault()}; - (void)taosArrayPush(tb, &cell); + if (taosArrayPush(tb, &cell) == NULL) { + fstRegistryDestroy(registry); + return NULL; + } } registry->table = tb; @@ -125,7 +128,7 @@ FstRegistryEntry* fstRegistryGetEntry(FstRegistry* registry, FstBuilderNode* bNo entry->addr = cell->addr; return entry; } else { - fstBuilderNodeCloneFrom(cell->node, bNode); + (void)fstBuilderNodeCloneFrom(cell->node, bNode); entry->state = NOTFOUND; entry->cell = cell; // copy or not } @@ -145,7 +148,7 @@ FstRegistryEntry* fstRegistryGetEntry(FstRegistry* registry, FstBuilderNode* bNo return entry; } // clone from bNode, refactor later - fstBuilderNodeCloneFrom(cell2->node, bNode); + (void)fstBuilderNodeCloneFrom(cell2->node, bNode); fstRegistryCellSwap(registry->table, start, start + 1); FstRegistryCell* cCell = taosArrayGet(registry->table, start); @@ -166,7 +169,7 @@ FstRegistryEntry* fstRegistryGetEntry(FstRegistry* registry, FstBuilderNode* bNo uint64_t last = end - 1; FstRegistryCell* cell = (FstRegistryCell*)taosArrayGet(registry->table, last); // clone from bNode, refactor later - fstBuilderNodeCloneFrom(cell->node, bNode); + (void)fstBuilderNodeCloneFrom(cell->node, bNode); fstRegistryCellPromote(registry->table, last, start); FstRegistryCell* cCell = taosArrayGet(registry->table, start); diff --git a/source/libs/index/src/indexTfile.c b/source/libs/index/src/indexTfile.c index 8c06296732..55a9bb06d9 100644 --- a/source/libs/index/src/indexTfile.c +++ b/source/libs/index/src/indexTfile.c @@ -49,7 +49,7 @@ static int tfileReaderLoadFst(TFileReader* reader); static int tfileReaderVerify(TFileReader* reader); static int tfileReaderLoadTableIds(TFileReader* reader, int32_t offset, SArray* result); -static SArray* tfileGetFileList(const char* path); +static int32_t tfileGetFileList(const char* path, SArray** pResult); static int tfileRmExpireFile(SArray* result); static void tfileDestroyFileName(void* elem); static int tfileCompare(const void* a, const void* b); @@ -97,9 +97,15 @@ TFileCache* tfileCacheCreate(SIndex* idx, const char* path) { } tcache->tableCache = taosHashInit(8, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); + if (tcache->tableCache == NULL) { + indexError("failed to open table cache since%s", tstrerror(terrno)); + goto End; + } + tcache->capacity = 64; - SArray* files = tfileGetFileList(path); + SArray* files = NULL; + int32_t code = tfileGetFileList(path, &files); for (size_t i = 0; i < taosArrayGetSize(files); i++) { char* file = taosArrayGetP(files, i); @@ -125,7 +131,11 @@ TFileCache* tfileCacheCreate(SIndex* idx, const char* path) { char buf[128] = {0}; int32_t sz = idxSerialCacheKey(&key, buf); - (void)taosHashPut(tcache->tableCache, buf, sz, &reader, sizeof(void*)); + code = taosHashPut(tcache->tableCache, buf, sz, &reader, sizeof(void*)); + if (code != 0) { + tfileReaderDestroy(reader); + goto End; + } tfileReaderRef(reader); } taosArrayDestroyEx(files, tfileDestroyFileName); @@ -163,6 +173,7 @@ TFileReader* tfileCacheGet(TFileCache* tcache, ICacheKey* key) { return *reader; } + int32_t tfileCachePut(TFileCache* tcache, ICacheKey* key, TFileReader* reader) { int32_t code = 0; @@ -172,16 +183,18 @@ int32_t tfileCachePut(TFileCache* tcache, ICacheKey* key, TFileReader* reader) { TFileReader** p = taosHashGet(tcache->tableCache, buf, sz); if (p != NULL && *p != NULL) { TFileReader* oldRdr = *p; - (void)taosHashRemove(tcache->tableCache, buf, sz); - indexInfo("found %s, should remove file %s", buf, oldRdr->ctx->file.buf); - oldRdr->remove = true; - tfileReaderUnRef(oldRdr); + if ((code = taosHashRemove(tcache->tableCache, buf, sz)) != 0) { + indexError("failed to remove old reader from cache since %s, suid:%" PRIu64 ", colName:%s", tstrerror(code), + oldRdr->header.suid, oldRdr->header.colName); + } else { + indexInfo("found %s, should remove file %s", buf, oldRdr->ctx->file.buf); + oldRdr->remove = true; + tfileReaderUnRef(oldRdr); + } } code = taosHashPut(tcache->tableCache, buf, sz, &reader, sizeof(void*)); - if (code == 0) { - tfileReaderRef(reader); - } + tfileReaderRef(reader); return code; } int32_t tfileReaderCreate(IFileCtx* ctx, TFileReader** pReader) { @@ -232,7 +245,7 @@ void tfileReaderDestroy(TFileReader* reader) { } static int32_t tfSearchTerm(void* reader, SIndexTerm* tem, SIdxTRslt* tr) { - int ret = 0; + int32_t ret = 0; char* p = tem->colVal; uint64_t sz = tem->nColVal; @@ -246,6 +259,11 @@ static int32_t tfSearchTerm(void* reader, SIndexTerm* tem, SIdxTRslt* tr) { tem->suid, tem->colName, tem->colVal, cost); ret = tfileReaderLoadTableIds((TFileReader*)reader, (int32_t)offset, tr->total); + if (ret != 0) { + fstSliceDestroy(&key); + indexError("faile to search since %s", tstrerror(ret)); + return ret; + } cost = taosGetTimestampUs() - et; indexInfo("index: %" PRIu64 ", col: %s, colVal: %s, load all table info, time cost: %" PRIu64 "us", tem->suid, tem->colName, tem->colVal, cost); @@ -255,17 +273,29 @@ static int32_t tfSearchTerm(void* reader, SIndexTerm* tem, SIdxTRslt* tr) { } static int32_t tfSearchPrefix(void* reader, SIndexTerm* tem, SIdxTRslt* tr) { + int32_t lino = 0; + int32_t code = 0; char* p = tem->colVal; uint64_t sz = tem->nColVal; SArray* offsets = taosArrayInit(16, sizeof(uint64_t)); + if (offsets == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } + + FAutoCtx* ctx = automCtxCreate((void*)p, AUTOMATION_PREFIX); + if (ctx == NULL) { + taosArrayDestroy(offsets); + return TSDB_CODE_OUT_OF_MEMORY; + } - FAutoCtx* ctx = automCtxCreate((void*)p, AUTOMATION_PREFIX); FStmBuilder* sb = fstSearch(((TFileReader*)reader)->fst, ctx); FStmSt* st = stmBuilderIntoStm(sb); FStmStRslt* rt = NULL; while ((rt = stmStNextWith(st, NULL)) != NULL) { - (void)taosArrayPush(offsets, &(rt->out.out)); + if (taosArrayPush(offsets, &(rt->out.out)) == NULL) { + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exception); + } swsResultDestroy(rt); } stmStDestroy(st); @@ -275,14 +305,16 @@ static int32_t tfSearchPrefix(void* reader, SIndexTerm* tem, SIdxTRslt* tr) { for (int i = 0; i < taosArrayGetSize(offsets); i++) { uint64_t offset = *(uint64_t*)taosArrayGet(offsets, i); ret = tfileReaderLoadTableIds((TFileReader*)reader, offset, tr->total); - if (ret != 0) { - taosArrayDestroy(offsets); - indexError("failed to find target tablelist"); - return TSDB_CODE_FILE_CORRUPTED; - } + TAOS_CHECK_GOTO(ret, &lino, _exception); } taosArrayDestroy(offsets); return 0; +_exception: + stmStDestroy(st); + stmBuilderDestroy(sb); + taosArrayDestroy(offsets); + indexError("failed to searchPrefix since %s, lino:%d", tstrerror(code), lino); + return code; } static int32_t tfSearchSuffix(void* reader, SIndexTerm* tem, SIdxTRslt* tr) { int ret = 0; @@ -393,6 +425,12 @@ static int32_t tfSearchTerm_JSON(void* reader, SIndexTerm* tem, SIdxTRslt* tr) { tem->suid, tem->colName, tem->colVal, cost); ret = tfileReaderLoadTableIds((TFileReader*)reader, offset, tr->total); + if (ret != 0) { + indexError("failed to search json since %s", tstrerror(ret)); + taosMemoryFree(p); + fstSliceDestroy(&key); + return ret; + } cost = taosGetTimestampUs() - et; indexInfo("index: %" PRIu64 ", col: %s, colVal: %s, load all table info, offset: %" PRIu64 ", size: %d, time cost: %" PRIu64 "us", @@ -863,14 +901,24 @@ TFileValue* tfileValueCreate(char* val) { return NULL; } tf->colVal = taosStrdup(val); + if (tf->colVal == NULL) { + taosMemoryFree(tf); + } tf->tableId = taosArrayInit(32, sizeof(uint64_t)); + if (tf->tableId == NULL) { + taosMemoryFree(tf->colVal); + taosMemoryFree(tf); + return NULL; + } return tf; } -int tfileValuePush(TFileValue* tf, uint64_t val) { +int32_t tfileValuePush(TFileValue* tf, uint64_t val) { if (tf == NULL) { - return -1; + return TSDB_CODE_INVALID_PARA; + } + if (taosArrayPush(tf->tableId, &val) == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; } - (void)taosArrayPush(tf->tableId, &val); return 0; } void tfileValueDestroy(TFileValue* tf) { @@ -986,8 +1034,10 @@ static int tfileReaderLoadFst(TFileReader* reader) { return reader->fst != NULL ? 0 : -1; } -static int tfileReaderLoadTableIds(TFileReader* reader, int32_t offset, SArray* result) { +static int32_t tfileReaderLoadTableIds(TFileReader* reader, int32_t offset, SArray* result) { // TODO(yihao): opt later + int32_t code = 0; + int32_t lino = 0; IFileCtx* ctx = reader->ctx; // add block cache char block[4096] = {0}; @@ -1003,7 +1053,9 @@ static int tfileReaderLoadTableIds(TFileReader* reader, int32_t offset, SArray* while (nid > 0) { int32_t left = block + sizeof(block) - p; if (left >= sizeof(uint64_t)) { - (void)taosArrayPush(result, (uint64_t*)p); + if (taosArrayPush(result, (uint64_t*)p) == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } p += sizeof(uint64_t); } else { char buf[sizeof(uint64_t)] = {0}; @@ -1014,7 +1066,9 @@ static int tfileReaderLoadTableIds(TFileReader* reader, int32_t offset, SArray* nread = ctx->readFrom(ctx, (uint8_t*)block, sizeof(block), offset); memcpy(buf + left, block, sizeof(uint64_t) - left); - (void)taosArrayPush(result, (uint64_t*)buf); + if (taosArrayPush(result, (uint64_t*)buf) == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } p = block + sizeof(uint64_t) - left; } nid -= 1; @@ -1059,16 +1113,19 @@ void tfileReaderUnRef(TFileReader* rd) { } } -static SArray* tfileGetFileList(const char* path) { +static int32_t tfileGetFileList(const char* path, SArray** ppResult) { + int32_t code = 0; char buf[128] = {0}; uint64_t suid; int64_t version; SArray* files = taosArrayInit(4, sizeof(void*)); + if (files == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } TdDirPtr pDir = taosOpenDir(path); if (NULL == pDir) { - taosArrayDestroy(files); - return NULL; + TAOS_CHECK_GOTO(TAOS_SYSTEM_ERROR(errno), NULL, _exception); } TdDirEntryPtr pDirEntry; while ((pDirEntry = taosReadDir(pDir)) != NULL) { @@ -1079,15 +1136,29 @@ static SArray* tfileGetFileList(const char* path) { size_t len = strlen(path) + 1 + strlen(file) + 1; char* buf = taosMemoryCalloc(1, len); + if (buf == NULL) { + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _exception); + } + sprintf(buf, "%s/%s", path, file); - (void)taosArrayPush(files, &buf); + if (taosArrayPush(files, &buf) == NULL) { + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _exception); + } } (void)taosCloseDir(&pDir); taosArraySort(files, tfileCompare); (void)tfileRmExpireFile(files); + *ppResult = files; + return 0; - return files; +_exception: + (void)taosCloseDir(&pDir); + if (files != NULL) { + taosArrayDestroyEx(files, tfileDestroyFileName); + taosArrayDestroy(files); + } + return code; } static int tfileRmExpireFile(SArray* result) { // TODO(yihao): remove expire tindex after restart diff --git a/source/libs/index/src/indexUtil.c b/source/libs/index/src/indexUtil.c index 0776e71180..6a52b7b5a4 100644 --- a/source/libs/index/src/indexUtil.c +++ b/source/libs/index/src/indexUtil.c @@ -36,12 +36,16 @@ static FORCE_INLINE int iBinarySearch(SArray *arr, int s, int e, uint64_t k) { return s; } -void iIntersection(SArray *in, SArray *out) { +int32_t iIntersection(SArray *in, SArray *out) { + int32_t code = 0; int32_t sz = (int32_t)taosArrayGetSize(in); if (sz <= 0) { - return; + return 0; } MergeIndex *mi = taosMemoryCalloc(sz, sizeof(MergeIndex)); + if (mi == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } for (int i = 0; i < sz; i++) { SArray *t = taosArrayGetP(in, i); mi[i].len = (int32_t)taosArrayGetSize(t); @@ -64,19 +68,25 @@ void iIntersection(SArray *in, SArray *out) { } } if (has == true) { - (void)taosArrayPush(out, &tgt); + if (taosArrayPush(out, &tgt) == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + break; + } } } taosMemoryFreeClear(mi); + return code; } -void iUnion(SArray *in, SArray *out) { +int32_t iUnion(SArray *in, SArray *out) { + int32_t code = 0; int32_t sz = (int32_t)taosArrayGetSize(in); if (sz <= 0) { - return; + return 0; } if (sz == 1) { - (void)taosArrayAddAll(out, taosArrayGetP(in, 0)); - return; + if (taosArrayAddAll(out, taosArrayGetP(in, 0)) == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } } MergeIndex *mi = taosMemoryCalloc(sz, sizeof(MergeIndex)); @@ -108,19 +118,23 @@ void iUnion(SArray *in, SArray *out) { continue; } } - (void)taosArrayPush(out, &mVal); + if (taosArrayPush(out, &mVal) == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + break; + } } else { break; } } taosMemoryFreeClear(mi); + return 0; } -void iExcept(SArray *total, SArray *except) { +int32_t iExcept(SArray *total, SArray *except) { int32_t tsz = (int32_t)taosArrayGetSize(total); int32_t esz = (int32_t)taosArrayGetSize(except); if (esz == 0 || tsz == 0) { - return; + return 0; } int vIdx = 0; @@ -135,6 +149,7 @@ void iExcept(SArray *total, SArray *except) { } taosArrayPopTailBatch(total, tsz - vIdx); + return 0; } int uidCompare(const void *a, const void *b) { @@ -191,20 +206,37 @@ void idxTRsltDestroy(SIdxTRslt *tr) { taosArrayDestroy(tr->del); taosMemoryFree(tr); } -void idxTRsltMergeTo(SIdxTRslt *tr, SArray *result) { +int32_t idxTRsltMergeTo(SIdxTRslt *tr, SArray *result) { + int32_t code = 0; taosArraySort(tr->total, uidCompare); taosArraySort(tr->add, uidCompare); taosArraySort(tr->del, uidCompare); if (taosArrayGetSize(tr->total) == 0 || taosArrayGetSize(tr->add) == 0) { SArray *t = taosArrayGetSize(tr->total) == 0 ? tr->add : tr->total; - (void)taosArrayAddAll(result, t); + if (taosArrayAddAll(result, t) == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } } else { SArray *arrs = taosArrayInit(2, sizeof(void *)); - (void)taosArrayPush(arrs, &tr->total); - (void)taosArrayPush(arrs, &tr->add); - iUnion(arrs, result); + if (arrs == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } + + if (taosArrayPush(arrs, &tr->total) == NULL) { + taosArrayDestroy(arrs); + return TSDB_CODE_OUT_OF_MEMORY; + } + + if (taosArrayPush(arrs, &tr->add) == NULL) { + taosArrayDestroy(arrs); + return TSDB_CODE_OUT_OF_MEMORY; + } + code = iUnion(arrs, result); taosArrayDestroy(arrs); } - iExcept(result, tr->del); + if (code == 0) { + code = iExcept(result, tr->del); + } + return code; } diff --git a/source/libs/monitor/src/monFramework.c b/source/libs/monitor/src/monFramework.c index d5fc1b4c65..c3b63787a6 100644 --- a/source/libs/monitor/src/monFramework.c +++ b/source/libs/monitor/src/monFramework.c @@ -117,7 +117,10 @@ void monInitMonitorFW(){ if(taos_collector_registry_register_metric(gauge) == 1){ (void)taos_counter_destroy(gauge); } - (void)taosHashPut(tsMonitor.metrics, dnodes_gauges[i], strlen(dnodes_gauges[i]), &gauge, sizeof(taos_gauge_t *)); + if (taosHashPut(tsMonitor.metrics, dnodes_gauges[i], strlen(dnodes_gauges[i]), &gauge, sizeof(taos_gauge_t *)) != + 0) { + uError("failed to add dnode gauge at%d:%s", i, dnodes_gauges[i]); + } } int32_t dnodes_data_label_count = 5; @@ -128,8 +131,10 @@ void monInitMonitorFW(){ if(taos_collector_registry_register_metric(gauge) == 1){ (void)taos_counter_destroy(gauge); } - (void)taosHashPut(tsMonitor.metrics, dnodes_data_gauges[i], strlen(dnodes_data_gauges[i]), &gauge, - sizeof(taos_gauge_t *)); + if (taosHashPut(tsMonitor.metrics, dnodes_data_gauges[i], strlen(dnodes_data_gauges[i]), &gauge, + sizeof(taos_gauge_t *)) != 0) { + uError("failed to add dnode data gauge at%d:%s", i, dnodes_data_gauges[i]); + } } int32_t dnodes_log_label_count = 4; @@ -140,8 +145,10 @@ void monInitMonitorFW(){ if(taos_collector_registry_register_metric(gauge) == 1){ (void)taos_counter_destroy(gauge); } - (void)taosHashPut(tsMonitor.metrics, dnodes_log_gauges[i], strlen(dnodes_log_gauges[i]), &gauge, - sizeof(taos_gauge_t *)); + if (taosHashPut(tsMonitor.metrics, dnodes_log_gauges[i], strlen(dnodes_log_gauges[i]), &gauge, + sizeof(taos_gauge_t *)) != 0) { + uError("failed to add dnode log gauge at%d:%s", i, dnodes_log_gauges[i]); + } } } @@ -186,7 +193,9 @@ void monGenClusterInfoTable(SMonInfo *pMonitor){ if(taos_collector_registry_register_metric(gauge) == 1){ (void)taos_counter_destroy(gauge); } - (void)taosHashPut(tsMonitor.metrics, metric_names[i], strlen(metric_names[i]), &gauge, sizeof(taos_gauge_t *)); + if (taosHashPut(tsMonitor.metrics, metric_names[i], strlen(metric_names[i]), &gauge, sizeof(taos_gauge_t *)) != 0) { + uError("failed to add cluster gauge at%d:%s", i, metric_names[i]); + } } char buf[TSDB_CLUSTER_ID_LEN] = {0}; @@ -640,8 +649,10 @@ void monGenMnodeRoleTable(SMonInfo *pMonitor){ if(taos_collector_registry_register_metric(gauge) == 1){ (void)taos_counter_destroy(gauge); } - (void)taosHashPut(tsMonitor.metrics, mnodes_role_gauges[i], strlen(mnodes_role_gauges[i]), &gauge, - sizeof(taos_gauge_t *)); + if (taosHashPut(tsMonitor.metrics, mnodes_role_gauges[i], strlen(mnodes_role_gauges[i]), &gauge, + sizeof(taos_gauge_t *)) != 0) { + uError("failed to add mnode role gauge at%d:%s", i, mnodes_role_gauges[i]); + } } char buf[TSDB_CLUSTER_ID_LEN] = {0}; @@ -707,8 +718,10 @@ void monGenVnodeRoleTable(SMonInfo *pMonitor){ if(taos_collector_registry_register_metric(gauge) == 1){ (void)taos_counter_destroy(gauge); } - (void)taosHashPut(tsMonitor.metrics, vnodes_role_gauges[i], strlen(vnodes_role_gauges[i]), &gauge, - sizeof(taos_gauge_t *)); + if (taosHashPut(tsMonitor.metrics, vnodes_role_gauges[i], strlen(vnodes_role_gauges[i]), &gauge, + sizeof(taos_gauge_t *)) != 0) { + uError("failed to add vnode role gauge at%d:%s", i, vnodes_role_gauges[i]); + } } char buf[TSDB_CLUSTER_ID_LEN] = {0}; diff --git a/source/libs/monitor/src/monMain.c b/source/libs/monitor/src/monMain.c index 4abc8958df..14d62fbf0e 100644 --- a/source/libs/monitor/src/monMain.c +++ b/source/libs/monitor/src/monMain.c @@ -132,7 +132,8 @@ int32_t monInit(const SMonCfg *pCfg) { } void monInitVnode() { - if (tsEnableMonitor && tsMonitorFqdn[0] != 0 && tsMonitorPort != 0 && tsInsertCounter == NULL) { + if (!tsEnableMonitor || tsMonitorFqdn[0] == 0 || tsMonitorPort == 0) return; + if (tsInsertCounter == NULL) { taos_counter_t *counter = NULL; int32_t label_count = 7; const char *sample_labels[] = {VNODE_METRIC_TAG_NAME_SQL_TYPE, VNODE_METRIC_TAG_NAME_CLUSTER_ID, diff --git a/source/libs/nodes/src/nodesCloneFuncs.c b/source/libs/nodes/src/nodesCloneFuncs.c index 78cf78f6db..e2c5b42e39 100644 --- a/source/libs/nodes/src/nodesCloneFuncs.c +++ b/source/libs/nodes/src/nodesCloneFuncs.c @@ -103,6 +103,7 @@ static int32_t exprNodeCopy(const SExprNode* pSrc, SExprNode* pDst) { COPY_CHAR_ARRAY_FIELD(aliasName); COPY_CHAR_ARRAY_FIELD(userAlias); COPY_SCALAR_FIELD(orderAlias); + COPY_SCALAR_FIELD(projIdx); return TSDB_CODE_SUCCESS; } @@ -124,6 +125,8 @@ static int32_t columnNodeCopy(const SColumnNode* pSrc, SColumnNode* pDst) { COPY_SCALAR_FIELD(tableHasPk); COPY_SCALAR_FIELD(isPk); COPY_SCALAR_FIELD(numOfPKs); + COPY_SCALAR_FIELD(projRefIdx); + COPY_SCALAR_FIELD(resIdx); return TSDB_CODE_SUCCESS; } diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index c1afc4afb3..1d6c19346a 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -1090,7 +1090,7 @@ void nodesDestroyNode(SNode* pNode) { pStmt->destroyParseFileCxt(&pStmt->pParFileCxt); } - assert(TSDB_CODE_SUCCESS == taosCloseFile(&pStmt->fp)); + (void)taosCloseFile(&pStmt->fp); break; } case QUERY_NODE_CREATE_DATABASE_STMT: @@ -2260,8 +2260,13 @@ static EDealRes doCollect(SCollectColumnsCxt* pCxt, SColumnNode* pCol, SNode* pN } else { len = snprintf(name, sizeof(name), "%s.%s", pCol->tableAlias, pCol->colName); } - if (NULL == taosHashGet(pCxt->pColHash, name, len)) { - pCxt->errCode = taosHashPut(pCxt->pColHash, name, len, NULL, 0); + if (pCol->projRefIdx > 0) { + len = taosHashBinary(name, strlen(name)); + len += sprintf(name + len, "_%d", pCol->projRefIdx); + } + SNode** pNodeFound = taosHashGet(pCxt->pColHash, name, len); + if (pNodeFound == NULL) { + pCxt->errCode = taosHashPut(pCxt->pColHash, name, len, &pNode, POINTER_BYTES); if (TSDB_CODE_SUCCESS == pCxt->errCode) { SNode* pNew = NULL; pCxt->errCode = nodesCloneNode(pNode, &pNew); @@ -2304,7 +2309,6 @@ static EDealRes collectColumnsExt(SNode* pNode, void* pContext) { return DEAL_RES_CONTINUE; } - int32_t nodesCollectColumns(SSelectStmt* pSelect, ESqlClause clause, const char* pTableAlias, ECollectColType type, SNodeList** pCols) { if (NULL == pSelect || NULL == pCols) { diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h index 4686b90d46..f67f1d23b6 100644 --- a/source/libs/parser/inc/parAst.h +++ b/source/libs/parser/inc/parAst.h @@ -200,7 +200,8 @@ SNode* createDefaultTableOptions(SAstCreateContext* pCxt); SNode* createAlterTableOptions(SAstCreateContext* pCxt); SNode* setTableOption(SAstCreateContext* pCxt, SNode* pOptions, ETableOptionType type, void* pVal); SNode* createColumnDefNode(SAstCreateContext* pCxt, SToken* pColName, SDataType dataType, SNode* pOptions); -SNode* setColumnOptions(SAstCreateContext* pCxt, SNode* pOptions, EColumnOptionType type, void* pVal); +SNode* setColumnOptions(SAstCreateContext* pCxt, SNode* pOptions, const SToken* pVal1, void* pVal2); +SNode* setColumnOptionsPK(SAstCreateContext* pCxt, SNode* pOptions); SNode* createDefaultColumnOptions(SAstCreateContext* pCxt); SNode* createCreateTableStmt(SAstCreateContext* pCxt, bool ignoreExists, SNode* pRealTable, SNodeList* pCols, SNodeList* pTags, SNode* pOptions); diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index 9228e16ff9..f2a3692f78 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -750,7 +750,7 @@ column_stream_def_list(A) ::= column_stream_def_list(B) column_stream_def(A) ::= column_name(B) stream_col_options(C). { A = createColumnDefNode(pCxt, &B, createDataType(TSDB_DATA_TYPE_NULL), C); } stream_col_options(A) ::= . { A = createDefaultColumnOptions(pCxt); } -stream_col_options(A) ::= stream_col_options(B) PRIMARY KEY. { A = setColumnOptions(pCxt, B, COLUMN_OPTION_PRIMARYKEY, NULL); } +stream_col_options(A) ::= stream_col_options(B) PRIMARY KEY. { A = setColumnOptionsPK(pCxt, B); } //column_stream_def(A) ::= column_def(B). { A = B; } %type tag_def_or_ref_opt { SNodeList* } @@ -1611,7 +1611,5 @@ null_ordering_opt(A) ::= NULLS LAST. STRICT STRING TIMES VALUES VARIABLE VIEW WAL. column_options(A) ::= . { A = createDefaultColumnOptions(pCxt); } -column_options(A) ::= column_options(B) PRIMARY KEY. { A = setColumnOptions(pCxt, B, COLUMN_OPTION_PRIMARYKEY, NULL); } -column_options(A) ::= column_options(B) ENCODE NK_STRING(C). { A = setColumnOptions(pCxt, B, COLUMN_OPTION_ENCODE, &C); } -column_options(A) ::= column_options(B) COMPRESS NK_STRING(C). { A = setColumnOptions(pCxt, B, COLUMN_OPTION_COMPRESS, &C); } -column_options(A) ::= column_options(B) LEVEL NK_STRING(C). { A = setColumnOptions(pCxt, B, COLUMN_OPTION_LEVEL, &C); } +column_options(A) ::= column_options(B) PRIMARY KEY. { A = setColumnOptionsPK(pCxt, B); } +column_options(A) ::= column_options(B) NK_ID(C) NK_STRING(D). { A = setColumnOptions(pCxt, B, &C, &D); } diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index 20081b7535..fa6a3648e0 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -24,7 +24,7 @@ #define CHECK_MAKE_NODE(p) \ do { \ if (NULL == (p)) { \ - return NULL; \ + goto _err; \ } \ } while (0) @@ -32,14 +32,21 @@ do { \ if (NULL == (p)) { \ pCxt->errCode = TSDB_CODE_OUT_OF_MEMORY; \ - return NULL; \ + goto _err; \ } \ } while (0) #define CHECK_PARSER_STATUS(pCxt) \ do { \ if (TSDB_CODE_SUCCESS != pCxt->errCode) { \ - return NULL; \ + goto _err; \ + } \ + } while (0) + +#define CHECK_NAME(p) \ + do { \ + if (!p) { \ + goto _err; \ } \ } while (0) @@ -275,6 +282,9 @@ SNode* createRawExprNode(SAstCreateContext* pCxt, const SToken* pToken, SNode* p target->n = pToken->n; target->pNode = pNode; return (SNode*)target; +_err: + nodesDestroyNode(pNode); + return NULL; } SNode* createRawExprNodeExt(SAstCreateContext* pCxt, const SToken* pStart, const SToken* pEnd, SNode* pNode) { @@ -286,6 +296,9 @@ SNode* createRawExprNodeExt(SAstCreateContext* pCxt, const SToken* pStart, const target->n = (pEnd->z + pEnd->n) - pStart->z; target->pNode = pNode; return (SNode*)target; +_err: + nodesDestroyNode(pNode); + return NULL; } SNode* setRawExprNodeIsPseudoColumn(SAstCreateContext* pCxt, SNode* pNode, bool isPseudoColumn) { @@ -295,6 +308,9 @@ SNode* setRawExprNodeIsPseudoColumn(SAstCreateContext* pCxt, SNode* pNode, bool } ((SRawExprNode*)pNode)->isPseudoColumn = isPseudoColumn; return pNode; +_err: + nodesDestroyNode(pNode); + return NULL; } SNode* releaseRawExprNode(SAstCreateContext* pCxt, SNode* pNode) { @@ -325,6 +341,9 @@ SNode* releaseRawExprNode(SAstCreateContext* pCxt, SNode* pNode) { pRawExpr->pNode = NULL; nodesDestroyNode(pNode); return pRealizedExpr; +_err: + nodesDestroyNode(pNode); + return NULL; } SToken getTokenFromRawExprNode(SAstCreateContext* pCxt, SNode* pNode) { @@ -348,12 +367,19 @@ SNodeList* createNodeList(SAstCreateContext* pCxt, SNode* pNode) { return NULL; } return list; +_err: + nodesDestroyNode(pNode); + return NULL; } SNodeList* addNodeToList(SAstCreateContext* pCxt, SNodeList* pList, SNode* pNode) { CHECK_PARSER_STATUS(pCxt); pCxt->errCode = nodesListAppend(pList, pNode); return pList; +_err: + nodesDestroyNode(pNode); + nodesDestroyList(pList); + return NULL; } SNode* createColumnNode(SAstCreateContext* pCxt, SToken* pTableAlias, SToken* pColumnName) { @@ -369,6 +395,8 @@ SNode* createColumnNode(SAstCreateContext* pCxt, SToken* pTableAlias, SToken* pC } COPY_STRING_FORM_ID_TOKEN(col->colName, pColumnName); return (SNode*)col; +_err: + return NULL; } SNode* createValueNode(SAstCreateContext* pCxt, int32_t dataType, const SToken* pLiteral) { @@ -393,6 +421,8 @@ SNode* createValueNode(SAstCreateContext* pCxt, int32_t dataType, const SToken* } val->translate = false; return (SNode*)val; +_err: + return NULL; } SNode* createRawValueNode(SAstCreateContext* pCxt, int32_t dataType, const SToken* pLiteral, SNode* pNode) { @@ -433,12 +463,15 @@ _exit: return NULL; } return (SNode*)val; +_err: + nodesDestroyNode(pNode); + return NULL; } SNode* createRawValueNodeExt(SAstCreateContext* pCxt, int32_t dataType, const SToken* pLiteral, SNode* pLeft, SNode* pRight) { - CHECK_PARSER_STATUS(pCxt); SValueNode* val = NULL; + CHECK_PARSER_STATUS(pCxt); pCxt->errCode = nodesMakeNode(QUERY_NODE_VALUE, (SNode**)&val); if (TSDB_CODE_SUCCESS != pCxt->errCode) { @@ -463,11 +496,13 @@ SNode* createRawValueNodeExt(SAstCreateContext* pCxt, int32_t dataType, const ST _exit: nodesDestroyNode(pLeft); nodesDestroyNode(pRight); - if (pCxt->errCode != 0) { - nodesDestroyNode((SNode*)val); - return NULL; - } + CHECK_PARSER_STATUS(pCxt); return (SNode*)val; +_err: + nodesDestroyNode((SNode*)val); + nodesDestroyNode(pLeft); + nodesDestroyNode(pRight); + return NULL; } static bool hasHint(SNodeList* pHintList, EHintOption hint) { @@ -516,7 +551,9 @@ bool addHintNodeToList(SAstCreateContext* pCxt, SNodeList** ppHintList, EHintOpt SHintNode* hint = NULL; pCxt->errCode = nodesMakeNode(QUERY_NODE_HINT, (SNode**)&hint); - CHECK_MAKE_NODE(hint); + if (!hint) { + return true; + } hint->option = opt; hint->value = value; @@ -667,6 +704,8 @@ SNodeList* createHintNodeList(SAstCreateContext* pCxt, const SToken* pLiteral) { taosMemoryFree(hint); return pHintList; +_err: + return NULL; } SNode* createIdentifierValueNode(SAstCreateContext* pCxt, SToken* pLiteral) { @@ -724,6 +763,8 @@ SNode* createDurationValueNode(SAstCreateContext* pCxt, const SToken* pLiteral) val->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes; val->node.resType.precision = TSDB_TIME_PRECISION_MILLI; return (SNode*)val; +_err: + return NULL; } SNode* createTimeOffsetValueNode(SAstCreateContext* pCxt, const SToken* pLiteral) { @@ -774,6 +815,8 @@ SNode* createTimeOffsetValueNode(SAstCreateContext* pCxt, const SToken* pLiteral val->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes; val->node.resType.precision = TSDB_TIME_PRECISION_MILLI; return (SNode*)val; +_err: + return NULL; } SNode* createDefaultDatabaseCondValue(SAstCreateContext* pCxt) { @@ -796,6 +839,8 @@ SNode* createDefaultDatabaseCondValue(SAstCreateContext* pCxt) { val->node.resType.bytes = strlen(val->literal); val->node.resType.precision = TSDB_TIME_PRECISION_MILLI; return (SNode*)val; +_err: + return NULL; } SNode* createPlaceholderValueNode(SAstCreateContext* pCxt, const SToken* pLiteral) { @@ -823,9 +868,13 @@ SNode* createPlaceholderValueNode(SAstCreateContext* pCxt, const SToken* pLitera } if (NULL == taosArrayPush(pCxt->pPlaceholderValues, &val)) { pCxt->errCode = TSDB_CODE_OUT_OF_MEMORY; + nodesDestroyNode((SNode*)val); + taosArrayDestroy(pCxt->pPlaceholderValues); + return NULL; } - CHECK_PARSER_STATUS(pCxt); return (SNode*)val; +_err: + return NULL; } static int32_t addParamToLogicConditionNode(SLogicConditionNode* pCond, SNode* pParam) { @@ -858,6 +907,10 @@ SNode* createLogicConditionNode(SAstCreateContext* pCxt, ELogicConditionType typ return NULL; } return (SNode*)cond; +_err: + nodesDestroyNode(pParam1); + nodesDestroyNode(pParam2); + return NULL; } static uint8_t getMinusDataType(uint8_t orgType) { @@ -880,7 +933,7 @@ SNode* createOperatorNode(SAstCreateContext* pCxt, EOperatorType type, SNode* pL char* pNewLiteral = taosMemoryCalloc(1, strlen(pVal->literal) + 2); if (!pNewLiteral) { pCxt->errCode = TSDB_CODE_OUT_OF_MEMORY; - return NULL; + goto _err; } if ('+' == pVal->literal[0]) { sprintf(pNewLiteral, "-%s", pVal->literal + 1); @@ -901,55 +954,54 @@ SNode* createOperatorNode(SAstCreateContext* pCxt, EOperatorType type, SNode* pL op->pLeft = pLeft; op->pRight = pRight; return (SNode*)op; +_err: + nodesDestroyNode(pLeft); + nodesDestroyNode(pRight); + return NULL; } SNode* createBetweenAnd(SAstCreateContext* pCxt, SNode* pExpr, SNode* pLeft, SNode* pRight) { + SNode* pNew = NULL, *pGE = NULL, *pLE = NULL; CHECK_PARSER_STATUS(pCxt); - SNode* pNew = NULL; pCxt->errCode = nodesCloneNode(pExpr, &pNew); CHECK_PARSER_STATUS(pCxt); - SNode* pGE = createOperatorNode(pCxt, OP_TYPE_GREATER_EQUAL, pExpr, pLeft); - if (TSDB_CODE_SUCCESS != pCxt->errCode) { - nodesDestroyNode(pNew); - return NULL; - } - SNode* pLE = createOperatorNode(pCxt, OP_TYPE_LOWER_EQUAL, pNew, pRight); - if (TSDB_CODE_SUCCESS != pCxt->errCode) { - nodesDestroyNode(pNew); - nodesDestroyNode(pGE); - return NULL; - } + pGE = createOperatorNode(pCxt, OP_TYPE_GREATER_EQUAL, pExpr, pLeft); + CHECK_PARSER_STATUS(pCxt); + pLE = createOperatorNode(pCxt, OP_TYPE_LOWER_EQUAL, pNew, pRight); + CHECK_PARSER_STATUS(pCxt); SNode* pRet = createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, pGE, pLE); - if (TSDB_CODE_SUCCESS != pCxt->errCode) { - nodesDestroyNode(pNew); - nodesDestroyNode(pGE); - nodesDestroyNode(pLE); - } + CHECK_PARSER_STATUS(pCxt); return pRet; +_err: + nodesDestroyNode(pNew); + nodesDestroyNode(pGE); + nodesDestroyNode(pLE); + nodesDestroyNode(pExpr); + nodesDestroyNode(pLeft); + nodesDestroyNode(pRight); + return NULL; } SNode* createNotBetweenAnd(SAstCreateContext* pCxt, SNode* pExpr, SNode* pLeft, SNode* pRight) { + SNode* pNew = NULL, *pLT = NULL, *pGT = NULL; CHECK_PARSER_STATUS(pCxt); - SNode* pLT = createOperatorNode(pCxt, OP_TYPE_LOWER_THAN, pExpr, pLeft); - CHECK_MAKE_NODE(pLT); - SNode* pNew = NULL; pCxt->errCode = nodesCloneNode(pExpr, &pNew); - if (TSDB_CODE_SUCCESS != pCxt->errCode) { - nodesDestroyNode(pLT); - return NULL; - } - SNode* pGT = createOperatorNode(pCxt, OP_TYPE_GREATER_THAN, pNew, pRight); - if (TSDB_CODE_SUCCESS != pCxt->errCode) { - nodesDestroyNode(pLT); - nodesDestroyNode(pNew); - } + CHECK_PARSER_STATUS(pCxt); + pLT = createOperatorNode(pCxt, OP_TYPE_LOWER_THAN, pExpr, pLeft); + CHECK_PARSER_STATUS(pCxt); + pGT = createOperatorNode(pCxt, OP_TYPE_GREATER_THAN, pNew, pRight); + CHECK_PARSER_STATUS(pCxt); SNode* pRet = createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, pLT, pGT); - if (TSDB_CODE_SUCCESS != pCxt->errCode) { - nodesDestroyNode(pLT); - nodesDestroyNode(pGT); - nodesDestroyNode(pNew); - } + CHECK_PARSER_STATUS(pCxt); return pRet; +_err: + nodesDestroyNode(pNew); + nodesDestroyNode(pGT); + nodesDestroyNode(pLT); + nodesDestroyNode(pExpr); + nodesDestroyNode(pLeft); + nodesDestroyNode(pRight); + return NULL; } static SNode* createPrimaryKeyCol(SAstCreateContext* pCxt, const SToken* pFuncName) { @@ -965,6 +1017,8 @@ static SNode* createPrimaryKeyCol(SAstCreateContext* pCxt, const SToken* pFuncNa } pCol->isPrimTs = true; return (SNode*)pCol; +_err: + return NULL; } SNode* createFunctionNode(SAstCreateContext* pCxt, const SToken* pFuncName, SNodeList* pParameterList) { @@ -978,11 +1032,14 @@ SNode* createFunctionNode(SAstCreateContext* pCxt, const SToken* pFuncName, SNod COPY_STRING_FORM_ID_TOKEN(func->functionName, pFuncName); func->pParameterList = pParameterList; return (SNode*)func; +_err: + nodesDestroyList(pParameterList); + return NULL; } SNode* createCastFunctionNode(SAstCreateContext* pCxt, SNode* pExpr, SDataType dt) { - CHECK_PARSER_STATUS(pCxt); SFunctionNode* func = NULL; + CHECK_PARSER_STATUS(pCxt); pCxt->errCode = nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&func); CHECK_MAKE_NODE(func); strcpy(func->functionName, "cast"); @@ -995,11 +1052,15 @@ SNode* createCastFunctionNode(SAstCreateContext* pCxt, SNode* pExpr, SDataType d pCxt->errCode = nodesListMakeAppend(&func->pParameterList, pExpr); CHECK_PARSER_STATUS(pCxt); return (SNode*)func; +_err: + nodesDestroyNode((SNode*)func); + nodesDestroyNode(pExpr); + return NULL; } SNode* createPositionFunctionNode(SAstCreateContext* pCxt, SNode* pExpr, SNode* pExpr2) { - CHECK_PARSER_STATUS(pCxt); SFunctionNode* func = NULL; + CHECK_PARSER_STATUS(pCxt); pCxt->errCode = nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&func); CHECK_MAKE_NODE(func); strcpy(func->functionName, "position"); @@ -1008,11 +1069,16 @@ SNode* createPositionFunctionNode(SAstCreateContext* pCxt, SNode* pExpr, SNode* pCxt->errCode = nodesListMakeAppend(&func->pParameterList, pExpr2); CHECK_PARSER_STATUS(pCxt); return (SNode*)func; +_err: + nodesDestroyNode((SNode*)func); + nodesDestroyNode(pExpr); + nodesDestroyNode(pExpr2); + return NULL; } SNode* createTrimFunctionNode(SAstCreateContext* pCxt, SNode* pExpr, ETrimType type) { - CHECK_PARSER_STATUS(pCxt); SFunctionNode* func = NULL; + CHECK_PARSER_STATUS(pCxt); pCxt->errCode = nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&func); CHECK_MAKE_NODE(func); strcpy(func->functionName, "trim"); @@ -1020,11 +1086,15 @@ SNode* createTrimFunctionNode(SAstCreateContext* pCxt, SNode* pExpr, ETrimType t pCxt->errCode = nodesListMakeAppend(&func->pParameterList, pExpr); CHECK_PARSER_STATUS(pCxt); return (SNode*)func; +_err: + nodesDestroyNode((SNode*)func); + nodesDestroyNode(pExpr); + return NULL; } SNode* createTrimFunctionNodeExt(SAstCreateContext* pCxt, SNode* pExpr, SNode* pExpr2, ETrimType type) { - CHECK_PARSER_STATUS(pCxt); SFunctionNode* func = NULL; + CHECK_PARSER_STATUS(pCxt); pCxt->errCode = nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&func); CHECK_MAKE_NODE(func); strcpy(func->functionName, "trim"); @@ -1034,11 +1104,16 @@ SNode* createTrimFunctionNodeExt(SAstCreateContext* pCxt, SNode* pExpr, SNode* p pCxt->errCode = nodesListMakeAppend(&func->pParameterList, pExpr2); CHECK_PARSER_STATUS(pCxt); return (SNode*)func; +_err: + nodesDestroyNode((SNode*)func); + nodesDestroyNode(pExpr); + nodesDestroyNode(pExpr2); + return NULL; } SNode* createSubstrFunctionNode(SAstCreateContext* pCxt, SNode* pExpr, SNode* pExpr2) { - CHECK_PARSER_STATUS(pCxt); SFunctionNode* func = NULL; + CHECK_PARSER_STATUS(pCxt); pCxt->errCode = nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&func); CHECK_MAKE_NODE(func); strcpy(func->functionName, "substr"); @@ -1047,11 +1122,16 @@ SNode* createSubstrFunctionNode(SAstCreateContext* pCxt, SNode* pExpr, SNode* pE pCxt->errCode = nodesListMakeAppend(&func->pParameterList, pExpr2); CHECK_PARSER_STATUS(pCxt); return (SNode*)func; +_err: + nodesDestroyNode((SNode*)func); + nodesDestroyNode(pExpr); + nodesDestroyNode(pExpr2); + return NULL; } SNode* createSubstrFunctionNodeExt(SAstCreateContext* pCxt, SNode* pExpr, SNode* pExpr2, SNode* pExpr3) { - CHECK_PARSER_STATUS(pCxt); SFunctionNode* func = NULL; + CHECK_PARSER_STATUS(pCxt); pCxt->errCode = nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&func); CHECK_MAKE_NODE(func); strcpy(func->functionName, "substr"); @@ -1062,40 +1142,48 @@ SNode* createSubstrFunctionNodeExt(SAstCreateContext* pCxt, SNode* pExpr, SNode* pCxt->errCode = nodesListMakeAppend(&func->pParameterList, pExpr3); CHECK_PARSER_STATUS(pCxt); return (SNode*)func; +_err: + nodesDestroyNode((SNode*)func); + nodesDestroyNode(pExpr); + nodesDestroyNode(pExpr2); + nodesDestroyNode(pExpr3); + return NULL; } SNode* createNodeListNode(SAstCreateContext* pCxt, SNodeList* pList) { - CHECK_PARSER_STATUS(pCxt); SNodeListNode* list = NULL; + CHECK_PARSER_STATUS(pCxt); pCxt->errCode = nodesMakeNode(QUERY_NODE_NODE_LIST, (SNode**)&list); CHECK_MAKE_NODE(list); list->pNodeList = pList; return (SNode*)list; +_err: + nodesDestroyList(pList); + return NULL; } SNode* createNodeListNodeEx(SAstCreateContext* pCxt, SNode* p1, SNode* p2) { - CHECK_PARSER_STATUS(pCxt); SNodeListNode* list = NULL; + CHECK_PARSER_STATUS(pCxt); pCxt->errCode = nodesMakeNode(QUERY_NODE_NODE_LIST, (SNode**)&list); CHECK_MAKE_NODE(list); pCxt->errCode = nodesListMakeStrictAppend(&list->pNodeList, p1); - if (TSDB_CODE_SUCCESS != pCxt->errCode) { - nodesDestroyNode((SNode*)list); - return NULL; - } + CHECK_PARSER_STATUS(pCxt); pCxt->errCode = nodesListStrictAppend(list->pNodeList, p2); - if (TSDB_CODE_SUCCESS != pCxt->errCode) { - nodesDestroyNode((SNode*)list); - return NULL; - } + CHECK_PARSER_STATUS(pCxt); return (SNode*)list; +_err: + nodesDestroyNode((SNode*)list); + nodesDestroyNode(p1); + nodesDestroyNode(p2); + return NULL; } SNode* createRealTableNode(SAstCreateContext* pCxt, SToken* pDbName, SToken* pTableName, SToken* pTableAlias) { CHECK_PARSER_STATUS(pCxt); - if (!checkDbName(pCxt, pDbName, true) || !checkTableName(pCxt, pTableName) || !checkTableName(pCxt, pTableAlias)) { - return NULL; - } + CHECK_NAME(checkDbName(pCxt, pDbName, true)); + CHECK_NAME(checkTableName(pCxt, pTableName)); + CHECK_NAME(checkTableName(pCxt, pTableAlias)); SRealTableNode* realTable = NULL; pCxt->errCode = nodesMakeNode(QUERY_NODE_REAL_TABLE, (SNode**)&realTable); CHECK_MAKE_NODE(realTable); @@ -1111,6 +1199,8 @@ SNode* createRealTableNode(SAstCreateContext* pCxt, SToken* pDbName, SToken* pTa } COPY_STRING_FORM_ID_TOKEN(realTable->table.tableName, pTableName); return (SNode*)realTable; +_err: + return NULL; } SNode* createTempTableNode(SAstCreateContext* pCxt, SNode* pSubquery, SToken* pTableAlias) { @@ -1134,6 +1224,9 @@ SNode* createTempTableNode(SAstCreateContext* pCxt, SNode* pSubquery, SToken* pT strcpy(((SSetOperator*)pSubquery)->stmtName, tempTable->table.tableAlias); } return (SNode*)tempTable; +_err: + nodesDestroyNode(pSubquery); + return NULL; } SNode* createJoinTableNode(SAstCreateContext* pCxt, EJoinType type, EJoinSubType stype, SNode* pLeft, SNode* pRight, @@ -1148,13 +1241,17 @@ SNode* createJoinTableNode(SAstCreateContext* pCxt, EJoinType type, EJoinSubType joinTable->pRight = pRight; joinTable->pOnCond = pJoinCond; return (SNode*)joinTable; +_err: + nodesDestroyNode(pLeft); + nodesDestroyNode(pRight); + nodesDestroyNode(pJoinCond); + return NULL; } SNode* createViewNode(SAstCreateContext* pCxt, SToken* pDbName, SToken* pViewName) { CHECK_PARSER_STATUS(pCxt); - if (!checkDbName(pCxt, pDbName, true) || !checkViewName(pCxt, pViewName)) { - return NULL; - } + CHECK_NAME(checkDbName(pCxt, pDbName, true)); + CHECK_NAME(checkViewName(pCxt, pViewName)); SViewNode* pView = NULL; pCxt->errCode = nodesMakeNode(QUERY_NODE_VIEW, (SNode**)&pView); CHECK_MAKE_NODE(pView); @@ -1165,6 +1262,8 @@ SNode* createViewNode(SAstCreateContext* pCxt, SToken* pDbName, SToken* pViewNam } COPY_STRING_FORM_ID_TOKEN(pView->table.tableName, pViewName); return (SNode*)pView; +_err: + return NULL; } SNode* createLimitNode(SAstCreateContext* pCxt, const SToken* pLimit, const SToken* pOffset) { @@ -1177,6 +1276,8 @@ SNode* createLimitNode(SAstCreateContext* pCxt, const SToken* pLimit, const STok limitNode->offset = taosStr2Int64(pOffset->z, NULL, 10); } return (SNode*)limitNode; +_err: + return NULL; } SNode* createOrderByExprNode(SAstCreateContext* pCxt, SNode* pExpr, EOrder order, ENullOrder nullOrder) { @@ -1191,6 +1292,9 @@ SNode* createOrderByExprNode(SAstCreateContext* pCxt, SNode* pExpr, EOrder order } orderByExpr->nullOrder = nullOrder; return (SNode*)orderByExpr; +_err: + nodesDestroyNode(pExpr); + return NULL; } SNode* createSessionWindowNode(SAstCreateContext* pCxt, SNode* pCol, SNode* pGap) { @@ -1201,121 +1305,145 @@ SNode* createSessionWindowNode(SAstCreateContext* pCxt, SNode* pCol, SNode* pGap session->pCol = (SColumnNode*)pCol; session->pGap = (SValueNode*)pGap; return (SNode*)session; +_err: + nodesDestroyNode(pCol); + nodesDestroyNode(pGap); + return NULL; } SNode* createStateWindowNode(SAstCreateContext* pCxt, SNode* pExpr) { - CHECK_PARSER_STATUS(pCxt); SStateWindowNode* state = NULL; + CHECK_PARSER_STATUS(pCxt); pCxt->errCode = nodesMakeNode(QUERY_NODE_STATE_WINDOW, (SNode**)&state); CHECK_MAKE_NODE(state); state->pCol = createPrimaryKeyCol(pCxt, NULL); - if (NULL == state->pCol) { - nodesDestroyNode((SNode*)state); - CHECK_MAKE_NODE(NULL); - } + CHECK_MAKE_NODE(state->pCol); state->pExpr = pExpr; return (SNode*)state; +_err: + nodesDestroyNode((SNode*)state); + nodesDestroyNode(pExpr); + return NULL; } SNode* createEventWindowNode(SAstCreateContext* pCxt, SNode* pStartCond, SNode* pEndCond) { - CHECK_PARSER_STATUS(pCxt); SEventWindowNode* pEvent = NULL; + CHECK_PARSER_STATUS(pCxt); pCxt->errCode = nodesMakeNode(QUERY_NODE_EVENT_WINDOW, (SNode**)&pEvent); CHECK_MAKE_NODE(pEvent); pEvent->pCol = createPrimaryKeyCol(pCxt, NULL); - if (NULL == pEvent->pCol) { - nodesDestroyNode((SNode*)pEvent); - CHECK_MAKE_NODE(NULL); - } + CHECK_MAKE_NODE(pEvent->pCol); pEvent->pStartCond = pStartCond; pEvent->pEndCond = pEndCond; return (SNode*)pEvent; +_err: + nodesDestroyNode((SNode*)pEvent); + nodesDestroyNode(pStartCond); + nodesDestroyNode(pEndCond); + return NULL; } SNode* createCountWindowNode(SAstCreateContext* pCxt, const SToken* pCountToken, const SToken* pSlidingToken) { - CHECK_PARSER_STATUS(pCxt); SCountWindowNode* pCount = NULL; + CHECK_PARSER_STATUS(pCxt); pCxt->errCode = nodesMakeNode(QUERY_NODE_COUNT_WINDOW, (SNode**)&pCount); CHECK_MAKE_NODE(pCount); pCount->pCol = createPrimaryKeyCol(pCxt, NULL); - if (NULL == pCount->pCol) { - nodesDestroyNode((SNode*)pCount); - CHECK_MAKE_NODE(NULL); - } + CHECK_MAKE_NODE(pCount->pCol); pCount->windowCount = taosStr2Int64(pCountToken->z, NULL, 10); pCount->windowSliding = taosStr2Int64(pSlidingToken->z, NULL, 10); return (SNode*)pCount; +_err: + nodesDestroyNode((SNode*)pCount); + return NULL; } SNode* createIntervalWindowNode(SAstCreateContext* pCxt, SNode* pInterval, SNode* pOffset, SNode* pSliding, SNode* pFill) { - CHECK_PARSER_STATUS(pCxt); SIntervalWindowNode* interval = NULL; + CHECK_PARSER_STATUS(pCxt); pCxt->errCode = nodesMakeNode(QUERY_NODE_INTERVAL_WINDOW, (SNode**)&interval); CHECK_MAKE_NODE(interval); interval->pCol = createPrimaryKeyCol(pCxt, NULL); - if (NULL == interval->pCol) { - nodesDestroyNode((SNode*)interval); - CHECK_MAKE_NODE(NULL); - } + CHECK_MAKE_NODE(interval->pCol); interval->pInterval = pInterval; interval->pOffset = pOffset; interval->pSliding = pSliding; interval->pFill = pFill; return (SNode*)interval; +_err: + nodesDestroyNode((SNode*)interval); + nodesDestroyNode(pInterval); + nodesDestroyNode(pOffset); + nodesDestroyNode(pSliding); + nodesDestroyNode(pFill); + return NULL; } SNode* createWindowOffsetNode(SAstCreateContext* pCxt, SNode* pStartOffset, SNode* pEndOffset) { - CHECK_PARSER_STATUS(pCxt); SWindowOffsetNode* winOffset = NULL; + CHECK_PARSER_STATUS(pCxt); pCxt->errCode = nodesMakeNode(QUERY_NODE_WINDOW_OFFSET, (SNode**)&winOffset); CHECK_MAKE_NODE(winOffset); winOffset->pStartOffset = pStartOffset; winOffset->pEndOffset = pEndOffset; return (SNode*)winOffset; +_err: + nodesDestroyNode((SNode*)winOffset); + nodesDestroyNode(pStartOffset); + nodesDestroyNode(pEndOffset); + return NULL; } SNode* createFillNode(SAstCreateContext* pCxt, EFillMode mode, SNode* pValues) { - CHECK_PARSER_STATUS(pCxt); SFillNode* fill = NULL; + CHECK_PARSER_STATUS(pCxt); pCxt->errCode = nodesMakeNode(QUERY_NODE_FILL, (SNode**)&fill); CHECK_MAKE_NODE(fill); fill->mode = mode; fill->pValues = pValues; fill->pWStartTs = NULL; pCxt->errCode = nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&(fill->pWStartTs)); - if (NULL == fill->pWStartTs) { - nodesDestroyNode((SNode*)fill); - return NULL; - } + CHECK_MAKE_NODE(fill->pWStartTs); strcpy(((SFunctionNode*)fill->pWStartTs)->functionName, "_wstart"); return (SNode*)fill; +_err: + nodesDestroyNode((SNode*)fill); + nodesDestroyNode(pValues); + return NULL; } SNode* createGroupingSetNode(SAstCreateContext* pCxt, SNode* pNode) { - CHECK_PARSER_STATUS(pCxt); SGroupingSetNode* groupingSet = NULL; + CHECK_PARSER_STATUS(pCxt); pCxt->errCode = nodesMakeNode(QUERY_NODE_GROUPING_SET, (SNode**)&groupingSet); CHECK_MAKE_NODE(groupingSet); groupingSet->groupingSetType = GP_TYPE_NORMAL; groupingSet->pParameterList = NULL; pCxt->errCode = nodesListMakeAppend(&groupingSet->pParameterList, pNode); - if (TSDB_CODE_SUCCESS != pCxt->errCode) { - nodesDestroyNode((SNode*)groupingSet); - return NULL; - } CHECK_PARSER_STATUS(pCxt); return (SNode*)groupingSet; +_err: + nodesDestroyNode((SNode*)groupingSet); + nodesDestroyNode(pNode); + return NULL; } SNode* createInterpTimeRange(SAstCreateContext* pCxt, SNode* pStart, SNode* pEnd) { CHECK_PARSER_STATUS(pCxt); return createBetweenAnd(pCxt, createPrimaryKeyCol(pCxt, NULL), pStart, pEnd); +_err: + nodesDestroyNode(pStart); + nodesDestroyNode(pEnd); + return NULL; } SNode* createInterpTimePoint(SAstCreateContext* pCxt, SNode* pPoint) { CHECK_PARSER_STATUS(pCxt); return createOperatorNode(pCxt, OP_TYPE_EQUAL, createPrimaryKeyCol(pCxt, NULL), pPoint); +_err: + nodesDestroyNode(pPoint); + return NULL; } SNode* createWhenThenNode(SAstCreateContext* pCxt, SNode* pWhen, SNode* pThen) { @@ -1326,6 +1454,10 @@ SNode* createWhenThenNode(SAstCreateContext* pCxt, SNode* pWhen, SNode* pThen) { pWhenThen->pWhen = pWhen; pWhenThen->pThen = pThen; return (SNode*)pWhenThen; +_err: + nodesDestroyNode(pWhen); + nodesDestroyNode(pThen); + return NULL; } SNode* createCaseWhenNode(SAstCreateContext* pCxt, SNode* pCase, SNodeList* pWhenThenList, SNode* pElse) { @@ -1337,6 +1469,11 @@ SNode* createCaseWhenNode(SAstCreateContext* pCxt, SNode* pCase, SNodeList* pWhe pCaseWhen->pWhenThenList = pWhenThenList; pCaseWhen->pElse = pElse; return (SNode*)pCaseWhen; +_err: + nodesDestroyNode(pCase); + nodesDestroyList(pWhenThenList); + nodesDestroyNode(pElse); + return NULL; } SNode* setProjectionAlias(SAstCreateContext* pCxt, SNode* pNode, SToken* pAlias) { @@ -1350,6 +1487,9 @@ SNode* setProjectionAlias(SAstCreateContext* pCxt, SNode* pNode, SToken* pAlias) pExpr->userAlias[len] = '\0'; pExpr->asAlias = true; return pNode; +_err: + nodesDestroyNode(pNode); + return NULL; } SNode* addWhereClause(SAstCreateContext* pCxt, SNode* pStmt, SNode* pWhere) { @@ -1358,6 +1498,10 @@ SNode* addWhereClause(SAstCreateContext* pCxt, SNode* pStmt, SNode* pWhere) { ((SSelectStmt*)pStmt)->pWhere = pWhere; } return pStmt; +_err: + nodesDestroyNode(pStmt); + nodesDestroyNode(pWhere); + return NULL; } SNode* addPartitionByClause(SAstCreateContext* pCxt, SNode* pStmt, SNodeList* pPartitionByList) { @@ -1366,6 +1510,10 @@ SNode* addPartitionByClause(SAstCreateContext* pCxt, SNode* pStmt, SNodeList* pP ((SSelectStmt*)pStmt)->pPartitionByList = pPartitionByList; } return pStmt; +_err: + nodesDestroyNode(pStmt); + nodesDestroyList(pPartitionByList); + return NULL; } SNode* addWindowClauseClause(SAstCreateContext* pCxt, SNode* pStmt, SNode* pWindow) { @@ -1374,6 +1522,10 @@ SNode* addWindowClauseClause(SAstCreateContext* pCxt, SNode* pStmt, SNode* pWind ((SSelectStmt*)pStmt)->pWindow = pWindow; } return pStmt; +_err: + nodesDestroyNode(pStmt); + nodesDestroyNode(pWindow); + return NULL; } SNode* addGroupByClause(SAstCreateContext* pCxt, SNode* pStmt, SNodeList* pGroupByList) { @@ -1382,6 +1534,10 @@ SNode* addGroupByClause(SAstCreateContext* pCxt, SNode* pStmt, SNodeList* pGroup ((SSelectStmt*)pStmt)->pGroupByList = pGroupByList; } return pStmt; +_err: + nodesDestroyNode(pStmt); + nodesDestroyList(pGroupByList); + return NULL; } SNode* addHavingClause(SAstCreateContext* pCxt, SNode* pStmt, SNode* pHaving) { @@ -1390,6 +1546,10 @@ SNode* addHavingClause(SAstCreateContext* pCxt, SNode* pStmt, SNode* pHaving) { ((SSelectStmt*)pStmt)->pHaving = pHaving; } return pStmt; +_err: + nodesDestroyNode(pStmt); + nodesDestroyNode(pHaving); + return NULL; } SNode* addOrderByClause(SAstCreateContext* pCxt, SNode* pStmt, SNodeList* pOrderByList) { @@ -1403,6 +1563,10 @@ SNode* addOrderByClause(SAstCreateContext* pCxt, SNode* pStmt, SNodeList* pOrder ((SSetOperator*)pStmt)->pOrderByList = pOrderByList; } return pStmt; +_err: + nodesDestroyNode(pStmt); + nodesDestroyList(pOrderByList); + return NULL; } SNode* addSlimitClause(SAstCreateContext* pCxt, SNode* pStmt, SNode* pSlimit) { @@ -1414,6 +1578,10 @@ SNode* addSlimitClause(SAstCreateContext* pCxt, SNode* pStmt, SNode* pSlimit) { ((SSelectStmt*)pStmt)->pSlimit = (SLimitNode*)pSlimit; } return pStmt; +_err: + nodesDestroyNode(pStmt); + nodesDestroyNode(pSlimit); + return NULL; } SNode* addLimitClause(SAstCreateContext* pCxt, SNode* pStmt, SNode* pLimit) { @@ -1427,6 +1595,10 @@ SNode* addLimitClause(SAstCreateContext* pCxt, SNode* pStmt, SNode* pLimit) { ((SSetOperator*)pStmt)->pLimit = pLimit; } return pStmt; +_err: + nodesDestroyNode(pStmt); + nodesDestroyNode(pLimit); + return NULL; } SNode* addRangeClause(SAstCreateContext* pCxt, SNode* pStmt, SNode* pRange) { @@ -1435,6 +1607,10 @@ SNode* addRangeClause(SAstCreateContext* pCxt, SNode* pStmt, SNode* pRange) { ((SSelectStmt*)pStmt)->pRange = pRange; } return pStmt; +_err: + nodesDestroyNode(pStmt); + nodesDestroyNode(pRange); + return NULL; } SNode* addEveryClause(SAstCreateContext* pCxt, SNode* pStmt, SNode* pEvery) { @@ -1443,6 +1619,10 @@ SNode* addEveryClause(SAstCreateContext* pCxt, SNode* pStmt, SNode* pEvery) { ((SSelectStmt*)pStmt)->pEvery = pEvery; } return pStmt; +_err: + nodesDestroyNode(pStmt); + nodesDestroyNode(pEvery); + return NULL; } SNode* addFillClause(SAstCreateContext* pCxt, SNode* pStmt, SNode* pFill) { @@ -1451,9 +1631,14 @@ SNode* addFillClause(SAstCreateContext* pCxt, SNode* pStmt, SNode* pFill) { SFillNode* pFillClause = (SFillNode*)pFill; nodesDestroyNode(pFillClause->pWStartTs); pFillClause->pWStartTs = createPrimaryKeyCol(pCxt, NULL); + CHECK_MAKE_NODE(pFillClause->pWStartTs); ((SSelectStmt*)pStmt)->pFill = (SNode*)pFillClause; } return pStmt; +_err: + nodesDestroyNode(pStmt); + nodesDestroyNode(pFill); + return NULL; } SNode* addJLimitClause(SAstCreateContext* pCxt, SNode* pJoin, SNode* pJLimit) { @@ -1465,6 +1650,10 @@ SNode* addJLimitClause(SAstCreateContext* pCxt, SNode* pJoin, SNode* pJLimit) { pJoinNode->pJLimit = pJLimit; return pJoin; +_err: + nodesDestroyNode(pJoin); + nodesDestroyNode(pJLimit); + return NULL; } SNode* addWindowOffsetClause(SAstCreateContext* pCxt, SNode* pJoin, SNode* pWinOffset) { @@ -1476,6 +1665,10 @@ SNode* addWindowOffsetClause(SAstCreateContext* pCxt, SNode* pJoin, SNode* pWinO pJoinNode->pWindowOffset = pWinOffset; return pJoin; +_err: + nodesDestroyNode(pJoin); + nodesDestroyNode(pWinOffset); + return NULL; } SNode* createSelectStmt(SAstCreateContext* pCxt, bool isDistinct, SNodeList* pProjectionList, SNode* pTable, @@ -1485,6 +1678,11 @@ SNode* createSelectStmt(SAstCreateContext* pCxt, bool isDistinct, SNodeList* pPr pCxt->errCode = createSelectStmtImpl(isDistinct, pProjectionList, pTable, pHint, &select); CHECK_MAKE_NODE(select); return select; +_err: + nodesDestroyList(pProjectionList); + nodesDestroyNode(pTable); + nodesDestroyList(pHint); + return NULL; } SNode* setSelectStmtTagMode(SAstCreateContext* pCxt, SNode* pStmt, bool bSelectTags) { @@ -1516,6 +1714,10 @@ SNode* createSetOperator(SAstCreateContext* pCxt, ESetOperatorType type, SNode* setSubquery(setOp->pRight); sprintf(setOp->stmtName, "%p", setOp); return (SNode*)setOp; +_err: + nodesDestroyNode(pLeft); + nodesDestroyNode(pRight); + return NULL; } static void updateWalOptionsDefault(SDatabaseOptions* pOptions) { @@ -1569,6 +1771,8 @@ SNode* createDefaultDatabaseOptions(SAstCreateContext* pCxt) { pOptions->withArbitrator = TSDB_DEFAULT_DB_WITH_ARBITRATOR; pOptions->encryptAlgorithm = TSDB_DEFAULT_ENCRYPT_ALGO; return (SNode*)pOptions; +_err: + return NULL; } SNode* createAlterDatabaseOptions(SAstCreateContext* pCxt) { @@ -1610,6 +1814,8 @@ SNode* createAlterDatabaseOptions(SAstCreateContext* pCxt) { pOptions->withArbitrator = -1; pOptions->encryptAlgorithm = -1; return (SNode*)pOptions; +_err: + return NULL; } static SNode* setDatabaseOptionImpl(SAstCreateContext* pCxt, SNode* pOptions, EDatabaseOptionType type, void* pVal, @@ -1751,6 +1957,9 @@ static SNode* setDatabaseOptionImpl(SAstCreateContext* pCxt, SNode* pOptions, ED break; } return pOptions; +_err: + nodesDestroyNode(pOptions); + return NULL; } SNode* setDatabaseOption(SAstCreateContext* pCxt, SNode* pOptions, EDatabaseOptionType type, void* pVal) { @@ -1767,13 +1976,15 @@ SNode* setAlterDatabaseOption(SAstCreateContext* pCxt, SNode* pOptions, SAlterOp break; } return setDatabaseOptionImpl(pCxt, pOptions, pAlterOption->type, &pAlterOption->val, true); +_err: + nodesDestroyNode(pOptions); + nodesDestroyList(pAlterOption->pList); + return NULL; } SNode* createCreateDatabaseStmt(SAstCreateContext* pCxt, bool ignoreExists, SToken* pDbName, SNode* pOptions) { CHECK_PARSER_STATUS(pCxt); - if (!checkDbName(pCxt, pDbName, false)) { - return NULL; - } + CHECK_NAME(checkDbName(pCxt, pDbName, false)); SCreateDatabaseStmt* pStmt = NULL; pCxt->errCode = nodesMakeNode(QUERY_NODE_CREATE_DATABASE_STMT, (SNode**)&pStmt); CHECK_MAKE_NODE(pStmt); @@ -1781,76 +1992,78 @@ SNode* createCreateDatabaseStmt(SAstCreateContext* pCxt, bool ignoreExists, STok pStmt->ignoreExists = ignoreExists; pStmt->pOptions = (SDatabaseOptions*)pOptions; return (SNode*)pStmt; +_err: + nodesDestroyNode(pOptions); + return NULL; } SNode* createDropDatabaseStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SToken* pDbName) { CHECK_PARSER_STATUS(pCxt); - if (!checkDbName(pCxt, pDbName, false)) { - return NULL; - } + CHECK_NAME(checkDbName(pCxt, pDbName, false)); SDropDatabaseStmt* pStmt = NULL; pCxt->errCode = nodesMakeNode(QUERY_NODE_DROP_DATABASE_STMT, (SNode**)&pStmt); CHECK_MAKE_NODE(pStmt); COPY_STRING_FORM_ID_TOKEN(pStmt->dbName, pDbName); pStmt->ignoreNotExists = ignoreNotExists; return (SNode*)pStmt; +_err: + return NULL; } SNode* createAlterDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName, SNode* pOptions) { CHECK_PARSER_STATUS(pCxt); - if (!checkDbName(pCxt, pDbName, false)) { - return NULL; - } + CHECK_NAME(checkDbName(pCxt, pDbName, false)); SAlterDatabaseStmt* pStmt = NULL; pCxt->errCode = nodesMakeNode(QUERY_NODE_ALTER_DATABASE_STMT, (SNode**)&pStmt); CHECK_MAKE_NODE(pStmt); COPY_STRING_FORM_ID_TOKEN(pStmt->dbName, pDbName); pStmt->pOptions = (SDatabaseOptions*)pOptions; return (SNode*)pStmt; +_err: + nodesDestroyNode(pOptions); + return NULL; } SNode* createFlushDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName) { CHECK_PARSER_STATUS(pCxt); - if (!checkDbName(pCxt, pDbName, false)) { - return NULL; - } + CHECK_NAME(checkDbName(pCxt, pDbName, false)); SFlushDatabaseStmt* pStmt = NULL; pCxt->errCode = nodesMakeNode(QUERY_NODE_FLUSH_DATABASE_STMT, (SNode**)&pStmt); CHECK_MAKE_NODE(pStmt); COPY_STRING_FORM_ID_TOKEN(pStmt->dbName, pDbName); return (SNode*)pStmt; +_err: + return NULL; } SNode* createTrimDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName, int32_t maxSpeed) { CHECK_PARSER_STATUS(pCxt); - if (!checkDbName(pCxt, pDbName, false)) { - return NULL; - } + CHECK_NAME(checkDbName(pCxt, pDbName, false)); STrimDatabaseStmt* pStmt = NULL; pCxt->errCode = nodesMakeNode(QUERY_NODE_TRIM_DATABASE_STMT, (SNode**)&pStmt); CHECK_MAKE_NODE(pStmt); COPY_STRING_FORM_ID_TOKEN(pStmt->dbName, pDbName); pStmt->maxSpeed = maxSpeed; return (SNode*)pStmt; +_err: + return NULL; } SNode* createS3MigrateDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName) { CHECK_PARSER_STATUS(pCxt); - if (!checkDbName(pCxt, pDbName, false)) { - return NULL; - } + CHECK_NAME(checkDbName(pCxt, pDbName, false)); SS3MigrateDatabaseStmt* pStmt = NULL; pCxt->errCode = nodesMakeNode(QUERY_NODE_S3MIGRATE_DATABASE_STMT, (SNode**)&pStmt); CHECK_MAKE_NODE(pStmt); COPY_STRING_FORM_ID_TOKEN(pStmt->dbName, pDbName); return (SNode*)pStmt; +_err: + return NULL; } SNode* createCompactStmt(SAstCreateContext* pCxt, SToken* pDbName, SNode* pStart, SNode* pEnd) { CHECK_PARSER_STATUS(pCxt); - if (!checkDbName(pCxt, pDbName, false)) { - return NULL; - } + CHECK_NAME(checkDbName(pCxt, pDbName, false)); SCompactDatabaseStmt* pStmt = NULL; pCxt->errCode = nodesMakeNode(QUERY_NODE_COMPACT_DATABASE_STMT, (SNode**)&pStmt); CHECK_MAKE_NODE(pStmt); @@ -1858,6 +2071,10 @@ SNode* createCompactStmt(SAstCreateContext* pCxt, SToken* pDbName, SNode* pStart pStmt->pStart = pStart; pStmt->pEnd = pEnd; return (SNode*)pStmt; +_err: + nodesDestroyNode(pStart); + nodesDestroyNode(pEnd); + return NULL; } SNode* createDefaultTableOptions(SAstCreateContext* pCxt) { @@ -1872,6 +2089,8 @@ SNode* createDefaultTableOptions(SAstCreateContext* pCxt) { pOptions->ttl = TSDB_DEFAULT_TABLE_TTL; pOptions->commentNull = true; // mark null return (SNode*)pOptions; +_err: + return NULL; } SNode* createAlterTableOptions(SAstCreateContext* pCxt) { @@ -1882,6 +2101,8 @@ SNode* createAlterTableOptions(SAstCreateContext* pCxt) { pOptions->ttl = -1; pOptions->commentNull = true; // mark null return (SNode*)pOptions; +_err: + return NULL; } SNode* setTableOption(SAstCreateContext* pCxt, SNode* pOptions, ETableOptionType type, void* pVal) { @@ -1922,6 +2143,9 @@ SNode* setTableOption(SAstCreateContext* pCxt, SNode* pOptions, ETableOptionType break; } return pOptions; +_err: + nodesDestroyNode(pOptions); + return NULL; } SNode* createDefaultColumnOptions(SAstCreateContext* pCxt) { @@ -1932,49 +2156,78 @@ SNode* createDefaultColumnOptions(SAstCreateContext* pCxt) { pOptions->commentNull = true; pOptions->bPrimaryKey = false; return (SNode*)pOptions; +_err: + return NULL; } -SNode* setColumnOptions(SAstCreateContext* pCxt, SNode* pOptions, EColumnOptionType type, void* pVal) { +EColumnOptionType getColumnOptionType(const char* optionType) { + if (0 == strcasecmp(optionType, "ENCODE")) { + return COLUMN_OPTION_ENCODE; + } else if (0 == strcasecmp(optionType, "COMPRESS")) { + return COLUMN_OPTION_COMPRESS; + } else if (0 == strcasecmp(optionType, "LEVEL")) { + return COLUMN_OPTION_LEVEL; + } + return 0; +} +SNode* setColumnOptionsPK(SAstCreateContext* pCxt, SNode* pOptions) { CHECK_PARSER_STATUS(pCxt); + ((SColumnOptions*)pOptions)->bPrimaryKey = true; + return pOptions; +_err: + nodesDestroyNode(pOptions); + return NULL; +} + +SNode* setColumnOptions(SAstCreateContext* pCxt, SNode* pOptions, const SToken* pVal1, void* pVal2) { + CHECK_PARSER_STATUS(pCxt); + char optionType[TSDB_CL_OPTION_LEN]; + + memset(optionType, 0, TSDB_CL_OPTION_LEN); + strncpy(optionType, pVal1->z, TMIN(pVal1->n, TSDB_CL_OPTION_LEN)); + if (0 == strlen(optionType)) { + pCxt->errCode = TSDB_CODE_PAR_SYNTAX_ERROR; + return pOptions; + } + EColumnOptionType type = getColumnOptionType(optionType); switch (type) { case COLUMN_OPTION_ENCODE: memset(((SColumnOptions*)pOptions)->encode, 0, TSDB_CL_COMPRESS_OPTION_LEN); - COPY_STRING_FORM_STR_TOKEN(((SColumnOptions*)pOptions)->encode, (SToken*)pVal); + COPY_STRING_FORM_STR_TOKEN(((SColumnOptions*)pOptions)->encode, (SToken*)pVal2); if (0 == strlen(((SColumnOptions*)pOptions)->encode)) { pCxt->errCode = TSDB_CODE_TSC_ENCODE_PARAM_ERROR; } break; case COLUMN_OPTION_COMPRESS: memset(((SColumnOptions*)pOptions)->compress, 0, TSDB_CL_COMPRESS_OPTION_LEN); - COPY_STRING_FORM_STR_TOKEN(((SColumnOptions*)pOptions)->compress, (SToken*)pVal); + COPY_STRING_FORM_STR_TOKEN(((SColumnOptions*)pOptions)->compress, (SToken*)pVal2); if (0 == strlen(((SColumnOptions*)pOptions)->compress)) { pCxt->errCode = TSDB_CODE_TSC_COMPRESS_PARAM_ERROR; } break; case COLUMN_OPTION_LEVEL: memset(((SColumnOptions*)pOptions)->compressLevel, 0, TSDB_CL_COMPRESS_OPTION_LEN); - COPY_STRING_FORM_STR_TOKEN(((SColumnOptions*)pOptions)->compressLevel, (SToken*)pVal); + COPY_STRING_FORM_STR_TOKEN(((SColumnOptions*)pOptions)->compressLevel, (SToken*)pVal2); if (0 == strlen(((SColumnOptions*)pOptions)->compressLevel)) { pCxt->errCode = TSDB_CODE_TSC_COMPRESS_LEVEL_ERROR; } break; - case COLUMN_OPTION_PRIMARYKEY: - ((SColumnOptions*)pOptions)->bPrimaryKey = true; - break; default: + pCxt->errCode = TSDB_CODE_PAR_SYNTAX_ERROR; break; } return pOptions; +_err: + nodesDestroyNode(pOptions); + return NULL; } SNode* createColumnDefNode(SAstCreateContext* pCxt, SToken* pColName, SDataType dataType, SNode* pNode) { CHECK_PARSER_STATUS(pCxt); - if (!checkColumnName(pCxt, pColName)) { - return NULL; - } + CHECK_NAME(checkColumnName(pCxt, pColName)); if (IS_VAR_DATA_TYPE(dataType.type) && dataType.bytes == 0) { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_VAR_COLUMN_LEN); - return NULL; + CHECK_PARSER_STATUS(pCxt); } SColumnDefNode* pCol = NULL; pCxt->errCode = nodesMakeNode(QUERY_NODE_COLUMN_DEF, (SNode**)&pCol); @@ -1984,6 +2237,9 @@ SNode* createColumnDefNode(SAstCreateContext* pCxt, SToken* pColName, SDataType pCol->pOptions = pNode; pCol->sma = true; return (SNode*)pCol; +_err: + nodesDestroyNode(pNode); + return NULL; } SDataType createDataType(uint8_t type) { @@ -2013,6 +2269,12 @@ SNode* createCreateTableStmt(SAstCreateContext* pCxt, bool ignoreExists, SNode* pStmt->pOptions = (STableOptions*)pOptions; nodesDestroyNode(pRealTable); return (SNode*)pStmt; +_err: + nodesDestroyNode(pRealTable); + nodesDestroyList(pCols); + nodesDestroyList(pTags); + nodesDestroyNode(pOptions); + return NULL; } SNode* createCreateSubTableClause(SAstCreateContext* pCxt, bool ignoreExists, SNode* pRealTable, SNode* pUseRealTable, @@ -2032,6 +2294,13 @@ SNode* createCreateSubTableClause(SAstCreateContext* pCxt, bool ignoreExists, SN nodesDestroyNode(pRealTable); nodesDestroyNode(pUseRealTable); return (SNode*)pStmt; +_err: + nodesDestroyNode(pRealTable); + nodesDestroyNode(pOptions); + nodesDestroyNode(pUseRealTable); + nodesDestroyList(pSpecificTags); + nodesDestroyList(pValsOfTags); + return NULL; } SNode* createCreateSubTableFromFileClause(SAstCreateContext* pCxt, bool ignoreExists, SNode* pUseRealTable, @@ -2052,6 +2321,10 @@ SNode* createCreateSubTableFromFileClause(SAstCreateContext* pCxt, bool ignoreEx nodesDestroyNode(pUseRealTable); return (SNode*)pStmt; +_err: + nodesDestroyNode(pUseRealTable); + nodesDestroyList(pSpecificTags); + return NULL; } SNode* createCreateMultiTableStmt(SAstCreateContext* pCxt, SNodeList* pSubTables) { @@ -2061,6 +2334,9 @@ SNode* createCreateMultiTableStmt(SAstCreateContext* pCxt, SNodeList* pSubTables CHECK_MAKE_NODE(pStmt); pStmt->pSubTables = pSubTables; return (SNode*)pStmt; +_err: + nodesDestroyList(pSubTables); + return NULL; } SNode* createDropTableClause(SAstCreateContext* pCxt, bool ignoreNotExists, SNode* pRealTable) { @@ -2073,6 +2349,9 @@ SNode* createDropTableClause(SAstCreateContext* pCxt, bool ignoreNotExists, SNod pStmt->ignoreNotExists = ignoreNotExists; nodesDestroyNode(pRealTable); return (SNode*)pStmt; +_err: + nodesDestroyNode(pRealTable); + return NULL; } SNode* createDropTableStmt(SAstCreateContext* pCxt, SNodeList* pTables) { @@ -2082,6 +2361,9 @@ SNode* createDropTableStmt(SAstCreateContext* pCxt, SNodeList* pTables) { CHECK_MAKE_NODE(pStmt); pStmt->pTables = pTables; return (SNode*)pStmt; +_err: + nodesDestroyList(pTables); + return NULL; } SNode* createDropSuperTableStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SNode* pRealTable) { @@ -2094,6 +2376,9 @@ SNode* createDropSuperTableStmt(SAstCreateContext* pCxt, bool ignoreNotExists, S pStmt->ignoreNotExists = ignoreNotExists; nodesDestroyNode(pRealTable); return (SNode*)pStmt; +_err: + nodesDestroyNode(pRealTable); + return NULL; } static SNode* createAlterTableStmtFinalize(SNode* pRealTable, SAlterTableStmt* pStmt) { @@ -2111,14 +2396,16 @@ SNode* createAlterTableModifyOptions(SAstCreateContext* pCxt, SNode* pRealTable, pStmt->alterType = TSDB_ALTER_TABLE_UPDATE_OPTIONS; pStmt->pOptions = (STableOptions*)pOptions; return createAlterTableStmtFinalize(pRealTable, pStmt); +_err: + nodesDestroyNode(pRealTable); + nodesDestroyNode(pOptions); + return NULL; } SNode* createAlterTableAddModifyCol(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType, SToken* pColName, SDataType dataType) { CHECK_PARSER_STATUS(pCxt); - if (!checkColumnName(pCxt, pColName)) { - return NULL; - } + CHECK_NAME(checkColumnName(pCxt, pColName)); SAlterTableStmt* pStmt = NULL; pCxt->errCode = nodesMakeNode(QUERY_NODE_ALTER_TABLE_STMT, (SNode**)&pStmt); CHECK_MAKE_NODE(pStmt); @@ -2126,15 +2413,15 @@ SNode* createAlterTableAddModifyCol(SAstCreateContext* pCxt, SNode* pRealTable, COPY_STRING_FORM_ID_TOKEN(pStmt->colName, pColName); pStmt->dataType = dataType; return createAlterTableStmtFinalize(pRealTable, pStmt); +_err: + nodesDestroyNode(pRealTable); + return NULL; } SNode* createAlterTableAddModifyColOptions2(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType, SToken* pColName, SDataType dataType, SNode* pOptions) { - CHECK_PARSER_STATUS(pCxt); - if (!checkColumnName(pCxt, pColName)) { - return NULL; - } - SAlterTableStmt* pStmt = NULL; + CHECK_PARSER_STATUS(pCxt); + CHECK_NAME(checkColumnName(pCxt, pColName)); pCxt->errCode = nodesMakeNode(QUERY_NODE_ALTER_TABLE_STMT, (SNode**)&pStmt); CHECK_MAKE_NODE(pStmt); pStmt->alterType = alterType; @@ -2155,19 +2442,21 @@ SNode* createAlterTableAddModifyColOptions2(SAstCreateContext* pCxt, SNode* pRea } else { pCxt->errCode = generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, "not support alter column with option except compress"); - nodesDestroyNode((SNode*)pStmt); - return NULL; + CHECK_PARSER_STATUS(pCxt); } } return createAlterTableStmtFinalize(pRealTable, pStmt); +_err: + nodesDestroyNode(pOptions); + nodesDestroyNode((SNode*)pStmt); + nodesDestroyNode(pRealTable); + return NULL; } SNode* createAlterTableAddModifyColOptions(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType, SToken* pColName, SNode* pOptions) { CHECK_PARSER_STATUS(pCxt); - if (!checkColumnName(pCxt, pColName)) { - return NULL; - } + CHECK_NAME(checkColumnName(pCxt, pColName)); SAlterTableStmt* pStmt = NULL; pCxt->errCode = nodesMakeNode(QUERY_NODE_ALTER_TABLE_STMT, (SNode**)&pStmt); CHECK_MAKE_NODE(pStmt); @@ -2175,27 +2464,31 @@ SNode* createAlterTableAddModifyColOptions(SAstCreateContext* pCxt, SNode* pReal COPY_STRING_FORM_ID_TOKEN(pStmt->colName, pColName); pStmt->pColOptions = (SColumnOptions*)pOptions; return createAlterTableStmtFinalize(pRealTable, pStmt); +_err: + nodesDestroyNode(pOptions); + nodesDestroyNode(pRealTable); + return NULL; } SNode* createAlterTableDropCol(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType, SToken* pColName) { CHECK_PARSER_STATUS(pCxt); - if (!checkColumnName(pCxt, pColName)) { - return NULL; - } + CHECK_NAME(checkColumnName(pCxt, pColName)); SAlterTableStmt* pStmt = NULL; pCxt->errCode = nodesMakeNode(QUERY_NODE_ALTER_TABLE_STMT, (SNode**)&pStmt); CHECK_MAKE_NODE(pStmt); pStmt->alterType = alterType; COPY_STRING_FORM_ID_TOKEN(pStmt->colName, pColName); return createAlterTableStmtFinalize(pRealTable, pStmt); +_err: + nodesDestroyNode(pRealTable); + return NULL; } SNode* createAlterTableRenameCol(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType, SToken* pOldColName, SToken* pNewColName) { CHECK_PARSER_STATUS(pCxt); - if (!checkColumnName(pCxt, pOldColName) || !checkColumnName(pCxt, pNewColName)) { - return NULL; - } + CHECK_NAME(checkColumnName(pCxt, pOldColName)); + CHECK_NAME(checkColumnName(pCxt, pNewColName)); SAlterTableStmt* pStmt = NULL; pCxt->errCode = nodesMakeNode(QUERY_NODE_ALTER_TABLE_STMT, (SNode**)&pStmt); CHECK_MAKE_NODE(pStmt); @@ -2203,14 +2496,14 @@ SNode* createAlterTableRenameCol(SAstCreateContext* pCxt, SNode* pRealTable, int COPY_STRING_FORM_ID_TOKEN(pStmt->colName, pOldColName); COPY_STRING_FORM_ID_TOKEN(pStmt->newColName, pNewColName); return createAlterTableStmtFinalize(pRealTable, pStmt); +_err: + nodesDestroyNode(pRealTable); + return NULL; } SNode* createAlterTableSetTag(SAstCreateContext* pCxt, SNode* pRealTable, SToken* pTagName, SNode* pVal) { CHECK_PARSER_STATUS(pCxt); - if (!checkColumnName(pCxt, pTagName)) { - nodesDestroyNode(pVal); - return NULL; - } + CHECK_NAME(checkColumnName(pCxt, pTagName)); SAlterTableStmt* pStmt = NULL; pCxt->errCode = nodesMakeNode(QUERY_NODE_ALTER_TABLE_STMT, (SNode**)&pStmt); CHECK_MAKE_NODE(pStmt); @@ -2218,6 +2511,10 @@ SNode* createAlterTableSetTag(SAstCreateContext* pCxt, SNode* pRealTable, SToken COPY_STRING_FORM_ID_TOKEN(pStmt->colName, pTagName); pStmt->pVal = (SValueNode*)pVal; return createAlterTableStmtFinalize(pRealTable, pStmt); +_err: + nodesDestroyNode(pVal); + nodesDestroyNode(pRealTable); + return NULL; } SNode* setAlterSuperTableType(SNode* pStmt) { @@ -2228,14 +2525,14 @@ SNode* setAlterSuperTableType(SNode* pStmt) { SNode* createUseDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName) { CHECK_PARSER_STATUS(pCxt); - if (!checkDbName(pCxt, pDbName, false)) { - return NULL; - } + CHECK_NAME(checkDbName(pCxt, pDbName, false)); SUseDatabaseStmt* pStmt = NULL; pCxt->errCode = nodesMakeNode(QUERY_NODE_USE_DATABASE_STMT, (SNode**)&pStmt); CHECK_MAKE_NODE(pStmt); COPY_STRING_FORM_ID_TOKEN(pStmt->dbName, pDbName); return (SNode*)pStmt; +_err: + return NULL; } static bool needDbShowStmt(ENodeType type) { @@ -2252,6 +2549,8 @@ SNode* createShowStmt(SAstCreateContext* pCxt, ENodeType type) { CHECK_MAKE_NODE(pStmt); pStmt->withFull = false; return (SNode*)pStmt; +_err: + return NULL; } SNode* createShowStmtWithFull(SAstCreateContext* pCxt, ENodeType type) { @@ -2261,6 +2560,8 @@ SNode* createShowStmtWithFull(SAstCreateContext* pCxt, ENodeType type) { CHECK_MAKE_NODE(pStmt); pStmt->withFull = true; return (SNode*)pStmt; +_err: + return NULL; } SNode* createShowCompactsStmt(SAstCreateContext* pCxt, ENodeType type) { @@ -2269,6 +2570,8 @@ SNode* createShowCompactsStmt(SAstCreateContext* pCxt, ENodeType type) { pCxt->errCode = nodesMakeNode(type, (SNode**)&pStmt); CHECK_MAKE_NODE(pStmt); return (SNode*)pStmt; +_err: + return NULL; } SNode* setShowKind(SAstCreateContext* pCxt, SNode* pStmt, EShowKind showKind) { @@ -2286,7 +2589,7 @@ SNode* createShowStmtWithCond(SAstCreateContext* pCxt, ENodeType type, SNode* pD if (needDbShowStmt(type) && NULL == pDbName) { snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, "database not specified"); pCxt->errCode = TSDB_CODE_PAR_SYNTAX_ERROR; - return NULL; + CHECK_PARSER_STATUS(pCxt); } SShowStmt* pStmt = NULL; pCxt->errCode = nodesMakeNode(type, (SNode**)&pStmt); @@ -2295,6 +2598,10 @@ SNode* createShowStmtWithCond(SAstCreateContext* pCxt, ENodeType type, SNode* pD pStmt->pTbName = pTbName; pStmt->tableCondType = tableCondType; return (SNode*)pStmt; +_err: + nodesDestroyNode(pDbName); + nodesDestroyNode(pTbName); + return NULL; } SNode* createShowTablesStmt(SAstCreateContext* pCxt, SShowTablesOption option, SNode* pTbName, @@ -2307,20 +2614,24 @@ SNode* createShowTablesStmt(SAstCreateContext* pCxt, SShowTablesOption option, S pDbName = createIdentifierValueNode(pCxt, &option.dbName); } SNode* pStmt = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, pDbName, pTbName, tableCondType); + CHECK_PARSER_STATUS(pCxt); (void)setShowKind(pCxt, pStmt, option.kind); return pStmt; +_err: + nodesDestroyNode(pTbName); + return NULL; } SNode* createShowCreateDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName) { CHECK_PARSER_STATUS(pCxt); - if (!checkDbName(pCxt, pDbName, true)) { - return NULL; - } + CHECK_NAME(checkDbName(pCxt, pDbName, true)); SShowCreateDatabaseStmt* pStmt = NULL; pCxt->errCode = nodesMakeNode(QUERY_NODE_SHOW_CREATE_DATABASE_STMT, (SNode**)&pStmt); CHECK_MAKE_NODE(pStmt); COPY_STRING_FORM_ID_TOKEN(pStmt->dbName, pDbName); return (SNode*)pStmt; +_err: + return NULL; } SNode* createShowAliveStmt(SAstCreateContext* pCxt, SNode* pNode, ENodeType type) { @@ -2337,19 +2648,13 @@ SNode* createShowAliveStmt(SAstCreateContext* pCxt, SNode* pNode, ENodeType type } } - if (pDbToken && !checkDbName(pCxt, pDbToken, true)) { - nodesDestroyNode(pNode); - return NULL; + if (pDbToken) { + CHECK_NAME(checkDbName(pCxt, pDbToken, true)); } SShowAliveStmt* pStmt = NULL; pCxt->errCode = nodesMakeNode(type, (SNode**)&pStmt); - if (TSDB_CODE_SUCCESS != pCxt->errCode) { - if (pNode) { - nodesDestroyNode(pNode); - } - return NULL; - } + CHECK_PARSER_STATUS(pCxt); if (pDbToken) { COPY_STRING_FORM_ID_TOKEN(pStmt->dbName, pDbToken); @@ -2359,6 +2664,9 @@ SNode* createShowAliveStmt(SAstCreateContext* pCxt, SNode* pNode, ENodeType type } return (SNode*)pStmt; +_err: + nodesDestroyNode(pNode); + return NULL; } SNode* createShowCreateTableStmt(SAstCreateContext* pCxt, ENodeType type, SNode* pRealTable) { @@ -2370,6 +2678,9 @@ SNode* createShowCreateTableStmt(SAstCreateContext* pCxt, ENodeType type, SNode* strcpy(pStmt->tableName, ((SRealTableNode*)pRealTable)->table.tableName); nodesDestroyNode(pRealTable); return (SNode*)pStmt; +_err: + nodesDestroyNode(pRealTable); + return NULL; } SNode* createShowCreateViewStmt(SAstCreateContext* pCxt, ENodeType type, SNode* pRealTable) { @@ -2381,6 +2692,9 @@ SNode* createShowCreateViewStmt(SAstCreateContext* pCxt, ENodeType type, SNode* strcpy(pStmt->viewName, ((SRealTableNode*)pRealTable)->table.tableName); nodesDestroyNode(pRealTable); return (SNode*)pStmt; +_err: + nodesDestroyNode(pRealTable); + return NULL; } SNode* createShowTableDistributedStmt(SAstCreateContext* pCxt, SNode* pRealTable) { @@ -2392,6 +2706,9 @@ SNode* createShowTableDistributedStmt(SAstCreateContext* pCxt, SNode* pRealTable strcpy(pStmt->tableName, ((SRealTableNode*)pRealTable)->table.tableName); nodesDestroyNode(pRealTable); return (SNode*)pStmt; +_err: + nodesDestroyNode(pRealTable); + return NULL; } SNode* createShowDnodeVariablesStmt(SAstCreateContext* pCxt, SNode* pDnodeId, SNode* pLikePattern) { @@ -2402,6 +2719,10 @@ SNode* createShowDnodeVariablesStmt(SAstCreateContext* pCxt, SNode* pDnodeId, SN pStmt->pDnodeId = pDnodeId; pStmt->pLikePattern = pLikePattern; return (SNode*)pStmt; +_err: + nodesDestroyNode(pDnodeId); + nodesDestroyNode(pLikePattern); + return NULL; } SNode* createShowVnodesStmt(SAstCreateContext* pCxt, SNode* pDnodeId, SNode* pDnodeEndpoint) { @@ -2412,6 +2733,10 @@ SNode* createShowVnodesStmt(SAstCreateContext* pCxt, SNode* pDnodeId, SNode* pDn pStmt->pDnodeId = pDnodeId; pStmt->pDnodeEndpoint = pDnodeEndpoint; return (SNode*)pStmt; +_err: + nodesDestroyNode(pDnodeId); + nodesDestroyNode(pDnodeEndpoint); + return NULL; } SNode* createShowTableTagsStmt(SAstCreateContext* pCxt, SNode* pTbName, SNode* pDbName, SNodeList* pTags) { @@ -2419,7 +2744,7 @@ SNode* createShowTableTagsStmt(SAstCreateContext* pCxt, SNode* pTbName, SNode* p if (NULL == pDbName) { snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, "database not specified"); pCxt->errCode = TSDB_CODE_PAR_SYNTAX_ERROR; - return NULL; + CHECK_PARSER_STATUS(pCxt); } SShowTableTagsStmt* pStmt = NULL; pCxt->errCode = nodesMakeNode(QUERY_NODE_SHOW_TABLE_TAGS_STMT, (SNode**)&pStmt); @@ -2428,6 +2753,11 @@ SNode* createShowTableTagsStmt(SAstCreateContext* pCxt, SNode* pTbName, SNode* p pStmt->pTbName = pTbName; pStmt->pTags = pTags; return (SNode*)pStmt; +_err: + nodesDestroyNode(pTbName); + nodesDestroyNode(pDbName); + nodesDestroyList(pTags); + return NULL; } SNode* createShowCompactDetailsStmt(SAstCreateContext* pCxt, SNode* pCompactId) { @@ -2437,6 +2767,9 @@ SNode* createShowCompactDetailsStmt(SAstCreateContext* pCxt, SNode* pCompactId) CHECK_MAKE_NODE(pStmt); pStmt->pCompactId = pCompactId; return (SNode*)pStmt; +_err: + nodesDestroyNode(pCompactId); + return NULL; } static int32_t getIpV4RangeFromWhitelistItem(char* ipRange, SIpV4Range* pIpRange) { @@ -2503,27 +2836,24 @@ SNode* addCreateUserStmtWhiteList(SAstCreateContext* pCxt, SNode* pCreateUserStm SCreateUserStmt* pCreateUser = (SCreateUserStmt*)pCreateUserStmt; pCreateUser->numIpRanges = LIST_LENGTH(pIpRangesNodeList); pCreateUser->pIpRanges = taosMemoryMalloc(pCreateUser->numIpRanges * sizeof(SIpV4Range)); - if (NULL == pCreateUser->pIpRanges) { - pCxt->errCode = TSDB_CODE_OUT_OF_MEMORY; - nodesDestroyNode(pCreateUserStmt); - return NULL; - } + CHECK_OUT_OF_MEM(pCreateUser->pIpRanges); + + pCxt->errCode = fillIpRangesFromWhiteList(pCxt, pIpRangesNodeList, pCreateUser->pIpRanges); + CHECK_PARSER_STATUS(pCxt); - int32_t code = fillIpRangesFromWhiteList(pCxt, pIpRangesNodeList, pCreateUser->pIpRanges); - if (TSDB_CODE_SUCCESS != code) { - nodesDestroyNode(pCreateUserStmt); - return NULL; - } return pCreateUserStmt; +_err: + nodesDestroyNode(pCreateUserStmt); + nodesDestroyList(pIpRangesNodeList); + return NULL; } SNode* createCreateUserStmt(SAstCreateContext* pCxt, SToken* pUserName, const SToken* pPassword, int8_t sysinfo, int8_t createDb, int8_t is_import) { CHECK_PARSER_STATUS(pCxt); char password[TSDB_USET_PASSWORD_LEN + 3] = {0}; - if (!checkUserName(pCxt, pUserName) || !checkPassword(pCxt, pPassword, password)) { - return NULL; - } + CHECK_NAME(checkUserName(pCxt, pUserName)); + CHECK_NAME(checkPassword(pCxt, pPassword, password)); SCreateUserStmt* pStmt = NULL; pCxt->errCode = nodesMakeNode(QUERY_NODE_CREATE_USER_STMT, (SNode**)&pStmt); CHECK_MAKE_NODE(pStmt); @@ -2533,14 +2863,14 @@ SNode* createCreateUserStmt(SAstCreateContext* pCxt, SToken* pUserName, const ST pStmt->createDb = createDb; pStmt->isImport = is_import; return (SNode*)pStmt; +_err: + return NULL; } SNode* createAlterUserStmt(SAstCreateContext* pCxt, SToken* pUserName, int8_t alterType, void* pAlterInfo) { - CHECK_PARSER_STATUS(pCxt); - if (!checkUserName(pCxt, pUserName)) { - return NULL; - } SAlterUserStmt* pStmt = NULL; + CHECK_PARSER_STATUS(pCxt); + CHECK_NAME(checkUserName(pCxt, pUserName)); pCxt->errCode = nodesMakeNode(QUERY_NODE_ALTER_USER_STMT, (SNode**)&pStmt); CHECK_MAKE_NODE(pStmt); COPY_STRING_FORM_ID_TOKEN(pStmt->userName, pUserName); @@ -2549,10 +2879,7 @@ SNode* createAlterUserStmt(SAstCreateContext* pCxt, SToken* pUserName, int8_t al case TSDB_ALTER_USER_PASSWD: { char password[TSDB_USET_PASSWORD_LEN] = {0}; SToken* pVal = pAlterInfo; - if (!checkPassword(pCxt, pVal, password)) { - nodesDestroyNode((SNode*)pStmt); - return NULL; - } + CHECK_NAME(checkPassword(pCxt, pVal, password)); strcpy(pStmt->password, password); break; } @@ -2577,35 +2904,31 @@ SNode* createAlterUserStmt(SAstCreateContext* pCxt, SToken* pUserName, int8_t al pStmt->pNodeListIpRanges = pIpRangesNodeList; pStmt->numIpRanges = LIST_LENGTH(pIpRangesNodeList); pStmt->pIpRanges = taosMemoryMalloc(pStmt->numIpRanges * sizeof(SIpV4Range)); - if (NULL == pStmt->pIpRanges) { - pCxt->errCode = TSDB_CODE_OUT_OF_MEMORY; - nodesDestroyNode((SNode*)pStmt); - return NULL; - } + CHECK_OUT_OF_MEM(pStmt->pIpRanges); - int32_t code = fillIpRangesFromWhiteList(pCxt, pIpRangesNodeList, pStmt->pIpRanges); - if (TSDB_CODE_SUCCESS != code) { - nodesDestroyNode((SNode*)pStmt); - return NULL; - } + pCxt->errCode = fillIpRangesFromWhiteList(pCxt, pIpRangesNodeList, pStmt->pIpRanges); + CHECK_PARSER_STATUS(pCxt); break; } default: break; } return (SNode*)pStmt; +_err: + nodesDestroyNode((SNode*)pStmt); + return NULL; } SNode* createDropUserStmt(SAstCreateContext* pCxt, SToken* pUserName) { CHECK_PARSER_STATUS(pCxt); - if (!checkUserName(pCxt, pUserName)) { - return NULL; - } + CHECK_NAME(checkUserName(pCxt, pUserName)); SDropUserStmt* pStmt = NULL; pCxt->errCode = nodesMakeNode(QUERY_NODE_DROP_USER_STMT, (SNode**)&pStmt); CHECK_MAKE_NODE(pStmt); COPY_STRING_FORM_ID_TOKEN(pStmt->userName, pUserName); return (SNode*)pStmt; +_err: + return NULL; } SNode* createCreateDnodeStmt(SAstCreateContext* pCxt, const SToken* pFqdn, const SToken* pPort) { @@ -2618,6 +2941,8 @@ SNode* createCreateDnodeStmt(SAstCreateContext* pCxt, const SToken* pFqdn, const return NULL; } return (SNode*)pStmt; +_err: + return NULL; } SNode* createDropDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode, bool force, bool unsafe) { @@ -2636,6 +2961,8 @@ SNode* createDropDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode, bool f pStmt->force = force; pStmt->unsafe = unsafe; return (SNode*)pStmt; +_err: + return NULL; } SNode* createAlterDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode, const SToken* pConfig, @@ -2654,6 +2981,8 @@ SNode* createAlterDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode, const (void)trimString(pValue->z, pValue->n, pStmt->value, sizeof(pStmt->value)); } return (SNode*)pStmt; +_err: + return NULL; } SNode* createEncryptKeyStmt(SAstCreateContext* pCxt, const SToken* pValue) { @@ -2685,10 +3014,7 @@ SNode* createCreateIndexStmt(SAstCreateContext* pCxt, EIndexType type, bool igno // no db specified, if (pCxt->pQueryCxt->db == NULL) { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_DB_NOT_SPECIFIED); - nodesDestroyNode(pIndexName); - nodesDestroyNode(pRealTable); - nodesDestroyNode(pOptions); - return NULL; + CHECK_PARSER_STATUS(pCxt); } else { snprintf(pStmt->indexDbName, sizeof(pStmt->indexDbName), "%s", pCxt->pQueryCxt->db); } @@ -2703,6 +3029,12 @@ SNode* createCreateIndexStmt(SAstCreateContext* pCxt, EIndexType type, bool igno pStmt->pCols = pCols; pStmt->pOptions = (SIndexOptions*)pOptions; return (SNode*)pStmt; +_err: + nodesDestroyNode(pIndexName); + nodesDestroyNode(pRealTable); + nodesDestroyNode(pOptions); + nodesDestroyList(pCols); + return NULL; } SNode* createIndexOption(SAstCreateContext* pCxt, SNodeList* pFuncs, SNode* pInterval, SNode* pOffset, SNode* pSliding, @@ -2717,6 +3049,12 @@ SNode* createIndexOption(SAstCreateContext* pCxt, SNodeList* pFuncs, SNode* pInt pOptions->pSliding = pSliding; pOptions->pStreamOptions = pStreamOptions; return (SNode*)pOptions; +_err: + nodesDestroyNode(pInterval); + nodesDestroyNode(pOffset); + nodesDestroyNode(pSliding); + nodesDestroyNode(pStreamOptions); + return NULL; } SNode* createDropIndexStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SNode* pIndexName) { @@ -2729,6 +3067,9 @@ SNode* createDropIndexStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SNode* snprintf(pStmt->indexName, sizeof(pStmt->indexName), "%s", ((SRealTableNode*)pIndexName)->table.tableName); nodesDestroyNode(pIndexName); return (SNode*)pStmt; +_err: + nodesDestroyNode(pIndexName); + return NULL; } SNode* createCreateComponentNodeStmt(SAstCreateContext* pCxt, ENodeType type, const SToken* pDnodeId) { @@ -2738,6 +3079,8 @@ SNode* createCreateComponentNodeStmt(SAstCreateContext* pCxt, ENodeType type, co CHECK_MAKE_NODE(pStmt); pStmt->dnodeId = taosStr2Int32(pDnodeId->z, NULL, 10); return (SNode*)pStmt; +_err: + return NULL; } SNode* createDropComponentNodeStmt(SAstCreateContext* pCxt, ENodeType type, const SToken* pDnodeId) { @@ -2747,6 +3090,8 @@ SNode* createDropComponentNodeStmt(SAstCreateContext* pCxt, ENodeType type, cons CHECK_MAKE_NODE(pStmt); pStmt->dnodeId = taosStr2Int32(pDnodeId->z, NULL, 10); return (SNode*)pStmt; +_err: + return NULL; } SNode* createRestoreComponentNodeStmt(SAstCreateContext* pCxt, ENodeType type, const SToken* pDnodeId) { @@ -2756,14 +3101,13 @@ SNode* createRestoreComponentNodeStmt(SAstCreateContext* pCxt, ENodeType type, c CHECK_MAKE_NODE(pStmt); pStmt->dnodeId = taosStr2Int32(pDnodeId->z, NULL, 10); return (SNode*)pStmt; +_err: + return NULL; } SNode* createCreateTopicStmtUseQuery(SAstCreateContext* pCxt, bool ignoreExists, SToken* pTopicName, SNode* pQuery) { CHECK_PARSER_STATUS(pCxt); - if (!checkTopicName(pCxt, pTopicName)) { - nodesDestroyNode(pQuery); - return NULL; - } + CHECK_NAME(checkTopicName(pCxt, pTopicName)); SCreateTopicStmt* pStmt = NULL; pCxt->errCode = nodesMakeNode(QUERY_NODE_CREATE_TOPIC_STMT, (SNode**)&pStmt); CHECK_MAKE_NODE(pStmt); @@ -2771,14 +3115,16 @@ SNode* createCreateTopicStmtUseQuery(SAstCreateContext* pCxt, bool ignoreExists, pStmt->ignoreExists = ignoreExists; pStmt->pQuery = pQuery; return (SNode*)pStmt; +_err: + nodesDestroyNode(pQuery); + return NULL; } SNode* createCreateTopicStmtUseDb(SAstCreateContext* pCxt, bool ignoreExists, SToken* pTopicName, SToken* pSubDbName, int8_t withMeta) { CHECK_PARSER_STATUS(pCxt); - if (!checkTopicName(pCxt, pTopicName) || !checkDbName(pCxt, pSubDbName, true)) { - return NULL; - } + CHECK_NAME(checkTopicName(pCxt, pTopicName)); + CHECK_NAME(checkDbName(pCxt, pSubDbName, true)); SCreateTopicStmt* pStmt = NULL; pCxt->errCode = nodesMakeNode(QUERY_NODE_CREATE_TOPIC_STMT, (SNode**)&pStmt); CHECK_MAKE_NODE(pStmt); @@ -2787,14 +3133,14 @@ SNode* createCreateTopicStmtUseDb(SAstCreateContext* pCxt, bool ignoreExists, ST COPY_STRING_FORM_ID_TOKEN(pStmt->subDbName, pSubDbName); pStmt->withMeta = withMeta; return (SNode*)pStmt; +_err: + return NULL; } SNode* createCreateTopicStmtUseTable(SAstCreateContext* pCxt, bool ignoreExists, SToken* pTopicName, SNode* pRealTable, int8_t withMeta, SNode* pWhere) { CHECK_PARSER_STATUS(pCxt); - if (!checkTopicName(pCxt, pTopicName)) { - return NULL; - } + CHECK_NAME(checkTopicName(pCxt, pTopicName)); SCreateTopicStmt* pStmt = NULL; pCxt->errCode = nodesMakeNode(QUERY_NODE_CREATE_TOPIC_STMT, (SNode**)&pStmt); CHECK_MAKE_NODE(pStmt); @@ -2807,29 +3153,29 @@ SNode* createCreateTopicStmtUseTable(SAstCreateContext* pCxt, bool ignoreExists, strcpy(pStmt->subSTbName, ((SRealTableNode*)pRealTable)->table.tableName); nodesDestroyNode(pRealTable); return (SNode*)pStmt; +_err: + nodesDestroyNode(pRealTable); + nodesDestroyNode(pWhere); + return NULL; } SNode* createDropTopicStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SToken* pTopicName) { CHECK_PARSER_STATUS(pCxt); - if (!checkTopicName(pCxt, pTopicName)) { - return NULL; - } + CHECK_NAME(checkTopicName(pCxt, pTopicName)); SDropTopicStmt* pStmt = NULL; pCxt->errCode = nodesMakeNode(QUERY_NODE_DROP_TOPIC_STMT, (SNode**)&pStmt); CHECK_MAKE_NODE(pStmt); COPY_STRING_FORM_ID_TOKEN(pStmt->topicName, pTopicName); pStmt->ignoreNotExists = ignoreNotExists; return (SNode*)pStmt; +_err: + return NULL; } SNode* createDropCGroupStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SToken* pCGroupId, SToken* pTopicName) { CHECK_PARSER_STATUS(pCxt); - if (!checkTopicName(pCxt, pTopicName)) { - return NULL; - } - if (!checkCGroupName(pCxt, pCGroupId)) { - return NULL; - } + CHECK_NAME(checkTopicName(pCxt, pTopicName)); + CHECK_NAME(checkCGroupName(pCxt, pCGroupId)); SDropCGroupStmt* pStmt = NULL; pCxt->errCode = nodesMakeNode(QUERY_NODE_DROP_CGROUP_STMT, (SNode**)&pStmt); CHECK_MAKE_NODE(pStmt); @@ -2837,6 +3183,8 @@ SNode* createDropCGroupStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SToke COPY_STRING_FORM_ID_TOKEN(pStmt->topicName, pTopicName); COPY_STRING_FORM_ID_TOKEN(pStmt->cgroup, pCGroupId); return (SNode*)pStmt; +_err: + return NULL; } SNode* createAlterClusterStmt(SAstCreateContext* pCxt, const SToken* pConfig, const SToken* pValue) { @@ -2849,6 +3197,8 @@ SNode* createAlterClusterStmt(SAstCreateContext* pCxt, const SToken* pConfig, co (void)trimString(pValue->z, pValue->n, pStmt->value, sizeof(pStmt->value)); } return (SNode*)pStmt; +_err: + return NULL; } SNode* createAlterLocalStmt(SAstCreateContext* pCxt, const SToken* pConfig, const SToken* pValue) { @@ -2861,6 +3211,8 @@ SNode* createAlterLocalStmt(SAstCreateContext* pCxt, const SToken* pConfig, cons (void)trimString(pValue->z, pValue->n, pStmt->value, sizeof(pStmt->value)); } return (SNode*)pStmt; +_err: + return NULL; } SNode* createDefaultExplainOptions(SAstCreateContext* pCxt) { @@ -2871,18 +3223,24 @@ SNode* createDefaultExplainOptions(SAstCreateContext* pCxt) { pOptions->verbose = TSDB_DEFAULT_EXPLAIN_VERBOSE; pOptions->ratio = TSDB_DEFAULT_EXPLAIN_RATIO; return (SNode*)pOptions; +_err: + return NULL; } SNode* setExplainVerbose(SAstCreateContext* pCxt, SNode* pOptions, const SToken* pVal) { CHECK_PARSER_STATUS(pCxt); ((SExplainOptions*)pOptions)->verbose = (0 == strncasecmp(pVal->z, "true", pVal->n)); return pOptions; +_err: + return NULL; } SNode* setExplainRatio(SAstCreateContext* pCxt, SNode* pOptions, const SToken* pVal) { CHECK_PARSER_STATUS(pCxt); ((SExplainOptions*)pOptions)->ratio = taosStr2Double(pVal->z, NULL); return pOptions; +_err: + return NULL; } SNode* createExplainStmt(SAstCreateContext* pCxt, bool analyze, SNode* pOptions, SNode* pQuery) { @@ -2894,6 +3252,10 @@ SNode* createExplainStmt(SAstCreateContext* pCxt, bool analyze, SNode* pOptions, pStmt->pOptions = (SExplainOptions*)pOptions; pStmt->pQuery = pQuery; return (SNode*)pStmt; +_err: + nodesDestroyNode(pOptions); + nodesDestroyNode(pQuery); + return NULL; } SNode* createDescribeStmt(SAstCreateContext* pCxt, SNode* pRealTable) { @@ -2905,6 +3267,9 @@ SNode* createDescribeStmt(SAstCreateContext* pCxt, SNode* pRealTable) { strcpy(pStmt->tableName, ((SRealTableNode*)pRealTable)->table.tableName); nodesDestroyNode(pRealTable); return (SNode*)pStmt; +_err: + nodesDestroyNode(pRealTable); + return NULL; } SNode* createResetQueryCacheStmt(SAstCreateContext* pCxt) { @@ -2913,6 +3278,8 @@ SNode* createResetQueryCacheStmt(SAstCreateContext* pCxt) { pCxt->errCode = nodesMakeNode(QUERY_NODE_RESET_QUERY_CACHE_STMT, (SNode**)&pStmt); CHECK_MAKE_NODE(pStmt); return pStmt; +_err: + return NULL; } static int32_t convertUdfLanguageType(SAstCreateContext* pCxt, const SToken* pLanguageToken, int8_t* pLanguage) { @@ -2933,12 +3300,11 @@ SNode* createCreateFunctionStmt(SAstCreateContext* pCxt, bool ignoreExists, bool CHECK_PARSER_STATUS(pCxt); if (pLibPath->n <= 2) { pCxt->errCode = TSDB_CODE_PAR_SYNTAX_ERROR; - return NULL; + CHECK_PARSER_STATUS(pCxt); } int8_t language = 0; - if (TSDB_CODE_SUCCESS != convertUdfLanguageType(pCxt, pLanguage, &language)) { - return NULL; - } + pCxt->errCode = convertUdfLanguageType(pCxt, pLanguage, &language); + CHECK_PARSER_STATUS(pCxt); SCreateFunctionStmt* pStmt = NULL; pCxt->errCode = nodesMakeNode(QUERY_NODE_CREATE_FUNCTION_STMT, (SNode**)&pStmt); CHECK_MAKE_NODE(pStmt); @@ -2951,6 +3317,8 @@ SNode* createCreateFunctionStmt(SAstCreateContext* pCxt, bool ignoreExists, bool pStmt->bufSize = bufSize; pStmt->language = language; return (SNode*)pStmt; +_err: + return NULL; } SNode* createDropFunctionStmt(SAstCreateContext* pCxt, bool ignoreNotExists, const SToken* pFuncName) { @@ -2961,11 +3329,13 @@ SNode* createDropFunctionStmt(SAstCreateContext* pCxt, bool ignoreNotExists, con pStmt->ignoreNotExists = ignoreNotExists; COPY_STRING_FORM_ID_TOKEN(pStmt->funcName, pFuncName); return (SNode*)pStmt; +_err: + return NULL; } SNode* createCreateViewStmt(SAstCreateContext* pCxt, bool orReplace, SNode* pView, const SToken* pAs, SNode* pQuery) { - CHECK_PARSER_STATUS(pCxt); SCreateViewStmt* pStmt = NULL; + CHECK_PARSER_STATUS(pCxt); pCxt->errCode = nodesMakeNode(QUERY_NODE_CREATE_VIEW_STMT, (SNode**)&pStmt); CHECK_MAKE_NODE(pStmt); int32_t i = pAs->n; @@ -2980,6 +3350,11 @@ SNode* createCreateViewStmt(SAstCreateContext* pCxt, bool orReplace, SNode* pVie pStmt->orReplace = orReplace; pStmt->pQuery = pQuery; return (SNode*)pStmt; +_err: + nodesDestroyNode(pView); + nodesDestroyNode(pQuery); + nodesDestroyNode((SNode*)pStmt); + return NULL; } SNode* createDropViewStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SNode* pView) { @@ -2992,6 +3367,9 @@ SNode* createDropViewStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SNode* strcpy(pStmt->viewName, ((SViewNode*)pView)->table.tableName); nodesDestroyNode(pView); return (SNode*)pStmt; +_err: + nodesDestroyNode(pView); + return NULL; } SNode* createStreamOptions(SAstCreateContext* pCxt) { @@ -3004,6 +3382,8 @@ SNode* createStreamOptions(SAstCreateContext* pCxt) { pOptions->ignoreExpired = STREAM_DEFAULT_IGNORE_EXPIRED; pOptions->ignoreUpdate = STREAM_DEFAULT_IGNORE_UPDATE; return (SNode*)pOptions; +_err: + return NULL; } static int8_t getTriggerType(uint32_t tokenType) { @@ -3062,11 +3442,7 @@ SNode* setStreamOptions(SAstCreateContext* pCxt, SNode* pOptions, EStreamOptions SNode* createCreateStreamStmt(SAstCreateContext* pCxt, bool ignoreExists, SToken* pStreamName, SNode* pRealTable, SNode* pOptions, SNodeList* pTags, SNode* pSubtable, SNode* pQuery, SNodeList* pCols) { CHECK_PARSER_STATUS(pCxt); - if (!checkStreamName(pCxt, pStreamName)) { - nodesDestroyNode(pQuery); - nodesDestroyNode(pOptions); - return NULL; - } + CHECK_NAME(checkStreamName(pCxt, pStreamName)); SCreateStreamStmt* pStmt = NULL; pCxt->errCode = nodesMakeNode(QUERY_NODE_CREATE_STREAM_STMT, (SNode**)&pStmt); CHECK_MAKE_NODE(pStmt); @@ -3081,40 +3457,46 @@ SNode* createCreateStreamStmt(SAstCreateContext* pCxt, bool ignoreExists, SToken pStmt->pSubtable = pSubtable; pStmt->pCols = pCols; return (SNode*)pStmt; +_err: + nodesDestroyNode(pRealTable); + nodesDestroyNode(pQuery); + nodesDestroyNode(pOptions); + nodesDestroyList(pTags); + nodesDestroyNode(pSubtable); + nodesDestroyList(pCols); + return NULL; } SNode* createDropStreamStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SToken* pStreamName) { CHECK_PARSER_STATUS(pCxt); - if (!checkStreamName(pCxt, pStreamName)) { - return NULL; - } + CHECK_NAME(checkStreamName(pCxt, pStreamName)); SDropStreamStmt* pStmt = NULL; pCxt->errCode = nodesMakeNode(QUERY_NODE_DROP_STREAM_STMT, (SNode**)&pStmt); CHECK_MAKE_NODE(pStmt); COPY_STRING_FORM_ID_TOKEN(pStmt->streamName, pStreamName); pStmt->ignoreNotExists = ignoreNotExists; return (SNode*)pStmt; +_err: + return NULL; } SNode* createPauseStreamStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SToken* pStreamName) { CHECK_PARSER_STATUS(pCxt); - if (!checkStreamName(pCxt, pStreamName)) { - return NULL; - } + CHECK_NAME(checkStreamName(pCxt, pStreamName)); SPauseStreamStmt* pStmt = NULL; pCxt->errCode = nodesMakeNode(QUERY_NODE_PAUSE_STREAM_STMT, (SNode**)&pStmt); CHECK_MAKE_NODE(pStmt); COPY_STRING_FORM_ID_TOKEN(pStmt->streamName, pStreamName); pStmt->ignoreNotExists = ignoreNotExists; return (SNode*)pStmt; +_err: + return NULL; } SNode* createResumeStreamStmt(SAstCreateContext* pCxt, bool ignoreNotExists, bool ignoreUntreated, SToken* pStreamName) { CHECK_PARSER_STATUS(pCxt); - if (!checkStreamName(pCxt, pStreamName)) { - return NULL; - } + CHECK_NAME(checkStreamName(pCxt, pStreamName)); SResumeStreamStmt* pStmt = NULL; pCxt->errCode = nodesMakeNode(QUERY_NODE_RESUME_STREAM_STMT, (SNode**)&pStmt); CHECK_MAKE_NODE(pStmt); @@ -3122,6 +3504,8 @@ SNode* createResumeStreamStmt(SAstCreateContext* pCxt, bool ignoreNotExists, boo pStmt->ignoreNotExists = ignoreNotExists; pStmt->ignoreUntreated = ignoreUntreated; return (SNode*)pStmt; +_err: + return NULL; } SNode* createKillStmt(SAstCreateContext* pCxt, ENodeType type, const SToken* pId) { @@ -3131,6 +3515,8 @@ SNode* createKillStmt(SAstCreateContext* pCxt, ENodeType type, const SToken* pId CHECK_MAKE_NODE(pStmt); pStmt->targetId = taosStr2Int32(pId->z, NULL, 10); return (SNode*)pStmt; +_err: + return NULL; } SNode* createKillQueryStmt(SAstCreateContext* pCxt, const SToken* pQueryId) { @@ -3140,6 +3526,8 @@ SNode* createKillQueryStmt(SAstCreateContext* pCxt, const SToken* pQueryId) { CHECK_MAKE_NODE(pStmt); (void)trimString(pQueryId->z, pQueryId->n, pStmt->queryId, sizeof(pStmt->queryId) - 1); return (SNode*)pStmt; +_err: + return NULL; } SNode* createBalanceVgroupStmt(SAstCreateContext* pCxt) { @@ -3148,6 +3536,8 @@ SNode* createBalanceVgroupStmt(SAstCreateContext* pCxt) { pCxt->errCode = nodesMakeNode(QUERY_NODE_BALANCE_VGROUP_STMT, (SNode**)&pStmt); CHECK_MAKE_NODE(pStmt); return (SNode*)pStmt; +_err: + return NULL; } SNode* createBalanceVgroupLeaderStmt(SAstCreateContext* pCxt, const SToken* pVgId) { @@ -3159,6 +3549,8 @@ SNode* createBalanceVgroupLeaderStmt(SAstCreateContext* pCxt, const SToken* pVgI pStmt->vgId = taosStr2Int32(pVgId->z, NULL, 10); } return (SNode*)pStmt; +_err: + return NULL; } SNode* createBalanceVgroupLeaderDBNameStmt(SAstCreateContext* pCxt, const SToken* pDbName) { @@ -3170,6 +3562,8 @@ SNode* createBalanceVgroupLeaderDBNameStmt(SAstCreateContext* pCxt, const SToken COPY_STRING_FORM_ID_TOKEN(pStmt->dbName, pDbName); } return (SNode*)pStmt; +_err: + return NULL; } SNode* createMergeVgroupStmt(SAstCreateContext* pCxt, const SToken* pVgId1, const SToken* pVgId2) { @@ -3180,6 +3574,8 @@ SNode* createMergeVgroupStmt(SAstCreateContext* pCxt, const SToken* pVgId1, cons pStmt->vgId1 = taosStr2Int32(pVgId1->z, NULL, 10); pStmt->vgId2 = taosStr2Int32(pVgId2->z, NULL, 10); return (SNode*)pStmt; +_err: + return NULL; } SNode* createRedistributeVgroupStmt(SAstCreateContext* pCxt, const SToken* pVgId, SNodeList* pDnodes) { @@ -3190,6 +3586,9 @@ SNode* createRedistributeVgroupStmt(SAstCreateContext* pCxt, const SToken* pVgId pStmt->vgId = taosStr2Int32(pVgId->z, NULL, 10); pStmt->pDnodes = pDnodes; return (SNode*)pStmt; +_err: + nodesDestroyList(pDnodes); + return NULL; } SNode* createSplitVgroupStmt(SAstCreateContext* pCxt, const SToken* pVgId) { @@ -3199,6 +3598,8 @@ SNode* createSplitVgroupStmt(SAstCreateContext* pCxt, const SToken* pVgId) { CHECK_MAKE_NODE(pStmt); pStmt->vgId = taosStr2Int32(pVgId->z, NULL, 10); return (SNode*)pStmt; +_err: + return NULL; } SNode* createSyncdbStmt(SAstCreateContext* pCxt, const SToken* pDbName) { @@ -3207,15 +3608,16 @@ SNode* createSyncdbStmt(SAstCreateContext* pCxt, const SToken* pDbName) { pCxt->errCode = nodesMakeNode(QUERY_NODE_SYNCDB_STMT, (SNode**)&pStmt); CHECK_MAKE_NODE(pStmt); return pStmt; +_err: + return NULL; } SNode* createGrantStmt(SAstCreateContext* pCxt, int64_t privileges, STokenPair* pPrivLevel, SToken* pUserName, SNode* pTagCond) { CHECK_PARSER_STATUS(pCxt); - if (!checkDbName(pCxt, &pPrivLevel->first, false) || !checkUserName(pCxt, pUserName) || - !checkTableName(pCxt, &pPrivLevel->second)) { - return NULL; - } + CHECK_NAME(checkDbName(pCxt, &pPrivLevel->first, false)); + CHECK_NAME(checkUserName(pCxt, pUserName)); + CHECK_NAME(checkTableName(pCxt, &pPrivLevel->second)); SGrantStmt* pStmt = NULL; pCxt->errCode = nodesMakeNode(QUERY_NODE_GRANT_STMT, (SNode**)&pStmt); CHECK_MAKE_NODE(pStmt); @@ -3227,14 +3629,16 @@ SNode* createGrantStmt(SAstCreateContext* pCxt, int64_t privileges, STokenPair* COPY_STRING_FORM_ID_TOKEN(pStmt->userName, pUserName); pStmt->pTagCond = pTagCond; return (SNode*)pStmt; +_err: + nodesDestroyNode(pTagCond); + return NULL; } SNode* createRevokeStmt(SAstCreateContext* pCxt, int64_t privileges, STokenPair* pPrivLevel, SToken* pUserName, SNode* pTagCond) { CHECK_PARSER_STATUS(pCxt); - if (!checkDbName(pCxt, &pPrivLevel->first, false) || !checkUserName(pCxt, pUserName)) { - return NULL; - } + CHECK_NAME(checkDbName(pCxt, &pPrivLevel->first, false)); + CHECK_NAME(checkUserName(pCxt, pUserName)); SRevokeStmt* pStmt = NULL; pCxt->errCode = nodesMakeNode(QUERY_NODE_REVOKE_STMT, (SNode**)&pStmt); CHECK_MAKE_NODE(pStmt); @@ -3246,29 +3650,30 @@ SNode* createRevokeStmt(SAstCreateContext* pCxt, int64_t privileges, STokenPair* COPY_STRING_FORM_ID_TOKEN(pStmt->userName, pUserName); pStmt->pTagCond = pTagCond; return (SNode*)pStmt; +_err: + nodesDestroyNode(pTagCond); + return NULL; } SNode* createFuncForDelete(SAstCreateContext* pCxt, const char* pFuncName) { SFunctionNode* pFunc = NULL; + CHECK_PARSER_STATUS(pCxt); pCxt->errCode = nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&pFunc); CHECK_MAKE_NODE(pFunc); snprintf(pFunc->functionName, sizeof(pFunc->functionName), "%s", pFuncName); SNode* pCol = createPrimaryKeyCol(pCxt, NULL); - if (!pCol) { - nodesDestroyNode((SNode*)pFunc); - return NULL; - } + CHECK_MAKE_NODE(pCol); pCxt->errCode = nodesListMakeStrictAppend(&pFunc->pParameterList, pCol); - if (TSDB_CODE_SUCCESS != pCxt->errCode) { - nodesDestroyNode((SNode*)pFunc); - return NULL; - } + CHECK_PARSER_STATUS(pCxt); return (SNode*)pFunc; +_err: + nodesDestroyNode((SNode*)pFunc); + return NULL; } SNode* createDeleteStmt(SAstCreateContext* pCxt, SNode* pTable, SNode* pWhere) { - CHECK_PARSER_STATUS(pCxt); SDeleteStmt* pStmt = NULL; + CHECK_PARSER_STATUS(pCxt); pCxt->errCode = nodesMakeNode(QUERY_NODE_DELETE_STMT, (SNode**)&pStmt); CHECK_MAKE_NODE(pStmt); pStmt->pFromTable = pTable; @@ -3276,11 +3681,15 @@ SNode* createDeleteStmt(SAstCreateContext* pCxt, SNode* pTable, SNode* pWhere) { pStmt->pCountFunc = createFuncForDelete(pCxt, "count"); pStmt->pFirstFunc = createFuncForDelete(pCxt, "first"); pStmt->pLastFunc = createFuncForDelete(pCxt, "last"); - if (NULL == pStmt->pCountFunc || NULL == pStmt->pFirstFunc || NULL == pStmt->pLastFunc) { - nodesDestroyNode((SNode*)pStmt); - CHECK_MAKE_NODE(NULL); - } + CHECK_MAKE_NODE(pStmt->pCountFunc); + CHECK_MAKE_NODE(pStmt->pFirstFunc); + CHECK_MAKE_NODE(pStmt->pLastFunc); return (SNode*)pStmt; +_err: + nodesDestroyNode((SNode*)pStmt); + nodesDestroyNode(pTable); + nodesDestroyNode(pWhere); + return NULL; } SNode* createInsertStmt(SAstCreateContext* pCxt, SNode* pTable, SNodeList* pCols, SNode* pQuery) { @@ -3297,17 +3706,18 @@ SNode* createInsertStmt(SAstCreateContext* pCxt, SNode* pTable, SNodeList* pCols strcpy(((SSetOperator*)pQuery)->stmtName, ((STableNode*)pTable)->tableAlias); } return (SNode*)pStmt; +_err: + nodesDestroyNode(pTable); + nodesDestroyNode(pQuery); + nodesDestroyList(pCols); + return NULL; } SNode* createCreateTSMAStmt(SAstCreateContext* pCxt, bool ignoreExists, SToken* tsmaName, SNode* pOptions, SNode* pRealTable, SNode* pInterval) { - CHECK_PARSER_STATUS(pCxt); - if (!checkTsmaName(pCxt, tsmaName)) { - nodesDestroyNode(pInterval); - return NULL; - } - SCreateTSMAStmt* pStmt = NULL; + CHECK_PARSER_STATUS(pCxt); + CHECK_NAME(checkTsmaName(pCxt, tsmaName)); pCxt->errCode = nodesMakeNode(QUERY_NODE_CREATE_TSMA_STMT, (SNode**)&pStmt); CHECK_MAKE_NODE(pStmt); @@ -3316,11 +3726,7 @@ SNode* createCreateTSMAStmt(SAstCreateContext* pCxt, bool ignoreExists, SToken* // recursive tsma pStmt->pOptions = NULL; pCxt->errCode = nodesMakeNode(QUERY_NODE_TSMA_OPTIONS, (SNode**)&pStmt->pOptions); - if (!pStmt->pOptions) { - nodesDestroyNode(pInterval); - nodesDestroyNode((SNode*)pStmt); - return NULL; - } + CHECK_MAKE_NODE(pStmt->pOptions); pStmt->pOptions->recursiveTsma = true; } else { pStmt->pOptions = (STSMAOptions*)pOptions; @@ -3335,6 +3741,12 @@ SNode* createCreateTSMAStmt(SAstCreateContext* pCxt, bool ignoreExists, SToken* nodesDestroyNode(pRealTable); return (SNode*)pStmt; +_err: + nodesDestroyNode((SNode*)pStmt); + nodesDestroyNode(pOptions); + nodesDestroyNode(pRealTable); + nodesDestroyNode(pInterval); + return NULL; } SNode* createTSMAOptions(SAstCreateContext* pCxt, SNodeList* pFuncs) { @@ -3344,6 +3756,9 @@ SNode* createTSMAOptions(SAstCreateContext* pCxt, SNodeList* pFuncs) { CHECK_MAKE_NODE(pOptions); pOptions->pFuncs = pFuncs; return (SNode*)pOptions; +_err: + nodesDestroyList(pFuncs); + return NULL; } SNode* createDefaultTSMAOptions(SAstCreateContext* pCxt) { @@ -3352,6 +3767,8 @@ SNode* createDefaultTSMAOptions(SAstCreateContext* pCxt) { pCxt->errCode = nodesMakeNode(QUERY_NODE_TSMA_OPTIONS, (SNode**)&pOptions); CHECK_MAKE_NODE(pOptions); return (SNode*)pOptions; +_err: + return NULL; } SNode* createDropTSMAStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SNode* pRealTable) { @@ -3368,6 +3785,9 @@ SNode* createDropTSMAStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SNode* nodesDestroyNode(pRealTable); return (SNode*)pStmt; +_err: + nodesDestroyNode(pRealTable); + return NULL; } SNode* createShowTSMASStmt(SAstCreateContext* pCxt, SNode* dbName) { @@ -3379,4 +3799,7 @@ SNode* createShowTSMASStmt(SAstCreateContext* pCxt, SNode* dbName) { pStmt->pDbName = dbName; return (SNode*)pStmt; +_err: + nodesDestroyNode(dbName); + return NULL; } diff --git a/source/libs/parser/src/parAstParser.c b/source/libs/parser/src/parAstParser.c index 49be0b8d90..d323d45c81 100644 --- a/source/libs/parser/src/parAstParser.c +++ b/source/libs/parser/src/parAstParser.c @@ -107,6 +107,7 @@ typedef struct SCollectMetaKeyCxt { typedef struct SCollectMetaKeyFromExprCxt { SCollectMetaKeyCxt* pComCxt; bool hasLastRowOrLast; + bool tbnameCollect; int32_t errCode; } SCollectMetaKeyFromExprCxt; @@ -204,6 +205,45 @@ static EDealRes collectMetaKeyFromTempTable(SCollectMetaKeyFromExprCxt* pCxt, ST return TSDB_CODE_SUCCESS == pCxt->errCode ? DEAL_RES_CONTINUE : DEAL_RES_ERROR; } +static int32_t isTbnameEqCondOperator(SOperatorNode* pOperator, char** ppTableName) { + if (pOperator->opType != OP_TYPE_EQUAL) { + return TSDB_CODE_SUCCESS; + } + + SValueNode* pValueNode = NULL; + if (nodeType(pOperator->pLeft) == QUERY_NODE_FUNCTION && + 0 == strcasecmp(((SFunctionNode*)(pOperator->pLeft))->functionName, "tbname") && + nodeType(pOperator->pRight) == QUERY_NODE_VALUE) { + pValueNode = (SValueNode*)pOperator->pRight; + } else if (nodeType(pOperator->pRight) == QUERY_NODE_FUNCTION && + 0 == strcasecmp(((SFunctionNode*)(pOperator->pRight))->functionName, "tbname") && + nodeType(pOperator->pLeft) == QUERY_NODE_VALUE) { + pValueNode = (SValueNode*)pOperator->pLeft; + } else { + return TSDB_CODE_SUCCESS; + } + + *ppTableName = pValueNode->literal; + + return TSDB_CODE_SUCCESS; +} + +static EDealRes collectMetaKeyFromOperator(SCollectMetaKeyFromExprCxt* pCxt, SOperatorNode* pOpNode) { + if (!pCxt->tbnameCollect) { + return DEAL_RES_CONTINUE; + } + + char* pTableName = NULL; + int32_t code = isTbnameEqCondOperator((SOperatorNode*)pOpNode, &pTableName); + if (TSDB_CODE_SUCCESS != code) return DEAL_RES_CONTINUE; + if (pTableName) { + SSelectStmt* pSelect = (SSelectStmt*)pCxt->pComCxt->pStmt; + pCxt->errCode = collectMetaKeyFromRealTableImpl(pCxt->pComCxt, ((SRealTableNode*)pSelect->pFromTable)->table.dbName, pTableName, AUTH_TYPE_READ); + } + + return TSDB_CODE_SUCCESS == pCxt->errCode ? DEAL_RES_CONTINUE : DEAL_RES_ERROR; +} + static EDealRes collectMetaKeyFromExprImpl(SNode* pNode, void* pContext) { SCollectMetaKeyFromExprCxt* pCxt = pContext; switch (nodeType(pNode)) { @@ -213,6 +253,8 @@ static EDealRes collectMetaKeyFromExprImpl(SNode* pNode, void* pContext) { return collectMetaKeyFromRealTable(pCxt, (SRealTableNode*)pNode); case QUERY_NODE_TEMP_TABLE: return collectMetaKeyFromTempTable(pCxt, (STempTableNode*)pNode); + case QUERY_NODE_OPERATOR: + return collectMetaKeyFromOperator(pCxt, (SOperatorNode*)pNode); default: break; } @@ -220,7 +262,7 @@ static EDealRes collectMetaKeyFromExprImpl(SNode* pNode, void* pContext) { } static int32_t collectMetaKeyFromExprs(SCollectMetaKeyCxt* pCxt, SNodeList* pList) { - SCollectMetaKeyFromExprCxt cxt = {.pComCxt = pCxt, .errCode = TSDB_CODE_SUCCESS}; + SCollectMetaKeyFromExprCxt cxt = {.pComCxt = pCxt, .errCode = TSDB_CODE_SUCCESS, .tbnameCollect = false}; nodesWalkExprs(pList, collectMetaKeyFromExprImpl, &cxt); return cxt.errCode; } @@ -245,6 +287,9 @@ static int32_t reserveDbCfgForLastRow(SCollectMetaKeyCxt* pCxt, SNode* pTable) { static int32_t collectMetaKeyFromSelect(SCollectMetaKeyCxt* pCxt, SSelectStmt* pStmt) { SCollectMetaKeyFromExprCxt cxt = {.pComCxt = pCxt, .hasLastRowOrLast = false, .errCode = TSDB_CODE_SUCCESS}; + if (pStmt->pFromTable && QUERY_NODE_REAL_TABLE == nodeType(pStmt->pFromTable)) { + cxt.tbnameCollect = true; + } nodesWalkSelectStmt(pStmt, SQL_CLAUSE_FROM, collectMetaKeyFromExprImpl, &cxt); if (TSDB_CODE_SUCCESS == cxt.errCode && cxt.hasLastRowOrLast) { cxt.errCode = reserveDbCfgForLastRow(pCxt, pStmt->pFromTable); diff --git a/source/libs/parser/src/parInsertSql.c b/source/libs/parser/src/parInsertSql.c index cb94cd42f7..a8db514ee3 100644 --- a/source/libs/parser/src/parInsertSql.c +++ b/source/libs/parser/src/parInsertSql.c @@ -655,7 +655,7 @@ static int32_t parseTagToken(const char** end, SToken* pToken, SSchema* pSchema, code = parseGeometry(pToken, &output, &size); if (code != TSDB_CODE_SUCCESS) { - code = buildSyntaxErrMsg(pMsgBuf, getThreadLocalGeosCtx()->errMsg, pToken->z); + code = buildSyntaxErrMsg(pMsgBuf, getGeosErrMsg(code), pToken->z); } else if (size + VARSTR_HEADER_SIZE > pSchema->bytes) { // Too long values will raise the invalid sql error message code = generateSyntaxErrMsg(pMsgBuf, TSDB_CODE_PAR_VALUE_TOO_LONG, pSchema->name); @@ -1646,7 +1646,7 @@ static int32_t parseValueTokenImpl(SInsertParseContext* pCxt, const char** pSql, code = parseGeometry(pToken, &output, &size); if (code != TSDB_CODE_SUCCESS) { - code = buildSyntaxErrMsg(&pCxt->msg, getThreadLocalGeosCtx()->errMsg, pToken->z); + code = buildSyntaxErrMsg(&pCxt->msg, getGeosErrMsg(code), pToken->z); } // Too long values will raise the invalid sql error message else if (size + VARSTR_HEADER_SIZE > pSchema->bytes) { @@ -2254,7 +2254,7 @@ static int32_t parseDataFromFileImpl(SInsertParseContext* pCxt, SVnodeModifyOpSt static int32_t parseDataFromFile(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt, SToken* pFilePath, SRowsDataContext rowsDataCxt) { - char filePathStr[TSDB_FILENAME_LEN] = {0}; + char filePathStr[PATH_MAX] = {0}; if (TK_NK_STRING == pFilePath->type) { (void)trimString(pFilePath->z, pFilePath->n, filePathStr, sizeof(filePathStr)); } else { diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c index 9bcc201443..7422e86345 100644 --- a/source/libs/parser/src/parTokenizer.c +++ b/source/libs/parser/src/parTokenizer.c @@ -338,9 +338,6 @@ static SKeyword keywordTable[] = { {"S3_COMPACT", TK_S3_COMPACT}, {"S3MIGRATE", TK_S3MIGRATE}, {"KEEP_TIME_OFFSET", TK_KEEP_TIME_OFFSET}, - {"ENCODE", TK_ENCODE}, - {"COMPRESS", TK_COMPRESS}, - {"LEVEL", TK_LEVEL}, {"ARBGROUPS", TK_ARBGROUPS}, {"IS_IMPORT", TK_IS_IMPORT}, }; diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index e5e47a6c9b..8aac33b4f4 100755 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -1270,12 +1270,12 @@ static void setColumnPrimTs(STranslateContext* pCxt, SColumnNode* pCol, const ST } } -static int32_t createColumnsByTable(STranslateContext* pCxt, const STableNode* pTable, bool igTags, SNodeList* pList) { +static int32_t createColumnsByTable(STranslateContext* pCxt, const STableNode* pTable, bool igTags, SNodeList* pList, bool skipProjRef) { int32_t code = 0; if (QUERY_NODE_REAL_TABLE == nodeType(pTable)) { const STableMeta* pMeta = ((SRealTableNode*)pTable)->pMeta; int32_t nums = pMeta->tableInfo.numOfColumns + - (igTags ? 0 : ((TSDB_SUPER_TABLE == pMeta->tableType) ? pMeta->tableInfo.numOfTags : 0)); + (igTags ? 0 : ((TSDB_SUPER_TABLE == pMeta->tableType || ((SRealTableNode*)pTable)->stbRewrite) ? pMeta->tableInfo.numOfTags : 0)); for (int32_t i = 0; i < nums; ++i) { if (invisibleColumn(pCxt->pParseCxt->enableSysInfo, pMeta->tableType, pMeta->schema[i].flags)) { pCxt->pParseCxt->hasInvisibleCol = true; @@ -1305,7 +1305,11 @@ static int32_t createColumnsByTable(STranslateContext* pCxt, const STableNode* p SListCell* pCell = nodesListGetCell(pList, LIST_LENGTH(pList) - 1); code = setColumnInfoByExpr(pTempTable, (SExprNode*)pNode, (SColumnNode**)&pCell->pNode); } - if (TSDB_CODE_SUCCESS != code) break; + if (TSDB_CODE_SUCCESS == code) { + if (!skipProjRef) pCol->projRefIdx = ((SExprNode*)pNode)->projIdx; // only set proj ref when select * from (select ...) + } else { + break; + } } } return code; @@ -4669,7 +4673,7 @@ int32_t translateTable(STranslateContext* pCxt, SNode** pTable, SNode* pJoinPare return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_GET_META_ERROR, tstrerror(code)); } #ifdef TD_ENTERPRISE - if (TSDB_VIEW_TABLE == pRealTable->pMeta->tableType && !pCurrSmt->tagScan) { + if (TSDB_VIEW_TABLE == pRealTable->pMeta->tableType && (!pCurrSmt->tagScan || pCxt->pParseCxt->biMode)) { return translateView(pCxt, pTable, &name); } code = translateAudit(pCxt, pRealTable, &name); @@ -4770,7 +4774,7 @@ static int32_t createAllColumns(STranslateContext* pCxt, bool igTags, SNodeList* size_t nums = taosArrayGetSize(pTables); for (size_t i = 0; i < nums; ++i) { STableNode* pTable = taosArrayGetP(pTables, i); - int32_t code = createColumnsByTable(pCxt, pTable, igTags, *pCols); + int32_t code = createColumnsByTable(pCxt, pTable, igTags, *pCols, nums > 1); if (TSDB_CODE_SUCCESS != code) { return code; } @@ -4833,7 +4837,7 @@ static int32_t createTableAllCols(STranslateContext* pCxt, SColumnNode* pCol, bo } } if (TSDB_CODE_SUCCESS == code) { - code = createColumnsByTable(pCxt, pTable, igTags, *pOutput); + code = createColumnsByTable(pCxt, pTable, igTags, *pOutput, false); } return code; } @@ -5175,6 +5179,11 @@ static int32_t translateProjectionList(STranslateContext* pCxt, SSelectStmt* pSe if (!pSelect->isSubquery) { return rewriteProjectAlias(pSelect->pProjectionList); } else { + SNode* pNode; + int32_t projIdx = 1; + FOREACH(pNode, pSelect->pProjectionList) { + ((SExprNode*)pNode)->projIdx = projIdx++; + } return TSDB_CODE_SUCCESS; } } @@ -5964,6 +5973,7 @@ static int32_t isOperatorEqTbnameCond(STranslateContext* pCxt, SOperatorNode* pO *pRet = false; return TSDB_CODE_SUCCESS; } + SFunctionNode* pTbnameFunc = NULL; SValueNode* pValueNode = NULL; if (nodeType(pOperator->pLeft) == QUERY_NODE_FUNCTION && @@ -6041,7 +6051,6 @@ static int32_t isOperatorTbnameInCond(STranslateContext* pCxt, SOperatorNode* pO static int32_t findEqCondTbNameInOperatorNode(STranslateContext* pCxt, SNode* pWhere, SEqCondTbNameTableInfo* pInfo, bool* pRet) { int32_t code = TSDB_CODE_SUCCESS; char* pTableAlias = NULL; - char* pTbNameVal = NULL; bool eqTbnameCond = false, tbnameInCond = false; code = isOperatorEqTbnameCond(pCxt, (SOperatorNode*)pWhere, &pTableAlias, &pInfo->aTbnames, &eqTbnameCond); if (TSDB_CODE_SUCCESS == code) { @@ -6222,12 +6231,73 @@ static void findVgroupsFromEqualTbname(STranslateContext* pCxt, SArray* aTbnames } } +static int32_t replaceToChildTableQuery(STranslateContext* pCxt, SEqCondTbNameTableInfo* pInfo) { + SName snameTb; + int32_t code = 0; + SRealTableNode* pRealTable = pInfo->pRealTable; + char* tbName = taosArrayGetP(pInfo->aTbnames, 0); + (void)toName(pCxt->pParseCxt->acctId, pRealTable->table.dbName, tbName, &snameTb); + + STableMeta* pMeta = NULL; + TAOS_CHECK_RETURN(catalogGetCachedTableMeta(pCxt->pParseCxt->pCatalog, &snameTb, &pMeta)); + if (NULL == pMeta || TSDB_CHILD_TABLE != pMeta->tableType || pMeta->suid != pRealTable->pMeta->suid) { + goto _return; + } + + pRealTable->pMeta->uid = pMeta->uid; + pRealTable->pMeta->vgId = pMeta->vgId; + pRealTable->pMeta->tableType = pMeta->tableType; + tstrncpy(pRealTable->table.tableName, tbName, sizeof(pRealTable->table.tableName)); + + pRealTable->stbRewrite = true; + + if (pRealTable->pTsmas) { + // if select from a child table, fetch it's corresponding tsma target child table infos + char buf[TSDB_TABLE_FNAME_LEN + TSDB_TABLE_NAME_LEN + 1]; + for (int32_t i = 0; i < pRealTable->pTsmas->size; ++i) { + STableTSMAInfo* pTsma = taosArrayGetP(pRealTable->pTsmas, i); + SName tsmaTargetTbName = {0}; + (void)toName(pCxt->pParseCxt->acctId, pRealTable->table.dbName, "", &tsmaTargetTbName); + int32_t len = snprintf(buf, TSDB_TABLE_FNAME_LEN + TSDB_TABLE_NAME_LEN, "%s.%s_%s", pTsma->dbFName, pTsma->name, + pRealTable->table.tableName); + len = taosCreateMD5Hash(buf, len); + strncpy(tsmaTargetTbName.tname, buf, MD5_OUTPUT_LEN); + STsmaTargetTbInfo ctbInfo = {0}; + if (!pRealTable->tsmaTargetTbInfo) { + pRealTable->tsmaTargetTbInfo = taosArrayInit(pRealTable->pTsmas->size, sizeof(STsmaTargetTbInfo)); + if (!pRealTable->tsmaTargetTbInfo) { + code = terrno; + break; + } + } + sprintf(ctbInfo.tableName, "%s", tsmaTargetTbName.tname); + ctbInfo.uid = pMeta->uid; + + if (NULL == taosArrayPush(pRealTable->tsmaTargetTbInfo, &ctbInfo)) { + code = terrno; + goto _return; + } + } + } + +_return: + + taosMemoryFree(pMeta); + return code; +} + static int32_t setEqualTbnameTableVgroups(STranslateContext* pCxt, SSelectStmt* pSelect, SArray* aTables) { int32_t code = TSDB_CODE_SUCCESS; - for (int i = 0; i < taosArrayGetSize(aTables); ++i) { - SEqCondTbNameTableInfo* pInfo = taosArrayGet(aTables, i); - int32_t nTbls = taosArrayGetSize(pInfo->aTbnames); + int32_t aTableNum = taosArrayGetSize(aTables); + int32_t nTbls = 0; + bool stableQuery = false; + SEqCondTbNameTableInfo* pInfo = NULL; + + qDebug("start to update stable vg for tbname optimize, aTableNum:%d", aTableNum); + for (int i = 0; i < aTableNum; ++i) { + pInfo = taosArrayGet(aTables, i); int32_t numOfVgs = pInfo->pRealTable->pVgroupList->numOfVgroups; + nTbls = taosArrayGetSize(pInfo->aTbnames); SVgroupsInfo* vgsInfo = taosMemoryMalloc(sizeof(SVgroupsInfo) + nTbls * sizeof(SVgroupInfo)); findVgroupsFromEqualTbname(pCxt, pInfo->aTbnames, pInfo->pRealTable->table.dbName, numOfVgs, vgsInfo); @@ -6237,6 +6307,7 @@ static int32_t setEqualTbnameTableVgroups(STranslateContext* pCxt, SSelectStmt* } else { taosMemoryFree(vgsInfo); } + stableQuery = pInfo->pRealTable->pMeta->tableType == TSDB_SUPER_TABLE; vgsInfo = NULL; if (pInfo->pRealTable->pTsmas) { @@ -6276,7 +6347,14 @@ static int32_t setEqualTbnameTableVgroups(STranslateContext* pCxt, SSelectStmt* } } } - return TSDB_CODE_SUCCESS; + + qDebug("before ctbname optimize, code:%d, aTableNum:%d, nTbls:%d, stableQuery:%d", code, aTableNum, nTbls, stableQuery); + + if (TSDB_CODE_SUCCESS == code && 1 == aTableNum && 1 == nTbls && stableQuery && NULL == pInfo->pRealTable->pTsmas) { + code = replaceToChildTableQuery(pCxt, pInfo); + } + + return code; } static int32_t setTableVgroupsFromEqualTbnameCond(STranslateContext* pCxt, SSelectStmt* pSelect) { diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index 4ff7510e92..b694a502da 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -426,9 +426,6 @@ #define TK_VALUES 379 #define TK_VARIABLE 380 #define TK_WAL 381 -#define TK_ENCODE 382 -#define TK_COMPRESS 383 -#define TK_LEVEL 384 #endif /**************** End token definitions ***************************************/ @@ -493,31 +490,31 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 567 +#define YYNOCODE 564 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SToken typedef union { int yyinit; ParseTOKENTYPE yy0; - EFillMode yy18; - EJoinType yy36; - ENullOrder yy109; - bool yy173; - SNodeList* yy334; - SAlterOption yy389; - STokenPair yy399; - EOperatorType yy506; - SToken yy533; - EShowKind yy537; - SNode* yy560; - int64_t yy585; - EJoinSubType yy648; - ETrimType yy672; - SShowTablesOption yy709; - int8_t yy719; - int32_t yy802; - SDataType yy952; - EOrder yy974; + ETrimType yy72; + bool yy89; + SNode* yy248; + SShowTablesOption yy373; + SToken yy401; + EOrder yy482; + int64_t yy525; + EJoinSubType yy582; + EFillMode yy583; + int32_t yy604; + SAlterOption yy677; + int8_t yy695; + EOperatorType yy716; + ENullOrder yy721; + EJoinType yy804; + SNodeList* yy928; + SDataType yy976; + STokenPair yy1041; + EShowKind yy1042; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -536,20 +533,20 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 1006 -#define YYNRULE 770 -#define YYNRULE_WITH_ACTION 770 -#define YYNTOKEN 385 -#define YY_MAX_SHIFT 1005 -#define YY_MIN_SHIFTREDUCE 1490 -#define YY_MAX_SHIFTREDUCE 2259 -#define YY_ERROR_ACTION 2260 -#define YY_ACCEPT_ACTION 2261 -#define YY_NO_ACTION 2262 -#define YY_MIN_REDUCE 2263 -#define YY_MAX_REDUCE 3032 -#define YY_MIN_DSTRCTR 386 -#define YY_MAX_DSTRCTR 566 +#define YYNSTATE 1004 +#define YYNRULE 768 +#define YYNRULE_WITH_ACTION 768 +#define YYNTOKEN 382 +#define YY_MAX_SHIFT 1003 +#define YY_MIN_SHIFTREDUCE 1486 +#define YY_MAX_SHIFTREDUCE 2253 +#define YY_ERROR_ACTION 2254 +#define YY_ACCEPT_ACTION 2255 +#define YY_NO_ACTION 2256 +#define YY_MIN_REDUCE 2257 +#define YY_MAX_REDUCE 3024 +#define YY_MIN_DSTRCTR 383 +#define YY_MAX_DSTRCTR 563 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -632,845 +629,874 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (3956) +#define YY_ACTTAB_COUNT (4102) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 821, 670, 3003, 678, 671, 2311, 671, 2311, 2998, 2475, - /* 10 */ 2998, 956, 58, 56, 2430, 57, 55, 54, 53, 52, - /* 20 */ 499, 2264, 1982, 2626, 2007, 464, 820, 229, 771, 3002, - /* 30 */ 218, 2999, 822, 2999, 3001, 503, 1980, 492, 2084, 2355, - /* 40 */ 218, 2793, 149, 2623, 882, 148, 147, 146, 145, 144, - /* 50 */ 143, 142, 141, 140, 582, 2595, 836, 2599, 51, 50, - /* 60 */ 833, 168, 57, 55, 54, 53, 52, 2599, 2079, 149, + /* 0 */ 821, 670, 2997, 678, 671, 2305, 671, 2305, 2992, 2469, + /* 10 */ 2992, 954, 58, 56, 2424, 57, 55, 54, 53, 52, + /* 20 */ 498, 2258, 1978, 2620, 399, 461, 820, 229, 2502, 2996, + /* 30 */ 218, 2993, 822, 2993, 2995, 502, 1976, 491, 2080, 2349, + /* 40 */ 218, 2787, 149, 2617, 882, 148, 147, 146, 145, 144, + /* 50 */ 143, 142, 141, 140, 895, 895, 836, 2593, 51, 50, + /* 60 */ 833, 168, 57, 55, 54, 53, 52, 2593, 2075, 149, /* 70 */ 767, 865, 148, 147, 146, 145, 144, 143, 142, 141, - /* 80 */ 140, 895, 1988, 51, 50, 2811, 757, 57, 55, 54, - /* 90 */ 53, 52, 51, 50, 2698, 2011, 57, 55, 54, 53, - /* 100 */ 52, 2758, 751, 877, 755, 753, 299, 298, 245, 690, - /* 110 */ 680, 2665, 1002, 895, 693, 59, 973, 972, 971, 970, - /* 120 */ 528, 249, 969, 968, 173, 963, 962, 961, 960, 959, - /* 130 */ 958, 957, 172, 951, 950, 949, 527, 526, 946, 945, - /* 140 */ 944, 209, 208, 943, 523, 942, 941, 940, 2792, 43, - /* 150 */ 351, 2840, 2087, 2088, 810, 132, 2794, 881, 2796, 2797, - /* 160 */ 876, 2462, 2751, 864, 900, 516, 2220, 105, 2613, 211, - /* 170 */ 691, 2900, 104, 51, 50, 494, 2896, 57, 55, 54, - /* 180 */ 53, 52, 2793, 2811, 205, 2908, 832, 770, 160, 831, - /* 190 */ 3003, 2043, 2053, 342, 343, 230, 2998, 878, 341, 768, - /* 200 */ 2064, 2086, 2089, 2947, 2263, 51, 50, 2010, 61, 57, - /* 210 */ 55, 54, 53, 52, 820, 229, 1983, 2173, 1981, 2999, - /* 220 */ 822, 2180, 9, 863, 505, 505, 2811, 2007, 158, 157, + /* 80 */ 140, 218, 1984, 51, 50, 2805, 757, 57, 55, 54, + /* 90 */ 53, 52, 51, 50, 2003, 2007, 57, 55, 54, 53, + /* 100 */ 52, 2752, 751, 877, 755, 753, 299, 298, 2594, 690, + /* 110 */ 520, 771, 1000, 2518, 2520, 59, 971, 970, 969, 968, + /* 120 */ 528, 249, 967, 966, 173, 961, 960, 959, 958, 957, + /* 130 */ 956, 955, 172, 949, 948, 947, 527, 526, 944, 943, + /* 140 */ 942, 209, 208, 941, 523, 940, 939, 938, 2786, 61, + /* 150 */ 61, 2834, 2083, 2084, 810, 132, 2788, 881, 2790, 2791, + /* 160 */ 876, 2456, 2745, 864, 900, 515, 2216, 105, 2607, 211, + /* 170 */ 691, 2894, 104, 51, 50, 493, 2890, 57, 55, 54, + /* 180 */ 53, 52, 2787, 2805, 205, 2902, 832, 2620, 160, 831, + /* 190 */ 195, 2039, 2049, 680, 2659, 230, 2992, 878, 2398, 111, + /* 200 */ 2060, 2082, 2085, 2941, 2257, 51, 50, 2618, 882, 57, + /* 210 */ 55, 54, 53, 52, 820, 229, 1979, 464, 1977, 2993, + /* 220 */ 822, 895, 9, 863, 504, 504, 2805, 2460, 158, 157, /* 230 */ 156, 155, 154, 153, 152, 151, 150, 900, 900, 103, - /* 240 */ 456, 895, 2758, 2261, 877, 937, 185, 184, 934, 933, - /* 250 */ 932, 182, 1986, 1987, 2040, 809, 2042, 2045, 2046, 2047, - /* 260 */ 2048, 2049, 2050, 2051, 2052, 873, 866, 2007, 225, 898, - /* 270 */ 897, 2071, 2072, 2073, 2074, 2075, 2078, 2080, 2081, 2082, - /* 280 */ 2083, 2085, 2, 58, 56, 2176, 686, 2793, 675, 2792, - /* 290 */ 2114, 499, 2840, 1982, 672, 689, 132, 2794, 881, 2796, - /* 300 */ 2797, 876, 875, 2244, 864, 900, 744, 1980, 170, 2084, - /* 310 */ 179, 2871, 2900, 2192, 833, 168, 494, 2896, 51, 50, - /* 320 */ 895, 758, 57, 55, 54, 53, 52, 3003, 573, 2012, - /* 330 */ 2626, 2811, 531, 2151, 73, 2998, 61, 530, 220, 2079, - /* 340 */ 300, 2151, 865, 33, 501, 2007, 19, 2758, 667, 877, - /* 350 */ 2623, 882, 44, 1988, 3002, 2115, 747, 665, 2999, 3000, - /* 360 */ 661, 657, 73, 741, 739, 2752, 58, 56, 73, 265, - /* 370 */ 297, 896, 2471, 673, 499, 2319, 1982, 2209, 635, 633, - /* 380 */ 333, 436, 771, 1002, 243, 77, 15, 2568, 787, 1535, - /* 390 */ 1980, 159, 2084, 203, 2792, 328, 2998, 2840, 2044, 716, - /* 400 */ 335, 431, 2794, 881, 2796, 2797, 876, 874, 1542, 864, - /* 410 */ 900, 856, 2865, 2358, 3004, 229, 83, 125, 12, 2999, - /* 420 */ 822, 82, 2079, 2087, 2088, 865, 2221, 520, 505, 19, - /* 430 */ 2524, 2526, 2120, 1537, 1540, 1541, 1988, 835, 198, 2908, - /* 440 */ 2909, 900, 166, 2913, 803, 802, 2207, 2208, 2210, 2211, - /* 450 */ 2212, 42, 496, 2109, 2110, 2111, 2112, 2113, 2117, 2118, - /* 460 */ 2119, 2041, 2043, 2053, 773, 2665, 1002, 2008, 564, 15, - /* 470 */ 563, 62, 2086, 2089, 2920, 2148, 2149, 2150, 2920, 2920, - /* 480 */ 2920, 2920, 2920, 2148, 2149, 2150, 2768, 1983, 1988, 1981, - /* 490 */ 737, 736, 735, 195, 863, 193, 73, 727, 165, 731, - /* 500 */ 811, 2404, 562, 730, 518, 2473, 2087, 2088, 729, 734, - /* 510 */ 474, 473, 906, 1653, 728, 2772, 1828, 1829, 472, 724, - /* 520 */ 723, 722, 2172, 1986, 1987, 2040, 335, 2042, 2045, 2046, - /* 530 */ 2047, 2048, 2049, 2050, 2051, 2052, 873, 866, 2455, 443, - /* 540 */ 898, 897, 2071, 2072, 183, 2043, 2053, 2078, 2080, 2081, - /* 550 */ 2082, 2083, 2085, 2, 335, 2086, 2089, 687, 610, 1655, - /* 560 */ 335, 471, 470, 609, 1715, 2774, 2776, 495, 303, 2151, - /* 570 */ 1983, 608, 1981, 222, 833, 168, 2010, 863, 900, 1706, - /* 580 */ 929, 928, 927, 1710, 926, 1712, 1713, 925, 922, 2518, - /* 590 */ 1721, 919, 1723, 1724, 916, 913, 910, 51, 50, 1754, - /* 600 */ 1755, 57, 55, 54, 53, 52, 1986, 1987, 2040, 930, - /* 610 */ 2042, 2045, 2046, 2047, 2048, 2049, 2050, 2051, 2052, 873, - /* 620 */ 866, 688, 2619, 898, 897, 2071, 2072, 65, 2915, 2626, - /* 630 */ 2078, 2080, 2081, 2082, 2083, 2085, 2, 12, 58, 56, - /* 640 */ 511, 469, 468, 392, 718, 2793, 499, 302, 1982, 2624, - /* 650 */ 882, 301, 806, 1909, 1910, 1715, 2912, 833, 168, 196, - /* 660 */ 878, 2275, 1980, 335, 2084, 720, 905, 904, 903, 719, - /* 670 */ 1706, 929, 928, 927, 1710, 926, 1712, 1713, 872, 871, - /* 680 */ 2793, 1721, 870, 1723, 1724, 869, 913, 910, 335, 2811, - /* 690 */ 1562, 2286, 1561, 2008, 2079, 878, 2551, 865, 138, 2908, - /* 700 */ 2909, 19, 166, 2913, 2674, 2758, 164, 877, 1988, 218, - /* 710 */ 2920, 2148, 2149, 2150, 2920, 2920, 2920, 2920, 2920, 896, - /* 720 */ 2471, 58, 56, 2090, 2811, 114, 550, 2768, 1563, 499, - /* 730 */ 451, 1982, 2285, 479, 2040, 759, 2600, 2095, 1002, 522, - /* 740 */ 2758, 15, 877, 2007, 135, 1980, 1562, 2084, 1561, 333, - /* 750 */ 2011, 2758, 2792, 518, 2473, 2840, 2772, 588, 2595, 408, - /* 760 */ 2794, 881, 2796, 2797, 876, 725, 31, 864, 900, 812, - /* 770 */ 807, 800, 796, 896, 2471, 619, 2595, 2079, 2087, 2088, - /* 780 */ 865, 199, 2908, 2909, 1563, 166, 2913, 2792, 1646, 2711, - /* 790 */ 2840, 1988, 2758, 159, 132, 2794, 881, 2796, 2797, 876, - /* 800 */ 502, 721, 864, 900, 481, 2673, 2774, 2777, 2875, 192, - /* 810 */ 2900, 247, 896, 2471, 494, 2896, 95, 2043, 2053, 900, - /* 820 */ 2476, 1002, 1951, 939, 59, 1855, 1856, 2086, 2089, 252, - /* 830 */ 51, 50, 234, 171, 57, 55, 54, 53, 52, 737, - /* 840 */ 736, 735, 1983, 2463, 1981, 787, 727, 165, 731, 863, - /* 850 */ 2445, 612, 730, 2998, 510, 509, 47, 729, 734, 474, - /* 860 */ 473, 2087, 2088, 728, 554, 2712, 611, 472, 724, 723, - /* 870 */ 722, 3004, 229, 2011, 1854, 1857, 2999, 822, 1986, 1987, - /* 880 */ 2040, 111, 2042, 2045, 2046, 2047, 2048, 2049, 2050, 2051, - /* 890 */ 2052, 873, 866, 556, 552, 898, 897, 2071, 2072, 467, - /* 900 */ 2043, 2053, 2078, 2080, 2081, 2082, 2083, 2085, 2, 2466, - /* 910 */ 2086, 2089, 51, 50, 2044, 868, 57, 55, 54, 53, - /* 920 */ 52, 787, 392, 224, 939, 1983, 867, 1981, 629, 2998, - /* 930 */ 896, 2471, 863, 267, 525, 524, 2531, 673, 514, 2319, - /* 940 */ 521, 566, 1665, 1982, 462, 2531, 565, 3004, 229, 192, - /* 950 */ 66, 46, 2999, 822, 2342, 2529, 1664, 1980, 1989, 2284, - /* 960 */ 2476, 1986, 1987, 2040, 840, 2042, 2045, 2046, 2047, 2048, - /* 970 */ 2049, 2050, 2051, 2052, 873, 866, 738, 2041, 898, 897, - /* 980 */ 2071, 2072, 480, 2673, 2012, 2078, 2080, 2081, 2082, 2083, - /* 990 */ 2085, 2, 58, 56, 2201, 2793, 254, 787, 2531, 12, - /* 1000 */ 499, 10, 1982, 1988, 2283, 2998, 490, 2116, 2202, 115, - /* 1010 */ 836, 2153, 2154, 2155, 2156, 2157, 1980, 2529, 2084, 2758, - /* 1020 */ 2059, 628, 253, 3004, 229, 896, 2471, 37, 2999, 822, - /* 1030 */ 2251, 2282, 640, 1002, 821, 626, 896, 2471, 314, 2811, - /* 1040 */ 2525, 2526, 2998, 1883, 2793, 692, 232, 2679, 2079, 896, - /* 1050 */ 2471, 865, 896, 2471, 2200, 2758, 570, 877, 2915, 878, - /* 1060 */ 820, 229, 1988, 2531, 2758, 2999, 822, 896, 2471, 571, - /* 1070 */ 896, 2471, 590, 896, 2471, 58, 56, 896, 2471, 385, - /* 1080 */ 896, 2471, 848, 499, 2121, 1982, 2911, 604, 2811, 116, - /* 1090 */ 605, 2758, 1002, 606, 720, 59, 2915, 2468, 719, 1980, - /* 1100 */ 305, 2084, 2792, 40, 2758, 2840, 877, 2012, 304, 132, - /* 1110 */ 2794, 881, 2796, 2797, 876, 896, 2471, 864, 900, 2531, - /* 1120 */ 1950, 896, 2471, 211, 2910, 2900, 2281, 504, 953, 494, - /* 1130 */ 2896, 2079, 2087, 2088, 865, 313, 39, 1983, 2529, 1981, - /* 1140 */ 1992, 839, 51, 50, 192, 1988, 57, 55, 54, 53, - /* 1150 */ 52, 2792, 513, 512, 2840, 2477, 2250, 2948, 197, 2794, - /* 1160 */ 881, 2796, 2797, 876, 1565, 1566, 864, 900, 54, 53, - /* 1170 */ 52, 2043, 2053, 1986, 1987, 1002, 2460, 2007, 59, 896, - /* 1180 */ 2471, 2086, 2089, 51, 50, 2531, 2758, 57, 55, 54, - /* 1190 */ 53, 52, 124, 519, 712, 711, 1983, 955, 1981, 346, - /* 1200 */ 714, 713, 2458, 863, 2529, 51, 50, 788, 2958, 57, - /* 1210 */ 55, 54, 53, 52, 41, 2087, 2088, 2280, 2279, 2464, - /* 1220 */ 51, 50, 14, 13, 57, 55, 54, 53, 52, 733, - /* 1230 */ 732, 399, 1986, 1987, 2040, 2508, 2042, 2045, 2046, 2047, - /* 1240 */ 2048, 2049, 2050, 2051, 2052, 873, 866, 111, 2278, 898, - /* 1250 */ 897, 2071, 2072, 175, 2043, 2053, 2078, 2080, 2081, 2082, - /* 1260 */ 2083, 2085, 2, 786, 2086, 2089, 51, 50, 896, 2471, - /* 1270 */ 57, 55, 54, 53, 52, 2467, 285, 2758, 2758, 1983, - /* 1280 */ 2447, 1981, 857, 859, 2872, 2872, 863, 825, 853, 51, - /* 1290 */ 50, 2060, 204, 57, 55, 54, 53, 52, 896, 2471, - /* 1300 */ 391, 710, 706, 702, 698, 38, 284, 2444, 2758, 169, - /* 1310 */ 896, 2471, 2871, 2062, 2011, 1986, 1987, 2040, 353, 2042, - /* 1320 */ 2045, 2046, 2047, 2048, 2049, 2050, 2051, 2052, 873, 866, - /* 1330 */ 889, 2007, 898, 897, 2071, 2072, 1899, 2128, 2277, 2078, - /* 1340 */ 2080, 2081, 2082, 2083, 2085, 2, 58, 56, 2044, 2274, - /* 1350 */ 1669, 440, 112, 2005, 499, 769, 1982, 282, 3002, 1542, - /* 1360 */ 617, 51, 50, 466, 1668, 57, 55, 54, 53, 52, - /* 1370 */ 1980, 637, 2084, 1005, 51, 50, 896, 2471, 57, 55, - /* 1380 */ 54, 53, 52, 896, 2471, 1540, 1541, 596, 545, 639, - /* 1390 */ 896, 2471, 389, 1544, 441, 598, 890, 815, 2758, 2006, - /* 1400 */ 2273, 2272, 2079, 894, 71, 865, 576, 993, 219, 2758, - /* 1410 */ 381, 2041, 236, 45, 2271, 784, 1988, 989, 985, 981, - /* 1420 */ 977, 2270, 384, 2269, 270, 937, 185, 184, 934, 933, - /* 1430 */ 932, 182, 193, 281, 967, 965, 931, 272, 279, 2522, - /* 1440 */ 642, 310, 2474, 277, 684, 828, 1002, 465, 2531, 15, - /* 1450 */ 2291, 995, 937, 185, 184, 934, 933, 932, 182, 584, - /* 1460 */ 2758, 2758, 269, 2268, 2267, 2702, 2162, 2530, 131, 2065, - /* 1470 */ 2266, 51, 50, 357, 2758, 57, 55, 54, 53, 52, - /* 1480 */ 2533, 2758, 935, 2758, 89, 2522, 2087, 2088, 2578, 3, - /* 1490 */ 2606, 2585, 175, 625, 624, 623, 622, 621, 616, 615, - /* 1500 */ 614, 613, 448, 64, 849, 603, 602, 601, 600, 599, - /* 1510 */ 593, 592, 591, 2448, 586, 585, 463, 1648, 2340, 538, - /* 1520 */ 577, 1816, 1817, 2758, 2758, 2043, 2053, 1835, 936, 161, - /* 1530 */ 2758, 2522, 580, 2331, 290, 2086, 2089, 288, 102, 292, - /* 1540 */ 740, 294, 291, 101, 293, 726, 174, 2329, 2012, 355, - /* 1550 */ 1983, 855, 1981, 296, 338, 742, 295, 863, 761, 337, - /* 1560 */ 760, 794, 1626, 1649, 398, 2041, 51, 50, 1644, 745, - /* 1570 */ 57, 55, 54, 53, 52, 1907, 2779, 60, 307, 2061, - /* 1580 */ 2253, 2254, 2475, 60, 212, 826, 1986, 1987, 2040, 223, - /* 1590 */ 2042, 2045, 2046, 2047, 2048, 2049, 2050, 2051, 2052, 873, - /* 1600 */ 866, 14, 13, 898, 897, 2071, 2072, 183, 1627, 340, - /* 1610 */ 2078, 2080, 2081, 2082, 2083, 2085, 2, 194, 88, 51, - /* 1620 */ 50, 2793, 405, 57, 55, 54, 53, 52, 2405, 764, - /* 1630 */ 60, 360, 359, 2276, 862, 638, 878, 75, 2321, 60, - /* 1640 */ 2781, 403, 87, 60, 2196, 86, 60, 2793, 1991, 88, - /* 1650 */ 180, 161, 362, 361, 2961, 203, 442, 364, 363, 772, - /* 1660 */ 2206, 130, 878, 127, 2955, 2811, 2205, 319, 263, 652, - /* 1670 */ 650, 647, 645, 329, 2058, 183, 947, 366, 365, 368, - /* 1680 */ 367, 2758, 1990, 877, 824, 787, 804, 370, 369, 321, - /* 1690 */ 838, 2811, 344, 2998, 372, 371, 837, 374, 373, 1618, - /* 1700 */ 834, 845, 85, 376, 375, 378, 377, 2758, 163, 877, - /* 1710 */ 2812, 3004, 229, 2063, 73, 787, 2999, 822, 380, 379, - /* 1720 */ 2122, 2312, 2066, 2998, 2397, 2396, 2054, 908, 2792, 1852, - /* 1730 */ 181, 2840, 1842, 356, 893, 132, 2794, 881, 2796, 2797, - /* 1740 */ 876, 3004, 229, 864, 900, 829, 2999, 822, 183, 3018, - /* 1750 */ 948, 2900, 787, 74, 2792, 494, 2896, 2840, 1697, 2793, - /* 1760 */ 2998, 132, 2794, 881, 2796, 2797, 876, 801, 162, 864, - /* 1770 */ 900, 180, 1599, 1616, 878, 3018, 2968, 2900, 3004, 229, - /* 1780 */ 486, 494, 2896, 2999, 822, 397, 2951, 808, 482, 842, - /* 1790 */ 2604, 529, 547, 2318, 2519, 780, 326, 2952, 2962, 816, - /* 1800 */ 817, 331, 2605, 2811, 136, 2793, 2323, 99, 98, 569, - /* 1810 */ 1728, 2106, 242, 1736, 334, 2431, 5, 537, 1600, 2758, - /* 1820 */ 878, 877, 798, 532, 460, 561, 559, 2005, 546, 2015, - /* 1830 */ 1994, 1743, 525, 524, 557, 2793, 558, 237, 439, 1876, - /* 1840 */ 238, 548, 1996, 560, 544, 540, 536, 533, 562, 2811, - /* 1850 */ 878, 1741, 2991, 240, 186, 390, 1989, 574, 2084, 2006, - /* 1860 */ 581, 991, 251, 583, 1993, 2758, 2792, 877, 589, 2840, - /* 1870 */ 587, 631, 594, 132, 2794, 881, 2796, 2797, 876, 2811, - /* 1880 */ 607, 864, 900, 643, 620, 618, 2793, 3018, 2079, 2900, - /* 1890 */ 627, 2597, 630, 494, 2896, 2758, 641, 877, 632, 644, - /* 1900 */ 256, 878, 1988, 2932, 257, 646, 335, 648, 649, 260, - /* 1910 */ 651, 653, 2792, 2013, 668, 2840, 4, 676, 679, 132, - /* 1920 */ 2794, 881, 2796, 2797, 876, 268, 669, 864, 900, 677, - /* 1930 */ 2811, 107, 861, 3018, 2008, 2900, 2014, 681, 682, 494, - /* 1940 */ 2896, 2016, 2792, 685, 683, 2840, 2758, 271, 877, 132, - /* 1950 */ 2794, 881, 2796, 2797, 876, 2017, 274, 864, 900, 276, - /* 1960 */ 2620, 446, 445, 3018, 108, 2900, 2018, 109, 110, 494, - /* 1970 */ 2896, 506, 2614, 694, 283, 715, 763, 748, 749, 137, - /* 1980 */ 765, 717, 113, 434, 2461, 515, 287, 2084, 2688, 2685, - /* 1990 */ 2684, 393, 2457, 2792, 289, 2793, 2840, 188, 134, 2459, - /* 2000 */ 132, 2794, 881, 2796, 2797, 876, 2009, 2454, 864, 900, - /* 2010 */ 878, 189, 176, 190, 3018, 775, 2900, 2079, 306, 774, - /* 2020 */ 494, 2896, 2666, 779, 311, 2793, 776, 805, 782, 2967, - /* 2030 */ 791, 843, 316, 8, 2939, 814, 1997, 309, 1992, 2811, - /* 2040 */ 878, 792, 320, 781, 790, 2966, 318, 202, 819, 322, - /* 2050 */ 818, 789, 2919, 487, 323, 2758, 327, 877, 324, 2793, - /* 2060 */ 830, 827, 167, 3021, 325, 2010, 2170, 2168, 231, 2811, - /* 2070 */ 2916, 330, 2000, 2002, 878, 336, 1, 2997, 215, 177, - /* 2080 */ 841, 2634, 394, 2633, 2632, 2758, 491, 877, 395, 898, - /* 2090 */ 897, 846, 847, 178, 72, 851, 2078, 2080, 2081, 2082, - /* 2100 */ 2083, 2085, 2792, 2811, 854, 2840, 885, 349, 883, 132, - /* 2110 */ 2794, 881, 2796, 2797, 876, 2881, 887, 864, 900, 2758, - /* 2120 */ 354, 877, 888, 2873, 396, 2900, 2472, 2750, 123, 494, - /* 2130 */ 2896, 2749, 2792, 126, 2745, 2840, 2744, 2736, 2735, 132, - /* 2140 */ 2794, 881, 2796, 2797, 876, 1514, 2793, 864, 900, 2727, - /* 2150 */ 2726, 2742, 2741, 858, 400, 2900, 2733, 997, 2732, 494, - /* 2160 */ 2896, 878, 902, 998, 2721, 1973, 2792, 1949, 2720, 2840, - /* 2170 */ 2739, 383, 2738, 133, 2794, 881, 2796, 2797, 876, 187, - /* 2180 */ 2730, 864, 900, 999, 386, 994, 767, 387, 402, 2900, - /* 2190 */ 2811, 2729, 2793, 2899, 2896, 2718, 2717, 2715, 2714, 508, - /* 2200 */ 507, 1974, 2523, 1001, 63, 444, 2758, 878, 877, 422, - /* 2210 */ 452, 447, 433, 453, 435, 404, 2710, 423, 898, 897, - /* 2220 */ 2709, 2708, 2793, 96, 2703, 2078, 2080, 2081, 2082, 2083, - /* 2230 */ 2085, 534, 535, 1933, 1934, 235, 2811, 878, 539, 2701, - /* 2240 */ 541, 542, 543, 1932, 2700, 2699, 461, 2697, 549, 2696, - /* 2250 */ 551, 2695, 2758, 2792, 877, 553, 2840, 1920, 555, 2670, - /* 2260 */ 133, 2794, 881, 2796, 2797, 876, 2811, 2694, 864, 900, - /* 2270 */ 239, 2669, 241, 1879, 97, 1878, 2900, 2647, 2646, 2645, - /* 2280 */ 860, 2896, 2758, 567, 877, 568, 2793, 2644, 2643, 2587, - /* 2290 */ 2584, 572, 1815, 2583, 575, 2577, 578, 579, 2574, 879, - /* 2300 */ 2573, 878, 2840, 244, 2572, 2571, 133, 2794, 881, 2796, - /* 2310 */ 2797, 876, 100, 2793, 864, 900, 2576, 246, 2575, 2570, - /* 2320 */ 2569, 2567, 2900, 2566, 2565, 248, 455, 2896, 878, 2792, - /* 2330 */ 2811, 2564, 2840, 595, 597, 2562, 200, 2794, 881, 2796, - /* 2340 */ 2797, 876, 2561, 2560, 864, 900, 2758, 2559, 877, 2558, - /* 2350 */ 2793, 2582, 2557, 2556, 2555, 2580, 2563, 2811, 2554, 2553, - /* 2360 */ 2552, 2550, 2549, 2548, 2547, 878, 250, 2544, 2543, 106, - /* 2370 */ 2542, 2541, 2540, 2758, 2546, 877, 2545, 2612, 2581, 2579, - /* 2380 */ 2539, 2538, 2537, 255, 2536, 634, 2535, 1821, 636, 2534, - /* 2390 */ 2532, 1666, 449, 2792, 2811, 1670, 2840, 823, 3019, 2793, - /* 2400 */ 133, 2794, 881, 2796, 2797, 876, 2362, 258, 864, 900, - /* 2410 */ 2758, 2361, 877, 259, 878, 2360, 2900, 2359, 261, 1662, - /* 2420 */ 2792, 2897, 2357, 2840, 2354, 262, 2353, 197, 2794, 881, - /* 2430 */ 2796, 2797, 876, 654, 484, 864, 900, 450, 656, 658, - /* 2440 */ 660, 655, 659, 2811, 2346, 662, 663, 2333, 2793, 664, - /* 2450 */ 666, 2307, 92, 210, 264, 2778, 1543, 2792, 2306, 2758, - /* 2460 */ 2840, 877, 93, 878, 432, 2794, 881, 2796, 2797, 876, - /* 2470 */ 221, 2668, 864, 900, 674, 266, 2793, 2959, 273, 275, - /* 2480 */ 2641, 2618, 278, 485, 2664, 2654, 2642, 280, 2611, 2449, - /* 2490 */ 2793, 878, 2811, 2356, 2352, 695, 697, 1592, 2350, 696, - /* 2500 */ 699, 701, 700, 2348, 703, 878, 2792, 704, 2758, 2840, - /* 2510 */ 877, 705, 2793, 432, 2794, 881, 2796, 2797, 876, 2345, - /* 2520 */ 2811, 864, 900, 707, 708, 2328, 709, 875, 2326, 2327, - /* 2530 */ 2325, 2303, 2451, 1748, 2811, 84, 2758, 1747, 877, 286, - /* 2540 */ 2450, 1651, 1652, 1650, 1647, 1645, 1643, 964, 1642, 1641, - /* 2550 */ 2758, 2343, 877, 1640, 1639, 2792, 2811, 966, 2840, 1636, - /* 2560 */ 1634, 475, 425, 2794, 881, 2796, 2797, 876, 2341, 1635, - /* 2570 */ 864, 900, 2758, 1633, 877, 476, 2332, 477, 743, 2330, - /* 2580 */ 478, 2793, 746, 2792, 2302, 2301, 2840, 2300, 750, 2299, - /* 2590 */ 200, 2794, 881, 2796, 2797, 876, 878, 2792, 864, 900, - /* 2600 */ 2840, 752, 2298, 754, 413, 2794, 881, 2796, 2797, 876, - /* 2610 */ 2297, 139, 864, 900, 756, 813, 1914, 2793, 1916, 2792, - /* 2620 */ 1918, 32, 2840, 2667, 1913, 2811, 431, 2794, 881, 2796, - /* 2630 */ 2797, 876, 878, 67, 864, 900, 78, 2866, 2663, 68, - /* 2640 */ 766, 2758, 1904, 877, 308, 2793, 1887, 1885, 1889, 2653, - /* 2650 */ 777, 191, 3020, 778, 312, 2640, 2639, 783, 1864, 1863, - /* 2660 */ 878, 2811, 3003, 21, 785, 497, 2223, 793, 483, 34, - /* 2670 */ 6, 315, 7, 2197, 795, 797, 317, 2758, 22, 877, - /* 2680 */ 799, 23, 2204, 214, 226, 201, 213, 17, 2792, 2811, - /* 2690 */ 2191, 2840, 35, 2779, 36, 432, 2794, 881, 2796, 2797, - /* 2700 */ 876, 493, 2161, 864, 900, 2758, 227, 877, 2163, 94, - /* 2710 */ 24, 228, 2165, 2243, 76, 2244, 25, 2238, 2237, 2145, - /* 2720 */ 488, 2242, 2241, 489, 2792, 2144, 2793, 2840, 332, 498, - /* 2730 */ 70, 417, 2794, 881, 2796, 2797, 876, 69, 2638, 864, - /* 2740 */ 900, 878, 206, 2617, 117, 18, 118, 2616, 119, 347, - /* 2750 */ 339, 2199, 2792, 2610, 2793, 2840, 216, 844, 345, 432, - /* 2760 */ 2794, 881, 2796, 2797, 876, 120, 80, 864, 900, 878, - /* 2770 */ 2811, 2097, 26, 850, 852, 348, 350, 2096, 13, 11, - /* 2780 */ 1998, 2057, 27, 28, 20, 48, 2758, 2107, 877, 915, - /* 2790 */ 2793, 2056, 207, 918, 921, 217, 2033, 880, 2811, 2609, - /* 2800 */ 886, 121, 2446, 924, 49, 878, 2055, 16, 29, 30, - /* 2810 */ 500, 2025, 884, 81, 2758, 352, 877, 891, 122, 892, - /* 2820 */ 358, 90, 127, 2793, 2850, 2849, 2259, 2258, 2068, 899, - /* 2830 */ 79, 2257, 1729, 2792, 2811, 2256, 2840, 907, 878, 901, - /* 2840 */ 432, 2794, 881, 2796, 2797, 876, 517, 909, 864, 900, - /* 2850 */ 2758, 1726, 877, 911, 914, 912, 917, 920, 1725, 923, - /* 2860 */ 1720, 762, 1722, 1719, 2840, 1716, 2793, 2811, 427, 2794, - /* 2870 */ 881, 2796, 2797, 876, 1718, 1714, 864, 900, 128, 382, - /* 2880 */ 129, 878, 1717, 2758, 1742, 877, 91, 1738, 1590, 938, - /* 2890 */ 1630, 1629, 1628, 1625, 1622, 1621, 1620, 2792, 1619, 2793, - /* 2900 */ 2840, 1660, 1617, 952, 409, 2794, 881, 2796, 2797, 876, - /* 2910 */ 2811, 1615, 864, 900, 878, 1614, 1613, 1659, 233, 1611, - /* 2920 */ 954, 1608, 1610, 1609, 1607, 1606, 2758, 1605, 877, 1656, - /* 2930 */ 2792, 1654, 1602, 2840, 1601, 1596, 2351, 406, 2794, 881, - /* 2940 */ 2796, 2797, 876, 2811, 1598, 864, 900, 1597, 1595, 976, - /* 2950 */ 974, 975, 2349, 978, 980, 979, 2347, 982, 983, 2758, - /* 2960 */ 984, 877, 2344, 2793, 986, 2324, 988, 990, 2322, 987, - /* 2970 */ 992, 1532, 2296, 2792, 996, 1515, 2840, 388, 878, 1520, - /* 2980 */ 410, 2794, 881, 2796, 2797, 876, 2793, 1522, 864, 900, - /* 2990 */ 1000, 2262, 1984, 401, 1003, 1004, 2262, 2262, 2262, 2262, - /* 3000 */ 2262, 878, 2262, 2262, 2262, 2262, 2792, 2811, 2262, 2840, - /* 3010 */ 2262, 2262, 2262, 424, 2794, 881, 2796, 2797, 876, 2262, - /* 3020 */ 2262, 864, 900, 2758, 2262, 877, 2262, 2262, 2262, 2262, - /* 3030 */ 2811, 2262, 2793, 2262, 2262, 2262, 2262, 2262, 2262, 2262, - /* 3040 */ 2262, 2262, 2262, 2262, 2262, 2262, 2758, 878, 877, 2262, - /* 3050 */ 2262, 2262, 2262, 2262, 2793, 2262, 2262, 2262, 2262, 2262, - /* 3060 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2793, 878, - /* 3070 */ 2792, 2262, 2262, 2840, 2262, 2262, 2811, 411, 2794, 881, - /* 3080 */ 2796, 2797, 876, 878, 2262, 864, 900, 2262, 2262, 2262, - /* 3090 */ 2262, 2262, 2758, 2792, 877, 2262, 2840, 2262, 2811, 2262, - /* 3100 */ 412, 2794, 881, 2796, 2797, 876, 2262, 2262, 864, 900, - /* 3110 */ 2262, 2262, 2811, 2262, 2758, 2262, 877, 2262, 2262, 2262, - /* 3120 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2758, 2262, - /* 3130 */ 877, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2792, - /* 3140 */ 2262, 2262, 2840, 2262, 2793, 2262, 428, 2794, 881, 2796, - /* 3150 */ 2797, 876, 2262, 2262, 864, 900, 2262, 2262, 2262, 878, - /* 3160 */ 2262, 2792, 2262, 2262, 2840, 2262, 2262, 2262, 414, 2794, - /* 3170 */ 881, 2796, 2797, 876, 2262, 2792, 864, 900, 2840, 2793, - /* 3180 */ 2262, 2262, 429, 2794, 881, 2796, 2797, 876, 2811, 2262, - /* 3190 */ 864, 900, 2262, 2262, 878, 2262, 2262, 2262, 2262, 2262, - /* 3200 */ 2262, 2262, 2262, 2262, 2758, 2262, 877, 2262, 2262, 2262, - /* 3210 */ 2262, 2262, 2793, 2262, 2262, 2262, 2262, 2262, 2262, 2262, - /* 3220 */ 2262, 2262, 2262, 2811, 2262, 2262, 2262, 878, 2262, 2262, - /* 3230 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2758, - /* 3240 */ 2262, 877, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, - /* 3250 */ 2262, 2792, 2262, 2262, 2840, 2793, 2811, 2262, 415, 2794, - /* 3260 */ 881, 2796, 2797, 876, 2262, 2262, 864, 900, 2262, 2262, - /* 3270 */ 878, 2262, 2758, 2262, 877, 2262, 2262, 2262, 2262, 2262, - /* 3280 */ 2262, 2262, 2262, 2262, 2262, 2262, 2792, 2262, 2793, 2840, - /* 3290 */ 2262, 2262, 2262, 430, 2794, 881, 2796, 2797, 876, 2811, - /* 3300 */ 2262, 864, 900, 878, 2262, 2262, 2262, 2262, 2262, 2262, - /* 3310 */ 2262, 2262, 2262, 2262, 2262, 2758, 2262, 877, 2262, 2792, - /* 3320 */ 2262, 2262, 2840, 2262, 2262, 2262, 416, 2794, 881, 2796, - /* 3330 */ 2797, 876, 2811, 2262, 864, 900, 2262, 2262, 2262, 2262, - /* 3340 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2758, 2262, - /* 3350 */ 877, 2262, 2793, 2262, 2262, 2262, 2262, 2262, 2262, 2262, - /* 3360 */ 2262, 2262, 2792, 2262, 2262, 2840, 2262, 878, 2262, 407, - /* 3370 */ 2794, 881, 2796, 2797, 876, 2793, 2262, 864, 900, 2262, - /* 3380 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, - /* 3390 */ 878, 2262, 2262, 2262, 2262, 2792, 2811, 2262, 2840, 2262, - /* 3400 */ 2262, 2262, 418, 2794, 881, 2796, 2797, 876, 2262, 2262, - /* 3410 */ 864, 900, 2758, 2262, 877, 2262, 2262, 2262, 2262, 2811, - /* 3420 */ 2262, 2793, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, - /* 3430 */ 2262, 2262, 2262, 2262, 2262, 2758, 878, 877, 2262, 2262, - /* 3440 */ 2262, 2262, 2262, 2793, 2262, 2262, 2262, 2262, 2262, 2262, - /* 3450 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2793, 878, 2792, - /* 3460 */ 2262, 2262, 2840, 2262, 2262, 2811, 419, 2794, 881, 2796, - /* 3470 */ 2797, 876, 878, 2262, 864, 900, 2262, 2262, 2262, 2262, - /* 3480 */ 2262, 2758, 2792, 877, 2262, 2840, 2262, 2811, 2262, 420, - /* 3490 */ 2794, 881, 2796, 2797, 876, 2262, 2262, 864, 900, 2262, - /* 3500 */ 2262, 2811, 2262, 2758, 2262, 877, 2262, 2262, 2262, 2262, - /* 3510 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2758, 2262, 877, - /* 3520 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2792, 2262, - /* 3530 */ 2262, 2840, 2262, 2793, 2262, 421, 2794, 881, 2796, 2797, - /* 3540 */ 876, 2262, 2262, 864, 900, 2262, 2262, 2262, 878, 2262, - /* 3550 */ 2792, 2262, 2262, 2840, 2262, 2262, 2262, 437, 2794, 881, - /* 3560 */ 2796, 2797, 876, 2262, 2792, 864, 900, 2840, 2793, 2262, - /* 3570 */ 2262, 438, 2794, 881, 2796, 2797, 876, 2811, 2262, 864, - /* 3580 */ 900, 2262, 2262, 878, 2262, 2262, 2262, 2262, 2262, 2262, - /* 3590 */ 2262, 2262, 2262, 2758, 2262, 877, 2262, 2262, 2262, 2262, - /* 3600 */ 2262, 2793, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, - /* 3610 */ 2262, 2262, 2811, 2262, 2262, 2262, 878, 2262, 2262, 2262, - /* 3620 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2758, 2262, - /* 3630 */ 877, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, - /* 3640 */ 2792, 2262, 2262, 2840, 2793, 2811, 2262, 2805, 2794, 881, - /* 3650 */ 2796, 2797, 876, 2262, 2262, 864, 900, 2262, 2262, 878, - /* 3660 */ 2262, 2758, 2262, 877, 2262, 2262, 2262, 2262, 2262, 2262, - /* 3670 */ 2262, 2262, 2262, 2262, 2262, 2792, 2262, 2793, 2840, 2262, - /* 3680 */ 2262, 2262, 2804, 2794, 881, 2796, 2797, 876, 2811, 2262, - /* 3690 */ 864, 900, 878, 2262, 2262, 2262, 2262, 2262, 2262, 2262, - /* 3700 */ 2262, 2262, 2262, 2262, 2758, 2262, 877, 2262, 2792, 2262, - /* 3710 */ 2262, 2840, 2262, 2262, 2262, 2803, 2794, 881, 2796, 2797, - /* 3720 */ 876, 2811, 2262, 864, 900, 2262, 2262, 2262, 2262, 2262, - /* 3730 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2758, 2262, 877, - /* 3740 */ 2262, 2793, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, - /* 3750 */ 2262, 2792, 2262, 2262, 2840, 2262, 878, 2262, 457, 2794, - /* 3760 */ 881, 2796, 2797, 876, 2793, 2262, 864, 900, 2262, 2262, - /* 3770 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 878, - /* 3780 */ 2262, 2262, 2262, 2262, 2792, 2811, 2262, 2840, 2262, 2262, - /* 3790 */ 2262, 458, 2794, 881, 2796, 2797, 876, 2262, 2262, 864, - /* 3800 */ 900, 2758, 2262, 877, 2262, 2262, 2262, 2262, 2811, 2262, - /* 3810 */ 2793, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, - /* 3820 */ 2262, 2262, 2262, 2262, 2758, 878, 877, 2262, 2262, 2262, - /* 3830 */ 2262, 2262, 2793, 2262, 2262, 2262, 2262, 2262, 2262, 2262, - /* 3840 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 878, 2792, 2262, - /* 3850 */ 2262, 2840, 2262, 2262, 2811, 454, 2794, 881, 2796, 2797, - /* 3860 */ 876, 2262, 2262, 864, 900, 2262, 2262, 2262, 2262, 2262, - /* 3870 */ 2758, 2792, 877, 2262, 2840, 2262, 2811, 2262, 459, 2794, - /* 3880 */ 881, 2796, 2797, 876, 2262, 2262, 864, 900, 2262, 2262, - /* 3890 */ 2262, 2262, 2758, 2262, 877, 2262, 2262, 2262, 2262, 2262, - /* 3900 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, - /* 3910 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 879, 2262, 2262, - /* 3920 */ 2840, 2262, 2262, 2262, 427, 2794, 881, 2796, 2797, 876, - /* 3930 */ 2262, 2262, 864, 900, 2262, 2262, 2262, 2262, 2262, 2792, - /* 3940 */ 2262, 2262, 2840, 2262, 2262, 2262, 426, 2794, 881, 2796, - /* 3950 */ 2797, 876, 2262, 2262, 864, 900, + /* 240 */ 453, 73, 2752, 2255, 877, 935, 185, 184, 932, 931, + /* 250 */ 930, 182, 1982, 1983, 2036, 809, 2038, 2041, 2042, 2043, + /* 260 */ 2044, 2045, 2046, 2047, 2048, 873, 866, 811, 225, 898, + /* 270 */ 897, 2067, 2068, 2069, 2070, 2071, 2074, 2076, 2077, 2078, + /* 280 */ 2079, 2081, 2, 58, 56, 2172, 2696, 2787, 895, 2786, + /* 290 */ 2110, 498, 2834, 1978, 582, 2589, 132, 2788, 881, 2790, + /* 300 */ 2791, 876, 875, 770, 864, 900, 573, 1976, 170, 2080, + /* 310 */ 179, 2865, 2894, 2188, 2620, 2746, 493, 2890, 51, 50, + /* 320 */ 833, 168, 57, 55, 54, 53, 52, 868, 500, 2008, + /* 330 */ 675, 2805, 531, 2147, 2617, 882, 672, 530, 867, 2075, + /* 340 */ 538, 335, 865, 33, 2003, 686, 19, 2752, 245, 877, + /* 350 */ 2997, 193, 44, 1984, 1531, 2111, 635, 633, 2992, 436, + /* 360 */ 518, 2467, 243, 2004, 51, 50, 58, 56, 57, 55, + /* 370 */ 54, 53, 52, 1538, 498, 720, 1978, 2996, 504, 719, + /* 380 */ 2004, 2993, 2994, 1000, 2545, 125, 15, 2280, 787, 265, + /* 390 */ 1976, 900, 2080, 673, 2786, 2313, 2992, 2834, 1533, 1536, + /* 400 */ 1537, 431, 2788, 881, 2790, 2791, 876, 874, 2112, 864, + /* 410 */ 900, 856, 2859, 2352, 2998, 229, 2147, 43, 351, 2993, + /* 420 */ 822, 2562, 2075, 2083, 2084, 865, 2217, 77, 39, 19, + /* 430 */ 689, 2003, 2116, 335, 51, 50, 1984, 2147, 57, 55, + /* 440 */ 54, 53, 52, 835, 198, 2902, 2903, 2752, 166, 2907, + /* 450 */ 2997, 42, 495, 2105, 2106, 2107, 2108, 2109, 2113, 2114, + /* 460 */ 2115, 124, 2039, 2049, 267, 2176, 1000, 2006, 673, 15, + /* 470 */ 2313, 2003, 2082, 2085, 2914, 2144, 2145, 2146, 2914, 2914, + /* 480 */ 2914, 2914, 2914, 193, 1558, 2117, 1557, 1979, 2458, 1977, + /* 490 */ 737, 736, 735, 2468, 863, 1750, 1751, 727, 165, 731, + /* 500 */ 164, 2036, 2439, 730, 40, 903, 2083, 2084, 729, 734, + /* 510 */ 473, 472, 1851, 1852, 728, 1824, 1825, 693, 471, 724, + /* 520 */ 723, 722, 1559, 1982, 1983, 2036, 73, 2038, 2041, 2042, + /* 530 */ 2043, 2044, 2045, 2046, 2047, 2048, 873, 866, 73, 612, + /* 540 */ 898, 897, 2067, 2068, 2279, 2039, 2049, 2074, 2076, 2077, + /* 550 */ 2078, 2079, 2081, 2, 611, 2082, 2085, 1661, 2144, 2145, + /* 560 */ 2146, 1850, 1853, 2240, 2247, 444, 443, 896, 2465, 771, + /* 570 */ 1979, 1660, 1977, 896, 2465, 505, 937, 863, 2914, 2144, + /* 580 */ 2145, 2146, 2914, 2914, 2914, 2914, 2914, 522, 951, 514, + /* 590 */ 2525, 2080, 610, 234, 937, 51, 50, 609, 459, 57, + /* 600 */ 55, 54, 53, 52, 2752, 608, 1982, 1983, 2036, 2523, + /* 610 */ 2038, 2041, 2042, 2043, 2044, 2045, 2046, 2047, 2048, 873, + /* 620 */ 866, 2075, 687, 898, 897, 2067, 2068, 62, 285, 2705, + /* 630 */ 2074, 2076, 2077, 2078, 2079, 2081, 2, 12, 58, 56, + /* 640 */ 333, 203, 2040, 328, 204, 222, 498, 640, 1978, 1665, + /* 650 */ 1711, 773, 2659, 710, 706, 702, 698, 953, 284, 525, + /* 660 */ 524, 2512, 1976, 1664, 2080, 1702, 927, 926, 925, 1706, + /* 670 */ 924, 1708, 1709, 923, 920, 95, 1717, 917, 1719, 1720, + /* 680 */ 914, 911, 908, 1985, 768, 787, 688, 2613, 821, 2091, + /* 690 */ 2246, 2525, 171, 2992, 2075, 2003, 2992, 865, 303, 489, + /* 700 */ 12, 19, 2457, 2056, 112, 2037, 1984, 2762, 1984, 282, + /* 710 */ 2523, 2998, 229, 904, 820, 229, 2993, 822, 335, 2993, + /* 720 */ 822, 58, 56, 2086, 2149, 2150, 2151, 2152, 2153, 498, + /* 730 */ 335, 1978, 392, 1711, 510, 196, 2766, 2269, 1000, 642, + /* 740 */ 2205, 15, 2278, 588, 2589, 1976, 2762, 2080, 1702, 927, + /* 750 */ 926, 925, 1706, 924, 1708, 1709, 872, 871, 928, 1717, + /* 760 */ 870, 1719, 1720, 869, 911, 908, 619, 2589, 1558, 1969, + /* 770 */ 1557, 1945, 786, 470, 468, 2766, 270, 2075, 2083, 2084, + /* 780 */ 865, 896, 2465, 1905, 1906, 281, 2768, 2770, 494, 272, + /* 790 */ 279, 1984, 479, 2667, 385, 277, 684, 247, 2454, 900, + /* 800 */ 513, 66, 2752, 507, 506, 1970, 1559, 803, 802, 2203, + /* 810 */ 2204, 2206, 2207, 2208, 269, 896, 2465, 2039, 2049, 335, + /* 820 */ 252, 1000, 898, 897, 59, 2768, 2771, 2082, 2085, 2074, + /* 830 */ 2076, 2077, 2078, 2079, 2081, 159, 2449, 466, 900, 737, + /* 840 */ 736, 735, 1979, 716, 1977, 550, 727, 165, 731, 863, + /* 850 */ 2519, 2520, 730, 467, 465, 501, 718, 729, 734, 473, + /* 860 */ 472, 2083, 2084, 728, 192, 1988, 2040, 471, 724, 723, + /* 870 */ 722, 342, 343, 896, 2465, 2470, 341, 720, 1982, 1983, + /* 880 */ 2036, 719, 2038, 2041, 2042, 2043, 2044, 2045, 2046, 2047, + /* 890 */ 2048, 873, 866, 570, 744, 898, 897, 2067, 2068, 1649, + /* 900 */ 2039, 2049, 2074, 2076, 2077, 2078, 2079, 2081, 2, 758, + /* 910 */ 2082, 2085, 2909, 71, 51, 50, 1947, 2277, 57, 55, + /* 920 */ 54, 53, 52, 169, 784, 1979, 2865, 1977, 300, 2037, + /* 930 */ 51, 50, 863, 2452, 57, 55, 54, 53, 52, 929, + /* 940 */ 2906, 566, 2516, 1978, 747, 1651, 565, 667, 509, 508, + /* 950 */ 73, 741, 739, 46, 1561, 1562, 665, 1976, 297, 661, + /* 960 */ 657, 1982, 1983, 2036, 115, 2038, 2041, 2042, 2043, 2044, + /* 970 */ 2045, 2046, 2047, 2048, 873, 866, 2525, 2752, 898, 897, + /* 980 */ 2067, 2068, 1946, 554, 503, 2074, 2076, 2077, 2078, 2079, + /* 990 */ 2081, 2, 58, 56, 2197, 2523, 2787, 787, 1879, 2706, + /* 1000 */ 498, 521, 1978, 1984, 83, 2992, 896, 2465, 2198, 82, + /* 1010 */ 192, 878, 556, 552, 512, 511, 1976, 2525, 2080, 896, + /* 1020 */ 2465, 2470, 2055, 2998, 229, 519, 571, 37, 2993, 822, + /* 1030 */ 54, 53, 52, 1000, 2787, 391, 2523, 135, 2058, 590, + /* 1040 */ 2805, 1538, 2276, 2169, 896, 2465, 518, 2467, 2075, 878, + /* 1050 */ 564, 865, 563, 310, 2196, 787, 2752, 2275, 877, 896, + /* 1060 */ 2465, 398, 1984, 2992, 604, 51, 50, 1536, 1537, 57, + /* 1070 */ 55, 54, 53, 52, 815, 58, 56, 2909, 2805, 605, + /* 1080 */ 2006, 2998, 229, 498, 562, 1978, 2993, 822, 896, 2465, + /* 1090 */ 712, 711, 1000, 2469, 2752, 59, 877, 480, 2667, 1976, + /* 1100 */ 392, 2080, 2752, 2786, 38, 2905, 2834, 2274, 606, 2673, + /* 1110 */ 197, 2788, 881, 2790, 2791, 876, 41, 2752, 864, 900, + /* 1120 */ 896, 2465, 51, 50, 733, 732, 57, 55, 54, 53, + /* 1130 */ 52, 2075, 2083, 2084, 865, 2003, 12, 1979, 10, 1977, + /* 1140 */ 692, 2786, 335, 2158, 2834, 1984, 896, 2465, 132, 2788, + /* 1150 */ 881, 2790, 2791, 876, 14, 13, 864, 900, 806, 788, + /* 1160 */ 2952, 2668, 2869, 857, 2894, 2866, 2462, 2752, 493, 2890, + /* 1170 */ 304, 2039, 2049, 1982, 1983, 1000, 965, 963, 59, 896, + /* 1180 */ 2465, 2082, 2085, 51, 50, 833, 168, 57, 55, 54, + /* 1190 */ 53, 52, 896, 2465, 714, 713, 1979, 2909, 1977, 305, + /* 1200 */ 51, 50, 2336, 863, 57, 55, 54, 53, 52, 859, + /* 1210 */ 2007, 2866, 313, 51, 50, 2083, 2084, 57, 55, 54, + /* 1220 */ 53, 52, 51, 50, 738, 2904, 57, 55, 54, 53, + /* 1230 */ 52, 2441, 1982, 1983, 2036, 2003, 2038, 2041, 2042, 2043, + /* 1240 */ 2044, 2045, 2046, 2047, 2048, 873, 866, 2285, 993, 898, + /* 1250 */ 897, 2067, 2068, 333, 2039, 2049, 2074, 2076, 2077, 2078, + /* 1260 */ 2079, 2081, 2, 2438, 2082, 2085, 51, 50, 2525, 2124, + /* 1270 */ 57, 55, 54, 53, 52, 812, 807, 800, 796, 1979, + /* 1280 */ 2525, 1977, 896, 2465, 896, 2465, 863, 840, 51, 50, + /* 1290 */ 111, 2061, 57, 55, 54, 53, 52, 833, 168, 848, + /* 1300 */ 2996, 2273, 839, 764, 159, 45, 2040, 2007, 2057, 138, + /* 1310 */ 2902, 2903, 721, 166, 2907, 1982, 1983, 2036, 2461, 2038, + /* 1320 */ 2041, 2042, 2043, 2044, 2045, 2046, 2047, 2048, 873, 866, + /* 1330 */ 896, 2465, 898, 897, 2067, 2068, 2692, 896, 2465, 2074, + /* 1340 */ 2076, 2077, 2078, 2079, 2081, 2, 58, 56, 2168, 933, + /* 1350 */ 346, 440, 2516, 2001, 498, 2272, 1978, 853, 2271, 787, + /* 1360 */ 617, 2752, 192, 463, 761, 825, 760, 2992, 772, 2037, + /* 1370 */ 1976, 637, 2080, 2471, 2007, 837, 935, 185, 184, 932, + /* 1380 */ 931, 930, 182, 896, 2465, 2998, 229, 596, 2268, 639, + /* 1390 */ 2993, 822, 2267, 302, 441, 598, 2054, 301, 934, 828, + /* 1400 */ 175, 2516, 2075, 353, 2527, 865, 576, 136, 935, 185, + /* 1410 */ 184, 932, 931, 930, 182, 2752, 1984, 2266, 2752, 525, + /* 1420 */ 524, 199, 2902, 2903, 787, 166, 2907, 3, 2265, 1992, + /* 1430 */ 545, 787, 2992, 896, 2465, 629, 1540, 290, 89, 2992, + /* 1440 */ 288, 64, 2002, 1985, 2008, 2080, 1000, 462, 2752, 15, + /* 1450 */ 2998, 229, 2752, 889, 236, 2993, 822, 2998, 229, 584, + /* 1460 */ 51, 50, 2993, 822, 57, 55, 54, 53, 52, 2037, + /* 1470 */ 183, 114, 47, 2264, 2263, 2075, 448, 2752, 2262, 478, + /* 1480 */ 224, 759, 175, 1895, 896, 2465, 2083, 2084, 2752, 1984, + /* 1490 */ 2600, 2579, 102, 625, 624, 623, 622, 621, 616, 615, + /* 1500 */ 614, 613, 445, 254, 890, 603, 602, 601, 600, 599, + /* 1510 */ 593, 592, 591, 2261, 586, 585, 460, 2572, 2260, 861, + /* 1520 */ 577, 1812, 1813, 896, 2465, 2039, 2049, 1831, 628, 253, + /* 1530 */ 2525, 896, 2465, 2752, 2752, 2082, 2085, 2442, 2752, 1644, + /* 1540 */ 161, 2008, 626, 894, 725, 292, 726, 232, 291, 2524, + /* 1550 */ 1979, 381, 1977, 65, 101, 294, 314, 863, 293, 638, + /* 1560 */ 296, 580, 2334, 295, 862, 1903, 945, 1642, 794, 1640, + /* 1570 */ 174, 60, 60, 2752, 212, 2249, 2250, 223, 2752, 2325, + /* 1580 */ 220, 14, 13, 183, 740, 1645, 1982, 1983, 2036, 1614, + /* 1590 */ 2038, 2041, 2042, 2043, 2044, 2045, 2046, 2047, 2048, 873, + /* 1600 */ 866, 742, 2323, 898, 897, 2067, 2068, 116, 2008, 340, + /* 1610 */ 2074, 2076, 2077, 2078, 2079, 2081, 2, 194, 88, 60, + /* 1620 */ 2787, 75, 405, 1993, 745, 1988, 824, 130, 60, 127, + /* 1630 */ 60, 2270, 2773, 60, 88, 836, 180, 161, 183, 360, + /* 1640 */ 359, 403, 87, 362, 361, 86, 364, 363, 366, 365, + /* 1650 */ 2787, 2192, 368, 367, 2202, 2201, 442, 319, 1987, 1996, + /* 1660 */ 1998, 370, 369, 826, 2805, 878, 838, 2315, 263, 652, + /* 1670 */ 650, 647, 645, 372, 371, 85, 898, 897, 374, 373, + /* 1680 */ 2752, 2399, 877, 2074, 2076, 2077, 2078, 2079, 2081, 376, + /* 1690 */ 375, 906, 344, 181, 2805, 1986, 2775, 378, 377, 829, + /* 1700 */ 183, 845, 2059, 162, 2118, 380, 379, 2317, 180, 946, + /* 1710 */ 2752, 2062, 877, 2050, 73, 1622, 1848, 1838, 2955, 356, + /* 1720 */ 893, 1693, 203, 329, 1595, 804, 321, 2786, 834, 163, + /* 1730 */ 2834, 2806, 1612, 2306, 132, 2788, 881, 2790, 2791, 876, + /* 1740 */ 2391, 2102, 864, 900, 2390, 2945, 801, 485, 211, 808, + /* 1750 */ 2894, 481, 2598, 74, 493, 2890, 2787, 2786, 397, 842, + /* 1760 */ 2834, 1623, 989, 529, 132, 2788, 881, 2790, 2791, 876, + /* 1770 */ 1596, 878, 864, 900, 1724, 2787, 1732, 547, 3012, 2312, + /* 1780 */ 2894, 2513, 2942, 1739, 493, 2890, 1737, 780, 2946, 816, + /* 1790 */ 878, 186, 2949, 817, 331, 2956, 326, 334, 2599, 2425, + /* 1800 */ 2805, 5, 532, 2001, 537, 457, 2011, 99, 98, 569, + /* 1810 */ 546, 557, 242, 237, 238, 574, 2752, 240, 877, 2805, + /* 1820 */ 1872, 390, 558, 560, 2002, 561, 559, 581, 251, 583, + /* 1830 */ 587, 589, 607, 631, 594, 2752, 618, 877, 439, 620, + /* 1840 */ 1990, 548, 2591, 627, 544, 540, 536, 533, 562, 630, + /* 1850 */ 632, 643, 641, 644, 257, 256, 646, 648, 649, 260, + /* 1860 */ 651, 653, 2009, 2786, 668, 4, 2834, 669, 676, 677, + /* 1870 */ 200, 2788, 881, 2790, 2791, 876, 679, 1989, 864, 900, + /* 1880 */ 2004, 681, 2786, 268, 2787, 2834, 107, 271, 2010, 132, + /* 1890 */ 2788, 881, 2790, 2791, 876, 682, 2012, 864, 900, 878, + /* 1900 */ 274, 2962, 683, 3012, 276, 2894, 335, 685, 2013, 493, + /* 1910 */ 2890, 2614, 108, 2014, 2608, 694, 109, 110, 283, 715, + /* 1920 */ 137, 2787, 717, 763, 2455, 2682, 287, 2451, 2805, 289, + /* 1930 */ 188, 823, 3013, 748, 134, 749, 878, 765, 798, 113, + /* 1940 */ 2453, 434, 2448, 189, 2752, 2005, 877, 190, 176, 393, + /* 1950 */ 306, 2660, 775, 774, 776, 781, 309, 311, 782, 805, + /* 1960 */ 2679, 2961, 843, 2960, 2678, 2805, 814, 779, 791, 320, + /* 1970 */ 8, 819, 2787, 322, 2933, 202, 792, 790, 818, 323, + /* 1980 */ 3015, 2752, 789, 877, 2913, 324, 327, 878, 486, 2985, + /* 1990 */ 316, 2786, 827, 318, 2834, 830, 325, 2006, 132, 2788, + /* 2000 */ 881, 2790, 2791, 876, 2166, 1, 864, 900, 2787, 167, + /* 2010 */ 2991, 2164, 3012, 215, 2894, 330, 2805, 231, 493, 2890, + /* 2020 */ 2910, 336, 177, 878, 846, 2926, 394, 841, 2786, 2628, + /* 2030 */ 395, 2834, 2752, 847, 877, 132, 2788, 881, 2790, 2791, + /* 2040 */ 876, 2627, 72, 864, 900, 178, 883, 854, 2875, 3012, + /* 2050 */ 887, 2894, 2805, 2626, 2787, 493, 2890, 349, 490, 851, + /* 2060 */ 354, 123, 885, 396, 2466, 888, 2744, 126, 2752, 878, + /* 2070 */ 877, 2743, 1510, 2739, 2738, 2730, 995, 2729, 2721, 2786, + /* 2080 */ 2720, 400, 2834, 996, 997, 187, 132, 2788, 881, 2790, + /* 2090 */ 2791, 876, 2736, 386, 864, 900, 2787, 2735, 2805, 992, + /* 2100 */ 3012, 2727, 2894, 383, 435, 387, 493, 2890, 999, 767, + /* 2110 */ 404, 878, 902, 2726, 2752, 2786, 877, 2715, 2834, 2714, + /* 2120 */ 422, 2733, 132, 2788, 881, 2790, 2791, 876, 2732, 2724, + /* 2130 */ 864, 900, 2723, 402, 2787, 2712, 3012, 2711, 2894, 2709, + /* 2140 */ 2805, 469, 493, 2890, 2708, 2517, 433, 449, 516, 878, + /* 2150 */ 423, 2704, 2703, 2702, 96, 63, 2752, 450, 877, 2697, + /* 2160 */ 534, 2786, 535, 1929, 2834, 1930, 235, 539, 132, 2788, + /* 2170 */ 881, 2790, 2791, 876, 2695, 541, 864, 900, 2805, 542, + /* 2180 */ 543, 1928, 2867, 2694, 2894, 2693, 458, 2691, 493, 2890, + /* 2190 */ 549, 2690, 551, 2689, 2752, 553, 877, 2688, 555, 1916, + /* 2200 */ 2664, 2663, 239, 2786, 241, 1875, 2834, 97, 1874, 2641, + /* 2210 */ 132, 2788, 881, 2790, 2791, 876, 567, 568, 864, 900, + /* 2220 */ 2640, 2787, 2639, 2638, 858, 2637, 2894, 2581, 572, 1811, + /* 2230 */ 493, 2890, 2578, 2577, 575, 2571, 878, 2568, 578, 244, + /* 2240 */ 579, 2786, 2567, 100, 2834, 2566, 2565, 2570, 133, 2788, + /* 2250 */ 881, 2790, 2791, 876, 769, 246, 864, 900, 2569, 2564, + /* 2260 */ 2563, 2561, 2560, 2559, 2894, 2805, 248, 595, 2893, 2890, + /* 2270 */ 2787, 2558, 1003, 597, 2556, 2555, 2554, 2553, 2552, 2576, + /* 2280 */ 2551, 2752, 2550, 877, 2549, 878, 2574, 2557, 2548, 2547, + /* 2290 */ 2546, 389, 2544, 2543, 2542, 2541, 2540, 2539, 2538, 250, + /* 2300 */ 2537, 106, 2536, 2535, 2534, 2606, 991, 219, 2575, 2573, + /* 2310 */ 2533, 2532, 2531, 1817, 2805, 255, 987, 983, 979, 975, + /* 2320 */ 2530, 384, 634, 2529, 636, 2528, 2526, 2356, 2786, 1662, + /* 2330 */ 2752, 2834, 877, 446, 258, 133, 2788, 881, 2790, 2791, + /* 2340 */ 876, 1666, 2355, 864, 900, 2354, 2353, 2351, 2348, 1658, + /* 2350 */ 2347, 2894, 654, 447, 2340, 860, 2890, 658, 2327, 2301, + /* 2360 */ 2300, 2662, 656, 1539, 662, 2658, 666, 131, 660, 210, + /* 2370 */ 2648, 655, 357, 2636, 259, 2787, 659, 879, 664, 264, + /* 2380 */ 2834, 2635, 261, 262, 133, 2788, 881, 2790, 2791, 876, + /* 2390 */ 878, 663, 864, 900, 2772, 92, 2612, 266, 2605, 275, + /* 2400 */ 2894, 2443, 2787, 849, 452, 2890, 221, 93, 674, 1588, + /* 2410 */ 273, 2350, 2346, 278, 695, 280, 697, 878, 2344, 2805, + /* 2420 */ 699, 2787, 696, 700, 701, 2342, 703, 705, 704, 2339, + /* 2430 */ 707, 708, 709, 2322, 2320, 2752, 878, 877, 2321, 2319, + /* 2440 */ 2297, 2445, 2787, 1744, 1743, 2444, 2805, 962, 355, 1648, + /* 2450 */ 855, 1647, 1646, 338, 964, 1643, 84, 878, 337, 1641, + /* 2460 */ 1639, 286, 2752, 2337, 877, 2805, 1638, 1637, 1636, 1630, + /* 2470 */ 474, 1635, 1632, 1631, 2335, 475, 2326, 307, 1629, 476, + /* 2480 */ 2324, 2752, 2786, 877, 743, 2834, 2805, 477, 2787, 133, + /* 2490 */ 2788, 881, 2790, 2791, 876, 746, 2296, 864, 900, 2295, + /* 2500 */ 2294, 2293, 2752, 878, 877, 2894, 750, 752, 2292, 2786, + /* 2510 */ 2891, 754, 2834, 2291, 756, 139, 408, 2788, 881, 2790, + /* 2520 */ 2791, 876, 1910, 31, 864, 900, 483, 1912, 2786, 1909, + /* 2530 */ 2661, 2834, 2805, 1914, 67, 197, 2788, 881, 2790, 2791, + /* 2540 */ 876, 32, 2657, 864, 900, 308, 68, 1881, 2752, 2786, + /* 2550 */ 877, 1883, 2834, 2647, 777, 2787, 432, 2788, 881, 2790, + /* 2560 */ 2791, 876, 2634, 766, 864, 900, 78, 1885, 1900, 778, + /* 2570 */ 878, 2633, 484, 2997, 2787, 1860, 21, 17, 312, 1859, + /* 2580 */ 2219, 34, 315, 793, 2193, 2953, 191, 795, 783, 878, + /* 2590 */ 785, 482, 6, 7, 797, 2786, 799, 22, 2834, 2805, + /* 2600 */ 23, 2787, 432, 2788, 881, 2790, 2791, 876, 214, 226, + /* 2610 */ 864, 900, 2773, 317, 2200, 2752, 875, 877, 2805, 201, + /* 2620 */ 36, 213, 35, 76, 227, 2187, 2159, 94, 2161, 25, + /* 2630 */ 2157, 228, 332, 2239, 2752, 2240, 877, 2234, 2233, 487, + /* 2640 */ 2238, 2237, 488, 2141, 2140, 2805, 70, 2632, 206, 2611, + /* 2650 */ 117, 118, 24, 339, 2195, 2610, 844, 2604, 119, 120, + /* 2660 */ 216, 2752, 2786, 877, 345, 2834, 850, 80, 350, 425, + /* 2670 */ 2788, 881, 2790, 2791, 876, 348, 26, 864, 900, 347, + /* 2680 */ 13, 2786, 2093, 18, 2834, 69, 852, 11, 200, 2788, + /* 2690 */ 881, 2790, 2791, 876, 1994, 2092, 864, 900, 2103, 27, + /* 2700 */ 28, 20, 207, 48, 217, 2053, 2029, 880, 2786, 2052, + /* 2710 */ 913, 2834, 2603, 916, 2787, 431, 2788, 881, 2790, 2791, + /* 2720 */ 876, 121, 813, 864, 900, 919, 2860, 922, 127, 878, + /* 2730 */ 886, 2440, 49, 891, 2051, 2021, 16, 29, 30, 81, + /* 2740 */ 352, 2787, 884, 122, 90, 892, 358, 2844, 2843, 899, + /* 2750 */ 3014, 2064, 79, 2252, 2253, 1725, 878, 901, 2805, 905, + /* 2760 */ 517, 907, 909, 912, 1722, 910, 915, 1716, 1721, 918, + /* 2770 */ 1718, 921, 1712, 1715, 2752, 1710, 877, 1714, 2787, 1713, + /* 2780 */ 128, 382, 129, 1738, 91, 2805, 1734, 1626, 1625, 1586, + /* 2790 */ 936, 1624, 1621, 878, 1618, 950, 1617, 1616, 496, 1615, + /* 2800 */ 1656, 2752, 1613, 877, 1611, 2787, 1610, 1609, 952, 233, + /* 2810 */ 1655, 1607, 1604, 1606, 1605, 1603, 1602, 1601, 1652, 1650, + /* 2820 */ 878, 2786, 2805, 1598, 2834, 492, 1592, 1597, 432, 2788, + /* 2830 */ 881, 2790, 2791, 876, 1594, 1593, 864, 900, 2752, 1591, + /* 2840 */ 877, 2345, 972, 973, 974, 2343, 976, 977, 2786, 2805, + /* 2850 */ 2341, 2834, 978, 980, 2338, 417, 2788, 881, 2790, 2791, + /* 2860 */ 876, 981, 497, 864, 900, 2752, 982, 877, 984, 2787, + /* 2870 */ 985, 986, 2318, 988, 2316, 990, 1528, 2290, 1511, 994, + /* 2880 */ 1516, 388, 998, 1518, 878, 2786, 1980, 401, 2834, 499, + /* 2890 */ 2787, 1001, 432, 2788, 881, 2790, 2791, 876, 1002, 2256, + /* 2900 */ 864, 900, 2256, 2256, 2256, 878, 2256, 2256, 2256, 2256, + /* 2910 */ 2787, 2256, 2786, 2805, 2256, 2834, 2256, 2256, 2256, 432, + /* 2920 */ 2788, 881, 2790, 2791, 876, 878, 2256, 864, 900, 2752, + /* 2930 */ 2256, 877, 2256, 2256, 2805, 2256, 2787, 2256, 2256, 2256, + /* 2940 */ 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, + /* 2950 */ 2752, 878, 877, 2256, 2805, 2256, 2256, 2256, 2256, 2256, + /* 2960 */ 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, + /* 2970 */ 2752, 2256, 877, 2256, 2256, 2787, 2786, 2256, 2256, 2834, + /* 2980 */ 2805, 2256, 2256, 413, 2788, 881, 2790, 2791, 876, 2256, + /* 2990 */ 878, 864, 900, 2256, 2256, 2256, 2752, 762, 877, 2256, + /* 3000 */ 2834, 2787, 2256, 2256, 427, 2788, 881, 2790, 2791, 876, + /* 3010 */ 2256, 2256, 864, 900, 2256, 2256, 878, 2786, 2256, 2805, + /* 3020 */ 2834, 2256, 2256, 2256, 409, 2788, 881, 2790, 2791, 876, + /* 3030 */ 2256, 2256, 864, 900, 2256, 2752, 2256, 877, 2256, 2256, + /* 3040 */ 2256, 2256, 2256, 2786, 2256, 2805, 2834, 2256, 2256, 2256, + /* 3050 */ 406, 2788, 881, 2790, 2791, 876, 2256, 2256, 864, 900, + /* 3060 */ 2256, 2752, 2256, 877, 2256, 2256, 2256, 2256, 2256, 2256, + /* 3070 */ 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, + /* 3080 */ 2256, 2256, 2786, 2256, 2256, 2834, 2256, 2256, 2256, 410, + /* 3090 */ 2788, 881, 2790, 2791, 876, 2256, 2256, 864, 900, 2256, + /* 3100 */ 2256, 2256, 2256, 2256, 2256, 2256, 2787, 2256, 2786, 2256, + /* 3110 */ 2256, 2834, 2256, 2256, 2256, 424, 2788, 881, 2790, 2791, + /* 3120 */ 876, 878, 2256, 864, 900, 2256, 2256, 2787, 2256, 2256, + /* 3130 */ 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, + /* 3140 */ 2256, 2256, 878, 2256, 2787, 2256, 2256, 2256, 2256, 2256, + /* 3150 */ 2805, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 878, + /* 3160 */ 2256, 2256, 2256, 2256, 2256, 2256, 2752, 2256, 877, 2256, + /* 3170 */ 2256, 2805, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, + /* 3180 */ 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2752, 2805, 877, + /* 3190 */ 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, + /* 3200 */ 2256, 2256, 2256, 2256, 2752, 2256, 877, 2256, 2256, 2256, + /* 3210 */ 2256, 2787, 2256, 2786, 2256, 2256, 2834, 2256, 2256, 2256, + /* 3220 */ 411, 2788, 881, 2790, 2791, 876, 878, 2256, 864, 900, + /* 3230 */ 2256, 2256, 2256, 2256, 2786, 2256, 2256, 2834, 2256, 2256, + /* 3240 */ 2256, 412, 2788, 881, 2790, 2791, 876, 2256, 2256, 864, + /* 3250 */ 900, 2786, 2256, 2787, 2834, 2805, 2256, 2256, 428, 2788, + /* 3260 */ 881, 2790, 2791, 876, 2256, 2256, 864, 900, 878, 2256, + /* 3270 */ 2256, 2752, 2256, 877, 2256, 2787, 2256, 2256, 2256, 2256, + /* 3280 */ 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, + /* 3290 */ 878, 2256, 2256, 2256, 2256, 2256, 2787, 2805, 2256, 2256, + /* 3300 */ 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, + /* 3310 */ 2256, 878, 2256, 2752, 2256, 877, 2256, 2787, 2786, 2805, + /* 3320 */ 2256, 2834, 2256, 2256, 2256, 414, 2788, 881, 2790, 2791, + /* 3330 */ 876, 2256, 878, 864, 900, 2752, 2256, 877, 2256, 2256, + /* 3340 */ 2805, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, + /* 3350 */ 2256, 2256, 2256, 2256, 2256, 2256, 2752, 2256, 877, 2256, + /* 3360 */ 2786, 2805, 2256, 2834, 2256, 2256, 2256, 429, 2788, 881, + /* 3370 */ 2790, 2791, 876, 2256, 2256, 864, 900, 2752, 2256, 877, + /* 3380 */ 2256, 2256, 2786, 2256, 2787, 2834, 2256, 2256, 2256, 415, + /* 3390 */ 2788, 881, 2790, 2791, 876, 2256, 2256, 864, 900, 878, + /* 3400 */ 2256, 2256, 2256, 2786, 2256, 2787, 2834, 2256, 2256, 2256, + /* 3410 */ 430, 2788, 881, 2790, 2791, 876, 2256, 2256, 864, 900, + /* 3420 */ 878, 2256, 2256, 2256, 2786, 2256, 2256, 2834, 2805, 2256, + /* 3430 */ 2256, 416, 2788, 881, 2790, 2791, 876, 2256, 2256, 864, + /* 3440 */ 900, 2256, 2256, 2256, 2752, 2256, 877, 2256, 2256, 2805, + /* 3450 */ 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, + /* 3460 */ 2256, 2256, 2256, 2256, 2256, 2752, 2256, 877, 2256, 2256, + /* 3470 */ 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, + /* 3480 */ 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, + /* 3490 */ 2256, 2786, 2256, 2256, 2834, 2256, 2256, 2256, 407, 2788, + /* 3500 */ 881, 2790, 2791, 876, 2256, 2256, 864, 900, 2256, 2256, + /* 3510 */ 2787, 2256, 2786, 2256, 2256, 2834, 2256, 2256, 2256, 418, + /* 3520 */ 2788, 881, 2790, 2791, 876, 878, 2256, 864, 900, 2256, + /* 3530 */ 2787, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, + /* 3540 */ 2256, 2256, 2256, 2256, 2256, 878, 2256, 2256, 2256, 2256, + /* 3550 */ 2256, 2256, 2787, 2256, 2805, 2256, 2256, 2256, 2256, 2256, + /* 3560 */ 2256, 2256, 2256, 2256, 2256, 2256, 2256, 878, 2256, 2256, + /* 3570 */ 2752, 2256, 877, 2256, 2805, 2256, 2256, 2256, 2256, 2256, + /* 3580 */ 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, + /* 3590 */ 2752, 2256, 877, 2256, 2256, 2256, 2805, 2256, 2256, 2256, + /* 3600 */ 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, + /* 3610 */ 2256, 2256, 2752, 2256, 877, 2256, 2256, 2786, 2256, 2256, + /* 3620 */ 2834, 2256, 2256, 2256, 419, 2788, 881, 2790, 2791, 876, + /* 3630 */ 2256, 2256, 864, 900, 2256, 2787, 2256, 2786, 2256, 2256, + /* 3640 */ 2834, 2256, 2256, 2256, 420, 2788, 881, 2790, 2791, 876, + /* 3650 */ 878, 2256, 864, 900, 2256, 2256, 2256, 2787, 2256, 2786, + /* 3660 */ 2256, 2256, 2834, 2256, 2256, 2256, 421, 2788, 881, 2790, + /* 3670 */ 2791, 876, 878, 2256, 864, 900, 2787, 2256, 2256, 2805, + /* 3680 */ 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, + /* 3690 */ 2256, 878, 2256, 2256, 2256, 2752, 2256, 877, 2256, 2787, + /* 3700 */ 2256, 2805, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, + /* 3710 */ 2256, 2256, 2256, 2256, 878, 2256, 2256, 2752, 2256, 877, + /* 3720 */ 2805, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, + /* 3730 */ 2256, 2256, 2256, 2256, 2256, 2256, 2752, 2256, 877, 2256, + /* 3740 */ 2256, 2256, 2786, 2805, 2256, 2834, 2256, 2256, 2256, 437, + /* 3750 */ 2788, 881, 2790, 2791, 876, 2256, 2256, 864, 900, 2752, + /* 3760 */ 2256, 877, 2256, 2787, 2786, 2256, 2256, 2834, 2256, 2256, + /* 3770 */ 2256, 438, 2788, 881, 2790, 2791, 876, 2256, 878, 864, + /* 3780 */ 900, 2256, 2256, 2786, 2256, 2787, 2834, 2256, 2256, 2256, + /* 3790 */ 2799, 2788, 881, 2790, 2791, 876, 2256, 2256, 864, 900, + /* 3800 */ 878, 2256, 2256, 2256, 2787, 2256, 2786, 2805, 2256, 2834, + /* 3810 */ 2256, 2256, 2256, 2798, 2788, 881, 2790, 2791, 876, 878, + /* 3820 */ 2256, 864, 900, 2752, 2256, 877, 2256, 2256, 2256, 2805, + /* 3830 */ 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, + /* 3840 */ 2256, 2256, 2256, 2256, 2256, 2752, 2256, 877, 2805, 2256, + /* 3850 */ 2256, 2256, 2256, 2787, 2256, 2256, 2256, 2256, 2256, 2256, + /* 3860 */ 2256, 2256, 2256, 2256, 2752, 2256, 877, 2256, 878, 2256, + /* 3870 */ 2786, 2256, 2256, 2834, 2256, 2256, 2256, 2797, 2788, 881, + /* 3880 */ 2790, 2791, 876, 2256, 2256, 864, 900, 2256, 2256, 2256, + /* 3890 */ 2256, 2256, 2786, 2256, 2256, 2834, 2256, 2805, 2256, 454, + /* 3900 */ 2788, 881, 2790, 2791, 876, 2256, 2256, 864, 900, 2256, + /* 3910 */ 2256, 2786, 2256, 2752, 2834, 877, 2256, 2256, 455, 2788, + /* 3920 */ 881, 2790, 2791, 876, 2256, 2256, 864, 900, 2256, 2256, + /* 3930 */ 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2787, 2256, + /* 3940 */ 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, + /* 3950 */ 2256, 2256, 2256, 878, 2256, 2256, 2256, 2256, 2787, 2256, + /* 3960 */ 2786, 2256, 2256, 2834, 2256, 2256, 2256, 451, 2788, 881, + /* 3970 */ 2790, 2791, 876, 878, 2256, 864, 900, 2256, 2787, 2256, + /* 3980 */ 2256, 2256, 2805, 2256, 2256, 2256, 2256, 2256, 2256, 2256, + /* 3990 */ 2256, 2256, 2256, 878, 2256, 2256, 2256, 2256, 2752, 2256, + /* 4000 */ 877, 2256, 2805, 2256, 2256, 2256, 2256, 2256, 2256, 2256, + /* 4010 */ 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2752, 2256, + /* 4020 */ 877, 2256, 2805, 2256, 2256, 2256, 2256, 2256, 2256, 2256, + /* 4030 */ 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2752, 2256, + /* 4040 */ 877, 2256, 2256, 2256, 2256, 2786, 2256, 2256, 2834, 2256, + /* 4050 */ 2256, 2256, 456, 2788, 881, 2790, 2791, 876, 2256, 2256, + /* 4060 */ 864, 900, 2256, 2256, 2256, 879, 2256, 2256, 2834, 2256, + /* 4070 */ 2256, 2256, 427, 2788, 881, 2790, 2791, 876, 2256, 2256, + /* 4080 */ 864, 900, 2256, 2256, 2256, 2786, 2256, 2256, 2834, 2256, + /* 4090 */ 2256, 2256, 426, 2788, 881, 2790, 2791, 876, 2256, 2256, + /* 4100 */ 864, 900, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 530, 397, 530, 397, 400, 401, 400, 401, 538, 433, - /* 10 */ 538, 418, 12, 13, 421, 12, 13, 14, 15, 16, - /* 20 */ 20, 0, 22, 450, 20, 427, 556, 557, 402, 557, - /* 30 */ 432, 561, 562, 561, 562, 427, 36, 464, 38, 0, - /* 40 */ 432, 388, 21, 470, 471, 24, 25, 26, 27, 28, - /* 50 */ 29, 30, 31, 32, 402, 403, 403, 459, 8, 9, - /* 60 */ 402, 403, 12, 13, 14, 15, 16, 459, 68, 21, - /* 70 */ 494, 71, 24, 25, 26, 27, 28, 29, 30, 31, - /* 80 */ 32, 20, 82, 8, 9, 432, 21, 12, 13, 14, - /* 90 */ 15, 16, 8, 9, 0, 20, 12, 13, 14, 15, - /* 100 */ 16, 448, 37, 450, 39, 40, 41, 42, 456, 402, - /* 110 */ 484, 485, 112, 20, 74, 115, 77, 78, 79, 80, + /* 0 */ 527, 394, 527, 394, 397, 398, 397, 398, 535, 430, + /* 10 */ 535, 415, 12, 13, 418, 12, 13, 14, 15, 16, + /* 20 */ 20, 0, 22, 447, 421, 424, 553, 554, 425, 554, + /* 30 */ 429, 558, 559, 558, 559, 424, 36, 461, 38, 0, + /* 40 */ 429, 385, 21, 467, 468, 24, 25, 26, 27, 28, + /* 50 */ 29, 30, 31, 32, 20, 20, 400, 456, 8, 9, + /* 60 */ 399, 400, 12, 13, 14, 15, 16, 456, 68, 21, + /* 70 */ 491, 71, 24, 25, 26, 27, 28, 29, 30, 31, + /* 80 */ 32, 429, 82, 8, 9, 429, 21, 12, 13, 14, + /* 90 */ 15, 16, 8, 9, 20, 20, 12, 13, 14, 15, + /* 100 */ 16, 445, 37, 447, 39, 40, 41, 42, 456, 399, + /* 110 */ 443, 399, 112, 446, 447, 115, 77, 78, 79, 80, /* 120 */ 81, 68, 83, 84, 85, 86, 87, 88, 89, 90, /* 130 */ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - /* 140 */ 101, 102, 103, 104, 105, 106, 107, 108, 495, 519, - /* 150 */ 520, 498, 152, 153, 403, 502, 503, 504, 505, 506, - /* 160 */ 507, 435, 435, 510, 511, 438, 116, 114, 461, 516, - /* 170 */ 463, 518, 119, 8, 9, 522, 523, 12, 13, 14, - /* 180 */ 15, 16, 388, 432, 526, 527, 528, 20, 530, 531, - /* 190 */ 3, 191, 192, 146, 147, 542, 538, 403, 151, 126, - /* 200 */ 116, 201, 202, 550, 0, 8, 9, 20, 115, 12, - /* 210 */ 13, 14, 15, 16, 556, 557, 216, 4, 218, 561, - /* 220 */ 562, 14, 44, 223, 498, 498, 432, 20, 24, 25, - /* 230 */ 26, 27, 28, 29, 30, 31, 32, 511, 511, 186, - /* 240 */ 75, 20, 448, 385, 450, 145, 146, 147, 148, 149, - /* 250 */ 150, 151, 252, 253, 254, 504, 256, 257, 258, 259, + /* 140 */ 101, 102, 103, 104, 105, 106, 107, 108, 492, 115, + /* 150 */ 115, 495, 152, 153, 400, 499, 500, 501, 502, 503, + /* 160 */ 504, 432, 432, 507, 508, 435, 116, 114, 458, 513, + /* 170 */ 460, 515, 119, 8, 9, 519, 520, 12, 13, 14, + /* 180 */ 15, 16, 385, 429, 523, 524, 525, 447, 527, 528, + /* 190 */ 409, 191, 192, 481, 482, 539, 535, 400, 417, 408, + /* 200 */ 116, 201, 202, 547, 0, 8, 9, 467, 468, 12, + /* 210 */ 13, 14, 15, 16, 553, 554, 216, 426, 218, 558, + /* 220 */ 559, 20, 44, 223, 495, 495, 429, 436, 24, 25, + /* 230 */ 26, 27, 28, 29, 30, 31, 32, 508, 508, 186, + /* 240 */ 75, 115, 445, 382, 447, 145, 146, 147, 148, 149, + /* 250 */ 150, 151, 252, 253, 254, 501, 256, 257, 258, 259, /* 260 */ 260, 261, 262, 263, 264, 265, 266, 20, 193, 269, /* 270 */ 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, - /* 280 */ 280, 281, 282, 12, 13, 14, 20, 388, 14, 495, - /* 290 */ 125, 20, 498, 22, 20, 20, 502, 503, 504, 505, - /* 300 */ 506, 507, 403, 116, 510, 511, 4, 36, 514, 38, - /* 310 */ 516, 517, 518, 116, 402, 403, 522, 523, 8, 9, - /* 320 */ 20, 19, 12, 13, 14, 15, 16, 530, 402, 254, - /* 330 */ 450, 432, 474, 155, 115, 538, 115, 479, 244, 68, - /* 340 */ 38, 155, 71, 33, 464, 20, 75, 448, 54, 450, - /* 350 */ 470, 471, 268, 82, 557, 190, 54, 63, 561, 562, - /* 360 */ 66, 67, 115, 61, 62, 435, 12, 13, 115, 398, - /* 370 */ 68, 402, 403, 402, 20, 404, 22, 252, 452, 453, - /* 380 */ 193, 455, 402, 112, 458, 4, 115, 0, 530, 4, - /* 390 */ 36, 422, 38, 532, 495, 534, 538, 498, 191, 430, - /* 400 */ 307, 502, 503, 504, 505, 506, 507, 508, 23, 510, - /* 410 */ 511, 512, 513, 0, 556, 557, 114, 117, 283, 561, - /* 420 */ 562, 119, 68, 152, 153, 71, 116, 446, 498, 75, - /* 430 */ 449, 450, 267, 48, 49, 50, 82, 525, 526, 527, - /* 440 */ 528, 511, 530, 531, 319, 320, 321, 322, 323, 324, - /* 450 */ 325, 286, 287, 288, 289, 290, 291, 292, 293, 294, - /* 460 */ 295, 254, 191, 192, 484, 485, 112, 20, 215, 115, - /* 470 */ 217, 115, 201, 202, 296, 297, 298, 299, 300, 301, - /* 480 */ 302, 303, 304, 297, 298, 299, 419, 216, 82, 218, - /* 490 */ 77, 78, 79, 412, 223, 432, 115, 84, 85, 86, - /* 500 */ 20, 420, 249, 90, 441, 442, 152, 153, 95, 96, - /* 510 */ 97, 98, 228, 36, 101, 448, 191, 192, 105, 106, - /* 520 */ 107, 108, 309, 252, 253, 254, 307, 256, 257, 258, - /* 530 */ 259, 260, 261, 262, 263, 264, 265, 266, 433, 434, - /* 540 */ 269, 270, 271, 272, 33, 191, 192, 276, 277, 278, - /* 550 */ 279, 280, 281, 282, 307, 201, 202, 402, 171, 82, - /* 560 */ 307, 41, 42, 176, 112, 498, 499, 500, 146, 155, - /* 570 */ 216, 184, 218, 431, 402, 403, 20, 223, 511, 127, - /* 580 */ 128, 129, 130, 131, 132, 133, 134, 135, 136, 447, - /* 590 */ 138, 139, 140, 141, 142, 143, 144, 8, 9, 152, - /* 600 */ 153, 12, 13, 14, 15, 16, 252, 253, 254, 126, + /* 280 */ 280, 281, 282, 12, 13, 14, 0, 385, 20, 492, + /* 290 */ 125, 20, 495, 22, 399, 400, 499, 500, 501, 502, + /* 300 */ 503, 504, 400, 20, 507, 508, 399, 36, 511, 38, + /* 310 */ 513, 514, 515, 116, 447, 432, 519, 520, 8, 9, + /* 320 */ 399, 400, 12, 13, 14, 15, 16, 430, 461, 254, + /* 330 */ 14, 429, 471, 155, 467, 468, 20, 476, 441, 68, + /* 340 */ 54, 307, 71, 33, 20, 20, 75, 445, 453, 447, + /* 350 */ 527, 429, 268, 82, 4, 190, 449, 450, 535, 452, + /* 360 */ 438, 439, 455, 20, 8, 9, 12, 13, 12, 13, + /* 370 */ 14, 15, 16, 23, 20, 145, 22, 554, 495, 149, + /* 380 */ 20, 558, 559, 112, 0, 117, 115, 385, 527, 395, + /* 390 */ 36, 508, 38, 399, 492, 401, 535, 495, 48, 49, + /* 400 */ 50, 499, 500, 501, 502, 503, 504, 505, 190, 507, + /* 410 */ 508, 509, 510, 0, 553, 554, 155, 516, 517, 558, + /* 420 */ 559, 0, 68, 152, 153, 71, 116, 4, 2, 75, + /* 430 */ 20, 20, 267, 307, 8, 9, 82, 155, 12, 13, + /* 440 */ 14, 15, 16, 522, 523, 524, 525, 445, 527, 528, + /* 450 */ 3, 286, 287, 288, 289, 290, 291, 292, 293, 294, + /* 460 */ 295, 406, 191, 192, 395, 14, 112, 20, 399, 115, + /* 470 */ 401, 20, 201, 202, 296, 297, 298, 299, 300, 301, + /* 480 */ 302, 303, 304, 429, 20, 267, 22, 216, 433, 218, + /* 490 */ 77, 78, 79, 439, 223, 152, 153, 84, 85, 86, + /* 500 */ 36, 254, 0, 90, 286, 20, 152, 153, 95, 96, + /* 510 */ 97, 98, 152, 153, 101, 191, 192, 74, 105, 106, + /* 520 */ 107, 108, 58, 252, 253, 254, 115, 256, 257, 258, + /* 530 */ 259, 260, 261, 262, 263, 264, 265, 266, 115, 155, + /* 540 */ 269, 270, 271, 272, 385, 191, 192, 276, 277, 278, + /* 550 */ 279, 280, 281, 282, 170, 201, 202, 22, 297, 298, + /* 560 */ 299, 201, 202, 116, 208, 12, 13, 399, 400, 399, + /* 570 */ 216, 36, 218, 399, 400, 22, 74, 223, 296, 297, + /* 580 */ 298, 299, 300, 301, 302, 303, 304, 419, 13, 36, + /* 590 */ 429, 38, 171, 419, 74, 8, 9, 176, 437, 12, + /* 600 */ 13, 14, 15, 16, 445, 184, 252, 253, 254, 448, /* 610 */ 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, - /* 620 */ 266, 466, 467, 269, 270, 271, 272, 116, 501, 450, + /* 620 */ 266, 68, 399, 269, 270, 271, 272, 115, 38, 471, /* 630 */ 276, 277, 278, 279, 280, 281, 282, 283, 12, 13, - /* 640 */ 36, 121, 122, 432, 124, 388, 20, 147, 22, 470, - /* 650 */ 471, 151, 196, 231, 232, 112, 529, 402, 403, 387, - /* 660 */ 403, 389, 36, 307, 38, 145, 382, 383, 384, 149, - /* 670 */ 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, - /* 680 */ 388, 138, 139, 140, 141, 142, 143, 144, 307, 432, - /* 690 */ 20, 388, 22, 20, 68, 403, 0, 71, 526, 527, - /* 700 */ 528, 75, 530, 531, 493, 448, 36, 450, 82, 432, - /* 710 */ 296, 297, 298, 299, 300, 301, 302, 303, 304, 402, - /* 720 */ 403, 12, 13, 14, 432, 225, 73, 419, 58, 20, - /* 730 */ 230, 22, 388, 233, 254, 235, 459, 14, 112, 422, - /* 740 */ 448, 115, 450, 20, 432, 36, 20, 38, 22, 193, - /* 750 */ 20, 448, 495, 441, 442, 498, 448, 402, 403, 502, - /* 760 */ 503, 504, 505, 506, 507, 13, 509, 510, 511, 313, - /* 770 */ 314, 315, 316, 402, 403, 402, 403, 68, 152, 153, - /* 780 */ 71, 526, 527, 528, 58, 530, 531, 495, 36, 474, - /* 790 */ 498, 82, 448, 422, 502, 503, 504, 505, 506, 507, - /* 800 */ 423, 430, 510, 511, 492, 493, 498, 499, 516, 432, - /* 810 */ 518, 456, 402, 403, 522, 523, 409, 191, 192, 511, - /* 820 */ 443, 112, 218, 74, 115, 152, 153, 201, 202, 456, - /* 830 */ 8, 9, 422, 426, 12, 13, 14, 15, 16, 77, - /* 840 */ 78, 79, 216, 436, 218, 530, 84, 85, 86, 223, - /* 850 */ 0, 155, 90, 538, 250, 251, 267, 95, 96, 97, - /* 860 */ 98, 152, 153, 101, 211, 474, 170, 105, 106, 107, - /* 870 */ 108, 556, 557, 20, 201, 202, 561, 562, 252, 253, - /* 880 */ 254, 411, 256, 257, 258, 259, 260, 261, 262, 263, - /* 890 */ 264, 265, 266, 240, 241, 269, 270, 271, 272, 429, - /* 900 */ 191, 192, 276, 277, 278, 279, 280, 281, 282, 439, - /* 910 */ 201, 202, 8, 9, 191, 433, 12, 13, 14, 15, - /* 920 */ 16, 530, 432, 193, 74, 216, 444, 218, 91, 538, - /* 930 */ 402, 403, 223, 398, 12, 13, 432, 402, 36, 404, - /* 940 */ 423, 474, 22, 22, 440, 432, 479, 556, 557, 432, - /* 950 */ 422, 47, 561, 562, 0, 451, 36, 36, 36, 388, - /* 960 */ 443, 252, 253, 254, 451, 256, 257, 258, 259, 260, - /* 970 */ 261, 262, 263, 264, 265, 266, 22, 254, 269, 270, - /* 980 */ 271, 272, 492, 493, 254, 276, 277, 278, 279, 280, - /* 990 */ 281, 282, 12, 13, 22, 388, 159, 530, 432, 283, - /* 1000 */ 20, 285, 22, 82, 388, 538, 440, 190, 36, 186, - /* 1010 */ 403, 300, 301, 302, 303, 304, 36, 451, 38, 448, - /* 1020 */ 116, 184, 185, 556, 557, 402, 403, 47, 561, 562, - /* 1030 */ 208, 388, 112, 112, 530, 198, 402, 403, 68, 432, - /* 1040 */ 449, 450, 538, 220, 388, 422, 193, 428, 68, 402, - /* 1050 */ 403, 71, 402, 403, 82, 448, 422, 450, 501, 403, - /* 1060 */ 556, 557, 82, 432, 448, 561, 562, 402, 403, 422, - /* 1070 */ 402, 403, 422, 402, 403, 12, 13, 402, 403, 34, - /* 1080 */ 402, 403, 451, 20, 267, 22, 529, 422, 432, 119, - /* 1090 */ 422, 448, 112, 422, 145, 115, 501, 422, 149, 36, - /* 1100 */ 422, 38, 495, 286, 448, 498, 450, 254, 489, 502, - /* 1110 */ 503, 504, 505, 506, 507, 402, 403, 510, 511, 432, - /* 1120 */ 218, 402, 403, 516, 529, 518, 388, 440, 13, 522, - /* 1130 */ 523, 68, 152, 153, 71, 422, 2, 216, 451, 218, - /* 1140 */ 218, 422, 8, 9, 432, 82, 12, 13, 14, 15, - /* 1150 */ 16, 495, 250, 251, 498, 443, 334, 550, 502, 503, - /* 1160 */ 504, 505, 506, 507, 59, 60, 510, 511, 14, 15, - /* 1170 */ 16, 191, 192, 252, 253, 112, 433, 20, 115, 402, - /* 1180 */ 403, 201, 202, 8, 9, 432, 448, 12, 13, 14, - /* 1190 */ 15, 16, 409, 440, 407, 408, 216, 82, 218, 422, - /* 1200 */ 407, 408, 433, 223, 451, 8, 9, 551, 552, 12, - /* 1210 */ 13, 14, 15, 16, 2, 152, 153, 388, 388, 436, - /* 1220 */ 8, 9, 1, 2, 12, 13, 14, 15, 16, 416, - /* 1230 */ 417, 424, 252, 253, 254, 428, 256, 257, 258, 259, - /* 1240 */ 260, 261, 262, 263, 264, 265, 266, 411, 388, 269, - /* 1250 */ 270, 271, 272, 33, 191, 192, 276, 277, 278, 279, - /* 1260 */ 280, 281, 282, 52, 201, 202, 8, 9, 402, 403, - /* 1270 */ 12, 13, 14, 15, 16, 439, 38, 448, 448, 216, - /* 1280 */ 0, 218, 515, 515, 517, 517, 223, 33, 422, 8, - /* 1290 */ 9, 116, 54, 12, 13, 14, 15, 16, 402, 403, - /* 1300 */ 433, 63, 64, 65, 66, 47, 68, 0, 448, 514, - /* 1310 */ 402, 403, 517, 116, 20, 252, 253, 254, 422, 256, + /* 640 */ 193, 529, 191, 531, 54, 428, 20, 112, 22, 22, + /* 650 */ 112, 481, 482, 63, 64, 65, 66, 82, 68, 12, + /* 660 */ 13, 444, 36, 36, 38, 127, 128, 129, 130, 131, + /* 670 */ 132, 133, 134, 135, 136, 406, 138, 139, 140, 141, + /* 680 */ 142, 143, 144, 36, 126, 527, 463, 464, 527, 14, + /* 690 */ 334, 429, 423, 535, 68, 20, 535, 71, 146, 437, + /* 700 */ 283, 75, 433, 116, 114, 254, 82, 416, 82, 119, + /* 710 */ 448, 553, 554, 228, 553, 554, 558, 559, 307, 558, + /* 720 */ 559, 12, 13, 14, 300, 301, 302, 303, 304, 20, + /* 730 */ 307, 22, 429, 112, 36, 384, 445, 386, 112, 112, + /* 740 */ 252, 115, 385, 399, 400, 36, 416, 38, 127, 128, + /* 750 */ 129, 130, 131, 132, 133, 134, 135, 136, 126, 138, + /* 760 */ 139, 140, 141, 142, 143, 144, 399, 400, 20, 216, + /* 770 */ 22, 218, 52, 41, 42, 445, 186, 68, 152, 153, + /* 780 */ 71, 399, 400, 231, 232, 195, 495, 496, 497, 199, + /* 790 */ 200, 82, 489, 490, 34, 205, 206, 453, 430, 508, + /* 800 */ 36, 419, 445, 250, 251, 252, 58, 319, 320, 321, + /* 810 */ 322, 323, 324, 325, 224, 399, 400, 191, 192, 307, + /* 820 */ 453, 112, 269, 270, 115, 495, 496, 201, 202, 276, + /* 830 */ 277, 278, 279, 280, 281, 419, 430, 431, 508, 77, + /* 840 */ 78, 79, 216, 427, 218, 73, 84, 85, 86, 223, + /* 850 */ 446, 447, 90, 121, 122, 420, 124, 95, 96, 97, + /* 860 */ 98, 152, 153, 101, 429, 218, 191, 105, 106, 107, + /* 870 */ 108, 146, 147, 399, 400, 440, 151, 145, 252, 253, + /* 880 */ 254, 149, 256, 257, 258, 259, 260, 261, 262, 263, + /* 890 */ 264, 265, 266, 419, 4, 269, 270, 271, 272, 36, + /* 900 */ 191, 192, 276, 277, 278, 279, 280, 281, 282, 19, + /* 910 */ 201, 202, 498, 193, 8, 9, 218, 385, 12, 13, + /* 920 */ 14, 15, 16, 511, 204, 216, 514, 218, 38, 254, + /* 930 */ 8, 9, 223, 430, 12, 13, 14, 15, 16, 442, + /* 940 */ 526, 471, 445, 22, 54, 82, 476, 54, 250, 251, + /* 950 */ 115, 61, 62, 47, 59, 60, 63, 36, 68, 66, + /* 960 */ 67, 252, 253, 254, 186, 256, 257, 258, 259, 260, + /* 970 */ 261, 262, 263, 264, 265, 266, 429, 445, 269, 270, + /* 980 */ 271, 272, 218, 211, 437, 276, 277, 278, 279, 280, + /* 990 */ 281, 282, 12, 13, 22, 448, 385, 527, 220, 471, + /* 1000 */ 20, 420, 22, 82, 114, 535, 399, 400, 36, 119, + /* 1010 */ 429, 400, 240, 241, 250, 251, 36, 429, 38, 399, + /* 1020 */ 400, 440, 116, 553, 554, 437, 419, 47, 558, 559, + /* 1030 */ 14, 15, 16, 112, 385, 430, 448, 429, 116, 419, + /* 1040 */ 429, 23, 385, 4, 399, 400, 438, 439, 68, 400, + /* 1050 */ 215, 71, 217, 430, 82, 527, 445, 385, 447, 399, + /* 1060 */ 400, 430, 82, 535, 419, 8, 9, 49, 50, 12, + /* 1070 */ 13, 14, 15, 16, 13, 12, 13, 498, 429, 419, + /* 1080 */ 20, 553, 554, 20, 249, 22, 558, 559, 399, 400, + /* 1090 */ 404, 405, 112, 430, 445, 115, 447, 489, 490, 36, + /* 1100 */ 429, 38, 445, 492, 47, 526, 495, 385, 419, 425, + /* 1110 */ 499, 500, 501, 502, 503, 504, 2, 445, 507, 508, + /* 1120 */ 399, 400, 8, 9, 413, 414, 12, 13, 14, 15, + /* 1130 */ 16, 68, 152, 153, 71, 20, 283, 216, 285, 218, + /* 1140 */ 419, 492, 307, 82, 495, 82, 399, 400, 499, 500, + /* 1150 */ 501, 502, 503, 504, 1, 2, 507, 508, 196, 548, + /* 1160 */ 549, 490, 513, 512, 515, 514, 419, 445, 519, 520, + /* 1170 */ 486, 191, 192, 252, 253, 112, 413, 414, 115, 399, + /* 1180 */ 400, 201, 202, 8, 9, 399, 400, 12, 13, 14, + /* 1190 */ 15, 16, 399, 400, 404, 405, 216, 498, 218, 419, + /* 1200 */ 8, 9, 0, 223, 12, 13, 14, 15, 16, 512, + /* 1210 */ 20, 514, 419, 8, 9, 152, 153, 12, 13, 14, + /* 1220 */ 15, 16, 8, 9, 22, 526, 12, 13, 14, 15, + /* 1230 */ 16, 0, 252, 253, 254, 20, 256, 257, 258, 259, + /* 1240 */ 260, 261, 262, 263, 264, 265, 266, 388, 389, 269, + /* 1250 */ 270, 271, 272, 193, 191, 192, 276, 277, 278, 279, + /* 1260 */ 280, 281, 282, 0, 201, 202, 8, 9, 429, 116, + /* 1270 */ 12, 13, 14, 15, 16, 313, 314, 315, 316, 216, + /* 1280 */ 429, 218, 399, 400, 399, 400, 223, 448, 8, 9, + /* 1290 */ 408, 116, 12, 13, 14, 15, 16, 399, 400, 448, + /* 1300 */ 3, 385, 419, 471, 419, 47, 191, 20, 116, 523, + /* 1310 */ 524, 525, 427, 527, 528, 252, 253, 254, 436, 256, /* 1320 */ 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, - /* 1330 */ 422, 20, 269, 270, 271, 272, 116, 116, 388, 276, - /* 1340 */ 277, 278, 279, 280, 281, 282, 12, 13, 191, 388, - /* 1350 */ 22, 18, 114, 20, 20, 1, 22, 119, 3, 23, - /* 1360 */ 27, 8, 9, 30, 36, 12, 13, 14, 15, 16, - /* 1370 */ 36, 38, 38, 19, 8, 9, 402, 403, 12, 13, - /* 1380 */ 14, 15, 16, 402, 403, 49, 50, 54, 44, 56, - /* 1390 */ 402, 403, 38, 14, 61, 62, 422, 13, 448, 20, - /* 1400 */ 388, 388, 68, 422, 193, 71, 73, 53, 54, 448, - /* 1410 */ 422, 254, 68, 47, 388, 204, 82, 63, 64, 65, - /* 1420 */ 66, 388, 68, 388, 186, 145, 146, 147, 148, 149, - /* 1430 */ 150, 151, 432, 195, 416, 417, 445, 199, 200, 448, - /* 1440 */ 112, 433, 442, 205, 206, 33, 112, 114, 432, 115, - /* 1450 */ 391, 392, 145, 146, 147, 148, 149, 150, 151, 126, - /* 1460 */ 448, 448, 224, 388, 388, 0, 82, 451, 114, 116, - /* 1470 */ 388, 8, 9, 119, 448, 12, 13, 14, 15, 16, - /* 1480 */ 0, 448, 445, 448, 126, 448, 152, 153, 0, 33, - /* 1490 */ 157, 158, 33, 160, 161, 162, 163, 164, 165, 166, - /* 1500 */ 167, 168, 169, 47, 150, 172, 173, 174, 175, 176, - /* 1510 */ 177, 178, 179, 0, 181, 182, 183, 36, 0, 54, - /* 1520 */ 187, 188, 189, 448, 448, 191, 192, 194, 445, 33, - /* 1530 */ 448, 448, 44, 0, 120, 201, 202, 123, 180, 120, - /* 1540 */ 22, 120, 123, 47, 123, 13, 33, 0, 254, 195, - /* 1550 */ 216, 197, 218, 120, 200, 22, 123, 223, 234, 205, - /* 1560 */ 236, 33, 36, 82, 433, 254, 8, 9, 36, 22, - /* 1570 */ 12, 13, 14, 15, 16, 116, 51, 33, 224, 116, - /* 1580 */ 152, 153, 433, 33, 33, 331, 252, 253, 254, 480, + /* 1330 */ 399, 400, 269, 270, 271, 272, 0, 399, 400, 276, + /* 1340 */ 277, 278, 279, 280, 281, 282, 12, 13, 309, 442, + /* 1350 */ 419, 18, 445, 20, 20, 385, 22, 419, 385, 527, + /* 1360 */ 27, 445, 429, 30, 234, 33, 236, 535, 471, 254, + /* 1370 */ 36, 38, 38, 440, 20, 471, 145, 146, 147, 148, + /* 1380 */ 149, 150, 151, 399, 400, 553, 554, 54, 385, 56, + /* 1390 */ 558, 559, 385, 147, 61, 62, 116, 151, 442, 33, + /* 1400 */ 33, 445, 68, 419, 0, 71, 73, 193, 145, 146, + /* 1410 */ 147, 148, 149, 150, 151, 445, 82, 385, 445, 12, + /* 1420 */ 13, 523, 524, 525, 527, 527, 528, 33, 385, 22, + /* 1430 */ 44, 527, 535, 399, 400, 91, 14, 120, 126, 535, + /* 1440 */ 123, 47, 20, 36, 254, 38, 112, 114, 445, 115, + /* 1450 */ 553, 554, 445, 419, 68, 558, 559, 553, 554, 126, + /* 1460 */ 8, 9, 558, 559, 12, 13, 14, 15, 16, 254, + /* 1470 */ 33, 225, 267, 385, 385, 68, 230, 445, 385, 233, + /* 1480 */ 193, 235, 33, 116, 399, 400, 152, 153, 445, 82, + /* 1490 */ 157, 158, 180, 160, 161, 162, 163, 164, 165, 166, + /* 1500 */ 167, 168, 169, 159, 419, 172, 173, 174, 175, 176, + /* 1510 */ 177, 178, 179, 385, 181, 182, 183, 0, 385, 112, + /* 1520 */ 187, 188, 189, 399, 400, 191, 192, 194, 184, 185, + /* 1530 */ 429, 399, 400, 445, 445, 201, 202, 0, 445, 36, + /* 1540 */ 33, 254, 198, 419, 13, 120, 13, 193, 123, 448, + /* 1550 */ 216, 419, 218, 116, 47, 120, 68, 223, 123, 155, + /* 1560 */ 120, 44, 0, 123, 75, 116, 13, 36, 33, 36, + /* 1570 */ 33, 33, 33, 445, 33, 152, 153, 477, 445, 0, + /* 1580 */ 244, 1, 2, 33, 22, 82, 252, 253, 254, 36, /* 1590 */ 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, - /* 1600 */ 266, 1, 2, 269, 270, 271, 272, 33, 82, 33, - /* 1610 */ 276, 277, 278, 279, 280, 281, 282, 18, 33, 8, - /* 1620 */ 9, 388, 23, 12, 13, 14, 15, 16, 420, 474, - /* 1630 */ 33, 12, 13, 389, 75, 155, 403, 33, 405, 33, - /* 1640 */ 115, 42, 43, 33, 116, 46, 33, 388, 36, 33, - /* 1650 */ 33, 33, 12, 13, 460, 532, 57, 12, 13, 474, - /* 1660 */ 116, 115, 403, 117, 405, 432, 116, 116, 69, 70, - /* 1670 */ 71, 72, 73, 565, 116, 33, 13, 12, 13, 12, - /* 1680 */ 13, 448, 36, 450, 329, 530, 554, 12, 13, 547, - /* 1690 */ 116, 432, 116, 538, 12, 13, 474, 12, 13, 36, - /* 1700 */ 533, 116, 33, 12, 13, 12, 13, 448, 406, 450, - /* 1710 */ 432, 556, 557, 116, 115, 530, 561, 562, 12, 13, - /* 1720 */ 116, 401, 116, 538, 419, 419, 116, 33, 495, 116, - /* 1730 */ 33, 498, 116, 116, 116, 502, 503, 504, 505, 506, - /* 1740 */ 507, 556, 557, 510, 511, 333, 561, 562, 33, 516, - /* 1750 */ 13, 518, 530, 154, 495, 522, 523, 498, 116, 388, - /* 1760 */ 538, 502, 503, 504, 505, 506, 507, 553, 33, 510, - /* 1770 */ 511, 33, 36, 36, 403, 516, 405, 518, 556, 557, - /* 1780 */ 553, 522, 523, 561, 562, 116, 460, 553, 473, 553, - /* 1790 */ 460, 406, 496, 403, 447, 481, 524, 460, 460, 537, - /* 1800 */ 537, 558, 460, 432, 193, 388, 0, 208, 209, 210, - /* 1810 */ 116, 252, 213, 116, 540, 421, 310, 54, 82, 448, - /* 1820 */ 403, 450, 405, 475, 497, 226, 227, 20, 402, 20, - /* 1830 */ 218, 116, 12, 13, 233, 388, 486, 491, 239, 214, - /* 1840 */ 411, 242, 22, 486, 245, 246, 247, 248, 249, 432, - /* 1850 */ 403, 116, 405, 411, 116, 477, 36, 402, 38, 20, - /* 1860 */ 403, 55, 47, 457, 218, 448, 495, 450, 457, 498, - /* 1870 */ 403, 190, 454, 502, 503, 504, 505, 506, 507, 432, - /* 1880 */ 402, 510, 511, 113, 457, 403, 388, 516, 68, 518, - /* 1890 */ 454, 402, 454, 522, 523, 448, 111, 450, 454, 415, - /* 1900 */ 414, 403, 82, 405, 402, 402, 307, 110, 413, 402, - /* 1910 */ 402, 402, 495, 20, 395, 498, 52, 395, 486, 502, - /* 1920 */ 503, 504, 505, 506, 507, 411, 399, 510, 511, 399, - /* 1930 */ 432, 411, 112, 516, 20, 518, 20, 450, 404, 522, - /* 1940 */ 523, 20, 495, 404, 476, 498, 448, 411, 450, 502, - /* 1950 */ 503, 504, 505, 506, 507, 20, 411, 510, 511, 411, - /* 1960 */ 467, 12, 13, 516, 411, 518, 20, 411, 411, 522, - /* 1970 */ 523, 22, 461, 402, 411, 395, 237, 391, 391, 402, - /* 1980 */ 490, 432, 115, 395, 432, 36, 432, 38, 448, 448, - /* 1990 */ 448, 486, 432, 495, 432, 388, 498, 432, 432, 432, - /* 2000 */ 502, 503, 504, 505, 506, 507, 20, 432, 510, 511, - /* 2010 */ 403, 432, 488, 432, 516, 222, 518, 68, 409, 221, - /* 2020 */ 522, 523, 485, 450, 409, 388, 483, 318, 402, 546, - /* 2030 */ 448, 317, 468, 326, 549, 207, 216, 482, 218, 432, - /* 2040 */ 403, 328, 548, 475, 327, 546, 468, 546, 306, 545, - /* 2050 */ 305, 311, 536, 335, 544, 448, 535, 450, 543, 388, - /* 2060 */ 332, 330, 403, 566, 475, 20, 126, 308, 539, 432, - /* 2070 */ 501, 559, 252, 253, 403, 409, 541, 560, 404, 409, - /* 2080 */ 448, 448, 468, 448, 448, 448, 448, 450, 468, 269, - /* 2090 */ 270, 199, 465, 409, 115, 448, 276, 277, 278, 279, - /* 2100 */ 280, 281, 495, 432, 461, 498, 448, 409, 199, 502, - /* 2110 */ 503, 504, 505, 506, 507, 521, 462, 510, 511, 448, - /* 2120 */ 409, 450, 461, 516, 428, 518, 403, 448, 409, 522, - /* 2130 */ 523, 448, 495, 115, 448, 498, 448, 448, 448, 502, - /* 2140 */ 503, 504, 505, 506, 507, 22, 388, 510, 511, 448, - /* 2150 */ 448, 448, 448, 516, 402, 518, 448, 390, 448, 522, - /* 2160 */ 523, 403, 437, 35, 448, 216, 495, 218, 448, 498, - /* 2170 */ 448, 409, 448, 502, 503, 504, 505, 506, 507, 393, - /* 2180 */ 448, 510, 511, 37, 394, 40, 494, 396, 410, 518, - /* 2190 */ 432, 448, 388, 522, 523, 448, 448, 448, 448, 250, - /* 2200 */ 251, 252, 448, 395, 478, 434, 448, 403, 450, 425, - /* 2210 */ 469, 434, 425, 469, 487, 386, 0, 425, 269, 270, - /* 2220 */ 0, 0, 388, 47, 0, 276, 277, 278, 279, 280, - /* 2230 */ 281, 36, 243, 36, 36, 36, 432, 403, 243, 0, - /* 2240 */ 36, 36, 243, 36, 0, 0, 243, 0, 36, 0, - /* 2250 */ 36, 0, 448, 495, 450, 22, 498, 238, 36, 0, - /* 2260 */ 502, 503, 504, 505, 506, 507, 432, 0, 510, 511, - /* 2270 */ 224, 0, 224, 218, 225, 216, 518, 0, 0, 0, - /* 2280 */ 522, 523, 448, 212, 450, 211, 388, 0, 0, 158, - /* 2290 */ 0, 51, 51, 0, 36, 0, 36, 54, 0, 495, - /* 2300 */ 0, 403, 498, 51, 0, 0, 502, 503, 504, 505, - /* 2310 */ 506, 507, 47, 388, 510, 511, 0, 51, 0, 0, - /* 2320 */ 0, 0, 518, 0, 0, 176, 522, 523, 403, 495, - /* 2330 */ 432, 0, 498, 36, 176, 0, 502, 503, 504, 505, - /* 2340 */ 506, 507, 0, 0, 510, 511, 448, 0, 450, 0, - /* 2350 */ 388, 0, 0, 0, 0, 0, 0, 432, 0, 0, - /* 2360 */ 0, 0, 0, 0, 0, 403, 51, 0, 0, 47, - /* 2370 */ 0, 0, 0, 448, 0, 450, 0, 0, 0, 0, - /* 2380 */ 0, 0, 0, 158, 0, 157, 0, 22, 156, 0, - /* 2390 */ 0, 22, 52, 495, 432, 22, 498, 563, 564, 388, - /* 2400 */ 502, 503, 504, 505, 506, 507, 0, 68, 510, 511, - /* 2410 */ 448, 0, 450, 68, 403, 0, 518, 0, 68, 36, - /* 2420 */ 495, 523, 0, 498, 0, 68, 0, 502, 503, 504, - /* 2430 */ 505, 506, 507, 36, 472, 510, 511, 52, 44, 36, - /* 2440 */ 44, 54, 54, 432, 0, 36, 54, 0, 388, 44, - /* 2450 */ 36, 0, 44, 33, 47, 51, 14, 495, 0, 448, - /* 2460 */ 498, 450, 44, 403, 502, 503, 504, 505, 506, 507, - /* 2470 */ 51, 0, 510, 511, 51, 45, 388, 552, 44, 207, - /* 2480 */ 0, 0, 51, 472, 0, 0, 0, 51, 0, 0, - /* 2490 */ 388, 403, 432, 0, 0, 36, 44, 76, 0, 54, - /* 2500 */ 36, 44, 54, 0, 36, 403, 495, 54, 448, 498, - /* 2510 */ 450, 44, 388, 502, 503, 504, 505, 506, 507, 0, - /* 2520 */ 432, 510, 511, 36, 54, 0, 44, 403, 0, 0, - /* 2530 */ 0, 0, 0, 36, 432, 125, 448, 22, 450, 123, - /* 2540 */ 0, 36, 22, 36, 36, 36, 36, 33, 36, 36, - /* 2550 */ 448, 0, 450, 36, 36, 495, 432, 33, 498, 36, - /* 2560 */ 22, 22, 502, 503, 504, 505, 506, 507, 0, 36, - /* 2570 */ 510, 511, 448, 36, 450, 22, 0, 22, 56, 0, - /* 2580 */ 22, 388, 36, 495, 0, 0, 498, 0, 36, 0, - /* 2590 */ 502, 503, 504, 505, 506, 507, 403, 495, 510, 511, - /* 2600 */ 498, 36, 0, 36, 502, 503, 504, 505, 506, 507, - /* 2610 */ 0, 20, 510, 511, 22, 555, 36, 388, 36, 495, - /* 2620 */ 116, 115, 498, 0, 36, 432, 502, 503, 504, 505, - /* 2630 */ 506, 507, 403, 193, 510, 511, 115, 513, 0, 193, - /* 2640 */ 228, 448, 229, 450, 51, 388, 22, 36, 223, 0, - /* 2650 */ 22, 219, 564, 193, 199, 0, 0, 203, 193, 193, - /* 2660 */ 403, 432, 3, 33, 203, 472, 116, 36, 36, 115, - /* 2670 */ 52, 115, 52, 116, 115, 113, 116, 448, 33, 450, - /* 2680 */ 111, 33, 116, 33, 51, 115, 115, 312, 495, 432, - /* 2690 */ 116, 498, 115, 51, 33, 502, 503, 504, 505, 506, - /* 2700 */ 507, 472, 116, 510, 511, 448, 33, 450, 82, 115, - /* 2710 */ 312, 115, 36, 116, 3, 116, 33, 36, 36, 116, - /* 2720 */ 36, 36, 36, 36, 495, 116, 388, 498, 51, 472, - /* 2730 */ 33, 502, 503, 504, 505, 506, 507, 296, 0, 510, - /* 2740 */ 511, 403, 51, 0, 115, 312, 44, 0, 44, 200, - /* 2750 */ 116, 116, 495, 0, 388, 498, 115, 196, 115, 502, - /* 2760 */ 503, 504, 505, 506, 507, 44, 115, 510, 511, 403, - /* 2770 */ 432, 113, 33, 116, 196, 115, 195, 113, 2, 284, - /* 2780 */ 22, 116, 115, 115, 115, 115, 448, 252, 450, 115, - /* 2790 */ 388, 116, 51, 115, 115, 51, 22, 255, 432, 0, - /* 2800 */ 196, 44, 0, 115, 115, 403, 116, 115, 115, 115, - /* 2810 */ 472, 116, 116, 115, 448, 115, 450, 22, 115, 118, - /* 2820 */ 51, 115, 117, 388, 115, 115, 22, 22, 116, 115, - /* 2830 */ 115, 22, 116, 495, 432, 229, 498, 36, 403, 126, - /* 2840 */ 502, 503, 504, 505, 506, 507, 36, 115, 510, 511, - /* 2850 */ 448, 116, 450, 36, 36, 115, 36, 36, 116, 36, - /* 2860 */ 137, 495, 116, 137, 498, 116, 388, 432, 502, 503, - /* 2870 */ 504, 505, 506, 507, 137, 116, 510, 511, 115, 33, - /* 2880 */ 115, 403, 137, 448, 36, 450, 115, 22, 76, 75, - /* 2890 */ 22, 36, 36, 36, 36, 36, 36, 495, 36, 388, - /* 2900 */ 498, 82, 36, 109, 502, 503, 504, 505, 506, 507, - /* 2910 */ 432, 36, 510, 511, 403, 36, 36, 82, 33, 36, - /* 2920 */ 109, 22, 36, 36, 36, 36, 448, 36, 450, 82, - /* 2930 */ 495, 36, 36, 498, 36, 22, 0, 502, 503, 504, - /* 2940 */ 505, 506, 507, 432, 36, 510, 511, 36, 36, 44, - /* 2950 */ 36, 54, 0, 36, 44, 54, 0, 36, 54, 448, - /* 2960 */ 44, 450, 0, 388, 36, 0, 44, 36, 0, 54, - /* 2970 */ 22, 36, 0, 495, 33, 22, 498, 22, 403, 36, - /* 2980 */ 502, 503, 504, 505, 506, 507, 388, 36, 510, 511, - /* 2990 */ 21, 567, 22, 22, 21, 20, 567, 567, 567, 567, - /* 3000 */ 567, 403, 567, 567, 567, 567, 495, 432, 567, 498, - /* 3010 */ 567, 567, 567, 502, 503, 504, 505, 506, 507, 567, - /* 3020 */ 567, 510, 511, 448, 567, 450, 567, 567, 567, 567, - /* 3030 */ 432, 567, 388, 567, 567, 567, 567, 567, 567, 567, - /* 3040 */ 567, 567, 567, 567, 567, 567, 448, 403, 450, 567, - /* 3050 */ 567, 567, 567, 567, 388, 567, 567, 567, 567, 567, - /* 3060 */ 567, 567, 567, 567, 567, 567, 567, 567, 388, 403, - /* 3070 */ 495, 567, 567, 498, 567, 567, 432, 502, 503, 504, - /* 3080 */ 505, 506, 507, 403, 567, 510, 511, 567, 567, 567, - /* 3090 */ 567, 567, 448, 495, 450, 567, 498, 567, 432, 567, - /* 3100 */ 502, 503, 504, 505, 506, 507, 567, 567, 510, 511, - /* 3110 */ 567, 567, 432, 567, 448, 567, 450, 567, 567, 567, - /* 3120 */ 567, 567, 567, 567, 567, 567, 567, 567, 448, 567, - /* 3130 */ 450, 567, 567, 567, 567, 567, 567, 567, 567, 495, - /* 3140 */ 567, 567, 498, 567, 388, 567, 502, 503, 504, 505, - /* 3150 */ 506, 507, 567, 567, 510, 511, 567, 567, 567, 403, - /* 3160 */ 567, 495, 567, 567, 498, 567, 567, 567, 502, 503, - /* 3170 */ 504, 505, 506, 507, 567, 495, 510, 511, 498, 388, - /* 3180 */ 567, 567, 502, 503, 504, 505, 506, 507, 432, 567, - /* 3190 */ 510, 511, 567, 567, 403, 567, 567, 567, 567, 567, - /* 3200 */ 567, 567, 567, 567, 448, 567, 450, 567, 567, 567, - /* 3210 */ 567, 567, 388, 567, 567, 567, 567, 567, 567, 567, - /* 3220 */ 567, 567, 567, 432, 567, 567, 567, 403, 567, 567, - /* 3230 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 448, - /* 3240 */ 567, 450, 567, 567, 567, 567, 567, 567, 567, 567, - /* 3250 */ 567, 495, 567, 567, 498, 388, 432, 567, 502, 503, - /* 3260 */ 504, 505, 506, 507, 567, 567, 510, 511, 567, 567, - /* 3270 */ 403, 567, 448, 567, 450, 567, 567, 567, 567, 567, - /* 3280 */ 567, 567, 567, 567, 567, 567, 495, 567, 388, 498, - /* 3290 */ 567, 567, 567, 502, 503, 504, 505, 506, 507, 432, - /* 3300 */ 567, 510, 511, 403, 567, 567, 567, 567, 567, 567, - /* 3310 */ 567, 567, 567, 567, 567, 448, 567, 450, 567, 495, - /* 3320 */ 567, 567, 498, 567, 567, 567, 502, 503, 504, 505, - /* 3330 */ 506, 507, 432, 567, 510, 511, 567, 567, 567, 567, - /* 3340 */ 567, 567, 567, 567, 567, 567, 567, 567, 448, 567, - /* 3350 */ 450, 567, 388, 567, 567, 567, 567, 567, 567, 567, - /* 3360 */ 567, 567, 495, 567, 567, 498, 567, 403, 567, 502, - /* 3370 */ 503, 504, 505, 506, 507, 388, 567, 510, 511, 567, - /* 3380 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 567, - /* 3390 */ 403, 567, 567, 567, 567, 495, 432, 567, 498, 567, - /* 3400 */ 567, 567, 502, 503, 504, 505, 506, 507, 567, 567, - /* 3410 */ 510, 511, 448, 567, 450, 567, 567, 567, 567, 432, - /* 3420 */ 567, 388, 567, 567, 567, 567, 567, 567, 567, 567, - /* 3430 */ 567, 567, 567, 567, 567, 448, 403, 450, 567, 567, - /* 3440 */ 567, 567, 567, 388, 567, 567, 567, 567, 567, 567, - /* 3450 */ 567, 567, 567, 567, 567, 567, 567, 388, 403, 495, - /* 3460 */ 567, 567, 498, 567, 567, 432, 502, 503, 504, 505, - /* 3470 */ 506, 507, 403, 567, 510, 511, 567, 567, 567, 567, - /* 3480 */ 567, 448, 495, 450, 567, 498, 567, 432, 567, 502, - /* 3490 */ 503, 504, 505, 506, 507, 567, 567, 510, 511, 567, - /* 3500 */ 567, 432, 567, 448, 567, 450, 567, 567, 567, 567, - /* 3510 */ 567, 567, 567, 567, 567, 567, 567, 448, 567, 450, - /* 3520 */ 567, 567, 567, 567, 567, 567, 567, 567, 495, 567, - /* 3530 */ 567, 498, 567, 388, 567, 502, 503, 504, 505, 506, - /* 3540 */ 507, 567, 567, 510, 511, 567, 567, 567, 403, 567, - /* 3550 */ 495, 567, 567, 498, 567, 567, 567, 502, 503, 504, - /* 3560 */ 505, 506, 507, 567, 495, 510, 511, 498, 388, 567, - /* 3570 */ 567, 502, 503, 504, 505, 506, 507, 432, 567, 510, - /* 3580 */ 511, 567, 567, 403, 567, 567, 567, 567, 567, 567, - /* 3590 */ 567, 567, 567, 448, 567, 450, 567, 567, 567, 567, - /* 3600 */ 567, 388, 567, 567, 567, 567, 567, 567, 567, 567, - /* 3610 */ 567, 567, 432, 567, 567, 567, 403, 567, 567, 567, - /* 3620 */ 567, 567, 567, 567, 567, 567, 567, 567, 448, 567, - /* 3630 */ 450, 567, 567, 567, 567, 567, 567, 567, 567, 567, - /* 3640 */ 495, 567, 567, 498, 388, 432, 567, 502, 503, 504, - /* 3650 */ 505, 506, 507, 567, 567, 510, 511, 567, 567, 403, - /* 3660 */ 567, 448, 567, 450, 567, 567, 567, 567, 567, 567, - /* 3670 */ 567, 567, 567, 567, 567, 495, 567, 388, 498, 567, - /* 3680 */ 567, 567, 502, 503, 504, 505, 506, 507, 432, 567, - /* 3690 */ 510, 511, 403, 567, 567, 567, 567, 567, 567, 567, - /* 3700 */ 567, 567, 567, 567, 448, 567, 450, 567, 495, 567, - /* 3710 */ 567, 498, 567, 567, 567, 502, 503, 504, 505, 506, - /* 3720 */ 507, 432, 567, 510, 511, 567, 567, 567, 567, 567, - /* 3730 */ 567, 567, 567, 567, 567, 567, 567, 448, 567, 450, - /* 3740 */ 567, 388, 567, 567, 567, 567, 567, 567, 567, 567, - /* 3750 */ 567, 495, 567, 567, 498, 567, 403, 567, 502, 503, - /* 3760 */ 504, 505, 506, 507, 388, 567, 510, 511, 567, 567, - /* 3770 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 403, - /* 3780 */ 567, 567, 567, 567, 495, 432, 567, 498, 567, 567, - /* 3790 */ 567, 502, 503, 504, 505, 506, 507, 567, 567, 510, - /* 3800 */ 511, 448, 567, 450, 567, 567, 567, 567, 432, 567, - /* 3810 */ 388, 567, 567, 567, 567, 567, 567, 567, 567, 567, - /* 3820 */ 567, 567, 567, 567, 448, 403, 450, 567, 567, 567, - /* 3830 */ 567, 567, 388, 567, 567, 567, 567, 567, 567, 567, - /* 3840 */ 567, 567, 567, 567, 567, 567, 567, 403, 495, 567, - /* 3850 */ 567, 498, 567, 567, 432, 502, 503, 504, 505, 506, - /* 3860 */ 507, 567, 567, 510, 511, 567, 567, 567, 567, 567, - /* 3870 */ 448, 495, 450, 567, 498, 567, 432, 567, 502, 503, - /* 3880 */ 504, 505, 506, 507, 567, 567, 510, 511, 567, 567, - /* 3890 */ 567, 567, 448, 567, 450, 567, 567, 567, 567, 567, - /* 3900 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 567, - /* 3910 */ 567, 567, 567, 567, 567, 567, 567, 495, 567, 567, - /* 3920 */ 498, 567, 567, 567, 502, 503, 504, 505, 506, 507, - /* 3930 */ 567, 567, 510, 511, 567, 567, 567, 567, 567, 495, - /* 3940 */ 567, 567, 498, 567, 567, 567, 502, 503, 504, 505, - /* 3950 */ 506, 507, 567, 567, 510, 511, 385, 385, 385, 385, - /* 3960 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 3970 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 3980 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 3990 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4000 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4010 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4020 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4030 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4040 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4050 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4060 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4070 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4080 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4090 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4100 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4110 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4120 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4130 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4140 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4150 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4160 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4170 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4180 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4190 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4200 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4210 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4220 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4230 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4240 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4250 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4260 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4270 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4280 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4290 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4300 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4310 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4320 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4330 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4340 */ 385, + /* 1600 */ 266, 22, 0, 269, 270, 271, 272, 119, 254, 33, + /* 1610 */ 276, 277, 278, 279, 280, 281, 282, 18, 33, 33, + /* 1620 */ 385, 33, 23, 216, 22, 218, 329, 115, 33, 117, + /* 1630 */ 33, 386, 51, 33, 33, 400, 33, 33, 33, 12, + /* 1640 */ 13, 42, 43, 12, 13, 46, 12, 13, 12, 13, + /* 1650 */ 385, 116, 12, 13, 116, 116, 57, 116, 36, 252, + /* 1660 */ 253, 12, 13, 331, 429, 400, 116, 402, 69, 70, + /* 1670 */ 71, 72, 73, 12, 13, 33, 269, 270, 12, 13, + /* 1680 */ 445, 417, 447, 276, 277, 278, 279, 280, 281, 12, + /* 1690 */ 13, 33, 116, 33, 429, 36, 115, 12, 13, 333, + /* 1700 */ 33, 116, 116, 33, 116, 12, 13, 0, 33, 13, + /* 1710 */ 445, 116, 447, 116, 115, 36, 116, 116, 457, 116, + /* 1720 */ 116, 116, 529, 562, 36, 551, 544, 492, 530, 403, + /* 1730 */ 495, 429, 36, 398, 499, 500, 501, 502, 503, 504, + /* 1740 */ 416, 252, 507, 508, 416, 457, 550, 550, 513, 550, + /* 1750 */ 515, 470, 457, 154, 519, 520, 385, 492, 116, 550, + /* 1760 */ 495, 82, 55, 403, 499, 500, 501, 502, 503, 504, + /* 1770 */ 82, 400, 507, 508, 116, 385, 116, 493, 513, 400, + /* 1780 */ 515, 444, 547, 116, 519, 520, 116, 478, 457, 534, + /* 1790 */ 400, 116, 402, 534, 555, 457, 521, 537, 457, 418, + /* 1800 */ 429, 310, 472, 20, 54, 494, 20, 208, 209, 210, + /* 1810 */ 399, 233, 213, 488, 408, 399, 445, 408, 447, 429, + /* 1820 */ 214, 474, 483, 483, 20, 226, 227, 400, 47, 454, + /* 1830 */ 400, 454, 399, 190, 451, 445, 400, 447, 239, 454, + /* 1840 */ 218, 242, 399, 451, 245, 246, 247, 248, 249, 451, + /* 1850 */ 451, 113, 111, 412, 399, 411, 399, 110, 410, 399, + /* 1860 */ 399, 399, 20, 492, 392, 52, 495, 396, 392, 396, + /* 1870 */ 499, 500, 501, 502, 503, 504, 483, 218, 507, 508, + /* 1880 */ 20, 447, 492, 408, 385, 495, 408, 408, 20, 499, + /* 1890 */ 500, 501, 502, 503, 504, 401, 20, 507, 508, 400, + /* 1900 */ 408, 402, 473, 513, 408, 515, 307, 401, 20, 519, + /* 1910 */ 520, 464, 408, 20, 458, 399, 408, 408, 408, 392, + /* 1920 */ 399, 385, 429, 237, 429, 445, 429, 429, 429, 429, + /* 1930 */ 429, 560, 561, 388, 429, 388, 400, 487, 402, 115, + /* 1940 */ 429, 392, 429, 429, 445, 20, 447, 429, 485, 483, + /* 1950 */ 406, 482, 222, 221, 480, 472, 479, 406, 399, 318, + /* 1960 */ 445, 543, 317, 543, 445, 429, 207, 447, 445, 545, + /* 1970 */ 326, 306, 385, 542, 546, 543, 328, 327, 305, 541, + /* 1980 */ 563, 445, 311, 447, 533, 540, 532, 400, 335, 402, + /* 1990 */ 465, 492, 330, 465, 495, 332, 472, 20, 499, 500, + /* 2000 */ 501, 502, 503, 504, 126, 538, 507, 508, 385, 400, + /* 2010 */ 557, 308, 513, 401, 515, 556, 429, 536, 519, 520, + /* 2020 */ 498, 406, 406, 400, 199, 402, 465, 445, 492, 445, + /* 2030 */ 465, 495, 445, 462, 447, 499, 500, 501, 502, 503, + /* 2040 */ 504, 445, 115, 507, 508, 406, 199, 458, 518, 513, + /* 2050 */ 459, 515, 429, 445, 385, 519, 520, 406, 445, 445, + /* 2060 */ 406, 406, 445, 425, 400, 458, 445, 115, 445, 400, + /* 2070 */ 447, 445, 22, 445, 445, 445, 387, 445, 445, 492, + /* 2080 */ 445, 399, 495, 35, 37, 390, 499, 500, 501, 502, + /* 2090 */ 503, 504, 445, 391, 507, 508, 385, 445, 429, 40, + /* 2100 */ 513, 445, 515, 406, 484, 393, 519, 520, 392, 491, + /* 2110 */ 383, 400, 434, 445, 445, 492, 447, 445, 495, 445, + /* 2120 */ 422, 445, 499, 500, 501, 502, 503, 504, 445, 445, + /* 2130 */ 507, 508, 445, 407, 385, 445, 513, 445, 515, 445, + /* 2140 */ 429, 431, 519, 520, 445, 445, 422, 466, 431, 400, + /* 2150 */ 422, 0, 0, 0, 47, 475, 445, 466, 447, 0, + /* 2160 */ 36, 492, 243, 36, 495, 36, 36, 243, 499, 500, + /* 2170 */ 501, 502, 503, 504, 0, 36, 507, 508, 429, 36, + /* 2180 */ 243, 36, 513, 0, 515, 0, 243, 0, 519, 520, + /* 2190 */ 36, 0, 36, 0, 445, 22, 447, 0, 36, 238, + /* 2200 */ 0, 0, 224, 492, 224, 218, 495, 225, 216, 0, + /* 2210 */ 499, 500, 501, 502, 503, 504, 212, 211, 507, 508, + /* 2220 */ 0, 385, 0, 0, 513, 0, 515, 158, 51, 51, + /* 2230 */ 519, 520, 0, 0, 36, 0, 400, 0, 36, 51, + /* 2240 */ 54, 492, 0, 47, 495, 0, 0, 0, 499, 500, + /* 2250 */ 501, 502, 503, 504, 1, 51, 507, 508, 0, 0, + /* 2260 */ 0, 0, 0, 0, 515, 429, 176, 36, 519, 520, + /* 2270 */ 385, 0, 19, 176, 0, 0, 0, 0, 0, 0, + /* 2280 */ 0, 445, 0, 447, 0, 400, 0, 0, 0, 0, + /* 2290 */ 0, 38, 0, 0, 0, 0, 0, 0, 0, 51, + /* 2300 */ 0, 47, 0, 0, 0, 0, 53, 54, 0, 0, + /* 2310 */ 0, 0, 0, 22, 429, 158, 63, 64, 65, 66, + /* 2320 */ 0, 68, 157, 0, 156, 0, 0, 0, 492, 22, + /* 2330 */ 445, 495, 447, 52, 68, 499, 500, 501, 502, 503, + /* 2340 */ 504, 22, 0, 507, 508, 0, 0, 0, 0, 36, + /* 2350 */ 0, 515, 36, 52, 0, 519, 520, 36, 0, 0, + /* 2360 */ 0, 0, 44, 14, 36, 0, 36, 114, 44, 33, + /* 2370 */ 0, 54, 119, 0, 68, 385, 54, 492, 44, 47, + /* 2380 */ 495, 0, 68, 68, 499, 500, 501, 502, 503, 504, + /* 2390 */ 400, 54, 507, 508, 51, 44, 0, 45, 0, 207, + /* 2400 */ 515, 0, 385, 150, 519, 520, 51, 44, 51, 76, + /* 2410 */ 44, 0, 0, 51, 36, 51, 44, 400, 0, 429, + /* 2420 */ 36, 385, 54, 54, 44, 0, 36, 44, 54, 0, + /* 2430 */ 36, 54, 44, 0, 0, 445, 400, 447, 0, 0, + /* 2440 */ 0, 0, 385, 36, 22, 0, 429, 33, 195, 22, + /* 2450 */ 197, 36, 36, 200, 33, 36, 125, 400, 205, 36, + /* 2460 */ 36, 123, 445, 0, 447, 429, 36, 36, 36, 22, + /* 2470 */ 22, 36, 36, 36, 0, 22, 0, 224, 36, 22, + /* 2480 */ 0, 445, 492, 447, 56, 495, 429, 22, 385, 499, + /* 2490 */ 500, 501, 502, 503, 504, 36, 0, 507, 508, 0, + /* 2500 */ 0, 0, 445, 400, 447, 515, 36, 36, 0, 492, + /* 2510 */ 520, 36, 495, 0, 22, 20, 499, 500, 501, 502, + /* 2520 */ 503, 504, 36, 506, 507, 508, 469, 36, 492, 36, + /* 2530 */ 0, 495, 429, 116, 193, 499, 500, 501, 502, 503, + /* 2540 */ 504, 115, 0, 507, 508, 51, 193, 36, 445, 492, + /* 2550 */ 447, 22, 495, 0, 22, 385, 499, 500, 501, 502, + /* 2560 */ 503, 504, 0, 228, 507, 508, 115, 223, 229, 193, + /* 2570 */ 400, 0, 469, 3, 385, 193, 33, 312, 199, 193, + /* 2580 */ 116, 115, 115, 36, 116, 549, 219, 115, 203, 400, + /* 2590 */ 203, 36, 52, 52, 113, 492, 111, 33, 495, 429, + /* 2600 */ 33, 385, 499, 500, 501, 502, 503, 504, 33, 51, + /* 2610 */ 507, 508, 51, 116, 116, 445, 400, 447, 429, 115, + /* 2620 */ 33, 115, 115, 3, 33, 116, 82, 115, 36, 33, + /* 2630 */ 116, 115, 51, 116, 445, 116, 447, 36, 36, 36, + /* 2640 */ 36, 36, 36, 116, 116, 429, 33, 0, 51, 0, + /* 2650 */ 115, 44, 312, 116, 116, 0, 196, 0, 44, 44, + /* 2660 */ 115, 445, 492, 447, 115, 495, 116, 115, 195, 499, + /* 2670 */ 500, 501, 502, 503, 504, 115, 33, 507, 508, 200, + /* 2680 */ 2, 492, 113, 312, 495, 296, 196, 284, 499, 500, + /* 2690 */ 501, 502, 503, 504, 22, 113, 507, 508, 252, 115, + /* 2700 */ 115, 115, 51, 115, 51, 116, 22, 255, 492, 116, + /* 2710 */ 115, 495, 0, 115, 385, 499, 500, 501, 502, 503, + /* 2720 */ 504, 44, 552, 507, 508, 115, 510, 115, 117, 400, + /* 2730 */ 196, 0, 115, 22, 116, 116, 115, 115, 115, 115, + /* 2740 */ 115, 385, 116, 115, 115, 118, 51, 115, 115, 115, + /* 2750 */ 561, 116, 115, 229, 22, 116, 400, 126, 429, 36, + /* 2760 */ 36, 115, 36, 36, 116, 115, 36, 137, 116, 36, + /* 2770 */ 116, 36, 116, 137, 445, 116, 447, 137, 385, 137, + /* 2780 */ 115, 33, 115, 36, 115, 429, 22, 22, 36, 76, + /* 2790 */ 75, 36, 36, 400, 36, 109, 36, 36, 469, 36, + /* 2800 */ 82, 445, 36, 447, 36, 385, 36, 36, 109, 33, + /* 2810 */ 82, 36, 22, 36, 36, 36, 36, 36, 82, 36, + /* 2820 */ 400, 492, 429, 36, 495, 469, 22, 36, 499, 500, + /* 2830 */ 501, 502, 503, 504, 36, 36, 507, 508, 445, 36, + /* 2840 */ 447, 0, 36, 54, 44, 0, 36, 54, 492, 429, + /* 2850 */ 0, 495, 44, 36, 0, 499, 500, 501, 502, 503, + /* 2860 */ 504, 54, 469, 507, 508, 445, 44, 447, 36, 385, + /* 2870 */ 54, 44, 0, 36, 0, 22, 36, 0, 22, 33, + /* 2880 */ 36, 22, 21, 36, 400, 492, 22, 22, 495, 469, + /* 2890 */ 385, 21, 499, 500, 501, 502, 503, 504, 20, 564, + /* 2900 */ 507, 508, 564, 564, 564, 400, 564, 564, 564, 564, + /* 2910 */ 385, 564, 492, 429, 564, 495, 564, 564, 564, 499, + /* 2920 */ 500, 501, 502, 503, 504, 400, 564, 507, 508, 445, + /* 2930 */ 564, 447, 564, 564, 429, 564, 385, 564, 564, 564, + /* 2940 */ 564, 564, 564, 564, 564, 564, 564, 564, 564, 564, + /* 2950 */ 445, 400, 447, 564, 429, 564, 564, 564, 564, 564, + /* 2960 */ 564, 564, 564, 564, 564, 564, 564, 564, 564, 564, + /* 2970 */ 445, 564, 447, 564, 564, 385, 492, 564, 564, 495, + /* 2980 */ 429, 564, 564, 499, 500, 501, 502, 503, 504, 564, + /* 2990 */ 400, 507, 508, 564, 564, 564, 445, 492, 447, 564, + /* 3000 */ 495, 385, 564, 564, 499, 500, 501, 502, 503, 504, + /* 3010 */ 564, 564, 507, 508, 564, 564, 400, 492, 564, 429, + /* 3020 */ 495, 564, 564, 564, 499, 500, 501, 502, 503, 504, + /* 3030 */ 564, 564, 507, 508, 564, 445, 564, 447, 564, 564, + /* 3040 */ 564, 564, 564, 492, 564, 429, 495, 564, 564, 564, + /* 3050 */ 499, 500, 501, 502, 503, 504, 564, 564, 507, 508, + /* 3060 */ 564, 445, 564, 447, 564, 564, 564, 564, 564, 564, + /* 3070 */ 564, 564, 564, 564, 564, 564, 564, 564, 564, 564, + /* 3080 */ 564, 564, 492, 564, 564, 495, 564, 564, 564, 499, + /* 3090 */ 500, 501, 502, 503, 504, 564, 564, 507, 508, 564, + /* 3100 */ 564, 564, 564, 564, 564, 564, 385, 564, 492, 564, + /* 3110 */ 564, 495, 564, 564, 564, 499, 500, 501, 502, 503, + /* 3120 */ 504, 400, 564, 507, 508, 564, 564, 385, 564, 564, + /* 3130 */ 564, 564, 564, 564, 564, 564, 564, 564, 564, 564, + /* 3140 */ 564, 564, 400, 564, 385, 564, 564, 564, 564, 564, + /* 3150 */ 429, 564, 564, 564, 564, 564, 564, 564, 564, 400, + /* 3160 */ 564, 564, 564, 564, 564, 564, 445, 564, 447, 564, + /* 3170 */ 564, 429, 564, 564, 564, 564, 564, 564, 564, 564, + /* 3180 */ 564, 564, 564, 564, 564, 564, 564, 445, 429, 447, + /* 3190 */ 564, 564, 564, 564, 564, 564, 564, 564, 564, 564, + /* 3200 */ 564, 564, 564, 564, 445, 564, 447, 564, 564, 564, + /* 3210 */ 564, 385, 564, 492, 564, 564, 495, 564, 564, 564, + /* 3220 */ 499, 500, 501, 502, 503, 504, 400, 564, 507, 508, + /* 3230 */ 564, 564, 564, 564, 492, 564, 564, 495, 564, 564, + /* 3240 */ 564, 499, 500, 501, 502, 503, 504, 564, 564, 507, + /* 3250 */ 508, 492, 564, 385, 495, 429, 564, 564, 499, 500, + /* 3260 */ 501, 502, 503, 504, 564, 564, 507, 508, 400, 564, + /* 3270 */ 564, 445, 564, 447, 564, 385, 564, 564, 564, 564, + /* 3280 */ 564, 564, 564, 564, 564, 564, 564, 564, 564, 564, + /* 3290 */ 400, 564, 564, 564, 564, 564, 385, 429, 564, 564, + /* 3300 */ 564, 564, 564, 564, 564, 564, 564, 564, 564, 564, + /* 3310 */ 564, 400, 564, 445, 564, 447, 564, 385, 492, 429, + /* 3320 */ 564, 495, 564, 564, 564, 499, 500, 501, 502, 503, + /* 3330 */ 504, 564, 400, 507, 508, 445, 564, 447, 564, 564, + /* 3340 */ 429, 564, 564, 564, 564, 564, 564, 564, 564, 564, + /* 3350 */ 564, 564, 564, 564, 564, 564, 445, 564, 447, 564, + /* 3360 */ 492, 429, 564, 495, 564, 564, 564, 499, 500, 501, + /* 3370 */ 502, 503, 504, 564, 564, 507, 508, 445, 564, 447, + /* 3380 */ 564, 564, 492, 564, 385, 495, 564, 564, 564, 499, + /* 3390 */ 500, 501, 502, 503, 504, 564, 564, 507, 508, 400, + /* 3400 */ 564, 564, 564, 492, 564, 385, 495, 564, 564, 564, + /* 3410 */ 499, 500, 501, 502, 503, 504, 564, 564, 507, 508, + /* 3420 */ 400, 564, 564, 564, 492, 564, 564, 495, 429, 564, + /* 3430 */ 564, 499, 500, 501, 502, 503, 504, 564, 564, 507, + /* 3440 */ 508, 564, 564, 564, 445, 564, 447, 564, 564, 429, + /* 3450 */ 564, 564, 564, 564, 564, 564, 564, 564, 564, 564, + /* 3460 */ 564, 564, 564, 564, 564, 445, 564, 447, 564, 564, + /* 3470 */ 564, 564, 564, 564, 564, 564, 564, 564, 564, 564, + /* 3480 */ 564, 564, 564, 564, 564, 564, 564, 564, 564, 564, + /* 3490 */ 564, 492, 564, 564, 495, 564, 564, 564, 499, 500, + /* 3500 */ 501, 502, 503, 504, 564, 564, 507, 508, 564, 564, + /* 3510 */ 385, 564, 492, 564, 564, 495, 564, 564, 564, 499, + /* 3520 */ 500, 501, 502, 503, 504, 400, 564, 507, 508, 564, + /* 3530 */ 385, 564, 564, 564, 564, 564, 564, 564, 564, 564, + /* 3540 */ 564, 564, 564, 564, 564, 400, 564, 564, 564, 564, + /* 3550 */ 564, 564, 385, 564, 429, 564, 564, 564, 564, 564, + /* 3560 */ 564, 564, 564, 564, 564, 564, 564, 400, 564, 564, + /* 3570 */ 445, 564, 447, 564, 429, 564, 564, 564, 564, 564, + /* 3580 */ 564, 564, 564, 564, 564, 564, 564, 564, 564, 564, + /* 3590 */ 445, 564, 447, 564, 564, 564, 429, 564, 564, 564, + /* 3600 */ 564, 564, 564, 564, 564, 564, 564, 564, 564, 564, + /* 3610 */ 564, 564, 445, 564, 447, 564, 564, 492, 564, 564, + /* 3620 */ 495, 564, 564, 564, 499, 500, 501, 502, 503, 504, + /* 3630 */ 564, 564, 507, 508, 564, 385, 564, 492, 564, 564, + /* 3640 */ 495, 564, 564, 564, 499, 500, 501, 502, 503, 504, + /* 3650 */ 400, 564, 507, 508, 564, 564, 564, 385, 564, 492, + /* 3660 */ 564, 564, 495, 564, 564, 564, 499, 500, 501, 502, + /* 3670 */ 503, 504, 400, 564, 507, 508, 385, 564, 564, 429, + /* 3680 */ 564, 564, 564, 564, 564, 564, 564, 564, 564, 564, + /* 3690 */ 564, 400, 564, 564, 564, 445, 564, 447, 564, 385, + /* 3700 */ 564, 429, 564, 564, 564, 564, 564, 564, 564, 564, + /* 3710 */ 564, 564, 564, 564, 400, 564, 564, 445, 564, 447, + /* 3720 */ 429, 564, 564, 564, 564, 564, 564, 564, 564, 564, + /* 3730 */ 564, 564, 564, 564, 564, 564, 445, 564, 447, 564, + /* 3740 */ 564, 564, 492, 429, 564, 495, 564, 564, 564, 499, + /* 3750 */ 500, 501, 502, 503, 504, 564, 564, 507, 508, 445, + /* 3760 */ 564, 447, 564, 385, 492, 564, 564, 495, 564, 564, + /* 3770 */ 564, 499, 500, 501, 502, 503, 504, 564, 400, 507, + /* 3780 */ 508, 564, 564, 492, 564, 385, 495, 564, 564, 564, + /* 3790 */ 499, 500, 501, 502, 503, 504, 564, 564, 507, 508, + /* 3800 */ 400, 564, 564, 564, 385, 564, 492, 429, 564, 495, + /* 3810 */ 564, 564, 564, 499, 500, 501, 502, 503, 504, 400, + /* 3820 */ 564, 507, 508, 445, 564, 447, 564, 564, 564, 429, + /* 3830 */ 564, 564, 564, 564, 564, 564, 564, 564, 564, 564, + /* 3840 */ 564, 564, 564, 564, 564, 445, 564, 447, 429, 564, + /* 3850 */ 564, 564, 564, 385, 564, 564, 564, 564, 564, 564, + /* 3860 */ 564, 564, 564, 564, 445, 564, 447, 564, 400, 564, + /* 3870 */ 492, 564, 564, 495, 564, 564, 564, 499, 500, 501, + /* 3880 */ 502, 503, 504, 564, 564, 507, 508, 564, 564, 564, + /* 3890 */ 564, 564, 492, 564, 564, 495, 564, 429, 564, 499, + /* 3900 */ 500, 501, 502, 503, 504, 564, 564, 507, 508, 564, + /* 3910 */ 564, 492, 564, 445, 495, 447, 564, 564, 499, 500, + /* 3920 */ 501, 502, 503, 504, 564, 564, 507, 508, 564, 564, + /* 3930 */ 564, 564, 564, 564, 564, 564, 564, 564, 385, 564, + /* 3940 */ 564, 564, 564, 564, 564, 564, 564, 564, 564, 564, + /* 3950 */ 564, 564, 564, 400, 564, 564, 564, 564, 385, 564, + /* 3960 */ 492, 564, 564, 495, 564, 564, 564, 499, 500, 501, + /* 3970 */ 502, 503, 504, 400, 564, 507, 508, 564, 385, 564, + /* 3980 */ 564, 564, 429, 564, 564, 564, 564, 564, 564, 564, + /* 3990 */ 564, 564, 564, 400, 564, 564, 564, 564, 445, 564, + /* 4000 */ 447, 564, 429, 564, 564, 564, 564, 564, 564, 564, + /* 4010 */ 564, 564, 564, 564, 564, 564, 564, 564, 445, 564, + /* 4020 */ 447, 564, 429, 564, 564, 564, 564, 564, 564, 564, + /* 4030 */ 564, 564, 564, 564, 564, 564, 564, 564, 445, 564, + /* 4040 */ 447, 564, 564, 564, 564, 492, 564, 564, 495, 564, + /* 4050 */ 564, 564, 499, 500, 501, 502, 503, 504, 564, 564, + /* 4060 */ 507, 508, 564, 564, 564, 492, 564, 564, 495, 564, + /* 4070 */ 564, 564, 499, 500, 501, 502, 503, 504, 564, 564, + /* 4080 */ 507, 508, 564, 564, 564, 492, 564, 564, 495, 564, + /* 4090 */ 564, 564, 499, 500, 501, 502, 503, 504, 564, 564, + /* 4100 */ 507, 508, 382, 382, 382, 382, 382, 382, 382, 382, + /* 4110 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, + /* 4120 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, + /* 4130 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, + /* 4140 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, + /* 4150 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, + /* 4160 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, + /* 4170 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, + /* 4180 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, + /* 4190 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, + /* 4200 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, + /* 4210 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, + /* 4220 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, + /* 4230 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, + /* 4240 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, + /* 4250 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, + /* 4260 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, + /* 4270 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, + /* 4280 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, + /* 4290 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, + /* 4300 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, + /* 4310 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, + /* 4320 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, + /* 4330 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, + /* 4340 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, + /* 4350 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, + /* 4360 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, + /* 4370 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, + /* 4380 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, + /* 4390 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, + /* 4400 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, + /* 4410 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, + /* 4420 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, + /* 4430 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, + /* 4440 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, + /* 4450 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, + /* 4460 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, + /* 4470 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, + /* 4480 */ 382, 382, 382, 382, }; -#define YY_SHIFT_COUNT (1005) +#define YY_SHIFT_COUNT (1003) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (2975) +#define YY_SHIFT_MAX (2878) static const unsigned short int yy_shift_ofst[] = { /* 0 */ 1599, 271, 354, 271, 626, 626, 626, 626, 626, 626, /* 10 */ 626, 626, 626, 626, 626, 626, 709, 1063, 1063, 1334, @@ -1478,250 +1504,250 @@ static const unsigned short int yy_shift_ofst[] = { /* 30 */ 1063, 980, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, /* 40 */ 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, /* 50 */ 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, - /* 60 */ 1063, 93, 247, 253, 221, 219, 356, 219, 219, 221, - /* 70 */ 221, 219, 1820, 219, 1333, 1820, 381, 219, 4, 1949, - /* 80 */ 673, 673, 61, 61, 1949, 1949, 385, 385, 673, 325, - /* 90 */ 325, 447, 274, 274, 480, 300, 61, 61, 61, 61, - /* 100 */ 61, 61, 61, 61, 61, 61, 61, 167, 266, 275, - /* 110 */ 61, 61, 40, 4, 61, 167, 61, 4, 61, 61, - /* 120 */ 61, 61, 4, 61, 61, 61, 4, 61, 4, 4, - /* 130 */ 4, 749, 165, 165, 452, 452, 543, 762, 178, 48, + /* 60 */ 1063, 34, 411, 835, 35, 126, 512, 126, 126, 35, + /* 70 */ 35, 126, 1407, 126, 1333, 1407, 423, 126, 74, 553, + /* 80 */ 360, 360, 201, 201, 553, 553, 350, 350, 360, 324, + /* 90 */ 324, 343, 316, 316, 247, 268, 201, 201, 201, 201, + /* 100 */ 201, 201, 201, 201, 201, 201, 201, 283, 325, 410, + /* 110 */ 201, 201, 443, 74, 201, 283, 201, 74, 201, 201, + /* 120 */ 201, 201, 74, 201, 201, 201, 74, 201, 74, 74, + /* 130 */ 74, 520, 165, 165, 538, 538, 621, 762, 178, 48, /* 140 */ 921, 921, 921, 921, 921, 921, 921, 921, 921, 921, - /* 150 */ 921, 921, 921, 921, 921, 921, 921, 921, 921, 520, - /* 160 */ 187, 325, 447, 1105, 1105, 477, 556, 556, 556, 716, - /* 170 */ 716, 850, 1115, 477, 40, 4, 73, 4, 4, 135, - /* 180 */ 4, 4, 406, 4, 406, 406, 483, 1045, 452, 452, - /* 190 */ 452, 452, 452, 452, 1354, 413, 21, 75, 414, 414, - /* 200 */ 822, 125, 456, 711, 670, 186, 207, 723, 922, 922, - /* 210 */ 1336, 730, 972, 972, 972, 1211, 972, 1157, 853, 726, - /* 220 */ 1344, 1379, 949, 823, 1294, 1294, 1311, 1384, 1384, 1355, - /* 230 */ 1456, 213, 1294, 1115, 1506, 1763, 1807, 1809, 1601, 40, - /* 240 */ 1809, 40, 1625, 1807, 1839, 1815, 1839, 1815, 1681, 1807, - /* 250 */ 1839, 1807, 1815, 1681, 1681, 1681, 1770, 1785, 1807, 1807, - /* 260 */ 1797, 1807, 1807, 1807, 1893, 1864, 1893, 1864, 1809, 40, - /* 270 */ 40, 1914, 40, 1916, 1921, 40, 1916, 40, 1935, 40, - /* 280 */ 1946, 40, 40, 1807, 40, 1893, 4, 4, 4, 4, - /* 290 */ 4, 4, 4, 4, 4, 4, 4, 1807, 1045, 1045, - /* 300 */ 1893, 406, 406, 406, 1739, 1867, 1809, 749, 1986, 1793, - /* 310 */ 1798, 1914, 749, 1506, 1807, 406, 1709, 1714, 1709, 1714, - /* 320 */ 1707, 1828, 1709, 1713, 1717, 1740, 1506, 1742, 1745, 1718, - /* 330 */ 1728, 1731, 1839, 2045, 1940, 1759, 1916, 749, 749, 1714, - /* 340 */ 406, 406, 406, 406, 1714, 406, 1892, 749, 406, 1946, - /* 350 */ 749, 1979, 406, 1909, 1946, 749, 483, 749, 1839, 406, - /* 360 */ 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, - /* 370 */ 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, - /* 380 */ 406, 2018, 406, 1807, 749, 2123, 2128, 2146, 2145, 1893, - /* 390 */ 3956, 3956, 3956, 3956, 3956, 3956, 3956, 3956, 3956, 3956, - /* 400 */ 3956, 3956, 39, 1238, 204, 302, 310, 84, 904, 50, - /* 410 */ 197, 1175, 1197, 1258, 1134, 1212, 1353, 1366, 1463, 1558, - /* 420 */ 589, 1611, 1280, 1307, 1281, 1281, 1281, 1281, 1281, 1281, - /* 430 */ 1281, 1281, 1281, 100, 65, 500, 837, 3, 3, 653, - /* 440 */ 53, 387, 294, 284, 284, 604, 902, 284, 696, 920, - /* 450 */ 1328, 422, 47, 47, 1154, 1221, 817, 1154, 1154, 1154, - /* 460 */ 1465, 94, 511, 1488, 1496, 1358, 1480, 1513, 1414, 1419, - /* 470 */ 1421, 1433, 1481, 752, 1532, 954, 1518, 1533, 1547, 1324, - /* 480 */ 1220, 1459, 970, 1528, 1544, 1550, 1551, 1428, 1254, 1412, - /* 490 */ 1574, 1576, 1585, 1597, 1600, 1604, 1559, 1606, 1610, 1525, - /* 500 */ 1613, 1616, 1617, 1618, 1642, 1619, 1640, 1645, 1665, 1667, - /* 510 */ 1675, 1682, 1685, 1691, 1693, 1706, 1669, 1694, 1697, 1715, - /* 520 */ 1735, 1738, 1546, 1526, 1612, 1646, 1663, 1737, 1736, 1806, - /* 530 */ 2216, 2220, 2221, 2176, 2224, 2195, 1989, 2197, 2198, 2199, - /* 540 */ 1995, 2239, 2204, 2205, 1999, 2207, 2244, 2245, 2003, 2247, - /* 550 */ 2212, 2249, 2214, 2251, 2233, 2267, 2222, 2019, 2259, 2046, - /* 560 */ 2271, 2048, 2049, 2055, 2059, 2277, 2278, 2279, 2071, 2074, - /* 570 */ 2287, 2288, 2131, 2240, 2241, 2290, 2258, 2293, 2295, 2260, - /* 580 */ 2243, 2298, 2252, 2300, 2265, 2304, 2305, 2316, 2266, 2318, - /* 590 */ 2319, 2320, 2321, 2323, 2324, 2149, 2297, 2331, 2158, 2335, - /* 600 */ 2342, 2343, 2347, 2349, 2351, 2352, 2353, 2354, 2355, 2356, - /* 610 */ 2358, 2359, 2360, 2361, 2362, 2363, 2364, 2374, 2376, 2315, - /* 620 */ 2367, 2322, 2368, 2370, 2371, 2372, 2377, 2378, 2379, 2380, - /* 630 */ 2381, 2365, 2382, 2225, 2384, 2228, 2386, 2232, 2389, 2390, - /* 640 */ 2369, 2340, 2373, 2385, 2406, 2339, 2411, 2345, 2383, 2415, - /* 650 */ 2350, 2417, 2357, 2422, 2424, 2397, 2387, 2394, 2426, 2403, - /* 660 */ 2388, 2396, 2444, 2409, 2392, 2405, 2447, 2414, 2451, 2407, - /* 670 */ 2408, 2420, 2404, 2419, 2442, 2423, 2458, 2430, 2418, 2471, - /* 680 */ 2484, 2485, 2486, 2434, 2272, 2480, 2404, 2431, 2481, 2404, - /* 690 */ 2436, 2488, 2489, 2421, 2493, 2494, 2459, 2445, 2452, 2498, - /* 700 */ 2464, 2448, 2457, 2503, 2468, 2453, 2467, 2519, 2487, 2470, - /* 710 */ 2482, 2525, 2528, 2529, 2530, 2531, 2532, 2410, 2416, 2497, - /* 720 */ 2515, 2540, 2520, 2505, 2507, 2508, 2509, 2510, 2512, 2513, - /* 730 */ 2517, 2518, 2514, 2524, 2523, 2533, 2538, 2537, 2551, 2539, - /* 740 */ 2568, 2553, 2576, 2555, 2522, 2579, 2558, 2546, 2584, 2585, - /* 750 */ 2587, 2552, 2589, 2565, 2602, 2567, 2610, 2592, 2591, 2580, - /* 760 */ 2582, 2588, 2504, 2506, 2623, 2440, 2413, 2412, 2521, 2425, - /* 770 */ 2404, 2593, 2638, 2446, 2611, 2624, 2649, 2432, 2628, 2460, - /* 780 */ 2455, 2655, 2656, 2465, 2454, 2466, 2461, 2659, 2630, 2375, - /* 790 */ 2554, 2550, 2556, 2557, 2631, 2632, 2559, 2618, 2562, 2620, - /* 800 */ 2569, 2560, 2645, 2648, 2566, 2570, 2571, 2577, 2574, 2650, - /* 810 */ 2633, 2642, 2594, 2661, 2398, 2626, 2586, 2673, 2596, 2676, - /* 820 */ 2597, 2599, 2711, 2683, 2433, 2681, 2682, 2684, 2685, 2686, - /* 830 */ 2687, 2603, 2609, 2677, 2441, 2697, 2691, 2738, 2743, 2629, - /* 840 */ 2702, 2634, 2635, 2641, 2643, 2561, 2651, 2747, 2704, 2549, - /* 850 */ 2753, 2657, 2660, 2578, 2721, 2581, 2739, 2658, 2495, 2664, - /* 860 */ 2776, 2758, 2535, 2667, 2668, 2669, 2670, 2665, 2675, 2674, - /* 870 */ 2678, 2679, 2688, 2689, 2690, 2741, 2692, 2693, 2744, 2695, - /* 880 */ 2774, 2542, 2694, 2698, 2799, 2696, 2700, 2604, 2757, 2703, - /* 890 */ 2705, 2802, 2795, 2701, 2706, 2404, 2769, 2709, 2710, 2712, - /* 900 */ 2714, 2715, 2713, 2804, 2805, 2809, 2606, 2716, 2801, 2810, - /* 910 */ 2732, 2735, 2817, 2740, 2742, 2818, 2674, 2746, 2820, 2678, - /* 920 */ 2749, 2821, 2679, 2759, 2823, 2688, 2723, 2726, 2737, 2745, - /* 930 */ 2763, 2846, 2765, 2848, 2771, 2846, 2846, 2865, 2812, 2814, - /* 940 */ 2868, 2855, 2856, 2857, 2858, 2859, 2860, 2862, 2866, 2875, - /* 950 */ 2879, 2880, 2819, 2794, 2835, 2811, 2885, 2883, 2886, 2887, - /* 960 */ 2899, 2888, 2889, 2891, 2847, 2514, 2895, 2524, 2896, 2898, - /* 970 */ 2908, 2911, 2913, 2912, 2936, 2914, 2897, 2905, 2952, 2917, - /* 980 */ 2901, 2910, 2956, 2921, 2904, 2916, 2962, 2928, 2915, 2922, - /* 990 */ 2965, 2931, 2968, 2948, 2935, 2972, 2953, 2941, 2943, 2951, - /* 1000 */ 2955, 2969, 2970, 2971, 2973, 2975, + /* 150 */ 921, 921, 921, 921, 921, 921, 921, 921, 921, 732, + /* 160 */ 447, 324, 343, 895, 895, 863, 1060, 1060, 1060, 853, + /* 170 */ 853, 502, 575, 863, 443, 74, 558, 74, 74, 417, + /* 180 */ 74, 74, 624, 74, 624, 624, 632, 760, 538, 538, + /* 190 */ 538, 538, 538, 538, 2253, 413, 21, 75, 282, 282, + /* 200 */ 356, 488, 962, 424, 464, 261, 451, 675, 647, 647, + /* 210 */ 1018, 1287, 972, 972, 972, 720, 972, 1115, 1354, 748, + /* 220 */ 1386, 1422, 230, 778, 1190, 1190, 1215, 1061, 1061, 1297, + /* 230 */ 1394, 1039, 1190, 575, 1491, 1750, 1783, 1786, 1578, 443, + /* 240 */ 1786, 443, 1606, 1783, 1804, 1781, 1804, 1781, 1643, 1783, + /* 250 */ 1804, 1783, 1781, 1643, 1643, 1643, 1738, 1741, 1783, 1783, + /* 260 */ 1747, 1783, 1783, 1783, 1842, 1813, 1842, 1813, 1786, 443, + /* 270 */ 443, 1860, 443, 1868, 1876, 443, 1868, 443, 1888, 443, + /* 280 */ 1893, 443, 443, 1783, 443, 1842, 74, 74, 74, 74, + /* 290 */ 74, 74, 74, 74, 74, 74, 74, 1783, 760, 760, + /* 300 */ 1842, 624, 624, 624, 1686, 1824, 1786, 520, 1925, 1730, + /* 310 */ 1732, 1860, 520, 1491, 1783, 624, 1641, 1645, 1641, 1645, + /* 320 */ 1644, 1759, 1641, 1648, 1650, 1671, 1491, 1665, 1673, 1653, + /* 330 */ 1663, 1662, 1804, 1977, 1878, 1703, 1868, 520, 520, 1645, + /* 340 */ 624, 624, 624, 624, 1645, 624, 1825, 520, 624, 1893, + /* 350 */ 520, 1927, 624, 1847, 1893, 520, 632, 520, 1804, 624, + /* 360 */ 624, 624, 624, 624, 624, 624, 624, 624, 624, 624, + /* 370 */ 624, 624, 624, 624, 624, 624, 624, 624, 624, 624, + /* 380 */ 624, 1952, 624, 1783, 520, 2050, 2048, 2047, 2059, 1842, + /* 390 */ 4102, 4102, 4102, 4102, 4102, 4102, 4102, 4102, 4102, 4102, + /* 400 */ 4102, 4102, 39, 590, 204, 890, 310, 84, 906, 50, + /* 410 */ 197, 587, 922, 1057, 426, 1114, 1175, 1258, 1192, 1280, + /* 420 */ 1205, 1214, 1231, 1263, 1452, 1452, 1452, 1452, 1452, 1452, + /* 430 */ 1452, 1452, 1452, 100, 65, 1246, 1344, 3, 3, 772, + /* 440 */ 53, 421, 893, 698, 764, 384, 535, 627, 552, 725, + /* 450 */ 725, 1016, 1153, 218, 1016, 1016, 1016, 286, 1336, 1437, + /* 460 */ 1517, 1507, 1312, 1404, 1537, 1317, 485, 1425, 1435, 485, + /* 470 */ 1440, 1503, 1531, 1533, 1202, 1562, 1579, 1602, 1130, 1367, + /* 480 */ 1449, 1488, 1535, 1538, 1539, 1541, 1423, 1332, 1366, 1550, + /* 490 */ 1576, 1585, 1586, 1580, 1588, 1489, 1595, 1597, 1581, 1600, + /* 500 */ 1601, 1603, 1604, 1605, 1627, 1631, 1634, 1636, 1640, 1649, + /* 510 */ 1661, 1666, 1677, 1685, 1693, 1642, 485, 1658, 1660, 1667, + /* 520 */ 1670, 1675, 1512, 1679, 1622, 1659, 1553, 1696, 1688, 1707, + /* 530 */ 2151, 2152, 2153, 2107, 2159, 2124, 1919, 2127, 2129, 2130, + /* 540 */ 1924, 2174, 2139, 2143, 1937, 2145, 2183, 2185, 1943, 2187, + /* 550 */ 2154, 2191, 2156, 2193, 2173, 2197, 2162, 1961, 2200, 1978, + /* 560 */ 2201, 1980, 1982, 1987, 1992, 2209, 2220, 2222, 2004, 2006, + /* 570 */ 2223, 2225, 2069, 2177, 2178, 2232, 2198, 2233, 2235, 2202, + /* 580 */ 2186, 2237, 2188, 2242, 2196, 2245, 2246, 2247, 2204, 2258, + /* 590 */ 2259, 2260, 2261, 2262, 2263, 2090, 2231, 2271, 2097, 2274, + /* 600 */ 2275, 2276, 2277, 2278, 2279, 2280, 2282, 2284, 2286, 2287, + /* 610 */ 2288, 2289, 2290, 2292, 2293, 2294, 2295, 2296, 2297, 2248, + /* 620 */ 2298, 2254, 2300, 2302, 2303, 2304, 2305, 2308, 2309, 2310, + /* 630 */ 2311, 2291, 2312, 2157, 2320, 2165, 2323, 2168, 2325, 2326, + /* 640 */ 2307, 2281, 2319, 2301, 2327, 2266, 2342, 2306, 2313, 2345, + /* 650 */ 2314, 2346, 2315, 2347, 2348, 2316, 2317, 2318, 2350, 2321, + /* 660 */ 2322, 2324, 2354, 2328, 2337, 2334, 2358, 2330, 2359, 2332, + /* 670 */ 2351, 2336, 2343, 2355, 2349, 2357, 2360, 2352, 2363, 2361, + /* 680 */ 2365, 2370, 2373, 2366, 2192, 2381, 2343, 2362, 2396, 2343, + /* 690 */ 2364, 2398, 2401, 2333, 2411, 2412, 2378, 2368, 2372, 2418, + /* 700 */ 2384, 2369, 2380, 2425, 2390, 2374, 2383, 2429, 2394, 2377, + /* 710 */ 2388, 2433, 2434, 2438, 2439, 2440, 2441, 2331, 2338, 2407, + /* 720 */ 2422, 2445, 2427, 2415, 2416, 2419, 2423, 2424, 2430, 2431, + /* 730 */ 2432, 2435, 2414, 2421, 2436, 2437, 2447, 2442, 2463, 2448, + /* 740 */ 2474, 2453, 2476, 2457, 2428, 2480, 2465, 2459, 2496, 2499, + /* 750 */ 2500, 2470, 2501, 2471, 2508, 2475, 2513, 2492, 2495, 2486, + /* 760 */ 2491, 2493, 2417, 2426, 2530, 2341, 2339, 2335, 2451, 2344, + /* 770 */ 2343, 2494, 2542, 2353, 2511, 2529, 2553, 2367, 2532, 2376, + /* 780 */ 2379, 2562, 2571, 2382, 2385, 2386, 2387, 2570, 2543, 2265, + /* 790 */ 2466, 2464, 2467, 2468, 2547, 2555, 2472, 2540, 2481, 2541, + /* 800 */ 2485, 2497, 2564, 2567, 2498, 2504, 2506, 2507, 2509, 2575, + /* 810 */ 2558, 2561, 2512, 2587, 2340, 2544, 2514, 2591, 2516, 2592, + /* 820 */ 2517, 2519, 2620, 2596, 2371, 2601, 2602, 2603, 2604, 2605, + /* 830 */ 2606, 2527, 2528, 2581, 2389, 2613, 2597, 2647, 2649, 2535, + /* 840 */ 2607, 2537, 2538, 2545, 2549, 2460, 2552, 2655, 2614, 2479, + /* 850 */ 2657, 2550, 2560, 2490, 2615, 2473, 2643, 2569, 2403, 2582, + /* 860 */ 2678, 2672, 2446, 2584, 2585, 2586, 2588, 2589, 2593, 2595, + /* 870 */ 2598, 2610, 2612, 2617, 2618, 2651, 2621, 2622, 2653, 2619, + /* 880 */ 2684, 2452, 2623, 2624, 2712, 2626, 2625, 2534, 2677, 2628, + /* 890 */ 2611, 2731, 2711, 2627, 2629, 2343, 2695, 2632, 2633, 2635, + /* 900 */ 2634, 2637, 2631, 2732, 2524, 2639, 2723, 2724, 2646, 2648, + /* 910 */ 2726, 2650, 2652, 2727, 2595, 2654, 2730, 2598, 2656, 2733, + /* 920 */ 2610, 2659, 2735, 2612, 2630, 2636, 2640, 2642, 2665, 2748, + /* 930 */ 2667, 2747, 2669, 2748, 2748, 2764, 2713, 2715, 2765, 2752, + /* 940 */ 2755, 2756, 2758, 2760, 2761, 2763, 2766, 2768, 2770, 2771, + /* 950 */ 2718, 2686, 2728, 2699, 2776, 2775, 2777, 2778, 2790, 2779, + /* 960 */ 2780, 2781, 2736, 2414, 2783, 2421, 2787, 2791, 2798, 2799, + /* 970 */ 2804, 2803, 2841, 2806, 2789, 2800, 2845, 2810, 2793, 2808, + /* 980 */ 2850, 2817, 2807, 2822, 2854, 2832, 2816, 2827, 2872, 2837, + /* 990 */ 2874, 2853, 2840, 2877, 2856, 2846, 2844, 2847, 2859, 2861, + /* 1000 */ 2864, 2865, 2870, 2878, }; #define YY_REDUCE_COUNT (401) -#define YY_REDUCE_MIN (-530) -#define YY_REDUCE_MAX (3444) +#define YY_REDUCE_MIN (-527) +#define YY_REDUCE_MAX (3593) static const short yy_reduce_ofst[] = { - /* 0 */ -142, -347, -206, 607, 1233, 1259, 1371, 1417, 1447, 1498, - /* 10 */ 292, 1607, 1637, 1671, 1758, 1804, -101, 656, 1834, 1898, - /* 20 */ 257, 1925, 1962, 2011, 2060, 2088, 2124, 2193, 2229, 2257, - /* 30 */ 2338, 2102, 2366, 2402, 2435, 2478, 2511, 2575, 2598, 2644, - /* 40 */ 2666, 2680, 2756, 2791, 2824, 2867, 2900, 2964, 2987, 3033, - /* 50 */ 3055, 3069, 3145, 3180, 3213, 3256, 3289, 3353, 3376, 3422, - /* 60 */ 3444, -342, 504, 467, -88, 315, 391, 1155, 1185, 172, - /* 70 */ 255, 1222, 67, -530, -74, 308, -528, -203, 312, -273, - /* 80 */ -427, -120, -31, 371, -274, -70, -396, -394, 179, -402, - /* 90 */ -392, -19, -29, 535, -249, 317, 410, 528, 634, 647, - /* 100 */ -348, 355, 650, 665, 668, 671, 373, -374, 155, -293, - /* 110 */ 623, 675, 470, 490, 678, -20, 713, 566, 719, 777, - /* 120 */ 866, 896, 377, 908, 974, 981, 687, 988, 63, 753, - /* 130 */ 517, 407, -370, -370, 105, -424, 482, 81, -139, 272, - /* 140 */ 303, 344, 571, 616, 643, 738, 829, 830, 860, 950, - /* 150 */ 961, 1012, 1013, 1026, 1033, 1035, 1075, 1076, 1082, 142, - /* 160 */ 127, 277, 591, 787, 793, 813, 127, 557, 595, 767, - /* 170 */ 768, 783, -407, 1018, 836, 211, 619, 513, 631, 795, - /* 180 */ 712, 1000, 991, 1016, 1037, 1083, 807, 1059, 743, 769, - /* 190 */ 867, 1008, 1131, 1149, 1109, 1208, 1244, 1194, 1123, 1123, - /* 200 */ 1108, 1132, 1142, 1167, 1302, 1123, 1278, 1278, 1305, 1306, - /* 210 */ 1320, 1326, 1214, 1227, 1234, 1315, 1236, 1278, 1330, 1385, - /* 220 */ 1296, 1390, 1347, 1314, 1337, 1338, 1278, 1262, 1263, 1243, - /* 230 */ 1272, 1274, 1342, 1394, 1348, 1327, 1426, 1350, 1346, 1429, - /* 240 */ 1357, 1442, 1378, 1455, 1457, 1406, 1467, 1411, 1418, 1478, - /* 250 */ 1482, 1489, 1427, 1436, 1438, 1444, 1484, 1486, 1502, 1503, - /* 260 */ 1495, 1507, 1508, 1509, 1519, 1527, 1522, 1530, 1432, 1514, - /* 270 */ 1520, 1487, 1536, 1534, 1468, 1545, 1539, 1548, 1493, 1553, - /* 280 */ 1511, 1556, 1557, 1571, 1563, 1580, 1549, 1552, 1554, 1560, - /* 290 */ 1562, 1565, 1566, 1567, 1575, 1579, 1581, 1577, 1586, 1587, - /* 300 */ 1588, 1540, 1541, 1542, 1490, 1524, 1505, 1609, 1537, 1543, - /* 310 */ 1555, 1573, 1615, 1568, 1626, 1582, 1483, 1564, 1499, 1578, - /* 320 */ 1485, 1494, 1501, 1504, 1510, 1515, 1589, 1516, 1521, 1497, - /* 330 */ 1517, 1512, 1659, 1569, 1535, 1529, 1674, 1666, 1670, 1614, - /* 340 */ 1632, 1633, 1635, 1636, 1620, 1638, 1627, 1684, 1647, 1643, - /* 350 */ 1698, 1594, 1658, 1654, 1661, 1711, 1696, 1719, 1723, 1679, - /* 360 */ 1683, 1686, 1688, 1689, 1690, 1701, 1702, 1703, 1704, 1708, - /* 370 */ 1710, 1716, 1720, 1722, 1724, 1732, 1743, 1747, 1748, 1749, - /* 380 */ 1750, 1725, 1754, 1752, 1762, 1767, 1786, 1790, 1791, 1808, - /* 390 */ 1726, 1771, 1692, 1727, 1741, 1744, 1784, 1787, 1777, 1792, - /* 400 */ 1778, 1829, + /* 0 */ -139, -344, -203, 1235, 1265, 1390, 1499, 1536, 1587, 1623, + /* 10 */ 649, 1669, 1711, 1749, 1836, 1885, -98, 611, 1371, 1990, + /* 20 */ 2017, 2036, 2057, 2103, 2170, 2189, 2216, 2329, 2356, 2393, + /* 30 */ 2420, 2484, 2505, 2525, 2551, 2590, 2616, 2721, 2742, 2759, + /* 40 */ 2826, 2868, 2890, 2911, 2932, 2999, 3020, 3125, 3145, 3167, + /* 50 */ 3250, 3272, 3291, 3314, 3378, 3400, 3419, 3468, 3553, 3573, + /* 60 */ 3593, -339, 161, 470, -79, 158, 528, 832, 897, 786, + /* 70 */ 898, 904, 291, -527, -93, 330, -525, -177, 608, -270, + /* 80 */ -424, -133, 416, 885, -271, -117, -393, -391, -260, -399, + /* 90 */ -389, -333, -6, 69, -246, 168, 174, 382, 474, 607, + /* 100 */ -105, 344, 620, 645, 660, 689, 367, -288, 223, -290, + /* 110 */ 721, 747, -209, 303, 780, 170, 793, 262, 883, 931, + /* 120 */ 938, 984, 435, 1034, 1085, 1124, 547, 1132, -78, 588, + /* 130 */ 581, 269, -99, -99, 406, -421, -103, -219, 112, 351, + /* 140 */ 2, 159, 357, 532, 657, 672, 722, 916, 970, 973, + /* 150 */ 1003, 1007, 1032, 1043, 1088, 1089, 1093, 1128, 1133, 217, + /* 160 */ 414, -348, 404, 686, 790, 711, 414, 579, 699, 651, + /* 170 */ 697, 55, -404, 763, 882, 671, 684, 839, 851, 412, + /* 180 */ 933, 54, 497, 1101, 907, 956, -397, 859, 368, 503, + /* 190 */ 605, 623, 631, 663, 1100, 1264, 1245, 1261, 1193, 1193, + /* 200 */ 1161, 1174, 1182, 1198, 1326, 1193, 1302, 1302, 1324, 1328, + /* 210 */ 1335, 1288, 1196, 1197, 1199, 1281, 1209, 1302, 1295, 1360, + /* 220 */ 1284, 1379, 1337, 1309, 1331, 1338, 1302, 1255, 1259, 1239, + /* 230 */ 1275, 1260, 1341, 1381, 1330, 1311, 1411, 1339, 1325, 1406, + /* 240 */ 1340, 1409, 1347, 1416, 1427, 1375, 1430, 1377, 1383, 1433, + /* 250 */ 1436, 1443, 1385, 1392, 1398, 1399, 1441, 1444, 1455, 1457, + /* 260 */ 1448, 1460, 1461, 1462, 1472, 1471, 1476, 1473, 1393, 1475, + /* 270 */ 1478, 1434, 1479, 1494, 1429, 1492, 1506, 1496, 1447, 1504, + /* 280 */ 1456, 1508, 1509, 1516, 1510, 1527, 1493, 1495, 1497, 1498, + /* 290 */ 1500, 1501, 1505, 1511, 1513, 1514, 1518, 1521, 1545, 1547, + /* 300 */ 1549, 1480, 1515, 1519, 1450, 1463, 1466, 1544, 1469, 1474, + /* 310 */ 1477, 1520, 1551, 1483, 1559, 1523, 1418, 1525, 1420, 1528, + /* 320 */ 1428, 1424, 1432, 1431, 1438, 1445, 1524, 1451, 1454, 1417, + /* 330 */ 1453, 1459, 1609, 1522, 1467, 1481, 1612, 1615, 1616, 1561, + /* 340 */ 1582, 1584, 1596, 1608, 1565, 1613, 1571, 1639, 1614, 1589, + /* 350 */ 1651, 1530, 1617, 1591, 1607, 1654, 1638, 1655, 1664, 1621, + /* 360 */ 1626, 1628, 1629, 1630, 1632, 1633, 1635, 1647, 1652, 1656, + /* 370 */ 1668, 1672, 1674, 1676, 1683, 1684, 1687, 1690, 1692, 1694, + /* 380 */ 1699, 1678, 1700, 1682, 1697, 1689, 1695, 1702, 1712, 1716, + /* 390 */ 1680, 1710, 1618, 1620, 1681, 1691, 1698, 1724, 1717, 1728, + /* 400 */ 1726, 1727, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 10 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 20 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 30 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 40 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 50 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 60 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 70 */ 2260, 2635, 2260, 2260, 2591, 2260, 2260, 2260, 2260, 2260, - /* 80 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2598, - /* 90 */ 2598, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 100 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 110 */ 2260, 2260, 2366, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 120 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 130 */ 2260, 2364, 2902, 2260, 3028, 2676, 2260, 2260, 2931, 2260, - /* 140 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 150 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 160 */ 2914, 2260, 2260, 2337, 2337, 2260, 2914, 2914, 2914, 2874, - /* 170 */ 2874, 2364, 2260, 2260, 2366, 2260, 2678, 2260, 2260, 2260, - /* 180 */ 2260, 2260, 2260, 2260, 2260, 2260, 2507, 2290, 2260, 2260, - /* 190 */ 2260, 2260, 2260, 2260, 2661, 2260, 2260, 2960, 2906, 2907, - /* 200 */ 3022, 2260, 2963, 2925, 2260, 2920, 2260, 2260, 2260, 2260, - /* 210 */ 2260, 2950, 2260, 2260, 2260, 2260, 2260, 2260, 2603, 2260, - /* 220 */ 2704, 2260, 2452, 2655, 2260, 2260, 2260, 2260, 2260, 3006, - /* 230 */ 2904, 2944, 2260, 2260, 2954, 2260, 2260, 2260, 2692, 2366, - /* 240 */ 2260, 2366, 2648, 2586, 2260, 2596, 2260, 2596, 2593, 2260, - /* 250 */ 2260, 2260, 2596, 2593, 2593, 2593, 2440, 2436, 2260, 2260, - /* 260 */ 2434, 2260, 2260, 2260, 2260, 2320, 2260, 2320, 2260, 2366, - /* 270 */ 2366, 2260, 2366, 2260, 2260, 2366, 2260, 2366, 2260, 2366, - /* 280 */ 2260, 2366, 2366, 2260, 2366, 2260, 2260, 2260, 2260, 2260, - /* 290 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 300 */ 2260, 2260, 2260, 2260, 2690, 2671, 2260, 2364, 2260, 2659, - /* 310 */ 2657, 2260, 2364, 2954, 2260, 2260, 2976, 2971, 2976, 2971, - /* 320 */ 2990, 2986, 2976, 2995, 2992, 2956, 2954, 2937, 2933, 3025, - /* 330 */ 3012, 3008, 2260, 2260, 2942, 2940, 2260, 2364, 2364, 2971, - /* 340 */ 2260, 2260, 2260, 2260, 2971, 2260, 2260, 2364, 2260, 2260, - /* 350 */ 2364, 2260, 2260, 2260, 2260, 2364, 2260, 2364, 2260, 2260, - /* 360 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 370 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 380 */ 2260, 2469, 2260, 2260, 2364, 2260, 2292, 2294, 2304, 2260, - /* 390 */ 2650, 3028, 2676, 2681, 2631, 2631, 2510, 2510, 3028, 2510, - /* 400 */ 2367, 2265, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 410 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2809, 2260, 2260, - /* 420 */ 2260, 2260, 2260, 2260, 2989, 2988, 2810, 2260, 2878, 2877, - /* 430 */ 2876, 2867, 2809, 2465, 2260, 2260, 2260, 2808, 2807, 2260, - /* 440 */ 2260, 2260, 2260, 2456, 2453, 2260, 2260, 2478, 2260, 2260, - /* 450 */ 2260, 2260, 2622, 2621, 2801, 2260, 2260, 2802, 2800, 2799, - /* 460 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 470 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 480 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 3009, 3013, - /* 490 */ 2260, 2260, 2260, 2260, 2903, 2260, 2260, 2260, 2260, 2780, - /* 500 */ 2260, 2260, 2260, 2260, 2260, 2748, 2743, 2734, 2725, 2740, - /* 510 */ 2731, 2719, 2737, 2728, 2716, 2713, 2260, 2260, 2260, 2260, - /* 520 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 530 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 540 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 550 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 560 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 570 */ 2260, 2260, 2592, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 580 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 590 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 600 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 610 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 620 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 630 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2607, 2260, 2260, - /* 640 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 650 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 660 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 670 */ 2260, 2309, 2787, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 680 */ 2260, 2260, 2260, 2260, 2260, 2260, 2790, 2260, 2260, 2791, - /* 690 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 700 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 710 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 720 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 730 */ 2260, 2260, 2411, 2410, 2260, 2260, 2260, 2260, 2260, 2260, - /* 740 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 750 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 760 */ 2260, 2260, 2792, 2260, 2260, 2260, 2260, 2675, 2260, 2260, - /* 770 */ 2782, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 780 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 3005, 2957, 2260, - /* 790 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 800 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 810 */ 2260, 2780, 2260, 2987, 2260, 2260, 2260, 2260, 2260, 2260, - /* 820 */ 2260, 3003, 2260, 3007, 2260, 2260, 2260, 2260, 2260, 2260, - /* 830 */ 2260, 2913, 2909, 2260, 2260, 2905, 2260, 2260, 2260, 2260, - /* 840 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 850 */ 2260, 2260, 2260, 2260, 2260, 2260, 2864, 2260, 2260, 2260, - /* 860 */ 2898, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2506, - /* 870 */ 2505, 2504, 2503, 2260, 2260, 2260, 2260, 2260, 2260, 2792, - /* 880 */ 2260, 2795, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 890 */ 2260, 2260, 2260, 2260, 2260, 2779, 2260, 2843, 2842, 2260, - /* 900 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 910 */ 2500, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 920 */ 2260, 2260, 2260, 2260, 2260, 2260, 2484, 2482, 2481, 2480, - /* 930 */ 2260, 2517, 2260, 2260, 2260, 2513, 2512, 2260, 2260, 2260, - /* 940 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 950 */ 2260, 2260, 2260, 2260, 2260, 2260, 2385, 2260, 2260, 2260, - /* 960 */ 2260, 2260, 2260, 2260, 2260, 2377, 2260, 2376, 2260, 2260, - /* 970 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 980 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 990 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2289, 2260, 2260, - /* 1000 */ 2260, 2260, 2260, 2260, 2260, 2260, + /* 0 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 10 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 20 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 30 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 40 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 50 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 60 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 70 */ 2254, 2629, 2254, 2254, 2585, 2254, 2254, 2254, 2254, 2254, + /* 80 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2592, + /* 90 */ 2592, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 100 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 110 */ 2254, 2254, 2360, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 120 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 130 */ 2254, 2358, 2896, 2254, 3022, 2670, 2254, 2254, 2925, 2254, + /* 140 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 150 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 160 */ 2908, 2254, 2254, 2331, 2331, 2254, 2908, 2908, 2908, 2868, + /* 170 */ 2868, 2358, 2254, 2254, 2360, 2254, 2672, 2254, 2254, 2254, + /* 180 */ 2254, 2254, 2254, 2254, 2254, 2254, 2501, 2284, 2254, 2254, + /* 190 */ 2254, 2254, 2254, 2254, 2655, 2254, 2254, 2954, 2900, 2901, + /* 200 */ 3016, 2254, 2957, 2919, 2254, 2914, 2254, 2254, 2254, 2254, + /* 210 */ 2254, 2944, 2254, 2254, 2254, 2254, 2254, 2254, 2597, 2254, + /* 220 */ 2698, 2254, 2446, 2649, 2254, 2254, 2254, 2254, 2254, 3000, + /* 230 */ 2898, 2938, 2254, 2254, 2948, 2254, 2254, 2254, 2686, 2360, + /* 240 */ 2254, 2360, 2642, 2580, 2254, 2590, 2254, 2590, 2587, 2254, + /* 250 */ 2254, 2254, 2590, 2587, 2587, 2587, 2434, 2430, 2254, 2254, + /* 260 */ 2428, 2254, 2254, 2254, 2254, 2314, 2254, 2314, 2254, 2360, + /* 270 */ 2360, 2254, 2360, 2254, 2254, 2360, 2254, 2360, 2254, 2360, + /* 280 */ 2254, 2360, 2360, 2254, 2360, 2254, 2254, 2254, 2254, 2254, + /* 290 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 300 */ 2254, 2254, 2254, 2254, 2684, 2665, 2254, 2358, 2254, 2653, + /* 310 */ 2651, 2254, 2358, 2948, 2254, 2254, 2970, 2965, 2970, 2965, + /* 320 */ 2984, 2980, 2970, 2989, 2986, 2950, 2948, 2931, 2927, 3019, + /* 330 */ 3006, 3002, 2254, 2254, 2936, 2934, 2254, 2358, 2358, 2965, + /* 340 */ 2254, 2254, 2254, 2254, 2965, 2254, 2254, 2358, 2254, 2254, + /* 350 */ 2358, 2254, 2254, 2254, 2254, 2358, 2254, 2358, 2254, 2254, + /* 360 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 370 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 380 */ 2254, 2463, 2254, 2254, 2358, 2254, 2286, 2288, 2298, 2254, + /* 390 */ 2644, 3022, 2670, 2675, 2625, 2625, 2504, 2504, 3022, 2504, + /* 400 */ 2361, 2259, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 410 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2803, 2254, 2254, + /* 420 */ 2254, 2254, 2254, 2254, 2983, 2982, 2804, 2254, 2872, 2871, + /* 430 */ 2870, 2861, 2803, 2459, 2254, 2254, 2254, 2802, 2801, 2254, + /* 440 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2616, + /* 450 */ 2615, 2795, 2254, 2254, 2796, 2794, 2793, 2254, 2254, 2254, + /* 460 */ 2254, 2254, 2254, 2254, 2254, 2254, 2450, 2254, 2254, 2447, + /* 470 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 480 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 3003, 3007, 2254, + /* 490 */ 2254, 2254, 2254, 2897, 2254, 2254, 2254, 2254, 2774, 2254, + /* 500 */ 2254, 2254, 2254, 2254, 2742, 2737, 2728, 2719, 2734, 2725, + /* 510 */ 2713, 2731, 2722, 2710, 2707, 2254, 2472, 2254, 2254, 2254, + /* 520 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 530 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 540 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 550 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 560 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 570 */ 2254, 2254, 2586, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 580 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 590 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 600 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 610 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 620 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 630 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2601, 2254, 2254, + /* 640 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 650 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 660 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 670 */ 2254, 2303, 2781, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 680 */ 2254, 2254, 2254, 2254, 2254, 2254, 2784, 2254, 2254, 2785, + /* 690 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 700 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 710 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 720 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 730 */ 2254, 2254, 2405, 2404, 2254, 2254, 2254, 2254, 2254, 2254, + /* 740 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 750 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 760 */ 2254, 2254, 2786, 2254, 2254, 2254, 2254, 2669, 2254, 2254, + /* 770 */ 2776, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 780 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2999, 2951, 2254, + /* 790 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 800 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 810 */ 2254, 2774, 2254, 2981, 2254, 2254, 2254, 2254, 2254, 2254, + /* 820 */ 2254, 2997, 2254, 3001, 2254, 2254, 2254, 2254, 2254, 2254, + /* 830 */ 2254, 2907, 2903, 2254, 2254, 2899, 2254, 2254, 2254, 2254, + /* 840 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 850 */ 2254, 2254, 2254, 2254, 2254, 2254, 2858, 2254, 2254, 2254, + /* 860 */ 2892, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2500, + /* 870 */ 2499, 2498, 2497, 2254, 2254, 2254, 2254, 2254, 2254, 2786, + /* 880 */ 2254, 2789, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 890 */ 2254, 2254, 2254, 2254, 2254, 2773, 2254, 2837, 2836, 2254, + /* 900 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2494, 2254, + /* 910 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 920 */ 2254, 2254, 2254, 2254, 2478, 2476, 2475, 2474, 2254, 2511, + /* 930 */ 2254, 2254, 2254, 2507, 2506, 2254, 2254, 2254, 2254, 2254, + /* 940 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 950 */ 2254, 2254, 2254, 2254, 2379, 2254, 2254, 2254, 2254, 2254, + /* 960 */ 2254, 2254, 2254, 2371, 2254, 2370, 2254, 2254, 2254, 2254, + /* 970 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 980 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, + /* 990 */ 2254, 2254, 2254, 2254, 2254, 2283, 2254, 2254, 2254, 2254, + /* 1000 */ 2254, 2254, 2254, 2254, }; /********** End of lemon-generated parsing tables *****************************/ @@ -2123,9 +2149,6 @@ static const YYCODETYPE yyFallback[] = { 336, /* VALUES => ABORT */ 336, /* VARIABLE => ABORT */ 336, /* WAL => ABORT */ - 0, /* ENCODE => nothing */ - 0, /* COMPRESS => nothing */ - 0, /* LEVEL => nothing */ }; #endif /* YYFALLBACK */ @@ -2591,191 +2614,188 @@ static const char *const yyTokenName[] = { /* 379 */ "VALUES", /* 380 */ "VARIABLE", /* 381 */ "WAL", - /* 382 */ "ENCODE", - /* 383 */ "COMPRESS", - /* 384 */ "LEVEL", - /* 385 */ "cmd", - /* 386 */ "account_options", - /* 387 */ "alter_account_options", - /* 388 */ "literal", - /* 389 */ "alter_account_option", - /* 390 */ "ip_range_list", - /* 391 */ "white_list", - /* 392 */ "white_list_opt", - /* 393 */ "is_import_opt", - /* 394 */ "is_createdb_opt", - /* 395 */ "user_name", - /* 396 */ "sysinfo_opt", - /* 397 */ "privileges", - /* 398 */ "priv_level", - /* 399 */ "with_opt", - /* 400 */ "priv_type_list", - /* 401 */ "priv_type", - /* 402 */ "db_name", - /* 403 */ "table_name", - /* 404 */ "topic_name", - /* 405 */ "search_condition", - /* 406 */ "dnode_endpoint", - /* 407 */ "force_opt", - /* 408 */ "unsafe_opt", - /* 409 */ "not_exists_opt", - /* 410 */ "db_options", - /* 411 */ "exists_opt", - /* 412 */ "alter_db_options", - /* 413 */ "speed_opt", - /* 414 */ "start_opt", - /* 415 */ "end_opt", - /* 416 */ "integer_list", - /* 417 */ "variable_list", - /* 418 */ "retention_list", - /* 419 */ "signed", - /* 420 */ "alter_db_option", - /* 421 */ "retention", - /* 422 */ "full_table_name", - /* 423 */ "column_def_list", - /* 424 */ "tags_def_opt", - /* 425 */ "table_options", - /* 426 */ "multi_create_clause", - /* 427 */ "tag_list_opt", - /* 428 */ "tags_def", - /* 429 */ "multi_drop_clause", - /* 430 */ "alter_table_clause", - /* 431 */ "alter_table_options", - /* 432 */ "column_name", - /* 433 */ "type_name", - /* 434 */ "column_options", - /* 435 */ "tags_literal", - /* 436 */ "create_subtable_clause", - /* 437 */ "specific_cols_opt", - /* 438 */ "tags_literal_list", - /* 439 */ "drop_table_clause", - /* 440 */ "col_name_list", - /* 441 */ "tag_def_list", - /* 442 */ "tag_def", - /* 443 */ "column_def", - /* 444 */ "type_name_default_len", - /* 445 */ "duration_list", - /* 446 */ "rollup_func_list", - /* 447 */ "alter_table_option", - /* 448 */ "duration_literal", - /* 449 */ "rollup_func_name", - /* 450 */ "function_name", - /* 451 */ "col_name", - /* 452 */ "db_kind_opt", - /* 453 */ "table_kind_db_name_cond_opt", - /* 454 */ "like_pattern_opt", - /* 455 */ "db_name_cond_opt", - /* 456 */ "table_name_cond", - /* 457 */ "from_db_opt", - /* 458 */ "table_kind", - /* 459 */ "tag_item", - /* 460 */ "column_alias", - /* 461 */ "tsma_name", - /* 462 */ "tsma_func_list", - /* 463 */ "full_tsma_name", - /* 464 */ "func_list", - /* 465 */ "index_options", - /* 466 */ "full_index_name", - /* 467 */ "index_name", - /* 468 */ "sliding_opt", - /* 469 */ "sma_stream_opt", - /* 470 */ "func", - /* 471 */ "sma_func_name", - /* 472 */ "expression_list", - /* 473 */ "with_meta", - /* 474 */ "query_or_subquery", - /* 475 */ "where_clause_opt", - /* 476 */ "cgroup_name", - /* 477 */ "analyze_opt", - /* 478 */ "explain_options", - /* 479 */ "insert_query", - /* 480 */ "or_replace_opt", - /* 481 */ "agg_func_opt", - /* 482 */ "bufsize_opt", - /* 483 */ "language_opt", - /* 484 */ "full_view_name", - /* 485 */ "view_name", - /* 486 */ "stream_name", - /* 487 */ "stream_options", - /* 488 */ "col_list_opt", - /* 489 */ "tag_def_or_ref_opt", - /* 490 */ "subtable_opt", - /* 491 */ "ignore_opt", - /* 492 */ "column_stream_def_list", - /* 493 */ "column_stream_def", - /* 494 */ "stream_col_options", - /* 495 */ "expression", - /* 496 */ "on_vgroup_id", - /* 497 */ "dnode_list", - /* 498 */ "literal_func", - /* 499 */ "signed_literal", - /* 500 */ "literal_list", - /* 501 */ "table_alias", - /* 502 */ "expr_or_subquery", - /* 503 */ "pseudo_column", - /* 504 */ "column_reference", - /* 505 */ "function_expression", - /* 506 */ "case_when_expression", - /* 507 */ "star_func", - /* 508 */ "star_func_para_list", - /* 509 */ "trim_specification_type", - /* 510 */ "substr_func", - /* 511 */ "noarg_func", - /* 512 */ "other_para_list", - /* 513 */ "star_func_para", - /* 514 */ "when_then_list", - /* 515 */ "case_when_else_opt", - /* 516 */ "common_expression", - /* 517 */ "when_then_expr", - /* 518 */ "predicate", - /* 519 */ "compare_op", - /* 520 */ "in_op", - /* 521 */ "in_predicate_value", - /* 522 */ "boolean_value_expression", - /* 523 */ "boolean_primary", - /* 524 */ "from_clause_opt", - /* 525 */ "table_reference_list", - /* 526 */ "table_reference", - /* 527 */ "table_primary", - /* 528 */ "joined_table", - /* 529 */ "alias_opt", - /* 530 */ "subquery", - /* 531 */ "parenthesized_joined_table", - /* 532 */ "join_type", - /* 533 */ "join_subtype", - /* 534 */ "join_on_clause_opt", - /* 535 */ "window_offset_clause_opt", - /* 536 */ "jlimit_clause_opt", - /* 537 */ "window_offset_literal", - /* 538 */ "query_specification", - /* 539 */ "hint_list", - /* 540 */ "set_quantifier_opt", - /* 541 */ "tag_mode_opt", - /* 542 */ "select_list", - /* 543 */ "partition_by_clause_opt", - /* 544 */ "range_opt", - /* 545 */ "every_opt", - /* 546 */ "fill_opt", - /* 547 */ "twindow_clause_opt", - /* 548 */ "group_by_clause_opt", - /* 549 */ "having_clause_opt", - /* 550 */ "select_item", - /* 551 */ "partition_list", - /* 552 */ "partition_item", - /* 553 */ "interval_sliding_duration_literal", - /* 554 */ "fill_mode", - /* 555 */ "group_by_list", - /* 556 */ "query_expression", - /* 557 */ "query_simple", - /* 558 */ "order_by_clause_opt", - /* 559 */ "slimit_clause_opt", - /* 560 */ "limit_clause_opt", - /* 561 */ "union_query_expression", - /* 562 */ "query_simple_or_subquery", - /* 563 */ "sort_specification_list", - /* 564 */ "sort_specification", - /* 565 */ "ordering_specification_opt", - /* 566 */ "null_ordering_opt", + /* 382 */ "cmd", + /* 383 */ "account_options", + /* 384 */ "alter_account_options", + /* 385 */ "literal", + /* 386 */ "alter_account_option", + /* 387 */ "ip_range_list", + /* 388 */ "white_list", + /* 389 */ "white_list_opt", + /* 390 */ "is_import_opt", + /* 391 */ "is_createdb_opt", + /* 392 */ "user_name", + /* 393 */ "sysinfo_opt", + /* 394 */ "privileges", + /* 395 */ "priv_level", + /* 396 */ "with_opt", + /* 397 */ "priv_type_list", + /* 398 */ "priv_type", + /* 399 */ "db_name", + /* 400 */ "table_name", + /* 401 */ "topic_name", + /* 402 */ "search_condition", + /* 403 */ "dnode_endpoint", + /* 404 */ "force_opt", + /* 405 */ "unsafe_opt", + /* 406 */ "not_exists_opt", + /* 407 */ "db_options", + /* 408 */ "exists_opt", + /* 409 */ "alter_db_options", + /* 410 */ "speed_opt", + /* 411 */ "start_opt", + /* 412 */ "end_opt", + /* 413 */ "integer_list", + /* 414 */ "variable_list", + /* 415 */ "retention_list", + /* 416 */ "signed", + /* 417 */ "alter_db_option", + /* 418 */ "retention", + /* 419 */ "full_table_name", + /* 420 */ "column_def_list", + /* 421 */ "tags_def_opt", + /* 422 */ "table_options", + /* 423 */ "multi_create_clause", + /* 424 */ "tag_list_opt", + /* 425 */ "tags_def", + /* 426 */ "multi_drop_clause", + /* 427 */ "alter_table_clause", + /* 428 */ "alter_table_options", + /* 429 */ "column_name", + /* 430 */ "type_name", + /* 431 */ "column_options", + /* 432 */ "tags_literal", + /* 433 */ "create_subtable_clause", + /* 434 */ "specific_cols_opt", + /* 435 */ "tags_literal_list", + /* 436 */ "drop_table_clause", + /* 437 */ "col_name_list", + /* 438 */ "tag_def_list", + /* 439 */ "tag_def", + /* 440 */ "column_def", + /* 441 */ "type_name_default_len", + /* 442 */ "duration_list", + /* 443 */ "rollup_func_list", + /* 444 */ "alter_table_option", + /* 445 */ "duration_literal", + /* 446 */ "rollup_func_name", + /* 447 */ "function_name", + /* 448 */ "col_name", + /* 449 */ "db_kind_opt", + /* 450 */ "table_kind_db_name_cond_opt", + /* 451 */ "like_pattern_opt", + /* 452 */ "db_name_cond_opt", + /* 453 */ "table_name_cond", + /* 454 */ "from_db_opt", + /* 455 */ "table_kind", + /* 456 */ "tag_item", + /* 457 */ "column_alias", + /* 458 */ "tsma_name", + /* 459 */ "tsma_func_list", + /* 460 */ "full_tsma_name", + /* 461 */ "func_list", + /* 462 */ "index_options", + /* 463 */ "full_index_name", + /* 464 */ "index_name", + /* 465 */ "sliding_opt", + /* 466 */ "sma_stream_opt", + /* 467 */ "func", + /* 468 */ "sma_func_name", + /* 469 */ "expression_list", + /* 470 */ "with_meta", + /* 471 */ "query_or_subquery", + /* 472 */ "where_clause_opt", + /* 473 */ "cgroup_name", + /* 474 */ "analyze_opt", + /* 475 */ "explain_options", + /* 476 */ "insert_query", + /* 477 */ "or_replace_opt", + /* 478 */ "agg_func_opt", + /* 479 */ "bufsize_opt", + /* 480 */ "language_opt", + /* 481 */ "full_view_name", + /* 482 */ "view_name", + /* 483 */ "stream_name", + /* 484 */ "stream_options", + /* 485 */ "col_list_opt", + /* 486 */ "tag_def_or_ref_opt", + /* 487 */ "subtable_opt", + /* 488 */ "ignore_opt", + /* 489 */ "column_stream_def_list", + /* 490 */ "column_stream_def", + /* 491 */ "stream_col_options", + /* 492 */ "expression", + /* 493 */ "on_vgroup_id", + /* 494 */ "dnode_list", + /* 495 */ "literal_func", + /* 496 */ "signed_literal", + /* 497 */ "literal_list", + /* 498 */ "table_alias", + /* 499 */ "expr_or_subquery", + /* 500 */ "pseudo_column", + /* 501 */ "column_reference", + /* 502 */ "function_expression", + /* 503 */ "case_when_expression", + /* 504 */ "star_func", + /* 505 */ "star_func_para_list", + /* 506 */ "trim_specification_type", + /* 507 */ "substr_func", + /* 508 */ "noarg_func", + /* 509 */ "other_para_list", + /* 510 */ "star_func_para", + /* 511 */ "when_then_list", + /* 512 */ "case_when_else_opt", + /* 513 */ "common_expression", + /* 514 */ "when_then_expr", + /* 515 */ "predicate", + /* 516 */ "compare_op", + /* 517 */ "in_op", + /* 518 */ "in_predicate_value", + /* 519 */ "boolean_value_expression", + /* 520 */ "boolean_primary", + /* 521 */ "from_clause_opt", + /* 522 */ "table_reference_list", + /* 523 */ "table_reference", + /* 524 */ "table_primary", + /* 525 */ "joined_table", + /* 526 */ "alias_opt", + /* 527 */ "subquery", + /* 528 */ "parenthesized_joined_table", + /* 529 */ "join_type", + /* 530 */ "join_subtype", + /* 531 */ "join_on_clause_opt", + /* 532 */ "window_offset_clause_opt", + /* 533 */ "jlimit_clause_opt", + /* 534 */ "window_offset_literal", + /* 535 */ "query_specification", + /* 536 */ "hint_list", + /* 537 */ "set_quantifier_opt", + /* 538 */ "tag_mode_opt", + /* 539 */ "select_list", + /* 540 */ "partition_by_clause_opt", + /* 541 */ "range_opt", + /* 542 */ "every_opt", + /* 543 */ "fill_opt", + /* 544 */ "twindow_clause_opt", + /* 545 */ "group_by_clause_opt", + /* 546 */ "having_clause_opt", + /* 547 */ "select_item", + /* 548 */ "partition_list", + /* 549 */ "partition_item", + /* 550 */ "interval_sliding_duration_literal", + /* 551 */ "fill_mode", + /* 552 */ "group_by_list", + /* 553 */ "query_expression", + /* 554 */ "query_simple", + /* 555 */ "order_by_clause_opt", + /* 556 */ "slimit_clause_opt", + /* 557 */ "limit_clause_opt", + /* 558 */ "union_query_expression", + /* 559 */ "query_simple_or_subquery", + /* 560 */ "sort_specification_list", + /* 561 */ "sort_specification", + /* 562 */ "ordering_specification_opt", + /* 563 */ "null_ordering_opt", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -3550,9 +3570,7 @@ static const char *const yyRuleName[] = { /* 764 */ "null_ordering_opt ::= NULLS LAST", /* 765 */ "column_options ::=", /* 766 */ "column_options ::= column_options PRIMARY KEY", - /* 767 */ "column_options ::= column_options ENCODE NK_STRING", - /* 768 */ "column_options ::= column_options COMPRESS NK_STRING", - /* 769 */ "column_options ::= column_options LEVEL NK_STRING", + /* 767 */ "column_options ::= column_options NK_ID NK_STRING", }; #endif /* NDEBUG */ @@ -3677,264 +3695,264 @@ static void yy_destructor( */ /********* Begin destructor definitions ***************************************/ /* Default NON-TERMINAL Destructor */ - case 385: /* cmd */ - case 388: /* literal */ - case 399: /* with_opt */ - case 405: /* search_condition */ - case 410: /* db_options */ - case 412: /* alter_db_options */ - case 414: /* start_opt */ - case 415: /* end_opt */ - case 419: /* signed */ - case 421: /* retention */ - case 422: /* full_table_name */ - case 425: /* table_options */ - case 430: /* alter_table_clause */ - case 431: /* alter_table_options */ - case 434: /* column_options */ - case 435: /* tags_literal */ - case 436: /* create_subtable_clause */ - case 439: /* drop_table_clause */ - case 442: /* tag_def */ - case 443: /* column_def */ - case 448: /* duration_literal */ - case 449: /* rollup_func_name */ - case 451: /* col_name */ - case 454: /* like_pattern_opt */ - case 455: /* db_name_cond_opt */ - case 456: /* table_name_cond */ - case 457: /* from_db_opt */ - case 459: /* tag_item */ - case 463: /* full_tsma_name */ - case 465: /* index_options */ - case 466: /* full_index_name */ - case 468: /* sliding_opt */ - case 469: /* sma_stream_opt */ - case 470: /* func */ - case 474: /* query_or_subquery */ - case 475: /* where_clause_opt */ - case 478: /* explain_options */ - case 479: /* insert_query */ - case 484: /* full_view_name */ - case 487: /* stream_options */ - case 490: /* subtable_opt */ - case 493: /* column_stream_def */ - case 494: /* stream_col_options */ - case 495: /* expression */ - case 498: /* literal_func */ - case 499: /* signed_literal */ - case 502: /* expr_or_subquery */ - case 503: /* pseudo_column */ - case 504: /* column_reference */ - case 505: /* function_expression */ - case 506: /* case_when_expression */ - case 513: /* star_func_para */ - case 515: /* case_when_else_opt */ - case 516: /* common_expression */ - case 517: /* when_then_expr */ - case 518: /* predicate */ - case 521: /* in_predicate_value */ - case 522: /* boolean_value_expression */ - case 523: /* boolean_primary */ - case 524: /* from_clause_opt */ - case 525: /* table_reference_list */ - case 526: /* table_reference */ - case 527: /* table_primary */ - case 528: /* joined_table */ - case 530: /* subquery */ - case 531: /* parenthesized_joined_table */ - case 534: /* join_on_clause_opt */ - case 535: /* window_offset_clause_opt */ - case 536: /* jlimit_clause_opt */ - case 537: /* window_offset_literal */ - case 538: /* query_specification */ - case 544: /* range_opt */ - case 545: /* every_opt */ - case 546: /* fill_opt */ - case 547: /* twindow_clause_opt */ - case 549: /* having_clause_opt */ - case 550: /* select_item */ - case 552: /* partition_item */ - case 553: /* interval_sliding_duration_literal */ - case 556: /* query_expression */ - case 557: /* query_simple */ - case 559: /* slimit_clause_opt */ - case 560: /* limit_clause_opt */ - case 561: /* union_query_expression */ - case 562: /* query_simple_or_subquery */ - case 564: /* sort_specification */ + case 382: /* cmd */ + case 385: /* literal */ + case 396: /* with_opt */ + case 402: /* search_condition */ + case 407: /* db_options */ + case 409: /* alter_db_options */ + case 411: /* start_opt */ + case 412: /* end_opt */ + case 416: /* signed */ + case 418: /* retention */ + case 419: /* full_table_name */ + case 422: /* table_options */ + case 427: /* alter_table_clause */ + case 428: /* alter_table_options */ + case 431: /* column_options */ + case 432: /* tags_literal */ + case 433: /* create_subtable_clause */ + case 436: /* drop_table_clause */ + case 439: /* tag_def */ + case 440: /* column_def */ + case 445: /* duration_literal */ + case 446: /* rollup_func_name */ + case 448: /* col_name */ + case 451: /* like_pattern_opt */ + case 452: /* db_name_cond_opt */ + case 453: /* table_name_cond */ + case 454: /* from_db_opt */ + case 456: /* tag_item */ + case 460: /* full_tsma_name */ + case 462: /* index_options */ + case 463: /* full_index_name */ + case 465: /* sliding_opt */ + case 466: /* sma_stream_opt */ + case 467: /* func */ + case 471: /* query_or_subquery */ + case 472: /* where_clause_opt */ + case 475: /* explain_options */ + case 476: /* insert_query */ + case 481: /* full_view_name */ + case 484: /* stream_options */ + case 487: /* subtable_opt */ + case 490: /* column_stream_def */ + case 491: /* stream_col_options */ + case 492: /* expression */ + case 495: /* literal_func */ + case 496: /* signed_literal */ + case 499: /* expr_or_subquery */ + case 500: /* pseudo_column */ + case 501: /* column_reference */ + case 502: /* function_expression */ + case 503: /* case_when_expression */ + case 510: /* star_func_para */ + case 512: /* case_when_else_opt */ + case 513: /* common_expression */ + case 514: /* when_then_expr */ + case 515: /* predicate */ + case 518: /* in_predicate_value */ + case 519: /* boolean_value_expression */ + case 520: /* boolean_primary */ + case 521: /* from_clause_opt */ + case 522: /* table_reference_list */ + case 523: /* table_reference */ + case 524: /* table_primary */ + case 525: /* joined_table */ + case 527: /* subquery */ + case 528: /* parenthesized_joined_table */ + case 531: /* join_on_clause_opt */ + case 532: /* window_offset_clause_opt */ + case 533: /* jlimit_clause_opt */ + case 534: /* window_offset_literal */ + case 535: /* query_specification */ + case 541: /* range_opt */ + case 542: /* every_opt */ + case 543: /* fill_opt */ + case 544: /* twindow_clause_opt */ + case 546: /* having_clause_opt */ + case 547: /* select_item */ + case 549: /* partition_item */ + case 550: /* interval_sliding_duration_literal */ + case 553: /* query_expression */ + case 554: /* query_simple */ + case 556: /* slimit_clause_opt */ + case 557: /* limit_clause_opt */ + case 558: /* union_query_expression */ + case 559: /* query_simple_or_subquery */ + case 561: /* sort_specification */ { - nodesDestroyNode((yypminor->yy560)); + nodesDestroyNode((yypminor->yy248)); } break; - case 386: /* account_options */ - case 387: /* alter_account_options */ - case 389: /* alter_account_option */ - case 413: /* speed_opt */ - case 473: /* with_meta */ - case 482: /* bufsize_opt */ + case 383: /* account_options */ + case 384: /* alter_account_options */ + case 386: /* alter_account_option */ + case 410: /* speed_opt */ + case 470: /* with_meta */ + case 479: /* bufsize_opt */ { } break; - case 390: /* ip_range_list */ - case 391: /* white_list */ - case 392: /* white_list_opt */ - case 416: /* integer_list */ - case 417: /* variable_list */ - case 418: /* retention_list */ - case 423: /* column_def_list */ - case 424: /* tags_def_opt */ - case 426: /* multi_create_clause */ - case 427: /* tag_list_opt */ - case 428: /* tags_def */ - case 429: /* multi_drop_clause */ - case 437: /* specific_cols_opt */ - case 438: /* tags_literal_list */ - case 440: /* col_name_list */ - case 441: /* tag_def_list */ - case 445: /* duration_list */ - case 446: /* rollup_func_list */ - case 464: /* func_list */ - case 472: /* expression_list */ - case 488: /* col_list_opt */ - case 489: /* tag_def_or_ref_opt */ - case 492: /* column_stream_def_list */ - case 497: /* dnode_list */ - case 500: /* literal_list */ - case 508: /* star_func_para_list */ - case 512: /* other_para_list */ - case 514: /* when_then_list */ - case 539: /* hint_list */ - case 542: /* select_list */ - case 543: /* partition_by_clause_opt */ - case 548: /* group_by_clause_opt */ - case 551: /* partition_list */ - case 555: /* group_by_list */ - case 558: /* order_by_clause_opt */ - case 563: /* sort_specification_list */ + case 387: /* ip_range_list */ + case 388: /* white_list */ + case 389: /* white_list_opt */ + case 413: /* integer_list */ + case 414: /* variable_list */ + case 415: /* retention_list */ + case 420: /* column_def_list */ + case 421: /* tags_def_opt */ + case 423: /* multi_create_clause */ + case 424: /* tag_list_opt */ + case 425: /* tags_def */ + case 426: /* multi_drop_clause */ + case 434: /* specific_cols_opt */ + case 435: /* tags_literal_list */ + case 437: /* col_name_list */ + case 438: /* tag_def_list */ + case 442: /* duration_list */ + case 443: /* rollup_func_list */ + case 461: /* func_list */ + case 469: /* expression_list */ + case 485: /* col_list_opt */ + case 486: /* tag_def_or_ref_opt */ + case 489: /* column_stream_def_list */ + case 494: /* dnode_list */ + case 497: /* literal_list */ + case 505: /* star_func_para_list */ + case 509: /* other_para_list */ + case 511: /* when_then_list */ + case 536: /* hint_list */ + case 539: /* select_list */ + case 540: /* partition_by_clause_opt */ + case 545: /* group_by_clause_opt */ + case 548: /* partition_list */ + case 552: /* group_by_list */ + case 555: /* order_by_clause_opt */ + case 560: /* sort_specification_list */ { - nodesDestroyList((yypminor->yy334)); + nodesDestroyList((yypminor->yy928)); } break; - case 393: /* is_import_opt */ - case 394: /* is_createdb_opt */ - case 396: /* sysinfo_opt */ + case 390: /* is_import_opt */ + case 391: /* is_createdb_opt */ + case 393: /* sysinfo_opt */ { } break; - case 395: /* user_name */ - case 402: /* db_name */ - case 403: /* table_name */ - case 404: /* topic_name */ - case 406: /* dnode_endpoint */ - case 432: /* column_name */ - case 450: /* function_name */ - case 460: /* column_alias */ - case 461: /* tsma_name */ - case 467: /* index_name */ - case 471: /* sma_func_name */ - case 476: /* cgroup_name */ - case 483: /* language_opt */ - case 485: /* view_name */ - case 486: /* stream_name */ - case 496: /* on_vgroup_id */ - case 501: /* table_alias */ - case 507: /* star_func */ - case 510: /* substr_func */ - case 511: /* noarg_func */ - case 529: /* alias_opt */ + case 392: /* user_name */ + case 399: /* db_name */ + case 400: /* table_name */ + case 401: /* topic_name */ + case 403: /* dnode_endpoint */ + case 429: /* column_name */ + case 447: /* function_name */ + case 457: /* column_alias */ + case 458: /* tsma_name */ + case 464: /* index_name */ + case 468: /* sma_func_name */ + case 473: /* cgroup_name */ + case 480: /* language_opt */ + case 482: /* view_name */ + case 483: /* stream_name */ + case 493: /* on_vgroup_id */ + case 498: /* table_alias */ + case 504: /* star_func */ + case 507: /* substr_func */ + case 508: /* noarg_func */ + case 526: /* alias_opt */ { } break; - case 397: /* privileges */ - case 400: /* priv_type_list */ - case 401: /* priv_type */ + case 394: /* privileges */ + case 397: /* priv_type_list */ + case 398: /* priv_type */ { } break; - case 398: /* priv_level */ + case 395: /* priv_level */ { } break; - case 407: /* force_opt */ - case 408: /* unsafe_opt */ - case 409: /* not_exists_opt */ - case 411: /* exists_opt */ - case 477: /* analyze_opt */ - case 480: /* or_replace_opt */ - case 481: /* agg_func_opt */ - case 491: /* ignore_opt */ - case 540: /* set_quantifier_opt */ - case 541: /* tag_mode_opt */ + case 404: /* force_opt */ + case 405: /* unsafe_opt */ + case 406: /* not_exists_opt */ + case 408: /* exists_opt */ + case 474: /* analyze_opt */ + case 477: /* or_replace_opt */ + case 478: /* agg_func_opt */ + case 488: /* ignore_opt */ + case 537: /* set_quantifier_opt */ + case 538: /* tag_mode_opt */ { } break; - case 420: /* alter_db_option */ - case 447: /* alter_table_option */ + case 417: /* alter_db_option */ + case 444: /* alter_table_option */ { } break; - case 433: /* type_name */ - case 444: /* type_name_default_len */ + case 430: /* type_name */ + case 441: /* type_name_default_len */ { } break; - case 452: /* db_kind_opt */ - case 458: /* table_kind */ + case 449: /* db_kind_opt */ + case 455: /* table_kind */ { } break; - case 453: /* table_kind_db_name_cond_opt */ + case 450: /* table_kind_db_name_cond_opt */ { } break; - case 462: /* tsma_func_list */ + case 459: /* tsma_func_list */ { - nodesDestroyNode((yypminor->yy560)); + nodesDestroyNode((yypminor->yy248)); } break; - case 509: /* trim_specification_type */ + case 506: /* trim_specification_type */ { } break; - case 519: /* compare_op */ - case 520: /* in_op */ + case 516: /* compare_op */ + case 517: /* in_op */ { } break; - case 532: /* join_type */ + case 529: /* join_type */ { } break; - case 533: /* join_subtype */ + case 530: /* join_subtype */ { } break; - case 554: /* fill_mode */ + case 551: /* fill_mode */ { } break; - case 565: /* ordering_specification_opt */ + case 562: /* ordering_specification_opt */ { } break; - case 566: /* null_ordering_opt */ + case 563: /* null_ordering_opt */ { } @@ -4236,776 +4254,774 @@ static void yy_shift( /* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side ** of that rule */ static const YYCODETYPE yyRuleInfoLhs[] = { - 385, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ - 385, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ - 386, /* (2) account_options ::= */ - 386, /* (3) account_options ::= account_options PPS literal */ - 386, /* (4) account_options ::= account_options TSERIES literal */ - 386, /* (5) account_options ::= account_options STORAGE literal */ - 386, /* (6) account_options ::= account_options STREAMS literal */ - 386, /* (7) account_options ::= account_options QTIME literal */ - 386, /* (8) account_options ::= account_options DBS literal */ - 386, /* (9) account_options ::= account_options USERS literal */ - 386, /* (10) account_options ::= account_options CONNS literal */ - 386, /* (11) account_options ::= account_options STATE literal */ - 387, /* (12) alter_account_options ::= alter_account_option */ - 387, /* (13) alter_account_options ::= alter_account_options alter_account_option */ - 389, /* (14) alter_account_option ::= PASS literal */ - 389, /* (15) alter_account_option ::= PPS literal */ - 389, /* (16) alter_account_option ::= TSERIES literal */ - 389, /* (17) alter_account_option ::= STORAGE literal */ - 389, /* (18) alter_account_option ::= STREAMS literal */ - 389, /* (19) alter_account_option ::= QTIME literal */ - 389, /* (20) alter_account_option ::= DBS literal */ - 389, /* (21) alter_account_option ::= USERS literal */ - 389, /* (22) alter_account_option ::= CONNS literal */ - 389, /* (23) alter_account_option ::= STATE literal */ - 390, /* (24) ip_range_list ::= NK_STRING */ - 390, /* (25) ip_range_list ::= ip_range_list NK_COMMA NK_STRING */ - 391, /* (26) white_list ::= HOST ip_range_list */ - 392, /* (27) white_list_opt ::= */ - 392, /* (28) white_list_opt ::= white_list */ - 393, /* (29) is_import_opt ::= */ - 393, /* (30) is_import_opt ::= IS_IMPORT NK_INTEGER */ - 394, /* (31) is_createdb_opt ::= */ - 394, /* (32) is_createdb_opt ::= CREATEDB NK_INTEGER */ - 385, /* (33) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt is_createdb_opt is_import_opt white_list_opt */ - 385, /* (34) cmd ::= ALTER USER user_name PASS NK_STRING */ - 385, /* (35) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ - 385, /* (36) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ - 385, /* (37) cmd ::= ALTER USER user_name CREATEDB NK_INTEGER */ - 385, /* (38) cmd ::= ALTER USER user_name ADD white_list */ - 385, /* (39) cmd ::= ALTER USER user_name DROP white_list */ - 385, /* (40) cmd ::= DROP USER user_name */ - 396, /* (41) sysinfo_opt ::= */ - 396, /* (42) sysinfo_opt ::= SYSINFO NK_INTEGER */ - 385, /* (43) cmd ::= GRANT privileges ON priv_level with_opt TO user_name */ - 385, /* (44) cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */ - 397, /* (45) privileges ::= ALL */ - 397, /* (46) privileges ::= priv_type_list */ - 397, /* (47) privileges ::= SUBSCRIBE */ - 400, /* (48) priv_type_list ::= priv_type */ - 400, /* (49) priv_type_list ::= priv_type_list NK_COMMA priv_type */ - 401, /* (50) priv_type ::= READ */ - 401, /* (51) priv_type ::= WRITE */ - 401, /* (52) priv_type ::= ALTER */ - 398, /* (53) priv_level ::= NK_STAR NK_DOT NK_STAR */ - 398, /* (54) priv_level ::= db_name NK_DOT NK_STAR */ - 398, /* (55) priv_level ::= db_name NK_DOT table_name */ - 398, /* (56) priv_level ::= topic_name */ - 399, /* (57) with_opt ::= */ - 399, /* (58) with_opt ::= WITH search_condition */ - 385, /* (59) cmd ::= CREATE ENCRYPT_KEY NK_STRING */ - 385, /* (60) cmd ::= CREATE DNODE dnode_endpoint */ - 385, /* (61) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ - 385, /* (62) cmd ::= DROP DNODE NK_INTEGER force_opt */ - 385, /* (63) cmd ::= DROP DNODE dnode_endpoint force_opt */ - 385, /* (64) cmd ::= DROP DNODE NK_INTEGER unsafe_opt */ - 385, /* (65) cmd ::= DROP DNODE dnode_endpoint unsafe_opt */ - 385, /* (66) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ - 385, /* (67) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ - 385, /* (68) cmd ::= ALTER ALL DNODES NK_STRING */ - 385, /* (69) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ - 385, /* (70) cmd ::= RESTORE DNODE NK_INTEGER */ - 406, /* (71) dnode_endpoint ::= NK_STRING */ - 406, /* (72) dnode_endpoint ::= NK_ID */ - 406, /* (73) dnode_endpoint ::= NK_IPTOKEN */ - 407, /* (74) force_opt ::= */ - 407, /* (75) force_opt ::= FORCE */ - 408, /* (76) unsafe_opt ::= UNSAFE */ - 385, /* (77) cmd ::= ALTER CLUSTER NK_STRING */ - 385, /* (78) cmd ::= ALTER CLUSTER NK_STRING NK_STRING */ - 385, /* (79) cmd ::= ALTER LOCAL NK_STRING */ - 385, /* (80) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ - 385, /* (81) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ - 385, /* (82) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ - 385, /* (83) cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */ - 385, /* (84) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ - 385, /* (85) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ - 385, /* (86) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ - 385, /* (87) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ - 385, /* (88) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ - 385, /* (89) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ - 385, /* (90) cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */ - 385, /* (91) cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */ - 385, /* (92) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ - 385, /* (93) cmd ::= DROP DATABASE exists_opt db_name */ - 385, /* (94) cmd ::= USE db_name */ - 385, /* (95) cmd ::= ALTER DATABASE db_name alter_db_options */ - 385, /* (96) cmd ::= FLUSH DATABASE db_name */ - 385, /* (97) cmd ::= TRIM DATABASE db_name speed_opt */ - 385, /* (98) cmd ::= S3MIGRATE DATABASE db_name */ - 385, /* (99) cmd ::= COMPACT DATABASE db_name start_opt end_opt */ - 409, /* (100) not_exists_opt ::= IF NOT EXISTS */ - 409, /* (101) not_exists_opt ::= */ - 411, /* (102) exists_opt ::= IF EXISTS */ - 411, /* (103) exists_opt ::= */ - 410, /* (104) db_options ::= */ - 410, /* (105) db_options ::= db_options BUFFER NK_INTEGER */ - 410, /* (106) db_options ::= db_options CACHEMODEL NK_STRING */ - 410, /* (107) db_options ::= db_options CACHESIZE NK_INTEGER */ - 410, /* (108) db_options ::= db_options COMP NK_INTEGER */ - 410, /* (109) db_options ::= db_options DURATION NK_INTEGER */ - 410, /* (110) db_options ::= db_options DURATION NK_VARIABLE */ - 410, /* (111) db_options ::= db_options MAXROWS NK_INTEGER */ - 410, /* (112) db_options ::= db_options MINROWS NK_INTEGER */ - 410, /* (113) db_options ::= db_options KEEP integer_list */ - 410, /* (114) db_options ::= db_options KEEP variable_list */ - 410, /* (115) db_options ::= db_options PAGES NK_INTEGER */ - 410, /* (116) db_options ::= db_options PAGESIZE NK_INTEGER */ - 410, /* (117) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ - 410, /* (118) db_options ::= db_options PRECISION NK_STRING */ - 410, /* (119) db_options ::= db_options REPLICA NK_INTEGER */ - 410, /* (120) db_options ::= db_options VGROUPS NK_INTEGER */ - 410, /* (121) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ - 410, /* (122) db_options ::= db_options RETENTIONS retention_list */ - 410, /* (123) db_options ::= db_options SCHEMALESS NK_INTEGER */ - 410, /* (124) db_options ::= db_options WAL_LEVEL NK_INTEGER */ - 410, /* (125) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ - 410, /* (126) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ - 410, /* (127) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ - 410, /* (128) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ - 410, /* (129) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ - 410, /* (130) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ - 410, /* (131) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ - 410, /* (132) db_options ::= db_options STT_TRIGGER NK_INTEGER */ - 410, /* (133) db_options ::= db_options TABLE_PREFIX signed */ - 410, /* (134) db_options ::= db_options TABLE_SUFFIX signed */ - 410, /* (135) db_options ::= db_options S3_CHUNKSIZE NK_INTEGER */ - 410, /* (136) db_options ::= db_options S3_KEEPLOCAL NK_INTEGER */ - 410, /* (137) db_options ::= db_options S3_KEEPLOCAL NK_VARIABLE */ - 410, /* (138) db_options ::= db_options S3_COMPACT NK_INTEGER */ - 410, /* (139) db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */ - 410, /* (140) db_options ::= db_options ENCRYPT_ALGORITHM NK_STRING */ - 412, /* (141) alter_db_options ::= alter_db_option */ - 412, /* (142) alter_db_options ::= alter_db_options alter_db_option */ - 420, /* (143) alter_db_option ::= BUFFER NK_INTEGER */ - 420, /* (144) alter_db_option ::= CACHEMODEL NK_STRING */ - 420, /* (145) alter_db_option ::= CACHESIZE NK_INTEGER */ - 420, /* (146) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ - 420, /* (147) alter_db_option ::= KEEP integer_list */ - 420, /* (148) alter_db_option ::= KEEP variable_list */ - 420, /* (149) alter_db_option ::= PAGES NK_INTEGER */ - 420, /* (150) alter_db_option ::= REPLICA NK_INTEGER */ - 420, /* (151) alter_db_option ::= WAL_LEVEL NK_INTEGER */ - 420, /* (152) alter_db_option ::= STT_TRIGGER NK_INTEGER */ - 420, /* (153) alter_db_option ::= MINROWS NK_INTEGER */ - 420, /* (154) alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ - 420, /* (155) alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ - 420, /* (156) alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ - 420, /* (157) alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ - 420, /* (158) alter_db_option ::= S3_KEEPLOCAL NK_INTEGER */ - 420, /* (159) alter_db_option ::= S3_KEEPLOCAL NK_VARIABLE */ - 420, /* (160) alter_db_option ::= S3_COMPACT NK_INTEGER */ - 420, /* (161) alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */ - 420, /* (162) alter_db_option ::= ENCRYPT_ALGORITHM NK_STRING */ - 416, /* (163) integer_list ::= NK_INTEGER */ - 416, /* (164) integer_list ::= integer_list NK_COMMA NK_INTEGER */ - 417, /* (165) variable_list ::= NK_VARIABLE */ - 417, /* (166) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ - 418, /* (167) retention_list ::= retention */ - 418, /* (168) retention_list ::= retention_list NK_COMMA retention */ - 421, /* (169) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ - 421, /* (170) retention ::= NK_MINUS NK_COLON NK_VARIABLE */ - 413, /* (171) speed_opt ::= */ - 413, /* (172) speed_opt ::= BWLIMIT NK_INTEGER */ - 414, /* (173) start_opt ::= */ - 414, /* (174) start_opt ::= START WITH NK_INTEGER */ - 414, /* (175) start_opt ::= START WITH NK_STRING */ - 414, /* (176) start_opt ::= START WITH TIMESTAMP NK_STRING */ - 415, /* (177) end_opt ::= */ - 415, /* (178) end_opt ::= END WITH NK_INTEGER */ - 415, /* (179) end_opt ::= END WITH NK_STRING */ - 415, /* (180) end_opt ::= END WITH TIMESTAMP NK_STRING */ - 385, /* (181) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - 385, /* (182) cmd ::= CREATE TABLE multi_create_clause */ - 385, /* (183) cmd ::= CREATE TABLE not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING */ - 385, /* (184) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - 385, /* (185) cmd ::= DROP TABLE multi_drop_clause */ - 385, /* (186) cmd ::= DROP STABLE exists_opt full_table_name */ - 385, /* (187) cmd ::= ALTER TABLE alter_table_clause */ - 385, /* (188) cmd ::= ALTER STABLE alter_table_clause */ - 430, /* (189) alter_table_clause ::= full_table_name alter_table_options */ - 430, /* (190) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options */ - 430, /* (191) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - 430, /* (192) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - 430, /* (193) alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */ - 430, /* (194) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - 430, /* (195) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - 430, /* (196) alter_table_clause ::= full_table_name DROP TAG column_name */ - 430, /* (197) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - 430, /* (198) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - 430, /* (199) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal */ - 426, /* (200) multi_create_clause ::= create_subtable_clause */ - 426, /* (201) multi_create_clause ::= multi_create_clause create_subtable_clause */ - 436, /* (202) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */ - 429, /* (203) multi_drop_clause ::= drop_table_clause */ - 429, /* (204) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ - 439, /* (205) drop_table_clause ::= exists_opt full_table_name */ - 437, /* (206) specific_cols_opt ::= */ - 437, /* (207) specific_cols_opt ::= NK_LP col_name_list NK_RP */ - 422, /* (208) full_table_name ::= table_name */ - 422, /* (209) full_table_name ::= db_name NK_DOT table_name */ - 441, /* (210) tag_def_list ::= tag_def */ - 441, /* (211) tag_def_list ::= tag_def_list NK_COMMA tag_def */ - 442, /* (212) tag_def ::= column_name type_name */ - 423, /* (213) column_def_list ::= column_def */ - 423, /* (214) column_def_list ::= column_def_list NK_COMMA column_def */ - 443, /* (215) column_def ::= column_name type_name column_options */ - 433, /* (216) type_name ::= BOOL */ - 433, /* (217) type_name ::= TINYINT */ - 433, /* (218) type_name ::= SMALLINT */ - 433, /* (219) type_name ::= INT */ - 433, /* (220) type_name ::= INTEGER */ - 433, /* (221) type_name ::= BIGINT */ - 433, /* (222) type_name ::= FLOAT */ - 433, /* (223) type_name ::= DOUBLE */ - 433, /* (224) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - 433, /* (225) type_name ::= TIMESTAMP */ - 433, /* (226) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - 433, /* (227) type_name ::= TINYINT UNSIGNED */ - 433, /* (228) type_name ::= SMALLINT UNSIGNED */ - 433, /* (229) type_name ::= INT UNSIGNED */ - 433, /* (230) type_name ::= BIGINT UNSIGNED */ - 433, /* (231) type_name ::= JSON */ - 433, /* (232) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - 433, /* (233) type_name ::= MEDIUMBLOB */ - 433, /* (234) type_name ::= BLOB */ - 433, /* (235) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - 433, /* (236) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ - 433, /* (237) type_name ::= DECIMAL */ - 433, /* (238) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - 433, /* (239) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - 444, /* (240) type_name_default_len ::= BINARY */ - 444, /* (241) type_name_default_len ::= NCHAR */ - 444, /* (242) type_name_default_len ::= VARCHAR */ - 444, /* (243) type_name_default_len ::= VARBINARY */ - 424, /* (244) tags_def_opt ::= */ - 424, /* (245) tags_def_opt ::= tags_def */ - 428, /* (246) tags_def ::= TAGS NK_LP tag_def_list NK_RP */ - 425, /* (247) table_options ::= */ - 425, /* (248) table_options ::= table_options COMMENT NK_STRING */ - 425, /* (249) table_options ::= table_options MAX_DELAY duration_list */ - 425, /* (250) table_options ::= table_options WATERMARK duration_list */ - 425, /* (251) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ - 425, /* (252) table_options ::= table_options TTL NK_INTEGER */ - 425, /* (253) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - 425, /* (254) table_options ::= table_options DELETE_MARK duration_list */ - 431, /* (255) alter_table_options ::= alter_table_option */ - 431, /* (256) alter_table_options ::= alter_table_options alter_table_option */ - 447, /* (257) alter_table_option ::= COMMENT NK_STRING */ - 447, /* (258) alter_table_option ::= TTL NK_INTEGER */ - 445, /* (259) duration_list ::= duration_literal */ - 445, /* (260) duration_list ::= duration_list NK_COMMA duration_literal */ - 446, /* (261) rollup_func_list ::= rollup_func_name */ - 446, /* (262) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ - 449, /* (263) rollup_func_name ::= function_name */ - 449, /* (264) rollup_func_name ::= FIRST */ - 449, /* (265) rollup_func_name ::= LAST */ - 440, /* (266) col_name_list ::= col_name */ - 440, /* (267) col_name_list ::= col_name_list NK_COMMA col_name */ - 451, /* (268) col_name ::= column_name */ - 385, /* (269) cmd ::= SHOW DNODES */ - 385, /* (270) cmd ::= SHOW USERS */ - 385, /* (271) cmd ::= SHOW USERS FULL */ - 385, /* (272) cmd ::= SHOW USER PRIVILEGES */ - 385, /* (273) cmd ::= SHOW db_kind_opt DATABASES */ - 385, /* (274) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ - 385, /* (275) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - 385, /* (276) cmd ::= SHOW db_name_cond_opt VGROUPS */ - 385, /* (277) cmd ::= SHOW MNODES */ - 385, /* (278) cmd ::= SHOW QNODES */ - 385, /* (279) cmd ::= SHOW ARBGROUPS */ - 385, /* (280) cmd ::= SHOW FUNCTIONS */ - 385, /* (281) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - 385, /* (282) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ - 385, /* (283) cmd ::= SHOW STREAMS */ - 385, /* (284) cmd ::= SHOW ACCOUNTS */ - 385, /* (285) cmd ::= SHOW APPS */ - 385, /* (286) cmd ::= SHOW CONNECTIONS */ - 385, /* (287) cmd ::= SHOW LICENCES */ - 385, /* (288) cmd ::= SHOW GRANTS */ - 385, /* (289) cmd ::= SHOW GRANTS FULL */ - 385, /* (290) cmd ::= SHOW GRANTS LOGS */ - 385, /* (291) cmd ::= SHOW CLUSTER MACHINES */ - 385, /* (292) cmd ::= SHOW CREATE DATABASE db_name */ - 385, /* (293) cmd ::= SHOW CREATE TABLE full_table_name */ - 385, /* (294) cmd ::= SHOW CREATE STABLE full_table_name */ - 385, /* (295) cmd ::= SHOW ENCRYPTIONS */ - 385, /* (296) cmd ::= SHOW QUERIES */ - 385, /* (297) cmd ::= SHOW SCORES */ - 385, /* (298) cmd ::= SHOW TOPICS */ - 385, /* (299) cmd ::= SHOW VARIABLES */ - 385, /* (300) cmd ::= SHOW CLUSTER VARIABLES */ - 385, /* (301) cmd ::= SHOW LOCAL VARIABLES */ - 385, /* (302) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ - 385, /* (303) cmd ::= SHOW BNODES */ - 385, /* (304) cmd ::= SHOW SNODES */ - 385, /* (305) cmd ::= SHOW CLUSTER */ - 385, /* (306) cmd ::= SHOW TRANSACTIONS */ - 385, /* (307) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ - 385, /* (308) cmd ::= SHOW CONSUMERS */ - 385, /* (309) cmd ::= SHOW SUBSCRIPTIONS */ - 385, /* (310) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ - 385, /* (311) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ - 385, /* (312) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ - 385, /* (313) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ - 385, /* (314) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ - 385, /* (315) cmd ::= SHOW VNODES */ - 385, /* (316) cmd ::= SHOW db_name_cond_opt ALIVE */ - 385, /* (317) cmd ::= SHOW CLUSTER ALIVE */ - 385, /* (318) cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */ - 385, /* (319) cmd ::= SHOW CREATE VIEW full_table_name */ - 385, /* (320) cmd ::= SHOW COMPACTS */ - 385, /* (321) cmd ::= SHOW COMPACT NK_INTEGER */ - 453, /* (322) table_kind_db_name_cond_opt ::= */ - 453, /* (323) table_kind_db_name_cond_opt ::= table_kind */ - 453, /* (324) table_kind_db_name_cond_opt ::= db_name NK_DOT */ - 453, /* (325) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ - 458, /* (326) table_kind ::= NORMAL */ - 458, /* (327) table_kind ::= CHILD */ - 455, /* (328) db_name_cond_opt ::= */ - 455, /* (329) db_name_cond_opt ::= db_name NK_DOT */ - 454, /* (330) like_pattern_opt ::= */ - 454, /* (331) like_pattern_opt ::= LIKE NK_STRING */ - 456, /* (332) table_name_cond ::= table_name */ - 457, /* (333) from_db_opt ::= */ - 457, /* (334) from_db_opt ::= FROM db_name */ - 427, /* (335) tag_list_opt ::= */ - 427, /* (336) tag_list_opt ::= tag_item */ - 427, /* (337) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ - 459, /* (338) tag_item ::= TBNAME */ - 459, /* (339) tag_item ::= QTAGS */ - 459, /* (340) tag_item ::= column_name */ - 459, /* (341) tag_item ::= column_name column_alias */ - 459, /* (342) tag_item ::= column_name AS column_alias */ - 452, /* (343) db_kind_opt ::= */ - 452, /* (344) db_kind_opt ::= USER */ - 452, /* (345) db_kind_opt ::= SYSTEM */ - 385, /* (346) cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */ - 385, /* (347) cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */ - 385, /* (348) cmd ::= DROP TSMA exists_opt full_tsma_name */ - 385, /* (349) cmd ::= SHOW db_name_cond_opt TSMAS */ - 463, /* (350) full_tsma_name ::= tsma_name */ - 463, /* (351) full_tsma_name ::= db_name NK_DOT tsma_name */ - 462, /* (352) tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */ - 385, /* (353) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ - 385, /* (354) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ - 385, /* (355) cmd ::= DROP INDEX exists_opt full_index_name */ - 466, /* (356) full_index_name ::= index_name */ - 466, /* (357) full_index_name ::= db_name NK_DOT index_name */ - 465, /* (358) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - 465, /* (359) 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 */ - 464, /* (360) func_list ::= func */ - 464, /* (361) func_list ::= func_list NK_COMMA func */ - 470, /* (362) func ::= sma_func_name NK_LP expression_list NK_RP */ - 471, /* (363) sma_func_name ::= function_name */ - 471, /* (364) sma_func_name ::= COUNT */ - 471, /* (365) sma_func_name ::= FIRST */ - 471, /* (366) sma_func_name ::= LAST */ - 471, /* (367) sma_func_name ::= LAST_ROW */ - 469, /* (368) sma_stream_opt ::= */ - 469, /* (369) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ - 469, /* (370) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ - 469, /* (371) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ - 473, /* (372) with_meta ::= AS */ - 473, /* (373) with_meta ::= WITH META AS */ - 473, /* (374) with_meta ::= ONLY META AS */ - 385, /* (375) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ - 385, /* (376) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ - 385, /* (377) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ - 385, /* (378) cmd ::= DROP TOPIC exists_opt topic_name */ - 385, /* (379) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - 385, /* (380) cmd ::= DESC full_table_name */ - 385, /* (381) cmd ::= DESCRIBE full_table_name */ - 385, /* (382) cmd ::= RESET QUERY CACHE */ - 385, /* (383) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - 385, /* (384) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ - 477, /* (385) analyze_opt ::= */ - 477, /* (386) analyze_opt ::= ANALYZE */ - 478, /* (387) explain_options ::= */ - 478, /* (388) explain_options ::= explain_options VERBOSE NK_BOOL */ - 478, /* (389) explain_options ::= explain_options RATIO NK_FLOAT */ - 385, /* (390) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ - 385, /* (391) cmd ::= DROP FUNCTION exists_opt function_name */ - 481, /* (392) agg_func_opt ::= */ - 481, /* (393) agg_func_opt ::= AGGREGATE */ - 482, /* (394) bufsize_opt ::= */ - 482, /* (395) bufsize_opt ::= BUFSIZE NK_INTEGER */ - 483, /* (396) language_opt ::= */ - 483, /* (397) language_opt ::= LANGUAGE NK_STRING */ - 480, /* (398) or_replace_opt ::= */ - 480, /* (399) or_replace_opt ::= OR REPLACE */ - 385, /* (400) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ - 385, /* (401) cmd ::= DROP VIEW exists_opt full_view_name */ - 484, /* (402) full_view_name ::= view_name */ - 484, /* (403) full_view_name ::= db_name NK_DOT view_name */ - 385, /* (404) 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 */ - 385, /* (405) cmd ::= DROP STREAM exists_opt stream_name */ - 385, /* (406) cmd ::= PAUSE STREAM exists_opt stream_name */ - 385, /* (407) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ - 488, /* (408) col_list_opt ::= */ - 488, /* (409) col_list_opt ::= NK_LP column_stream_def_list NK_RP */ - 492, /* (410) column_stream_def_list ::= column_stream_def */ - 492, /* (411) column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ - 493, /* (412) column_stream_def ::= column_name stream_col_options */ - 494, /* (413) stream_col_options ::= */ - 494, /* (414) stream_col_options ::= stream_col_options PRIMARY KEY */ - 489, /* (415) tag_def_or_ref_opt ::= */ - 489, /* (416) tag_def_or_ref_opt ::= tags_def */ - 489, /* (417) tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ - 487, /* (418) stream_options ::= */ - 487, /* (419) stream_options ::= stream_options TRIGGER AT_ONCE */ - 487, /* (420) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - 487, /* (421) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - 487, /* (422) stream_options ::= stream_options WATERMARK duration_literal */ - 487, /* (423) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - 487, /* (424) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ - 487, /* (425) stream_options ::= stream_options DELETE_MARK duration_literal */ - 487, /* (426) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ - 490, /* (427) subtable_opt ::= */ - 490, /* (428) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - 491, /* (429) ignore_opt ::= */ - 491, /* (430) ignore_opt ::= IGNORE UNTREATED */ - 385, /* (431) cmd ::= KILL CONNECTION NK_INTEGER */ - 385, /* (432) cmd ::= KILL QUERY NK_STRING */ - 385, /* (433) cmd ::= KILL TRANSACTION NK_INTEGER */ - 385, /* (434) cmd ::= KILL COMPACT NK_INTEGER */ - 385, /* (435) cmd ::= BALANCE VGROUP */ - 385, /* (436) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ - 385, /* (437) cmd ::= BALANCE VGROUP LEADER DATABASE db_name */ - 385, /* (438) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - 385, /* (439) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - 385, /* (440) cmd ::= SPLIT VGROUP NK_INTEGER */ - 496, /* (441) on_vgroup_id ::= */ - 496, /* (442) on_vgroup_id ::= ON NK_INTEGER */ - 497, /* (443) dnode_list ::= DNODE NK_INTEGER */ - 497, /* (444) dnode_list ::= dnode_list DNODE NK_INTEGER */ - 385, /* (445) cmd ::= DELETE FROM full_table_name where_clause_opt */ - 385, /* (446) cmd ::= query_or_subquery */ - 385, /* (447) cmd ::= insert_query */ - 479, /* (448) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - 479, /* (449) insert_query ::= INSERT INTO full_table_name query_or_subquery */ - 435, /* (450) tags_literal ::= NK_INTEGER */ - 435, /* (451) tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ - 435, /* (452) tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ - 435, /* (453) tags_literal ::= NK_PLUS NK_INTEGER */ - 435, /* (454) tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ - 435, /* (455) tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ - 435, /* (456) tags_literal ::= NK_MINUS NK_INTEGER */ - 435, /* (457) tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ - 435, /* (458) tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ - 435, /* (459) tags_literal ::= NK_FLOAT */ - 435, /* (460) tags_literal ::= NK_PLUS NK_FLOAT */ - 435, /* (461) tags_literal ::= NK_MINUS NK_FLOAT */ - 435, /* (462) tags_literal ::= NK_BIN */ - 435, /* (463) tags_literal ::= NK_BIN NK_PLUS duration_literal */ - 435, /* (464) tags_literal ::= NK_BIN NK_MINUS duration_literal */ - 435, /* (465) tags_literal ::= NK_PLUS NK_BIN */ - 435, /* (466) tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ - 435, /* (467) tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ - 435, /* (468) tags_literal ::= NK_MINUS NK_BIN */ - 435, /* (469) tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ - 435, /* (470) tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ - 435, /* (471) tags_literal ::= NK_HEX */ - 435, /* (472) tags_literal ::= NK_HEX NK_PLUS duration_literal */ - 435, /* (473) tags_literal ::= NK_HEX NK_MINUS duration_literal */ - 435, /* (474) tags_literal ::= NK_PLUS NK_HEX */ - 435, /* (475) tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ - 435, /* (476) tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ - 435, /* (477) tags_literal ::= NK_MINUS NK_HEX */ - 435, /* (478) tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ - 435, /* (479) tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ - 435, /* (480) tags_literal ::= NK_STRING */ - 435, /* (481) tags_literal ::= NK_STRING NK_PLUS duration_literal */ - 435, /* (482) tags_literal ::= NK_STRING NK_MINUS duration_literal */ - 435, /* (483) tags_literal ::= NK_BOOL */ - 435, /* (484) tags_literal ::= NULL */ - 435, /* (485) tags_literal ::= literal_func */ - 435, /* (486) tags_literal ::= literal_func NK_PLUS duration_literal */ - 435, /* (487) tags_literal ::= literal_func NK_MINUS duration_literal */ - 438, /* (488) tags_literal_list ::= tags_literal */ - 438, /* (489) tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ - 388, /* (490) literal ::= NK_INTEGER */ - 388, /* (491) literal ::= NK_FLOAT */ - 388, /* (492) literal ::= NK_STRING */ - 388, /* (493) literal ::= NK_BOOL */ - 388, /* (494) literal ::= TIMESTAMP NK_STRING */ - 388, /* (495) literal ::= duration_literal */ - 388, /* (496) literal ::= NULL */ - 388, /* (497) literal ::= NK_QUESTION */ - 448, /* (498) duration_literal ::= NK_VARIABLE */ - 419, /* (499) signed ::= NK_INTEGER */ - 419, /* (500) signed ::= NK_PLUS NK_INTEGER */ - 419, /* (501) signed ::= NK_MINUS NK_INTEGER */ - 419, /* (502) signed ::= NK_FLOAT */ - 419, /* (503) signed ::= NK_PLUS NK_FLOAT */ - 419, /* (504) signed ::= NK_MINUS NK_FLOAT */ - 499, /* (505) signed_literal ::= signed */ - 499, /* (506) signed_literal ::= NK_STRING */ - 499, /* (507) signed_literal ::= NK_BOOL */ - 499, /* (508) signed_literal ::= TIMESTAMP NK_STRING */ - 499, /* (509) signed_literal ::= duration_literal */ - 499, /* (510) signed_literal ::= NULL */ - 499, /* (511) signed_literal ::= literal_func */ - 499, /* (512) signed_literal ::= NK_QUESTION */ - 500, /* (513) literal_list ::= signed_literal */ - 500, /* (514) literal_list ::= literal_list NK_COMMA signed_literal */ - 402, /* (515) db_name ::= NK_ID */ - 403, /* (516) table_name ::= NK_ID */ - 432, /* (517) column_name ::= NK_ID */ - 450, /* (518) function_name ::= NK_ID */ - 485, /* (519) view_name ::= NK_ID */ - 501, /* (520) table_alias ::= NK_ID */ - 460, /* (521) column_alias ::= NK_ID */ - 460, /* (522) column_alias ::= NK_ALIAS */ - 395, /* (523) user_name ::= NK_ID */ - 404, /* (524) topic_name ::= NK_ID */ - 486, /* (525) stream_name ::= NK_ID */ - 476, /* (526) cgroup_name ::= NK_ID */ - 467, /* (527) index_name ::= NK_ID */ - 461, /* (528) tsma_name ::= NK_ID */ - 502, /* (529) expr_or_subquery ::= expression */ - 495, /* (530) expression ::= literal */ - 495, /* (531) expression ::= pseudo_column */ - 495, /* (532) expression ::= column_reference */ - 495, /* (533) expression ::= function_expression */ - 495, /* (534) expression ::= case_when_expression */ - 495, /* (535) expression ::= NK_LP expression NK_RP */ - 495, /* (536) expression ::= NK_PLUS expr_or_subquery */ - 495, /* (537) expression ::= NK_MINUS expr_or_subquery */ - 495, /* (538) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ - 495, /* (539) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ - 495, /* (540) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ - 495, /* (541) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ - 495, /* (542) expression ::= expr_or_subquery NK_REM expr_or_subquery */ - 495, /* (543) expression ::= column_reference NK_ARROW NK_STRING */ - 495, /* (544) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ - 495, /* (545) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ - 472, /* (546) expression_list ::= expr_or_subquery */ - 472, /* (547) expression_list ::= expression_list NK_COMMA expr_or_subquery */ - 504, /* (548) column_reference ::= column_name */ - 504, /* (549) column_reference ::= table_name NK_DOT column_name */ - 504, /* (550) column_reference ::= NK_ALIAS */ - 504, /* (551) column_reference ::= table_name NK_DOT NK_ALIAS */ - 503, /* (552) pseudo_column ::= ROWTS */ - 503, /* (553) pseudo_column ::= TBNAME */ - 503, /* (554) pseudo_column ::= table_name NK_DOT TBNAME */ - 503, /* (555) pseudo_column ::= QSTART */ - 503, /* (556) pseudo_column ::= QEND */ - 503, /* (557) pseudo_column ::= QDURATION */ - 503, /* (558) pseudo_column ::= WSTART */ - 503, /* (559) pseudo_column ::= WEND */ - 503, /* (560) pseudo_column ::= WDURATION */ - 503, /* (561) pseudo_column ::= IROWTS */ - 503, /* (562) pseudo_column ::= ISFILLED */ - 503, /* (563) pseudo_column ::= QTAGS */ - 505, /* (564) function_expression ::= function_name NK_LP expression_list NK_RP */ - 505, /* (565) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - 505, /* (566) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - 505, /* (567) function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ - 505, /* (568) function_expression ::= POSITION NK_LP expr_or_subquery IN expr_or_subquery NK_RP */ - 505, /* (569) function_expression ::= TRIM NK_LP expr_or_subquery NK_RP */ - 505, /* (570) function_expression ::= TRIM NK_LP trim_specification_type FROM expr_or_subquery NK_RP */ - 505, /* (571) function_expression ::= TRIM NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ - 505, /* (572) function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP */ - 505, /* (573) function_expression ::= substr_func NK_LP expression_list NK_RP */ - 505, /* (574) function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ - 505, /* (575) function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP */ - 505, /* (576) function_expression ::= REPLACE NK_LP expression_list NK_RP */ - 505, /* (577) function_expression ::= literal_func */ - 498, /* (578) literal_func ::= noarg_func NK_LP NK_RP */ - 498, /* (579) literal_func ::= NOW */ - 498, /* (580) literal_func ::= TODAY */ - 510, /* (581) substr_func ::= SUBSTR */ - 510, /* (582) substr_func ::= SUBSTRING */ - 509, /* (583) trim_specification_type ::= BOTH */ - 509, /* (584) trim_specification_type ::= TRAILING */ - 509, /* (585) trim_specification_type ::= LEADING */ - 511, /* (586) noarg_func ::= NOW */ - 511, /* (587) noarg_func ::= TODAY */ - 511, /* (588) noarg_func ::= TIMEZONE */ - 511, /* (589) noarg_func ::= DATABASE */ - 511, /* (590) noarg_func ::= CLIENT_VERSION */ - 511, /* (591) noarg_func ::= SERVER_VERSION */ - 511, /* (592) noarg_func ::= SERVER_STATUS */ - 511, /* (593) noarg_func ::= CURRENT_USER */ - 511, /* (594) noarg_func ::= USER */ - 511, /* (595) noarg_func ::= PI */ - 507, /* (596) star_func ::= COUNT */ - 507, /* (597) star_func ::= FIRST */ - 507, /* (598) star_func ::= LAST */ - 507, /* (599) star_func ::= LAST_ROW */ - 508, /* (600) star_func_para_list ::= NK_STAR */ - 508, /* (601) star_func_para_list ::= other_para_list */ - 512, /* (602) other_para_list ::= star_func_para */ - 512, /* (603) other_para_list ::= other_para_list NK_COMMA star_func_para */ - 513, /* (604) star_func_para ::= expr_or_subquery */ - 513, /* (605) star_func_para ::= table_name NK_DOT NK_STAR */ - 506, /* (606) case_when_expression ::= CASE when_then_list case_when_else_opt END */ - 506, /* (607) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - 514, /* (608) when_then_list ::= when_then_expr */ - 514, /* (609) when_then_list ::= when_then_list when_then_expr */ - 517, /* (610) when_then_expr ::= WHEN common_expression THEN common_expression */ - 515, /* (611) case_when_else_opt ::= */ - 515, /* (612) case_when_else_opt ::= ELSE common_expression */ - 518, /* (613) predicate ::= expr_or_subquery compare_op expr_or_subquery */ - 518, /* (614) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ - 518, /* (615) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ - 518, /* (616) predicate ::= expr_or_subquery IS NULL */ - 518, /* (617) predicate ::= expr_or_subquery IS NOT NULL */ - 518, /* (618) predicate ::= expr_or_subquery in_op in_predicate_value */ - 519, /* (619) compare_op ::= NK_LT */ - 519, /* (620) compare_op ::= NK_GT */ - 519, /* (621) compare_op ::= NK_LE */ - 519, /* (622) compare_op ::= NK_GE */ - 519, /* (623) compare_op ::= NK_NE */ - 519, /* (624) compare_op ::= NK_EQ */ - 519, /* (625) compare_op ::= LIKE */ - 519, /* (626) compare_op ::= NOT LIKE */ - 519, /* (627) compare_op ::= MATCH */ - 519, /* (628) compare_op ::= NMATCH */ - 519, /* (629) compare_op ::= CONTAINS */ - 520, /* (630) in_op ::= IN */ - 520, /* (631) in_op ::= NOT IN */ - 521, /* (632) in_predicate_value ::= NK_LP literal_list NK_RP */ - 522, /* (633) boolean_value_expression ::= boolean_primary */ - 522, /* (634) boolean_value_expression ::= NOT boolean_primary */ - 522, /* (635) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - 522, /* (636) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - 523, /* (637) boolean_primary ::= predicate */ - 523, /* (638) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - 516, /* (639) common_expression ::= expr_or_subquery */ - 516, /* (640) common_expression ::= boolean_value_expression */ - 524, /* (641) from_clause_opt ::= */ - 524, /* (642) from_clause_opt ::= FROM table_reference_list */ - 525, /* (643) table_reference_list ::= table_reference */ - 525, /* (644) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - 526, /* (645) table_reference ::= table_primary */ - 526, /* (646) table_reference ::= joined_table */ - 527, /* (647) table_primary ::= table_name alias_opt */ - 527, /* (648) table_primary ::= db_name NK_DOT table_name alias_opt */ - 527, /* (649) table_primary ::= subquery alias_opt */ - 527, /* (650) table_primary ::= parenthesized_joined_table */ - 529, /* (651) alias_opt ::= */ - 529, /* (652) alias_opt ::= table_alias */ - 529, /* (653) alias_opt ::= AS table_alias */ - 531, /* (654) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - 531, /* (655) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - 528, /* (656) joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ - 532, /* (657) join_type ::= */ - 532, /* (658) join_type ::= INNER */ - 532, /* (659) join_type ::= LEFT */ - 532, /* (660) join_type ::= RIGHT */ - 532, /* (661) join_type ::= FULL */ - 533, /* (662) join_subtype ::= */ - 533, /* (663) join_subtype ::= OUTER */ - 533, /* (664) join_subtype ::= SEMI */ - 533, /* (665) join_subtype ::= ANTI */ - 533, /* (666) join_subtype ::= ASOF */ - 533, /* (667) join_subtype ::= WINDOW */ - 534, /* (668) join_on_clause_opt ::= */ - 534, /* (669) join_on_clause_opt ::= ON search_condition */ - 535, /* (670) window_offset_clause_opt ::= */ - 535, /* (671) window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ - 537, /* (672) window_offset_literal ::= NK_VARIABLE */ - 537, /* (673) window_offset_literal ::= NK_MINUS NK_VARIABLE */ - 536, /* (674) jlimit_clause_opt ::= */ - 536, /* (675) jlimit_clause_opt ::= JLIMIT NK_INTEGER */ - 538, /* (676) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ - 539, /* (677) hint_list ::= */ - 539, /* (678) hint_list ::= NK_HINT */ - 541, /* (679) tag_mode_opt ::= */ - 541, /* (680) tag_mode_opt ::= TAGS */ - 540, /* (681) set_quantifier_opt ::= */ - 540, /* (682) set_quantifier_opt ::= DISTINCT */ - 540, /* (683) set_quantifier_opt ::= ALL */ - 542, /* (684) select_list ::= select_item */ - 542, /* (685) select_list ::= select_list NK_COMMA select_item */ - 550, /* (686) select_item ::= NK_STAR */ - 550, /* (687) select_item ::= common_expression */ - 550, /* (688) select_item ::= common_expression column_alias */ - 550, /* (689) select_item ::= common_expression AS column_alias */ - 550, /* (690) select_item ::= table_name NK_DOT NK_STAR */ - 475, /* (691) where_clause_opt ::= */ - 475, /* (692) where_clause_opt ::= WHERE search_condition */ - 543, /* (693) partition_by_clause_opt ::= */ - 543, /* (694) partition_by_clause_opt ::= PARTITION BY partition_list */ - 551, /* (695) partition_list ::= partition_item */ - 551, /* (696) partition_list ::= partition_list NK_COMMA partition_item */ - 552, /* (697) partition_item ::= expr_or_subquery */ - 552, /* (698) partition_item ::= expr_or_subquery column_alias */ - 552, /* (699) partition_item ::= expr_or_subquery AS column_alias */ - 547, /* (700) twindow_clause_opt ::= */ - 547, /* (701) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ - 547, /* (702) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - 547, /* (703) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - 547, /* (704) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - 547, /* (705) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ - 547, /* (706) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ - 547, /* (707) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - 468, /* (708) sliding_opt ::= */ - 468, /* (709) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ - 553, /* (710) interval_sliding_duration_literal ::= NK_VARIABLE */ - 553, /* (711) interval_sliding_duration_literal ::= NK_STRING */ - 553, /* (712) interval_sliding_duration_literal ::= NK_INTEGER */ - 546, /* (713) fill_opt ::= */ - 546, /* (714) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - 546, /* (715) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ - 546, /* (716) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ - 554, /* (717) fill_mode ::= NONE */ - 554, /* (718) fill_mode ::= PREV */ - 554, /* (719) fill_mode ::= NULL */ - 554, /* (720) fill_mode ::= NULL_F */ - 554, /* (721) fill_mode ::= LINEAR */ - 554, /* (722) fill_mode ::= NEXT */ - 548, /* (723) group_by_clause_opt ::= */ - 548, /* (724) group_by_clause_opt ::= GROUP BY group_by_list */ - 555, /* (725) group_by_list ::= expr_or_subquery */ - 555, /* (726) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - 549, /* (727) having_clause_opt ::= */ - 549, /* (728) having_clause_opt ::= HAVING search_condition */ - 544, /* (729) range_opt ::= */ - 544, /* (730) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - 544, /* (731) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ - 545, /* (732) every_opt ::= */ - 545, /* (733) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - 556, /* (734) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - 557, /* (735) query_simple ::= query_specification */ - 557, /* (736) query_simple ::= union_query_expression */ - 561, /* (737) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - 561, /* (738) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - 562, /* (739) query_simple_or_subquery ::= query_simple */ - 562, /* (740) query_simple_or_subquery ::= subquery */ - 474, /* (741) query_or_subquery ::= query_expression */ - 474, /* (742) query_or_subquery ::= subquery */ - 558, /* (743) order_by_clause_opt ::= */ - 558, /* (744) order_by_clause_opt ::= ORDER BY sort_specification_list */ - 559, /* (745) slimit_clause_opt ::= */ - 559, /* (746) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - 559, /* (747) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - 559, /* (748) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 560, /* (749) limit_clause_opt ::= */ - 560, /* (750) limit_clause_opt ::= LIMIT NK_INTEGER */ - 560, /* (751) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - 560, /* (752) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 530, /* (753) subquery ::= NK_LP query_expression NK_RP */ - 530, /* (754) subquery ::= NK_LP subquery NK_RP */ - 405, /* (755) search_condition ::= common_expression */ - 563, /* (756) sort_specification_list ::= sort_specification */ - 563, /* (757) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - 564, /* (758) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - 565, /* (759) ordering_specification_opt ::= */ - 565, /* (760) ordering_specification_opt ::= ASC */ - 565, /* (761) ordering_specification_opt ::= DESC */ - 566, /* (762) null_ordering_opt ::= */ - 566, /* (763) null_ordering_opt ::= NULLS FIRST */ - 566, /* (764) null_ordering_opt ::= NULLS LAST */ - 434, /* (765) column_options ::= */ - 434, /* (766) column_options ::= column_options PRIMARY KEY */ - 434, /* (767) column_options ::= column_options ENCODE NK_STRING */ - 434, /* (768) column_options ::= column_options COMPRESS NK_STRING */ - 434, /* (769) column_options ::= column_options LEVEL NK_STRING */ + 382, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ + 382, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ + 383, /* (2) account_options ::= */ + 383, /* (3) account_options ::= account_options PPS literal */ + 383, /* (4) account_options ::= account_options TSERIES literal */ + 383, /* (5) account_options ::= account_options STORAGE literal */ + 383, /* (6) account_options ::= account_options STREAMS literal */ + 383, /* (7) account_options ::= account_options QTIME literal */ + 383, /* (8) account_options ::= account_options DBS literal */ + 383, /* (9) account_options ::= account_options USERS literal */ + 383, /* (10) account_options ::= account_options CONNS literal */ + 383, /* (11) account_options ::= account_options STATE literal */ + 384, /* (12) alter_account_options ::= alter_account_option */ + 384, /* (13) alter_account_options ::= alter_account_options alter_account_option */ + 386, /* (14) alter_account_option ::= PASS literal */ + 386, /* (15) alter_account_option ::= PPS literal */ + 386, /* (16) alter_account_option ::= TSERIES literal */ + 386, /* (17) alter_account_option ::= STORAGE literal */ + 386, /* (18) alter_account_option ::= STREAMS literal */ + 386, /* (19) alter_account_option ::= QTIME literal */ + 386, /* (20) alter_account_option ::= DBS literal */ + 386, /* (21) alter_account_option ::= USERS literal */ + 386, /* (22) alter_account_option ::= CONNS literal */ + 386, /* (23) alter_account_option ::= STATE literal */ + 387, /* (24) ip_range_list ::= NK_STRING */ + 387, /* (25) ip_range_list ::= ip_range_list NK_COMMA NK_STRING */ + 388, /* (26) white_list ::= HOST ip_range_list */ + 389, /* (27) white_list_opt ::= */ + 389, /* (28) white_list_opt ::= white_list */ + 390, /* (29) is_import_opt ::= */ + 390, /* (30) is_import_opt ::= IS_IMPORT NK_INTEGER */ + 391, /* (31) is_createdb_opt ::= */ + 391, /* (32) is_createdb_opt ::= CREATEDB NK_INTEGER */ + 382, /* (33) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt is_createdb_opt is_import_opt white_list_opt */ + 382, /* (34) cmd ::= ALTER USER user_name PASS NK_STRING */ + 382, /* (35) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ + 382, /* (36) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ + 382, /* (37) cmd ::= ALTER USER user_name CREATEDB NK_INTEGER */ + 382, /* (38) cmd ::= ALTER USER user_name ADD white_list */ + 382, /* (39) cmd ::= ALTER USER user_name DROP white_list */ + 382, /* (40) cmd ::= DROP USER user_name */ + 393, /* (41) sysinfo_opt ::= */ + 393, /* (42) sysinfo_opt ::= SYSINFO NK_INTEGER */ + 382, /* (43) cmd ::= GRANT privileges ON priv_level with_opt TO user_name */ + 382, /* (44) cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */ + 394, /* (45) privileges ::= ALL */ + 394, /* (46) privileges ::= priv_type_list */ + 394, /* (47) privileges ::= SUBSCRIBE */ + 397, /* (48) priv_type_list ::= priv_type */ + 397, /* (49) priv_type_list ::= priv_type_list NK_COMMA priv_type */ + 398, /* (50) priv_type ::= READ */ + 398, /* (51) priv_type ::= WRITE */ + 398, /* (52) priv_type ::= ALTER */ + 395, /* (53) priv_level ::= NK_STAR NK_DOT NK_STAR */ + 395, /* (54) priv_level ::= db_name NK_DOT NK_STAR */ + 395, /* (55) priv_level ::= db_name NK_DOT table_name */ + 395, /* (56) priv_level ::= topic_name */ + 396, /* (57) with_opt ::= */ + 396, /* (58) with_opt ::= WITH search_condition */ + 382, /* (59) cmd ::= CREATE ENCRYPT_KEY NK_STRING */ + 382, /* (60) cmd ::= CREATE DNODE dnode_endpoint */ + 382, /* (61) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ + 382, /* (62) cmd ::= DROP DNODE NK_INTEGER force_opt */ + 382, /* (63) cmd ::= DROP DNODE dnode_endpoint force_opt */ + 382, /* (64) cmd ::= DROP DNODE NK_INTEGER unsafe_opt */ + 382, /* (65) cmd ::= DROP DNODE dnode_endpoint unsafe_opt */ + 382, /* (66) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ + 382, /* (67) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ + 382, /* (68) cmd ::= ALTER ALL DNODES NK_STRING */ + 382, /* (69) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ + 382, /* (70) cmd ::= RESTORE DNODE NK_INTEGER */ + 403, /* (71) dnode_endpoint ::= NK_STRING */ + 403, /* (72) dnode_endpoint ::= NK_ID */ + 403, /* (73) dnode_endpoint ::= NK_IPTOKEN */ + 404, /* (74) force_opt ::= */ + 404, /* (75) force_opt ::= FORCE */ + 405, /* (76) unsafe_opt ::= UNSAFE */ + 382, /* (77) cmd ::= ALTER CLUSTER NK_STRING */ + 382, /* (78) cmd ::= ALTER CLUSTER NK_STRING NK_STRING */ + 382, /* (79) cmd ::= ALTER LOCAL NK_STRING */ + 382, /* (80) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ + 382, /* (81) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ + 382, /* (82) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ + 382, /* (83) cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */ + 382, /* (84) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ + 382, /* (85) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ + 382, /* (86) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ + 382, /* (87) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ + 382, /* (88) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ + 382, /* (89) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ + 382, /* (90) cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */ + 382, /* (91) cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */ + 382, /* (92) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ + 382, /* (93) cmd ::= DROP DATABASE exists_opt db_name */ + 382, /* (94) cmd ::= USE db_name */ + 382, /* (95) cmd ::= ALTER DATABASE db_name alter_db_options */ + 382, /* (96) cmd ::= FLUSH DATABASE db_name */ + 382, /* (97) cmd ::= TRIM DATABASE db_name speed_opt */ + 382, /* (98) cmd ::= S3MIGRATE DATABASE db_name */ + 382, /* (99) cmd ::= COMPACT DATABASE db_name start_opt end_opt */ + 406, /* (100) not_exists_opt ::= IF NOT EXISTS */ + 406, /* (101) not_exists_opt ::= */ + 408, /* (102) exists_opt ::= IF EXISTS */ + 408, /* (103) exists_opt ::= */ + 407, /* (104) db_options ::= */ + 407, /* (105) db_options ::= db_options BUFFER NK_INTEGER */ + 407, /* (106) db_options ::= db_options CACHEMODEL NK_STRING */ + 407, /* (107) db_options ::= db_options CACHESIZE NK_INTEGER */ + 407, /* (108) db_options ::= db_options COMP NK_INTEGER */ + 407, /* (109) db_options ::= db_options DURATION NK_INTEGER */ + 407, /* (110) db_options ::= db_options DURATION NK_VARIABLE */ + 407, /* (111) db_options ::= db_options MAXROWS NK_INTEGER */ + 407, /* (112) db_options ::= db_options MINROWS NK_INTEGER */ + 407, /* (113) db_options ::= db_options KEEP integer_list */ + 407, /* (114) db_options ::= db_options KEEP variable_list */ + 407, /* (115) db_options ::= db_options PAGES NK_INTEGER */ + 407, /* (116) db_options ::= db_options PAGESIZE NK_INTEGER */ + 407, /* (117) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ + 407, /* (118) db_options ::= db_options PRECISION NK_STRING */ + 407, /* (119) db_options ::= db_options REPLICA NK_INTEGER */ + 407, /* (120) db_options ::= db_options VGROUPS NK_INTEGER */ + 407, /* (121) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ + 407, /* (122) db_options ::= db_options RETENTIONS retention_list */ + 407, /* (123) db_options ::= db_options SCHEMALESS NK_INTEGER */ + 407, /* (124) db_options ::= db_options WAL_LEVEL NK_INTEGER */ + 407, /* (125) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ + 407, /* (126) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ + 407, /* (127) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ + 407, /* (128) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ + 407, /* (129) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ + 407, /* (130) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ + 407, /* (131) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ + 407, /* (132) db_options ::= db_options STT_TRIGGER NK_INTEGER */ + 407, /* (133) db_options ::= db_options TABLE_PREFIX signed */ + 407, /* (134) db_options ::= db_options TABLE_SUFFIX signed */ + 407, /* (135) db_options ::= db_options S3_CHUNKSIZE NK_INTEGER */ + 407, /* (136) db_options ::= db_options S3_KEEPLOCAL NK_INTEGER */ + 407, /* (137) db_options ::= db_options S3_KEEPLOCAL NK_VARIABLE */ + 407, /* (138) db_options ::= db_options S3_COMPACT NK_INTEGER */ + 407, /* (139) db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */ + 407, /* (140) db_options ::= db_options ENCRYPT_ALGORITHM NK_STRING */ + 409, /* (141) alter_db_options ::= alter_db_option */ + 409, /* (142) alter_db_options ::= alter_db_options alter_db_option */ + 417, /* (143) alter_db_option ::= BUFFER NK_INTEGER */ + 417, /* (144) alter_db_option ::= CACHEMODEL NK_STRING */ + 417, /* (145) alter_db_option ::= CACHESIZE NK_INTEGER */ + 417, /* (146) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ + 417, /* (147) alter_db_option ::= KEEP integer_list */ + 417, /* (148) alter_db_option ::= KEEP variable_list */ + 417, /* (149) alter_db_option ::= PAGES NK_INTEGER */ + 417, /* (150) alter_db_option ::= REPLICA NK_INTEGER */ + 417, /* (151) alter_db_option ::= WAL_LEVEL NK_INTEGER */ + 417, /* (152) alter_db_option ::= STT_TRIGGER NK_INTEGER */ + 417, /* (153) alter_db_option ::= MINROWS NK_INTEGER */ + 417, /* (154) alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ + 417, /* (155) alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ + 417, /* (156) alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ + 417, /* (157) alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ + 417, /* (158) alter_db_option ::= S3_KEEPLOCAL NK_INTEGER */ + 417, /* (159) alter_db_option ::= S3_KEEPLOCAL NK_VARIABLE */ + 417, /* (160) alter_db_option ::= S3_COMPACT NK_INTEGER */ + 417, /* (161) alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */ + 417, /* (162) alter_db_option ::= ENCRYPT_ALGORITHM NK_STRING */ + 413, /* (163) integer_list ::= NK_INTEGER */ + 413, /* (164) integer_list ::= integer_list NK_COMMA NK_INTEGER */ + 414, /* (165) variable_list ::= NK_VARIABLE */ + 414, /* (166) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ + 415, /* (167) retention_list ::= retention */ + 415, /* (168) retention_list ::= retention_list NK_COMMA retention */ + 418, /* (169) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ + 418, /* (170) retention ::= NK_MINUS NK_COLON NK_VARIABLE */ + 410, /* (171) speed_opt ::= */ + 410, /* (172) speed_opt ::= BWLIMIT NK_INTEGER */ + 411, /* (173) start_opt ::= */ + 411, /* (174) start_opt ::= START WITH NK_INTEGER */ + 411, /* (175) start_opt ::= START WITH NK_STRING */ + 411, /* (176) start_opt ::= START WITH TIMESTAMP NK_STRING */ + 412, /* (177) end_opt ::= */ + 412, /* (178) end_opt ::= END WITH NK_INTEGER */ + 412, /* (179) end_opt ::= END WITH NK_STRING */ + 412, /* (180) end_opt ::= END WITH TIMESTAMP NK_STRING */ + 382, /* (181) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + 382, /* (182) cmd ::= CREATE TABLE multi_create_clause */ + 382, /* (183) cmd ::= CREATE TABLE not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING */ + 382, /* (184) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ + 382, /* (185) cmd ::= DROP TABLE multi_drop_clause */ + 382, /* (186) cmd ::= DROP STABLE exists_opt full_table_name */ + 382, /* (187) cmd ::= ALTER TABLE alter_table_clause */ + 382, /* (188) cmd ::= ALTER STABLE alter_table_clause */ + 427, /* (189) alter_table_clause ::= full_table_name alter_table_options */ + 427, /* (190) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options */ + 427, /* (191) alter_table_clause ::= full_table_name DROP COLUMN column_name */ + 427, /* (192) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + 427, /* (193) alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */ + 427, /* (194) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + 427, /* (195) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + 427, /* (196) alter_table_clause ::= full_table_name DROP TAG column_name */ + 427, /* (197) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + 427, /* (198) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + 427, /* (199) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal */ + 423, /* (200) multi_create_clause ::= create_subtable_clause */ + 423, /* (201) multi_create_clause ::= multi_create_clause create_subtable_clause */ + 433, /* (202) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */ + 426, /* (203) multi_drop_clause ::= drop_table_clause */ + 426, /* (204) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ + 436, /* (205) drop_table_clause ::= exists_opt full_table_name */ + 434, /* (206) specific_cols_opt ::= */ + 434, /* (207) specific_cols_opt ::= NK_LP col_name_list NK_RP */ + 419, /* (208) full_table_name ::= table_name */ + 419, /* (209) full_table_name ::= db_name NK_DOT table_name */ + 438, /* (210) tag_def_list ::= tag_def */ + 438, /* (211) tag_def_list ::= tag_def_list NK_COMMA tag_def */ + 439, /* (212) tag_def ::= column_name type_name */ + 420, /* (213) column_def_list ::= column_def */ + 420, /* (214) column_def_list ::= column_def_list NK_COMMA column_def */ + 440, /* (215) column_def ::= column_name type_name column_options */ + 430, /* (216) type_name ::= BOOL */ + 430, /* (217) type_name ::= TINYINT */ + 430, /* (218) type_name ::= SMALLINT */ + 430, /* (219) type_name ::= INT */ + 430, /* (220) type_name ::= INTEGER */ + 430, /* (221) type_name ::= BIGINT */ + 430, /* (222) type_name ::= FLOAT */ + 430, /* (223) type_name ::= DOUBLE */ + 430, /* (224) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + 430, /* (225) type_name ::= TIMESTAMP */ + 430, /* (226) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + 430, /* (227) type_name ::= TINYINT UNSIGNED */ + 430, /* (228) type_name ::= SMALLINT UNSIGNED */ + 430, /* (229) type_name ::= INT UNSIGNED */ + 430, /* (230) type_name ::= BIGINT UNSIGNED */ + 430, /* (231) type_name ::= JSON */ + 430, /* (232) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + 430, /* (233) type_name ::= MEDIUMBLOB */ + 430, /* (234) type_name ::= BLOB */ + 430, /* (235) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + 430, /* (236) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ + 430, /* (237) type_name ::= DECIMAL */ + 430, /* (238) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + 430, /* (239) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + 441, /* (240) type_name_default_len ::= BINARY */ + 441, /* (241) type_name_default_len ::= NCHAR */ + 441, /* (242) type_name_default_len ::= VARCHAR */ + 441, /* (243) type_name_default_len ::= VARBINARY */ + 421, /* (244) tags_def_opt ::= */ + 421, /* (245) tags_def_opt ::= tags_def */ + 425, /* (246) tags_def ::= TAGS NK_LP tag_def_list NK_RP */ + 422, /* (247) table_options ::= */ + 422, /* (248) table_options ::= table_options COMMENT NK_STRING */ + 422, /* (249) table_options ::= table_options MAX_DELAY duration_list */ + 422, /* (250) table_options ::= table_options WATERMARK duration_list */ + 422, /* (251) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + 422, /* (252) table_options ::= table_options TTL NK_INTEGER */ + 422, /* (253) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + 422, /* (254) table_options ::= table_options DELETE_MARK duration_list */ + 428, /* (255) alter_table_options ::= alter_table_option */ + 428, /* (256) alter_table_options ::= alter_table_options alter_table_option */ + 444, /* (257) alter_table_option ::= COMMENT NK_STRING */ + 444, /* (258) alter_table_option ::= TTL NK_INTEGER */ + 442, /* (259) duration_list ::= duration_literal */ + 442, /* (260) duration_list ::= duration_list NK_COMMA duration_literal */ + 443, /* (261) rollup_func_list ::= rollup_func_name */ + 443, /* (262) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ + 446, /* (263) rollup_func_name ::= function_name */ + 446, /* (264) rollup_func_name ::= FIRST */ + 446, /* (265) rollup_func_name ::= LAST */ + 437, /* (266) col_name_list ::= col_name */ + 437, /* (267) col_name_list ::= col_name_list NK_COMMA col_name */ + 448, /* (268) col_name ::= column_name */ + 382, /* (269) cmd ::= SHOW DNODES */ + 382, /* (270) cmd ::= SHOW USERS */ + 382, /* (271) cmd ::= SHOW USERS FULL */ + 382, /* (272) cmd ::= SHOW USER PRIVILEGES */ + 382, /* (273) cmd ::= SHOW db_kind_opt DATABASES */ + 382, /* (274) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ + 382, /* (275) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + 382, /* (276) cmd ::= SHOW db_name_cond_opt VGROUPS */ + 382, /* (277) cmd ::= SHOW MNODES */ + 382, /* (278) cmd ::= SHOW QNODES */ + 382, /* (279) cmd ::= SHOW ARBGROUPS */ + 382, /* (280) cmd ::= SHOW FUNCTIONS */ + 382, /* (281) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + 382, /* (282) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ + 382, /* (283) cmd ::= SHOW STREAMS */ + 382, /* (284) cmd ::= SHOW ACCOUNTS */ + 382, /* (285) cmd ::= SHOW APPS */ + 382, /* (286) cmd ::= SHOW CONNECTIONS */ + 382, /* (287) cmd ::= SHOW LICENCES */ + 382, /* (288) cmd ::= SHOW GRANTS */ + 382, /* (289) cmd ::= SHOW GRANTS FULL */ + 382, /* (290) cmd ::= SHOW GRANTS LOGS */ + 382, /* (291) cmd ::= SHOW CLUSTER MACHINES */ + 382, /* (292) cmd ::= SHOW CREATE DATABASE db_name */ + 382, /* (293) cmd ::= SHOW CREATE TABLE full_table_name */ + 382, /* (294) cmd ::= SHOW CREATE STABLE full_table_name */ + 382, /* (295) cmd ::= SHOW ENCRYPTIONS */ + 382, /* (296) cmd ::= SHOW QUERIES */ + 382, /* (297) cmd ::= SHOW SCORES */ + 382, /* (298) cmd ::= SHOW TOPICS */ + 382, /* (299) cmd ::= SHOW VARIABLES */ + 382, /* (300) cmd ::= SHOW CLUSTER VARIABLES */ + 382, /* (301) cmd ::= SHOW LOCAL VARIABLES */ + 382, /* (302) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ + 382, /* (303) cmd ::= SHOW BNODES */ + 382, /* (304) cmd ::= SHOW SNODES */ + 382, /* (305) cmd ::= SHOW CLUSTER */ + 382, /* (306) cmd ::= SHOW TRANSACTIONS */ + 382, /* (307) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + 382, /* (308) cmd ::= SHOW CONSUMERS */ + 382, /* (309) cmd ::= SHOW SUBSCRIPTIONS */ + 382, /* (310) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ + 382, /* (311) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ + 382, /* (312) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ + 382, /* (313) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ + 382, /* (314) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ + 382, /* (315) cmd ::= SHOW VNODES */ + 382, /* (316) cmd ::= SHOW db_name_cond_opt ALIVE */ + 382, /* (317) cmd ::= SHOW CLUSTER ALIVE */ + 382, /* (318) cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */ + 382, /* (319) cmd ::= SHOW CREATE VIEW full_table_name */ + 382, /* (320) cmd ::= SHOW COMPACTS */ + 382, /* (321) cmd ::= SHOW COMPACT NK_INTEGER */ + 450, /* (322) table_kind_db_name_cond_opt ::= */ + 450, /* (323) table_kind_db_name_cond_opt ::= table_kind */ + 450, /* (324) table_kind_db_name_cond_opt ::= db_name NK_DOT */ + 450, /* (325) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ + 455, /* (326) table_kind ::= NORMAL */ + 455, /* (327) table_kind ::= CHILD */ + 452, /* (328) db_name_cond_opt ::= */ + 452, /* (329) db_name_cond_opt ::= db_name NK_DOT */ + 451, /* (330) like_pattern_opt ::= */ + 451, /* (331) like_pattern_opt ::= LIKE NK_STRING */ + 453, /* (332) table_name_cond ::= table_name */ + 454, /* (333) from_db_opt ::= */ + 454, /* (334) from_db_opt ::= FROM db_name */ + 424, /* (335) tag_list_opt ::= */ + 424, /* (336) tag_list_opt ::= tag_item */ + 424, /* (337) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ + 456, /* (338) tag_item ::= TBNAME */ + 456, /* (339) tag_item ::= QTAGS */ + 456, /* (340) tag_item ::= column_name */ + 456, /* (341) tag_item ::= column_name column_alias */ + 456, /* (342) tag_item ::= column_name AS column_alias */ + 449, /* (343) db_kind_opt ::= */ + 449, /* (344) db_kind_opt ::= USER */ + 449, /* (345) db_kind_opt ::= SYSTEM */ + 382, /* (346) cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */ + 382, /* (347) cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */ + 382, /* (348) cmd ::= DROP TSMA exists_opt full_tsma_name */ + 382, /* (349) cmd ::= SHOW db_name_cond_opt TSMAS */ + 460, /* (350) full_tsma_name ::= tsma_name */ + 460, /* (351) full_tsma_name ::= db_name NK_DOT tsma_name */ + 459, /* (352) tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */ + 382, /* (353) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ + 382, /* (354) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ + 382, /* (355) cmd ::= DROP INDEX exists_opt full_index_name */ + 463, /* (356) full_index_name ::= index_name */ + 463, /* (357) full_index_name ::= db_name NK_DOT index_name */ + 462, /* (358) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + 462, /* (359) 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 */ + 461, /* (360) func_list ::= func */ + 461, /* (361) func_list ::= func_list NK_COMMA func */ + 467, /* (362) func ::= sma_func_name NK_LP expression_list NK_RP */ + 468, /* (363) sma_func_name ::= function_name */ + 468, /* (364) sma_func_name ::= COUNT */ + 468, /* (365) sma_func_name ::= FIRST */ + 468, /* (366) sma_func_name ::= LAST */ + 468, /* (367) sma_func_name ::= LAST_ROW */ + 466, /* (368) sma_stream_opt ::= */ + 466, /* (369) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ + 466, /* (370) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ + 466, /* (371) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ + 470, /* (372) with_meta ::= AS */ + 470, /* (373) with_meta ::= WITH META AS */ + 470, /* (374) with_meta ::= ONLY META AS */ + 382, /* (375) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ + 382, /* (376) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ + 382, /* (377) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ + 382, /* (378) cmd ::= DROP TOPIC exists_opt topic_name */ + 382, /* (379) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + 382, /* (380) cmd ::= DESC full_table_name */ + 382, /* (381) cmd ::= DESCRIBE full_table_name */ + 382, /* (382) cmd ::= RESET QUERY CACHE */ + 382, /* (383) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + 382, /* (384) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ + 474, /* (385) analyze_opt ::= */ + 474, /* (386) analyze_opt ::= ANALYZE */ + 475, /* (387) explain_options ::= */ + 475, /* (388) explain_options ::= explain_options VERBOSE NK_BOOL */ + 475, /* (389) explain_options ::= explain_options RATIO NK_FLOAT */ + 382, /* (390) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ + 382, /* (391) cmd ::= DROP FUNCTION exists_opt function_name */ + 478, /* (392) agg_func_opt ::= */ + 478, /* (393) agg_func_opt ::= AGGREGATE */ + 479, /* (394) bufsize_opt ::= */ + 479, /* (395) bufsize_opt ::= BUFSIZE NK_INTEGER */ + 480, /* (396) language_opt ::= */ + 480, /* (397) language_opt ::= LANGUAGE NK_STRING */ + 477, /* (398) or_replace_opt ::= */ + 477, /* (399) or_replace_opt ::= OR REPLACE */ + 382, /* (400) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ + 382, /* (401) cmd ::= DROP VIEW exists_opt full_view_name */ + 481, /* (402) full_view_name ::= view_name */ + 481, /* (403) full_view_name ::= db_name NK_DOT view_name */ + 382, /* (404) 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 */ + 382, /* (405) cmd ::= DROP STREAM exists_opt stream_name */ + 382, /* (406) cmd ::= PAUSE STREAM exists_opt stream_name */ + 382, /* (407) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ + 485, /* (408) col_list_opt ::= */ + 485, /* (409) col_list_opt ::= NK_LP column_stream_def_list NK_RP */ + 489, /* (410) column_stream_def_list ::= column_stream_def */ + 489, /* (411) column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ + 490, /* (412) column_stream_def ::= column_name stream_col_options */ + 491, /* (413) stream_col_options ::= */ + 491, /* (414) stream_col_options ::= stream_col_options PRIMARY KEY */ + 486, /* (415) tag_def_or_ref_opt ::= */ + 486, /* (416) tag_def_or_ref_opt ::= tags_def */ + 486, /* (417) tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ + 484, /* (418) stream_options ::= */ + 484, /* (419) stream_options ::= stream_options TRIGGER AT_ONCE */ + 484, /* (420) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + 484, /* (421) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + 484, /* (422) stream_options ::= stream_options WATERMARK duration_literal */ + 484, /* (423) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + 484, /* (424) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ + 484, /* (425) stream_options ::= stream_options DELETE_MARK duration_literal */ + 484, /* (426) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ + 487, /* (427) subtable_opt ::= */ + 487, /* (428) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + 488, /* (429) ignore_opt ::= */ + 488, /* (430) ignore_opt ::= IGNORE UNTREATED */ + 382, /* (431) cmd ::= KILL CONNECTION NK_INTEGER */ + 382, /* (432) cmd ::= KILL QUERY NK_STRING */ + 382, /* (433) cmd ::= KILL TRANSACTION NK_INTEGER */ + 382, /* (434) cmd ::= KILL COMPACT NK_INTEGER */ + 382, /* (435) cmd ::= BALANCE VGROUP */ + 382, /* (436) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ + 382, /* (437) cmd ::= BALANCE VGROUP LEADER DATABASE db_name */ + 382, /* (438) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + 382, /* (439) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + 382, /* (440) cmd ::= SPLIT VGROUP NK_INTEGER */ + 493, /* (441) on_vgroup_id ::= */ + 493, /* (442) on_vgroup_id ::= ON NK_INTEGER */ + 494, /* (443) dnode_list ::= DNODE NK_INTEGER */ + 494, /* (444) dnode_list ::= dnode_list DNODE NK_INTEGER */ + 382, /* (445) cmd ::= DELETE FROM full_table_name where_clause_opt */ + 382, /* (446) cmd ::= query_or_subquery */ + 382, /* (447) cmd ::= insert_query */ + 476, /* (448) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + 476, /* (449) insert_query ::= INSERT INTO full_table_name query_or_subquery */ + 432, /* (450) tags_literal ::= NK_INTEGER */ + 432, /* (451) tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ + 432, /* (452) tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ + 432, /* (453) tags_literal ::= NK_PLUS NK_INTEGER */ + 432, /* (454) tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ + 432, /* (455) tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ + 432, /* (456) tags_literal ::= NK_MINUS NK_INTEGER */ + 432, /* (457) tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ + 432, /* (458) tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ + 432, /* (459) tags_literal ::= NK_FLOAT */ + 432, /* (460) tags_literal ::= NK_PLUS NK_FLOAT */ + 432, /* (461) tags_literal ::= NK_MINUS NK_FLOAT */ + 432, /* (462) tags_literal ::= NK_BIN */ + 432, /* (463) tags_literal ::= NK_BIN NK_PLUS duration_literal */ + 432, /* (464) tags_literal ::= NK_BIN NK_MINUS duration_literal */ + 432, /* (465) tags_literal ::= NK_PLUS NK_BIN */ + 432, /* (466) tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ + 432, /* (467) tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ + 432, /* (468) tags_literal ::= NK_MINUS NK_BIN */ + 432, /* (469) tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ + 432, /* (470) tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ + 432, /* (471) tags_literal ::= NK_HEX */ + 432, /* (472) tags_literal ::= NK_HEX NK_PLUS duration_literal */ + 432, /* (473) tags_literal ::= NK_HEX NK_MINUS duration_literal */ + 432, /* (474) tags_literal ::= NK_PLUS NK_HEX */ + 432, /* (475) tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ + 432, /* (476) tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ + 432, /* (477) tags_literal ::= NK_MINUS NK_HEX */ + 432, /* (478) tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ + 432, /* (479) tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ + 432, /* (480) tags_literal ::= NK_STRING */ + 432, /* (481) tags_literal ::= NK_STRING NK_PLUS duration_literal */ + 432, /* (482) tags_literal ::= NK_STRING NK_MINUS duration_literal */ + 432, /* (483) tags_literal ::= NK_BOOL */ + 432, /* (484) tags_literal ::= NULL */ + 432, /* (485) tags_literal ::= literal_func */ + 432, /* (486) tags_literal ::= literal_func NK_PLUS duration_literal */ + 432, /* (487) tags_literal ::= literal_func NK_MINUS duration_literal */ + 435, /* (488) tags_literal_list ::= tags_literal */ + 435, /* (489) tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ + 385, /* (490) literal ::= NK_INTEGER */ + 385, /* (491) literal ::= NK_FLOAT */ + 385, /* (492) literal ::= NK_STRING */ + 385, /* (493) literal ::= NK_BOOL */ + 385, /* (494) literal ::= TIMESTAMP NK_STRING */ + 385, /* (495) literal ::= duration_literal */ + 385, /* (496) literal ::= NULL */ + 385, /* (497) literal ::= NK_QUESTION */ + 445, /* (498) duration_literal ::= NK_VARIABLE */ + 416, /* (499) signed ::= NK_INTEGER */ + 416, /* (500) signed ::= NK_PLUS NK_INTEGER */ + 416, /* (501) signed ::= NK_MINUS NK_INTEGER */ + 416, /* (502) signed ::= NK_FLOAT */ + 416, /* (503) signed ::= NK_PLUS NK_FLOAT */ + 416, /* (504) signed ::= NK_MINUS NK_FLOAT */ + 496, /* (505) signed_literal ::= signed */ + 496, /* (506) signed_literal ::= NK_STRING */ + 496, /* (507) signed_literal ::= NK_BOOL */ + 496, /* (508) signed_literal ::= TIMESTAMP NK_STRING */ + 496, /* (509) signed_literal ::= duration_literal */ + 496, /* (510) signed_literal ::= NULL */ + 496, /* (511) signed_literal ::= literal_func */ + 496, /* (512) signed_literal ::= NK_QUESTION */ + 497, /* (513) literal_list ::= signed_literal */ + 497, /* (514) literal_list ::= literal_list NK_COMMA signed_literal */ + 399, /* (515) db_name ::= NK_ID */ + 400, /* (516) table_name ::= NK_ID */ + 429, /* (517) column_name ::= NK_ID */ + 447, /* (518) function_name ::= NK_ID */ + 482, /* (519) view_name ::= NK_ID */ + 498, /* (520) table_alias ::= NK_ID */ + 457, /* (521) column_alias ::= NK_ID */ + 457, /* (522) column_alias ::= NK_ALIAS */ + 392, /* (523) user_name ::= NK_ID */ + 401, /* (524) topic_name ::= NK_ID */ + 483, /* (525) stream_name ::= NK_ID */ + 473, /* (526) cgroup_name ::= NK_ID */ + 464, /* (527) index_name ::= NK_ID */ + 458, /* (528) tsma_name ::= NK_ID */ + 499, /* (529) expr_or_subquery ::= expression */ + 492, /* (530) expression ::= literal */ + 492, /* (531) expression ::= pseudo_column */ + 492, /* (532) expression ::= column_reference */ + 492, /* (533) expression ::= function_expression */ + 492, /* (534) expression ::= case_when_expression */ + 492, /* (535) expression ::= NK_LP expression NK_RP */ + 492, /* (536) expression ::= NK_PLUS expr_or_subquery */ + 492, /* (537) expression ::= NK_MINUS expr_or_subquery */ + 492, /* (538) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + 492, /* (539) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + 492, /* (540) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + 492, /* (541) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + 492, /* (542) expression ::= expr_or_subquery NK_REM expr_or_subquery */ + 492, /* (543) expression ::= column_reference NK_ARROW NK_STRING */ + 492, /* (544) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + 492, /* (545) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + 469, /* (546) expression_list ::= expr_or_subquery */ + 469, /* (547) expression_list ::= expression_list NK_COMMA expr_or_subquery */ + 501, /* (548) column_reference ::= column_name */ + 501, /* (549) column_reference ::= table_name NK_DOT column_name */ + 501, /* (550) column_reference ::= NK_ALIAS */ + 501, /* (551) column_reference ::= table_name NK_DOT NK_ALIAS */ + 500, /* (552) pseudo_column ::= ROWTS */ + 500, /* (553) pseudo_column ::= TBNAME */ + 500, /* (554) pseudo_column ::= table_name NK_DOT TBNAME */ + 500, /* (555) pseudo_column ::= QSTART */ + 500, /* (556) pseudo_column ::= QEND */ + 500, /* (557) pseudo_column ::= QDURATION */ + 500, /* (558) pseudo_column ::= WSTART */ + 500, /* (559) pseudo_column ::= WEND */ + 500, /* (560) pseudo_column ::= WDURATION */ + 500, /* (561) pseudo_column ::= IROWTS */ + 500, /* (562) pseudo_column ::= ISFILLED */ + 500, /* (563) pseudo_column ::= QTAGS */ + 502, /* (564) function_expression ::= function_name NK_LP expression_list NK_RP */ + 502, /* (565) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + 502, /* (566) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + 502, /* (567) function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ + 502, /* (568) function_expression ::= POSITION NK_LP expr_or_subquery IN expr_or_subquery NK_RP */ + 502, /* (569) function_expression ::= TRIM NK_LP expr_or_subquery NK_RP */ + 502, /* (570) function_expression ::= TRIM NK_LP trim_specification_type FROM expr_or_subquery NK_RP */ + 502, /* (571) function_expression ::= TRIM NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ + 502, /* (572) function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP */ + 502, /* (573) function_expression ::= substr_func NK_LP expression_list NK_RP */ + 502, /* (574) function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ + 502, /* (575) function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP */ + 502, /* (576) function_expression ::= REPLACE NK_LP expression_list NK_RP */ + 502, /* (577) function_expression ::= literal_func */ + 495, /* (578) literal_func ::= noarg_func NK_LP NK_RP */ + 495, /* (579) literal_func ::= NOW */ + 495, /* (580) literal_func ::= TODAY */ + 507, /* (581) substr_func ::= SUBSTR */ + 507, /* (582) substr_func ::= SUBSTRING */ + 506, /* (583) trim_specification_type ::= BOTH */ + 506, /* (584) trim_specification_type ::= TRAILING */ + 506, /* (585) trim_specification_type ::= LEADING */ + 508, /* (586) noarg_func ::= NOW */ + 508, /* (587) noarg_func ::= TODAY */ + 508, /* (588) noarg_func ::= TIMEZONE */ + 508, /* (589) noarg_func ::= DATABASE */ + 508, /* (590) noarg_func ::= CLIENT_VERSION */ + 508, /* (591) noarg_func ::= SERVER_VERSION */ + 508, /* (592) noarg_func ::= SERVER_STATUS */ + 508, /* (593) noarg_func ::= CURRENT_USER */ + 508, /* (594) noarg_func ::= USER */ + 508, /* (595) noarg_func ::= PI */ + 504, /* (596) star_func ::= COUNT */ + 504, /* (597) star_func ::= FIRST */ + 504, /* (598) star_func ::= LAST */ + 504, /* (599) star_func ::= LAST_ROW */ + 505, /* (600) star_func_para_list ::= NK_STAR */ + 505, /* (601) star_func_para_list ::= other_para_list */ + 509, /* (602) other_para_list ::= star_func_para */ + 509, /* (603) other_para_list ::= other_para_list NK_COMMA star_func_para */ + 510, /* (604) star_func_para ::= expr_or_subquery */ + 510, /* (605) star_func_para ::= table_name NK_DOT NK_STAR */ + 503, /* (606) case_when_expression ::= CASE when_then_list case_when_else_opt END */ + 503, /* (607) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + 511, /* (608) when_then_list ::= when_then_expr */ + 511, /* (609) when_then_list ::= when_then_list when_then_expr */ + 514, /* (610) when_then_expr ::= WHEN common_expression THEN common_expression */ + 512, /* (611) case_when_else_opt ::= */ + 512, /* (612) case_when_else_opt ::= ELSE common_expression */ + 515, /* (613) predicate ::= expr_or_subquery compare_op expr_or_subquery */ + 515, /* (614) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + 515, /* (615) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + 515, /* (616) predicate ::= expr_or_subquery IS NULL */ + 515, /* (617) predicate ::= expr_or_subquery IS NOT NULL */ + 515, /* (618) predicate ::= expr_or_subquery in_op in_predicate_value */ + 516, /* (619) compare_op ::= NK_LT */ + 516, /* (620) compare_op ::= NK_GT */ + 516, /* (621) compare_op ::= NK_LE */ + 516, /* (622) compare_op ::= NK_GE */ + 516, /* (623) compare_op ::= NK_NE */ + 516, /* (624) compare_op ::= NK_EQ */ + 516, /* (625) compare_op ::= LIKE */ + 516, /* (626) compare_op ::= NOT LIKE */ + 516, /* (627) compare_op ::= MATCH */ + 516, /* (628) compare_op ::= NMATCH */ + 516, /* (629) compare_op ::= CONTAINS */ + 517, /* (630) in_op ::= IN */ + 517, /* (631) in_op ::= NOT IN */ + 518, /* (632) in_predicate_value ::= NK_LP literal_list NK_RP */ + 519, /* (633) boolean_value_expression ::= boolean_primary */ + 519, /* (634) boolean_value_expression ::= NOT boolean_primary */ + 519, /* (635) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + 519, /* (636) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + 520, /* (637) boolean_primary ::= predicate */ + 520, /* (638) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + 513, /* (639) common_expression ::= expr_or_subquery */ + 513, /* (640) common_expression ::= boolean_value_expression */ + 521, /* (641) from_clause_opt ::= */ + 521, /* (642) from_clause_opt ::= FROM table_reference_list */ + 522, /* (643) table_reference_list ::= table_reference */ + 522, /* (644) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + 523, /* (645) table_reference ::= table_primary */ + 523, /* (646) table_reference ::= joined_table */ + 524, /* (647) table_primary ::= table_name alias_opt */ + 524, /* (648) table_primary ::= db_name NK_DOT table_name alias_opt */ + 524, /* (649) table_primary ::= subquery alias_opt */ + 524, /* (650) table_primary ::= parenthesized_joined_table */ + 526, /* (651) alias_opt ::= */ + 526, /* (652) alias_opt ::= table_alias */ + 526, /* (653) alias_opt ::= AS table_alias */ + 528, /* (654) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + 528, /* (655) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + 525, /* (656) joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ + 529, /* (657) join_type ::= */ + 529, /* (658) join_type ::= INNER */ + 529, /* (659) join_type ::= LEFT */ + 529, /* (660) join_type ::= RIGHT */ + 529, /* (661) join_type ::= FULL */ + 530, /* (662) join_subtype ::= */ + 530, /* (663) join_subtype ::= OUTER */ + 530, /* (664) join_subtype ::= SEMI */ + 530, /* (665) join_subtype ::= ANTI */ + 530, /* (666) join_subtype ::= ASOF */ + 530, /* (667) join_subtype ::= WINDOW */ + 531, /* (668) join_on_clause_opt ::= */ + 531, /* (669) join_on_clause_opt ::= ON search_condition */ + 532, /* (670) window_offset_clause_opt ::= */ + 532, /* (671) window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ + 534, /* (672) window_offset_literal ::= NK_VARIABLE */ + 534, /* (673) window_offset_literal ::= NK_MINUS NK_VARIABLE */ + 533, /* (674) jlimit_clause_opt ::= */ + 533, /* (675) jlimit_clause_opt ::= JLIMIT NK_INTEGER */ + 535, /* (676) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + 536, /* (677) hint_list ::= */ + 536, /* (678) hint_list ::= NK_HINT */ + 538, /* (679) tag_mode_opt ::= */ + 538, /* (680) tag_mode_opt ::= TAGS */ + 537, /* (681) set_quantifier_opt ::= */ + 537, /* (682) set_quantifier_opt ::= DISTINCT */ + 537, /* (683) set_quantifier_opt ::= ALL */ + 539, /* (684) select_list ::= select_item */ + 539, /* (685) select_list ::= select_list NK_COMMA select_item */ + 547, /* (686) select_item ::= NK_STAR */ + 547, /* (687) select_item ::= common_expression */ + 547, /* (688) select_item ::= common_expression column_alias */ + 547, /* (689) select_item ::= common_expression AS column_alias */ + 547, /* (690) select_item ::= table_name NK_DOT NK_STAR */ + 472, /* (691) where_clause_opt ::= */ + 472, /* (692) where_clause_opt ::= WHERE search_condition */ + 540, /* (693) partition_by_clause_opt ::= */ + 540, /* (694) partition_by_clause_opt ::= PARTITION BY partition_list */ + 548, /* (695) partition_list ::= partition_item */ + 548, /* (696) partition_list ::= partition_list NK_COMMA partition_item */ + 549, /* (697) partition_item ::= expr_or_subquery */ + 549, /* (698) partition_item ::= expr_or_subquery column_alias */ + 549, /* (699) partition_item ::= expr_or_subquery AS column_alias */ + 544, /* (700) twindow_clause_opt ::= */ + 544, /* (701) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ + 544, /* (702) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + 544, /* (703) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ + 544, /* (704) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ + 544, /* (705) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ + 544, /* (706) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ + 544, /* (707) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + 465, /* (708) sliding_opt ::= */ + 465, /* (709) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ + 550, /* (710) interval_sliding_duration_literal ::= NK_VARIABLE */ + 550, /* (711) interval_sliding_duration_literal ::= NK_STRING */ + 550, /* (712) interval_sliding_duration_literal ::= NK_INTEGER */ + 543, /* (713) fill_opt ::= */ + 543, /* (714) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + 543, /* (715) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ + 543, /* (716) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ + 551, /* (717) fill_mode ::= NONE */ + 551, /* (718) fill_mode ::= PREV */ + 551, /* (719) fill_mode ::= NULL */ + 551, /* (720) fill_mode ::= NULL_F */ + 551, /* (721) fill_mode ::= LINEAR */ + 551, /* (722) fill_mode ::= NEXT */ + 545, /* (723) group_by_clause_opt ::= */ + 545, /* (724) group_by_clause_opt ::= GROUP BY group_by_list */ + 552, /* (725) group_by_list ::= expr_or_subquery */ + 552, /* (726) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + 546, /* (727) having_clause_opt ::= */ + 546, /* (728) having_clause_opt ::= HAVING search_condition */ + 541, /* (729) range_opt ::= */ + 541, /* (730) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + 541, /* (731) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ + 542, /* (732) every_opt ::= */ + 542, /* (733) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + 553, /* (734) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + 554, /* (735) query_simple ::= query_specification */ + 554, /* (736) query_simple ::= union_query_expression */ + 558, /* (737) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + 558, /* (738) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + 559, /* (739) query_simple_or_subquery ::= query_simple */ + 559, /* (740) query_simple_or_subquery ::= subquery */ + 471, /* (741) query_or_subquery ::= query_expression */ + 471, /* (742) query_or_subquery ::= subquery */ + 555, /* (743) order_by_clause_opt ::= */ + 555, /* (744) order_by_clause_opt ::= ORDER BY sort_specification_list */ + 556, /* (745) slimit_clause_opt ::= */ + 556, /* (746) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + 556, /* (747) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + 556, /* (748) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 557, /* (749) limit_clause_opt ::= */ + 557, /* (750) limit_clause_opt ::= LIMIT NK_INTEGER */ + 557, /* (751) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + 557, /* (752) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 527, /* (753) subquery ::= NK_LP query_expression NK_RP */ + 527, /* (754) subquery ::= NK_LP subquery NK_RP */ + 402, /* (755) search_condition ::= common_expression */ + 560, /* (756) sort_specification_list ::= sort_specification */ + 560, /* (757) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + 561, /* (758) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + 562, /* (759) ordering_specification_opt ::= */ + 562, /* (760) ordering_specification_opt ::= ASC */ + 562, /* (761) ordering_specification_opt ::= DESC */ + 563, /* (762) null_ordering_opt ::= */ + 563, /* (763) null_ordering_opt ::= NULLS FIRST */ + 563, /* (764) null_ordering_opt ::= NULLS LAST */ + 431, /* (765) column_options ::= */ + 431, /* (766) column_options ::= column_options PRIMARY KEY */ + 431, /* (767) column_options ::= column_options NK_ID NK_STRING */ }; /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number @@ -5778,9 +5794,7 @@ static const signed char yyRuleInfoNRhs[] = { -2, /* (764) null_ordering_opt ::= NULLS LAST */ 0, /* (765) column_options ::= */ -3, /* (766) column_options ::= column_options PRIMARY KEY */ - -3, /* (767) column_options ::= column_options ENCODE NK_STRING */ - -3, /* (768) column_options ::= column_options COMPRESS NK_STRING */ - -3, /* (769) column_options ::= column_options LEVEL NK_STRING */ + -3, /* (767) column_options ::= column_options NK_ID NK_STRING */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -5824,11 +5838,11 @@ static YYACTIONTYPE yy_reduce( YYMINORTYPE yylhsminor; case 0: /* cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } - yy_destructor(yypParser,386,&yymsp[0].minor); + yy_destructor(yypParser,383,&yymsp[0].minor); break; case 1: /* cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } - yy_destructor(yypParser,387,&yymsp[0].minor); + yy_destructor(yypParser,384,&yymsp[0].minor); break; case 2: /* account_options ::= */ { } @@ -5842,20 +5856,20 @@ static YYACTIONTYPE yy_reduce( case 9: /* account_options ::= account_options USERS literal */ yytestcase(yyruleno==9); case 10: /* account_options ::= account_options CONNS literal */ yytestcase(yyruleno==10); case 11: /* account_options ::= account_options STATE literal */ yytestcase(yyruleno==11); - { yy_destructor(yypParser,386,&yymsp[-2].minor); + { yy_destructor(yypParser,383,&yymsp[-2].minor); { } - yy_destructor(yypParser,388,&yymsp[0].minor); + yy_destructor(yypParser,385,&yymsp[0].minor); } break; case 12: /* alter_account_options ::= alter_account_option */ - { yy_destructor(yypParser,389,&yymsp[0].minor); + { yy_destructor(yypParser,386,&yymsp[0].minor); { } } break; case 13: /* alter_account_options ::= alter_account_options alter_account_option */ - { yy_destructor(yypParser,387,&yymsp[-1].minor); + { yy_destructor(yypParser,384,&yymsp[-1].minor); { } - yy_destructor(yypParser,389,&yymsp[0].minor); + yy_destructor(yypParser,386,&yymsp[0].minor); } break; case 14: /* alter_account_option ::= PASS literal */ @@ -5869,18 +5883,18 @@ static YYACTIONTYPE yy_reduce( case 22: /* alter_account_option ::= CONNS literal */ yytestcase(yyruleno==22); case 23: /* alter_account_option ::= STATE literal */ yytestcase(yyruleno==23); { } - yy_destructor(yypParser,388,&yymsp[0].minor); + yy_destructor(yypParser,385,&yymsp[0].minor); break; case 24: /* ip_range_list ::= NK_STRING */ - { yylhsminor.yy334 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy334 = yylhsminor.yy334; + { yylhsminor.yy928 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy928 = yylhsminor.yy928; break; case 25: /* ip_range_list ::= ip_range_list NK_COMMA NK_STRING */ - { yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy334 = yylhsminor.yy334; + { yylhsminor.yy928 = addNodeToList(pCxt, yymsp[-2].minor.yy928, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy928 = yylhsminor.yy928; break; case 26: /* white_list ::= HOST ip_range_list */ - { yymsp[-1].minor.yy334 = yymsp[0].minor.yy334; } + { yymsp[-1].minor.yy928 = yymsp[0].minor.yy928; } break; case 27: /* white_list_opt ::= */ case 206: /* specific_cols_opt ::= */ yytestcase(yyruleno==206); @@ -5891,99 +5905,99 @@ static YYACTIONTYPE yy_reduce( case 693: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==693); case 723: /* group_by_clause_opt ::= */ yytestcase(yyruleno==723); case 743: /* order_by_clause_opt ::= */ yytestcase(yyruleno==743); - { yymsp[1].minor.yy334 = NULL; } + { yymsp[1].minor.yy928 = NULL; } break; case 28: /* white_list_opt ::= white_list */ case 245: /* tags_def_opt ::= tags_def */ yytestcase(yyruleno==245); case 416: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==416); case 601: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==601); - { yylhsminor.yy334 = yymsp[0].minor.yy334; } - yymsp[0].minor.yy334 = yylhsminor.yy334; + { yylhsminor.yy928 = yymsp[0].minor.yy928; } + yymsp[0].minor.yy928 = yylhsminor.yy928; break; case 29: /* is_import_opt ::= */ case 31: /* is_createdb_opt ::= */ yytestcase(yyruleno==31); - { yymsp[1].minor.yy719 = 0; } + { yymsp[1].minor.yy695 = 0; } break; case 30: /* is_import_opt ::= IS_IMPORT NK_INTEGER */ case 32: /* is_createdb_opt ::= CREATEDB NK_INTEGER */ yytestcase(yyruleno==32); case 42: /* sysinfo_opt ::= SYSINFO NK_INTEGER */ yytestcase(yyruleno==42); - { yymsp[-1].minor.yy719 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } + { yymsp[-1].minor.yy695 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } break; case 33: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt is_createdb_opt is_import_opt white_list_opt */ { - pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-6].minor.yy533, &yymsp[-4].minor.yy0, yymsp[-3].minor.yy719, yymsp[-1].minor.yy719, yymsp[-2].minor.yy719); - pCxt->pRootNode = addCreateUserStmtWhiteList(pCxt, pCxt->pRootNode, yymsp[0].minor.yy334); + pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-6].minor.yy401, &yymsp[-4].minor.yy0, yymsp[-3].minor.yy695, yymsp[-1].minor.yy695, yymsp[-2].minor.yy695); + pCxt->pRootNode = addCreateUserStmtWhiteList(pCxt, pCxt->pRootNode, yymsp[0].minor.yy928); } break; case 34: /* cmd ::= ALTER USER user_name PASS NK_STRING */ - { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy533, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } + { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy401, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } break; case 35: /* cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ - { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy533, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } + { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy401, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } break; case 36: /* cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ - { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy533, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } + { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy401, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } break; case 37: /* cmd ::= ALTER USER user_name CREATEDB NK_INTEGER */ - { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy533, TSDB_ALTER_USER_CREATEDB, &yymsp[0].minor.yy0); } + { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy401, TSDB_ALTER_USER_CREATEDB, &yymsp[0].minor.yy0); } break; case 38: /* cmd ::= ALTER USER user_name ADD white_list */ - { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy533, TSDB_ALTER_USER_ADD_WHITE_LIST, yymsp[0].minor.yy334); } + { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy401, TSDB_ALTER_USER_ADD_WHITE_LIST, yymsp[0].minor.yy928); } break; case 39: /* cmd ::= ALTER USER user_name DROP white_list */ - { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy533, TSDB_ALTER_USER_DROP_WHITE_LIST, yymsp[0].minor.yy334); } + { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy401, TSDB_ALTER_USER_DROP_WHITE_LIST, yymsp[0].minor.yy928); } break; case 40: /* cmd ::= DROP USER user_name */ - { pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy533); } + { pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy401); } break; case 41: /* sysinfo_opt ::= */ - { yymsp[1].minor.yy719 = 1; } + { yymsp[1].minor.yy695 = 1; } break; case 43: /* cmd ::= GRANT privileges ON priv_level with_opt TO user_name */ - { pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-5].minor.yy585, &yymsp[-3].minor.yy399, &yymsp[0].minor.yy533, yymsp[-2].minor.yy560); } + { pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-5].minor.yy525, &yymsp[-3].minor.yy1041, &yymsp[0].minor.yy401, yymsp[-2].minor.yy248); } break; case 44: /* cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */ - { pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy585, &yymsp[-3].minor.yy399, &yymsp[0].minor.yy533, yymsp[-2].minor.yy560); } + { pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy525, &yymsp[-3].minor.yy1041, &yymsp[0].minor.yy401, yymsp[-2].minor.yy248); } break; case 45: /* privileges ::= ALL */ - { yymsp[0].minor.yy585 = PRIVILEGE_TYPE_ALL; } + { yymsp[0].minor.yy525 = PRIVILEGE_TYPE_ALL; } break; case 46: /* privileges ::= priv_type_list */ case 48: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==48); - { yylhsminor.yy585 = yymsp[0].minor.yy585; } - yymsp[0].minor.yy585 = yylhsminor.yy585; + { yylhsminor.yy525 = yymsp[0].minor.yy525; } + yymsp[0].minor.yy525 = yylhsminor.yy525; break; case 47: /* privileges ::= SUBSCRIBE */ - { yymsp[0].minor.yy585 = PRIVILEGE_TYPE_SUBSCRIBE; } + { yymsp[0].minor.yy525 = PRIVILEGE_TYPE_SUBSCRIBE; } break; case 49: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */ - { yylhsminor.yy585 = yymsp[-2].minor.yy585 | yymsp[0].minor.yy585; } - yymsp[-2].minor.yy585 = yylhsminor.yy585; + { yylhsminor.yy525 = yymsp[-2].minor.yy525 | yymsp[0].minor.yy525; } + yymsp[-2].minor.yy525 = yylhsminor.yy525; break; case 50: /* priv_type ::= READ */ - { yymsp[0].minor.yy585 = PRIVILEGE_TYPE_READ; } + { yymsp[0].minor.yy525 = PRIVILEGE_TYPE_READ; } break; case 51: /* priv_type ::= WRITE */ - { yymsp[0].minor.yy585 = PRIVILEGE_TYPE_WRITE; } + { yymsp[0].minor.yy525 = PRIVILEGE_TYPE_WRITE; } break; case 52: /* priv_type ::= ALTER */ - { yymsp[0].minor.yy585 = PRIVILEGE_TYPE_ALTER; } + { yymsp[0].minor.yy525 = PRIVILEGE_TYPE_ALTER; } break; case 53: /* priv_level ::= NK_STAR NK_DOT NK_STAR */ - { yylhsminor.yy399.first = yymsp[-2].minor.yy0; yylhsminor.yy399.second = yymsp[0].minor.yy0; } - yymsp[-2].minor.yy399 = yylhsminor.yy399; + { yylhsminor.yy1041.first = yymsp[-2].minor.yy0; yylhsminor.yy1041.second = yymsp[0].minor.yy0; } + yymsp[-2].minor.yy1041 = yylhsminor.yy1041; break; case 54: /* priv_level ::= db_name NK_DOT NK_STAR */ - { yylhsminor.yy399.first = yymsp[-2].minor.yy533; yylhsminor.yy399.second = yymsp[0].minor.yy0; } - yymsp[-2].minor.yy399 = yylhsminor.yy399; + { yylhsminor.yy1041.first = yymsp[-2].minor.yy401; yylhsminor.yy1041.second = yymsp[0].minor.yy0; } + yymsp[-2].minor.yy1041 = yylhsminor.yy1041; break; case 55: /* priv_level ::= db_name NK_DOT table_name */ - { yylhsminor.yy399.first = yymsp[-2].minor.yy533; yylhsminor.yy399.second = yymsp[0].minor.yy533; } - yymsp[-2].minor.yy399 = yylhsminor.yy399; + { yylhsminor.yy1041.first = yymsp[-2].minor.yy401; yylhsminor.yy1041.second = yymsp[0].minor.yy401; } + yymsp[-2].minor.yy1041 = yylhsminor.yy1041; break; case 56: /* priv_level ::= topic_name */ - { yylhsminor.yy399.first = yymsp[0].minor.yy533; yylhsminor.yy399.second = nil_token; } - yymsp[0].minor.yy399 = yylhsminor.yy399; + { yylhsminor.yy1041.first = yymsp[0].minor.yy401; yylhsminor.yy1041.second = nil_token; } + yymsp[0].minor.yy1041 = yylhsminor.yy1041; break; case 57: /* with_opt ::= */ case 173: /* start_opt ::= */ yytestcase(yyruleno==173); @@ -6004,35 +6018,35 @@ static YYACTIONTYPE yy_reduce( case 732: /* every_opt ::= */ yytestcase(yyruleno==732); case 745: /* slimit_clause_opt ::= */ yytestcase(yyruleno==745); case 749: /* limit_clause_opt ::= */ yytestcase(yyruleno==749); - { yymsp[1].minor.yy560 = NULL; } + { yymsp[1].minor.yy248 = NULL; } break; case 58: /* with_opt ::= WITH search_condition */ case 642: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==642); case 669: /* join_on_clause_opt ::= ON search_condition */ yytestcase(yyruleno==669); case 692: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==692); case 728: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==728); - { yymsp[-1].minor.yy560 = yymsp[0].minor.yy560; } + { yymsp[-1].minor.yy248 = yymsp[0].minor.yy248; } break; case 59: /* cmd ::= CREATE ENCRYPT_KEY NK_STRING */ { pCxt->pRootNode = createEncryptKeyStmt(pCxt, &yymsp[0].minor.yy0); } break; case 60: /* cmd ::= CREATE DNODE dnode_endpoint */ - { pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy533, NULL); } + { pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy401, NULL); } break; case 61: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ - { pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy0); } + { pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy401, &yymsp[0].minor.yy0); } break; case 62: /* cmd ::= DROP DNODE NK_INTEGER force_opt */ - { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy173, false); } + { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy89, false); } break; case 63: /* cmd ::= DROP DNODE dnode_endpoint force_opt */ - { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy533, yymsp[0].minor.yy173, false); } + { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy401, yymsp[0].minor.yy89, false); } break; case 64: /* cmd ::= DROP DNODE NK_INTEGER unsafe_opt */ - { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, false, yymsp[0].minor.yy173); } + { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, false, yymsp[0].minor.yy89); } break; case 65: /* cmd ::= DROP DNODE dnode_endpoint unsafe_opt */ - { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy533, false, yymsp[0].minor.yy173); } + { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy401, false, yymsp[0].minor.yy89); } break; case 66: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } @@ -6086,8 +6100,8 @@ static YYACTIONTYPE yy_reduce( case 597: /* star_func ::= FIRST */ yytestcase(yyruleno==597); case 598: /* star_func ::= LAST */ yytestcase(yyruleno==598); case 599: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==599); - { yylhsminor.yy533 = yymsp[0].minor.yy0; } - yymsp[0].minor.yy533 = yylhsminor.yy533; + { yylhsminor.yy401 = yymsp[0].minor.yy0; } + yymsp[0].minor.yy401 = yylhsminor.yy401; break; case 74: /* force_opt ::= */ case 101: /* not_exists_opt ::= */ yytestcase(yyruleno==101); @@ -6098,7 +6112,7 @@ static YYACTIONTYPE yy_reduce( case 429: /* ignore_opt ::= */ yytestcase(yyruleno==429); case 679: /* tag_mode_opt ::= */ yytestcase(yyruleno==679); case 681: /* set_quantifier_opt ::= */ yytestcase(yyruleno==681); - { yymsp[1].minor.yy173 = false; } + { yymsp[1].minor.yy89 = false; } break; case 75: /* force_opt ::= FORCE */ case 76: /* unsafe_opt ::= UNSAFE */ yytestcase(yyruleno==76); @@ -6106,7 +6120,7 @@ static YYACTIONTYPE yy_reduce( case 393: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==393); case 680: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==680); case 682: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==682); - { yymsp[0].minor.yy173 = true; } + { yymsp[0].minor.yy89 = true; } break; case 77: /* cmd ::= ALTER CLUSTER NK_STRING */ { pCxt->pRootNode = createAlterClusterStmt(pCxt, &yymsp[0].minor.yy0, NULL); } @@ -6154,271 +6168,271 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_VNODE_STMT, &yymsp[0].minor.yy0); } break; case 92: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ - { pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy173, &yymsp[-1].minor.yy533, yymsp[0].minor.yy560); } + { pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy89, &yymsp[-1].minor.yy401, yymsp[0].minor.yy248); } break; case 93: /* cmd ::= DROP DATABASE exists_opt db_name */ - { pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy173, &yymsp[0].minor.yy533); } + { pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy89, &yymsp[0].minor.yy401); } break; case 94: /* cmd ::= USE db_name */ - { pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy533); } + { pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy401); } break; case 95: /* cmd ::= ALTER DATABASE db_name alter_db_options */ - { pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy533, yymsp[0].minor.yy560); } + { pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy401, yymsp[0].minor.yy248); } break; case 96: /* cmd ::= FLUSH DATABASE db_name */ - { pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy533); } + { pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy401); } break; case 97: /* cmd ::= TRIM DATABASE db_name speed_opt */ - { pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy533, yymsp[0].minor.yy802); } + { pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy401, yymsp[0].minor.yy604); } break; case 98: /* cmd ::= S3MIGRATE DATABASE db_name */ - { pCxt->pRootNode = createS3MigrateDatabaseStmt(pCxt, &yymsp[0].minor.yy533); } + { pCxt->pRootNode = createS3MigrateDatabaseStmt(pCxt, &yymsp[0].minor.yy401); } break; case 99: /* cmd ::= COMPACT DATABASE db_name start_opt end_opt */ - { pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy533, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } + { pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy401, yymsp[-1].minor.yy248, yymsp[0].minor.yy248); } break; case 100: /* not_exists_opt ::= IF NOT EXISTS */ - { yymsp[-2].minor.yy173 = true; } + { yymsp[-2].minor.yy89 = true; } break; case 102: /* exists_opt ::= IF EXISTS */ case 399: /* or_replace_opt ::= OR REPLACE */ yytestcase(yyruleno==399); case 430: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==430); - { yymsp[-1].minor.yy173 = true; } + { yymsp[-1].minor.yy89 = true; } break; case 104: /* db_options ::= */ - { yymsp[1].minor.yy560 = createDefaultDatabaseOptions(pCxt); } + { yymsp[1].minor.yy248 = createDefaultDatabaseOptions(pCxt); } break; case 105: /* db_options ::= db_options BUFFER NK_INTEGER */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 106: /* db_options ::= db_options CACHEMODEL NK_STRING */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 107: /* db_options ::= db_options CACHESIZE NK_INTEGER */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 108: /* db_options ::= db_options COMP NK_INTEGER */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_COMP, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_COMP, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 109: /* db_options ::= db_options DURATION NK_INTEGER */ case 110: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==110); - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 111: /* db_options ::= db_options MAXROWS NK_INTEGER */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 112: /* db_options ::= db_options MINROWS NK_INTEGER */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 113: /* db_options ::= db_options KEEP integer_list */ case 114: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==114); - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_KEEP, yymsp[0].minor.yy334); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_KEEP, yymsp[0].minor.yy928); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 115: /* db_options ::= db_options PAGES NK_INTEGER */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 116: /* db_options ::= db_options PAGESIZE NK_INTEGER */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 117: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 118: /* db_options ::= db_options PRECISION NK_STRING */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 119: /* db_options ::= db_options REPLICA NK_INTEGER */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 120: /* db_options ::= db_options VGROUPS NK_INTEGER */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 121: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 122: /* db_options ::= db_options RETENTIONS retention_list */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_RETENTIONS, yymsp[0].minor.yy334); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_RETENTIONS, yymsp[0].minor.yy928); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 123: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 124: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_WAL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_WAL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 125: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 126: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 127: /* 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.yy560 = setDatabaseOption(pCxt, yymsp[-3].minor.yy560, DB_OPTION_WAL_RETENTION_PERIOD, &t); + yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-3].minor.yy248, DB_OPTION_WAL_RETENTION_PERIOD, &t); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + yymsp[-3].minor.yy248 = yylhsminor.yy248; break; case 128: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 129: /* 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.yy560 = setDatabaseOption(pCxt, yymsp[-3].minor.yy560, DB_OPTION_WAL_RETENTION_SIZE, &t); + yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-3].minor.yy248, DB_OPTION_WAL_RETENTION_SIZE, &t); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + yymsp[-3].minor.yy248 = yylhsminor.yy248; break; case 130: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 131: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 132: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 133: /* db_options ::= db_options TABLE_PREFIX signed */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_TABLE_PREFIX, yymsp[0].minor.yy560); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_TABLE_PREFIX, yymsp[0].minor.yy248); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 134: /* db_options ::= db_options TABLE_SUFFIX signed */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_TABLE_SUFFIX, yymsp[0].minor.yy560); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_TABLE_SUFFIX, yymsp[0].minor.yy248); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 135: /* db_options ::= db_options S3_CHUNKSIZE NK_INTEGER */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_S3_CHUNKSIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_S3_CHUNKSIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 136: /* db_options ::= db_options S3_KEEPLOCAL NK_INTEGER */ case 137: /* db_options ::= db_options S3_KEEPLOCAL NK_VARIABLE */ yytestcase(yyruleno==137); - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_S3_KEEPLOCAL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_S3_KEEPLOCAL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 138: /* db_options ::= db_options S3_COMPACT NK_INTEGER */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_S3_COMPACT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_S3_COMPACT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 139: /* db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_KEEP_TIME_OFFSET, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_KEEP_TIME_OFFSET, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 140: /* db_options ::= db_options ENCRYPT_ALGORITHM NK_STRING */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_ENCRYPT_ALGORITHM, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_ENCRYPT_ALGORITHM, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 141: /* alter_db_options ::= alter_db_option */ - { yylhsminor.yy560 = createAlterDatabaseOptions(pCxt); yylhsminor.yy560 = setAlterDatabaseOption(pCxt, yylhsminor.yy560, &yymsp[0].minor.yy389); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createAlterDatabaseOptions(pCxt); yylhsminor.yy248 = setAlterDatabaseOption(pCxt, yylhsminor.yy248, &yymsp[0].minor.yy677); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; case 142: /* alter_db_options ::= alter_db_options alter_db_option */ - { yylhsminor.yy560 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy560, &yymsp[0].minor.yy389); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy248, &yymsp[0].minor.yy677); } + yymsp[-1].minor.yy248 = yylhsminor.yy248; break; case 143: /* alter_db_option ::= BUFFER NK_INTEGER */ - { yymsp[-1].minor.yy389.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } + { yymsp[-1].minor.yy677.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy677.val = yymsp[0].minor.yy0; } break; case 144: /* alter_db_option ::= CACHEMODEL NK_STRING */ - { yymsp[-1].minor.yy389.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } + { yymsp[-1].minor.yy677.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy677.val = yymsp[0].minor.yy0; } break; case 145: /* alter_db_option ::= CACHESIZE NK_INTEGER */ - { yymsp[-1].minor.yy389.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } + { yymsp[-1].minor.yy677.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy677.val = yymsp[0].minor.yy0; } break; case 146: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ - { yymsp[-1].minor.yy389.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } + { yymsp[-1].minor.yy677.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy677.val = yymsp[0].minor.yy0; } break; case 147: /* alter_db_option ::= KEEP integer_list */ case 148: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==148); - { yymsp[-1].minor.yy389.type = DB_OPTION_KEEP; yymsp[-1].minor.yy389.pList = yymsp[0].minor.yy334; } + { yymsp[-1].minor.yy677.type = DB_OPTION_KEEP; yymsp[-1].minor.yy677.pList = yymsp[0].minor.yy928; } break; case 149: /* alter_db_option ::= PAGES NK_INTEGER */ - { yymsp[-1].minor.yy389.type = DB_OPTION_PAGES; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } + { yymsp[-1].minor.yy677.type = DB_OPTION_PAGES; yymsp[-1].minor.yy677.val = yymsp[0].minor.yy0; } break; case 150: /* alter_db_option ::= REPLICA NK_INTEGER */ - { yymsp[-1].minor.yy389.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } + { yymsp[-1].minor.yy677.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy677.val = yymsp[0].minor.yy0; } break; case 151: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */ - { yymsp[-1].minor.yy389.type = DB_OPTION_WAL; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } + { yymsp[-1].minor.yy677.type = DB_OPTION_WAL; yymsp[-1].minor.yy677.val = yymsp[0].minor.yy0; } break; case 152: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */ - { yymsp[-1].minor.yy389.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } + { yymsp[-1].minor.yy677.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy677.val = yymsp[0].minor.yy0; } break; case 153: /* alter_db_option ::= MINROWS NK_INTEGER */ - { yymsp[-1].minor.yy389.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } + { yymsp[-1].minor.yy677.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy677.val = yymsp[0].minor.yy0; } break; case 154: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ - { yymsp[-1].minor.yy389.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } + { yymsp[-1].minor.yy677.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy677.val = yymsp[0].minor.yy0; } break; case 155: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yymsp[-2].minor.yy389.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy389.val = t; + yymsp[-2].minor.yy677.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy677.val = t; } break; case 156: /* alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ - { yymsp[-1].minor.yy389.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } + { yymsp[-1].minor.yy677.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy677.val = yymsp[0].minor.yy0; } break; case 157: /* alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yymsp[-2].minor.yy389.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy389.val = t; + yymsp[-2].minor.yy677.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy677.val = t; } break; case 158: /* alter_db_option ::= S3_KEEPLOCAL NK_INTEGER */ case 159: /* alter_db_option ::= S3_KEEPLOCAL NK_VARIABLE */ yytestcase(yyruleno==159); - { yymsp[-1].minor.yy389.type = DB_OPTION_S3_KEEPLOCAL; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } + { yymsp[-1].minor.yy677.type = DB_OPTION_S3_KEEPLOCAL; yymsp[-1].minor.yy677.val = yymsp[0].minor.yy0; } break; case 160: /* alter_db_option ::= S3_COMPACT NK_INTEGER */ - { yymsp[-1].minor.yy389.type = DB_OPTION_S3_COMPACT, yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } + { yymsp[-1].minor.yy677.type = DB_OPTION_S3_COMPACT, yymsp[-1].minor.yy677.val = yymsp[0].minor.yy0; } break; case 161: /* alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */ - { yymsp[-1].minor.yy389.type = DB_OPTION_KEEP_TIME_OFFSET; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } + { yymsp[-1].minor.yy677.type = DB_OPTION_KEEP_TIME_OFFSET; yymsp[-1].minor.yy677.val = yymsp[0].minor.yy0; } break; case 162: /* alter_db_option ::= ENCRYPT_ALGORITHM NK_STRING */ - { yymsp[-1].minor.yy389.type = DB_OPTION_ENCRYPT_ALGORITHM; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } + { yymsp[-1].minor.yy677.type = DB_OPTION_ENCRYPT_ALGORITHM; yymsp[-1].minor.yy677.val = yymsp[0].minor.yy0; } break; case 163: /* integer_list ::= NK_INTEGER */ - { yylhsminor.yy334 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy334 = yylhsminor.yy334; + { yylhsminor.yy928 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy928 = yylhsminor.yy928; break; case 164: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ case 444: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==444); - { yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy334 = yylhsminor.yy334; + { yylhsminor.yy928 = addNodeToList(pCxt, yymsp[-2].minor.yy928, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy928 = yylhsminor.yy928; break; case 165: /* variable_list ::= NK_VARIABLE */ - { yylhsminor.yy334 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy334 = yylhsminor.yy334; + { yylhsminor.yy928 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy928 = yylhsminor.yy928; break; case 166: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ - { yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy334 = yylhsminor.yy334; + { yylhsminor.yy928 = addNodeToList(pCxt, yymsp[-2].minor.yy928, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy928 = yylhsminor.yy928; break; case 167: /* retention_list ::= retention */ case 200: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==200); @@ -6437,8 +6451,8 @@ static YYACTIONTYPE yy_reduce( case 684: /* select_list ::= select_item */ yytestcase(yyruleno==684); case 695: /* partition_list ::= partition_item */ yytestcase(yyruleno==695); case 756: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==756); - { yylhsminor.yy334 = createNodeList(pCxt, yymsp[0].minor.yy560); } - yymsp[0].minor.yy334 = yylhsminor.yy334; + { yylhsminor.yy928 = createNodeList(pCxt, yymsp[0].minor.yy248); } + yymsp[0].minor.yy928 = yylhsminor.yy928; break; case 168: /* retention_list ::= retention_list NK_COMMA retention */ case 204: /* multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ yytestcase(yyruleno==204); @@ -6455,292 +6469,292 @@ static YYACTIONTYPE yy_reduce( case 685: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==685); case 696: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==696); case 757: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==757); - { yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, yymsp[0].minor.yy560); } - yymsp[-2].minor.yy334 = yylhsminor.yy334; + { yylhsminor.yy928 = addNodeToList(pCxt, yymsp[-2].minor.yy928, yymsp[0].minor.yy248); } + yymsp[-2].minor.yy928 = yylhsminor.yy928; break; case 169: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ case 170: /* retention ::= NK_MINUS NK_COLON NK_VARIABLE */ yytestcase(yyruleno==170); - { yylhsminor.yy560 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 171: /* speed_opt ::= */ case 394: /* bufsize_opt ::= */ yytestcase(yyruleno==394); - { yymsp[1].minor.yy802 = 0; } + { yymsp[1].minor.yy604 = 0; } break; case 172: /* speed_opt ::= BWLIMIT NK_INTEGER */ case 395: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==395); - { yymsp[-1].minor.yy802 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } + { yymsp[-1].minor.yy604 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } break; case 174: /* start_opt ::= START WITH NK_INTEGER */ case 178: /* end_opt ::= END WITH NK_INTEGER */ yytestcase(yyruleno==178); - { yymsp[-2].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + { yymsp[-2].minor.yy248 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; case 175: /* start_opt ::= START WITH NK_STRING */ case 179: /* end_opt ::= END WITH NK_STRING */ yytestcase(yyruleno==179); - { yymsp[-2].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + { yymsp[-2].minor.yy248 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; case 176: /* start_opt ::= START WITH TIMESTAMP NK_STRING */ case 180: /* end_opt ::= END WITH TIMESTAMP NK_STRING */ yytestcase(yyruleno==180); - { yymsp[-3].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + { yymsp[-3].minor.yy248 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; case 181: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ case 184: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==184); - { pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy173, yymsp[-5].minor.yy560, yymsp[-3].minor.yy334, yymsp[-1].minor.yy334, yymsp[0].minor.yy560); } + { pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy89, yymsp[-5].minor.yy248, yymsp[-3].minor.yy928, yymsp[-1].minor.yy928, yymsp[0].minor.yy248); } break; case 182: /* cmd ::= CREATE TABLE multi_create_clause */ - { pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy334); } + { pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy928); } break; case 183: /* cmd ::= CREATE TABLE not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING */ - { pCxt->pRootNode = createCreateSubTableFromFileClause(pCxt, yymsp[-7].minor.yy173, yymsp[-5].minor.yy560, yymsp[-3].minor.yy334, &yymsp[0].minor.yy0); } + { pCxt->pRootNode = createCreateSubTableFromFileClause(pCxt, yymsp[-7].minor.yy89, yymsp[-5].minor.yy248, yymsp[-3].minor.yy928, &yymsp[0].minor.yy0); } break; case 185: /* cmd ::= DROP TABLE multi_drop_clause */ - { pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy334); } + { pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy928); } break; case 186: /* cmd ::= DROP STABLE exists_opt full_table_name */ - { pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy173, yymsp[0].minor.yy560); } + { pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy89, yymsp[0].minor.yy248); } break; case 187: /* cmd ::= ALTER TABLE alter_table_clause */ case 446: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==446); case 447: /* cmd ::= insert_query */ yytestcase(yyruleno==447); - { pCxt->pRootNode = yymsp[0].minor.yy560; } + { pCxt->pRootNode = yymsp[0].minor.yy248; } break; case 188: /* cmd ::= ALTER STABLE alter_table_clause */ - { pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy560); } + { pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy248); } break; case 189: /* alter_table_clause ::= full_table_name alter_table_options */ - { yylhsminor.yy560 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy248, yymsp[0].minor.yy248); } + yymsp[-1].minor.yy248 = yylhsminor.yy248; break; case 190: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options */ - { yylhsminor.yy560 = createAlterTableAddModifyColOptions2(pCxt, yymsp[-5].minor.yy560, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-2].minor.yy533, yymsp[-1].minor.yy952, yymsp[0].minor.yy560); } - yymsp[-5].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createAlterTableAddModifyColOptions2(pCxt, yymsp[-5].minor.yy248, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-2].minor.yy401, yymsp[-1].minor.yy976, yymsp[0].minor.yy248); } + yymsp[-5].minor.yy248 = yylhsminor.yy248; break; case 191: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ - { yylhsminor.yy560 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy560, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy533); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy248, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy401); } + yymsp[-3].minor.yy248 = yylhsminor.yy248; break; case 192: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - { yylhsminor.yy560 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy533, yymsp[0].minor.yy952); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy248, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy401, yymsp[0].minor.yy976); } + yymsp[-4].minor.yy248 = yylhsminor.yy248; break; case 193: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */ - { yylhsminor.yy560 = createAlterTableAddModifyColOptions(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_UPDATE_COLUMN_COMPRESS, &yymsp[-1].minor.yy533, yymsp[0].minor.yy560); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createAlterTableAddModifyColOptions(pCxt, yymsp[-4].minor.yy248, TSDB_ALTER_TABLE_UPDATE_COLUMN_COMPRESS, &yymsp[-1].minor.yy401, yymsp[0].minor.yy248); } + yymsp[-4].minor.yy248 = yylhsminor.yy248; break; case 194: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - { yylhsminor.yy560 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy533, &yymsp[0].minor.yy533); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy248, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy401, &yymsp[0].minor.yy401); } + yymsp[-4].minor.yy248 = yylhsminor.yy248; break; case 195: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - { yylhsminor.yy560 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy533, yymsp[0].minor.yy952); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy248, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy401, yymsp[0].minor.yy976); } + yymsp[-4].minor.yy248 = yylhsminor.yy248; break; case 196: /* alter_table_clause ::= full_table_name DROP TAG column_name */ - { yylhsminor.yy560 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy560, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy533); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy248, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy401); } + yymsp[-3].minor.yy248 = yylhsminor.yy248; break; case 197: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - { yylhsminor.yy560 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy533, yymsp[0].minor.yy952); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy248, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy401, yymsp[0].minor.yy976); } + yymsp[-4].minor.yy248 = yylhsminor.yy248; break; case 198: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - { yylhsminor.yy560 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy533, &yymsp[0].minor.yy533); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy248, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy401, &yymsp[0].minor.yy401); } + yymsp[-4].minor.yy248 = yylhsminor.yy248; break; case 199: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal */ - { yylhsminor.yy560 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy560, &yymsp[-2].minor.yy533, yymsp[0].minor.yy560); } - yymsp[-5].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy248, &yymsp[-2].minor.yy401, yymsp[0].minor.yy248); } + yymsp[-5].minor.yy248 = yylhsminor.yy248; break; case 201: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ case 609: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==609); - { yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-1].minor.yy334, yymsp[0].minor.yy560); } - yymsp[-1].minor.yy334 = yylhsminor.yy334; + { yylhsminor.yy928 = addNodeToList(pCxt, yymsp[-1].minor.yy928, yymsp[0].minor.yy248); } + yymsp[-1].minor.yy928 = yylhsminor.yy928; break; case 202: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */ - { yylhsminor.yy560 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy173, yymsp[-8].minor.yy560, yymsp[-6].minor.yy560, yymsp[-5].minor.yy334, yymsp[-2].minor.yy334, yymsp[0].minor.yy560); } - yymsp[-9].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy89, yymsp[-8].minor.yy248, yymsp[-6].minor.yy248, yymsp[-5].minor.yy928, yymsp[-2].minor.yy928, yymsp[0].minor.yy248); } + yymsp[-9].minor.yy248 = yylhsminor.yy248; break; case 205: /* drop_table_clause ::= exists_opt full_table_name */ - { yylhsminor.yy560 = createDropTableClause(pCxt, yymsp[-1].minor.yy173, yymsp[0].minor.yy560); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createDropTableClause(pCxt, yymsp[-1].minor.yy89, yymsp[0].minor.yy248); } + yymsp[-1].minor.yy248 = yylhsminor.yy248; break; case 207: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ case 409: /* col_list_opt ::= NK_LP column_stream_def_list NK_RP */ yytestcase(yyruleno==409); - { yymsp[-2].minor.yy334 = yymsp[-1].minor.yy334; } + { yymsp[-2].minor.yy928 = yymsp[-1].minor.yy928; } break; case 208: /* full_table_name ::= table_name */ case 350: /* full_tsma_name ::= tsma_name */ yytestcase(yyruleno==350); - { yylhsminor.yy560 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy533, NULL); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy401, NULL); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; case 209: /* full_table_name ::= db_name NK_DOT table_name */ case 351: /* full_tsma_name ::= db_name NK_DOT tsma_name */ yytestcase(yyruleno==351); - { yylhsminor.yy560 = createRealTableNode(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy533, NULL); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createRealTableNode(pCxt, &yymsp[-2].minor.yy401, &yymsp[0].minor.yy401, NULL); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 212: /* tag_def ::= column_name type_name */ - { yylhsminor.yy560 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy533, yymsp[0].minor.yy952, NULL); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy401, yymsp[0].minor.yy976, NULL); } + yymsp[-1].minor.yy248 = yylhsminor.yy248; break; case 215: /* column_def ::= column_name type_name column_options */ - { yylhsminor.yy560 = createColumnDefNode(pCxt, &yymsp[-2].minor.yy533, yymsp[-1].minor.yy952, yymsp[0].minor.yy560); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createColumnDefNode(pCxt, &yymsp[-2].minor.yy401, yymsp[-1].minor.yy976, yymsp[0].minor.yy248); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 216: /* type_name ::= BOOL */ - { yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_BOOL); } + { yymsp[0].minor.yy976 = createDataType(TSDB_DATA_TYPE_BOOL); } break; case 217: /* type_name ::= TINYINT */ - { yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_TINYINT); } + { yymsp[0].minor.yy976 = createDataType(TSDB_DATA_TYPE_TINYINT); } break; case 218: /* type_name ::= SMALLINT */ - { yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_SMALLINT); } + { yymsp[0].minor.yy976 = createDataType(TSDB_DATA_TYPE_SMALLINT); } break; case 219: /* type_name ::= INT */ case 220: /* type_name ::= INTEGER */ yytestcase(yyruleno==220); - { yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_INT); } + { yymsp[0].minor.yy976 = createDataType(TSDB_DATA_TYPE_INT); } break; case 221: /* type_name ::= BIGINT */ - { yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_BIGINT); } + { yymsp[0].minor.yy976 = createDataType(TSDB_DATA_TYPE_BIGINT); } break; case 222: /* type_name ::= FLOAT */ - { yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_FLOAT); } + { yymsp[0].minor.yy976 = createDataType(TSDB_DATA_TYPE_FLOAT); } break; case 223: /* type_name ::= DOUBLE */ - { yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_DOUBLE); } + { yymsp[0].minor.yy976 = createDataType(TSDB_DATA_TYPE_DOUBLE); } break; case 224: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - { yymsp[-3].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } + { yymsp[-3].minor.yy976 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } break; case 225: /* type_name ::= TIMESTAMP */ - { yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } + { yymsp[0].minor.yy976 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } break; case 226: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - { yymsp[-3].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } + { yymsp[-3].minor.yy976 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } break; case 227: /* type_name ::= TINYINT UNSIGNED */ - { yymsp[-1].minor.yy952 = createDataType(TSDB_DATA_TYPE_UTINYINT); } + { yymsp[-1].minor.yy976 = createDataType(TSDB_DATA_TYPE_UTINYINT); } break; case 228: /* type_name ::= SMALLINT UNSIGNED */ - { yymsp[-1].minor.yy952 = createDataType(TSDB_DATA_TYPE_USMALLINT); } + { yymsp[-1].minor.yy976 = createDataType(TSDB_DATA_TYPE_USMALLINT); } break; case 229: /* type_name ::= INT UNSIGNED */ - { yymsp[-1].minor.yy952 = createDataType(TSDB_DATA_TYPE_UINT); } + { yymsp[-1].minor.yy976 = createDataType(TSDB_DATA_TYPE_UINT); } break; case 230: /* type_name ::= BIGINT UNSIGNED */ - { yymsp[-1].minor.yy952 = createDataType(TSDB_DATA_TYPE_UBIGINT); } + { yymsp[-1].minor.yy976 = createDataType(TSDB_DATA_TYPE_UBIGINT); } break; case 231: /* type_name ::= JSON */ - { yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_JSON); } + { yymsp[0].minor.yy976 = createDataType(TSDB_DATA_TYPE_JSON); } break; case 232: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - { yymsp[-3].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } + { yymsp[-3].minor.yy976 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } break; case 233: /* type_name ::= MEDIUMBLOB */ - { yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } + { yymsp[0].minor.yy976 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } break; case 234: /* type_name ::= BLOB */ - { yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_BLOB); } + { yymsp[0].minor.yy976 = createDataType(TSDB_DATA_TYPE_BLOB); } break; case 235: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - { yymsp[-3].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } + { yymsp[-3].minor.yy976 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } break; case 236: /* type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ - { yymsp[-3].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); } + { yymsp[-3].minor.yy976 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); } break; case 237: /* type_name ::= DECIMAL */ - { yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + { yymsp[0].minor.yy976 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 238: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - { yymsp[-3].minor.yy952 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + { yymsp[-3].minor.yy976 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 239: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - { yymsp[-5].minor.yy952 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + { yymsp[-5].minor.yy976 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 240: /* type_name_default_len ::= BINARY */ - { yymsp[0].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, NULL); } + { yymsp[0].minor.yy976 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, NULL); } break; case 241: /* type_name_default_len ::= NCHAR */ - { yymsp[0].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, NULL); } + { yymsp[0].minor.yy976 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, NULL); } break; case 242: /* type_name_default_len ::= VARCHAR */ - { yymsp[0].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, NULL); } + { yymsp[0].minor.yy976 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, NULL); } break; case 243: /* type_name_default_len ::= VARBINARY */ - { yymsp[0].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, NULL); } + { yymsp[0].minor.yy976 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, NULL); } break; case 246: /* tags_def ::= TAGS NK_LP tag_def_list NK_RP */ case 417: /* tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ yytestcase(yyruleno==417); - { yymsp[-3].minor.yy334 = yymsp[-1].minor.yy334; } + { yymsp[-3].minor.yy928 = yymsp[-1].minor.yy928; } break; case 247: /* table_options ::= */ - { yymsp[1].minor.yy560 = createDefaultTableOptions(pCxt); } + { yymsp[1].minor.yy248 = createDefaultTableOptions(pCxt); } break; case 248: /* table_options ::= table_options COMMENT NK_STRING */ - { yylhsminor.yy560 = setTableOption(pCxt, yymsp[-2].minor.yy560, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setTableOption(pCxt, yymsp[-2].minor.yy248, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 249: /* table_options ::= table_options MAX_DELAY duration_list */ - { yylhsminor.yy560 = setTableOption(pCxt, yymsp[-2].minor.yy560, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy334); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setTableOption(pCxt, yymsp[-2].minor.yy248, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy928); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 250: /* table_options ::= table_options WATERMARK duration_list */ - { yylhsminor.yy560 = setTableOption(pCxt, yymsp[-2].minor.yy560, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy334); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setTableOption(pCxt, yymsp[-2].minor.yy248, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy928); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 251: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ - { yylhsminor.yy560 = setTableOption(pCxt, yymsp[-4].minor.yy560, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy334); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setTableOption(pCxt, yymsp[-4].minor.yy248, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy928); } + yymsp[-4].minor.yy248 = yylhsminor.yy248; break; case 252: /* table_options ::= table_options TTL NK_INTEGER */ - { yylhsminor.yy560 = setTableOption(pCxt, yymsp[-2].minor.yy560, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setTableOption(pCxt, yymsp[-2].minor.yy248, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 253: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - { yylhsminor.yy560 = setTableOption(pCxt, yymsp[-4].minor.yy560, TABLE_OPTION_SMA, yymsp[-1].minor.yy334); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setTableOption(pCxt, yymsp[-4].minor.yy248, TABLE_OPTION_SMA, yymsp[-1].minor.yy928); } + yymsp[-4].minor.yy248 = yylhsminor.yy248; break; case 254: /* table_options ::= table_options DELETE_MARK duration_list */ - { yylhsminor.yy560 = setTableOption(pCxt, yymsp[-2].minor.yy560, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy334); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setTableOption(pCxt, yymsp[-2].minor.yy248, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy928); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 255: /* alter_table_options ::= alter_table_option */ - { yylhsminor.yy560 = createAlterTableOptions(pCxt); yylhsminor.yy560 = setTableOption(pCxt, yylhsminor.yy560, yymsp[0].minor.yy389.type, &yymsp[0].minor.yy389.val); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createAlterTableOptions(pCxt); yylhsminor.yy248 = setTableOption(pCxt, yylhsminor.yy248, yymsp[0].minor.yy677.type, &yymsp[0].minor.yy677.val); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; case 256: /* alter_table_options ::= alter_table_options alter_table_option */ - { yylhsminor.yy560 = setTableOption(pCxt, yymsp[-1].minor.yy560, yymsp[0].minor.yy389.type, &yymsp[0].minor.yy389.val); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setTableOption(pCxt, yymsp[-1].minor.yy248, yymsp[0].minor.yy677.type, &yymsp[0].minor.yy677.val); } + yymsp[-1].minor.yy248 = yylhsminor.yy248; break; case 257: /* alter_table_option ::= COMMENT NK_STRING */ - { yymsp[-1].minor.yy389.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } + { yymsp[-1].minor.yy677.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy677.val = yymsp[0].minor.yy0; } break; case 258: /* alter_table_option ::= TTL NK_INTEGER */ - { yymsp[-1].minor.yy389.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } + { yymsp[-1].minor.yy677.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy677.val = yymsp[0].minor.yy0; } break; case 259: /* duration_list ::= duration_literal */ case 546: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==546); - { yylhsminor.yy334 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); } - yymsp[0].minor.yy334 = yylhsminor.yy334; + { yylhsminor.yy928 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy248)); } + yymsp[0].minor.yy928 = yylhsminor.yy928; break; case 260: /* duration_list ::= duration_list NK_COMMA duration_literal */ case 547: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==547); - { yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); } - yymsp[-2].minor.yy334 = yylhsminor.yy334; + { yylhsminor.yy928 = addNodeToList(pCxt, yymsp[-2].minor.yy928, releaseRawExprNode(pCxt, yymsp[0].minor.yy248)); } + yymsp[-2].minor.yy928 = yylhsminor.yy928; break; case 263: /* rollup_func_name ::= function_name */ - { yylhsminor.yy560 = createFunctionNode(pCxt, &yymsp[0].minor.yy533, NULL); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createFunctionNode(pCxt, &yymsp[0].minor.yy401, NULL); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; case 264: /* rollup_func_name ::= FIRST */ case 265: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==265); case 339: /* tag_item ::= QTAGS */ yytestcase(yyruleno==339); - { yylhsminor.yy560 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; case 268: /* col_name ::= column_name */ case 340: /* tag_item ::= column_name */ yytestcase(yyruleno==340); - { yylhsminor.yy560 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy533); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy401); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; case 269: /* cmd ::= SHOW DNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); } @@ -6757,19 +6771,19 @@ static YYACTIONTYPE yy_reduce( case 273: /* cmd ::= SHOW db_kind_opt DATABASES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); - (void)setShowKind(pCxt, pCxt->pRootNode, yymsp[-1].minor.yy537); + (void)setShowKind(pCxt, pCxt->pRootNode, yymsp[-1].minor.yy1042); } break; case 274: /* cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ { - pCxt->pRootNode = createShowTablesStmt(pCxt, yymsp[-2].minor.yy709, yymsp[0].minor.yy560, OP_TYPE_LIKE); + pCxt->pRootNode = createShowTablesStmt(pCxt, yymsp[-2].minor.yy373, yymsp[0].minor.yy248, OP_TYPE_LIKE); } break; case 275: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy560, yymsp[0].minor.yy560, OP_TYPE_LIKE); } + { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy248, yymsp[0].minor.yy248, OP_TYPE_LIKE); } break; case 276: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ - { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy560, NULL, OP_TYPE_LIKE); } + { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy248, NULL, OP_TYPE_LIKE); } break; case 277: /* cmd ::= SHOW MNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); } @@ -6784,10 +6798,10 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); } break; case 281: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy560, yymsp[-1].minor.yy560, OP_TYPE_EQUAL); } + { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy248, yymsp[-1].minor.yy248, OP_TYPE_EQUAL); } break; case 282: /* cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ - { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy533), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy533), OP_TYPE_EQUAL); } + { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy401), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy401), OP_TYPE_EQUAL); } break; case 283: /* cmd ::= SHOW STREAMS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); } @@ -6815,14 +6829,14 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT); } break; case 292: /* cmd ::= SHOW CREATE DATABASE db_name */ - { pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy533); } + { pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy401); } break; case 293: /* cmd ::= SHOW CREATE TABLE full_table_name */ - { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy560); } + { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy248); } break; case 294: /* cmd ::= SHOW CREATE STABLE full_table_name */ { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, - yymsp[0].minor.yy560); } + yymsp[0].minor.yy248); } break; case 295: /* cmd ::= SHOW ENCRYPTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ENCRYPTIONS_STMT); } @@ -6844,7 +6858,7 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); } break; case 302: /* 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.yy560); } + { pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy248); } break; case 303: /* cmd ::= SHOW BNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); } @@ -6859,7 +6873,7 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); } break; case 307: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ - { pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy560); } + { pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy248); } break; case 308: /* cmd ::= SHOW CONSUMERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } @@ -6868,16 +6882,16 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); } break; case 310: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ - { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy560, yymsp[-1].minor.yy560, OP_TYPE_EQUAL); } + { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy248, yymsp[-1].minor.yy248, OP_TYPE_EQUAL); } break; case 311: /* cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ - { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy533), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy533), OP_TYPE_EQUAL); } + { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy401), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy401), OP_TYPE_EQUAL); } break; case 312: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ - { pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy560, yymsp[0].minor.yy560, yymsp[-3].minor.yy334); } + { pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy248, yymsp[0].minor.yy248, yymsp[-3].minor.yy928); } break; case 313: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ - { pCxt->pRootNode = createShowTableTagsStmt(pCxt, createIdentifierValueNode(pCxt, &yymsp[0].minor.yy533), createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy533), yymsp[-4].minor.yy334); } + { pCxt->pRootNode = createShowTableTagsStmt(pCxt, createIdentifierValueNode(pCxt, &yymsp[0].minor.yy401), createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy401), yymsp[-4].minor.yy928); } break; case 314: /* cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ { pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); } @@ -6886,16 +6900,16 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, NULL); } break; case 316: /* cmd ::= SHOW db_name_cond_opt ALIVE */ - { pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy560, QUERY_NODE_SHOW_DB_ALIVE_STMT); } + { pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy248, QUERY_NODE_SHOW_DB_ALIVE_STMT); } break; case 317: /* cmd ::= SHOW CLUSTER ALIVE */ { pCxt->pRootNode = createShowAliveStmt(pCxt, NULL, QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT); } break; case 318: /* cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */ - { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VIEWS_STMT, yymsp[-2].minor.yy560, yymsp[0].minor.yy560, OP_TYPE_LIKE); } + { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VIEWS_STMT, yymsp[-2].minor.yy248, yymsp[0].minor.yy248, OP_TYPE_LIKE); } break; case 319: /* cmd ::= SHOW CREATE VIEW full_table_name */ - { pCxt->pRootNode = createShowCreateViewStmt(pCxt, QUERY_NODE_SHOW_CREATE_VIEW_STMT, yymsp[0].minor.yy560); } + { pCxt->pRootNode = createShowCreateViewStmt(pCxt, QUERY_NODE_SHOW_CREATE_VIEW_STMT, yymsp[0].minor.yy248); } break; case 320: /* cmd ::= SHOW COMPACTS */ { pCxt->pRootNode = createShowCompactsStmt(pCxt, QUERY_NODE_SHOW_COMPACTS_STMT); } @@ -6904,260 +6918,260 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowCompactDetailsStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } break; case 322: /* table_kind_db_name_cond_opt ::= */ - { yymsp[1].minor.yy709.kind = SHOW_KIND_ALL; yymsp[1].minor.yy709.dbName = nil_token; } + { yymsp[1].minor.yy373.kind = SHOW_KIND_ALL; yymsp[1].minor.yy373.dbName = nil_token; } break; case 323: /* table_kind_db_name_cond_opt ::= table_kind */ - { yylhsminor.yy709.kind = yymsp[0].minor.yy537; yylhsminor.yy709.dbName = nil_token; } - yymsp[0].minor.yy709 = yylhsminor.yy709; + { yylhsminor.yy373.kind = yymsp[0].minor.yy1042; yylhsminor.yy373.dbName = nil_token; } + yymsp[0].minor.yy373 = yylhsminor.yy373; break; case 324: /* table_kind_db_name_cond_opt ::= db_name NK_DOT */ - { yylhsminor.yy709.kind = SHOW_KIND_ALL; yylhsminor.yy709.dbName = yymsp[-1].minor.yy533; } - yymsp[-1].minor.yy709 = yylhsminor.yy709; + { yylhsminor.yy373.kind = SHOW_KIND_ALL; yylhsminor.yy373.dbName = yymsp[-1].minor.yy401; } + yymsp[-1].minor.yy373 = yylhsminor.yy373; break; case 325: /* table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ - { yylhsminor.yy709.kind = yymsp[-2].minor.yy537; yylhsminor.yy709.dbName = yymsp[-1].minor.yy533; } - yymsp[-2].minor.yy709 = yylhsminor.yy709; + { yylhsminor.yy373.kind = yymsp[-2].minor.yy1042; yylhsminor.yy373.dbName = yymsp[-1].minor.yy401; } + yymsp[-2].minor.yy373 = yylhsminor.yy373; break; case 326: /* table_kind ::= NORMAL */ - { yymsp[0].minor.yy537 = SHOW_KIND_TABLES_NORMAL; } + { yymsp[0].minor.yy1042 = SHOW_KIND_TABLES_NORMAL; } break; case 327: /* table_kind ::= CHILD */ - { yymsp[0].minor.yy537 = SHOW_KIND_TABLES_CHILD; } + { yymsp[0].minor.yy1042 = SHOW_KIND_TABLES_CHILD; } break; case 328: /* db_name_cond_opt ::= */ case 333: /* from_db_opt ::= */ yytestcase(yyruleno==333); - { yymsp[1].minor.yy560 = createDefaultDatabaseCondValue(pCxt); } + { yymsp[1].minor.yy248 = createDefaultDatabaseCondValue(pCxt); } break; case 329: /* db_name_cond_opt ::= db_name NK_DOT */ - { yylhsminor.yy560 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy533); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy401); } + yymsp[-1].minor.yy248 = yylhsminor.yy248; break; case 331: /* like_pattern_opt ::= LIKE NK_STRING */ - { yymsp[-1].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + { yymsp[-1].minor.yy248 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; case 332: /* table_name_cond ::= table_name */ - { yylhsminor.yy560 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy533); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy401); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; case 334: /* from_db_opt ::= FROM db_name */ - { yymsp[-1].minor.yy560 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy533); } + { yymsp[-1].minor.yy248 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy401); } break; case 338: /* tag_item ::= TBNAME */ - { yylhsminor.yy560 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; case 341: /* tag_item ::= column_name column_alias */ - { yylhsminor.yy560 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy533), &yymsp[0].minor.yy533); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy401), &yymsp[0].minor.yy401); } + yymsp[-1].minor.yy248 = yylhsminor.yy248; break; case 342: /* tag_item ::= column_name AS column_alias */ - { yylhsminor.yy560 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy533), &yymsp[0].minor.yy533); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy401), &yymsp[0].minor.yy401); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 343: /* db_kind_opt ::= */ - { yymsp[1].minor.yy537 = SHOW_KIND_ALL; } + { yymsp[1].minor.yy1042 = SHOW_KIND_ALL; } break; case 344: /* db_kind_opt ::= USER */ - { yymsp[0].minor.yy537 = SHOW_KIND_DATABASES_USER; } + { yymsp[0].minor.yy1042 = SHOW_KIND_DATABASES_USER; } break; case 345: /* db_kind_opt ::= SYSTEM */ - { yymsp[0].minor.yy537 = SHOW_KIND_DATABASES_SYSTEM; } + { yymsp[0].minor.yy1042 = SHOW_KIND_DATABASES_SYSTEM; } break; case 346: /* cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */ - { pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-8].minor.yy173, &yymsp[-7].minor.yy533, yymsp[-4].minor.yy560, yymsp[-5].minor.yy560, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); } + { pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-8].minor.yy89, &yymsp[-7].minor.yy401, yymsp[-4].minor.yy248, yymsp[-5].minor.yy248, releaseRawExprNode(pCxt, yymsp[-1].minor.yy248)); } break; case 347: /* cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */ - { pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-7].minor.yy173, &yymsp[-6].minor.yy533, NULL, yymsp[-4].minor.yy560, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); } + { pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-7].minor.yy89, &yymsp[-6].minor.yy401, NULL, yymsp[-4].minor.yy248, releaseRawExprNode(pCxt, yymsp[-1].minor.yy248)); } break; case 348: /* cmd ::= DROP TSMA exists_opt full_tsma_name */ - { pCxt->pRootNode = createDropTSMAStmt(pCxt, yymsp[-1].minor.yy173, yymsp[0].minor.yy560); } + { pCxt->pRootNode = createDropTSMAStmt(pCxt, yymsp[-1].minor.yy89, yymsp[0].minor.yy248); } break; case 349: /* cmd ::= SHOW db_name_cond_opt TSMAS */ - { pCxt->pRootNode = createShowTSMASStmt(pCxt, yymsp[-1].minor.yy560); } + { pCxt->pRootNode = createShowTSMASStmt(pCxt, yymsp[-1].minor.yy248); } break; case 352: /* tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */ - { yymsp[-3].minor.yy560 = createTSMAOptions(pCxt, yymsp[-1].minor.yy334); } + { yymsp[-3].minor.yy248 = createTSMAOptions(pCxt, yymsp[-1].minor.yy928); } break; case 353: /* cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ - { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy173, yymsp[-3].minor.yy560, yymsp[-1].minor.yy560, NULL, yymsp[0].minor.yy560); } + { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy89, yymsp[-3].minor.yy248, yymsp[-1].minor.yy248, NULL, yymsp[0].minor.yy248); } break; case 354: /* cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ - { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy173, yymsp[-5].minor.yy560, yymsp[-3].minor.yy560, yymsp[-1].minor.yy334, NULL); } + { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy89, yymsp[-5].minor.yy248, yymsp[-3].minor.yy248, yymsp[-1].minor.yy928, NULL); } break; case 355: /* cmd ::= DROP INDEX exists_opt full_index_name */ - { pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy173, yymsp[0].minor.yy560); } + { pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy89, yymsp[0].minor.yy248); } break; case 356: /* full_index_name ::= index_name */ - { yylhsminor.yy560 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy533); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy401); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; case 357: /* full_index_name ::= db_name NK_DOT index_name */ - { yylhsminor.yy560 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy533); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy401, &yymsp[0].minor.yy401); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 358: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - { yymsp[-9].minor.yy560 = createIndexOption(pCxt, yymsp[-7].minor.yy334, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), NULL, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } + { yymsp[-9].minor.yy248 = createIndexOption(pCxt, yymsp[-7].minor.yy928, releaseRawExprNode(pCxt, yymsp[-3].minor.yy248), NULL, yymsp[-1].minor.yy248, yymsp[0].minor.yy248); } break; case 359: /* 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.yy560 = createIndexOption(pCxt, yymsp[-9].minor.yy334, releaseRawExprNode(pCxt, yymsp[-5].minor.yy560), releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } + { yymsp[-11].minor.yy248 = createIndexOption(pCxt, yymsp[-9].minor.yy928, releaseRawExprNode(pCxt, yymsp[-5].minor.yy248), releaseRawExprNode(pCxt, yymsp[-3].minor.yy248), yymsp[-1].minor.yy248, yymsp[0].minor.yy248); } break; case 362: /* func ::= sma_func_name NK_LP expression_list NK_RP */ - { yylhsminor.yy560 = createFunctionNode(pCxt, &yymsp[-3].minor.yy533, yymsp[-1].minor.yy334); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createFunctionNode(pCxt, &yymsp[-3].minor.yy401, yymsp[-1].minor.yy928); } + yymsp[-3].minor.yy248 = yylhsminor.yy248; break; case 363: /* sma_func_name ::= function_name */ case 652: /* alias_opt ::= table_alias */ yytestcase(yyruleno==652); - { yylhsminor.yy533 = yymsp[0].minor.yy533; } - yymsp[0].minor.yy533 = yylhsminor.yy533; + { yylhsminor.yy401 = yymsp[0].minor.yy401; } + yymsp[0].minor.yy401 = yylhsminor.yy401; break; case 368: /* sma_stream_opt ::= */ case 418: /* stream_options ::= */ yytestcase(yyruleno==418); - { yymsp[1].minor.yy560 = createStreamOptions(pCxt); } + { yymsp[1].minor.yy248 = createStreamOptions(pCxt); } break; case 369: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ - { ((SStreamOptions*)yymsp[-2].minor.yy560)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy560); yylhsminor.yy560 = yymsp[-2].minor.yy560; } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { ((SStreamOptions*)yymsp[-2].minor.yy248)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy248); yylhsminor.yy248 = yymsp[-2].minor.yy248; } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 370: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ - { ((SStreamOptions*)yymsp[-2].minor.yy560)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy560); yylhsminor.yy560 = yymsp[-2].minor.yy560; } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { ((SStreamOptions*)yymsp[-2].minor.yy248)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy248); yylhsminor.yy248 = yymsp[-2].minor.yy248; } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 371: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ - { ((SStreamOptions*)yymsp[-2].minor.yy560)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy560); yylhsminor.yy560 = yymsp[-2].minor.yy560; } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { ((SStreamOptions*)yymsp[-2].minor.yy248)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy248); yylhsminor.yy248 = yymsp[-2].minor.yy248; } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 372: /* with_meta ::= AS */ - { yymsp[0].minor.yy802 = 0; } + { yymsp[0].minor.yy604 = 0; } break; case 373: /* with_meta ::= WITH META AS */ - { yymsp[-2].minor.yy802 = 1; } + { yymsp[-2].minor.yy604 = 1; } break; case 374: /* with_meta ::= ONLY META AS */ - { yymsp[-2].minor.yy802 = 2; } + { yymsp[-2].minor.yy604 = 2; } break; case 375: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ - { pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy173, &yymsp[-2].minor.yy533, yymsp[0].minor.yy560); } + { pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy89, &yymsp[-2].minor.yy401, yymsp[0].minor.yy248); } break; case 376: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ - { pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy173, &yymsp[-3].minor.yy533, &yymsp[0].minor.yy533, yymsp[-2].minor.yy802); } + { pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy89, &yymsp[-3].minor.yy401, &yymsp[0].minor.yy401, yymsp[-2].minor.yy604); } break; case 377: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ - { pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-5].minor.yy173, &yymsp[-4].minor.yy533, yymsp[-1].minor.yy560, yymsp[-3].minor.yy802, yymsp[0].minor.yy560); } + { pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-5].minor.yy89, &yymsp[-4].minor.yy401, yymsp[-1].minor.yy248, yymsp[-3].minor.yy604, yymsp[0].minor.yy248); } break; case 378: /* cmd ::= DROP TOPIC exists_opt topic_name */ - { pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy173, &yymsp[0].minor.yy533); } + { pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy89, &yymsp[0].minor.yy401); } break; case 379: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - { pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy173, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy533); } + { pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy89, &yymsp[-2].minor.yy401, &yymsp[0].minor.yy401); } break; case 380: /* cmd ::= DESC full_table_name */ case 381: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==381); - { pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy560); } + { pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy248); } break; case 382: /* cmd ::= RESET QUERY CACHE */ { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } break; case 383: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ case 384: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==384); - { pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy173, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } + { pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy89, yymsp[-1].minor.yy248, yymsp[0].minor.yy248); } break; case 387: /* explain_options ::= */ - { yymsp[1].minor.yy560 = createDefaultExplainOptions(pCxt); } + { yymsp[1].minor.yy248 = createDefaultExplainOptions(pCxt); } break; case 388: /* explain_options ::= explain_options VERBOSE NK_BOOL */ - { yylhsminor.yy560 = setExplainVerbose(pCxt, yymsp[-2].minor.yy560, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setExplainVerbose(pCxt, yymsp[-2].minor.yy248, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 389: /* explain_options ::= explain_options RATIO NK_FLOAT */ - { yylhsminor.yy560 = setExplainRatio(pCxt, yymsp[-2].minor.yy560, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setExplainRatio(pCxt, yymsp[-2].minor.yy248, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 390: /* cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ - { pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy173, yymsp[-9].minor.yy173, &yymsp[-6].minor.yy533, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy952, yymsp[-1].minor.yy802, &yymsp[0].minor.yy533, yymsp[-10].minor.yy173); } + { pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy89, yymsp[-9].minor.yy89, &yymsp[-6].minor.yy401, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy976, yymsp[-1].minor.yy604, &yymsp[0].minor.yy401, yymsp[-10].minor.yy89); } break; case 391: /* cmd ::= DROP FUNCTION exists_opt function_name */ - { pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy173, &yymsp[0].minor.yy533); } + { pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy89, &yymsp[0].minor.yy401); } break; case 396: /* language_opt ::= */ case 441: /* on_vgroup_id ::= */ yytestcase(yyruleno==441); - { yymsp[1].minor.yy533 = nil_token; } + { yymsp[1].minor.yy401 = nil_token; } break; case 397: /* language_opt ::= LANGUAGE NK_STRING */ case 442: /* on_vgroup_id ::= ON NK_INTEGER */ yytestcase(yyruleno==442); - { yymsp[-1].minor.yy533 = yymsp[0].minor.yy0; } + { yymsp[-1].minor.yy401 = yymsp[0].minor.yy0; } break; case 400: /* cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ - { pCxt->pRootNode = createCreateViewStmt(pCxt, yymsp[-4].minor.yy173, yymsp[-2].minor.yy560, &yymsp[-1].minor.yy0, yymsp[0].minor.yy560); } + { pCxt->pRootNode = createCreateViewStmt(pCxt, yymsp[-4].minor.yy89, yymsp[-2].minor.yy248, &yymsp[-1].minor.yy0, yymsp[0].minor.yy248); } break; case 401: /* cmd ::= DROP VIEW exists_opt full_view_name */ - { pCxt->pRootNode = createDropViewStmt(pCxt, yymsp[-1].minor.yy173, yymsp[0].minor.yy560); } + { pCxt->pRootNode = createDropViewStmt(pCxt, yymsp[-1].minor.yy89, yymsp[0].minor.yy248); } break; case 402: /* full_view_name ::= view_name */ - { yylhsminor.yy560 = createViewNode(pCxt, NULL, &yymsp[0].minor.yy533); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createViewNode(pCxt, NULL, &yymsp[0].minor.yy401); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; case 403: /* full_view_name ::= db_name NK_DOT view_name */ - { yylhsminor.yy560 = createViewNode(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy533); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createViewNode(pCxt, &yymsp[-2].minor.yy401, &yymsp[0].minor.yy401); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 404: /* 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.yy173, &yymsp[-8].minor.yy533, yymsp[-5].minor.yy560, yymsp[-7].minor.yy560, yymsp[-3].minor.yy334, yymsp[-2].minor.yy560, yymsp[0].minor.yy560, yymsp[-4].minor.yy334); } + { pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy89, &yymsp[-8].minor.yy401, yymsp[-5].minor.yy248, yymsp[-7].minor.yy248, yymsp[-3].minor.yy928, yymsp[-2].minor.yy248, yymsp[0].minor.yy248, yymsp[-4].minor.yy928); } break; case 405: /* cmd ::= DROP STREAM exists_opt stream_name */ - { pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy173, &yymsp[0].minor.yy533); } + { pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy89, &yymsp[0].minor.yy401); } break; case 406: /* cmd ::= PAUSE STREAM exists_opt stream_name */ - { pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy173, &yymsp[0].minor.yy533); } + { pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy89, &yymsp[0].minor.yy401); } break; case 407: /* cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ - { pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy173, yymsp[-1].minor.yy173, &yymsp[0].minor.yy533); } + { pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy89, yymsp[-1].minor.yy89, &yymsp[0].minor.yy401); } break; case 412: /* column_stream_def ::= column_name stream_col_options */ - { yylhsminor.yy560 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy533, createDataType(TSDB_DATA_TYPE_NULL), yymsp[0].minor.yy560); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy401, createDataType(TSDB_DATA_TYPE_NULL), yymsp[0].minor.yy248); } + yymsp[-1].minor.yy248 = yylhsminor.yy248; break; case 413: /* stream_col_options ::= */ case 765: /* column_options ::= */ yytestcase(yyruleno==765); - { yymsp[1].minor.yy560 = createDefaultColumnOptions(pCxt); } + { yymsp[1].minor.yy248 = createDefaultColumnOptions(pCxt); } break; case 414: /* stream_col_options ::= stream_col_options PRIMARY KEY */ case 766: /* column_options ::= column_options PRIMARY KEY */ yytestcase(yyruleno==766); - { yylhsminor.yy560 = setColumnOptions(pCxt, yymsp[-2].minor.yy560, COLUMN_OPTION_PRIMARYKEY, NULL); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setColumnOptionsPK(pCxt, yymsp[-2].minor.yy248); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 419: /* stream_options ::= stream_options TRIGGER AT_ONCE */ case 420: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==420); - { yylhsminor.yy560 = setStreamOptions(pCxt, yymsp[-2].minor.yy560, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setStreamOptions(pCxt, yymsp[-2].minor.yy248, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 421: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - { yylhsminor.yy560 = setStreamOptions(pCxt, yymsp[-3].minor.yy560, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setStreamOptions(pCxt, yymsp[-3].minor.yy248, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy248)); } + yymsp[-3].minor.yy248 = yylhsminor.yy248; break; case 422: /* stream_options ::= stream_options WATERMARK duration_literal */ - { yylhsminor.yy560 = setStreamOptions(pCxt, yymsp[-2].minor.yy560, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setStreamOptions(pCxt, yymsp[-2].minor.yy248, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy248)); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 423: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - { yylhsminor.yy560 = setStreamOptions(pCxt, yymsp[-3].minor.yy560, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setStreamOptions(pCxt, yymsp[-3].minor.yy248, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-3].minor.yy248 = yylhsminor.yy248; break; case 424: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ - { yylhsminor.yy560 = setStreamOptions(pCxt, yymsp[-2].minor.yy560, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setStreamOptions(pCxt, yymsp[-2].minor.yy248, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 425: /* stream_options ::= stream_options DELETE_MARK duration_literal */ - { yylhsminor.yy560 = setStreamOptions(pCxt, yymsp[-2].minor.yy560, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setStreamOptions(pCxt, yymsp[-2].minor.yy248, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy248)); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 426: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ - { yylhsminor.yy560 = setStreamOptions(pCxt, yymsp[-3].minor.yy560, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setStreamOptions(pCxt, yymsp[-3].minor.yy248, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-3].minor.yy248 = yylhsminor.yy248; break; case 428: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ case 709: /* sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ yytestcase(yyruleno==709); case 733: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==733); - { yymsp[-3].minor.yy560 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy560); } + { yymsp[-3].minor.yy248 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy248); } break; case 431: /* cmd ::= KILL CONNECTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } @@ -7175,37 +7189,37 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createBalanceVgroupStmt(pCxt); } break; case 436: /* cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ - { pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt, &yymsp[0].minor.yy533); } + { pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt, &yymsp[0].minor.yy401); } break; case 437: /* cmd ::= BALANCE VGROUP LEADER DATABASE db_name */ - { pCxt->pRootNode = createBalanceVgroupLeaderDBNameStmt(pCxt, &yymsp[0].minor.yy533); } + { pCxt->pRootNode = createBalanceVgroupLeaderDBNameStmt(pCxt, &yymsp[0].minor.yy401); } break; case 438: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; case 439: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - { pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy334); } + { pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy928); } break; case 440: /* cmd ::= SPLIT VGROUP NK_INTEGER */ { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } break; case 443: /* dnode_list ::= DNODE NK_INTEGER */ - { yymsp[-1].minor.yy334 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + { yymsp[-1].minor.yy928 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } break; case 445: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ - { pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } + { pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy248, yymsp[0].minor.yy248); } break; case 448: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - { yymsp[-6].minor.yy560 = createInsertStmt(pCxt, yymsp[-4].minor.yy560, yymsp[-2].minor.yy334, yymsp[0].minor.yy560); } + { yymsp[-6].minor.yy248 = createInsertStmt(pCxt, yymsp[-4].minor.yy248, yymsp[-2].minor.yy928, yymsp[0].minor.yy248); } break; case 449: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ - { yymsp[-3].minor.yy560 = createInsertStmt(pCxt, yymsp[-1].minor.yy560, NULL, yymsp[0].minor.yy560); } + { yymsp[-3].minor.yy248 = createInsertStmt(pCxt, yymsp[-1].minor.yy248, NULL, yymsp[0].minor.yy248); } break; case 450: /* tags_literal ::= NK_INTEGER */ case 462: /* tags_literal ::= NK_BIN */ yytestcase(yyruleno==462); case 471: /* tags_literal ::= NK_HEX */ yytestcase(yyruleno==471); - { yylhsminor.yy560 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; case 451: /* tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ case 452: /* tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==452); @@ -7217,11 +7231,11 @@ static YYACTIONTYPE yy_reduce( case 482: /* tags_literal ::= NK_STRING NK_MINUS duration_literal */ yytestcase(yyruleno==482); { SToken l = yymsp[-2].minor.yy0; - SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); + SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248); l.n = (r.z + r.n) - l.z; - yylhsminor.yy560 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy560); + yylhsminor.yy248 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy248); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 453: /* tags_literal ::= NK_PLUS NK_INTEGER */ case 456: /* tags_literal ::= NK_MINUS NK_INTEGER */ yytestcase(yyruleno==456); @@ -7232,9 +7246,9 @@ static YYACTIONTYPE yy_reduce( { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy560 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL); + yylhsminor.yy248 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + yymsp[-1].minor.yy248 = yylhsminor.yy248; break; case 454: /* tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ case 455: /* tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==455); @@ -7250,70 +7264,70 @@ static YYACTIONTYPE yy_reduce( case 479: /* tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==479); { SToken l = yymsp[-3].minor.yy0; - SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); + SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248); l.n = (r.z + r.n) - l.z; - yylhsminor.yy560 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy560); + yylhsminor.yy248 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy248); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + yymsp[-3].minor.yy248 = yylhsminor.yy248; break; case 459: /* tags_literal ::= NK_FLOAT */ - { yylhsminor.yy560 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; case 460: /* tags_literal ::= NK_PLUS NK_FLOAT */ case 461: /* tags_literal ::= NK_MINUS NK_FLOAT */ yytestcase(yyruleno==461); { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy560 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t, NULL); + yylhsminor.yy248 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t, NULL); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + yymsp[-1].minor.yy248 = yylhsminor.yy248; break; case 480: /* tags_literal ::= NK_STRING */ - { yylhsminor.yy560 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; case 483: /* tags_literal ::= NK_BOOL */ - { yylhsminor.yy560 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; case 484: /* tags_literal ::= NULL */ - { yylhsminor.yy560 = createRawValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createRawValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; case 485: /* tags_literal ::= literal_func */ - { yylhsminor.yy560 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, NULL, yymsp[0].minor.yy560); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, NULL, yymsp[0].minor.yy248); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; case 486: /* tags_literal ::= literal_func NK_PLUS duration_literal */ case 487: /* tags_literal ::= literal_func NK_MINUS duration_literal */ yytestcase(yyruleno==487); { - SToken l = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); + SToken l = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy248); + SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248); l.n = (r.z + r.n) - l.z; - yylhsminor.yy560 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, yymsp[-2].minor.yy560, yymsp[0].minor.yy560); + yylhsminor.yy248 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, yymsp[-2].minor.yy248, yymsp[0].minor.yy248); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 490: /* literal ::= NK_INTEGER */ - { yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; case 491: /* literal ::= NK_FLOAT */ - { yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; case 492: /* literal ::= NK_STRING */ - { yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; case 493: /* literal ::= NK_BOOL */ - { yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; case 494: /* literal ::= TIMESTAMP NK_STRING */ - { yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } + yymsp[-1].minor.yy248 = yylhsminor.yy248; break; case 495: /* literal ::= duration_literal */ case 505: /* signed_literal ::= signed */ yytestcase(yyruleno==505); @@ -7335,64 +7349,64 @@ static YYACTIONTYPE yy_reduce( case 736: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==736); case 739: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==739); case 741: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==741); - { yylhsminor.yy560 = yymsp[0].minor.yy560; } - yymsp[0].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = yymsp[0].minor.yy248; } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; case 496: /* literal ::= NULL */ - { yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; case 497: /* literal ::= NK_QUESTION */ - { yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; case 498: /* duration_literal ::= NK_VARIABLE */ case 710: /* interval_sliding_duration_literal ::= NK_VARIABLE */ yytestcase(yyruleno==710); case 711: /* interval_sliding_duration_literal ::= NK_STRING */ yytestcase(yyruleno==711); case 712: /* interval_sliding_duration_literal ::= NK_INTEGER */ yytestcase(yyruleno==712); - { yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; case 499: /* signed ::= NK_INTEGER */ - { yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; case 500: /* signed ::= NK_PLUS NK_INTEGER */ - { yymsp[-1].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } + { yymsp[-1].minor.yy248 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } break; case 501: /* 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.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); + yylhsminor.yy248 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + yymsp[-1].minor.yy248 = yylhsminor.yy248; break; case 502: /* signed ::= NK_FLOAT */ - { yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; case 503: /* signed ::= NK_PLUS NK_FLOAT */ - { yymsp[-1].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + { yymsp[-1].minor.yy248 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } break; case 504: /* 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.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); + yylhsminor.yy248 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + yymsp[-1].minor.yy248 = yylhsminor.yy248; break; case 506: /* signed_literal ::= NK_STRING */ - { yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; case 507: /* signed_literal ::= NK_BOOL */ - { yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; case 508: /* signed_literal ::= TIMESTAMP NK_STRING */ - { yymsp[-1].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + { yymsp[-1].minor.yy248 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; case 509: /* signed_literal ::= duration_literal */ case 511: /* signed_literal ::= literal_func */ yytestcase(yyruleno==511); @@ -7402,119 +7416,119 @@ static YYACTIONTYPE yy_reduce( case 740: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==740); case 742: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==742); case 755: /* search_condition ::= common_expression */ yytestcase(yyruleno==755); - { yylhsminor.yy560 = releaseRawExprNode(pCxt, yymsp[0].minor.yy560); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = releaseRawExprNode(pCxt, yymsp[0].minor.yy248); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; case 510: /* signed_literal ::= NULL */ - { yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; case 512: /* signed_literal ::= NK_QUESTION */ - { yylhsminor.yy560 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; case 531: /* expression ::= pseudo_column */ - { yylhsminor.yy560 = yymsp[0].minor.yy560; (void)setRawExprNodeIsPseudoColumn(pCxt, yylhsminor.yy560, true); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = yymsp[0].minor.yy248; (void)setRawExprNodeIsPseudoColumn(pCxt, yylhsminor.yy248, true); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; case 535: /* expression ::= NK_LP expression NK_RP */ case 638: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==638); case 754: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==754); - { yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy248)); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 536: /* expression ::= NK_PLUS expr_or_subquery */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248); + yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy248)); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + yymsp[-1].minor.yy248 = yylhsminor.yy248; break; case 537: /* expression ::= NK_MINUS expr_or_subquery */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy560), NULL)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248); + yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy248), NULL)); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + yymsp[-1].minor.yy248 = yylhsminor.yy248; break; case 538: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy248); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248); + yylhsminor.yy248 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), releaseRawExprNode(pCxt, yymsp[0].minor.yy248))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 539: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy248); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248); + yylhsminor.yy248 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), releaseRawExprNode(pCxt, yymsp[0].minor.yy248))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 540: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy248); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248); + yylhsminor.yy248 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), releaseRawExprNode(pCxt, yymsp[0].minor.yy248))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 541: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy248); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248); + yylhsminor.yy248 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), releaseRawExprNode(pCxt, yymsp[0].minor.yy248))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 542: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy248); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248); + yylhsminor.yy248 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), releaseRawExprNode(pCxt, yymsp[0].minor.yy248))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 543: /* expression ::= column_reference NK_ARROW NK_STRING */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy248); + yylhsminor.yy248 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 544: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy248); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248); + yylhsminor.yy248 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), releaseRawExprNode(pCxt, yymsp[0].minor.yy248))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 545: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy248); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248); + yylhsminor.yy248 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), releaseRawExprNode(pCxt, yymsp[0].minor.yy248))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 548: /* column_reference ::= column_name */ - { yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy533, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy533)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createRawExprNode(pCxt, &yymsp[0].minor.yy401, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy401)); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; case 549: /* column_reference ::= table_name NK_DOT column_name */ - { yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy533, createColumnNode(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy533)); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy401, &yymsp[0].minor.yy401, createColumnNode(pCxt, &yymsp[-2].minor.yy401, &yymsp[0].minor.yy401)); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 550: /* column_reference ::= NK_ALIAS */ - { yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; case 551: /* column_reference ::= table_name NK_DOT NK_ALIAS */ - { yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy0, createColumnNode(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy401, &yymsp[0].minor.yy0, createColumnNode(pCxt, &yymsp[-2].minor.yy401, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 552: /* pseudo_column ::= ROWTS */ case 553: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==553); @@ -7529,450 +7543,442 @@ static YYACTIONTYPE yy_reduce( case 563: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==563); case 579: /* literal_func ::= NOW */ yytestcase(yyruleno==579); case 580: /* literal_func ::= TODAY */ yytestcase(yyruleno==580); - { yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; case 554: /* pseudo_column ::= table_name NK_DOT TBNAME */ - { yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy533)))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy401, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy401)))); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 564: /* function_expression ::= function_name NK_LP expression_list NK_RP */ case 565: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==565); case 573: /* function_expression ::= substr_func NK_LP expression_list NK_RP */ yytestcase(yyruleno==573); - { yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy533, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy533, yymsp[-1].minor.yy334)); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy401, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy401, yymsp[-1].minor.yy928)); } + yymsp[-3].minor.yy248 = yylhsminor.yy248; break; case 566: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ case 567: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ yytestcase(yyruleno==567); - { yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), yymsp[-1].minor.yy952)); } - yymsp[-5].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy248), yymsp[-1].minor.yy976)); } + yymsp[-5].minor.yy248 = yylhsminor.yy248; break; case 568: /* function_expression ::= POSITION NK_LP expr_or_subquery IN expr_or_subquery NK_RP */ - { yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createPositionFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), releaseRawExprNode(pCxt, yymsp[-1].minor.yy560))); } - yymsp[-5].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createPositionFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy248), releaseRawExprNode(pCxt, yymsp[-1].minor.yy248))); } + yymsp[-5].minor.yy248 = yylhsminor.yy248; break; case 569: /* function_expression ::= TRIM NK_LP expr_or_subquery NK_RP */ - { yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560), TRIM_TYPE_BOTH)); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy248), TRIM_TYPE_BOTH)); } + yymsp[-3].minor.yy248 = yylhsminor.yy248; break; case 570: /* function_expression ::= TRIM NK_LP trim_specification_type FROM expr_or_subquery NK_RP */ - { yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560), yymsp[-3].minor.yy672)); } - yymsp[-5].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy248), yymsp[-3].minor.yy72)); } + yymsp[-5].minor.yy248 = yylhsminor.yy248; break; case 571: /* function_expression ::= TRIM NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ - { yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), releaseRawExprNode(pCxt, yymsp[-1].minor.yy560), TRIM_TYPE_BOTH)); } - yymsp[-5].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy248), releaseRawExprNode(pCxt, yymsp[-1].minor.yy248), TRIM_TYPE_BOTH)); } + yymsp[-5].minor.yy248 = yylhsminor.yy248; break; case 572: /* function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP */ - { yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-6].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), releaseRawExprNode(pCxt, yymsp[-1].minor.yy560), yymsp[-4].minor.yy672)); } - yymsp[-6].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-6].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy248), releaseRawExprNode(pCxt, yymsp[-1].minor.yy248), yymsp[-4].minor.yy72)); } + yymsp[-6].minor.yy248 = yylhsminor.yy248; break; case 574: /* function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ - { yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy533, &yymsp[0].minor.yy0, createSubstrFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), releaseRawExprNode(pCxt, yymsp[-1].minor.yy560))); } - yymsp[-5].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy401, &yymsp[0].minor.yy0, createSubstrFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy248), releaseRawExprNode(pCxt, yymsp[-1].minor.yy248))); } + yymsp[-5].minor.yy248 = yylhsminor.yy248; break; case 575: /* function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP */ - { yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-7].minor.yy533, &yymsp[0].minor.yy0, createSubstrFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy560), releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), releaseRawExprNode(pCxt, yymsp[-1].minor.yy560))); } - yymsp[-7].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-7].minor.yy401, &yymsp[0].minor.yy0, createSubstrFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy248), releaseRawExprNode(pCxt, yymsp[-3].minor.yy248), releaseRawExprNode(pCxt, yymsp[-1].minor.yy248))); } + yymsp[-7].minor.yy248 = yylhsminor.yy248; break; case 576: /* function_expression ::= REPLACE NK_LP expression_list NK_RP */ - { yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy334)); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy928)); } + yymsp[-3].minor.yy248 = yylhsminor.yy248; break; case 578: /* literal_func ::= noarg_func NK_LP NK_RP */ - { yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy533, NULL)); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy401, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy401, NULL)); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 583: /* trim_specification_type ::= BOTH */ - { yymsp[0].minor.yy672 = TRIM_TYPE_BOTH; } + { yymsp[0].minor.yy72 = TRIM_TYPE_BOTH; } break; case 584: /* trim_specification_type ::= TRAILING */ - { yymsp[0].minor.yy672 = TRIM_TYPE_TRAILING; } + { yymsp[0].minor.yy72 = TRIM_TYPE_TRAILING; } break; case 585: /* trim_specification_type ::= LEADING */ - { yymsp[0].minor.yy672 = TRIM_TYPE_LEADING; } + { yymsp[0].minor.yy72 = TRIM_TYPE_LEADING; } break; case 600: /* star_func_para_list ::= NK_STAR */ - { yylhsminor.yy334 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy334 = yylhsminor.yy334; + { yylhsminor.yy928 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy928 = yylhsminor.yy928; break; case 605: /* star_func_para ::= table_name NK_DOT NK_STAR */ case 690: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==690); - { yylhsminor.yy560 = createColumnNode(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createColumnNode(pCxt, &yymsp[-2].minor.yy401, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 606: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ - { yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy334, yymsp[-1].minor.yy560)); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy928, yymsp[-1].minor.yy248)); } + yymsp[-3].minor.yy248 = yylhsminor.yy248; break; case 607: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - { yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), yymsp[-2].minor.yy334, yymsp[-1].minor.yy560)); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy248), yymsp[-2].minor.yy928, yymsp[-1].minor.yy248)); } + yymsp[-4].minor.yy248 = yylhsminor.yy248; break; case 610: /* when_then_expr ::= WHEN common_expression THEN common_expression */ - { yymsp[-3].minor.yy560 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); } + { yymsp[-3].minor.yy248 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), releaseRawExprNode(pCxt, yymsp[0].minor.yy248)); } break; case 612: /* case_when_else_opt ::= ELSE common_expression */ - { yymsp[-1].minor.yy560 = releaseRawExprNode(pCxt, yymsp[0].minor.yy560); } + { yymsp[-1].minor.yy248 = releaseRawExprNode(pCxt, yymsp[0].minor.yy248); } break; case 613: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ case 618: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==618); { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy506, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy248); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248); + yylhsminor.yy248 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy716, releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), releaseRawExprNode(pCxt, yymsp[0].minor.yy248))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 614: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy560), releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy248); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248); + yylhsminor.yy248 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy248), releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), releaseRawExprNode(pCxt, yymsp[0].minor.yy248))); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; + yymsp[-4].minor.yy248 = yylhsminor.yy248; break; case 615: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy560), releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy248); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248); + yylhsminor.yy248 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy248), releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), releaseRawExprNode(pCxt, yymsp[0].minor.yy248))); } - yymsp[-5].minor.yy560 = yylhsminor.yy560; + yymsp[-5].minor.yy248 = yylhsminor.yy248; break; case 616: /* predicate ::= expr_or_subquery IS NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy248); + yylhsminor.yy248 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), NULL)); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 617: /* predicate ::= expr_or_subquery IS NOT NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy248); + yylhsminor.yy248 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy248), NULL)); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + yymsp[-3].minor.yy248 = yylhsminor.yy248; break; case 619: /* compare_op ::= NK_LT */ - { yymsp[0].minor.yy506 = OP_TYPE_LOWER_THAN; } + { yymsp[0].minor.yy716 = OP_TYPE_LOWER_THAN; } break; case 620: /* compare_op ::= NK_GT */ - { yymsp[0].minor.yy506 = OP_TYPE_GREATER_THAN; } + { yymsp[0].minor.yy716 = OP_TYPE_GREATER_THAN; } break; case 621: /* compare_op ::= NK_LE */ - { yymsp[0].minor.yy506 = OP_TYPE_LOWER_EQUAL; } + { yymsp[0].minor.yy716 = OP_TYPE_LOWER_EQUAL; } break; case 622: /* compare_op ::= NK_GE */ - { yymsp[0].minor.yy506 = OP_TYPE_GREATER_EQUAL; } + { yymsp[0].minor.yy716 = OP_TYPE_GREATER_EQUAL; } break; case 623: /* compare_op ::= NK_NE */ - { yymsp[0].minor.yy506 = OP_TYPE_NOT_EQUAL; } + { yymsp[0].minor.yy716 = OP_TYPE_NOT_EQUAL; } break; case 624: /* compare_op ::= NK_EQ */ - { yymsp[0].minor.yy506 = OP_TYPE_EQUAL; } + { yymsp[0].minor.yy716 = OP_TYPE_EQUAL; } break; case 625: /* compare_op ::= LIKE */ - { yymsp[0].minor.yy506 = OP_TYPE_LIKE; } + { yymsp[0].minor.yy716 = OP_TYPE_LIKE; } break; case 626: /* compare_op ::= NOT LIKE */ - { yymsp[-1].minor.yy506 = OP_TYPE_NOT_LIKE; } + { yymsp[-1].minor.yy716 = OP_TYPE_NOT_LIKE; } break; case 627: /* compare_op ::= MATCH */ - { yymsp[0].minor.yy506 = OP_TYPE_MATCH; } + { yymsp[0].minor.yy716 = OP_TYPE_MATCH; } break; case 628: /* compare_op ::= NMATCH */ - { yymsp[0].minor.yy506 = OP_TYPE_NMATCH; } + { yymsp[0].minor.yy716 = OP_TYPE_NMATCH; } break; case 629: /* compare_op ::= CONTAINS */ - { yymsp[0].minor.yy506 = OP_TYPE_JSON_CONTAINS; } + { yymsp[0].minor.yy716 = OP_TYPE_JSON_CONTAINS; } break; case 630: /* in_op ::= IN */ - { yymsp[0].minor.yy506 = OP_TYPE_IN; } + { yymsp[0].minor.yy716 = OP_TYPE_IN; } break; case 631: /* in_op ::= NOT IN */ - { yymsp[-1].minor.yy506 = OP_TYPE_NOT_IN; } + { yymsp[-1].minor.yy716 = OP_TYPE_NOT_IN; } break; case 632: /* in_predicate_value ::= NK_LP literal_list NK_RP */ - { yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy334)); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy928)); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 634: /* boolean_value_expression ::= NOT boolean_primary */ { - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy560), NULL)); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248); + yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy248), NULL)); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + yymsp[-1].minor.yy248 = yylhsminor.yy248; break; case 635: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy248); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248); + yylhsminor.yy248 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), releaseRawExprNode(pCxt, yymsp[0].minor.yy248))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 636: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy248); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248); + yylhsminor.yy248 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), releaseRawExprNode(pCxt, yymsp[0].minor.yy248))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 644: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ - { yylhsminor.yy560 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, JOIN_STYPE_NONE, yymsp[-2].minor.yy560, yymsp[0].minor.yy560, NULL); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, JOIN_STYPE_NONE, yymsp[-2].minor.yy248, yymsp[0].minor.yy248, NULL); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 647: /* table_primary ::= table_name alias_opt */ - { yylhsminor.yy560 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy533, &yymsp[0].minor.yy533); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy401, &yymsp[0].minor.yy401); } + yymsp[-1].minor.yy248 = yylhsminor.yy248; break; case 648: /* table_primary ::= db_name NK_DOT table_name alias_opt */ - { yylhsminor.yy560 = createRealTableNode(pCxt, &yymsp[-3].minor.yy533, &yymsp[-1].minor.yy533, &yymsp[0].minor.yy533); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createRealTableNode(pCxt, &yymsp[-3].minor.yy401, &yymsp[-1].minor.yy401, &yymsp[0].minor.yy401); } + yymsp[-3].minor.yy248 = yylhsminor.yy248; break; case 649: /* table_primary ::= subquery alias_opt */ - { yylhsminor.yy560 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560), &yymsp[0].minor.yy533); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy248), &yymsp[0].minor.yy401); } + yymsp[-1].minor.yy248 = yylhsminor.yy248; break; case 651: /* alias_opt ::= */ - { yymsp[1].minor.yy533 = nil_token; } + { yymsp[1].minor.yy401 = nil_token; } break; case 653: /* alias_opt ::= AS table_alias */ - { yymsp[-1].minor.yy533 = yymsp[0].minor.yy533; } + { yymsp[-1].minor.yy401 = yymsp[0].minor.yy401; } break; case 654: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ case 655: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==655); - { yymsp[-2].minor.yy560 = yymsp[-1].minor.yy560; } + { yymsp[-2].minor.yy248 = yymsp[-1].minor.yy248; } break; case 656: /* joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ { - yylhsminor.yy560 = createJoinTableNode(pCxt, yymsp[-6].minor.yy36, yymsp[-5].minor.yy648, yymsp[-7].minor.yy560, yymsp[-3].minor.yy560, yymsp[-2].minor.yy560); - yylhsminor.yy560 = addWindowOffsetClause(pCxt, yylhsminor.yy560, yymsp[-1].minor.yy560); - yylhsminor.yy560 = addJLimitClause(pCxt, yylhsminor.yy560, yymsp[0].minor.yy560); + yylhsminor.yy248 = createJoinTableNode(pCxt, yymsp[-6].minor.yy804, yymsp[-5].minor.yy582, yymsp[-7].minor.yy248, yymsp[-3].minor.yy248, yymsp[-2].minor.yy248); + yylhsminor.yy248 = addWindowOffsetClause(pCxt, yylhsminor.yy248, yymsp[-1].minor.yy248); + yylhsminor.yy248 = addJLimitClause(pCxt, yylhsminor.yy248, yymsp[0].minor.yy248); } - yymsp[-7].minor.yy560 = yylhsminor.yy560; + yymsp[-7].minor.yy248 = yylhsminor.yy248; break; case 657: /* join_type ::= */ - { yymsp[1].minor.yy36 = JOIN_TYPE_INNER; } + { yymsp[1].minor.yy804 = JOIN_TYPE_INNER; } break; case 658: /* join_type ::= INNER */ - { yymsp[0].minor.yy36 = JOIN_TYPE_INNER; } + { yymsp[0].minor.yy804 = JOIN_TYPE_INNER; } break; case 659: /* join_type ::= LEFT */ - { yymsp[0].minor.yy36 = JOIN_TYPE_LEFT; } + { yymsp[0].minor.yy804 = JOIN_TYPE_LEFT; } break; case 660: /* join_type ::= RIGHT */ - { yymsp[0].minor.yy36 = JOIN_TYPE_RIGHT; } + { yymsp[0].minor.yy804 = JOIN_TYPE_RIGHT; } break; case 661: /* join_type ::= FULL */ - { yymsp[0].minor.yy36 = JOIN_TYPE_FULL; } + { yymsp[0].minor.yy804 = JOIN_TYPE_FULL; } break; case 662: /* join_subtype ::= */ - { yymsp[1].minor.yy648 = JOIN_STYPE_NONE; } + { yymsp[1].minor.yy582 = JOIN_STYPE_NONE; } break; case 663: /* join_subtype ::= OUTER */ - { yymsp[0].minor.yy648 = JOIN_STYPE_OUTER; } + { yymsp[0].minor.yy582 = JOIN_STYPE_OUTER; } break; case 664: /* join_subtype ::= SEMI */ - { yymsp[0].minor.yy648 = JOIN_STYPE_SEMI; } + { yymsp[0].minor.yy582 = JOIN_STYPE_SEMI; } break; case 665: /* join_subtype ::= ANTI */ - { yymsp[0].minor.yy648 = JOIN_STYPE_ANTI; } + { yymsp[0].minor.yy582 = JOIN_STYPE_ANTI; } break; case 666: /* join_subtype ::= ASOF */ - { yymsp[0].minor.yy648 = JOIN_STYPE_ASOF; } + { yymsp[0].minor.yy582 = JOIN_STYPE_ASOF; } break; case 667: /* join_subtype ::= WINDOW */ - { yymsp[0].minor.yy648 = JOIN_STYPE_WIN; } + { yymsp[0].minor.yy582 = JOIN_STYPE_WIN; } break; case 671: /* window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ - { yymsp[-5].minor.yy560 = createWindowOffsetNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); } + { yymsp[-5].minor.yy248 = createWindowOffsetNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy248), releaseRawExprNode(pCxt, yymsp[-1].minor.yy248)); } break; case 672: /* window_offset_literal ::= NK_VARIABLE */ - { yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createTimeOffsetValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createTimeOffsetValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; case 673: /* window_offset_literal ::= NK_MINUS NK_VARIABLE */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy560 = createRawExprNode(pCxt, &t, createTimeOffsetValueNode(pCxt, &t)); + yylhsminor.yy248 = createRawExprNode(pCxt, &t, createTimeOffsetValueNode(pCxt, &t)); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + yymsp[-1].minor.yy248 = yylhsminor.yy248; break; case 675: /* jlimit_clause_opt ::= JLIMIT NK_INTEGER */ case 746: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ yytestcase(yyruleno==746); case 750: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==750); - { yymsp[-1].minor.yy560 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } + { yymsp[-1].minor.yy248 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } break; case 676: /* query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ { - yymsp[-13].minor.yy560 = createSelectStmt(pCxt, yymsp[-11].minor.yy173, yymsp[-9].minor.yy334, yymsp[-8].minor.yy560, yymsp[-12].minor.yy334); - yymsp[-13].minor.yy560 = setSelectStmtTagMode(pCxt, yymsp[-13].minor.yy560, yymsp[-10].minor.yy173); - yymsp[-13].minor.yy560 = addWhereClause(pCxt, yymsp[-13].minor.yy560, yymsp[-7].minor.yy560); - yymsp[-13].minor.yy560 = addPartitionByClause(pCxt, yymsp[-13].minor.yy560, yymsp[-6].minor.yy334); - yymsp[-13].minor.yy560 = addWindowClauseClause(pCxt, yymsp[-13].minor.yy560, yymsp[-2].minor.yy560); - yymsp[-13].minor.yy560 = addGroupByClause(pCxt, yymsp[-13].minor.yy560, yymsp[-1].minor.yy334); - yymsp[-13].minor.yy560 = addHavingClause(pCxt, yymsp[-13].minor.yy560, yymsp[0].minor.yy560); - yymsp[-13].minor.yy560 = addRangeClause(pCxt, yymsp[-13].minor.yy560, yymsp[-5].minor.yy560); - yymsp[-13].minor.yy560 = addEveryClause(pCxt, yymsp[-13].minor.yy560, yymsp[-4].minor.yy560); - yymsp[-13].minor.yy560 = addFillClause(pCxt, yymsp[-13].minor.yy560, yymsp[-3].minor.yy560); + yymsp[-13].minor.yy248 = createSelectStmt(pCxt, yymsp[-11].minor.yy89, yymsp[-9].minor.yy928, yymsp[-8].minor.yy248, yymsp[-12].minor.yy928); + yymsp[-13].minor.yy248 = setSelectStmtTagMode(pCxt, yymsp[-13].minor.yy248, yymsp[-10].minor.yy89); + yymsp[-13].minor.yy248 = addWhereClause(pCxt, yymsp[-13].minor.yy248, yymsp[-7].minor.yy248); + yymsp[-13].minor.yy248 = addPartitionByClause(pCxt, yymsp[-13].minor.yy248, yymsp[-6].minor.yy928); + yymsp[-13].minor.yy248 = addWindowClauseClause(pCxt, yymsp[-13].minor.yy248, yymsp[-2].minor.yy248); + yymsp[-13].minor.yy248 = addGroupByClause(pCxt, yymsp[-13].minor.yy248, yymsp[-1].minor.yy928); + yymsp[-13].minor.yy248 = addHavingClause(pCxt, yymsp[-13].minor.yy248, yymsp[0].minor.yy248); + yymsp[-13].minor.yy248 = addRangeClause(pCxt, yymsp[-13].minor.yy248, yymsp[-5].minor.yy248); + yymsp[-13].minor.yy248 = addEveryClause(pCxt, yymsp[-13].minor.yy248, yymsp[-4].minor.yy248); + yymsp[-13].minor.yy248 = addFillClause(pCxt, yymsp[-13].minor.yy248, yymsp[-3].minor.yy248); } break; case 677: /* hint_list ::= */ - { yymsp[1].minor.yy334 = createHintNodeList(pCxt, NULL); } + { yymsp[1].minor.yy928 = createHintNodeList(pCxt, NULL); } break; case 678: /* hint_list ::= NK_HINT */ - { yylhsminor.yy334 = createHintNodeList(pCxt, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy334 = yylhsminor.yy334; + { yylhsminor.yy928 = createHintNodeList(pCxt, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy928 = yylhsminor.yy928; break; case 683: /* set_quantifier_opt ::= ALL */ - { yymsp[0].minor.yy173 = false; } + { yymsp[0].minor.yy89 = false; } break; case 686: /* select_item ::= NK_STAR */ - { yylhsminor.yy560 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; case 688: /* select_item ::= common_expression column_alias */ case 698: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==698); - { yylhsminor.yy560 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560), &yymsp[0].minor.yy533); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy248), &yymsp[0].minor.yy401); } + yymsp[-1].minor.yy248 = yylhsminor.yy248; break; case 689: /* select_item ::= common_expression AS column_alias */ case 699: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==699); - { yylhsminor.yy560 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), &yymsp[0].minor.yy533); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), &yymsp[0].minor.yy401); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 694: /* partition_by_clause_opt ::= PARTITION BY partition_list */ case 724: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==724); case 744: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==744); - { yymsp[-2].minor.yy334 = yymsp[0].minor.yy334; } + { yymsp[-2].minor.yy928 = yymsp[0].minor.yy928; } break; case 701: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ - { yymsp[-5].minor.yy560 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); } + { yymsp[-5].minor.yy248 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy248), releaseRawExprNode(pCxt, yymsp[-1].minor.yy248)); } break; case 702: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - { yymsp[-3].minor.yy560 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); } + { yymsp[-3].minor.yy248 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy248)); } break; case 703: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - { yymsp[-5].minor.yy560 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), NULL, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } + { yymsp[-5].minor.yy248 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy248), NULL, yymsp[-1].minor.yy248, yymsp[0].minor.yy248); } break; case 704: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - { yymsp[-7].minor.yy560 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy560), releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } + { yymsp[-7].minor.yy248 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy248), releaseRawExprNode(pCxt, yymsp[-3].minor.yy248), yymsp[-1].minor.yy248, yymsp[0].minor.yy248); } break; case 705: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ - { yymsp[-6].minor.yy560 = createEventWindowNode(pCxt, yymsp[-3].minor.yy560, yymsp[0].minor.yy560); } + { yymsp[-6].minor.yy248 = createEventWindowNode(pCxt, yymsp[-3].minor.yy248, yymsp[0].minor.yy248); } break; case 706: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ - { yymsp[-3].minor.yy560 = createCountWindowNode(pCxt, &yymsp[-1].minor.yy0, &yymsp[-1].minor.yy0); } + { yymsp[-3].minor.yy248 = createCountWindowNode(pCxt, &yymsp[-1].minor.yy0, &yymsp[-1].minor.yy0); } break; case 707: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - { yymsp[-5].minor.yy560 = createCountWindowNode(pCxt, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0); } + { yymsp[-5].minor.yy248 = createCountWindowNode(pCxt, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0); } break; case 714: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ - { yymsp[-3].minor.yy560 = createFillNode(pCxt, yymsp[-1].minor.yy18, NULL); } + { yymsp[-3].minor.yy248 = createFillNode(pCxt, yymsp[-1].minor.yy583, NULL); } break; case 715: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ - { yymsp[-5].minor.yy560 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy334)); } + { yymsp[-5].minor.yy248 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy928)); } break; case 716: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ - { yymsp[-5].minor.yy560 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy334)); } + { yymsp[-5].minor.yy248 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy928)); } break; case 717: /* fill_mode ::= NONE */ - { yymsp[0].minor.yy18 = FILL_MODE_NONE; } + { yymsp[0].minor.yy583 = FILL_MODE_NONE; } break; case 718: /* fill_mode ::= PREV */ - { yymsp[0].minor.yy18 = FILL_MODE_PREV; } + { yymsp[0].minor.yy583 = FILL_MODE_PREV; } break; case 719: /* fill_mode ::= NULL */ - { yymsp[0].minor.yy18 = FILL_MODE_NULL; } + { yymsp[0].minor.yy583 = FILL_MODE_NULL; } break; case 720: /* fill_mode ::= NULL_F */ - { yymsp[0].minor.yy18 = FILL_MODE_NULL_F; } + { yymsp[0].minor.yy583 = FILL_MODE_NULL_F; } break; case 721: /* fill_mode ::= LINEAR */ - { yymsp[0].minor.yy18 = FILL_MODE_LINEAR; } + { yymsp[0].minor.yy583 = FILL_MODE_LINEAR; } break; case 722: /* fill_mode ::= NEXT */ - { yymsp[0].minor.yy18 = FILL_MODE_NEXT; } + { yymsp[0].minor.yy583 = FILL_MODE_NEXT; } break; case 725: /* group_by_list ::= expr_or_subquery */ - { yylhsminor.yy334 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); } - yymsp[0].minor.yy334 = yylhsminor.yy334; + { yylhsminor.yy928 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy248))); } + yymsp[0].minor.yy928 = yylhsminor.yy928; break; case 726: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - { yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); } - yymsp[-2].minor.yy334 = yylhsminor.yy334; + { yylhsminor.yy928 = addNodeToList(pCxt, yymsp[-2].minor.yy928, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy248))); } + yymsp[-2].minor.yy928 = yylhsminor.yy928; break; case 730: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - { yymsp[-5].minor.yy560 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); } + { yymsp[-5].minor.yy248 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy248), releaseRawExprNode(pCxt, yymsp[-1].minor.yy248)); } break; case 731: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ - { yymsp[-3].minor.yy560 = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); } + { yymsp[-3].minor.yy248 = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy248)); } break; case 734: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ { - yylhsminor.yy560 = addOrderByClause(pCxt, yymsp[-3].minor.yy560, yymsp[-2].minor.yy334); - yylhsminor.yy560 = addSlimitClause(pCxt, yylhsminor.yy560, yymsp[-1].minor.yy560); - yylhsminor.yy560 = addLimitClause(pCxt, yylhsminor.yy560, yymsp[0].minor.yy560); + yylhsminor.yy248 = addOrderByClause(pCxt, yymsp[-3].minor.yy248, yymsp[-2].minor.yy928); + yylhsminor.yy248 = addSlimitClause(pCxt, yylhsminor.yy248, yymsp[-1].minor.yy248); + yylhsminor.yy248 = addLimitClause(pCxt, yylhsminor.yy248, yymsp[0].minor.yy248); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + yymsp[-3].minor.yy248 = yylhsminor.yy248; break; case 737: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - { yylhsminor.yy560 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy560, yymsp[0].minor.yy560); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy248, yymsp[0].minor.yy248); } + yymsp[-3].minor.yy248 = yylhsminor.yy248; break; case 738: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - { yylhsminor.yy560 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy560, yymsp[0].minor.yy560); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy248, yymsp[0].minor.yy248); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 747: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ case 751: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==751); - { yymsp[-3].minor.yy560 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } + { yymsp[-3].minor.yy248 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; case 748: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ case 752: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==752); - { yymsp[-3].minor.yy560 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } + { yymsp[-3].minor.yy248 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } break; case 753: /* subquery ::= NK_LP query_expression NK_RP */ - { yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy560); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy248); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 758: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - { yylhsminor.yy560 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), yymsp[-1].minor.yy974, yymsp[0].minor.yy109); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + { yylhsminor.yy248 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), yymsp[-1].minor.yy482, yymsp[0].minor.yy721); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; case 759: /* ordering_specification_opt ::= */ - { yymsp[1].minor.yy974 = ORDER_ASC; } + { yymsp[1].minor.yy482 = ORDER_ASC; } break; case 760: /* ordering_specification_opt ::= ASC */ - { yymsp[0].minor.yy974 = ORDER_ASC; } + { yymsp[0].minor.yy482 = ORDER_ASC; } break; case 761: /* ordering_specification_opt ::= DESC */ - { yymsp[0].minor.yy974 = ORDER_DESC; } + { yymsp[0].minor.yy482 = ORDER_DESC; } break; case 762: /* null_ordering_opt ::= */ - { yymsp[1].minor.yy109 = NULL_ORDER_DEFAULT; } + { yymsp[1].minor.yy721 = NULL_ORDER_DEFAULT; } break; case 763: /* null_ordering_opt ::= NULLS FIRST */ - { yymsp[-1].minor.yy109 = NULL_ORDER_FIRST; } + { yymsp[-1].minor.yy721 = NULL_ORDER_FIRST; } break; case 764: /* null_ordering_opt ::= NULLS LAST */ - { yymsp[-1].minor.yy109 = NULL_ORDER_LAST; } + { yymsp[-1].minor.yy721 = NULL_ORDER_LAST; } break; - case 767: /* column_options ::= column_options ENCODE NK_STRING */ - { yylhsminor.yy560 = setColumnOptions(pCxt, yymsp[-2].minor.yy560, COLUMN_OPTION_ENCODE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 768: /* column_options ::= column_options COMPRESS NK_STRING */ - { yylhsminor.yy560 = setColumnOptions(pCxt, yymsp[-2].minor.yy560, COLUMN_OPTION_COMPRESS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 769: /* column_options ::= column_options LEVEL NK_STRING */ - { yylhsminor.yy560 = setColumnOptions(pCxt, yymsp[-2].minor.yy560, COLUMN_OPTION_LEVEL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 767: /* column_options ::= column_options NK_ID NK_STRING */ + { yylhsminor.yy248 = setColumnOptions(pCxt, yymsp[-2].minor.yy248, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; default: break; diff --git a/source/libs/planner/inc/planInt.h b/source/libs/planner/inc/planInt.h index 090071ee7f..beb277493c 100644 --- a/source/libs/planner/inc/planInt.h +++ b/source/libs/planner/inc/planInt.h @@ -68,6 +68,8 @@ int32_t tagScanSetExecutionMode(SScanLogicNode* pScan); int32_t cloneLimit(SLogicNode* pParent, SLogicNode* pChild, uint8_t cloneWhat, bool* pCloned); int32_t sortPriKeyOptGetSequencingNodesImpl(SLogicNode* pNode, bool groupSort, SSortLogicNode* pSort, bool* pNotOptimize, SNodeList** pSequencingNodes, bool* keepSort); +bool isColRefExpr(const SColumnNode* pCol, const SExprNode* pExpr); +void rewriteTargetsWithResId(SNodeList* pTargets); #ifdef __cplusplus diff --git a/source/libs/planner/src/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c index d5ee5c51df..3d13ad4c62 100644 --- a/source/libs/planner/src/planLogicCreater.c +++ b/source/libs/planner/src/planLogicCreater.c @@ -122,6 +122,7 @@ static EDealRes doRewriteExpr(SNode** pNode, void* pContext) { strcpy(pCol->node.aliasName, pToBeRewrittenExpr->aliasName); strcpy(pCol->node.userAlias, ((SExprNode*)pExpr)->userAlias); strcpy(pCol->colName, ((SExprNode*)pExpr)->aliasName); + pCol->node.projIdx = ((SExprNode*)(*pNode))->projIdx; if (QUERY_NODE_FUNCTION == nodeType(pExpr)) { setColumnInfo((SFunctionNode*)pExpr, pCol, pCxt->isPartitionBy); } @@ -637,6 +638,10 @@ static int32_t createJoinLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect } nodesDestroyList(pColList); } + + if (TSDB_CODE_SUCCESS == code) { + rewriteTargetsWithResId(pJoin->node.pTargets); + } if (NULL == pJoin->node.pTargets && NULL != pLeft) { code = nodesCloneList(pLeft->pTargets, &pJoin->node.pTargets); @@ -1342,6 +1347,9 @@ static int32_t createSortLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect ? (pSort->groupSort ? DATA_ORDER_LEVEL_IN_GROUP : DATA_ORDER_LEVEL_GLOBAL) : DATA_ORDER_LEVEL_NONE; code = nodesCollectColumns(pSelect, SQL_CLAUSE_ORDER_BY, NULL, COLLECT_COL_TYPE_ALL, &pSort->node.pTargets); + if (TSDB_CODE_SUCCESS == code) { + rewriteTargetsWithResId(pSort->node.pTargets); + } if (TSDB_CODE_SUCCESS == code && NULL == pSort->node.pTargets) { SNode* pNew = NULL; code = nodesCloneNode(nodesListGetNode(pCxt->pCurrRoot->pTargets, 0), &pNew); @@ -1390,11 +1398,14 @@ static int32_t createColumnByProjections(SLogicPlanContext* pCxt, const char* pS } SNode* pNode; + int32_t projIdx = 1; FOREACH(pNode, pExprs) { - if (TSDB_CODE_SUCCESS != (code = nodesListStrictAppend(pList, (SNode*)createColumnByExpr(pStmtName, (SExprNode*)pNode)))) { + SColumnNode* pCol = createColumnByExpr(pStmtName, (SExprNode*)pNode); + if (TSDB_CODE_SUCCESS != (code = nodesListStrictAppend(pList, (SNode*)pCol))) { nodesDestroyList(pList); return code; } + pCol->resIdx = ((SExprNode*)pNode)->projIdx; } *pCols = pList; @@ -1459,6 +1470,9 @@ static int32_t createPartitionLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pS code = nodesListMakeStrictAppend(&pPartition->node.pTargets, pNew); } } + if (TSDB_CODE_SUCCESS == code) { + rewriteTargetsWithResId(pPartition->node.pTargets); + } if (TSDB_CODE_SUCCESS == code) { // code = nodesCollectFuncs(pSelect, SQL_CLAUSE_GROUP_BY, NULL, fmIsAggFunc, &pPartition->pAggFuncs); diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index d48871fd70..7da4f93dee 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -3475,6 +3475,20 @@ static EDealRes eliminateProjOptRewriteScanTableAlias(SNode* pNode, void* pConte } +static void eliminateProjPushdownProjIdx(SNodeList* pParentProjects, SNodeList* pChildTargets) { + SNode* pChildTarget = NULL, *pParentProject = NULL; + FOREACH(pChildTarget, pChildTargets) { + SColumnNode* pTargetCol = (SColumnNode*)pChildTarget; + FOREACH(pParentProject, pParentProjects) { + SExprNode* pProject = (SExprNode*)pParentProject; + if (0 == strcmp(pTargetCol->colName, pProject->aliasName)) { + pTargetCol->resIdx = pProject->projIdx; + break; + } + } + } +} + static int32_t eliminateProjOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan, SProjectLogicNode* pProjectNode) { SLogicNode* pChild = (SLogicNode*)nodesListGetNode(pProjectNode->node.pChildren, 0); @@ -3546,6 +3560,7 @@ static int32_t eliminateProjOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* nodesWalkExprs(pScan->pScanPseudoCols, eliminateProjOptRewriteScanTableAlias, &cxt); nodesWalkExpr(pScan->node.pConditions, eliminateProjOptRewriteScanTableAlias, &cxt); nodesWalkExprs(pChild->pTargets, eliminateProjOptRewriteScanTableAlias, &cxt); + eliminateProjPushdownProjIdx(pProjectNode->pProjections, pChild->pTargets); } if (TSDB_CODE_SUCCESS == code) { @@ -4883,6 +4898,31 @@ typedef struct SMergeProjectionsContext { int32_t errCode; } SMergeProjectionsContext; +static EDealRes mergeProjectionsExpr2(SNode** pNode, void* pContext) { + SMergeProjectionsContext* pCxt = pContext; + SProjectLogicNode* pChildProj = pCxt->pChildProj; + if (QUERY_NODE_COLUMN == nodeType(*pNode)) { + SColumnNode* pProjCol = (SColumnNode*)(*pNode); + SNode* pProjection; + int32_t projIdx = 1; + FOREACH(pProjection, pChildProj->pProjections) { + if (isColRefExpr(pProjCol, (SExprNode*)pProjection)) { + SNode* pExpr = NULL; + pCxt->errCode = nodesCloneNode(pProjection, &pExpr); + if (pExpr == NULL) { + return DEAL_RES_ERROR; + } + snprintf(((SExprNode*)pExpr)->aliasName, sizeof(((SExprNode*)pExpr)->aliasName), "%s", + ((SExprNode*)*pNode)->aliasName); + nodesDestroyNode(*pNode); + *pNode = pExpr; + return DEAL_RES_IGNORE_CHILD; + } + } + } + return DEAL_RES_CONTINUE; +} + static EDealRes mergeProjectionsExpr(SNode** pNode, void* pContext) { SMergeProjectionsContext* pCxt = pContext; SProjectLogicNode* pChildProj = pCxt->pChildProj; @@ -4917,7 +4957,7 @@ static int32_t mergeProjectsOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* ((SProjectLogicNode*)pSelfNode)->inputIgnoreGroup = true; } SMergeProjectionsContext cxt = {.pChildProj = (SProjectLogicNode*)pChild, .errCode = TSDB_CODE_SUCCESS}; - nodesRewriteExprs(((SProjectLogicNode*)pSelfNode)->pProjections, mergeProjectionsExpr, &cxt); + nodesRewriteExprs(((SProjectLogicNode*)pSelfNode)->pProjections, mergeProjectionsExpr2, &cxt); int32_t code = cxt.errCode; if (TSDB_CODE_SUCCESS == code) { @@ -6578,7 +6618,6 @@ static bool tsmaOptMayBeOptimized(SLogicNode* pNode, void* pCtx) { return false; } - assert(pFuncs); FOREACH(pTmpNode, pFuncs) { SFunctionNode* pFunc = (SFunctionNode*)pTmpNode; if (!fmIsTSMASupportedFunc(pFunc->funcId) && !fmIsPseudoColumnFunc(pFunc->funcId) && @@ -7271,7 +7310,6 @@ static int32_t tsmaOptRewriteParent(STSMAOptCtx* pTsmaOptCtx, SLogicNode* pParen if (code == TSDB_CODE_SUCCESS && pWindow) { SColumnNode* pCol = (SColumnNode*)pScan->pScanCols->pTail->pNode; - assert(pCol->colId == PRIMARYKEY_TIMESTAMP_COL_ID); nodesDestroyNode(pWindow->pTspk); pWindow->pTspk = NULL; code = nodesCloneNode((SNode*)pCol, &pWindow->pTspk); diff --git a/source/libs/planner/src/planPhysiCreater.c b/source/libs/planner/src/planPhysiCreater.c index e50e574f01..2b0f449b77 100644 --- a/source/libs/planner/src/planPhysiCreater.c +++ b/source/libs/planner/src/planPhysiCreater.c @@ -35,17 +35,18 @@ typedef struct SPhysiPlanContext { int32_t errCode; int16_t nextDataBlockId; SArray* pLocationHelper; + SArray* pProjIdxLocHelper; bool hasScan; bool hasSysScan; } SPhysiPlanContext; -static int32_t getSlotKey(SNode* pNode, const char* pStmtName, char** ppKey, int32_t *pLen) { +static int32_t getSlotKey(SNode* pNode, const char* pStmtName, char** ppKey, int32_t *pLen, uint16_t extraBufLen) { int32_t code = 0; if (QUERY_NODE_COLUMN == nodeType(pNode)) { SColumnNode* pCol = (SColumnNode*)pNode; if (NULL != pStmtName) { if ('\0' != pStmtName[0]) { - *ppKey = taosMemoryCalloc(1, TSDB_TABLE_NAME_LEN + 1 + TSDB_COL_NAME_LEN + 1); + *ppKey = taosMemoryCalloc(1, TSDB_TABLE_NAME_LEN + 1 + TSDB_COL_NAME_LEN + 1 + extraBufLen); if (!*ppKey) { return terrno; } @@ -55,7 +56,7 @@ static int32_t getSlotKey(SNode* pNode, const char* pStmtName, char** ppKey, int *pLen = taosHashBinary(*ppKey, strlen(*ppKey)); return code; } else { - *ppKey = taosMemoryCalloc(1, TSDB_COL_NAME_LEN + 1); + *ppKey = taosMemoryCalloc(1, TSDB_COL_NAME_LEN + 1 + extraBufLen); if (!*ppKey) { return terrno; } @@ -65,7 +66,7 @@ static int32_t getSlotKey(SNode* pNode, const char* pStmtName, char** ppKey, int } } if ('\0' == pCol->tableAlias[0]) { - *ppKey = taosMemoryCalloc(1, TSDB_COL_NAME_LEN + 1); + *ppKey = taosMemoryCalloc(1, TSDB_COL_NAME_LEN + 1 + extraBufLen); if (!*ppKey) { return terrno; } @@ -74,7 +75,7 @@ static int32_t getSlotKey(SNode* pNode, const char* pStmtName, char** ppKey, int return code; } - *ppKey = taosMemoryCalloc(1, TSDB_TABLE_NAME_LEN + 1 + TSDB_COL_NAME_LEN + 1); + *ppKey = taosMemoryCalloc(1, TSDB_TABLE_NAME_LEN + 1 + TSDB_COL_NAME_LEN + 1 + extraBufLen); if (!*ppKey) { return terrno; } @@ -89,7 +90,7 @@ static int32_t getSlotKey(SNode* pNode, const char* pStmtName, char** ppKey, int SValueNode* pVal = (SValueNode*)nodesListGetNode(pFunc->pParameterList, 0); if (pVal) { if (NULL != pStmtName && '\0' != pStmtName[0]) { - *ppKey = taosMemoryCalloc(1, TSDB_TABLE_NAME_LEN + 1 + TSDB_COL_NAME_LEN + 1); + *ppKey = taosMemoryCalloc(1, TSDB_TABLE_NAME_LEN + 1 + TSDB_COL_NAME_LEN + 1 + extraBufLen); if (!*ppKey) { return terrno; } @@ -99,7 +100,7 @@ static int32_t getSlotKey(SNode* pNode, const char* pStmtName, char** ppKey, int *pLen = taosHashBinary(*ppKey, strlen(*ppKey)); return code; } - *ppKey = taosMemoryCalloc(1, strlen(pVal->literal) + 1 + TSDB_COL_NAME_LEN + 1); + *ppKey = taosMemoryCalloc(1, strlen(pVal->literal) + 1 + TSDB_COL_NAME_LEN + 1 + extraBufLen); if (!*ppKey) { return terrno; } @@ -113,7 +114,7 @@ static int32_t getSlotKey(SNode* pNode, const char* pStmtName, char** ppKey, int } if (NULL != pStmtName && '\0' != pStmtName[0]) { - *ppKey = taosMemoryCalloc(1, TSDB_TABLE_NAME_LEN + 1 + TSDB_COL_NAME_LEN + 1); + *ppKey = taosMemoryCalloc(1, TSDB_TABLE_NAME_LEN + 1 + TSDB_COL_NAME_LEN + 1 + extraBufLen); if (!*ppKey) { return terrno; } @@ -124,7 +125,7 @@ static int32_t getSlotKey(SNode* pNode, const char* pStmtName, char** ppKey, int return code; } - *ppKey = taosMemoryCalloc(1, TSDB_COL_NAME_LEN + 1); + *ppKey = taosMemoryCalloc(1, TSDB_COL_NAME_LEN + 1 + extraBufLen); if (!*ppKey) { return terrno; } @@ -191,22 +192,34 @@ static int32_t putSlotToHash(const char* pName, int32_t len, int16_t dataBlockId } static int32_t createDataBlockDescHash(SPhysiPlanContext* pCxt, int32_t capacity, int16_t dataBlockId, - SHashObj** pDescHash) { + SHashObj** pDescHash, SHashObj** ppProjIdxDescHash) { SHashObj* pHash = taosHashInit(capacity, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK); if (NULL == pHash) { return TSDB_CODE_OUT_OF_MEMORY; } + SHashObj* pProjIdxHash = taosHashInit(capacity, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK); + if (!pProjIdxHash) { + taosHashCleanup(pHash); + return TSDB_CODE_OUT_OF_MEMORY; + } if (NULL == taosArrayInsert(pCxt->pLocationHelper, dataBlockId, &pHash)) { taosHashCleanup(pHash); + taosHashCleanup(pProjIdxHash); + return TSDB_CODE_OUT_OF_MEMORY; + } + if (NULL == taosArrayInsert(pCxt->pProjIdxLocHelper, dataBlockId, &pProjIdxHash)) { + taosHashCleanup(pHash); + taosHashCleanup(pProjIdxHash); return TSDB_CODE_OUT_OF_MEMORY; } *pDescHash = pHash; + *ppProjIdxDescHash = pProjIdxHash; return TSDB_CODE_SUCCESS; } static int32_t buildDataBlockSlots(SPhysiPlanContext* pCxt, SNodeList* pList, SDataBlockDescNode* pDataBlockDesc, - SHashObj* pHash) { + SHashObj* pHash, SHashObj* pProjIdxDescHash) { pDataBlockDesc->pSlots = NULL; int32_t code = nodesMakeList(&pDataBlockDesc->pSlots); if (NULL == pDataBlockDesc->pSlots) { @@ -218,12 +231,16 @@ static int32_t buildDataBlockSlots(SPhysiPlanContext* pCxt, SNodeList* pList, SD FOREACH(pNode, pList) { char* name = NULL; int32_t len = 0; - code = getSlotKey(pNode, NULL, &name, &len); + code = getSlotKey(pNode, NULL, &name, &len, 16); if (TSDB_CODE_SUCCESS == code) { code = nodesListStrictAppend(pDataBlockDesc->pSlots, createSlotDesc(pCxt, name, pNode, slotId, true, false)); } + code = putSlotToHash(name, len, pDataBlockDesc->dataBlockId, slotId, pNode, pHash); if (TSDB_CODE_SUCCESS == code) { - code = putSlotToHash(name, len, pDataBlockDesc->dataBlockId, slotId, pNode, pHash); + if (nodeType(pNode) == QUERY_NODE_COLUMN && ((SColumnNode*)pNode)->resIdx > 0) { + sprintf(name + strlen(name), "_%d", ((SColumnNode*)pNode)->resIdx); + code = putSlotToHash(name, strlen(name), pDataBlockDesc->dataBlockId, slotId, pNode, pProjIdxDescHash); + } } taosMemoryFree(name); if (TSDB_CODE_SUCCESS == code) { @@ -246,9 +263,10 @@ static int32_t createDataBlockDesc(SPhysiPlanContext* pCxt, SNodeList* pList, SD pDesc->dataBlockId = pCxt->nextDataBlockId++; SHashObj* pHash = NULL; - code = createDataBlockDescHash(pCxt, LIST_LENGTH(pList), pDesc->dataBlockId, &pHash); + SHashObj* pProjIdxHash = NULL; + code = createDataBlockDescHash(pCxt, LIST_LENGTH(pList), pDesc->dataBlockId, &pHash, &pProjIdxHash); if (TSDB_CODE_SUCCESS == code) { - code = buildDataBlockSlots(pCxt, pList, pDesc, pHash); + code = buildDataBlockSlots(pCxt, pList, pDesc, pHash, pProjIdxHash); } if (TSDB_CODE_SUCCESS == code) { @@ -286,7 +304,7 @@ static int32_t addDataBlockSlotsImpl(SPhysiPlanContext* pCxt, SNodeList* pList, SNode* pExpr = QUERY_NODE_ORDER_BY_EXPR == nodeType(pNode) ? ((SOrderByExprNode*)pNode)->pExpr : pNode; char *name = NULL; int32_t len = 0; - code = getSlotKey(pExpr, pStmtName, &name, &len); + code = getSlotKey(pExpr, pStmtName, &name, &len, 0); if (TSDB_CODE_SUCCESS == code) { SSlotIndex* pIndex = taosHashGet(pHash, name, len); if (NULL == pIndex) { @@ -355,7 +373,9 @@ static int32_t pushdownDataBlockSlots(SPhysiPlanContext* pCxt, SNodeList* pList, typedef struct SSetSlotIdCxt { int32_t errCode; SHashObj* pLeftHash; + SHashObj* pLeftProjIdxHash; SHashObj* pRightHash; + SHashObj* pRightProdIdxHash; } SSetSlotIdCxt; static void dumpSlots(const char* pName, SHashObj* pHash) { @@ -379,13 +399,22 @@ static EDealRes doSetSlotId(SNode* pNode, void* pContext) { SSetSlotIdCxt* pCxt = (SSetSlotIdCxt*)pContext; char *name = NULL; int32_t len = 0; - pCxt->errCode = getSlotKey(pNode, NULL, &name, &len); + pCxt->errCode = getSlotKey(pNode, NULL, &name, &len, 16); if (TSDB_CODE_SUCCESS != pCxt->errCode) { return DEAL_RES_ERROR; } - SSlotIndex* pIndex = taosHashGet(pCxt->pLeftHash, name, len); - if (NULL == pIndex) { - pIndex = taosHashGet(pCxt->pRightHash, name, len); + SSlotIndex *pIndex = NULL; + if (((SColumnNode*)pNode)->projRefIdx > 0) { + sprintf(name + strlen(name), "_%d", ((SColumnNode*)pNode)->projRefIdx); + pIndex = taosHashGet(pCxt->pLeftProjIdxHash, name, strlen(name)); + if (!pIndex) { + pIndex = taosHashGet(pCxt->pRightProdIdxHash, name, strlen(name)); + } + } else { + pIndex = taosHashGet(pCxt->pLeftHash, name, len); + if (NULL == pIndex) { + pIndex = taosHashGet(pCxt->pRightHash, name, len); + } } // pIndex is definitely not NULL, otherwise it is a bug if (NULL == pIndex) { @@ -396,9 +425,9 @@ static EDealRes doSetSlotId(SNode* pNode, void* pContext) { taosMemoryFree(name); return DEAL_RES_ERROR; } - taosMemoryFree(name); ((SColumnNode*)pNode)->dataBlockId = pIndex->dataBlockId; ((SColumnNode*)pNode)->slotId = ((SSlotIdInfo*)taosArrayGet(pIndex->pSlotIdsInfo, 0))->slotId; + taosMemoryFree(name); return DEAL_RES_IGNORE_CHILD; } return DEAL_RES_CONTINUE; @@ -419,7 +448,9 @@ static int32_t setNodeSlotId(SPhysiPlanContext* pCxt, int16_t leftDataBlockId, i SSetSlotIdCxt cxt = { .errCode = TSDB_CODE_SUCCESS, .pLeftHash = taosArrayGetP(pCxt->pLocationHelper, leftDataBlockId), - .pRightHash = (rightDataBlockId < 0 ? NULL : taosArrayGetP(pCxt->pLocationHelper, rightDataBlockId))}; + .pLeftProjIdxHash = taosArrayGetP(pCxt->pProjIdxLocHelper, leftDataBlockId), + .pRightHash = (rightDataBlockId < 0 ? NULL : taosArrayGetP(pCxt->pLocationHelper, rightDataBlockId)), + .pRightProdIdxHash = (rightDataBlockId < 0 ? NULL : taosArrayGetP(pCxt->pProjIdxLocHelper, rightDataBlockId))}; nodesWalkExpr(pRes, doSetSlotId, &cxt); if (TSDB_CODE_SUCCESS != cxt.errCode) { nodesDestroyNode(pRes); @@ -445,7 +476,9 @@ static int32_t setListSlotId(SPhysiPlanContext* pCxt, int16_t leftDataBlockId, i SSetSlotIdCxt cxt = { .errCode = TSDB_CODE_SUCCESS, .pLeftHash = taosArrayGetP(pCxt->pLocationHelper, leftDataBlockId), - .pRightHash = (rightDataBlockId < 0 ? NULL : taosArrayGetP(pCxt->pLocationHelper, rightDataBlockId))}; + .pLeftProjIdxHash = taosArrayGetP(pCxt->pProjIdxLocHelper, leftDataBlockId), + .pRightHash = (rightDataBlockId < 0 ? NULL : taosArrayGetP(pCxt->pLocationHelper, rightDataBlockId)), + .pRightProdIdxHash = (rightDataBlockId < 0 ? NULL : taosArrayGetP(pCxt->pProjIdxLocHelper, rightDataBlockId))}; nodesWalkExprs(pRes, doSetSlotId, &cxt); if (TSDB_CODE_SUCCESS != cxt.errCode) { nodesDestroyList(pRes); @@ -1254,7 +1287,7 @@ static int32_t sortHashJoinTargets(int16_t lBlkId, int16_t rBlkId, SHashJoinPhys SColumnNode* pCol = (SColumnNode*)pNode; char *pName = NULL; int32_t len = 0; - code = getSlotKey(pNode, NULL, &pName, &len); + code = getSlotKey(pNode, NULL, &pName, &len, 0); if (TSDB_CODE_SUCCESS == code) { code = tSimpleHashPut(pHash, pName, len, &pCol, POINTER_BYTES); } @@ -1272,7 +1305,7 @@ static int32_t sortHashJoinTargets(int16_t lBlkId, int16_t rBlkId, SHashJoinPhys char* pName = NULL; SColumnNode* pCol = (SColumnNode*)pNode; int32_t len = 0; - code = getSlotKey(pNode, NULL, &pName, &len); + code = getSlotKey(pNode, NULL, &pName, &len, 0); if (TSDB_CODE_SUCCESS == code) { SNode** p = tSimpleHashGet(pHash, pName, len); if (p) { @@ -1293,7 +1326,7 @@ static int32_t sortHashJoinTargets(int16_t lBlkId, int16_t rBlkId, SHashJoinPhys char* pName = NULL; SColumnNode* pCol = (SColumnNode*)pNode; int32_t len = 0; - code = getSlotKey(pNode, NULL, &pName, &len); + code = getSlotKey(pNode, NULL, &pName, &len, 0); if (TSDB_CODE_SUCCESS == code) { SNode** p = tSimpleHashGet(pHash, pName, len); if (p) { @@ -2992,6 +3025,7 @@ static void destoryLocationHash(void* p) { static void destoryPhysiPlanContext(SPhysiPlanContext* pCxt) { taosArrayDestroyEx(pCxt->pLocationHelper, destoryLocationHash); + taosArrayDestroyEx(pCxt->pProjIdxLocHelper, destoryLocationHash); } static void setExplainInfo(SPlanContext* pCxt, SQueryPlan* pPlan) { @@ -3023,9 +3057,12 @@ int32_t createPhysiPlan(SPlanContext* pCxt, SQueryLogicPlan* pLogicPlan, SQueryP .errCode = TSDB_CODE_SUCCESS, .nextDataBlockId = 0, .pLocationHelper = taosArrayInit(32, POINTER_BYTES), + .pProjIdxLocHelper = taosArrayInit(32, POINTER_BYTES), .hasScan = false, .hasSysScan = false}; - if (NULL == cxt.pLocationHelper) { + if (NULL == cxt.pLocationHelper || !cxt.pProjIdxLocHelper) { + taosArrayDestroy(cxt.pLocationHelper); + taosArrayDestroy(cxt.pProjIdxLocHelper); return TSDB_CODE_OUT_OF_MEMORY; } diff --git a/source/libs/planner/src/planUtil.c b/source/libs/planner/src/planUtil.c index e1e98f221f..b5f0bc50e8 100644 --- a/source/libs/planner/src/planUtil.c +++ b/source/libs/planner/src/planUtil.c @@ -716,5 +716,16 @@ int32_t tagScanSetExecutionMode(SScanLogicNode* pScan) { return TSDB_CODE_SUCCESS; } +bool isColRefExpr(const SColumnNode* pCol, const SExprNode* pExpr) { + if (pCol->projRefIdx > 0) return pCol->projRefIdx == pExpr->projIdx; + return 0 == strcmp(pCol->colName, pExpr->aliasName); +} +void rewriteTargetsWithResId(SNodeList* pTargets) { + SNode* pNode; + FOREACH(pNode, pTargets) { + SColumnNode* pCol = (SColumnNode*)pNode; + pCol->resIdx = pCol->projRefIdx; + } +} diff --git a/source/libs/scalar/src/filter.c b/source/libs/scalar/src/filter.c index cbc7ca77bb..fb3845c032 100644 --- a/source/libs/scalar/src/filter.c +++ b/source/libs/scalar/src/filter.c @@ -5113,7 +5113,7 @@ int32_t fltOptimizeNodes(SFilterInfo *pInfo, SNode **pNode, SFltTreeStat *pStat) FLT_ERR_JRET(fltSclCollectOperators(*pNode, sclOpList)); SArray *colRangeList = taosArrayInit(16, sizeof(SFltSclColumnRange)); if (NULL == colRangeList) { - FLT_ERR_RET(terrno); + FLT_ERR_JRET(terrno); } FLT_ERR_JRET(fltSclProcessCNF(sclOpList, colRangeList)); pInfo->sclCtx.fltSclRange = colRangeList; @@ -5221,7 +5221,7 @@ int32_t filterInitFromNode(SNode *pNode, SFilterInfo **pInfo, uint32_t options) FLT_ERR_JRET(fltOptimizeNodes(info, &info->sclCtx.node, &stat)); } - return code; + return TSDB_CODE_SUCCESS; _return: diff --git a/source/libs/scalar/src/scalar.c b/source/libs/scalar/src/scalar.c index cff73067b1..ee79c9a66e 100644 --- a/source/libs/scalar/src/scalar.c +++ b/source/libs/scalar/src/scalar.c @@ -131,7 +131,7 @@ int32_t scalarGenerateSetFromList(void **data, void *pNode, uint32_t type) { SListCell *cell = nodeList->pNodeList->pHead; SScalarParam out = {.columnData = taosMemoryCalloc(1, sizeof(SColumnInfoData))}; if (out.columnData == NULL) { - SCL_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + SCL_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); } int32_t len = 0; void *buf = NULL; @@ -879,7 +879,7 @@ int32_t sclExecOperator(SOperatorNode *node, SScalarCtx *ctx, SScalarParam *outp SScalarParam *params = NULL; int32_t rowNum = 0; int32_t code = 0; - int32_t paramNum = 0; + int32_t paramNum = scalarGetOperatorParamNum(node->opType); // json not support in in operator if (nodeType(node->pLeft) == QUERY_NODE_VALUE) { @@ -890,7 +890,7 @@ int32_t sclExecOperator(SOperatorNode *node, SScalarCtx *ctx, SScalarParam *outp } } - SCL_ERR_RET(sclInitOperatorParams(¶ms, node, ctx, &rowNum)); + SCL_ERR_JRET(sclInitOperatorParams(¶ms, node, ctx, &rowNum)); if (output->columnData == NULL) { code = sclCreateColumnInfoData(&node->node.resType, rowNum, output); if (code != TSDB_CODE_SUCCESS) { @@ -900,7 +900,6 @@ int32_t sclExecOperator(SOperatorNode *node, SScalarCtx *ctx, SScalarParam *outp _bin_scalar_fn_t OperatorFn = getBinScalarOperatorFn(node->opType); - paramNum = scalarGetOperatorParamNum(node->opType); SScalarParam *pLeft = ¶ms[0]; SScalarParam *pRight = paramNum > 1 ? ¶ms[1] : NULL; diff --git a/source/libs/scalar/src/sclfunc.c b/source/libs/scalar/src/sclfunc.c index 8da8245196..7fae646e8f 100644 --- a/source/libs/scalar/src/sclfunc.c +++ b/source/libs/scalar/src/sclfunc.c @@ -766,6 +766,9 @@ static int32_t tlrtrim(char *input, char *remInput, char *output, int32_t inputT if (remLen == 0 || remLen > orgLen) { (void)memcpy(varDataVal(output), orgStr, orgLen); varDataSetLen(output, orgLen); + if (needFree) { + taosMemoryFree(remStr); + } return TSDB_CODE_SUCCESS; } diff --git a/source/libs/scalar/src/sclvector.c b/source/libs/scalar/src/sclvector.c index 5556108a52..ead6053505 100644 --- a/source/libs/scalar/src/sclvector.c +++ b/source/libs/scalar/src/sclvector.c @@ -446,12 +446,12 @@ static FORCE_INLINE int32_t varToGeometry(char *buf, SScalarParam *pOut, int32_t unsigned char *t = NULL; char *output = NULL; - if (initCtxGeomFromText()) { - sclError("failed to init geometry ctx, %s", getThreadLocalGeosCtx()->errMsg); + if ((code = initCtxGeomFromText()) != 0) { + sclError("failed to init geometry ctx, %s", getGeosErrMsg(code)); SCL_ERR_JRET(TSDB_CODE_APP_ERROR); } - if (doGeomFromText(buf, &t, &len)) { - sclInfo("failed to convert text to geometry, %s", getThreadLocalGeosCtx()->errMsg); + if ((code = doGeomFromText(buf, &t, &len)) != 0) { + sclInfo("failed to convert text to geometry, %s", getGeosErrMsg(code)); SCL_ERR_JRET(TSDB_CODE_SCALAR_CONVERT_ERROR); } diff --git a/source/libs/scheduler/inc/schInt.h b/source/libs/scheduler/inc/schInt.h index c723360b36..f12d0fd246 100644 --- a/source/libs/scheduler/inc/schInt.h +++ b/source/libs/scheduler/inc/schInt.h @@ -91,7 +91,7 @@ typedef struct SSchRuntimeStat { #if defined(WINDOWS) || defined(_TD_DARWIN_64) size_t avoidCompilationErrors; #endif - + int64_t hbConnNotFound; } SSchRuntimeStat; typedef struct SSchJobStat { diff --git a/source/libs/scheduler/src/schUtil.c b/source/libs/scheduler/src/schUtil.c index 01249dbb98..3f610ed387 100644 --- a/source/libs/scheduler/src/schUtil.c +++ b/source/libs/scheduler/src/schUtil.c @@ -251,9 +251,8 @@ int32_t schUpdateHbConnection(SQueryNodeEpId *epId, SSchTrans *trans) { hb = taosHashGet(schMgmt.hbConnections, epId, sizeof(SQueryNodeEpId)); if (NULL == hb) { SCH_UNLOCK(SCH_READ, &schMgmt.hbLock); - qDebug("taosHashGet hb connection not exists, nodeId:%d, fqdn:%s, port:%d", epId->nodeId, epId->ep.fqdn, - epId->ep.port); - SCH_ERR_RET(TSDB_CODE_APP_ERROR); + (void)atomic_add_fetch_64(&schMgmt.stat.runtime.hbConnNotFound, 1); + return TSDB_CODE_SUCCESS; } SCH_LOCK(SCH_WRITE, &hb->lock); diff --git a/source/libs/stream/src/streamBackendRocksdb.c b/source/libs/stream/src/streamBackendRocksdb.c index 29fb18ef07..4793a8951a 100644 --- a/source/libs/stream/src/streamBackendRocksdb.c +++ b/source/libs/stream/src/streamBackendRocksdb.c @@ -1096,21 +1096,23 @@ int32_t delObsoleteCheckpoint(void* arg, const char* path) { * replication is finished */ int32_t chkpMayDelObsolete(void* arg, int64_t chkpId, char* path) { + int32_t code = 0; STaskDbWrapper* pBackend = arg; - + SArray * chkpDel = NULL, *chkpDup = NULL; (void)taosThreadRwlockWrlock(&pBackend->chkpDirLock); - (void)taosArrayPush(pBackend->chkpSaved, &chkpId); - - SArray* chkpDel = taosArrayInit(8, sizeof(int64_t)); - if (chkpDel == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; + if (taosArrayPush(pBackend->chkpSaved, &chkpId) == NULL) { + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _exception); } - SArray* chkpDup = taosArrayInit(8, sizeof(int64_t)); + chkpDel = taosArrayInit(8, sizeof(int64_t)); + if (chkpDel == NULL) { + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _exception); + } + + chkpDup = taosArrayInit(8, sizeof(int64_t)); if (chkpDup == NULL) { - taosArrayDestroy(chkpDel); - return TSDB_CODE_OUT_OF_MEMORY; + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _exception); } int64_t firsId = 0; @@ -1120,9 +1122,13 @@ int32_t chkpMayDelObsolete(void* arg, int64_t chkpId, char* path) { for (int i = 0; i < taosArrayGetSize(pBackend->chkpSaved); i++) { int64_t id = *(int64_t*)taosArrayGet(pBackend->chkpSaved, i); if (id >= firsId) { - (void)taosArrayPush(chkpDup, &id); + if (taosArrayPush(chkpDup, &id) == NULL) { + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _exception); + } } else { - (void)taosArrayPush(chkpDel, &id); + if (taosArrayPush(chkpDel, &id) == NULL) { + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _exception); + } } } } else { @@ -1131,13 +1137,18 @@ int32_t chkpMayDelObsolete(void* arg, int64_t chkpId, char* path) { for (int i = 0; i < dsz; i++) { int64_t id = *(int64_t*)taosArrayGet(pBackend->chkpSaved, i); - (void)taosArrayPush(chkpDel, &id); + if (taosArrayPush(chkpDel, &id) == NULL) { + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _exception); + } } for (int i = dsz < 0 ? 0 : dsz; i < sz; i++) { int64_t id = *(int64_t*)taosArrayGet(pBackend->chkpSaved, i); - (void)taosArrayPush(chkpDup, &id); + if (taosArrayPush(chkpDup, &id) == NULL) { + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _exception); + } } } + taosArrayDestroy(pBackend->chkpSaved); pBackend->chkpSaved = chkpDup; @@ -1155,6 +1166,11 @@ int32_t chkpMayDelObsolete(void* arg, int64_t chkpId, char* path) { } taosArrayDestroy(chkpDel); return 0; +_exception: + taosArrayDestroy(chkpDup); + taosArrayDestroy(chkpDel); + (void)taosThreadRwlockUnlock(&pBackend->chkpDirLock); + return code; } #ifdef BUILD_NO_CALL @@ -1288,7 +1304,9 @@ int32_t taskDbLoadChkpInfo(STaskDbWrapper* pBackend) { int ret = sscanf(taosGetDirEntryName(de), "checkpoint%" PRId64 "", &checkpointId); if (ret == 1) { - (void)taosArrayPush(pBackend->chkpSaved, &checkpointId); + if (taosArrayPush(pBackend->chkpSaved, &checkpointId) == NULL) { + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _exception); + } } } else { continue; @@ -1300,13 +1318,21 @@ int32_t taskDbLoadChkpInfo(STaskDbWrapper* pBackend) { (void)taosCloseDir(&pDir); return 0; +_exception: + taosMemoryFree(pChkpDir); + (void)taosCloseDir(&pDir); + return code; } int32_t chkpGetAllDbCfHandle2(STaskDbWrapper* pBackend, rocksdb_column_family_handle_t*** ppHandle) { + int32_t code = 0; SArray* pHandle = taosArrayInit(8, POINTER_BYTES); for (int i = 0; i < sizeof(ginitDict) / sizeof(ginitDict[0]); i++) { if (pBackend->pCf[i]) { rocksdb_column_family_handle_t* p = pBackend->pCf[i]; - (void)taosArrayPush(pHandle, &p); + if (taosArrayPush(pHandle, &p) == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto _exception; + } } } int32_t nCf = taosArrayGetSize(pHandle); @@ -1316,13 +1342,20 @@ int32_t chkpGetAllDbCfHandle2(STaskDbWrapper* pBackend, rocksdb_column_family_ha } rocksdb_column_family_handle_t** ppCf = taosMemoryCalloc(nCf, sizeof(rocksdb_column_family_handle_t*)); + if (ppCf == NULL) { + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _exception); + } for (int i = 0; i < nCf; i++) { ppCf[i] = taosArrayGetP(pHandle, i); } + taosArrayDestroy(pHandle); *ppHandle = ppCf; return nCf; +_exception: + taosArrayDestroy(pHandle); + return code; } int32_t chkpDoDbCheckpoint(rocksdb_t* db, char* path) { @@ -2435,7 +2468,9 @@ void taskDbInitChkpOpt(STaskDbWrapper* pTaskDb) { void taskDbRefChkp(STaskDbWrapper* pTaskDb, int64_t chkp) { (void)taosThreadRwlockWrlock(&pTaskDb->chkpDirLock); - (void)taosArrayPush(pTaskDb->chkpInUse, &chkp); + if (taosArrayPush(pTaskDb->chkpInUse, &chkp) == NULL) { + stError("failed to push chkp: %" PRIi64 " into inuse", chkp); + } taosArraySort(pTaskDb->chkpInUse, chkpIdComp); (void)taosThreadRwlockUnlock(&pTaskDb->chkpDirLock); } @@ -4271,7 +4306,10 @@ int32_t streamDefaultIterGet_rocksdb(SStreamState* pState, const void* start, co if (strncmp(key, start, strlen(start)) == 0 && strlen(key) >= strlen(start) + 1) { int64_t checkPoint = 0; if (sscanf(key + strlen(key), ":%" PRId64 "", &checkPoint) == 1) { - (void)taosArrayPush(result, &checkPoint); + if (taosArrayPush(result, &checkPoint) == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + break; + } } } else { break; @@ -4487,7 +4525,10 @@ int32_t compareHashTableImpl(SHashObj* p1, SHashObj* p2, SArray* diff) { return TSDB_CODE_OUT_OF_MEMORY; } (void)strncpy(fname, name, len); - (void)taosArrayPush(diff, &fname); + if (taosArrayPush(diff, &fname) == NULL) { + taosMemoryFree(fname); + return TSDB_CODE_OUT_OF_MEMORY; + } } pIter = taosHashIterate(p2, pIter); } @@ -4646,7 +4687,11 @@ int32_t dbChkpGetDelta(SDbChkp* p, int64_t chkpId, SArray* list) { } (void)strncpy(fname, name, len); - (void)taosArrayPush(p->pAdd, &fname); + if (taosArrayPush(p->pAdd, &fname) == NULL) { + taosMemoryFree(fname); + (void)taosThreadRwlockUnlock(&p->rwLock); + return TSDB_CODE_OUT_OF_MEMORY; + } } pIter = taosHashIterate(p->pSstTbl[1 - p->idx], pIter); } @@ -4850,7 +4895,11 @@ int32_t dbChkpDumpTo(SDbChkp* p, char* dname, SArray* list) { code = TSDB_CODE_OUT_OF_MEMORY; goto _ERROR; } - (void)taosArrayPush(list, &p); + if (taosArrayPush(list, &p) == NULL) { + taosMemoryFree(p); + code = TSDB_CODE_OUT_OF_MEMORY; + goto _ERROR; + } } // copy current file to dst dir diff --git a/source/libs/stream/src/streamCheckStatus.c b/source/libs/stream/src/streamCheckStatus.c index 2d04f2cb34..91196f31e0 100644 --- a/source/libs/stream/src/streamCheckStatus.c +++ b/source/libs/stream/src/streamCheckStatus.c @@ -107,7 +107,7 @@ void streamTaskSendCheckMsg(SStreamTask* pTask) { streamTaskAddReqInfo(&pTask->taskCheckInfo, req.reqId, pDispatch->taskId, pDispatch->nodeId, idstr); stDebug("s-task:%s (vgId:%d) stage:%" PRId64 " check single downstream task:0x%x(vgId:%d) ver:%" PRId64 "-%" PRId64 - " window:%" PRId64 "-%" PRId64 " qid:0x%" PRIx64, + " window:%" PRId64 "-%" PRId64 "QID:0x%" PRIx64, idstr, pTask->info.nodeId, req.stage, req.downstreamTaskId, req.downstreamNodeId, pRange->range.minVer, pRange->range.maxVer, pWindow->skey, pWindow->ekey, req.reqId); @@ -133,7 +133,7 @@ void streamTaskSendCheckMsg(SStreamTask* pTask) { streamTaskAddReqInfo(&pTask->taskCheckInfo, req.reqId, pVgInfo->taskId, pVgInfo->vgId, idstr); stDebug("s-task:%s (vgId:%d) stage:%" PRId64 - " check downstream task:0x%x (vgId:%d) (shuffle), idx:%d, qid:0x%" PRIx64, + " check downstream task:0x%x (vgId:%d) (shuffle), idx:%d,QID:0x%" PRIx64, idstr, pTask->info.nodeId, req.stage, req.downstreamTaskId, req.downstreamNodeId, i, req.reqId); (void)streamSendCheckMsg(pTask, &req, pVgInfo->vgId, &pVgInfo->epSet); } @@ -432,7 +432,7 @@ int32_t streamTaskUpdateCheckInfo(STaskCheckInfo* pInfo, int32_t taskId, int32_t findCheckRspStatus(pInfo, taskId, &p); if (p != NULL) { if (reqId != p->reqId) { - stError("s-task:%s qid:0x%" PRIx64 " expected:0x%" PRIx64 + stError("s-task:%sQID:0x%" PRIx64 " expected:0x%" PRIx64 " expired check-rsp recv from downstream task:0x%x, discarded", id, reqId, p->reqId, taskId); streamMutexUnlock(&pInfo->checkInfoLock); @@ -454,7 +454,7 @@ int32_t streamTaskUpdateCheckInfo(STaskCheckInfo* pInfo, int32_t taskId, int32_t } streamMutexUnlock(&pInfo->checkInfoLock); - stError("s-task:%s unexpected check rsp msg, invalid downstream task:0x%x, qid:%" PRIx64 " discarded", id, taskId, + stError("s-task:%s unexpected check rsp msg, invalid downstream task:0x%x,QID:%" PRIx64 " discarded", id, taskId, reqId); return TSDB_CODE_FAILED; } @@ -541,7 +541,7 @@ void doSendCheckMsg(SStreamTask* pTask, SDownstreamStatusInfo* p) { STaskDispatcherFixed* pDispatch = &pOutputInfo->fixedDispatcher; setCheckDownstreamReqInfo(&req, p->reqId, pDispatch->taskId, pDispatch->nodeId); - stDebug("s-task:%s (vgId:%d) stage:%" PRId64 " re-send check downstream task:0x%x(vgId:%d) qid:0x%" PRIx64, id, + stDebug("s-task:%s (vgId:%d) stage:%" PRId64 " re-send check downstream task:0x%x(vgId:%d)QID:0x%" PRIx64, id, pTask->info.nodeId, req.stage, req.downstreamTaskId, req.downstreamNodeId, req.reqId); (void)streamSendCheckMsg(pTask, &req, pOutputInfo->fixedDispatcher.nodeId, &pOutputInfo->fixedDispatcher.epSet); @@ -559,7 +559,7 @@ void doSendCheckMsg(SStreamTask* pTask, SDownstreamStatusInfo* p) { setCheckDownstreamReqInfo(&req, p->reqId, pVgInfo->taskId, pVgInfo->vgId); stDebug("s-task:%s (vgId:%d) stage:%" PRId64 - " re-send check downstream task:0x%x(vgId:%d) (shuffle), idx:%d qid:0x%" PRIx64, + " re-send check downstream task:0x%x(vgId:%d) (shuffle), idx:%dQID:0x%" PRIx64, id, pTask->info.nodeId, req.stage, req.downstreamTaskId, req.downstreamNodeId, i, p->reqId); (void)streamSendCheckMsg(pTask, &req, pVgInfo->vgId, &pVgInfo->epSet); break; @@ -585,12 +585,18 @@ void getCheckRspStatus(STaskCheckInfo* pInfo, int64_t el, int32_t* numOfReady, i } else { // TASK_DOWNSTREAM_NOT_READY if (p->rspTs == 0) { // not response yet if (el >= CHECK_NOT_RSP_DURATION) { // not receive info for 10 sec. - (void)taosArrayPush(pTimeoutList, &p->taskId); + void* px = taosArrayPush(pTimeoutList, &p->taskId); + if (px == NULL) { + stError("s-task:%s failed to record time out task:0x%x", id, p->taskId); + } } else { // el < CHECK_NOT_RSP_DURATION (*numOfNotRsp) += 1; // do nothing and continue waiting for their rsp } } else { - (void)taosArrayPush(pNotReadyList, &p->taskId); + void* px = taosArrayPush(pNotReadyList, &p->taskId); + if (px == NULL) { + stError("s-task:%s failed to record not ready task:0x%x", id, p->taskId); + } } } } diff --git a/source/libs/stream/src/streamCheckpoint.c b/source/libs/stream/src/streamCheckpoint.c index 1a0b1e8665..d0bf24bd03 100644 --- a/source/libs/stream/src/streamCheckpoint.c +++ b/source/libs/stream/src/streamCheckpoint.c @@ -586,7 +586,7 @@ int32_t streamTaskUpdateTaskCheckpointInfo(SStreamTask* pTask, bool restored, SV id, vgId, pStatus.name, pInfo->checkpointId, pReq->checkpointId, pInfo->checkpointVer, pReq->checkpointVer, pInfo->checkpointTime, pReq->checkpointTs); } else { // not in restore status, must be in checkpoint status - if (pStatus.state == TASK_STATUS__CK) { + if ((pStatus.state == TASK_STATUS__CK) || (pMeta->role == NODE_ROLE_FOLLOWER)) { stDebug("s-task:%s vgId:%d status:%s start to update the checkpoint-info, checkpointId:%" PRId64 "->%" PRId64 " checkpointVer:%" PRId64 "->%" PRId64 " checkpointTs:%" PRId64 "->%" PRId64, id, vgId, pStatus.name, pInfo->checkpointId, pReq->checkpointId, pInfo->checkpointVer, @@ -610,12 +610,12 @@ int32_t streamTaskUpdateTaskCheckpointInfo(SStreamTask* pTask, bool restored, SV } // update only it is in checkpoint status, or during restore procedure. - if (pStatus.state == TASK_STATUS__CK || (!restored)) { + if ((pStatus.state == TASK_STATUS__CK) || (!restored) || (pMeta->role == NODE_ROLE_FOLLOWER)) { pInfo->checkpointId = pReq->checkpointId; pInfo->checkpointVer = pReq->checkpointVer; pInfo->checkpointTime = pReq->checkpointTs; - if (restored) { + if (restored && (pMeta->role == NODE_ROLE_LEADER)) { code = streamTaskHandleEvent(pTask->status.pSM, TASK_EVENT_CHECKPOINT_DONE); } } @@ -973,7 +973,10 @@ void checkpointTriggerMonitorFn(void* param, void* tmrId) { if (!recved) { // make sure the inputQ is opened for not recv upstream checkpoint-trigger message streamTaskOpenUpstreamInput(pTask, pInfo->taskId); - (void)taosArrayPush(pNotSendList, pInfo); + void* px = taosArrayPush(pNotSendList, pInfo); + if (px == NULL) { + stError("s-task:%s failed to record not send info, code: out of memory", id); + } } } @@ -1371,28 +1374,23 @@ int32_t deleteCheckpointFile(const char* id, const char* name) { } int32_t streamTaskSendNegotiateChkptIdMsg(SStreamTask* pTask) { - const char* id = pTask->id.idStr; - streamMutexLock(&pTask->lock); ETaskStatus p = streamTaskGetStatus(pTask).state; - - if (pTask->status.sendConsensusChkptId == true) { - stDebug("s-task:%s already start to consensus-checkpointId, not start again before it completed", id); - streamMutexUnlock(&pTask->lock); - return TSDB_CODE_SUCCESS; - } else { - pTask->status.sendConsensusChkptId = true; - } - + // if (pInfo->alreadySendChkptId == true) { + // stDebug("s-task:%s already start to consensus-checkpointId, not start again before it completed", id); + // streamMutexUnlock(&pTask->lock); + // return TSDB_CODE_SUCCESS; + // } else { + // pInfo->alreadySendChkptId = true; + // } + // + streamTaskSetReqConsenChkptId(pTask, taosGetTimestampMs()); streamMutexUnlock(&pTask->lock); if (pTask->pBackend != NULL) { streamFreeTaskState(pTask, p); pTask->pBackend = NULL; } - - pTask->status.requireConsensusChkptId = true; - stDebug("s-task:%s set the require consensus-checkpointId flag", id); return 0; } diff --git a/source/libs/stream/src/streamDispatch.c b/source/libs/stream/src/streamDispatch.c index a6c2ae73e5..0bc090cdfe 100644 --- a/source/libs/stream/src/streamDispatch.c +++ b/source/libs/stream/src/streamDispatch.c @@ -130,7 +130,7 @@ int32_t streamTaskBroadcastRetrieveReq(SStreamTask* pTask, SStreamRetrieveReq* r return code; } - stDebug("s-task:%s (child %d) send retrieve req to task:0x%x (vgId:%d), qid:0x%" PRIx64, pTask->id.idStr, + stDebug("s-task:%s (child %d) send retrieve req to task:0x%x (vgId:%d),QID:0x%" PRIx64, pTask->id.idStr, pTask->info.selfChildId, pEpInfo->taskId, pEpInfo->nodeId, req->reqId); } @@ -214,6 +214,7 @@ int32_t streamSendCheckMsg(SStreamTask* pTask, const SStreamTaskCheckReq* pReq, tEncoderInit(&encoder, abuf, tlen); if ((code = tEncodeStreamTaskCheckReq(&encoder, pReq)) < 0) { rpcFreeCont(buf); + tEncoderClear(&encoder); return code; } tEncoderClear(&encoder); @@ -306,7 +307,12 @@ static int32_t doBuildDispatchMsg(SStreamTask* pTask, const SStreamDataBlock* pD int32_t code = 0; int64_t now = taosGetTimestampMs(); int32_t numOfBlocks = taosArrayGetSize(pData->blocks); - ASSERT(numOfBlocks != 0 && pTask->msgInfo.pData == NULL); + + if (!(numOfBlocks != 0 && pTask->msgInfo.pData == NULL)) { + stError("s-task:%s dispatch block number:%d, exist not rsp dispatch msg:%p, abort build new dispatch msg", + pTask->id.idStr, numOfBlocks, pTask->msgInfo.pData); + return TSDB_CODE_STREAM_INTERNAL_ERROR; + } pTask->msgInfo.dispatchMsgType = pData->type; @@ -474,7 +480,10 @@ static void addDispatchEntry(SDispatchMsgInfo* pMsgInfo, int32_t nodeId, int64_t streamMutexLock(&pMsgInfo->lock); } - (void)taosArrayPush(pMsgInfo->pSendInfo, &entry); + void* p = taosArrayPush(pMsgInfo->pSendInfo, &entry); + if (p == NULL) { + stError("failed to add dispatch info"); + } if (lock) { streamMutexUnlock(&pMsgInfo->lock); @@ -671,8 +680,8 @@ int32_t streamSearchAndAddBlock(SStreamTask* pTask, SStreamDispatchReq* pReqs, S memcpy(bln.parTbName, pDataBlock->info.parTbName, strlen(pDataBlock->info.parTbName)); // failed to put into name buffer, no need to do anything - if (tSimpleHashGetSize(pTask->pNameMap) < MAX_BLOCK_NAME_NUM) { - (void)tSimpleHashPut(pTask->pNameMap, &groupId, sizeof(int64_t), &bln, sizeof(SBlockName)); + if (tSimpleHashGetSize(pTask->pNameMap) < MAX_BLOCK_NAME_NUM) { // allow error, and do nothing + int32_t code = tSimpleHashPut(pTask->pNameMap, &groupId, sizeof(int64_t), &bln, sizeof(SBlockName)); } } @@ -708,14 +717,15 @@ int32_t streamSearchAndAddBlock(SStreamTask* pTask, SStreamDispatchReq* pReqs, S } streamMutexUnlock(&pTask->msgInfo.lock); - ASSERT(found); - return 0; + if (!found) { + stError("s-task:%s not found req hash value:%u", pTask->id.idStr, hashValue); + return TSDB_CODE_STREAM_INTERNAL_ERROR; + } else { + return 0; + } } int32_t streamDispatchStreamBlock(SStreamTask* pTask) { - ASSERT((pTask->outputInfo.type == TASK_OUTPUT__FIXED_DISPATCH || - pTask->outputInfo.type == TASK_OUTPUT__SHUFFLE_DISPATCH)); - const char* id = pTask->id.idStr; int32_t numOfElems = streamQueueGetNumOfItems(pTask->outputq.queue); if (numOfElems > 0) { @@ -739,8 +749,11 @@ int32_t streamDispatchStreamBlock(SStreamTask* pTask) { return 0; } - ASSERT(pTask->msgInfo.pData == NULL); - stDebug("s-task:%s start to dispatch msg, set output status:%d", id, pTask->outputq.status); + if (pTask->msgInfo.pData != NULL) { + stFatal("s-task:%s not rsp data:%p exist, should not dispatch msg now", id, pTask->msgInfo.pData); + } else { + stDebug("s-task:%s start to dispatch msg, set output status:%d", id, pTask->outputq.status); + } SStreamDataBlock* pBlock = NULL; streamQueueNextItem(pTask->outputq.queue, (SStreamQueueItem**)&pBlock); @@ -751,8 +764,11 @@ int32_t streamDispatchStreamBlock(SStreamTask* pTask) { } int32_t type = pBlock->type; - ASSERT(type == STREAM_INPUT__DATA_BLOCK || type == STREAM_INPUT__CHECKPOINT_TRIGGER || - type == STREAM_INPUT__TRANS_STATE); + if (!(type == STREAM_INPUT__DATA_BLOCK || type == STREAM_INPUT__CHECKPOINT_TRIGGER || + type == STREAM_INPUT__TRANS_STATE)) { + stError("s-task:%s invalid dispatch block type:%d", id, type); + return TSDB_CODE_INTERNAL_ERROR; + } pTask->execInfo.dispatch += 1; @@ -830,6 +846,7 @@ int32_t initCheckpointReadyMsg(SStreamTask* pTask, int32_t upstreamNodeId, int32 tEncoderInit(&encoder, abuf, tlen); if ((code = tEncodeStreamCheckpointReadyMsg(&encoder, &req)) < 0) { rpcFreeCont(buf); + tEncoderClear(&encoder); return code; } tEncoderClear(&encoder); @@ -878,7 +895,6 @@ static void checkpointReadyMsgSendMonitorFn(void* param, void* tmrId) { SArray* pList = pActiveInfo->pReadyMsgList; int32_t num = taosArrayGetSize(pList); - if (pTmrInfo->launchChkptId != pActiveInfo->activeId) { streamMutexUnlock(&pActiveInfo->lock); int32_t ref = streamCleanBeforeQuitTmr(pTmrInfo, pTask); @@ -902,7 +918,15 @@ static void checkpointReadyMsgSendMonitorFn(void* param, void* tmrId) { SArray* pNotRspList = taosArrayInit(4, sizeof(int32_t)); - ASSERT(taosArrayGetSize(pTask->upstreamInfo.pList) == num); + if (taosArrayGetSize(pTask->upstreamInfo.pList) != num) { + streamMutexUnlock(&pActiveInfo->lock); + int32_t ref = streamCleanBeforeQuitTmr(pTmrInfo, pTask); + stWarn("s-task:%s vgId:%d upstream number:%d not equals sent readyMsg:%d, quit from readyMsg send tmr, ref:%d", id, + vgId, (int32_t)taosArrayGetSize(pTask->upstreamInfo.pList), num, ref); + + streamMetaReleaseTask(pTask->pMeta, pTask); + return; + } for (int32_t i = 0; i < num; ++i) { STaskCheckpointReadyInfo* pInfo = taosArrayGet(pList, i); @@ -914,9 +938,13 @@ static void checkpointReadyMsgSendMonitorFn(void* param, void* tmrId) { continue; } - (void)taosArrayPush(pNotRspList, &pInfo->upstreamTaskId); - stDebug("s-task:%s vgId:%d level:%d checkpoint-ready rsp from upstream:0x%x not confirmed yet", id, vgId, - pTask->info.taskLevel, pInfo->upstreamTaskId); + void* p = taosArrayPush(pNotRspList, &pInfo->upstreamTaskId); + if (p == NULL) { + stError("s-task:%s vgId:%d failed to record not rsp task, code: out of memory", id, vgId); + } else { + stDebug("s-task:%s vgId:%d level:%d checkpoint-ready rsp from upstream:0x%x not confirmed yet", id, vgId, + pTask->info.taskLevel, pInfo->upstreamTaskId); + } } int32_t checkpointId = pActiveInfo->activeId; @@ -984,7 +1012,11 @@ int32_t streamTaskSendCheckpointReadyMsg(SStreamTask* pTask) { streamMutexLock(&pActiveInfo->lock); int32_t num = taosArrayGetSize(pList); - ASSERT(taosArrayGetSize(pTask->upstreamInfo.pList) == num); + if (taosArrayGetSize(pTask->upstreamInfo.pList) != num) { + stError("s-task:%s invalid number of sent readyMsg:%d to upstream:%d", id, num, + (int32_t)taosArrayGetSize(pTask->upstreamInfo.pList)); + return TSDB_CODE_STREAM_INTERNAL_ERROR; + } for (int32_t i = 0; i < num; ++i) { STaskCheckpointReadyInfo* pInfo = taosArrayGet(pList, i); @@ -1064,9 +1096,7 @@ int32_t streamTaskSendCheckpointSourceRsp(SStreamTask* pTask) { int32_t streamAddBlockIntoDispatchMsg(const SSDataBlock* pBlock, SStreamDispatchReq* pReq) { int32_t dataStrLen = sizeof(SRetrieveTableRsp) + blockGetEncodeSize(pBlock) + PAYLOAD_PREFIX_LEN; - ASSERT(dataStrLen > 0); - - void* buf = taosMemoryCalloc(1, dataStrLen); + void* buf = taosMemoryCalloc(1, dataStrLen); if (buf == NULL) { return terrno; } @@ -1100,8 +1130,17 @@ int32_t streamAddBlockIntoDispatchMsg(const SSDataBlock* pBlock, SStreamDispatch payloadLen += sizeof(SRetrieveTableRsp); - (void)taosArrayPush(pReq->dataLen, &payloadLen); - (void)taosArrayPush(pReq->data, &buf); + void* px = taosArrayPush(pReq->dataLen, &payloadLen); + if (px == NULL) { + taosMemoryFree(buf); + return terrno; + } + + px = taosArrayPush(pReq->data, &buf); + if (px == NULL) { + taosMemoryFree(buf); + return terrno; + } pReq->totalLen += dataStrLen; return 0; @@ -1131,6 +1170,7 @@ int32_t doSendDispatchMsg(SStreamTask* pTask, const SStreamDispatchReq* pReq, in SEncoder encoder; tEncoderInit(&encoder, abuf, tlen); if ((code = tEncodeStreamDispatchReq(&encoder, pReq)) < 0) { + tEncoderClear(&encoder); goto FAIL; } tEncoderClear(&encoder); @@ -1205,8 +1245,6 @@ int32_t streamAddCheckpointSourceRspMsg(SStreamCheckpointSourceReq* pReq, SRpcHa int32_t size = taosArrayGetSize(pActiveInfo->pReadyMsgList); if (size > 0) { - ASSERT(size == 1); - STaskCheckpointReadyInfo* pReady = taosArrayGet(pActiveInfo->pReadyMsgList, 0); if (pReady == NULL) { return terrno; @@ -1221,8 +1259,12 @@ int32_t streamAddCheckpointSourceRspMsg(SStreamCheckpointSourceReq* pReq, SRpcHa pTask->id.idStr, pReady->checkpointId, pReady->transId, pReq->transId, pReq->checkpointId); } } else { - (void)taosArrayPush(pActiveInfo->pReadyMsgList, &info); - stDebug("s-task:%s add checkpoint source rsp msg, total:%d", pTask->id.idStr, size + 1); + void* px = taosArrayPush(pActiveInfo->pReadyMsgList, &info); + if (px != NULL) { + stDebug("s-task:%s add checkpoint source rsp msg, total:%d", pTask->id.idStr, size + 1); + } else { + stError("s-task:%s failed to add readyMsg, code: out of memory", pTask->id.idStr); + } } streamMutexUnlock(&pActiveInfo->lock); @@ -1259,7 +1301,12 @@ int32_t streamAddCheckpointReadyMsg(SStreamTask* pTask, int32_t upstreamTaskId, SActiveCheckpointInfo* pActiveInfo = pTask->chkInfo.pActiveInfo; streamMutexLock(&pActiveInfo->lock); - (void)taosArrayPush(pActiveInfo->pReadyMsgList, &info); + void* px = taosArrayPush(pActiveInfo->pReadyMsgList, &info); + if (px == NULL) { + streamMutexUnlock(&pActiveInfo->lock); + stError("s-task:%s failed to add readyMsg info, code: out of memory", pTask->id.idStr); + return terrno; + } int32_t numOfRecv = taosArrayGetSize(pActiveInfo->pReadyMsgList); int32_t total = streamTaskGetNumOfUpstream(pTask); @@ -1267,7 +1314,6 @@ int32_t streamAddCheckpointReadyMsg(SStreamTask* pTask, int32_t upstreamTaskId, stDebug("s-task:%s recv checkpoint-trigger from all upstream, continue", pTask->id.idStr); pActiveInfo->allUpstreamTriggerRecv = 1; } else { - ASSERT(numOfRecv <= total); stDebug("s-task:%s %d/%d checkpoint-trigger recv", pTask->id.idStr, numOfRecv, total); } @@ -1516,7 +1562,9 @@ int32_t streamProcessDispatchRsp(SStreamTask* pTask, SStreamDispatchRsp* pRsp, i if (pMsgInfo->dispatchMsgType == STREAM_INPUT__TRANS_STATE) { stDebug("s-task:%s dispatch trans-state msgId:%d to downstream successfully, start to prepare transfer state", id, msgId); - ASSERT(pTask->info.fillHistory == 1); + if (pTask->info.fillHistory != 1) { + stFatal("s-task:%s unexpected dispatch rsp, not scan-history task, not recv this dispatch rsp", id); + } code = streamTransferStatePrepare(pTask); if (code != TSDB_CODE_SUCCESS) { // todo: do nothing if error happens @@ -1542,7 +1590,10 @@ static int32_t buildDispatchRsp(const SStreamTask* pTask, const SStreamDispatchR } ((SMsgHead*)(*pBuf))->vgId = htonl(pReq->upstreamNodeId); - ASSERT(((SMsgHead*)(*pBuf))->vgId != 0); + + if (((SMsgHead*)(*pBuf))->vgId == 0) { + return TSDB_CODE_INVALID_MSG; + } SStreamDispatchRsp* pDispatchRsp = POINTER_SHIFT((*pBuf), sizeof(SMsgHead)); diff --git a/source/libs/stream/src/streamExec.c b/source/libs/stream/src/streamExec.c index 7cb800c756..fca0bf403f 100644 --- a/source/libs/stream/src/streamExec.c +++ b/source/libs/stream/src/streamExec.c @@ -45,7 +45,11 @@ static int32_t doOutputResultBlockImpl(SStreamTask* pTask, SStreamDataBlock* pBl pTask->outputInfo.smaSink.smaSink(pTask->outputInfo.smaSink.vnode, pTask->outputInfo.smaSink.smaId, pBlock->blocks); destroyStreamDataBlock(pBlock); } else { - ASSERT(type == TASK_OUTPUT__FIXED_DISPATCH || type == TASK_OUTPUT__SHUFFLE_DISPATCH); + if (type != TASK_OUTPUT__FIXED_DISPATCH && type != TASK_OUTPUT__SHUFFLE_DISPATCH) { + stError("s-task:%s invalid stream output type:%d, internal error", pTask->id.idStr, type); + return TSDB_CODE_STREAM_INTERNAL_ERROR; + } + code = streamTaskPutDataIntoOutputQ(pTask, pBlock); if (code != TSDB_CODE_SUCCESS) { destroyStreamDataBlock(pBlock); @@ -127,7 +131,11 @@ void streamTaskExecImpl(SStreamTask* pTask, SStreamQueueItem* pItem, int64_t* to if (pItem->type == STREAM_INPUT__DATA_RETRIEVE) { SSDataBlock block = {0}; const SStreamDataBlock* pRetrieveBlock = (const SStreamDataBlock*)pItem; - ASSERT(taosArrayGetSize(pRetrieveBlock->blocks) == 1); + int32_t num = taosArrayGetSize(pRetrieveBlock->blocks); + if (num != 1) { + stError("s-task:%s invalid retrieve block number:%d, ignore", pTask->id.idStr, num); + continue; + } (void)assignOneDataBlock(&block, taosArrayGet(pRetrieveBlock->blocks, 0)); block.info.type = STREAM_PULL_OVER; @@ -140,7 +148,7 @@ void streamTaskExecImpl(SStreamTask* pTask, SStreamQueueItem* pItem, int64_t* to stError("s-task:%s failed to add retrieve block", pTask->id.idStr); } - stDebug("s-task:%s(child %d) retrieve process completed, qid:0x%" PRIx64 " dump results", pTask->id.idStr, + stDebug("s-task:%s(child %d) retrieve process completed,QID:0x%" PRIx64 " dump results", pTask->id.idStr, pTask->info.selfChildId, pRetrieveBlock->reqId); } @@ -178,7 +186,6 @@ void streamTaskExecImpl(SStreamTask* pTask, SStreamQueueItem* pItem, int64_t* to // current output should be dispatched to down stream nodes if (numOfBlocks >= STREAM_RESULT_DUMP_THRESHOLD || size >= STREAM_RESULT_DUMP_SIZE_THRESHOLD) { - ASSERT(numOfBlocks == taosArrayGetSize(pRes)); code = doDumpResult(pTask, pItem, pRes, size, totalSize, totalBlocks); // todo: here we need continue retry to put it into output buffer if (code != TSDB_CODE_SUCCESS) { @@ -192,7 +199,6 @@ void streamTaskExecImpl(SStreamTask* pTask, SStreamQueueItem* pItem, int64_t* to } if (numOfBlocks > 0) { - ASSERT(numOfBlocks == taosArrayGetSize(pRes)); code = doDumpResult(pTask, pItem, pRes, size, totalSize, totalBlocks); } else { taosArrayDestroyEx(pRes, (FDelete)blockDataFreeRes); @@ -277,7 +283,10 @@ static SScanhistoryDataInfo buildScanhistoryExecRet(EScanHistoryCode code, int32 } SScanhistoryDataInfo streamScanHistoryData(SStreamTask* pTask, int64_t st) { - ASSERT(pTask->info.taskLevel == TASK_LEVEL__SOURCE); + if(pTask->info.taskLevel != TASK_LEVEL__SOURCE) { + stError("s-task:%s not source scan-history task, not exec, quit", pTask->id.idStr); + return buildScanhistoryExecRet(TASK_SCANHISTORY_QUIT, 0); + } void* exec = pTask->exec.pExecutor; bool finished = false; @@ -374,10 +383,16 @@ int32_t streamTransferStateDoPrepare(SStreamTask* pTask) { // It must be halted for a source stream task, since when the related scan-history-data task start scan the history // for the step 2. if (pStreamTask->info.taskLevel == TASK_LEVEL__SOURCE) { - ASSERT(status == TASK_STATUS__HALT || status == TASK_STATUS__DROPPING || status == TASK_STATUS__STOP); + if (!(status == TASK_STATUS__HALT || status == TASK_STATUS__DROPPING || status == TASK_STATUS__STOP)) { + stError("s-task:%s invalid task status:%d", id, status); + return TSDB_CODE_STREAM_INTERNAL_ERROR; + } } else { - ASSERT(status == TASK_STATUS__READY || status == TASK_STATUS__PAUSE || status == TASK_STATUS__DROPPING || - status == TASK_STATUS__STOP); + if (!(status == TASK_STATUS__READY || status == TASK_STATUS__PAUSE || status == TASK_STATUS__DROPPING || + status == TASK_STATUS__STOP)) { + stError("s-task:%s invalid task status:%d", id, status); + return TSDB_CODE_STREAM_INTERNAL_ERROR; + } code = streamTaskHandleEvent(pStreamTask->status.pSM, TASK_EVENT_HALT); if (code != TSDB_CODE_SUCCESS) { stError("s-task:%s halt stream task:%s failed, code:%s not transfer state to stream task", id, @@ -438,7 +453,10 @@ int32_t streamTransferStatePrepare(SStreamTask* pTask) { int32_t code = TSDB_CODE_SUCCESS; SStreamMeta* pMeta = pTask->pMeta; - ASSERT(pTask->status.appendTranstateBlock == 1); + if (pTask->status.appendTranstateBlock != 1) { + stError("s-task:%s not set appendTransBlock flag, internal error", pTask->id.idStr); + return TSDB_CODE_STREAM_INTERNAL_ERROR; + } int32_t level = pTask->info.taskLevel; if (level == TASK_LEVEL__AGG || level == TASK_LEVEL__SOURCE) { // do transfer task operator states. @@ -476,14 +494,16 @@ static int32_t doSetStreamInputBlock(SStreamTask* pTask, const void* pInput, int code = qSetMultiStreamInput(pExecutor, pTrigger->pBlock, 1, STREAM_INPUT__DATA_BLOCK); } else if (pItem->type == STREAM_INPUT__DATA_SUBMIT) { - ASSERT(pTask->info.taskLevel == TASK_LEVEL__SOURCE); const SStreamDataSubmit* pSubmit = (const SStreamDataSubmit*)pInput; code = qSetMultiStreamInput(pExecutor, &pSubmit->submit, 1, STREAM_INPUT__DATA_SUBMIT); stDebug("s-task:%s set submit blocks as source block completed, %p %p len:%d ver:%" PRId64, id, pSubmit, pSubmit->submit.msgStr, pSubmit->submit.msgLen, pSubmit->submit.ver); - ASSERT((*pVer) <= pSubmit->submit.ver); - (*pVer) = pSubmit->submit.ver; - + if ((*pVer) > pSubmit->submit.ver) { + stError("s-task:%s invalid recorded ver:%" PRId64 " greater than new block ver:%" PRId64 ", not update", id, + *pVer, pSubmit->submit.ver); + } else { + (*pVer) = pSubmit->submit.ver; + } } else if (pItem->type == STREAM_INPUT__DATA_BLOCK || pItem->type == STREAM_INPUT__DATA_RETRIEVE) { const SStreamDataBlock* pBlock = (const SStreamDataBlock*)pInput; @@ -500,8 +520,13 @@ static int32_t doSetStreamInputBlock(SStreamTask* pTask, const void* pInput, int stDebug("s-task:%s %p set (merged) submit blocks as a batch, numOfBlocks:%d, ver:%" PRId64, id, pTask, numOfBlocks, pMerged->ver); code = qSetMultiStreamInput(pExecutor, pBlockList->pData, numOfBlocks, STREAM_INPUT__MERGED_SUBMIT); - ASSERT((*pVer) <= pMerged->ver); - (*pVer) = pMerged->ver; + + if ((*pVer) > pMerged->ver) { + stError("s-task:%s invalid recorded ver:%" PRId64 " greater than new block ver:%" PRId64 ", not update", id, + *pVer, pMerged->ver); + } else { + (*pVer) = pMerged->ver; + } } else if (pItem->type == STREAM_INPUT__REF_DATA_BLOCK) { const SStreamRefDataBlock* pRefBlock = (const SStreamRefDataBlock*)pInput; @@ -512,7 +537,8 @@ static int32_t doSetStreamInputBlock(SStreamTask* pTask, const void* pInput, int code = qSetMultiStreamInput(pExecutor, pCheckpoint->blocks, 1, pItem->type); } else { - ASSERT(0); + stError("s-task:%s invalid input block type:%d, discard", id, pItem->type); + code = TSDB_CODE_STREAM_INTERNAL_ERROR; } return code; @@ -542,7 +568,6 @@ void streamProcessTransstateBlock(SStreamTask* pTask, SStreamDataBlock* pBlock) stDebug("s-task:%s add transfer-state block into outputQ", id); } else { stDebug("s-task:%s all upstream tasks send transfer-state block, add transfer-state block into outputQ", id); - ASSERT(pTask->streamTaskId.taskId != 0 && pTask->info.fillHistory == 1); } // agg task should dispatch trans-state msg to sink task, to flush all data to sink task. @@ -560,7 +585,6 @@ void streamProcessTransstateBlock(SStreamTask* pTask, SStreamDataBlock* pBlock) } else { // non-dispatch task, do task state transfer directly streamFreeQitem((SStreamQueueItem*)pBlock); stDebug("s-task:%s non-dispatch task, level:%d start to transfer state directly", id, level); - ASSERT(pTask->info.fillHistory == 1); code = streamTransferStatePrepare(pTask); if (code != TSDB_CODE_SUCCESS) { @@ -606,7 +630,11 @@ static void doStreamTaskExecImpl(SStreamTask* pTask, SStreamQueueItem* pBlock, i } // update the currentVer if processing the submit blocks. - ASSERT(pInfo->checkpointVer <= pInfo->nextProcessVer && ver >= pInfo->checkpointVer); + if (!(pInfo->checkpointVer <= pInfo->nextProcessVer && ver >= pInfo->checkpointVer)) { + stError("s-task:%s invalid info, checkpointVer:%" PRId64 ", nextProcessVer:%" PRId64 " currentVer:%" PRId64, id, + pInfo->checkpointVer, pInfo->nextProcessVer, ver); + return; + } if (ver != pInfo->processedVer) { stDebug("s-task:%s update processedVer(unsaved) from %" PRId64 " to %" PRId64 " nextProcessVer:%" PRId64 @@ -622,8 +650,6 @@ void flushStateDataInExecutor(SStreamTask* pTask, SStreamQueueItem* pCheckpointB // 1. transfer the ownership of executor state bool dropRelHTask = (streamTaskGetPrevStatus(pTask) == TASK_STATUS__HALT); if (dropRelHTask) { - ASSERT(HAS_RELATED_FILLHISTORY_TASK(pTask)); - STaskId* pHTaskId = &pTask->hTaskInfo.id; SStreamTask* pHTask = NULL; int32_t code = streamMetaAcquireTask(pTask->pMeta, pHTaskId->streamId, pHTaskId->taskId, &pHTask); @@ -692,12 +718,10 @@ static int32_t doStreamExecTask(SStreamTask* pTask) { EExtractDataCode ret = streamTaskGetDataFromInputQ(pTask, &pInput, &numOfBlocks, &blockSize); if (ret == EXEC_AFTER_IDLE) { - ASSERT(pInput == NULL && numOfBlocks == 0); streamTaskSetIdleInfo(pTask, MIN_INVOKE_INTERVAL); return 0; } else { if (pInput == NULL) { - ASSERT(numOfBlocks == 0); return 0; } } @@ -718,7 +742,10 @@ static int32_t doStreamExecTask(SStreamTask* pTask) { } if (pTask->info.taskLevel == TASK_LEVEL__SINK) { - ASSERT(type == STREAM_INPUT__DATA_BLOCK || type == STREAM_INPUT__CHECKPOINT); + if (type != STREAM_INPUT__DATA_BLOCK && type != STREAM_INPUT__CHECKPOINT) { + stError("s-task:%s invalid block type:%d for sink task, discard", id, type); + continue; + } int64_t st = taosGetTimestampMs(); @@ -801,7 +828,11 @@ bool streamTaskReadyToRun(const SStreamTask* pTask, char** pStatus) { } void streamResumeTask(SStreamTask* pTask) { - ASSERT(pTask->status.schedStatus == TASK_SCHED_STATUS__ACTIVE); + if (pTask->status.schedStatus != TASK_SCHED_STATUS__ACTIVE) { + stError("s-task:%s invalid sched status:%d, not resume task", pTask->id.idStr, pTask->status.schedStatus); + return; + } + const char* id = pTask->id.idStr; while (1) { diff --git a/source/libs/stream/src/streamHb.c b/source/libs/stream/src/streamHb.c index 73392fade0..1fd3106cff 100644 --- a/source/libs/stream/src/streamHb.c +++ b/source/libs/stream/src/streamHb.c @@ -25,7 +25,6 @@ int32_t streamMetaId = 0; struct SMetaHbInfo { tmr_h hbTmr; - int32_t stopFlag; int32_t tickCounter; int32_t hbCount; int64_t hbStart; @@ -96,6 +95,7 @@ static int32_t doSendHbMsgInfo(SStreamHbMsg* pMsg, SStreamMeta* pMeta, SEpSet* p tEncoderInit(&encoder, buf, tlen); if ((code = tEncodeStreamHbMsg(&encoder, pMsg)) < 0) { rpcFreeCont(buf); + tEncoderClear(&encoder); stError("vgId:%d encode stream hb msg failed, code:%s", pMeta->vgId, tstrerror(code)); return TSDB_CODE_FAILED; } @@ -197,11 +197,12 @@ int32_t streamMetaSendHbHelper(SStreamMeta* pMeta) { } } - if ((*pTask)->status.requireConsensusChkptId) { - entry.checkpointInfo.consensusChkptId = 1; - (*pTask)->status.requireConsensusChkptId = false; - stDebug("s-task:%s vgId:%d set requiring consensus-checkpointId in hbMsg", (*pTask)->id.idStr, pMeta->vgId); + streamMutexLock(&(*pTask)->lock); + entry.checkpointInfo.consensusChkptId = streamTaskCheckIfReqConsenChkptId(*pTask, pMsg->ts); + if (entry.checkpointInfo.consensusChkptId) { + entry.checkpointInfo.consensusTs = pMsg->ts; } + streamMutexUnlock(&(*pTask)->lock); if ((*pTask)->exec.pWalReader != NULL) { entry.processedVer = walReaderGetCurrentVer((*pTask)->exec.pWalReader) - 1; @@ -241,6 +242,8 @@ int32_t streamMetaSendHbHelper(SStreamMeta* pMeta) { void streamMetaHbToMnode(void* param, void* tmrId) { int64_t rid = *(int64_t*)param; int32_t code = 0; + int32_t vgId = 0; + int32_t role = 0; SStreamMeta* pMeta = taosAcquireRef(streamMetaId, rid); if (pMeta == NULL) { @@ -248,29 +251,41 @@ void streamMetaHbToMnode(void* param, void* tmrId) { return; } + vgId = pMeta->vgId; + role = pMeta->role; + // need to stop, stop now - if (pMeta->pHbInfo->stopFlag == STREAM_META_WILL_STOP) { // todo refactor: not need this now, use closeFlag in Meta - pMeta->pHbInfo->stopFlag = STREAM_META_OK_TO_STOP; + if (pMeta->closeFlag) { + pMeta->pHbInfo->hbStart = 0; code = taosReleaseRef(streamMetaId, rid); if (code == TSDB_CODE_SUCCESS) { - stDebug("vgId:%d jump out of meta timer", pMeta->vgId); + stDebug("vgId:%d jump out of meta timer", vgId); } else { - stError("vgId:%d jump out of meta timer, failed to release the meta rid:%" PRId64, pMeta->vgId, rid); + stError("vgId:%d jump out of meta timer, failed to release the meta rid:%" PRId64, vgId, rid); } return; } // not leader not send msg if (pMeta->role != NODE_ROLE_LEADER) { + pMeta->pHbInfo->hbStart = 0; code = taosReleaseRef(streamMetaId, rid); if (code == TSDB_CODE_SUCCESS) { - stInfo("vgId:%d role:%d not leader not send hb to mnode", pMeta->vgId, pMeta->role); + stInfo("vgId:%d role:%d not leader not send hb to mnode", vgId, role); } else { - stError("vgId:%d role:%d not leader not send hb to mnodefailed to release the meta rid:%" PRId64, pMeta->vgId, - pMeta->role, rid); + stError("vgId:%d role:%d not leader not send hb to mnodefailed to release the meta rid:%" PRId64, vgId, role, rid); } + return; + } - pMeta->pHbInfo->hbStart = 0; + if (!waitForEnoughDuration(pMeta->pHbInfo)) { + streamTmrReset(streamMetaHbToMnode, META_HB_CHECK_INTERVAL, param, streamTimer, &pMeta->pHbInfo->hbTmr, vgId, + "meta-hb-tmr"); + + code = taosReleaseRef(streamMetaId, rid); + if (code) { + stError("vgId:%d in meta timer, failed to release the meta rid:%" PRId64, vgId, rid); + } return; } @@ -279,17 +294,6 @@ void streamMetaHbToMnode(void* param, void* tmrId) { pMeta->pHbInfo->hbStart = taosGetTimestampMs(); } - if (!waitForEnoughDuration(pMeta->pHbInfo)) { - streamTmrReset(streamMetaHbToMnode, META_HB_CHECK_INTERVAL, param, streamTimer, &pMeta->pHbInfo->hbTmr, pMeta->vgId, - "meta-hb-tmr"); - - code = taosReleaseRef(streamMetaId, rid); - if (code) { - stError("vgId:%d in meta timer, failed to release the meta rid:%" PRId64, pMeta->vgId, rid); - } - return; - } - streamMetaRLock(pMeta); code = streamMetaSendHbHelper(pMeta); if (code) { @@ -299,10 +303,10 @@ void streamMetaHbToMnode(void* param, void* tmrId) { streamTmrReset(streamMetaHbToMnode, META_HB_CHECK_INTERVAL, param, streamTimer, &pMeta->pHbInfo->hbTmr, pMeta->vgId, "meta-hb-tmr"); - code = taosReleaseRef(streamMetaId, rid); + code = taosReleaseRef(streamMetaId, rid); if (code) { - stError("vgId:%d in meta timer, failed to release the meta rid:%" PRId64, pMeta->vgId, rid); + stError("vgId:%d in meta timer, failed to release the meta rid:%" PRId64, vgId, rid); } } @@ -315,7 +319,6 @@ int32_t createMetaHbInfo(int64_t* pRid, SMetaHbInfo** pRes) { pInfo->hbTmr = taosTmrStart(streamMetaHbToMnode, META_HB_CHECK_INTERVAL, pRid, streamTimer); pInfo->tickCounter = 0; - pInfo->stopFlag = 0; pInfo->msgSendTs = -1; pInfo->hbCount = 0; @@ -339,11 +342,8 @@ void destroyMetaHbInfo(SMetaHbInfo* pInfo) { void streamMetaWaitForHbTmrQuit(SStreamMeta* pMeta) { // wait for the stream meta hb function stopping if (pMeta->role == NODE_ROLE_LEADER) { - pMeta->pHbInfo->stopFlag = STREAM_META_WILL_STOP; - while (pMeta->pHbInfo->stopFlag != STREAM_META_OK_TO_STOP) { - taosMsleep(100); - stDebug("vgId:%d wait for meta to stop timer", pMeta->vgId); - } + taosMsleep(2 * META_HB_CHECK_INTERVAL); + stDebug("vgId:%d wait for meta to stop timer", pMeta->vgId); } } diff --git a/source/libs/stream/src/streamMeta.c b/source/libs/stream/src/streamMeta.c index d6f1559578..084eb7b827 100644 --- a/source/libs/stream/src/streamMeta.c +++ b/source/libs/stream/src/streamMeta.c @@ -719,9 +719,13 @@ int32_t streamMetaRegisterTask(SStreamMeta* pMeta, int64_t ver, SStreamTask* pTa } int32_t streamMetaGetNumOfTasks(SStreamMeta* pMeta) { - size_t size = taosHashGetSize(pMeta->pTasksMap); - ASSERT(taosArrayGetSize(pMeta->pTaskList) == taosHashGetSize(pMeta->pTasksMap)); - return (int32_t)size; + int32_t size = (int32_t)taosHashGetSize(pMeta->pTasksMap); + int32_t sizeInList = taosArrayGetSize(pMeta->pTaskList); + if (sizeInList != size) { + stError("vgId:%d tasks number not consistent in list:%d and map:%d, ", pMeta->vgId, sizeInList, size); + } + + return size; } int32_t streamMetaAcquireTaskNoLock(SStreamMeta* pMeta, int64_t streamId, int32_t taskId, SStreamTask** pTask) { @@ -775,7 +779,10 @@ static void doRemoveIdFromList(SArray* pTaskList, int32_t num, SStreamTaskId* id break; } } - ASSERT(remove); + + if (!remove) { + stError("s-task:0x%x not in meta task list, internal error", id->taskId); + } } static int32_t streamTaskSendTransSuccessMsg(SStreamTask* pTask, void* param) { @@ -787,6 +794,7 @@ static int32_t streamTaskSendTransSuccessMsg(SStreamTask* pTask, void* param) { int32_t streamMetaUnregisterTask(SStreamMeta* pMeta, int64_t streamId, int32_t taskId) { SStreamTask* pTask = NULL; + int32_t vgId = pMeta->vgId; // pre-delete operation streamMetaWLock(pMeta); @@ -799,19 +807,19 @@ int32_t streamMetaUnregisterTask(SStreamMeta* pMeta, int64_t streamId, int32_t t // desc the paused task counter if (streamTaskShouldPause(pTask)) { int32_t num = atomic_sub_fetch_32(&pMeta->numOfPausedTasks, 1); - stInfo("vgId:%d s-task:%s drop stream task. pause task num:%d", pMeta->vgId, pTask->id.idStr, num); + stInfo("vgId:%d s-task:%s drop stream task. pause task num:%d", vgId, pTask->id.idStr, num); } // handle the dropping event (void)streamTaskHandleEventAsync(pTask->status.pSM, TASK_EVENT_DROPPING, streamTaskSendTransSuccessMsg, NULL); } else { - stDebug("vgId:%d failed to find the task:0x%x, it may be dropped already", pMeta->vgId, taskId); + stDebug("vgId:%d failed to find the task:0x%x, it may be dropped already", vgId, taskId); streamMetaWUnLock(pMeta); return 0; } streamMetaWUnLock(pMeta); - stDebug("s-task:0x%x vgId:%d set task status:dropping and start to unregister it", taskId, pMeta->vgId); + stDebug("s-task:0x%x vgId:%d set task status:dropping and start to unregister it", taskId, vgId); while (1) { int32_t timerActive = 0; @@ -845,14 +853,22 @@ int32_t streamMetaUnregisterTask(SStreamMeta* pMeta, int64_t streamId, int32_t t (void)atomic_sub_fetch_32(&pMeta->numOfStreamTasks, 1); } - (void)taosHashRemove(pMeta->pTasksMap, &id, sizeof(id)); + int32_t code = taosHashRemove(pMeta->pTasksMap, &id, sizeof(id)); doRemoveIdFromList(pMeta->pTaskList, (int32_t)taosArrayGetSize(pMeta->pTaskList), &pTask->id); (void)streamMetaRemoveTask(pMeta, &id); - ASSERT(taosHashGetSize(pMeta->pTasksMap) == taosArrayGetSize(pMeta->pTaskList)); + int32_t size = (int32_t) taosHashGetSize(pMeta->pTasksMap); + int32_t sizeInList = taosArrayGetSize(pMeta->pTaskList); + if (sizeInList != size) { + stError("vgId:%d tasks number not consistent in list:%d and map:%d, ", vgId, sizeInList, size); + } streamMetaWUnLock(pMeta); - ASSERT(pTask->status.timerActive == 0); + int32_t numOfTmr = pTask->status.timerActive; + if (numOfTmr != 0) { + stError("s-task:%s vgId:%d invalid timer Active record:%d, internal error", pTask->id.idStr, vgId, numOfTmr); + } + if (pTask->info.delaySchedParam != 0 && pTask->info.fillHistory == 0) { stDebug("s-task:%s stop schedTimer, and (before) desc ref:%d", pTask->id.idStr, pTask->refCnt); (void)taosTmrStop(pTask->schedInfo.pDelayTimer); @@ -862,7 +878,7 @@ int32_t streamMetaUnregisterTask(SStreamMeta* pMeta, int64_t streamId, int32_t t streamMetaReleaseTask(pMeta, pTask); } else { - stDebug("vgId:%d failed to find the task:0x%x, it may have been dropped already", pMeta->vgId, taskId); + stDebug("vgId:%d failed to find the task:0x%x, it may have been dropped already", vgId, taskId); streamMetaWUnLock(pMeta); } @@ -1013,7 +1029,10 @@ void streamMetaLoadAllTasks(SStreamMeta* pMeta) { tFreeStreamTask(pTask); STaskId id = streamTaskGetTaskId(pTask); - (void)taosArrayPush(pRecycleList, &id); + void* px = taosArrayPush(pRecycleList, &id); + if (px == NULL) { + stError("s-task:0x%x failed record the task into recycle list due to out of memory", taskId); + } int32_t total = taosArrayGetSize(pRecycleList); stDebug("s-task:0x%x is already dropped, add into recycle list, total:%d", taskId, total); @@ -1034,7 +1053,10 @@ void streamMetaLoadAllTasks(SStreamMeta* pMeta) { continue; } - (void)taosArrayPush(pMeta->pTaskList, &pTask->id); + void* px = taosArrayPush(pMeta->pTaskList, &pTask->id); + if (px == NULL) { + stFatal("s-task:0x%x failed to add into task list due to out of memory", pTask->id.taskId); + } } else { // todo this should replace the existed object put by replay creating stream task msg from mnode stError("s-task:0x%x already added into table meta by replaying WAL, need check", pTask->id.taskId); @@ -1044,7 +1066,7 @@ void streamMetaLoadAllTasks(SStreamMeta* pMeta) { if (taosHashPut(pMeta->pTasksMap, &id, sizeof(id), &pTask, POINTER_BYTES) != 0) { stError("s-task:0x%x failed to put into hashTable, code:%s, continue", pTask->id.taskId, tstrerror(terrno)); - (void)taosArrayPop(pMeta->pTaskList); + void* px = taosArrayPop(pMeta->pTaskList); tFreeStreamTask(pTask); continue; } @@ -1056,8 +1078,6 @@ void streamMetaLoadAllTasks(SStreamMeta* pMeta) { if (streamTaskShouldPause(pTask)) { (void)atomic_add_fetch_32(&pMeta->numOfPausedTasks, 1); } - - ASSERT(pTask->status.downstreamReady == 0); } tdbFree(pKey); @@ -1075,7 +1095,6 @@ void streamMetaLoadAllTasks(SStreamMeta* pMeta) { } int32_t numOfTasks = taosArrayGetSize(pMeta->pTaskList); - ASSERT(pMeta->numOfStreamTasks <= numOfTasks && pMeta->numOfPausedTasks <= numOfTasks); stDebug("vgId:%d load %d tasks into meta from disk completed, streamTask:%d, paused:%d", pMeta->vgId, numOfTasks, pMeta->numOfStreamTasks, pMeta->numOfPausedTasks); diff --git a/source/libs/stream/src/streamQueue.c b/source/libs/stream/src/streamQueue.c index 3703ed07aa..eca728b2d5 100644 --- a/source/libs/stream/src/streamQueue.c +++ b/source/libs/stream/src/streamQueue.c @@ -90,7 +90,6 @@ void streamQueueNextItem(SStreamQueue* pQueue, SStreamQueueItem** pItem) { int8_t flag = atomic_exchange_8(&pQueue->status, STREAM_QUEUE__PROCESSING); if (flag == STREAM_QUEUE__FAILED) { - ASSERT(pQueue->qItem != NULL); *pItem = streamQueueCurItem(pQueue); } else { pQueue->qItem = NULL; @@ -105,13 +104,20 @@ void streamQueueNextItem(SStreamQueue* pQueue, SStreamQueueItem** pItem) { } void streamQueueProcessSuccess(SStreamQueue* queue) { - ASSERT(atomic_load_8(&queue->status) == STREAM_QUEUE__PROCESSING); + if (atomic_load_8(&queue->status) != STREAM_QUEUE__PROCESSING) { + stError("invalid queue status:%d, expect:%d", atomic_load_8(&queue->status), STREAM_QUEUE__PROCESSING); + return; + } + queue->qItem = NULL; atomic_store_8(&queue->status, STREAM_QUEUE__SUCESS); } void streamQueueProcessFail(SStreamQueue* queue) { - ASSERT(atomic_load_8(&queue->status) == STREAM_QUEUE__PROCESSING); + if (atomic_load_8(&queue->status) != STREAM_QUEUE__PROCESSING) { + stError("invalid queue status:%d, expect:%d", atomic_load_8(&queue->status), STREAM_QUEUE__PROCESSING); + return; + } atomic_store_8(&queue->status, STREAM_QUEUE__FAILED); } @@ -229,7 +235,6 @@ EExtractDataCode streamTaskGetDataFromInputQ(SStreamTask* pTask, SStreamQueueIte } } else { if (*pInput == NULL) { - ASSERT((*numOfBlocks) == 0); *pInput = qItem; } else { // merge current block failed, let's handle the already merged blocks. void* newRet = NULL; @@ -340,7 +345,8 @@ int32_t streamTaskPutDataIntoInputQ(SStreamTask* pTask, SStreamQueueItem* pItem) double size = SIZE_IN_MiB(taosQueueMemorySize(pQueue)); stDebug("s-task:%s data res enqueue, current(blocks:%d, size:%.2fMiB)", pTask->id.idStr, total, size); } else { - ASSERT(0); + stError("s-task:%s invalid type:%d to put in inputQ", pTask->id.idStr, type); + return TSDB_CODE_INVALID_PARA; } if (type != STREAM_INPUT__GET_RES && type != STREAM_INPUT__CHECKPOINT && type != STREAM_INPUT__CHECKPOINT_TRIGGER && diff --git a/source/libs/stream/src/streamStartHistory.c b/source/libs/stream/src/streamStartHistory.c index e68c088b9a..a8c76d3f52 100644 --- a/source/libs/stream/src/streamStartHistory.c +++ b/source/libs/stream/src/streamStartHistory.c @@ -111,11 +111,15 @@ void streamExecScanHistoryInFuture(SStreamTask* pTask, int32_t idleDuration) { } int32_t streamTaskStartScanHistory(SStreamTask* pTask) { - int32_t level = pTask->info.taskLevel; - ETaskStatus status = streamTaskGetStatus(pTask).state; + int32_t level = pTask->info.taskLevel; + SStreamTaskState state = streamTaskGetStatus(pTask); - ASSERT((pTask->status.downstreamReady == 1) && (status == TASK_STATUS__SCAN_HISTORY) && - (pTask->info.fillHistory == 1)); + if (((pTask->status.downstreamReady != 1) || (state.state != TASK_STATUS__SCAN_HISTORY) || + (pTask->info.fillHistory != 1))) { + stFatal("s-task:%s invalid status:%s to start fill-history task, downReady:%d, is-fill-history task:%d", + pTask->id.idStr, state.name, pTask->status.downstreamReady, pTask->info.fillHistory); + return TSDB_CODE_STREAM_INTERNAL_ERROR; + } if (level == TASK_LEVEL__SOURCE) { return doStartScanHistoryTask(pTask); @@ -144,7 +148,6 @@ int32_t streamTaskOnNormalTaskReady(SStreamTask* pTask) { } SStreamTaskState p = streamTaskGetStatus(pTask); - ASSERT(p.state == TASK_STATUS__READY); int8_t schedStatus = pTask->status.schedStatus; if (pTask->info.taskLevel == TASK_LEVEL__SOURCE) { @@ -171,8 +174,6 @@ int32_t streamTaskOnScanHistoryTaskReady(SStreamTask* pTask) { if (code == 0) { SStreamTaskState p = streamTaskGetStatus(pTask); - ASSERT((p.state == TASK_STATUS__SCAN_HISTORY) && (pTask->info.fillHistory == 1)); - stDebug("s-task:%s fill-history task enters into scan-history data stage, status:%s", pTask->id.idStr, p.name); code = streamTaskStartScanHistory(pTask); } @@ -348,8 +349,6 @@ void tryLaunchHistoryTask(void* param, void* tmrId) { } if (streamTaskShouldStop(*ppTask)) { - ASSERT((*ppTask)->status.timerActive >= 1); - char* p = streamTaskGetStatus(*ppTask).name; int32_t ref = atomic_sub_fetch_32(&(*ppTask)->status.timerActive, 1); stDebug("s-task:%s status:%s should stop, quit launch fill-history task timer, retry:%d, ref:%d", @@ -385,7 +384,10 @@ void tryLaunchHistoryTask(void* param, void* tmrId) { notRetryLaunchFillHistoryTask(pTask, pInfo, now); } else { // not reach the limitation yet, let's continue retrying launch related fill-history task. streamTaskSetRetryInfoForLaunch(pHTaskInfo); - ASSERT(pTask->status.timerActive >= 1); + if (pTask->status.timerActive < 1) { + stError("s-task:%s invalid timerActive recorder:%d, abort timer", pTask->id.idStr, pTask->status.timerActive); + return; + } // abort the timer if intend to stop task SStreamTask* pHTask = NULL; @@ -451,8 +453,6 @@ int32_t launchNotBuiltFillHistoryTask(SStreamTask* pTask) { int32_t hTaskId = pTask->hTaskInfo.id.taskId; SLaunchHTaskInfo* pInfo = NULL; - ASSERT(hTaskId != 0); - stWarn("s-task:%s vgId:%d failed to launch history task:0x%x, since not built yet", idStr, pMeta->vgId, hTaskId); STaskId id = streamTaskGetTaskId(pTask); @@ -480,11 +480,18 @@ int32_t launchNotBuiltFillHistoryTask(SStreamTask* pTask) { return terrno; } - ASSERT(ref >= 1); + if (ref < 1) { + stError("s-task:%s invalid timerActive recorder:%d, abort timer", pTask->id.idStr, pTask->status.timerActive); + return TSDB_CODE_STREAM_INTERNAL_ERROR; + } stDebug("s-task:%s set timer active flag, ref:%d", idStr, ref); } else { // timer exists - ASSERT(pTask->status.timerActive >= 1); + if (pTask->status.timerActive < 1) { + stError("s-task:%s invalid timerActive recorder:%d, abort timer", pTask->id.idStr, pTask->status.timerActive); + return TSDB_CODE_STREAM_INTERNAL_ERROR; + } + stDebug("s-task:%s set timer active flag, task timer not null", idStr); streamTmrReset(tryLaunchHistoryTask, WAIT_FOR_MINIMAL_INTERVAL, pInfo, streamTimer, &pTask->hTaskInfo.pTimer, pTask->pMeta->vgId, " start-history-task-tmr"); @@ -500,7 +507,11 @@ int32_t streamTaskResetTimewindowFilter(SStreamTask* pTask) { bool streamHistoryTaskSetVerRangeStep2(SStreamTask* pTask, int64_t nextProcessVer) { SVersionRange* pRange = &pTask->dataRange.range; - ASSERT(nextProcessVer >= pRange->maxVer); + if (nextProcessVer < pRange->maxVer) { + stError("s-task:%s next processdVer:%"PRId64" is less than range max ver:%"PRId64, pTask->id.idStr, nextProcessVer, + pRange->maxVer); + return true; + } // maxVer for fill-history task is the version, where the last timestamp is acquired. // it's also the maximum version to scan data in tsdb. @@ -538,7 +549,11 @@ int32_t streamTaskSetRangeStreamCalc(SStreamTask* pTask) { return TSDB_CODE_SUCCESS; } else { - ASSERT(pTask->info.fillHistory == 0); + if (pTask->info.fillHistory != 0) { + stError("s-task:%s task should not be fill-history task, internal error", pTask->id.idStr); + return TSDB_CODE_STREAM_INTERNAL_ERROR; + } + if (pTask->info.taskLevel >= TASK_LEVEL__AGG) { return TSDB_CODE_SUCCESS; } diff --git a/source/libs/stream/src/streamStartTask.c b/source/libs/stream/src/streamStartTask.c index 92aad2ece1..c2e8a523e5 100644 --- a/source/libs/stream/src/streamStartTask.c +++ b/source/libs/stream/src/streamStartTask.c @@ -120,7 +120,8 @@ int32_t streamMetaStartAllTasks(SStreamMeta* pMeta) { stError("vgId:%d failed to handle event:%d", pMeta->vgId, TASK_EVENT_INIT); code = ret; - if (code != TSDB_CODE_STREAM_INVALID_STATETRANS) { + // do no added into result hashmap if it is failed due to concurrently starting of this stream task. + if (code != TSDB_CODE_STREAM_CONFLICT_EVENT) { streamMetaAddFailedTaskSelf(pTask, pInfo->readyTs); } } @@ -195,9 +196,9 @@ int32_t streamMetaAddTaskLaunchResult(SStreamMeta* pMeta, int64_t streamId, int3 } // clear the send consensus-checkpointId flag - streamMutexLock(&(*p)->lock); - (*p)->status.sendConsensusChkptId = false; - streamMutexUnlock(&(*p)->lock); +// streamMutexLock(&(*p)->lock); +// (*p)->status.sendConsensusChkptId = false; +// streamMutexUnlock(&(*p)->lock); if (pStartInfo->startAllTasks != 1) { int64_t el = endTs - startTs; @@ -385,11 +386,11 @@ int32_t streamMetaStartOneTask(SStreamMeta* pMeta, int64_t streamId, int32_t tas if (code == TSDB_CODE_SUCCESS) { code = streamTaskHandleEvent(pTask->status.pSM, TASK_EVENT_INIT); if (code != TSDB_CODE_SUCCESS) { - stError("s-task:%s vgId:%d failed to handle event:%d, code:%s", pTask->id.idStr, pMeta->vgId, TASK_EVENT_INIT, + stError("s-task:%s vgId:%d failed to handle event:init-task, code:%s", pTask->id.idStr, pMeta->vgId, tstrerror(code)); // do no added into result hashmap if it is failed due to concurrently starting of this stream task. - if (code != TSDB_CODE_STREAM_INVALID_STATETRANS) { + if (code != TSDB_CODE_STREAM_CONFLICT_EVENT) { streamMetaAddFailedTaskSelf(pTask, pInfo->readyTs); } } @@ -443,4 +444,47 @@ int32_t streamMetaStopAllTasks(SStreamMeta* pMeta) { return 0; } +int32_t streamTaskCheckIfReqConsenChkptId(SStreamTask* pTask, int64_t ts) { + SConsenChkptInfo* pConChkptInfo = &pTask->status.consenChkptInfo; + int32_t vgId = pTask->pMeta->vgId; + if (pConChkptInfo->status == TASK_CONSEN_CHKPT_REQ) { + pConChkptInfo->status = TASK_CONSEN_CHKPT_SEND; + pConChkptInfo->statusTs = ts; + stDebug("s-task:%s vgId:%d set requiring consensus-chkptId in hbMsg, ts:%" PRId64, pTask->id.idStr, + vgId, pConChkptInfo->statusTs); + return 1; + } else { + int32_t el = (ts - pConChkptInfo->statusTs) / 1000; + if ((pConChkptInfo->status == TASK_CONSEN_CHKPT_SEND) && el > 60) { + pConChkptInfo->statusTs = ts; + + stWarn( + "s-task:%s vgId:%d not recv consensus-chkptId for %ds(more than 60s), set requiring in Hb again, ts:%" PRId64, + pTask->id.idStr, vgId, el, pConChkptInfo->statusTs); + return 1; + } + } + + return 0; +} + +void streamTaskSetConsenChkptIdRecv(SStreamTask* pTask, int32_t transId, int64_t ts) { + SConsenChkptInfo* pInfo = &pTask->status.consenChkptInfo; + pInfo->consenChkptTransId = transId; + pInfo->status = TASK_CONSEN_CHKPT_RECV; + pInfo->statusTs = ts; + + stDebug("s-task:%s set recv consen-checkpointId, transId:%d", pTask->id.idStr, transId); +} + +void streamTaskSetReqConsenChkptId(SStreamTask* pTask, int64_t ts) { + SConsenChkptInfo* pInfo = &pTask->status.consenChkptInfo; + int32_t prevTrans = pInfo->consenChkptTransId; + + pInfo->status = TASK_CONSEN_CHKPT_REQ; + pInfo->statusTs = ts; + pInfo->consenChkptTransId = 0; + + stDebug("s-task:%s set req consen-checkpointId flag, prev transId:%d, ts:%" PRId64, pTask->id.idStr, prevTrans, ts); +} diff --git a/source/libs/stream/src/streamTask.c b/source/libs/stream/src/streamTask.c index a184314714..0791784656 100644 --- a/source/libs/stream/src/streamTask.c +++ b/source/libs/stream/src/streamTask.c @@ -134,8 +134,9 @@ int32_t tNewStreamTask(int64_t streamId, int8_t taskLevel, SEpSet* pEpset, bool return code; } - if (fillHistory) { - ASSERT(hasFillhistory); + if (fillHistory && !hasFillhistory) { + stError("s-task:0x%x create task failed, due to inconsistent fill-history flag", pTask->id.taskId); + return TSDB_CODE_INVALID_PARA; } epsetAssign(&(pTask->info.mnodeEpset), pEpset); @@ -310,6 +311,7 @@ void tFreeStreamTask(SStreamTask* pTask) { } void streamFreeTaskState(SStreamTask* pTask, int8_t remove) { + stDebug("s-task:0x%x start to free task state/backend", pTask->id.taskId); if (pTask->pState != NULL) { stDebug("s-task:0x%x start to free task state", pTask->id.taskId); streamStateClose(pTask->pState, remove); @@ -319,8 +321,11 @@ void streamFreeTaskState(SStreamTask* pTask, int8_t remove) { pTask->pBackend = NULL; pTask->pState = NULL; } else { + stDebug("s-task:0x%x task state is NULL, may del backend:%s", pTask->id.taskId, + pTask->backendPath ? pTask->backendPath : "NULL"); if (remove) { if (pTask->backendPath != NULL) { + stDebug("s-task:0x%x task state is NULL, do del backend:%s", pTask->id.taskId, pTask->backendPath); taosRemoveDir(pTask->backendPath); } } @@ -373,11 +378,11 @@ int32_t streamTaskSetBackendPath(SStreamTask* pTask) { int32_t taskId = 0; if (pTask->info.fillHistory) { - streamId = pTask->hTaskInfo.id.taskId; - taskId = pTask->hTaskInfo.id.taskId; - } else { - streamId = pTask->streamTaskId.taskId; + streamId = pTask->streamTaskId.streamId; taskId = pTask->streamTaskId.taskId; + } else { + streamId = pTask->id.streamId; + taskId = pTask->id.taskId; } char id[128] = {0}; @@ -393,6 +398,7 @@ int32_t streamTaskSetBackendPath(SStreamTask* pTask) { } (void)sprintf(pTask->backendPath, "%s%s%s", pTask->pMeta->path, TD_DIRSEP, id); + stDebug("s-task:%s set backend path:%s", pTask->id.idStr, pTask->backendPath); return 0; } @@ -723,8 +729,11 @@ void streamTaskCloseUpstreamInput(SStreamTask* pTask, int32_t taskId) { if ((pInfo != NULL) && pInfo->dataAllowed) { pInfo->dataAllowed = false; - int32_t t = atomic_add_fetch_32(&pTask->upstreamInfo.numOfClosed, 1); - ASSERT(t <= streamTaskGetNumOfUpstream(pTask)); + if (pTask->upstreamInfo.numOfClosed < streamTaskGetNumOfUpstream(pTask)) { + int32_t t = atomic_add_fetch_32(&pTask->upstreamInfo.numOfClosed, 1); + } else { + stError("s-task:%s not inc closed input, since they have been all closed already", pTask->id.idStr); + } } } @@ -734,7 +743,7 @@ void streamTaskOpenUpstreamInput(SStreamTask* pTask, int32_t taskId) { if (pInfo != NULL && (!pInfo->dataAllowed)) { int32_t t = atomic_sub_fetch_32(&pTask->upstreamInfo.numOfClosed, 1); - ASSERT(t >= 0); + stDebug("s-task:%s open inputQ for upstream:0x%x, remain closed:%d", pTask->id.idStr, taskId, t); pInfo->dataAllowed = true; } } @@ -770,8 +779,6 @@ int8_t streamTaskSetSchedStatusActive(SStreamTask* pTask) { int8_t streamTaskSetSchedStatusInactive(SStreamTask* pTask) { streamMutexLock(&pTask->lock); int8_t status = pTask->status.schedStatus; - ASSERT(status == TASK_SCHED_STATUS__WAITING || status == TASK_SCHED_STATUS__ACTIVE || - status == TASK_SCHED_STATUS__INACTIVE); pTask->status.schedStatus = TASK_SCHED_STATUS__INACTIVE; streamMutexUnlock(&pTask->lock); @@ -863,6 +870,7 @@ int32_t streamSendChkptReportMsg(SStreamTask* pTask, SCheckpointInfo* pCheckpoin tEncoderInit(&encoder, buf, tlen); if ((code = tEncodeStreamTaskChkptReport(&encoder, &req)) < 0) { rpcFreeCont(buf); + tEncoderClear(&encoder); stError("s-task:%s vgId:%d encode stream task checkpoint-report msg failed, code:%s", id, vgId, tstrerror(code)); return -1; } @@ -887,8 +895,6 @@ void streamTaskInitForLaunchHTask(SHistoryTaskInfo* pInfo) { } void streamTaskSetRetryInfoForLaunch(SHistoryTaskInfo* pInfo) { - ASSERT(pInfo->tickCount == 0); - pInfo->waitInterval *= RETRY_LAUNCH_INTERVAL_INC_RATE; pInfo->tickCount = ceil(pInfo->waitInterval / WAIT_FOR_MINIMAL_INTERVAL); pInfo->retryTimes += 1; @@ -941,7 +947,7 @@ STaskStatusEntry streamTaskGetStatusEntry(SStreamTask* pTask) { .checkpointInfo.latestSize = 0, .checkpointInfo.remoteBackup = 0, .checkpointInfo.consensusChkptId = 0, - .checkpointInfo.consensusTs = taosGetTimestampMs(), + .checkpointInfo.consensusTs = 0, .hTaskId = pTask->hTaskInfo.id.taskId, .procsTotal = SIZE_IN_MiB(pExecInfo->inputDataSize), .outputTotal = SIZE_IN_MiB(pExecInfo->outputDataSize), @@ -1016,6 +1022,7 @@ int32_t streamTaskSendCheckpointReq(SStreamTask* pTask) { tEncoderInit(&encoder, buf, tlen); if ((code = tEncodeStreamTaskCheckpointReq(&encoder, &req)) < 0) { rpcFreeCont(buf); + tEncoderClear(&encoder); stError("s-task:%s vgId:%d encode stream task req checkpoint msg failed, code:%s", id, vgId, tstrerror(code)); return -1; } @@ -1092,7 +1099,7 @@ static int32_t streamTaskEnqueueRetrieve(SStreamTask* pTask, SStreamRetrieveReq* } // enqueue - stDebug("s-task:%s (vgId:%d level:%d) recv retrieve req from task:0x%x(vgId:%d), qid:0x%" PRIx64, pTask->id.idStr, + stDebug("s-task:%s (vgId:%d level:%d) recv retrieve req from task:0x%x(vgId:%d),QID:0x%" PRIx64, pTask->id.idStr, pTask->pMeta->vgId, pTask->info.taskLevel, pReq->srcTaskId, pReq->srcNodeId, pReq->reqId); pData->type = STREAM_INPUT__DATA_RETRIEVE; diff --git a/source/libs/stream/src/streamTaskSm.c b/source/libs/stream/src/streamTaskSm.c index 46fb7a521d..968a737ec7 100644 --- a/source/libs/stream/src/streamTaskSm.c +++ b/source/libs/stream/src/streamTaskSm.c @@ -191,10 +191,9 @@ static int32_t doHandleWaitingEvent(SStreamTaskSM* pSM, const char* pEventName, GET_EVT_NAME(pEvtInfo->event), pSM->current.name); // remove it - (void) taosArrayPop(pSM->pWaitingEventList); + void* px = taosArrayPop(pSM->pWaitingEventList); STaskStateTrans* pNextTrans = streamTaskFindTransform(pSM->current.state, pEvtInfo->event); - ASSERT(pSM->pActiveTrans == NULL && pNextTrans != NULL); pSM->pActiveTrans = pNextTrans; pSM->startTs = taosGetTimestampMs(); @@ -413,7 +412,8 @@ int32_t streamTaskHandleEvent(SStreamTaskSM* pSM, EStreamTaskEvent event) { // no active event trans exists, handle this event directly pTrans = streamTaskFindTransform(pSM->current.state, event); if (pTrans == NULL) { - stDebug("s-task:%s failed to handle event:%s", pTask->id.idStr, GET_EVT_NAME(event)); + stDebug("s-task:%s failed to handle event:%s, status:%s", pTask->id.idStr, GET_EVT_NAME(event), + pSM->current.name); streamMutexUnlock(&pTask->lock); return TSDB_CODE_STREAM_INVALID_STATETRANS; } @@ -423,7 +423,7 @@ int32_t streamTaskHandleEvent(SStreamTaskSM* pSM, EStreamTaskEvent event) { if (event == TASK_EVENT_INIT && pSM->pActiveTrans->event == TASK_EVENT_INIT) { streamMutexUnlock(&pTask->lock); stError("s-task:%s already in handling init procedure, handle this init event failed", pTask->id.idStr); - return TSDB_CODE_STREAM_INVALID_STATETRANS; + return TSDB_CODE_STREAM_CONFLICT_EVENT; } // currently in some state transfer procedure, not auto invoke transfer, abort it diff --git a/source/libs/stream/src/streamUpdate.c b/source/libs/stream/src/streamUpdate.c index 8e32822fb7..3f7210d3c9 100644 --- a/source/libs/stream/src/streamUpdate.c +++ b/source/libs/stream/src/streamUpdate.c @@ -455,7 +455,7 @@ int32_t updateInfoSerialize(void* buf, int32_t bufLen, const SUpdateInfo* pInfo, SEncoder encoder = {0}; tEncoderInit(&encoder, buf, bufLen); - if (tStartEncode(&encoder) < 0) { + if (tStartEncode(&encoder) != 0) { code = TSDB_CODE_FAILED; QUERY_CHECK_CODE(code, lino, _end); } @@ -551,10 +551,10 @@ int32_t updateInfoSerialize(void* buf, int32_t bufLen, const SUpdateInfo* pInfo, tEndEncode(&encoder); int32_t tlen = encoder.pos; - tEncoderClear(&encoder); *pLen = tlen; _end: + tEncoderClear(&encoder); if (code != TSDB_CODE_SUCCESS) { uError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); } diff --git a/source/libs/sync/inc/syncUtil.h b/source/libs/sync/inc/syncUtil.h index f0bf095935..1606f47592 100644 --- a/source/libs/sync/inc/syncUtil.h +++ b/source/libs/sync/inc/syncUtil.h @@ -113,7 +113,8 @@ void syncLogRecvSyncSnapshotRsp(SSyncNode* pSyncNode, const SyncSnapshotRsp* pMs void syncLogRecvAppendEntries(SSyncNode* pSyncNode, const SyncAppendEntries* pMsg, const char* s); void syncLogSendAppendEntries(SSyncNode* pSyncNode, const SyncAppendEntries* pMsg, const char* s); -void syncLogRecvRequestVote(SSyncNode* pSyncNode, const SyncRequestVote* pMsg, int32_t voteGranted, const char* s); +void syncLogRecvRequestVote(SSyncNode* pSyncNode, const SyncRequestVote* pMsg, int32_t voteGranted, const char* s, + const char* opt); void syncLogSendRequestVote(SSyncNode* pSyncNode, const SyncRequestVote* pMsg, const char* s); void syncLogRecvRequestVoteReply(SSyncNode* pSyncNode, const SyncRequestVoteReply* pMsg, const char* s); diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index e9d27c3c17..a0236c38b8 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -61,6 +61,7 @@ static int32_t syncDoLeaderTransfer(SSyncNode* ths, SRpcMsg* pRpcMsg, SSyncRaftE static ESyncStrategy syncNodeStrategy(SSyncNode* pSyncNode); int64_t syncOpen(SSyncInfo* pSyncInfo, int32_t vnodeVersion) { + sInfo("vgId:%d, start to open sync", pSyncInfo->vgId); SSyncNode* pSyncNode = syncNodeOpen(pSyncInfo, vnodeVersion); if (pSyncNode == NULL) { sError("vgId:%d, failed to open sync node", pSyncInfo->vgId); @@ -79,6 +80,7 @@ int64_t syncOpen(SSyncInfo* pSyncInfo, int32_t vnodeVersion) { pSyncNode->hbBaseLine = pSyncInfo->heartbeatMs; pSyncNode->heartbeatTimerMS = pSyncInfo->heartbeatMs; pSyncNode->msgcb = pSyncInfo->msgcb; + sInfo("vgId:%d, sync opened", pSyncInfo->vgId); return pSyncNode->rid; } @@ -91,6 +93,7 @@ int32_t syncStart(int64_t rid) { sError("failed to acquire rid:%" PRId64 " of tsNodeReftId for pSyncNode", rid); TAOS_RETURN(code); } + sInfo("vgId:%d, begin to start sync", pSyncNode->vgId); if ((code = syncNodeRestore(pSyncNode)) < 0) { sError("vgId:%d, failed to restore sync log buffer since %s", pSyncNode->vgId, tstrerror(code)); @@ -103,6 +106,9 @@ int32_t syncStart(int64_t rid) { } syncNodeRelease(pSyncNode); + + sInfo("vgId:%d, sync started", pSyncNode->vgId); + TAOS_RETURN(code); _err: @@ -1370,7 +1376,7 @@ SSyncNode* syncNodeOpen(SSyncInfo* pSyncInfo, int32_t vnodeVersion) { pSyncNode->hbrSlowNum = 0; pSyncNode->tmrRoutineNum = 0; - sNInfo(pSyncNode, "sync open, node:%p electInterval:%d heartbeatInterval:%d heartbeatTimeout:%d", pSyncNode, + sNInfo(pSyncNode, "sync node opened, node:%p electInterval:%d heartbeatInterval:%d heartbeatTimeout:%d", pSyncNode, tsElectInterval, tsHeartbeatInterval, tsHeartbeatTimeout); return pSyncNode; @@ -1434,6 +1440,7 @@ int32_t syncNodeRestore(SSyncNode* pSyncNode) { int32_t syncNodeStart(SSyncNode* pSyncNode) { // start raft + sInfo("vgId:%d, begin to start sync node", pSyncNode->vgId); if (pSyncNode->raftCfg.cfg.nodeInfo[pSyncNode->raftCfg.cfg.myIndex].nodeRole == TAOS_SYNC_ROLE_LEARNER) { syncNodeBecomeLearner(pSyncNode, "first start"); } else { @@ -1453,6 +1460,7 @@ int32_t syncNodeStart(SSyncNode* pSyncNode) { if (ret != 0) { sError("vgId:%d, failed to start ping timer since %s", pSyncNode->vgId, tstrerror(ret)); } + sInfo("vgId:%d, sync node started", pSyncNode->vgId); return ret; } @@ -2034,6 +2042,8 @@ void syncNodeBecomeFollower(SSyncNode* pSyncNode, const char* debugStr) { // reset elect timer syncNodeResetElectTimer(pSyncNode); + + sInfo("vgId:%d, become follower. %s", pSyncNode->vgId, debugStr); } void syncNodeBecomeLearner(SSyncNode* pSyncNode, const char* debugStr) { @@ -3266,6 +3276,7 @@ int32_t syncNodeAppend(SSyncNode* ths, SSyncRaftEntry* pEntry) { sError("vgId:%d, cannot append an invalid client request with no msg head. type:%s, dataLen:%d", ths->vgId, TMSG_INFO(pEntry->originalRpcType), pEntry->dataLen); syncEntryDestroy(pEntry); + pEntry = NULL; goto _out; } @@ -3274,6 +3285,7 @@ int32_t syncNodeAppend(SSyncNode* ths, SSyncRaftEntry* pEntry) { sError("vgId:%d, failed to enqueue sync log buffer, index:%" PRId64, ths->vgId, pEntry->index); (void)syncFsmExecute(ths, ths->pFsm, ths->state, raftStoreGetTerm(ths), pEntry, terrno, false); syncEntryDestroy(pEntry); + pEntry = NULL; goto _out; } @@ -3282,7 +3294,8 @@ _out:; // proceed match index, with replicating on needed SyncIndex matchIndex = syncLogBufferProceed(ths->pLogBuf, ths, NULL, "Append"); - sTrace("vgId:%d, append raft entry. index:%" PRId64 ", term:%" PRId64 " pBuf: [%" PRId64 " %" PRId64 " %" PRId64 + if(pEntry != NULL) + sTrace("vgId:%d, append raft entry. index:%" PRId64 ", term:%" PRId64 " pBuf: [%" PRId64 " %" PRId64 " %" PRId64 ", %" PRId64 ")", ths->vgId, pEntry->index, pEntry->term, ths->pLogBuf->startIndex, ths->pLogBuf->commitIndex, ths->pLogBuf->matchIndex, ths->pLogBuf->endIndex); diff --git a/source/libs/sync/src/syncRequestVote.c b/source/libs/sync/src/syncRequestVote.c index 738e558033..c8e81b13df 100644 --- a/source/libs/sync/src/syncRequestVote.c +++ b/source/libs/sync/src/syncRequestVote.c @@ -91,9 +91,11 @@ int32_t syncNodeOnRequestVote(SSyncNode* ths, const SRpcMsg* pRpcMsg) { SyncRequestVote* pMsg = pRpcMsg->pCont; bool resetElect = false; + syncLogRecvRequestVote(ths, pMsg, -1, "", "recv"); + // if already drop replica, do not process if (!syncNodeInRaftGroup(ths, &pMsg->srcId)) { - syncLogRecvRequestVote(ths, pMsg, -1, "not in my config"); + syncLogRecvRequestVote(ths, pMsg, -1, "not in my config", "process"); TAOS_RETURN(TSDB_CODE_SYN_MISMATCHED_SIGNATURE); } @@ -133,7 +135,7 @@ int32_t syncNodeOnRequestVote(SSyncNode* ths, const SRpcMsg* pRpcMsg) { if (!(!grant || pMsg->term == pReply->term)) return TSDB_CODE_SYN_INTERNAL_ERROR; // trace log - syncLogRecvRequestVote(ths, pMsg, pReply->voteGranted, ""); + syncLogRecvRequestVote(ths, pMsg, pReply->voteGranted, "", "proceed"); syncLogSendRequestVoteReply(ths, pReply, ""); (void)syncNodeSendMsgById(&pReply->destId, ths, &rpcMsg); diff --git a/source/libs/sync/src/syncRequestVoteReply.c b/source/libs/sync/src/syncRequestVoteReply.c index add237c2d0..9f2d746755 100644 --- a/source/libs/sync/src/syncRequestVoteReply.c +++ b/source/libs/sync/src/syncRequestVoteReply.c @@ -53,14 +53,14 @@ int32_t syncNodeOnRequestVoteReply(SSyncNode* ths, const SRpcMsg* pRpcMsg) { if (pMsg->term < currentTerm) { syncLogRecvRequestVoteReply(ths, pMsg, "drop stale response"); - TAOS_RETURN(TSDB_CODE_FAILED); + TAOS_RETURN(TSDB_CODE_SYN_WRONG_TERM); } if (pMsg->term > currentTerm) { syncLogRecvRequestVoteReply(ths, pMsg, "error term"); syncNodeStepDown(ths, pMsg->term); - TAOS_RETURN(TSDB_CODE_FAILED); + TAOS_RETURN(TSDB_CODE_SYN_WRONG_TERM); } syncLogRecvRequestVoteReply(ths, pMsg, ""); @@ -73,7 +73,7 @@ int32_t syncNodeOnRequestVoteReply(SSyncNode* ths, const SRpcMsg* pRpcMsg) { sNError(ths, "vote respond error vote-respond-mgr term:%" PRIu64 ", msg term:%" PRIu64 "", ths->pVotesRespond->term, pMsg->term); - TAOS_RETURN(TSDB_CODE_FAILED); + TAOS_RETURN(TSDB_CODE_SYN_WRONG_TERM); } votesRespondAdd(ths->pVotesRespond, pMsg); diff --git a/source/libs/sync/src/syncUtil.c b/source/libs/sync/src/syncUtil.c index a30bd9064f..553560f089 100644 --- a/source/libs/sync/src/syncUtil.c +++ b/source/libs/sync/src/syncUtil.c @@ -470,13 +470,13 @@ void syncLogSendAppendEntries(SSyncNode* pSyncNode, const SyncAppendEntries* pMs pMsg->commitIndex, pMsg->dataLen, s); } -void syncLogRecvRequestVote(SSyncNode* pSyncNode, const SyncRequestVote* pMsg, int32_t voteGranted, - const char* errmsg) { +void syncLogRecvRequestVote(SSyncNode* pSyncNode, const SyncRequestVote* pMsg, int32_t voteGranted, const char* errmsg, + const char* opt) { 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, + "%s sync-request-vote from dnode:%d, {term:%" PRId64 ", last-index:%" PRId64 ", last-term:%" PRId64 "}, %s", + opt, DID(&pMsg->srcId), pMsg->term, pMsg->lastLogIndex, pMsg->lastLogTerm, (voteGranted != -1) ? statusMsg : errmsg); } diff --git a/source/libs/transport/inc/transLog.h b/source/libs/transport/inc/transLog.h index 278356b42e..ec71bbefae 100644 --- a/source/libs/transport/inc/transLog.h +++ b/source/libs/transport/inc/transLog.h @@ -32,12 +32,12 @@ extern "C" { #define tTrace(...) { if (rpcDebugFlag & DEBUG_TRACE) { taosPrintLog("RPC ", DEBUG_TRACE, rpcDebugFlag, __VA_ARGS__); }} #define tDump(x, y) { if (rpcDebugFlag & DEBUG_DUMP) { taosDumpData((unsigned char *)x, y); } } -#define tGTrace(param, ...) do { if (rpcDebugFlag & DEBUG_TRACE){char buf[40] = {0}; TRACE_TO_STR(trace, buf); tTrace(param ", qid:%s", __VA_ARGS__, buf);}} while(0) -#define tGFatal(param, ...) do {if (rpcDebugFlag & DEBUG_FATAL){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); tFatal(param ", qid:%s", __VA_ARGS__, buf); }} while (0) -#define tGError(param, ...) do { if (rpcDebugFlag & DEBUG_ERROR){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); tError(param ", qid:%s", __VA_ARGS__, buf);} } while(0) -#define tGWarn(param, ...) do { if (rpcDebugFlag & DEBUG_WARN) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); tWarn(param ", qid:%s", __VA_ARGS__, buf); }} while(0) -#define tGInfo(param, ...) do { if (rpcDebugFlag & DEBUG_INFO) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); tInfo(param ", qid:%s", __VA_ARGS__, buf); }} while(0) -#define tGDebug(param,...) do {if (rpcDebugFlag & DEBUG_DEBUG){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); tDebug(param ", qid:%s", __VA_ARGS__, buf); }} while(0) +#define tGTrace(param, ...) do { if (rpcDebugFlag & DEBUG_TRACE){char buf[40] = {0}; TRACE_TO_STR(trace, buf); tTrace(param ",QID:%s", __VA_ARGS__, buf);}} while(0) +#define tGFatal(param, ...) do {if (rpcDebugFlag & DEBUG_FATAL){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); tFatal(param ",QID:%s", __VA_ARGS__, buf); }} while (0) +#define tGError(param, ...) do { if (rpcDebugFlag & DEBUG_ERROR){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); tError(param ",QID:%s", __VA_ARGS__, buf);} } while(0) +#define tGWarn(param, ...) do { if (rpcDebugFlag & DEBUG_WARN) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); tWarn(param ",QID:%s", __VA_ARGS__, buf); }} while(0) +#define tGInfo(param, ...) do { if (rpcDebugFlag & DEBUG_INFO) { char buf[40] = {0}; TRACE_TO_STR(trace, buf); tInfo(param ",QID:%s", __VA_ARGS__, buf); }} while(0) +#define tGDebug(param,...) do {if (rpcDebugFlag & DEBUG_DEBUG){ char buf[40] = {0}; TRACE_TO_STR(trace, buf); tDebug(param ",QID:%s", __VA_ARGS__, buf); }} while(0) // clang-format on diff --git a/source/libs/transport/src/thttp.c b/source/libs/transport/src/thttp.c index 6096f69ca2..d19877dbf1 100644 --- a/source/libs/transport/src/thttp.c +++ b/source/libs/transport/src/thttp.c @@ -507,6 +507,7 @@ static bool httpFailFastShoudIgnoreMsg(SHashObj* pTable, char* server, int16_t p } } static void httpFailFastMayUpdate(SHashObj* pTable, char* server, int16_t port, int8_t succ) { + int32_t code = 0; char buf[256] = {0}; sprintf(buf, "%s:%d", server, port); @@ -514,7 +515,9 @@ static void httpFailFastMayUpdate(SHashObj* pTable, char* server, int16_t port, (void)taosHashRemove(pTable, buf, strlen(buf)); } else { int32_t st = taosGetTimestampSec(); - (void)taosHashPut(pTable, buf, strlen(buf), &st, sizeof(st)); + if ((code = taosHashPut(pTable, buf, strlen(buf), &st, sizeof(st))) != 0) { + tError("http-report failed to update conn status, dst:%s, reason:%s", buf, tstrerror(code)); + } } return; } diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index b87108bf52..dfa9595eb0 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -253,20 +253,20 @@ static void cliWalkCb(uv_handle_t* handle, void* arg); #define CONN_PERSIST_TIME(para) ((para) <= 90000 ? 90000 : (para)) #define CONN_GET_INST_LABEL(conn) (((STrans*)(((SCliThrd*)(conn)->hostThrd)->pTransInst))->label) -#define CONN_GET_MSGCTX_BY_AHANDLE(conn, ahandle) \ - do { \ - int i = 0, sz = transQueueSize(&conn->cliMsgs); \ - for (; i < sz; i++) { \ - pMsg = transQueueGet(&conn->cliMsgs, i); \ - if (pMsg->ctx != NULL && (uint64_t)pMsg->ctx->ahandle == ahandle) { \ - break; \ - } \ - } \ - if (i == sz) { \ - pMsg = NULL; \ - } else { \ - pMsg = transQueueRm(&conn->cliMsgs, i); \ - } \ +#define CONN_GET_MSGCTX_BY_AHANDLE(conn, ahandle) \ + do { \ + int i = 0, sz = transQueueSize(&conn->cliMsgs); \ + for (; i < sz; i++) { \ + pMsg = transQueueGet(&conn->cliMsgs, i); \ + if (pMsg->msg.msgType != TDMT_SCH_DROP_TASK && pMsg->ctx != NULL && (uint64_t)pMsg->ctx->ahandle == ahandle) { \ + break; \ + } \ + } \ + if (i == sz) { \ + pMsg = NULL; \ + } else { \ + pMsg = transQueueRm(&conn->cliMsgs, i); \ + } \ } while (0) #define CONN_GET_NEXT_SENDMSG(conn) \ @@ -332,6 +332,21 @@ static void cliReleaseUnfinishedMsg(SCliConn* conn) { transQueueClear(&conn->cliMsgs); memset(&conn->ctx, 0, sizeof(conn->ctx)); } +void cliResetTimer(SCliThrd* pThrd, SCliConn* conn) { + if (conn->timer) { + if (uv_is_active((uv_handle_t*)conn->timer)) { + tDebug("%s conn %p stop timer", CONN_GET_INST_LABEL(conn), conn); + (void)uv_timer_stop(conn->timer); + } + if (taosArrayPush(pThrd->timerList, &conn->timer) == NULL) { + tError("failed to push timer %p to list, reason:%s", conn->timer, tstrerror(TSDB_CODE_OUT_OF_MEMORY)); + conn->timer = NULL; + return; + } + conn->timer->data = NULL; + conn->timer = NULL; + } +} bool cliMaySendCachedMsg(SCliConn* conn) { if (!transQueueEmpty(&conn->cliMsgs)) { SCliMsg* pCliMsg = NULL; @@ -376,15 +391,7 @@ void cliHandleResp(SCliConn* conn) { SCliThrd* pThrd = conn->hostThrd; STrans* pTransInst = pThrd->pTransInst; - if (conn->timer) { - if (uv_is_active((uv_handle_t*)conn->timer)) { - tDebug("%s conn %p stop timer", CONN_GET_INST_LABEL(conn), conn); - (void)uv_timer_stop(conn->timer); - } - (void)taosArrayPush(pThrd->timerList, &conn->timer); - conn->timer->data = NULL; - conn->timer = NULL; - } + cliResetTimer(pThrd, conn); STransMsgHead* pHead = NULL; @@ -593,8 +600,8 @@ void cliConnTimeout(uv_timer_t* handle) { (void)uv_timer_stop(handle); handle->data = NULL; - (void)taosArrayPush(pThrd->timerList, &conn->timer); - conn->timer = NULL; + + cliResetTimer(pThrd, conn); cliMayUpdateFqdnCache(pThrd->fqdn2ipCache, conn->dstAddr); cliHandleFastFail(conn, UV_ECANCELED); @@ -643,13 +650,16 @@ void* destroyConnPool(SCliThrd* pThrd) { } static SCliConn* getConnFromPool(SCliThrd* pThrd, char* key, bool* exceed) { + int32_t code = 0; void* pool = pThrd->pool; STrans* pTranInst = pThrd->pTransInst; size_t klen = strlen(key); SConnList* plist = taosHashGet((SHashObj*)pool, key, klen); if (plist == NULL) { SConnList list = {0}; - (void)taosHashPut((SHashObj*)pool, key, klen, (void*)&list, sizeof(list)); + if ((code = taosHashPut((SHashObj*)pool, key, klen, (void*)&list, sizeof(list))) != 0) { + return NULL; + } plist = taosHashGet(pool, key, klen); SMsgList* nList = taosMemoryCalloc(1, sizeof(SMsgList)); @@ -686,13 +696,17 @@ static SCliConn* getConnFromPool(SCliThrd* pThrd, char* key, bool* exceed) { } static SCliConn* getConnFromPool2(SCliThrd* pThrd, char* key, SCliMsg** pMsg) { + int32_t code = 0; void* pool = pThrd->pool; STrans* pTransInst = pThrd->pTransInst; size_t klen = strlen(key); SConnList* plist = taosHashGet((SHashObj*)pool, key, klen); if (plist == NULL) { SConnList list = {0}; - (void)taosHashPut((SHashObj*)pool, key, klen, (void*)&list, sizeof(list)); + if ((code = taosHashPut((SHashObj*)pool, key, klen, (void*)&list, sizeof(list))) != 0) { + tError("failed to put key %s to pool, reason:%s", key, tstrerror(code)); + return NULL; + } plist = taosHashGet(pool, key, klen); SMsgList* nList = taosMemoryCalloc(1, sizeof(SMsgList)); @@ -805,12 +819,8 @@ static void addConnToPool(void* pool, SCliConn* conn) { } SCliThrd* thrd = conn->hostThrd; - if (conn->timer != NULL) { - (void)uv_timer_stop(conn->timer); - (void)taosArrayPush(thrd->timerList, &conn->timer); - conn->timer->data = NULL; - conn->timer = NULL; - } + cliResetTimer(thrd, conn); + if (T_REF_VAL_GET(conn) > 1) { transUnrefCliHandle(conn); } @@ -1053,12 +1063,7 @@ static void cliDestroyConn(SCliConn* conn, bool clear) { transDQCancel(pThrd->timeoutQueue, conn->task); conn->task = NULL; } - if (conn->timer != NULL) { - (void)uv_timer_stop(conn->timer); - conn->timer->data = NULL; - (void)taosArrayPush(pThrd->timerList, &conn->timer); - conn->timer = NULL; - } + cliResetTimer(pThrd, conn); if (clear) { if (!uv_is_closing((uv_handle_t*)conn->stream)) { @@ -1073,12 +1078,7 @@ static void cliDestroy(uv_handle_t* handle) { } SCliConn* conn = handle->data; SCliThrd* pThrd = conn->hostThrd; - if (conn->timer != NULL) { - (void)uv_timer_stop(conn->timer); - (void)taosArrayPush(pThrd->timerList, &conn->timer); - conn->timer->data = NULL; - conn->timer = NULL; - } + cliResetTimer(pThrd, conn); (void)atomic_sub_fetch_32(&pThrd->connCount, 1); @@ -1385,10 +1385,7 @@ static void cliHandleBatchReq(SCliBatch* pBatch, SCliThrd* pThrd) { uint32_t ipaddr = 0; if ((code = cliGetIpFromFqdnCache(pThrd->fqdn2ipCache, pList->ip, &ipaddr)) != 0) { - (void)uv_timer_stop(conn->timer); - conn->timer->data = NULL; - (void)taosArrayPush(pThrd->timerList, &conn->timer); - conn->timer = NULL; + cliResetTimer(pThrd, conn); cliHandleFastFail(conn, code); return; } @@ -1421,10 +1418,7 @@ static void cliHandleBatchReq(SCliBatch* pBatch, SCliThrd* pThrd) { ret = uv_tcp_connect(&conn->connReq, (uv_tcp_t*)(conn->stream), (const struct sockaddr*)&addr, cliConnCb); if (ret != 0) { - (void)uv_timer_stop(conn->timer); - conn->timer->data = NULL; - (void)taosArrayPush(pThrd->timerList, &conn->timer); - conn->timer = NULL; + cliResetTimer(pThrd, conn); cliMayUpdateFqdnCache(pThrd->fqdn2ipCache, conn->dstAddr); cliHandleFastFail(conn, -1); @@ -1502,7 +1496,10 @@ static void cliHandleFastFail(SCliConn* pConn, int status) { } } else { SFailFastItem item = {.count = 1, .timestamp = cTimestamp}; - (void)taosHashPut(pThrd->failFastCache, pConn->dstAddr, strlen(pConn->dstAddr), &item, sizeof(SFailFastItem)); + int32_t code = taosHashPut(pThrd->failFastCache, pConn->dstAddr, strlen(pConn->dstAddr), &item, sizeof(SFailFastItem)); + if (code != 0) { + tError("failed to put fail-fast item to cache, reason:%s", tstrerror(code)); + } } } } else { @@ -1522,10 +1519,7 @@ void cliConnCb(uv_connect_t* req, int status) { if (pConn->timer == NULL) { timeout = true; } else { - (void)uv_timer_stop(pConn->timer); - pConn->timer->data = NULL; - (void)taosArrayPush(pThrd->timerList, &pConn->timer); - pConn->timer = NULL; + cliResetTimer(pThrd, pConn); } STUB_RAND_NETWORK_ERR(status); @@ -1656,6 +1650,9 @@ static void cliHandleFreeById(SCliMsg* pMsg, SCliThrd* pThrd) { // already recv, and notify upper layer TAOS_CHECK_GOTO(TSDB_CODE_REF_INVALID_ID, NULL, _exception); } else { + destroyCmsg(pMsg); + (void)transReleaseExHandle(transGetRefMgt(), refId); + while (T_REF_VAL_GET(conn) >= 1) { transUnrefCliHandle(conn); } @@ -1867,11 +1864,7 @@ void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd) { uint32_t ipaddr; int32_t code = cliGetIpFromFqdnCache(pThrd->fqdn2ipCache, fqdn, &ipaddr); if (code != 0) { - (void)uv_timer_stop(conn->timer); - conn->timer->data = NULL; - (void)taosArrayPush(pThrd->timerList, &conn->timer); - conn->timer = NULL; - + cliResetTimer(pThrd, conn); cliHandleExcept(conn, code); return; } @@ -1907,10 +1900,7 @@ void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd) { ret = uv_tcp_connect(&conn->connReq, (uv_tcp_t*)(conn->stream), (const struct sockaddr*)&addr, cliConnCb); if (ret != 0) { - (void)uv_timer_stop(conn->timer); - conn->timer->data = NULL; - (void)taosArrayPush(pThrd->timerList, &conn->timer); - conn->timer = NULL; + cliResetTimer(pThrd, conn); cliMayUpdateFqdnCache(pThrd->fqdn2ipCache, conn->dstAddr); cliHandleFastFail(conn, ret); @@ -2374,7 +2364,9 @@ static int32_t createThrdObj(void* trans, SCliThrd** ppThrd) { TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _end); } (void)uv_timer_init(pThrd->loop, timer); - (void)taosArrayPush(pThrd->timerList, &timer); + if (taosArrayPush(pThrd->timerList, &timer) == NULL) { + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _end); + } } pThrd->pool = createConnPool(4); diff --git a/source/libs/transport/src/transComm.c b/source/libs/transport/src/transComm.c index a0836eae3d..1758ca65cc 100644 --- a/source/libs/transport/src/transComm.c +++ b/source/libs/transport/src/transComm.c @@ -375,11 +375,10 @@ void transCtxMerge(STransCtx* dst, STransCtx* src) { STransCtxVal* sVal = (STransCtxVal*)iter; key = taosHashGetKey(sVal, &klen); - // STransCtxVal* dVal = taosHashGet(dst->args, key, klen); - // if (dVal) { - // dst->freeFunc(dVal->val); - // } - (void)taosHashPut(dst->args, key, klen, sVal, sizeof(*sVal)); + int32_t code = taosHashPut(dst->args, key, klen, sVal, sizeof(*sVal)); + if (code != 0) { + tError("failed to put val to hash, reason:%s", tstrerror(code)); + } iter = taosHashIterate(src->args, iter); } taosHashCleanup(src->args); @@ -453,7 +452,9 @@ bool transQueuePush(STransQueue* queue, void* arg) { if (queue->q == NULL) { return true; } - (void)taosArrayPush(queue->q, &arg); + if (taosArrayPush(queue->q, &arg) == NULL) { + return false; + } if (taosArrayGetSize(queue->q) > 1) { return false; } diff --git a/source/os/src/osThread.c b/source/os/src/osThread.c index 95ff06e09e..d102a2a332 100644 --- a/source/os/src/osThread.c +++ b/source/os/src/osThread.c @@ -842,3 +842,35 @@ void taosThreadTestCancel(void) { void taosThreadClear(TdThread *thread) { (void)memset(thread, 0, sizeof(TdThread)); } + +#ifdef WINDOWS +bool taosThreadIsMain() { + DWORD curProcessId = GetCurrentProcessId(); + DWORD curThreadId = GetCurrentThreadId(); + DWORD dwThreadId = -1; + + HANDLE hThreadSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0); + if (hThreadSnapshot == INVALID_HANDLE_VALUE) { + return false; + } + + THREADENTRY32 te32; + te32.dwSize = sizeof(THREADENTRY32); + + if (!Thread32First(hThreadSnapshot, &te32)) { + CloseHandle(hThreadSnapshot); + return false; + } + + do { + if (te32.th32OwnerProcessID == curProcessId) { + dwThreadId = te32.th32ThreadID; + break; + } + } while (Thread32Next(hThreadSnapshot, &te32)); + + CloseHandle(hThreadSnapshot); + + return curThreadId == dwThreadId; +} +#endif diff --git a/source/util/src/tcache.c b/source/util/src/tcache.c index c33e0ee501..3b5c46c2b3 100644 --- a/source/util/src/tcache.c +++ b/source/util/src/tcache.c @@ -787,9 +787,6 @@ void taosTrashcanEmpty(SCacheObj *pCacheObj, bool force) { STrashElem *pElem = pCacheObj->pTrash; while (pElem) { - T_REF_VAL_CHECK(pElem->pData); - // A S S E R T(pElem->next != pElem && pElem->prev != pElem); - if (force || (T_REF_VAL_GET(pElem->pData) == 0)) { uDebug("cache:%s, key:%p, %p removed from trashcan. numOfElem in trashcan:%d", pCacheObj->name, pElem->pData->key, pElem->pData->data, pCacheObj->numOfElemsInTrash - 1); diff --git a/source/util/src/tcompare.c b/source/util/src/tcompare.c index 0dee177faf..11997d089c 100644 --- a/source/util/src/tcompare.c +++ b/source/util/src/tcompare.c @@ -1253,6 +1253,9 @@ void regexCacheFree(void *ppUsingRegex) { } int32_t InitRegexCache() { + #ifdef WINDOWS + return 0; + #endif sRegexCache.regexHash = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_ENTRY_LOCK); if (sRegexCache.regexHash == NULL) { uError("failed to create RegexCache"); @@ -1277,6 +1280,9 @@ int32_t InitRegexCache() { } void DestroyRegexCache(){ + #ifdef WINDOWS + return; + #endif int32_t code = 0; uInfo("[regex cache] destory regex cache"); (void)taosTmrStopA(&sRegexCache.timer); @@ -1359,6 +1365,46 @@ void releaseRegComp(UsingRegex **regex){ static threadlocal UsingRegex ** ppUsingRegex; static threadlocal regex_t * pRegex; static threadlocal char *pOldPattern = NULL; + +#ifdef WINDOWS +static threadlocal regex_t gRegex; + +void DestoryThreadLocalRegComp() { + if (NULL != pOldPattern) { + regfree(&gRegex); + taosMemoryFree(pOldPattern); + pOldPattern = NULL; + } +} + +int32_t threadGetRegComp(regex_t **regex, const char *pPattern) { + if (NULL != pOldPattern) { + if (strcmp(pOldPattern, pPattern) == 0) { + *regex = &gRegex; + return 0; + } else { + DestoryThreadLocalRegComp(); + } + } + pOldPattern = taosStrdup(pPattern); + if (NULL == pOldPattern) { + uError("Failed to Malloc when compile regex pattern %s.", pPattern); + return terrno; + } + int32_t cflags = REG_EXTENDED; + int32_t ret = regcomp(&gRegex, pPattern, cflags); + if (ret != 0) { + char msgbuf[256] = {0}; + (void)regerror(ret, &gRegex, msgbuf, tListLen(msgbuf)); + uError("Failed to compile regex pattern %s. reason %s", pPattern, msgbuf); + taosMemoryFree(pOldPattern); + pOldPattern = NULL; + return TSDB_CODE_PAR_REGULAR_EXPRESSION_ERROR; + } + *regex = &gRegex; + return 0; +} +#else void DestoryThreadLocalRegComp() { if (NULL != pOldPattern) { releaseRegComp(ppUsingRegex); @@ -1390,10 +1436,11 @@ int32_t threadGetRegComp(regex_t **regex, const char *pPattern) { return terrno; } ppUsingRegex = ppRegex; - pRegex = &((*ppUsingRegex)->pRegex); + pRegex = &((*ppUsingRegex)->pRegex); *regex = &(*ppRegex)->pRegex; return 0; } +#endif static int32_t doExecRegexMatch(const char *pString, const char *pPattern) { int32_t ret = 0; diff --git a/source/util/src/tconfig.c b/source/util/src/tconfig.c index 6e8ad547e1..c6da1537f5 100644 --- a/source/util/src/tconfig.c +++ b/source/util/src/tconfig.c @@ -385,10 +385,6 @@ int32_t cfgSetItem(SConfig *pCfg, const char *name, const char *value, ECfgSrcTy (void)taosThreadMutexUnlock(&pCfg->lock); } - if (code != 0){ - uError("cfg:%s, type:%s src:%s value:%s failed since %s", pItem->name, cfgDtypeStr(pItem->dtype), - cfgStypeStr(stype), value, tstrerror(code)); - } TAOS_RETURN(code); } @@ -1000,7 +996,7 @@ int32_t cfgLoadFromEnvFile(SConfig *pConfig, const char *envFile) { const char *filepath = ".env"; if (envFile != NULL && strlen(envFile) > 0) { if (!taosCheckExistFile(envFile)) { - uError("failed to load env file:%s", envFile); + (void)printf("failed to load env file:%s\n", envFile); TAOS_RETURN(TSDB_CODE_NOT_FOUND); } filepath = envFile; @@ -1075,7 +1071,7 @@ int32_t cfgLoadFromCfgFile(SConfig *pConfig, const char *filepath) { uInfo("failed to load from cfg file %s since %s, use default parameters", filepath, tstrerror(code)); TAOS_RETURN(TSDB_CODE_SUCCESS); } else { - uError("failed to load from cfg file %s since %s", filepath, tstrerror(code)); + (void)printf("failed to load from cfg file %s since %s\n", filepath, tstrerror(code)); TAOS_RETURN(code); } } @@ -1117,7 +1113,10 @@ int32_t cfgLoadFromCfgFile(SConfig *pConfig, const char *filepath) { } code = cfgSetItem(pConfig, name, newValue, CFG_STYPE_CFG_FILE, true); - if (TSDB_CODE_SUCCESS != code && TSDB_CODE_CFG_NOT_FOUND != code) break; + if (TSDB_CODE_SUCCESS != code && TSDB_CODE_CFG_NOT_FOUND != code) { + (void)printf("cfg:%s, value:%s failed since %s\n", name,newValue, tstrerror(code)); + break; + } } else { (void)paGetToken(value + vlen + 1, &value2, &vlen2); if (vlen2 != 0) { @@ -1131,7 +1130,10 @@ int32_t cfgLoadFromCfgFile(SConfig *pConfig, const char *filepath) { } code = cfgSetItem(pConfig, name, value, CFG_STYPE_CFG_FILE, true); - if (TSDB_CODE_SUCCESS != code && TSDB_CODE_CFG_NOT_FOUND != code) break; + if (TSDB_CODE_SUCCESS != code && TSDB_CODE_CFG_NOT_FOUND != code) { + (void)printf("cfg:%s, value:%s failed since %s\n", name, value, tstrerror(code)); + break; + } } if (strcasecmp(name, "dataDir") == 0) { @@ -1154,7 +1156,7 @@ int32_t cfgLoadFromCfgFile(SConfig *pConfig, const char *filepath) { uInfo("load from cfg file %s success", filepath); TAOS_RETURN(TSDB_CODE_SUCCESS); } else { - uError("failed to load from cfg file %s since %s", filepath, tstrerror(code)); + (void)printf("failed to load from cfg file %s since %s\n", filepath, tstrerror(code)); TAOS_RETURN(code); } } @@ -1236,7 +1238,7 @@ int32_t cfgLoadFromApollUrl(SConfig *pConfig, const char *url) { char *p = strchr(url, ':'); if (p == NULL) { - uError("fail to load apoll url: %s, unknown format", url); + (void)printf("fail to load apoll url: %s, unknown format\n", url); TAOS_RETURN(TSDB_CODE_INVALID_PARA); } p++; @@ -1244,7 +1246,7 @@ int32_t cfgLoadFromApollUrl(SConfig *pConfig, const char *url) { if (strncmp(url, "jsonFile", 8) == 0) { char *filepath = p; if (!taosCheckExistFile(filepath)) { - uError("failed to load json file:%s", filepath); + (void)printf("failed to load json file:%s\n", filepath); TAOS_RETURN(TSDB_CODE_NOT_FOUND); } @@ -1256,7 +1258,7 @@ int32_t cfgLoadFromApollUrl(SConfig *pConfig, const char *url) { char *buf = taosMemoryMalloc(fileSize + 1); if (!buf) { (void)taosCloseFile(&pFile); - uError("load json file error: %s, failed to alloc memory", filepath); + (void)printf("load json file error: %s, failed to alloc memory\n", filepath); TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY); } @@ -1264,7 +1266,7 @@ int32_t cfgLoadFromApollUrl(SConfig *pConfig, const char *url) { (void)taosLSeekFile(pFile, 0, SEEK_SET); if (taosReadFile(pFile, buf, fileSize) <= 0) { (void)taosCloseFile(&pFile); - uError("load json file error: %s", filepath); + (void)printf("load json file error: %s\n", filepath); taosMemoryFreeClear(buf); TAOS_RETURN(TSDB_CODE_INVALID_DATA_FMT); } @@ -1273,7 +1275,7 @@ int32_t cfgLoadFromApollUrl(SConfig *pConfig, const char *url) { if (NULL == pJson) { const char *jsonParseError = tjsonGetError(); if (jsonParseError != NULL) { - uError("load json file parse error: %s", jsonParseError); + (void)printf("load json file parse error: %s\n", jsonParseError); } taosMemoryFreeClear(buf); TAOS_CHECK_EXIT(TSDB_CODE_INVALID_DATA_FMT); @@ -1341,7 +1343,7 @@ int32_t cfgLoadFromApollUrl(SConfig *pConfig, const char *url) { // } else if (strncmp(url, "jsonUrl", 7) == 0) { // } else if (strncmp(url, "etcdUrl", 7) == 0) { } else { - uError("Unsupported url: %s", url); + (void)printf("Unsupported url: %s\n", url); TAOS_RETURN(TSDB_CODE_INVALID_PARA); } @@ -1353,7 +1355,7 @@ _exit: taosMemoryFree(cfgLineBuf); tjsonDelete(pJson); if (code != 0) { - uError("failed to load from apollo url:%s at line %d since %s", url, lino, tstrerror(code)); + (void)printf("failed to load from apollo url:%s at line %d since %s\n", url, lino, tstrerror(code)); } TAOS_RETURN(code); } diff --git a/source/util/src/terror.c b/source/util/src/terror.c index 6701842ec9..58dde5cd23 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -812,7 +812,8 @@ TAOS_DEFINE_ERROR(TSDB_CODE_STREAM_TASK_NOT_EXIST, "Stream task not exi TAOS_DEFINE_ERROR(TSDB_CODE_STREAM_EXEC_CANCELLED, "Stream task exec cancelled") TAOS_DEFINE_ERROR(TSDB_CODE_STREAM_INVALID_STATETRANS, "Invalid task state to handle event") TAOS_DEFINE_ERROR(TSDB_CODE_STREAM_TASK_IVLD_STATUS, "Invalid task status to proceed") -TAOS_DEFINE_ERROR(TSDB_CODE_STREAM_INTERNAL_ERROR, "Stream internal error") +TAOS_DEFINE_ERROR(TSDB_CODE_STREAM_CONFLICT_EVENT, "Stream conflict event") +TAOS_DEFINE_ERROR(TSDB_CODE_STREAM_INTERNAL_ERROR, "Stream internal error") TAOS_DEFINE_ERROR(TSDB_CODE_STREAM_NOT_LEADER, "Stream task not on leader vnode") // TDLite diff --git a/source/util/src/tgeosctx.c b/source/util/src/tgeosctx.c index a05734c911..ddd04b1e88 100644 --- a/source/util/src/tgeosctx.c +++ b/source/util/src/tgeosctx.c @@ -14,39 +14,102 @@ */ #include "tgeosctx.h" -#include "tdef.h" +#include "tlog.h" +#include "tutil.h" -static threadlocal SGeosContext tlGeosCtx = {0}; +static TdThreadKey tlGeosCtxKey = 0; +static int8_t tlGeosCtxKeyInited = 0; -SGeosContext* getThreadLocalGeosCtx() { return &tlGeosCtx; } +static threadlocal SGeosContext *tlGeosCtx = NULL; -void destroyThreadLocalGeosCtx() { - if (tlGeosCtx.WKTReader) { - GEOSWKTReader_destroy_r(tlGeosCtx.handle, tlGeosCtx.WKTReader); - tlGeosCtx.WKTReader = NULL; +static void destroyThreadLocalGeosCtx(void *param) { +#ifdef WINDOWS + if (taosThreadIsMain()) return; +#endif + + SGeosContext *pGeosCtx = (SGeosContext *)param; + if (!pGeosCtx) { + return; + } + if (pGeosCtx->WKTReader) { + GEOSWKTReader_destroy_r(pGeosCtx->handle, pGeosCtx->WKTReader); + pGeosCtx->WKTReader = NULL; } - if (tlGeosCtx.WKTWriter) { - GEOSWKTWriter_destroy_r(tlGeosCtx.handle, tlGeosCtx.WKTWriter); - tlGeosCtx.WKTWriter = NULL; + if (pGeosCtx->WKTWriter) { + GEOSWKTWriter_destroy_r(pGeosCtx->handle, pGeosCtx->WKTWriter); + pGeosCtx->WKTWriter = NULL; } - if (tlGeosCtx.WKBReader) { - GEOSWKBReader_destroy_r(tlGeosCtx.handle, tlGeosCtx.WKBReader); - tlGeosCtx.WKBReader = NULL; + if (pGeosCtx->WKBReader) { + GEOSWKBReader_destroy_r(pGeosCtx->handle, pGeosCtx->WKBReader); + pGeosCtx->WKBReader = NULL; } - if (tlGeosCtx.WKBWriter) { - GEOSWKBWriter_destroy_r(tlGeosCtx.handle, tlGeosCtx.WKBWriter); - tlGeosCtx.WKBWriter = NULL; + if (pGeosCtx->WKBWriter) { + GEOSWKBWriter_destroy_r(pGeosCtx->handle, pGeosCtx->WKBWriter); + pGeosCtx->WKBWriter = NULL; } - if (tlGeosCtx.WKTRegex) { - destroyRegexes(tlGeosCtx.WKTRegex, tlGeosCtx.WKTMatchData); + if (pGeosCtx->WKTRegex) { + destroyRegexes(pGeosCtx->WKTRegex, pGeosCtx->WKTMatchData); + pGeosCtx->WKTRegex = NULL; + pGeosCtx->WKTMatchData = NULL; } - if (tlGeosCtx.handle) { - GEOS_finish_r(tlGeosCtx.handle); - tlGeosCtx.handle = NULL; + if (pGeosCtx->handle) { + GEOS_finish_r(pGeosCtx->handle); + pGeosCtx->handle = NULL; } + taosMemoryFree(pGeosCtx); +} + +SGeosContext *acquireThreadLocalGeosCtx() { return tlGeosCtx; } + +int32_t getThreadLocalGeosCtx(SGeosContext **ppCtx) { + if ((*ppCtx = tlGeosCtx)) { + return 0; + } + + int32_t code = 0, lino = 0; + + int8_t old; + int32_t nLoops = 0; + while (1) { + old = atomic_val_compare_exchange_8(&tlGeosCtxKeyInited, 0, 2); + if (old != 2) break; + if (++nLoops > 1000) { + (void)sched_yield(); + nLoops = 0; + } + } + if (old == 0) { + if ((taosThreadKeyCreate(&tlGeosCtxKey, destroyThreadLocalGeosCtx)) != 0) { + atomic_store_8(&tlGeosCtxKeyInited, 0); + TAOS_CHECK_EXIT(TAOS_SYSTEM_ERROR(errno)); + } + atomic_store_8(&tlGeosCtxKeyInited, 1); + } + + SGeosContext *tlGeosCtxObj = (SGeosContext *)taosMemoryCalloc(1, sizeof(SGeosContext)); + if (!tlGeosCtxObj) { + TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY); + } + if ((taosThreadSetSpecific(tlGeosCtxKey, (const void *)tlGeosCtxObj)) != 0) { + taosMemoryFreeClear(tlGeosCtxObj); + TAOS_CHECK_EXIT(TAOS_SYSTEM_ERROR(errno)); + } + + *ppCtx = tlGeosCtx = tlGeosCtxObj; + +_exit: + if (code != 0) { + *ppCtx = NULL; + uError("failed to get geos context at line:%d since %s", lino, tstrerror(code)); + } + TAOS_RETURN(code); +} + +const char *getGeosErrMsg(int32_t code) { + return (tlGeosCtx && tlGeosCtx->errMsg[0] != 0) ? tlGeosCtx->errMsg : (code ? tstrerror(code) : ""); } diff --git a/source/util/src/thash.c b/source/util/src/thash.c index aac66348e7..7780be3fb7 100644 --- a/source/util/src/thash.c +++ b/source/util/src/thash.c @@ -285,6 +285,7 @@ SHashObj *taosHashInit(size_t capacity, _hash_fn_t fn, bool update, SHashLockTyp } if (taosArrayPush(pHashObj->pMemBlock, &p) == NULL) { + taosMemoryFree(p); taosArrayDestroy(pHashObj->pMemBlock); taosMemoryFree(pHashObj->hashList); taosMemoryFree(pHashObj); diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c index 3c41e00b7a..49e1d87d80 100644 --- a/source/util/src/tlog.c +++ b/source/util/src/tlog.c @@ -206,7 +206,7 @@ int32_t taosInitSlowLog() { (void)taosUmaskFile(0); tsLogObj.slowHandle->pFile = taosOpenFile(name, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_APPEND); if (tsLogObj.slowHandle->pFile == NULL) { - printf("\nfailed to open slow log file:%s, reason:%s\n", name, strerror(errno)); + (void)printf("\nfailed to open slow log file:%s, reason:%s\n", name, strerror(errno)); return TAOS_SYSTEM_ERROR(errno); } @@ -529,7 +529,7 @@ static int32_t taosInitNormalLog(const char *logName, int32_t maxFileNum) { processLogFileName(logName, maxFileNum); char name[PATH_MAX + 50] = "\0"; - sprintf(name, "%s.%d", tsLogObj.logName, tsLogObj.flag); + (void)sprintf(name, "%s.%d", tsLogObj.logName, tsLogObj.flag); (void)taosThreadMutexInit(&tsLogObj.logMutex, NULL); (void)taosUmaskFile(0); @@ -538,7 +538,7 @@ static int32_t taosInitNormalLog(const char *logName, int32_t maxFileNum) { tsLogObj.logHandle->pFile = taosOpenFile(name, TD_FILE_CREATE | TD_FILE_WRITE); if (tsLogObj.logHandle->pFile == NULL) { - printf("\nfailed to open log file:%s, reason:%s\n", name, strerror(errno)); + (void)printf("\nfailed to open log file:%s, reason:%s\n", name, strerror(errno)); return TAOS_SYSTEM_ERROR(errno); } (void)taosLockLogFile(tsLogObj.logHandle->pFile); @@ -546,18 +546,18 @@ static int32_t taosInitNormalLog(const char *logName, int32_t maxFileNum) { // only an estimate for number of lines int64_t filesize = 0; if (taosFStatFile(tsLogObj.logHandle->pFile, &filesize, NULL) < 0) { - printf("\nfailed to fstat log file:%s, reason:%s\n", name, strerror(errno)); + (void)printf("\nfailed to fstat log file:%s, reason:%s\n", name, strerror(errno)); return TAOS_SYSTEM_ERROR(errno); } tsLogObj.lines = (int32_t)(filesize / 60); (void)taosLSeekFile(tsLogObj.logHandle->pFile, 0, SEEK_END); - sprintf(name, "==================================================\n"); + (void)sprintf(name, "==================================================\n"); (void)taosWriteFile(tsLogObj.logHandle->pFile, name, (uint32_t)strlen(name)); - sprintf(name, " new log file \n"); + (void)sprintf(name, " new log file \n"); (void)taosWriteFile(tsLogObj.logHandle->pFile, name, (uint32_t)strlen(name)); - sprintf(name, "==================================================\n"); + (void)sprintf(name, "==================================================\n"); (void)taosWriteFile(tsLogObj.logHandle->pFile, name, (uint32_t)strlen(name)); return 0; diff --git a/source/util/src/tlrucache.c b/source/util/src/tlrucache.c index 33e0076c6e..7faff88155 100644 --- a/source/util/src/tlrucache.c +++ b/source/util/src/tlrucache.c @@ -374,6 +374,7 @@ static LRUStatus taosLRUCacheShardInsertEntry(SLRUCacheShard *shard, SLRUEntry * LRUStatus status = TAOS_LRU_STATUS_OK; SArray *lastReferenceList = taosArrayInit(16, POINTER_BYTES); if (!lastReferenceList) { + taosLRUEntryFree(e); return TAOS_LRU_STATUS_FAIL; } @@ -385,13 +386,12 @@ static LRUStatus taosLRUCacheShardInsertEntry(SLRUCacheShard *shard, SLRUEntry * TAOS_LRU_ENTRY_SET_IN_CACHE(e, false); if (handle == NULL) { if (!taosArrayPush(lastReferenceList, &e)) { - (void)taosThreadMutexUnlock(&shard->mutex); taosLRUEntryFree(e); - return status; + goto _exit; } } else { if (freeOnFail) { - taosMemoryFree(e); + taosLRUEntryFree(e); *handle = NULL; } @@ -410,9 +410,9 @@ static LRUStatus taosLRUCacheShardInsertEntry(SLRUCacheShard *shard, SLRUEntry * shard->usage -= old->totalCharge; if (!taosArrayPush(lastReferenceList, &old)) { - (void)taosThreadMutexUnlock(&shard->mutex); + taosLRUEntryFree(e); taosLRUEntryFree(old); - return status; + goto _exit; } } } @@ -427,6 +427,7 @@ static LRUStatus taosLRUCacheShardInsertEntry(SLRUCacheShard *shard, SLRUEntry * } } +_exit: (void)taosThreadMutexUnlock(&shard->mutex); for (int i = 0; i < taosArrayGetSize(lastReferenceList); ++i) { @@ -444,6 +445,9 @@ static LRUStatus taosLRUCacheShardInsert(SLRUCacheShard *shard, const void *key, LRUPriority priority, void *ud) { SLRUEntry *e = taosMemoryCalloc(1, sizeof(SLRUEntry) - 1 + keyLen); if (!e) { + if (deleter) { + (*deleter)(key, keyLen, value, ud); + } return TAOS_LRU_STATUS_FAIL; } diff --git a/source/util/src/tref.c b/source/util/src/tref.c index 4b1b477e06..0eac7b4427 100644 --- a/source/util/src/tref.c +++ b/source/util/src/tref.c @@ -455,9 +455,7 @@ static void taosLockList(int64_t *lockedBy) { static void taosUnlockList(int64_t *lockedBy) { int64_t tid = taosGetSelfPthreadId(); - if (atomic_val_compare_exchange_64(lockedBy, tid, 0) != tid) { - ASSERTS(false, "atomic_val_compare_exchange_64 tid failed"); - } + (void)atomic_val_compare_exchange_64(lockedBy, tid, 0); } static void taosInitRefModule(void) { (void)taosThreadMutexInit(&tsRefMutex, NULL); } diff --git a/source/util/src/tsched.c b/source/util/src/tsched.c index 6779e8dee5..34c74660fc 100644 --- a/source/util/src/tsched.c +++ b/source/util/src/tsched.c @@ -178,7 +178,6 @@ void *taosProcessSchedQueue(void *scheduler) { (*(msg.tfp))(msg.ahandle, msg.thandle); } - destroyThreadLocalGeosCtx(); return NULL; } diff --git a/source/util/src/tworker.c b/source/util/src/tworker.c index 60444e586f..e089f8e6e0 100644 --- a/source/util/src/tworker.c +++ b/source/util/src/tworker.c @@ -105,7 +105,6 @@ static void *tQWorkerThreadFp(SQueueWorker *worker) { taosUpdateItemSize(qinfo.queue, 1); } - destroyThreadLocalGeosCtx(); DestoryThreadLocalRegComp(); return NULL; @@ -665,7 +664,6 @@ static void *tQueryAutoQWorkerThreadFp(SQueryAutoQWorker *worker) { } } - destroyThreadLocalGeosCtx(); DestoryThreadLocalRegComp(); return NULL; diff --git a/source/util/test/regexTest.cpp b/source/util/test/regexTest.cpp index 5fe3701700..05d2f3b703 100644 --- a/source/util/test/regexTest.cpp +++ b/source/util/test/regexTest.cpp @@ -66,6 +66,7 @@ TEST(testCase, regexCacheTest1) { char s1[] = "abc"; auto start = std::chrono::high_resolution_clock::now(); +#ifndef WINDOWS uint64_t t0 = taosGetTimestampUs(); for (int i = 0; i < times; i++) { HashRegexPtr* ret = NULL; @@ -77,6 +78,7 @@ TEST(testCase, regexCacheTest1) { uint64_t t1 = taosGetTimestampUs(); printf("%s regex(current) %d times:%" PRIu64 " us.\n", s1, times, t1 - t0); + #endif uint64_t t2 = taosGetTimestampUs(); for(int i = 0; i < times; i++) { @@ -101,6 +103,7 @@ TEST(testCase, regexCacheTest2) { char s1[] = "abc%*"; auto start = std::chrono::high_resolution_clock::now(); +#ifndef WINDOWS uint64_t t0 = taosGetTimestampUs(); for (int i = 0; i < times; i++) { HashRegexPtr* ret = NULL; @@ -112,6 +115,7 @@ TEST(testCase, regexCacheTest2) { uint64_t t1 = taosGetTimestampUs(); printf("%s regex(current) %d times:%" PRIu64 " us.\n", s1, times, t1 - t0); + #endif uint64_t t2 = taosGetTimestampUs(); for(int i = 0; i < times; i++) { @@ -137,6 +141,7 @@ TEST(testCase, regexCacheTest3) { char s2[] = "abc"; auto start = std::chrono::high_resolution_clock::now(); +#ifndef WINDOWS uint64_t t0 = taosGetTimestampUs(); for (int i = 0; i < times; i++) { HashRegexPtr* ret = NULL; @@ -148,6 +153,7 @@ TEST(testCase, regexCacheTest3) { uint64_t t1 = taosGetTimestampUs(); printf("'%s' and '%s' take place by turn regex(current) %d times:%" PRIu64 " us.\n", s1, s2, times, t1 - t0); +#endif uint64_t t2 = taosGetTimestampUs(); for(int i = 0; i < times; i++) { @@ -176,6 +182,7 @@ TEST(testCase, regexCacheTest4) { char s2[] = "abc"; auto start = std::chrono::high_resolution_clock::now(); +#ifndef WINDOWS uint64_t t0 = taosGetTimestampUs(); for (int i = 0; i < times; i++) { for (int j = 0; j < count; ++j) { @@ -196,6 +203,7 @@ TEST(testCase, regexCacheTest4) { uint64_t t1 = taosGetTimestampUs(); printf("'%s' and '%s' take place by turn(per %d count) regex(current) %d times:%" PRIu64 " us.\n", s1, s2, count, times, t1 - t0); +#endif uint64_t t2 = taosGetTimestampUs(); for (int i = 0; i < times; i++) { diff --git a/tests/army/insert/test_column_tag_boundary.py b/tests/army/insert/test_column_tag_boundary.py index 4f1245d728..aadada024f 100644 --- a/tests/army/insert/test_column_tag_boundary.py +++ b/tests/army/insert/test_column_tag_boundary.py @@ -20,7 +20,7 @@ class TDTestCase(TBase): self.max_tag_length = 16382 self.max_column_length = 65517 self.child_table_num = 1 - self.insert_round_num = 700 + self.insert_round_num = 300 self.row_num_per_round = 15 self.start_ts = 1704082431000 @@ -47,8 +47,8 @@ class TDTestCase(TBase): # check the data for i in range(self.child_table_num): tdSql.query(f"select * from ct_binary{i+1};") - tdSql.checkRows(10500) - row_num = random.randint(0, 9999) + tdSql.checkRows(4500) + row_num = random.randint(0, 3999) tdSql.checkData(row_num, 1, 'a' * self.max_column_length) tdSql.query(f"show tags from ct_binary{i+1};") tdSql.checkData(0, 5, tag) @@ -71,8 +71,8 @@ class TDTestCase(TBase): # check the data for i in range(self.child_table_num): tdSql.query(f"select * from ct_varchar{i+1};") - tdSql.checkRows(10500) - row_num = random.randint(0, 9999) + tdSql.checkRows(4500) + row_num = random.randint(0, 3999) tdSql.checkData(row_num, 1, 'b' * self.max_column_length) tdSql.query(f"show tags from ct_varchar{i+1};") tdSql.checkData(0, 5, tag) @@ -106,8 +106,8 @@ class TDTestCase(TBase): # check the data for i in range(self.child_table_num): tdSql.query(f"select * from ct_nchar{i+1};") - tdSql.checkRows(10500) - row_num = random.randint(0, 9999) + tdSql.checkRows(4500) + row_num = random.randint(0, 3999) tdSql.checkData(row_num, 1, column) tdSql.query(f"show tags from ct_nchar{i+1};") tdSql.checkData(0, 5, tag) @@ -132,8 +132,8 @@ class TDTestCase(TBase): # check the data for i in range(self.child_table_num): tdSql.query(f"select * from ct_varbinary{i+1};") - tdSql.checkRows(5600) - row_num = random.randint(0, 5599) + tdSql.checkRows(2400) + row_num = random.randint(0, 2399) tdSql.checkData(row_num, 1, bytes.fromhex(column)) tdSql.query(f"show tags from ct_varbinary{i+1};") tdSql.checkData(0, 5, '\\x' + tag.upper()) @@ -161,8 +161,8 @@ class TDTestCase(TBase): # check the data for i in range(self.child_table_num): tdSql.query(f"select * from ct_json_tag{i+1} where t1->'{tag_key}' = '{tag_value}';") - tdSql.checkRows(5600) - row_num = random.randint(0, 5599) + tdSql.checkRows(2400) + row_num = random.randint(0, 2399) tdSql.checkData(row_num, 1, bytes.fromhex(column)) def run(self): diff --git a/tests/army/query/function/ans/ascii.csv b/tests/army/query/function/ans/ascii.csv index 77f605d047..cc1529367b 100644 --- a/tests/army/query/function/ans/ascii.csv +++ b/tests/army/query/function/ans/ascii.csv @@ -46,4 +46,67 @@ 228 117 112 -110 \ No newline at end of file +110 +116 +116 +39 +108 +120 +108 +120 +108 +116 +104 +116 +116 +104 +108 +120 +108 +120 +108 +116 +104 +116 +116 +104 +110 +228 +117 +112 +110 +110 +97 +228 +110 +97 +110 +228 +117 +112 +110 +110 +97 +228 +110 +97 +110 +112 +110 +112 +228 +117 +112 +112 +112 +112 +110 +112 +110 +112 +228 +117 +112 +112 +112 +112 diff --git a/tests/army/query/function/ans/char.csv b/tests/army/query/function/ans/char.csv index ce9c37a420..7488ac31b8 100644 --- a/tests/army/query/function/ans/char.csv +++ b/tests/army/query/function/ans/char.csv @@ -36,4 +36,8 @@ MMMMM NNNNN OOOOO PPPPP -QQQQQ \ No newline at end of file +QQQQQ +M +MM +{ +M{ diff --git a/tests/army/query/function/ans/char_length.csv b/tests/army/query/function/ans/char_length.csv index 8e1a319202..1a4c328fef 100644 --- a/tests/army/query/function/ans/char_length.csv +++ b/tests/army/query/function/ans/char_length.csv @@ -46,4 +46,48 @@ 10 6 7 -5 \ No newline at end of file +5 +4 +2 +6 +5 +5 +10 +6 +7 +5 +5 +5 +10 +5 +5 +5 +10 +6 +7 +5 +5 +5 +10 +5 +5 +5 +6 +5 +5 +10 +6 +7 +6 +7 +5 +5 +6 +5 +5 +10 +6 +7 +6 +7 +5 diff --git a/tests/army/query/function/ans/dayofweek.csv b/tests/army/query/function/ans/dayofweek.csv index f57d37ad05..93af60dc7d 100644 --- a/tests/army/query/function/ans/dayofweek.csv +++ b/tests/army/query/function/ans/dayofweek.csv @@ -73,4 +73,27 @@ 6 6 6 -6 \ No newline at end of file +6 +4 +4 +2 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 +6 diff --git a/tests/army/query/function/ans/degrees.csv b/tests/army/query/function/ans/degrees.csv index 84bf3e9ecc..4da868ff42 100644 --- a/tests/army/query/function/ans/degrees.csv +++ b/tests/army/query/function/ans/degrees.csv @@ -42,4 +42,25 @@ 57.295779513082323 81.028468454139556 99.239201175922574 -114.591559026164646 \ No newline at end of file +114.591559026164646 +180 +610.200029957721426 +491.254034090376820 +561.212164701962479 +643.603479905018958 +613.408634263739941 +487.472513516777667 +549.810284033650078 +628.076328902558998 +643.202411196955836 +592.266466706882511 +610.200029957721426 +491.254034090376820 +561.212164701962479 +643.603479905018958 +613.408634263739941 +487.472513516777667 +549.810284033650078 +628.076328902558998 +643.202411196955836 +592.266466706882511 diff --git a/tests/army/query/function/ans/exp.csv b/tests/army/query/function/ans/exp.csv index e0473ca3fa..37a6204848 100755 --- a/tests/army/query/function/ans/exp.csv +++ b/tests/army/query/function/ans/exp.csv @@ -41,4 +41,26 @@ 4.113250378782928 5.652233674034091 7.389056098930650 -3814279.104760214220732 \ No newline at end of file +3814279.104760214220732 +7.38905609893065 +1.6487212707001282 +42192.578453635847836 +5292.258432380726845 +17943.802618770550907 +75583.992598717435612 +44622.804904812772293 +4954.246535954979663 +14705.836248958077704 +57641.604897186582093 +75056.754435561466380 +30853.327779395312973 +42192.578453635847836 +5292.258432380726845 +17943.802618770550907 +75583.992598717435612 +44622.804904812772293 +4954.246535954979663 +14705.836248958077704 +57641.604897186582093 +75056.754435561466380 +30853.327779395312973 diff --git a/tests/army/query/function/ans/ln.csv b/tests/army/query/function/ans/ln.csv index 67f0176082..ef8db86bbf 100755 --- a/tests/army/query/function/ans/ln.csv +++ b/tests/army/query/function/ans/ln.csv @@ -38,4 +38,26 @@ 1.005052538742381 1.098612288668110 -0.226079864157595 -2.000000000000000 \ No newline at end of file +2.000000000000000 +2.302585092994046 +1.144729885849400 +2.365559856336680 +2.148734409997751 +2.281872059185575 +2.418855857000369 +2.370804362614190 +2.141006941277850 +2.261346315560232 +2.394434736880126 +2.418232501568406 +2.335729681253415 +2.365559856336680 +2.148734409997751 +2.281872059185575 +2.418855857000369 +2.370804362614190 +2.141006941277850 +2.261346315560232 +2.394434736880126 +2.418232501568406 +2.335729681253415 diff --git a/tests/army/query/function/ans/mod.csv b/tests/army/query/function/ans/mod.csv index 55835cec6f..87f776a3a9 100644 --- a/tests/army/query/function/ans/mod.csv +++ b/tests/army/query/function/ans/mod.csv @@ -48,3 +48,25 @@ 3.310891102586806e+00 3.350522322288470e+00 3.215120509901375e+00 +1 +1 +0 +1 +2 +0 +1 +2 +0 +1 +2 +0 +0 +1 +2 +0 +1 +2 +0 +1 +2 +0 diff --git a/tests/army/query/function/ans/pi.csv b/tests/army/query/function/ans/pi.csv index d78bc78eb9..68dd383cb3 100644 --- a/tests/army/query/function/ans/pi.csv +++ b/tests/army/query/function/ans/pi.csv @@ -24,4 +24,5 @@ 3.141592653589793 9.869604401089358 1.772453850905516 -3 \ No newline at end of file +3 +3.141592653589793 diff --git a/tests/army/query/function/ans/position.csv b/tests/army/query/function/ans/position.csv index d3d2967f87..1f3534572e 100644 --- a/tests/army/query/function/ans/position.csv +++ b/tests/army/query/function/ans/position.csv @@ -90,3 +90,87 @@ 1 1 1.000000000000000e+00 +1 +0 +1 +1 +0 +0 +0 +0 +4 +0 +0 +0 +0 +0 +0 +0 +0 +0 +4 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +4 +0 +0 +0 +0 +0 +0 +0 +4 +0 +4 +0 +0 +0 +0 +0 +0 +0 +4 +0 +4 +0 +0 +5 +0 +0 +0 +0 +0 +0 +4 +0 +0 +5 +0 +0 +0 +0 +0 +0 diff --git a/tests/army/query/function/ans/radians.csv b/tests/army/query/function/ans/radians.csv index a9f0a9025d..0f6e56c565 100644 --- a/tests/army/query/function/ans/radians.csv +++ b/tests/army/query/function/ans/radians.csv @@ -42,4 +42,25 @@ 0.017453292519943 0.024682682989769 0.030229989403904 -0.034906585039887 \ No newline at end of file +0.034906585039887 +3.141592653589793 +0.185877558679493 +0.149644536324422 +0.170955001564425 +0.196052831414414 +0.186854955444309 +0.148492619284422 +0.167481790094528 +0.191322990739406 +0.195930658899406 +0.180414682914441 +0.185877558679493 +0.149644536324422 +0.170955001564425 +0.196052831414414 +0.186854955444309 +0.148492619284422 +0.167481790094528 +0.191322990739406 +0.195930658899406 +0.180414682914441 diff --git a/tests/army/query/function/ans/repeat.csv b/tests/army/query/function/ans/repeat.csv index 202d1a969f..98176c87a3 100644 --- a/tests/army/query/function/ans/repeat.csv +++ b/tests/army/query/function/ans/repeat.csv @@ -56,4 +56,106 @@ var1 var1var1 var1var1var1 var1var1var1var1 -var1var1var1var1var1 \ No newline at end of file +var1var1var1var1var1 +taos +taostaos +lililililili +xxx +lililililili +xxx +lililililili +taostaostaos +hahahahahaha +taostaostaos +taostaostaos +hahahahahaha +lililililili +xxx +lililililili +xxx +lililililili +taostaostaos +hahahahahaha +taostaostaos +taostaostaos +hahahahahaha +novelnovelnovel +一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十 +updateupdateupdate +prisionprisionprision +novelnovelnovel +novelnovelnovel +againagainagain +一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十 +novelnovelnovel +againagainagain +novelnovelnovel +一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十 +updateupdateupdate +prisionprisionprision +novelnovelnovel +novelnovelnovel +againagainagain +一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十 +novelnovelnovel +againagainagain +novelnovelnovel +personpersonperson +novelnovelnovel +plateplateplate +一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十 +updateupdateupdate +prisionprisionprision +personpersonperson +prisionprisionprision +plateplateplate +novelnovelnovel +personpersonperson +novelnovelnovel +plateplateplate +一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十 +updateupdateupdate +prisionprisionprision +personpersonperson +prisionprisionprision +plateplateplate +lili +x +lili +x +lili +taos +haha +taos +taos +haha +lili +x +lili +x +lili +taos +haha +taos +taos +haha +novel +一二三四五六七八九十 +update +prision +novel +novel +again +一二三四五六七八九十 +novel +again +novel +一二三四五六七八九十 +update +prision +novel +novel +again +一二三四五六七八九十 +novel +again diff --git a/tests/army/query/function/ans/replace.csv b/tests/army/query/function/ans/replace.csv index a19dc73015..4df4e02d83 100644 --- a/tests/army/query/function/ans/replace.csv +++ b/tests/army/query/function/ans/replace.csv @@ -368,4 +368,109 @@ e二三四五六七abcdefghijk213124123 一二三四五六七abcdefghijk213124123 一二三四五六七abcdefghijk213124123 一二三四五六七abcdefghijk213124123 -一二三四五六七abcdefghijk213124123 \ No newline at end of file +一二三四五六七abcdefghijk213124123 +eebbccdd +aabbccdd +南京 +北南 +南京taos +novel +一二三四五六七八九十 +update +prision +novtl +novel +again +一二三四五六七八九十 +novel +again +novel +一二三四五六七八九十 +update +prision +novtl +novel +again +一二三四五六七八九十 +novel +again +novtl +一二三四五六七八九十 +update +prision +novel +novel +again +一二三四五六七八九十 +novtl +again +novtl +一二三四五六七八九十 +update +prision +novel +novel +again +一二三四五六七八九十 +novtl +again +novel +person +novel +plate +一二三四五六七八九十 +update +prision +person +prision +plate +novel +person +novel +plate +一二三四五六七八九十 +update +prision +person +prision +plate +novtl +person +novel +platt +一二三四五六七八九十 +update +prision +person +prision +plate +novtl +person +novel +platt +一二三四五六七八九十 +update +prision +person +prision +plate +novel +一二三四五六七八九十 +update +prision +nov一二三四五六七八九十l +novel +again +一二三四五六七八九十 +novel +again +novel +一二三四五六七八九十 +update +prision +nov一二三四五六七八九十l +novel +again +一二三四五六七八九十 +novel +again diff --git a/tests/army/query/function/ans/round.csv b/tests/army/query/function/ans/round.csv index ae85752d0d..75b48e51a8 100644 --- a/tests/army/query/function/ans/round.csv +++ b/tests/army/query/function/ans/round.csv @@ -62,4 +62,33 @@ 9.6000004 11.0000000 11.1999998 -10.3000002 \ No newline at end of file +10.3000002 +10.55 +10.55 +10.6 +11 +11 +10 +0 +-10.6 +99 +11 +9 +10 +11 +11 +9 +10 +11 +11 +10 +11 +9 +10 +11 +11 +9 +10 +11 +11 +10 diff --git a/tests/army/query/function/ans/sign.csv b/tests/army/query/function/ans/sign.csv index 8c317babf7..4338e8f40d 100644 --- a/tests/army/query/function/ans/sign.csv +++ b/tests/army/query/function/ans/sign.csv @@ -43,4 +43,28 @@ 1.000000000000000 1.000000000000000 1.000000000000000 -0 \ No newline at end of file +0 +1 +1 +-1 +-1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 diff --git a/tests/army/query/function/ans/stddev.csv b/tests/army/query/function/ans/stddev.csv index 4a6873869e..48d54ae544 100644 --- a/tests/army/query/function/ans/stddev.csv +++ b/tests/army/query/function/ans/stddev.csv @@ -30,4 +30,8 @@ 8.077747210701755 8.077747210701755 8.077747210701755 -8.077747210701755 \ No newline at end of file +8.077747210701755 +2886.751331514371941 +2886.751331514371941 +1.154339668872967 +1.154339668872967 diff --git a/tests/army/query/function/ans/substr.csv b/tests/army/query/function/ans/substr.csv index 208ac0cede..72fd79c419 100644 --- a/tests/army/query/function/ans/substr.csv +++ b/tests/army/query/function/ans/substr.csv @@ -445,4 +445,51 @@ bc一二三abc一二三a rision rision bc一二三abc一二三a -二三123321三二一 \ No newline at end of file +二三123321三二一 +dengine +e +tde +dengine +e +中国 +中国t +novel +perso +novel +plate +一二三四五 +updat +prisi +perso +prisi +plate +novel +perso +novel +plate +一二三四五 +updat +prisi +perso +prisi +plate +novel +一二三四五 +updat +prisi +novel +novel +again +一二三四五 +novel +again +novel +一二三四五 +updat +prisi +novel +novel +again +一二三四五 +novel +again diff --git a/tests/army/query/function/ans/substr_idx.csv b/tests/army/query/function/ans/substr_idx.csv index 0734e9794e..ff64b770c4 100644 --- a/tests/army/query/function/ans/substr_idx.csv +++ b/tests/army/query/function/ans/substr_idx.csv @@ -188,4 +188,108 @@ a一二三a一二三bbcfp 一二三123321三二一 一二三123321三二一 一二三123321三二一 -一二三123321三二一 \ No newline at end of file +一二三123321三二一 +www.taosdata +taosdata.com +中国.科学 +北京。涛思 +novel +一二三四五六七八九十 +update +prision +novel +novel +ag +一二三四五六七八九十 +novel +ag +novel +一二三四五六七八九十 +update +prision +novel +novel +ag +一二三四五六七八九十 +novel +ag +novel +一二三四五六七八九十 +update +prision +novel +novel +again +一二三四五六七八九十 +novel +again +novel +一二三四五六七八九十 +update +prision +novel +novel +again +一二三四五六七八九十 +novel +again +novel +一二三四五六七八九十 +update +prision +novel +novel +again +一二三四五六七八九十 +novel +again +novel +一二三四五六七八九十 +update +prision +novel +novel +again +一二三四五六七八九十 +novel +again +novel +person +novel +plate +一二三四五六七八九十 +update +prision +person +prision +plate +novel +person +novel +plate +一二三四五六七八九十 +update +prision +person +prision +plate +novel +person +novel +plate +一二三四五六七八九十 +update +prision +person +prision +plate +novel +person +novel +plate +一二三四五六七八九十 +update +prision +person +prision +plate diff --git a/tests/army/query/function/ans/timediff.csv b/tests/army/query/function/ans/timediff.csv index edc2808afc..c819be1411 100644 --- a/tests/army/query/function/ans/timediff.csv +++ b/tests/army/query/function/ans/timediff.csv @@ -295,4 +295,40 @@ 372 372 372 -372 \ No newline at end of file +372 +-10 +31536000 +3000 +43200 +720 +30 +4 +2592000000 +2592000 +2592000 +60 +60 +79774389 +-79774389 +79774389 +-79774389 +-220769589123 +-220766589123 +-220763589123 +-220760589123 +-220757589123 +-220754589123 +-220751589123 +-220748589123 +-220745589123 +-220742589123 +-220769589123 +-220766589123 +-220763589123 +-220760589123 +-220757589123 +-220754589123 +-220751589123 +-220748589123 +-220745589123 +-220742589123 diff --git a/tests/army/query/function/ans/trim.csv b/tests/army/query/function/ans/trim.csv index a349c09788..01ed8a62c9 100644 --- a/tests/army/query/function/ans/trim.csv +++ b/tests/army/query/function/ans/trim.csv @@ -353,4 +353,101 @@ bbcfp三a 三abbcfp三a 三abbcfp三a 三abbcfp三a -三abbcfp三a \ No newline at end of file +三abbcfp三a +A +涛思 +b bbb +aaa + aaa abab aaaa + abab aaaa +京涛思数据科技有限公司北 +bei京涛思数据科技有限公司北 + aaa abab aaaa +aaa abab + aaa abab +北京涛思数据科技有限公司 +北京涛思数据科技有限公司bei +aaa abab aaaa + aaa abab aaaa + abab +京涛思数据科技有限公司 +novel +一二三四五六七八九十 +update +prision +novel +novel +again +一二三四五六七八九十 +novel +again +novel +一二三四五六七八九十 +update +prision +novel +novel +again +一二三四五六七八九十 +novel +again +novel +person +novel +plate +一二三四五六七八九十 +update +prision +person +prision +plate +novel +person +novel +plate +一二三四五六七八九十 +update +prision +person +prision +plate +novel +一二三四五六七八九十 +update +prision +novel +novel +again +一二三四五六七八九十 +novel +again +novel +一二三四五六七八九十 +update +prision +novel +novel +again +一二三四五六七八九十 +novel +again +novel +person +novel +plat +一二三四五六七八九十 +update +prision +person +prision +plate +novel +person +novel +plat +一二三四五六七八九十 +update +prision +person +prision +plate diff --git a/tests/army/query/function/ans/trunc.csv b/tests/army/query/function/ans/trunc.csv index aa5d0da84d..ea735c1c7e 100755 --- a/tests/army/query/function/ans/trunc.csv +++ b/tests/army/query/function/ans/trunc.csv @@ -79,4 +79,51 @@ 9.5000000 10.8999996 11.1999998 -10.3000002 \ No newline at end of file +10.3000002 +99.99 +99.99 +99.9 +99 +90 +0 +99 +10.6 +8.5 +9.7 +11.2 +10.7 +8.5 +9.5 +10.9 +11.2 +10.3 +10.6 +8.5 +9.7 +11.2 +10.7 +8.5 +9.5 +10.9 +11.2 +10.3 +10.6 +8.5 +9.7 +11.2 +10.7 +8.5 +9.5 +10.9 +11.2 +10.3 +10.6 +8.5 +9.7 +11.2 +10.7 +8.5 +9.5 +10.9 +11.2 +10.3 diff --git a/tests/army/query/function/ans/varpop.csv b/tests/army/query/function/ans/varpop.csv index c00ae59a8b..d621d013fd 100644 --- a/tests/army/query/function/ans/varpop.csv +++ b/tests/army/query/function/ans/varpop.csv @@ -30,4 +30,8 @@ 65.250000000000000 65.250000000000000 65.250000000000000 -65.250000000000000 \ No newline at end of file +65.250000000000000 +8333333.250000000000000 +8333333.250000000000000 +1.332500071133751 +1.332500071133751 diff --git a/tests/army/query/function/ans/week.csv b/tests/army/query/function/ans/week.csv index 4e91c6c880..3a127f2feb 100644 --- a/tests/army/query/function/ans/week.csv +++ b/tests/army/query/function/ans/week.csv @@ -140,4 +140,35 @@ 28 28 28 -28 \ No newline at end of file +28 +0 +0 +0 +52 +52 +0 +0 +52 +52 +3 +52 +28 +28 +28 +28 +28 +28 +28 +28 +28 +28 +28 +28 +28 +28 +28 +28 +28 +28 +28 +28 diff --git a/tests/army/query/function/ans/weekday.csv b/tests/army/query/function/ans/weekday.csv index 90cba4502f..39bec5315b 100644 --- a/tests/army/query/function/ans/weekday.csv +++ b/tests/army/query/function/ans/weekday.csv @@ -73,4 +73,28 @@ 4 4 4 -4 \ No newline at end of file +4 +2 +2 +0 +2 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 diff --git a/tests/army/query/function/ans/weekofyear.csv b/tests/army/query/function/ans/weekofyear.csv index 34fe47e20a..09c865e8b2 100644 --- a/tests/army/query/function/ans/weekofyear.csv +++ b/tests/army/query/function/ans/weekofyear.csv @@ -73,4 +73,27 @@ 28 28 28 -28 \ No newline at end of file +28 +1 +4 +29 +28 +28 +28 +28 +28 +28 +28 +28 +28 +28 +28 +28 +28 +28 +28 +28 +28 +28 +28 +28 diff --git a/tests/army/query/function/in/ascii.err b/tests/army/query/function/in/ascii.err new file mode 100644 index 0000000000..7917901450 --- /dev/null +++ b/tests/army/query/function/in/ascii.err @@ -0,0 +1,5 @@ +select ascii(); +select ascii(123); +select ascii(1); +select ascii(2); +select ascii(1.5); diff --git a/tests/army/query/function/in/ascii.in b/tests/army/query/function/in/ascii.in index 6aed758ebc..638fcd8d7c 100644 --- a/tests/army/query/function/in/ascii.in +++ b/tests/army/query/function/in/ascii.in @@ -14,4 +14,13 @@ select ASCII(concat(nch1,var1)) from ts_4893.meters order by ts limit 5; select ASCII(cast(nch1 as varchar)) from ts_4893.meters order by ts limit 5; select pow(ASCII(nch1), 2) from ts_4893.meters order by ts limit 5; select sqrt(ASCII(nch1)) from ts_4893.meters order by ts limit 5; -select cast(ASCII(nch1) as int) from ts_4893.meters order by ts limit 5; \ No newline at end of file +select cast(ASCII(nch1) as int) from ts_4893.meters order by ts limit 5; +select ascii('taos'); +select ascii('t'); +select ascii('\''); +select ascii(name) from ts_4893.d0 order by ts limit 10; +select ascii(name) from ts_4893.meters order by ts limit 10; +select ascii(nch1) from ts_4893.d0 order by ts limit 10; +select ascii(nch1) from ts_4893.meters order by ts limit 10; +select ascii(var1) from ts_4893.d0 order by ts limit 10; +select ascii(var1) from ts_4893.meters order by ts limit 10; diff --git a/tests/army/query/function/in/char.err b/tests/army/query/function/in/char.err new file mode 100644 index 0000000000..699cbd34d1 --- /dev/null +++ b/tests/army/query/function/in/char.err @@ -0,0 +1 @@ +select char(); diff --git a/tests/army/query/function/in/char.in b/tests/army/query/function/in/char.in index c075b2da2c..eb1d1b954e 100644 --- a/tests/army/query/function/in/char.in +++ b/tests/army/query/function/in/char.in @@ -9,3 +9,7 @@ select cast(CHAR(49) as int); select CHAR(id + 77) from ts_4893.meters order by ts limit 5;; select CONCAT(CHAR(id + 77),CHAR(id + 77),CHAR(id + 77)) from ts_4893.meters limit 5; select CHAR(id+77, id+77, id+77, id+77, id+77) from ts_4893.meters limit 5; +select char(77); +select char(77 * 256 + 77); +select char('123'); +select char(77, NULL, '123'); diff --git a/tests/army/query/function/in/char_length.err b/tests/army/query/function/in/char_length.err new file mode 100644 index 0000000000..fd0328ce05 --- /dev/null +++ b/tests/army/query/function/in/char_length.err @@ -0,0 +1,5 @@ +select char_length(); +select char_length('tao's'); +select char_length(123.45); +select char_length(123.45.67); +select char_length('a', 'b'); diff --git a/tests/army/query/function/in/char_length.in b/tests/army/query/function/in/char_length.in index 13f781b23c..eb0e7424fc 100644 --- a/tests/army/query/function/in/char_length.in +++ b/tests/army/query/function/in/char_length.in @@ -14,4 +14,12 @@ select CHAR_LENGTH(concat(nch1,var1)) from ts_4893.meters order by ts limit 5; select CHAR_LENGTH(cast(nch1 as varchar)) from ts_4893.meters order by ts limit 5; select pow(CHAR_LENGTH(nch1), 2) from ts_4893.meters order by ts limit 5; select sqrt(CHAR_LENGTH(nch1)) from ts_4893.meters order by ts limit 5; -select cast(CHAR_LENGTH(nch1) as int) from ts_4893.meters order by ts limit 5; \ No newline at end of file +select cast(CHAR_LENGTH(nch1) as int) from ts_4893.meters order by ts limit 5; +select char_length('taos'); +select char_length('涛思'); +select char_length('涛思taos'); +select char_length('tao\'s'); +select char_length(nch1) from ts_4893.d0 limit 10; +select char_length(nch1) from ts_4893.meters limit 10; +select char_length(var1) from ts_4893.d0 limit 10; +select char_length(var1) from ts_4893.meters limit 10; diff --git a/tests/army/query/function/in/dayofweek.err b/tests/army/query/function/in/dayofweek.err new file mode 100644 index 0000000000..151ae390bc --- /dev/null +++ b/tests/army/query/function/in/dayofweek.err @@ -0,0 +1,2 @@ +select dayofweek(); +select dayofweek('2020-01-01',1); diff --git a/tests/army/query/function/in/dayofweek.in b/tests/army/query/function/in/dayofweek.in index 87547c50da..66d6599963 100644 --- a/tests/army/query/function/in/dayofweek.in +++ b/tests/army/query/function/in/dayofweek.in @@ -10,4 +10,9 @@ select DAYOFWEEK('2000-01-06 00:00:00'); select DAYOFWEEK('2000-01-06 00:00:00') from ts_4893.meters order by ts limit 10; select DAYOFWEEK(1725095657); select DAYOFWEEK(1725095657) from ts_4893.meters order by ts limit 10; -select DAYOFWEEK(ts) from ts_4893.meters order by ts limit 10; \ No newline at end of file +select DAYOFWEEK(ts) from ts_4893.meters order by ts limit 10; +select dayofweek('2020-01-01'); +select dayofweek(1721020666); +select dayofweek(1721020666229); +select dayofweek(ts) from ts_4893.d0 order by ts limit 10; +select dayofweek(ts) from ts_4893.meters order by ts limit 10; diff --git a/tests/army/query/function/in/degrees.err b/tests/army/query/function/in/degrees.err new file mode 100644 index 0000000000..4b5bec47bf --- /dev/null +++ b/tests/army/query/function/in/degrees.err @@ -0,0 +1,2 @@ +select degrees(); +select degrees('abc'); diff --git a/tests/army/query/function/in/degrees.in b/tests/army/query/function/in/degrees.in index 9c75039595..54672c0722 100644 --- a/tests/army/query/function/in/degrees.in +++ b/tests/army/query/function/in/degrees.in @@ -26,4 +26,7 @@ select abs(DEGREES(10)); select pow(DEGREES(10), 2); select sqrt(DEGREES(10)); select cast(DEGREES(10) as int); -select DEGREES(sqrt(id)) from ts_4893.meters order by ts limit 5; \ No newline at end of file +select DEGREES(sqrt(id)) from ts_4893.meters order by ts limit 5; +select degrees(pi()); +select degrees(current) from ts_4893.d0 order by ts limit 10; +select degrees(current) from ts_4893.meters order by ts limit 10; diff --git a/tests/army/query/function/in/exp.err b/tests/army/query/function/in/exp.err new file mode 100644 index 0000000000..6e6a206db8 --- /dev/null +++ b/tests/army/query/function/in/exp.err @@ -0,0 +1,2 @@ +select exp(); +select exp('1'); diff --git a/tests/army/query/function/in/exp.in b/tests/army/query/function/in/exp.in index ebf88c7598..1af149d9cc 100755 --- a/tests/army/query/function/in/exp.in +++ b/tests/army/query/function/in/exp.in @@ -25,4 +25,8 @@ select pow(EXP(10), 2); select sqrt(EXP(10)); select cast(EXP(10) as int); select EXP(sqrt(id)) from ts_4893.meters order by ts limit 5; -select EXP(EXP(EXP(EXP(0)))); \ No newline at end of file +select EXP(EXP(EXP(EXP(0)))); +select exp(2); +select exp(0.5); +select exp(current) from ts_4893.d0 order by ts limit 10; +select exp(current) from ts_4893.meters order by ts limit 10; diff --git a/tests/army/query/function/in/ln.err b/tests/army/query/function/in/ln.err new file mode 100644 index 0000000000..1d0e60d1b0 --- /dev/null +++ b/tests/army/query/function/in/ln.err @@ -0,0 +1,2 @@ +select ln(); +select ln('1'); diff --git a/tests/army/query/function/in/ln.in b/tests/army/query/function/in/ln.in index 8b05b3e818..eb3f3281d5 100755 --- a/tests/army/query/function/in/ln.in +++ b/tests/army/query/function/in/ln.in @@ -22,4 +22,8 @@ select sqrt(LN(10)); select cast(LN(10) as int); select LN(sqrt(id) + 1) from ts_4893.meters order by ts limit 5; select LN(LN(LN(LN(10000)))); -select LN(EXP(2)); \ No newline at end of file +select LN(EXP(2)); +select ln(10); +select ln(pi()); +select ln(current) from ts_4893.d0 order by ts limit 10; +select ln(current) from ts_4893.meters order by ts limit 10; diff --git a/tests/army/query/function/in/mod.err b/tests/army/query/function/in/mod.err new file mode 100644 index 0000000000..1c260ce75c --- /dev/null +++ b/tests/army/query/function/in/mod.err @@ -0,0 +1,6 @@ +select mod(); +select mod(, 2); +select mod(10, ); +select mod(10, 'a'); +select mod('abc', 3); +select mod(10, 3, 1); diff --git a/tests/army/query/function/in/mod.in b/tests/army/query/function/in/mod.in index d75a6a9ac4..d335573cf4 100755 --- a/tests/army/query/function/in/mod.in +++ b/tests/army/query/function/in/mod.in @@ -11,4 +11,8 @@ select MOD(MOD(MOD(MOD(MOD(MOD(MOD(123456789.123456789, -1), -2), -3), -4), -5), select MOD(87654321.123456789, id + 1) from ts_4893.meters order by ts limit 10; select MOD(current, id + 1) from ts_4893.meters order by ts limit 10; select MOD(current, 1) from ts_4893.meters order by ts limit 10; -select MOD(sqrt(current), abs(id + 1)) from ts_4893.meters order by ts limit 10; \ No newline at end of file +select MOD(sqrt(current), abs(id + 1)) from ts_4893.meters order by ts limit 10; +select mod(10, -3); +select mod(10, 3); +select mod(id, 3) from ts_4893.d0 order by ts limit 10; +select mod(id, 3) from ts_4893.meters order by ts limit 10; diff --git a/tests/army/query/function/in/pi.err b/tests/army/query/function/in/pi.err new file mode 100644 index 0000000000..6666e64e73 --- /dev/null +++ b/tests/army/query/function/in/pi.err @@ -0,0 +1,2 @@ +select pi('111'); +select pi(123); diff --git a/tests/army/query/function/in/pi.in b/tests/army/query/function/in/pi.in index 23b4e0fa71..c0ccc0b079 100644 --- a/tests/army/query/function/in/pi.in +++ b/tests/army/query/function/in/pi.in @@ -16,4 +16,5 @@ select pi() + id from ts_4893.meters order by ts limit 5; select abs(pi()); select pow(pi(), 2); select sqrt(pi()); -select cast(pi() as int); \ No newline at end of file +select cast(pi() as int); +select pi(); diff --git a/tests/army/query/function/in/position.err b/tests/army/query/function/in/position.err new file mode 100644 index 0000000000..c63fc62c02 --- /dev/null +++ b/tests/army/query/function/in/position.err @@ -0,0 +1,5 @@ +select position('t' in); +select position(in 'taos'); +select position(1 in 2213); +select position(1 in '2213'); +select position('1' in 2213); diff --git a/tests/army/query/function/in/position.in b/tests/army/query/function/in/position.in index f7c6e71eed..7c682c5c80 100644 --- a/tests/army/query/function/in/position.in +++ b/tests/army/query/function/in/position.in @@ -25,4 +25,16 @@ select POSITION(var2 IN 'abcdefghijklmn') from ts_4893.meters where POSITION(var select POSITION(nch2 IN '一二三四五六七八九十') from ts_4893.meters where POSITION(nch2 IN '一二三四五六七八九十') != 0 order by ts limit 5; select POSITION(var2 IN '一二三四五六七八九十') from ts_4893.meters where POSITION(var2 IN '一二三四五六七八九十') != 0 order by ts limit 5; select ABS(POSITION('aaa' IN 'aaaaaaaaa')); -select POW(POSITION('aaa' IN 'aaaaaaaaa'), 2); \ No newline at end of file +select POW(POSITION('aaa' IN 'aaaaaaaaa'), 2); +select position('t' in 'taos'); +select position('ustc' in 'taos'); +select position('' in ''); +select position('' in 'taos'); +select position(nch2 in nch1) from ts_4893.d0 order by ts limit 10; +select position(nch2 in nch1) from ts_4893.meters order by ts limit 10; +select position(nch2 in var1) from ts_4893.d0 order by ts limit 10; +select position(nch2 in var1) from ts_4893.meters order by ts limit 10; +select position(var2 in nch1) from ts_4893.d0 order by ts limit 10; +select position(var2 in nch1) from ts_4893.meters order by ts limit 10; +select position(var2 in var1) from ts_4893.d0 order by ts limit 10; +select position(var2 in var1) from ts_4893.meters order by ts limit 10; diff --git a/tests/army/query/function/in/radians.err b/tests/army/query/function/in/radians.err new file mode 100644 index 0000000000..0153bff54b --- /dev/null +++ b/tests/army/query/function/in/radians.err @@ -0,0 +1,2 @@ +select radians(); +select radians('abc'); diff --git a/tests/army/query/function/in/radians.in b/tests/army/query/function/in/radians.in index 6f873b16d2..45ef75f0d2 100644 --- a/tests/army/query/function/in/radians.in +++ b/tests/army/query/function/in/radians.in @@ -26,4 +26,7 @@ select abs(RADIANS(10)); select pow(RADIANS(10), 2); select sqrt(RADIANS(10)); select cast(RADIANS(10) as int); -select RADIANS(sqrt(id)) from ts_4893.meters order by ts limit 5; \ No newline at end of file +select RADIANS(sqrt(id)) from ts_4893.meters order by ts limit 5; +select radians(180); +select radians(current) from ts_4893.d0 order by ts limit 10; +select radians(current) from ts_4893.meters order by ts limit 10; diff --git a/tests/army/query/function/in/repeat.err b/tests/army/query/function/in/repeat.err new file mode 100644 index 0000000000..0198c0e345 --- /dev/null +++ b/tests/army/query/function/in/repeat.err @@ -0,0 +1,11 @@ +select repeat(); +select repeat('taos', ); +select repeat(, 3); +select repeat('taos'); +select repeat(1); +select repeat(taos, 1); +select repeat(123, 2); +select repeat('taos', 1.5); +select repeat('taos', 1.4); +select repeat('taos', 12, 3); +select repeat(id, 3) from ts_4893.meters; diff --git a/tests/army/query/function/in/repeat.in b/tests/army/query/function/in/repeat.in index 76ebbddac4..a0a74a96cc 100644 --- a/tests/army/query/function/in/repeat.in +++ b/tests/army/query/function/in/repeat.in @@ -16,4 +16,16 @@ select position(var1 in repeat(nch1,6)) from ts_4893.meters where nch1 = var1 or select repeat(nch1, id) from ts_4893.meters where id > 0 order by ts limit 5; select repeat(var1, id) from ts_4893.meters where id > 0 order by ts limit 5; select repeat('nch1', id) from ts_4893.meters where id > 0 order by ts limit 5; -select repeat('var1', id) from ts_4893.meters where id > 0 order by ts limit 5; \ No newline at end of file +select repeat('var1', id) from ts_4893.meters where id > 0 order by ts limit 5; +select repeat('taos', 1); +select repeat('taos', 2); +select repeat(name, 3) from ts_4893.d0 order by ts limit 10; +select repeat(name, 3) from ts_4893.meters order by ts limit 10; +select repeat(nch1, 3) from ts_4893.d0 order by ts limit 10; +select repeat(nch1, 3) from ts_4893.meters order by ts limit 10; +select repeat(var1, 3) from ts_4893.d0 order by ts limit 10; +select repeat(var1, 3) from ts_4893.meters order by ts limit 10; +select repeat(name, groupid) from ts_4893.d0 order by ts limit 10; +select repeat(name, groupid) from ts_4893.meters order by ts limit 10; +select repeat(nch1, groupid) from ts_4893.d0 order by ts limit 10; +select repeat(nch1, groupid) from ts_4893.meters order by ts limit 10; diff --git a/tests/army/query/function/in/replace.err b/tests/army/query/function/in/replace.err new file mode 100644 index 0000000000..df5c847481 --- /dev/null +++ b/tests/army/query/function/in/replace.err @@ -0,0 +1,7 @@ +select replace(); +select replace('aabbccdd', , 'ee'); +select replace('aabbccdd', 'aa', ); +select replace(, 'aa', 'ee'); +select replace(123345, 1, 'ee'); +select replace('aabbccdd', 1, 'ee'); +select replace('aabbccdd', 'a', 1); diff --git a/tests/army/query/function/in/replace.in b/tests/army/query/function/in/replace.in index 70b694325d..619b10ced0 100644 --- a/tests/army/query/function/in/replace.in +++ b/tests/army/query/function/in/replace.in @@ -80,4 +80,19 @@ select replace('一二三四五六七abcdefghijk213124123', var2, 'var2') from t select replace('一二三四五六七abcdefghijk213124123', var2, 'var2') from ts_4893.meters where position(var2 IN '一二三四五六七abcdefghijk213124123') = 0 order by ts limit 5; select replace('一二三四五六七abcdefghijk213124123', var2, nch2) from ts_4893.meters order by ts limit 5; select replace('一二三四五六七abcdefghijk213124123', var2, nch2) from ts_4893.meters where position(var2 IN '一二三四五六七abcdefghijk213124123') != 0 order by ts limit 5; -select replace('一二三四五六七abcdefghijk213124123', var2, nch2) from ts_4893.meters where position(var2 IN '一二三四五六七abcdefghijk213124123') = 0 order by ts limit 5; \ No newline at end of file +select replace('一二三四五六七abcdefghijk213124123', var2, nch2) from ts_4893.meters where position(var2 IN '一二三四五六七abcdefghijk213124123') = 0 order by ts limit 5; +select replace('aabbccdd','aa', 'ee'); +select replace('aabbccdd','AA', 'ee'); +select replace('北京','北' , '南'); +select replace('北京','京' , '南'); +select replace('北京taos','北' , '南'); +select replace(nch1, nch2, 't') from ts_4893.d0 order by ts limit 10; +select replace(nch1, nch2, 't') from ts_4893.meters order by ts limit 10; +select replace(nch1, var2, 't') from ts_4893.d0 order by ts limit 10; +select replace(nch1, var2, 't') from ts_4893.meters order by ts limit 10; +select replace(var1, nch2, 't') from ts_4893.d0 order by ts limit 10; +select replace(var1, nch2, 't') from ts_4893.meters order by ts limit 10; +select replace(var1, var2, 't') from ts_4893.d0 order by ts limit 10; +select replace(var1, var2, 't') from ts_4893.meters order by ts limit 10; +select replace(nch1, nch2, var1) from ts_4893.d0 order by ts limit 10; +select replace(nch1, nch2, var1) from ts_4893.meters order by ts limit 10; diff --git a/tests/army/query/function/in/round.err b/tests/army/query/function/in/round.err new file mode 100644 index 0000000000..2b91a90b52 --- /dev/null +++ b/tests/army/query/function/in/round.err @@ -0,0 +1,5 @@ +select round(); +select round(10, ); +select round(, 2); +select round('abc', 2); +select round(123.23, 'a'); diff --git a/tests/army/query/function/in/round.in b/tests/army/query/function/in/round.in index 1b27c167df..f9be21ef04 100644 --- a/tests/army/query/function/in/round.in +++ b/tests/army/query/function/in/round.in @@ -17,3 +17,14 @@ select ROUND(current) from ts_4893.meters order by ts limit 20; select ROUND(87654321.123456789, id) from ts_4893.meters order by ts limit 10; select ROUND(current, id) from ts_4893.meters order by ts limit 10; select ROUND(current, 1) from ts_4893.meters order by ts limit 10; +select round(10.55, 3); +select round(10.55, 2); +select round(10.55, 1); +select round(10.55, 0); +select round(10.55); +select round(10.55, -1); +select round(10.55, -10); +select round(-10.55, 1); +select round(99, 1); +select round(current) from ts_4893.d0 order by ts limit 10; +select round(current) from ts_4893.meters order by ts limit 10; diff --git a/tests/army/query/function/in/sign.err b/tests/army/query/function/in/sign.err new file mode 100644 index 0000000000..97d6c78c03 --- /dev/null +++ b/tests/army/query/function/in/sign.err @@ -0,0 +1,3 @@ +select sign(); +select sign('abc'); +select sign(10, 1); diff --git a/tests/army/query/function/in/sign.in b/tests/army/query/function/in/sign.in index 5a64b557dd..1be6a3610c 100644 --- a/tests/army/query/function/in/sign.in +++ b/tests/army/query/function/in/sign.in @@ -27,4 +27,10 @@ select pow(SIGN(10), 2); select sqrt(SIGN(10)); select cast(SIGN(10) as int); select SIGN(sqrt(id)) from ts_4893.meters order by ts limit 5; -select SIGN(SIGN(SIGN(SIGN(0)))); \ No newline at end of file +select SIGN(SIGN(SIGN(SIGN(0)))); +select sign(1); +select sign(10); +select sign(-1); +select sign(-10); +select sign(current) from ts_4893.d0 order by ts limit 10; +select sign(current) from ts_4893.meters order by ts limit 10; diff --git a/tests/army/query/function/in/stddev.err b/tests/army/query/function/in/stddev.err new file mode 100644 index 0000000000..19555de093 --- /dev/null +++ b/tests/army/query/function/in/stddev.err @@ -0,0 +1,8 @@ +select stddev_pop() from ts_4893.d0; +select stddev_pop(ts) from ts_4893.d0; +select stddev_pop(name) from ts_4893.d0; +select stddev_pop(id, current) from ts_4893.d0; +select stddev_pop() from ts_4893.meters; +select stddev_pop(ts) from ts_4893.meters; +select stddev_pop(name) from ts_4893.meters; +select stddev_pop(id, current) from ts_4893.meters; diff --git a/tests/army/query/function/in/stddev.in b/tests/army/query/function/in/stddev.in index 77987b1520..ef36a7da41 100644 --- a/tests/army/query/function/in/stddev.in +++ b/tests/army/query/function/in/stddev.in @@ -4,3 +4,7 @@ select STDDEV(id) from ts_4893.meters; select STDDEV(id) from ts_4893.meters interval(1d) limit 10; select STDDEV(id) from ts_4893.meters where id > 100; select STDDEV(id) from ts_4893.meters interval(1d) order by 1 limit 10; +select stddev_pop(id) from ts_4893.d0; +select stddev_pop(id) from ts_4893.meters; +select stddev_pop(current) from ts_4893.d0; +select stddev_pop(current) from ts_4893.meters; diff --git a/tests/army/query/function/in/substr.err b/tests/army/query/function/in/substr.err new file mode 100644 index 0000000000..3138e6689b --- /dev/null +++ b/tests/army/query/function/in/substr.err @@ -0,0 +1,3 @@ +select substring(); +select substring('abc'); +select substring(10, 1); diff --git a/tests/army/query/function/in/substr.in b/tests/army/query/function/in/substr.in index 8393fca035..e5a1ea0754 100644 --- a/tests/army/query/function/in/substr.in +++ b/tests/army/query/function/in/substr.in @@ -125,4 +125,15 @@ select SUBSTR(var1 FROM sign(id) FOR 20) from ts_4893.meters where char_length(v select SUBSTR(nch1, 2, id) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5; select SUBSTR(nch1 FROM 2 FOR id) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5; select SUBSTR(var1, 2, id) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5; -select SUBSTR(var1 FROM 2 FOR id) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5; \ No newline at end of file +select SUBSTR(var1 FROM 2 FOR id) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5; +select substring('tdengine', 2); +select substring('tdengine', 8); +select substring('tdengine', 1, 3); +select substring('tdengine', 2, 99); +select substring('tdengine', -1, 10); +select substring('中国', 1, 3); +select substring('中国tdengine', 1, 3); +select substring(var1, 1, 5) from ts_4893.d0 order by ts limit 10; +select substring(var1, 1, 5) from ts_4893.meters order by ts limit 10; +select substring(nch1, 1, 5) from ts_4893.d0 order by ts limit 10; +select substring(nch1, 1, 5) from ts_4893.meters order by ts limit 10; diff --git a/tests/army/query/function/in/substr_idx.err b/tests/army/query/function/in/substr_idx.err new file mode 100644 index 0000000000..9f34731d6d --- /dev/null +++ b/tests/army/query/function/in/substr_idx.err @@ -0,0 +1,8 @@ +select substring_index(); +select substring_index(, '.', 2); +select substring_index('www.taosdata.com', , 2); +select substring_index('www.taosdata.com', '.', ); +select substring_index(123456789, '7', 1); +select substring_index('www.taosdata.com', c, 0); +select substring_index('www.taosdata.com', '.', '2'); +select substring_index('www.taosdata.com', '.', 2, 3); diff --git a/tests/army/query/function/in/substr_idx.in b/tests/army/query/function/in/substr_idx.in index 4ab9fe84dc..ae278f0a7a 100644 --- a/tests/army/query/function/in/substr_idx.in +++ b/tests/army/query/function/in/substr_idx.in @@ -77,3 +77,17 @@ select substring_index(nch1, '123', id) from ts_4893.meters where position('123' select substring_index(var1, '123', 1) from ts_4893.meters where position('123' in var1) > 1 order by ts limit 5; select substring_index(var1, '123', -1) from ts_4893.meters where position('123' in var1) > 1 order by ts limit 5; select substring_index(var1, '123', id) from ts_4893.meters where position('123' in var1) > 1 order by ts limit 5; +select substring_index('www.taosdata.com', '.', 2); +select substring_index('www.taosdata.com', '.', -2); +select substring_index('中国.科学.www.taosdata.com', '.', 2); +select substring_index('北京。涛思。数据。科技', '。', 2); +select substring_index(nch1, 'a', 2) from ts_4893.d0 order by ts limit 10; +select substring_index(nch1, 'a', 2) from ts_4893.meters order by ts limit 10; +select substring_index(nch1, nch2, 2) from ts_4893.d0 order by ts limit 10; +select substring_index(nch1, nch2, 2) from ts_4893.meters order by ts limit 10; +select substring_index(nch1, var2, 2) from ts_4893.d0 order by ts limit 10; +select substring_index(nch1, var2, 2) from ts_4893.meters order by ts limit 10; +select substring_index(var1, nch2, 2) from ts_4893.d0 order by ts limit 10; +select substring_index(var1, nch2, 2) from ts_4893.meters order by ts limit 10; +select substring_index(var1, var2, 2) from ts_4893.d0 order by ts limit 10; +select substring_index(var1, var2, 2) from ts_4893.meters order by ts limit 10; diff --git a/tests/army/query/function/in/timediff.err b/tests/army/query/function/in/timediff.err new file mode 100644 index 0000000000..da7972db33 --- /dev/null +++ b/tests/army/query/function/in/timediff.err @@ -0,0 +1,5 @@ +select timediff(); +select timediff(, '2022-01-01 08:00:01',1s); +select timediff('2022-01-01 08:00:00', ,1s); +select timediff('2022-01-01 08:00:00', '2022-01-01 08:00:01',); +select timediff(1720769589123, 1720769529123, 2s); diff --git a/tests/army/query/function/in/timediff.in b/tests/army/query/function/in/timediff.in index 08dc9fbf18..0367d94a1a 100644 --- a/tests/army/query/function/in/timediff.in +++ b/tests/army/query/function/in/timediff.in @@ -70,4 +70,22 @@ select TIMEDIFF(1725095657, ts, 1h) from ts_4893.meters order by ts limit 10; select TIMEDIFF(ts, 1725095657, 1d) from ts_4893.meters order by ts limit 10; select TIMEDIFF(1725095657, ts, 1d) from ts_4893.meters order by ts limit 10; select TIMEDIFF(ts, 1725095657, 1w) from ts_4893.meters order by ts limit 10; -select TIMEDIFF(1725095657, ts, 1w) from ts_4893.meters order by ts limit 10; \ No newline at end of file +select TIMEDIFF(1725095657, ts, 1w) from ts_4893.meters order by ts limit 10; +select timediff('2022-01-01 08:00:00', '2022-01-01 08:00:10',1s); +select timediff('2023-01-01 08:00:00', '2022-01-01 08:00:00',1s); +select timediff('2022-01-01 08:00:03', '2022-01-01 08:00:00',1a); +select timediff('2022-01-31 08:00:00', '2022-01-01 08:00:00',1m); +select timediff('2022-01-31 08:00:00', '2022-01-01 08:00:00',1h); +select timediff('2022-01-31 08:00:00', '2022-01-01 08:00:00',1d); +select timediff('2022-01-31 08:00:00', '2022-01-01 08:00:00',1w); +select timediff('2022-01-31 08:00:00', '2022-01-01 08:00:00'); +select timediff('2022-01-31 08:00:0', '2022-01-01 08:00:00',1s); +select timediff('2022-01-31', '2022-01-01',1s); +select timediff(1720769589, 1720769529, 1s); +select timediff(1720769589123, 1720769529123, 1s); +select timediff(1720769589, '2022-01-01 08:00:00', 1s); +select timediff('2022-01-01 08:00:00', 1720769589, 1s); +select timediff(1720769589231, '2022-01-01 08:00:00', 1s); +select timediff('2022-01-01 08:00:00', 1720769589123, 1s); +select timediff(ts, 1720769589123, 1a) from ts_4893.d0 order by ts limit 10; +select timediff(ts, 1720769589123, 1a) from ts_4893.meters order by ts limit 10; diff --git a/tests/army/query/function/in/trim.err b/tests/army/query/function/in/trim.err new file mode 100644 index 0000000000..4e3f378beb --- /dev/null +++ b/tests/army/query/function/in/trim.err @@ -0,0 +1,3 @@ +select trim(); +select trim(123); +select trim(both 1 from 123); diff --git a/tests/army/query/function/in/trim.in b/tests/army/query/function/in/trim.in index ad94905aa8..6706dfd98a 100644 --- a/tests/army/query/function/in/trim.in +++ b/tests/army/query/function/in/trim.in @@ -98,3 +98,28 @@ select trim(var2 from '三abbcfp三a') from ts_4893.meters where position(var2 i select trim(both var2 from '三abbcfp三a') from ts_4893.meters where position(var2 in '三abbcfp三a') = 0 order by ts limit 5; select trim(leading var2 from '三abbcfp三a') from ts_4893.meters where position(var2 in '三abbcfp三a') = 0 order by ts limit 5; select trim(trailing var2 from '三abbcfp三a') from ts_4893.meters where position(var2 in '三abbcfp三a') = 0 order by ts limit 5; +select trim(' A '); +select trim(' 涛思 '); +select trim('a' FROM 'aaab bbba'); +select trim(LEADING FROM ' aaa '); +select trim(LEADING 'a' FROM ' aaa abab aaaa '); +select trim(LEADING 'a' FROM 'aaa abab aaaa '); +select trim(LEADING '北' FROM '北京涛思数据科技有限公司北'); +select trim(LEADING '北' FROM '北bei京涛思数据科技有限公司北'); +select trim(TRAILING FROM ' aaa abab aaaa '); +select trim(TRAILING 'a' FROM 'aaa abab aaaa'); +select trim(TRAILING 'a' FROM ' aaa abab aaaa'); +select trim(TRAILING '北' FROM '北京涛思数据科技有限公司北') as sub; +select trim(TRAILING '北' FROM '北京涛思数据科技有限公司bei北'); +select trim(BOTH FROM ' aaa abab aaaa '); +select trim(BOTH 'a' FROM ' aaa abab aaaa '); +select trim(BOTH 'a' FROM 'aaa abab aaaa'); +select trim(BOTH '北' FROM '北京涛思数据科技有限公司北'); +select trim(nch2 from nch1) from ts_4893.d0 order by ts limit 10; +select trim(nch2 from nch1) from ts_4893.meters order by ts limit 10; +select trim(nch2 from var1) from ts_4893.d0 order by ts limit 10; +select trim(nch2 from var1) from ts_4893.meters order by ts limit 10; +select trim(var2 from nch1) from ts_4893.d0 order by ts limit 10; +select trim(var2 from nch1) from ts_4893.meters order by ts limit 10; +select trim(var2 from var1) from ts_4893.d0 order by ts limit 10; +select trim(var2 from var1) from ts_4893.meters order by ts limit 10; diff --git a/tests/army/query/function/in/trunc.err b/tests/army/query/function/in/trunc.err new file mode 100644 index 0000000000..5338de04a8 --- /dev/null +++ b/tests/army/query/function/in/trunc.err @@ -0,0 +1,6 @@ +select truncate(); +select truncate(99.99,); +select truncate(, 3); +select truncate(99.99); +select truncate('12', 2); +select truncate(12, '1'); diff --git a/tests/army/query/function/in/trunc.in b/tests/army/query/function/in/trunc.in index 842e112f3e..a341cde4b5 100755 --- a/tests/army/query/function/in/trunc.in +++ b/tests/army/query/function/in/trunc.in @@ -26,3 +26,12 @@ select TRUNC(TRUNC(TRUNC(TRUNC(TRUNC(TRUNC(TRUNC(123456789.123456789, -1), -2), select TRUNC(87654321.123456789, id) from ts_4893.meters order by ts limit 10; select TRUNC(current, id) from ts_4893.meters order by ts limit 10; select TRUNC(current, 1) from ts_4893.meters order by ts limit 10; +select truncate(99.99, 3); +select truncate(99.99, 2); +select truncate(99.99, 1); +select truncate(99.99, 0); +select truncate(99.99, -1); +select truncate(99.99, -10); +select truncate(99, 1); +select truncate(current, 1) from ts_4893.d0 order by ts limit 10; +select truncate(current, 1) from ts_4893.meters order by ts limit 10; diff --git a/tests/army/query/function/in/varpop.err b/tests/army/query/function/in/varpop.err new file mode 100644 index 0000000000..54c9f35c2d --- /dev/null +++ b/tests/army/query/function/in/varpop.err @@ -0,0 +1,8 @@ +select var_pop() from ts_4893.d0; +select var_pop(ts) from ts_4893.d0; +select var_pop(name) from ts_4893.d0; +select var_pop(id, current) from ts_4893.d0; +select var_pop() from ts_4893.meters; +select var_pop(ts) from ts_4893.meters; +select var_pop(name) from ts_4893.meters; +select var_pop(id, current) from ts_4893.meters; diff --git a/tests/army/query/function/in/varpop.in b/tests/army/query/function/in/varpop.in index 0fbdaeda95..1a8f5e6149 100644 --- a/tests/army/query/function/in/varpop.in +++ b/tests/army/query/function/in/varpop.in @@ -4,3 +4,7 @@ select VAR_POP(id) from ts_4893.meters; select VAR_POP(id) from ts_4893.meters interval(1d) limit 10; select VAR_POP(id) from ts_4893.meters where id > 100; select VAR_POP(id) from ts_4893.meters interval(1d) order by 1 limit 10; +select var_pop(id) from ts_4893.d0; +select var_pop(id) from ts_4893.meters; +select var_pop(current) from ts_4893.d0; +select var_pop(current) from ts_4893.meters; diff --git a/tests/army/query/function/in/week.err b/tests/army/query/function/in/week.err new file mode 100644 index 0000000000..4b94ebfd36 --- /dev/null +++ b/tests/army/query/function/in/week.err @@ -0,0 +1,6 @@ +select week(); +select week(, 0); +select week('2000-01-01', ); +select week('2000-01-01', -1); +select week('2000-01-01', 8); +select week('2000-01-01', 1.0); diff --git a/tests/army/query/function/in/week.in b/tests/army/query/function/in/week.in index 1571e66f83..a6b2bf161a 100644 --- a/tests/army/query/function/in/week.in +++ b/tests/army/query/function/in/week.in @@ -60,3 +60,16 @@ select WEEK(ts, 4) from ts_4893.meters order by ts limit 10; select WEEK(ts, 5) from ts_4893.meters order by ts limit 10; select WEEK(ts, 6) from ts_4893.meters order by ts limit 10; select WEEK(ts, 7) from ts_4893.meters order by ts limit 10; +select week(123); +select week('2000-01-01',0); +select week('2000-01-01',1); +select week('2000-01-01',2); +select week('2000-01-01',3); +select week('2000-01-01',4); +select week('2000-01-01',5); +select week('2000-01-01',6); +select week('2000-01-01',7); +select week(1721020591,0); +select week('2020-01-01 00:00:00', 2); +select week(ts) from ts_4893.d0 order by ts limit 10; +select week(ts) from ts_4893.meters order by ts limit 10; diff --git a/tests/army/query/function/in/weekday.err b/tests/army/query/function/in/weekday.err new file mode 100644 index 0000000000..02c1714366 --- /dev/null +++ b/tests/army/query/function/in/weekday.err @@ -0,0 +1,2 @@ +select weekday(); +select weekday('01/01/2020', 2); diff --git a/tests/army/query/function/in/weekday.in b/tests/army/query/function/in/weekday.in index af5bf91137..7e73967047 100644 --- a/tests/army/query/function/in/weekday.in +++ b/tests/army/query/function/in/weekday.in @@ -10,4 +10,10 @@ select WEEKDAY('2000-01-06 00:00:00'); select WEEKDAY('2000-01-06 00:00:00') from ts_4893.meters order by ts limit 10; select WEEKDAY(1725095657); select WEEKDAY(1725095657) from ts_4893.meters order by ts limit 10; -select WEEKDAY(ts) from ts_4893.meters order by ts limit 10; \ No newline at end of file +select WEEKDAY(ts) from ts_4893.meters order by ts limit 10; +select weekday('2020-01-01'); +select weekday(1721020591); +select weekday(1721020666229); +select weekday('2020-01-01 00:00:00'); +select weekday(ts) from ts_4893.d0 order by ts limit 10; +select weekday(ts) from ts_4893.meters order by ts limit 10; diff --git a/tests/army/query/function/in/weekofyear.err b/tests/army/query/function/in/weekofyear.err new file mode 100644 index 0000000000..c220f91ca2 --- /dev/null +++ b/tests/army/query/function/in/weekofyear.err @@ -0,0 +1,2 @@ +select weekofyear(); +select weekofyear('2020-01-01',1); diff --git a/tests/army/query/function/in/weekofyear.in b/tests/army/query/function/in/weekofyear.in index e12343141c..8ac1b745ab 100644 --- a/tests/army/query/function/in/weekofyear.in +++ b/tests/army/query/function/in/weekofyear.in @@ -10,4 +10,9 @@ select WEEKOFYEAR('2000-01-06 00:00:00'); select WEEKOFYEAR('2000-01-06 00:00:00') from ts_4893.meters order by ts limit 10; select WEEKOFYEAR(1725095657); select WEEKOFYEAR(1725095657) from ts_4893.meters order by ts limit 10; -select WEEKOFYEAR(ts) from ts_4893.meters order by ts limit 10; \ No newline at end of file +select WEEKOFYEAR(ts) from ts_4893.meters order by ts limit 10; +select weekofyear('2020-01-01'); +select weekofyear(1721020666); +select weekofyear(1721020666229); +select weekofyear(ts) from ts_4893.d0 order by ts limit 10; +select weekofyear(ts) from ts_4893.meters order by ts limit 10; diff --git a/tests/army/query/function/test_function.py b/tests/army/query/function/test_function.py index ab2a962d03..77967f7815 100644 --- a/tests/army/query/function/test_function.py +++ b/tests/army/query/function/test_function.py @@ -19,7 +19,6 @@ import taos import frame import frame.etool - from frame.log import * from frame.cases import * from frame.sql import * @@ -29,14 +28,13 @@ from frame import * class TDTestCase(TBase): updatecfgDict = { - "keepColumnName" : "1", - "ttlChangeOnWrite" : "1", - "querySmaOptimize" : "1", - "slowLogScope" : "none", - "queryBufferSize" : 10240 + "keepColumnName": "1", + "ttlChangeOnWrite": "1", + "querySmaOptimize": "1", + "slowLogScope": "none", + "queryBufferSize": 10240 } - def insertData(self): tdLog.info(f"insert data.") # taosBenchmark run @@ -71,59 +69,448 @@ class TDTestCase(TBase): tdSql.checkDataCsvByLine(sql_statement, ansFile) # 清空 sql_statement 以便处理下一条语句 sql_statement = '' + err_file_path = etool.curFile(__file__, f"in/{testCase}.err") + if not os.path.isfile(err_file_path): + return None + with open(err_file_path, 'r') as err_file: + err_statement = '' + for line in err_file: + if not line.strip() or line.strip().startswith('--'): + continue + + err_statement += line.strip() + + if err_statement.endswith(';'): + tdSql.error(err_statement) + err_statement = '' def test_pi(self): self.test_normal_query("pi") def test_round(self): self.test_normal_query("round") + + tdSql.query("select round(10, null);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select round(null, 2);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + def test_exp(self): self.test_normal_query("exp") + tdSql.query("select exp(null);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + def test_trunc(self): self.test_normal_query("trunc") + + tdSql.query("select truncate(99.99, null);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select truncate(null, 3);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + def test_ln(self): self.test_normal_query("ln") + + tdSql.query("select ln(null);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + def test_mod(self): self.test_normal_query("mod") + + tdSql.query("select mod(null, 2);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select mod(10, null);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select mod(10, 0);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + def test_sign(self): self.test_normal_query("sign") + + tdSql.query("select sign(null);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + def test_degrees(self): self.test_normal_query("degrees") + + tdSql.query("select degrees(null);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + def test_radians(self): self.test_normal_query("radians") + + tdSql.query("select radians(null);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + def test_char_length(self): self.test_normal_query("char_length") + + tdSql.query("select char_length(null);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + def test_char(self): self.test_normal_query("char") + + tdSql.query("select char(null);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, '') + + tdSql.query("select char('ustc');") + tdSql.checkRows(1) + tdSql.checkData(0, 0, chr(0)) + + result1 = [[chr(0)], [chr(1)], [chr(2)], [chr(3)], [chr(4)], [chr(5)], [chr(6)], [chr(7)], [chr(8)], [chr(9)]] + tdSql.checkDataMem("select char(id) from ts_4893.d0 limit 10;", result1) + tdSql.checkDataMem("select char(id) from ts_4893.meters limit 10;", result1) + + result2 = [[chr(0)], [chr(0)], [chr(0)], [chr(0)], [chr(0)], [chr(0)], [chr(0)], [chr(0)], [chr(0)], [chr(0)]] + tdSql.checkDataMem("select char(nch1) from ts_4893.d0 limit 10;", result2) + tdSql.checkDataMem("select char(nch1) from ts_4893.meters limit 10;", result2) + + tdSql.checkDataMem("select char(var1) from ts_4893.d0 limit 10;", result2) + tdSql.checkDataMem("select char(var1) from ts_4893.meters limit 10;", result2) + def test_ascii(self): self.test_normal_query("ascii") + + tdSql.query("select ascii(null);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + def test_position(self): self.test_normal_query("position") + + tdSql.query("select position('t' in null);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select position(null in 'taos');") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + def test_replace(self): self.test_normal_query("replace") + + tdSql.query("select replace(null, 'aa', 'ee');") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select replace('aabbccdd', null, 'ee');") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + def test_repeat(self): self.test_normal_query("repeat") + + tdSql.query("select repeat('taos', null);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select repeat(null, 3);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select repeat('taos', 0);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, '') + def test_substr(self): self.test_normal_query("substr") + + tdSql.query("select substring('tdengine', null, 3);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select substring(null, 1, 3);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select substring('tdengine', 1, null);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select substring('tdengine', 0);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, '') + + tdSql.query("select substring('tdengine', 10);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, '') + + tdSql.query("select substring('tdengine', 1, 0);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, '') + + tdSql.query("select substring('tdengine', 1, -1);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, '') + def test_substr_idx(self): self.test_normal_query("substr_idx") + + tdSql.query("select substring_index(null, '.', 2);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select substring_index('www.taosdata.com', null, 2);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select substring_index('www.taosdata.com', '.', null);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select substring_index('www.taosdata.com', '.', 0);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, '') + def test_trim(self): self.test_normal_query("trim") + + tdSql.query("select trim(null);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + def test_timediff(self): self.test_normal_query("timediff") + + tdSql.query("select timediff(null, '2022-01-01 08:00:01',1s);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select timediff('2022-01-01 08:00:00', null,1s);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select timediff('2022/01/31', '2022/01/01',1s);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select timediff('20220131', '20220101',1s);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select timediff('22/01/31', '22/01/01',1s);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select timediff('01/31/22', '01/01/22',1s);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select timediff('31-JAN-22', '01-JAN-22',1s);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select timediff('22/01/31', '22/01/01');") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select timediff('www', 'ttt');") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + def test_week(self): self.test_normal_query("week") + + tdSql.query("select week(null, 0);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select week('abc');") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select week('1721020591', 0);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select week('1721020666229', 0);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select week('01/01/2020', 2);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select week('20200101', 2);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select week('20/01/01', 2);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select week('11/01/31', 2);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select week('01-JAN-20', 2);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + def test_weekday(self): self.test_normal_query("weekday") + + tdSql.query("select weekday(null);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select weekday('1721020591');") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select weekday('1721020666229');") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select weekday('abc');") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select weekday('01/01/2020');") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select weekday('20200101');") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select weekday('20/01/01');") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select weekday('11/01/32');") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select weekday('01-JAN-20');") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + def test_weekofyear(self): self.test_normal_query("weekofyear") + + tdSql.query("select weekofyear(null);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select weekofyear('1721020591');") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select weekofyear('1721020666229');") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select weekofyear('abc');") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select weekofyear('01/01/2020');") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select weekofyear('20200101');") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select weekofyear('20/01/01');") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select weekofyear('11/01/31');") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select weekofyear('01-JAN-20');") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + def test_dayofweek(self): self.test_normal_query("dayofweek") + + tdSql.query("select dayofweek(null);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select dayofweek('1721020591');") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select dayofweek('1721020666229');") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select dayofweek('abc');") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select dayofweek('01/01/2020');") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select dayofweek('20200101');") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select dayofweek('20/01/01');") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select dayofweek('11/01/31');") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select dayofweek('01-JAN-20');") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + def test_stddev(self): self.test_normal_query("stddev") + + tdSql.query("select stddev_pop(null) from ts_4893.d0;") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select stddev_pop(null) from ts_4893.meters;") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + def test_varpop(self): self.test_normal_query("varpop") + + tdSql.query("select var_pop(null) from ts_4893.d0;") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select var_pop(null) from ts_4893.meters;") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + def test_error(self): + tdSql.error( + "select * from (select to_iso8601(ts, timezone()), timezone() from meters order by ts desc) limit 1000;", + expectErrInfo="Not supported timzone format") # TS-5340 + # run def run(self): tdLog.debug(f"start to excute {__file__}") @@ -163,8 +550,11 @@ class TDTestCase(TBase): # agg function self.test_stddev() self.test_varpop() - tdLog.success(f"{__file__} successfully executed") + # error function + self.test_error() + + tdLog.success(f"{__file__} successfully executed") tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/query/query_basic.py b/tests/army/query/query_basic.py index f700ee3153..979db9eeb4 100644 --- a/tests/army/query/query_basic.py +++ b/tests/army/query/query_basic.py @@ -225,6 +225,11 @@ class TDTestCase(TBase): sql2 = "select bi from stb where bi is not null order by bi desc limit 10;" self.checkSameResult(sql1, sql2) + # same as by TD-31726 + sql1 = "select fc as a, dc as a from stb limit 5;" + sql2 = "select * from (select fc as a, dc as a from stb)t limit 5;" + self.checkSameResult(sql1, sql2) + # distributed expect values expects = { "Block_Rows" : 6*100000, diff --git a/tests/army/query/window/base.py b/tests/army/query/window/base.py new file mode 100644 index 0000000000..c5be1207b5 --- /dev/null +++ b/tests/army/query/window/base.py @@ -0,0 +1,48 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame import etool + + +class TDTestCase: + # init + def init(self, conn, logSql, replicaVar=1): + self.replicaVar = int(replicaVar) + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor(), True) + # taosBenchmark run + tdLog.info(f"insert data.") + jfile = etool.curFile(__file__, "window.json") + etool.benchMark(json=jfile) + + # run + def run(self): + # TD-31660 + sql = "select _wstart,_wend,count(voltage),tbname from db.stb partition by tbname event_window start with voltage >2 end with voltage > 15 slimit 5 limit 5" + tdSql.query(sql) + tdSql.checkRows(25) + sql = "select _wstart,_wend,count(voltage),tbname from db.stb partition by tbname count_window(600) slimit 5 limit 5;" + tdSql.query(sql) + tdSql.checkRows(25) + + # stop + def stop(self): + tdSql.execute("drop database db;") + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/army/query/window/window.json b/tests/army/query/window/window.json new file mode 100644 index 0000000000..8d3f0ae328 --- /dev/null +++ b/tests/army/query/window/window.json @@ -0,0 +1,123 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "connection_pool_size": 8, + "num_of_records_per_req": 4000, + "prepared_rand": 10000, + "thread_count": 3, + "create_table_thread_count": 1, + "confirm_parameter_prompt": "no", + "databases": [ + { + "dbinfo": { + "name": "db", + "drop": "yes", + "vgroups": 3, + "replica": 1, + "duration": "3d", + "wal_retention_period": 1, + "wal_retention_size": 1, + "stt_trigger": 1 + }, + "super_tables": [ + { + "name": "stb", + "child_table_exists": "no", + "childtable_count": 6, + "insert_rows": 100000, + "childtable_prefix": "d", + "insert_mode": "taosc", + "timestamp_step": 30000, + "start_timestamp": 1700000000000, + "columns": [ + { + "type": "bool", + "name": "bc" + }, + { + "type": "float", + "name": "fc" + }, + { + "type": "double", + "name": "voltage", + "max": 250, + "min": 200 + }, + { + "type": "tinyint", + "name": "ti" + }, + { + "type": "smallint", + "name": "si" + }, + { + "type": "int", + "name": "ic" + }, + { + "type": "bigint", + "name": "bi" + }, + { + "type": "utinyint", + "name": "uti" + }, + { + "type": "usmallint", + "name": "usi" + }, + { + "type": "uint", + "name": "ui" + }, + { + "type": "ubigint", + "name": "ubi" + }, + { + "type": "binary", + "name": "bin", + "len": 8 + }, + { + "type": "nchar", + "name": "nch", + "len": 16 + } + ], + "tags": [ + { + "type": "tinyint", + "name": "groupid", + "max": 10, + "min": 1 + }, + { + "name": "location", + "type": "binary", + "len": 16, + "values": [ + "San Francisco", + "Los Angles", + "San Diego", + "San Jose", + "Palo Alto", + "Campbell", + "Mountain View", + "Sunnyvale", + "Santa Clara", + "Cupertino" + ] + } + ] + } + ] + } + ] +} diff --git a/tests/army/storage/compressBasic.py b/tests/army/storage/compressBasic.py index 0d62ab9e8b..f24c4dd288 100644 --- a/tests/army/storage/compressBasic.py +++ b/tests/army/storage/compressBasic.py @@ -279,6 +279,12 @@ class TDTestCase(TBase): # alter error sqls = [ + f"alter table {tbname} add column a1 int ONLYOPTION", + f"alter table {tbname} add column a1 int 'simple8b';", + f"alter table {tbname} add column a1 int WRONG 'simple8b';", + f"alter table {tbname} add column a1 int 123456789 'simple8b';", + f"alter table {tbname} add column a1 int WRONGANDVERYLONG 'simple8b';", + f"alter table {tbname} add column a1 int ENCODE 'veryveryveryveryveryverylong';", f"alter table {tbname} add column a1 int ENCODE 'simple8bAA';", f"alter table {tbname} add column a2 int COMPRESS 'AABB';", f"alter table {tbname} add column a3 bigint LEVEL 'high1';", diff --git a/tests/ci/count_assert.py b/tests/ci/count_assert.py new file mode 100644 index 0000000000..415c197b3f --- /dev/null +++ b/tests/ci/count_assert.py @@ -0,0 +1,53 @@ +import os +import re + +# List of source directories to search +source_dirs = [ + "community/source", + "community/include", + "enterprise/src/plugins/" +] + +# List of directories to exclude +exclude_dirs = [ + "community/source/client/jni" +] + +# List of files to exclude +exclude_source_files = [ + "community/source/libs/parser/src/sql.c", + "community/source/util/src/tlog.c", + "community/include/util/tlog.h" +] + +def grep_asserts_in_file(file_path, summary_list, detaild_list): + """Search for assert, ASSERTS, or ASSERT function calls in a file and print them.""" + match_count = 0 + with open(file_path, 'r') as file: + for line_number, line in enumerate(file, start=1): + if re.search(r'\bassert\(.*\)|\bASSERT\(.*\)|\bASSERTS\(.*\)|\bASSERT_CORE\(.*\)', line): + detaild_list.append(f"{file_path}:{line_number}: {line.strip()}") + match_count += 1 + if match_count > 0: + summary_list.append(f"Total matches in {file_path}: {match_count}") + +def traverse_and_grep(source_dirs, exclude_dirs, exclude_source_files): + """Traverse directories and grep for assert, ASSERTS, or ASSERT function calls in .h and .c files.""" + summary_list = [] + detaild_list = [] + for source_dir in source_dirs: + for root, _, files in os.walk(source_dir): + # Skip directories named 'test' or 'tests' and directories in exclude_dirs + if 'test' in root.split(os.sep) or 'tests' in root.split(os.sep) or any(excluded in root for excluded in exclude_dirs): + continue + for file in files: + if file.endswith((".h", ".c")): + file_path = os.path.join(root, file) + if file_path not in exclude_source_files: + grep_asserts_in_file(file_path, summary_list, detaild_list) + return summary_list, detaild_list + +if __name__ == "__main__": + summary_list, detaild_list = traverse_and_grep(source_dirs, exclude_dirs, exclude_source_files) + print("\n".join(summary_list)) + # print("\n".join(detaild_list)) \ No newline at end of file diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 7a20898911..ea459959e9 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -41,6 +41,7 @@ ,,y,army,./pytest.sh python3 ./test.py -f tmq/tmqBugs.py -N 3 ,,y,army,./pytest.sh python3 ./test.py -f query/fill/fill_compare_asc_desc.py ,,y,army,./pytest.sh python3 ./test.py -f query/last/test_last.py +,,y,army,./pytest.sh python3 ./test.py -f query/window/base.py # # system test @@ -144,6 +145,7 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/tsma2.py -Q 2 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/tsma2.py -Q 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/tsma2.py -Q 4 +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/nestedQuery2.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqShow.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDropStb.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/subscribeStb0.py @@ -227,6 +229,7 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/dropDbR3ConflictTransaction.py -N 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/basic5.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/subscribeDb.py -N 3 -n 3 +,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/ts-4674.py -N 3 -n 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/subscribeDb1.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/subscribeDb2.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/subscribeDb3.py @@ -313,7 +316,7 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/balance_vgroups_r1.py -N 6 ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/taosShell.py ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/taosShellError.py -,,n,system-test,python3 ./test.py -f 0-others/taosShellNetChk.py +,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/taosShellNetChk.py ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/telemetry.py ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/backquote_check.py ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/taosdMonitor.py diff --git a/tests/system-test/2-query/To_iso8601.py b/tests/system-test/2-query/To_iso8601.py index 24865ada88..89924a009e 100644 --- a/tests/system-test/2-query/To_iso8601.py +++ b/tests/system-test/2-query/To_iso8601.py @@ -146,6 +146,7 @@ class TDTestCase: err_param = [1.5,'a','c2'] for i in err_param: tdSql.error(f"select to_iso8601({i}) from db.ntb") + tdSql.error(f"select to_iso8601(ts, timezone()) from db.stb") tdSql.query("select to_iso8601(now) from db.stb") tdSql.checkRows(3) tdSql.query("select to_iso8601(now()) from db.stb") diff --git a/tests/system-test/2-query/nestedQuery2.py b/tests/system-test/2-query/nestedQuery2.py new file mode 100644 index 0000000000..dce119b1f2 --- /dev/null +++ b/tests/system-test/2-query/nestedQuery2.py @@ -0,0 +1,167 @@ +from random import randrange +import time +import threading +import secrets +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import * +from util.common import * +# from tmqCommon import * + +class TDTestCase: + updatecfgDict = {'asynclog': 0, 'ttlUnit': 1, 'ttlPushInterval': 5, 'ratioOfVnodeStreamThrea': 4} + + def __init__(self): + self.vgroups = 4 + self.ctbNum = 10 + self.rowsPerTbl = 10000 + self.duraion = '1h' + + def init(self, conn, logSql, replicaVar=1): + self.replicaVar = int(replicaVar) + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor(), False) + + def create_database(self, tsql, dbName, dropFlag=1, vgroups=2, replica=1, duration: str = '1d'): + if dropFlag == 1: + tsql.execute("drop database if exists %s" % (dbName)) + + tsql.execute("create database if not exists %s vgroups %d replica %d duration %s" % ( + dbName, vgroups, replica, duration)) + tdLog.debug("complete to create database %s" % (dbName)) + return + + def create_stable(self, tsql, paraDict): + colString = tdCom.gen_column_type_str( + colname_prefix=paraDict["colPrefix"], column_elm_list=paraDict["colSchema"]) + tagString = tdCom.gen_tag_type_str( + tagname_prefix=paraDict["tagPrefix"], tag_elm_list=paraDict["tagSchema"]) + sqlString = f"create table if not exists %s.%s (%s) tags (%s)" % ( + paraDict["dbName"], paraDict["stbName"], colString, tagString) + tdLog.debug("%s" % (sqlString)) + tsql.execute(sqlString) + return + + def create_ctable(self, tsql=None, dbName='dbx', stbName='stb', ctbPrefix='ctb', ctbNum=1, ctbStartIdx=0): + for i in range(ctbNum): + sqlString = "create table %s.%s%d using %s.%s tags(%d, 'tb%d', 'tb%d', %d, %d, %d)" % (dbName, ctbPrefix, i+ctbStartIdx, dbName, stbName, (i+ctbStartIdx) % 5, i+ctbStartIdx + random.randint( + 1, 100), i+ctbStartIdx + random.randint(1, 100), i+ctbStartIdx + random.randint(1, 100), i+ctbStartIdx + random.randint(1, 100), i+ctbStartIdx + random.randint(1, 100)) + tsql.execute(sqlString) + + tdLog.debug("complete to create %d child tables by %s.%s" % + (ctbNum, dbName, stbName)) + return + + def init_normal_tb(self, tsql, db_name: str, tb_name: str, rows: int, start_ts: int, ts_step: int): + sql = 'CREATE TABLE %s.%s (ts timestamp, c1 INT, c2 INT, c3 INT, c4 double, c5 VARCHAR(255))' % ( + db_name, tb_name) + tsql.execute(sql) + sql = 'INSERT INTO %s.%s values' % (db_name, tb_name) + for j in range(rows): + sql += f'(%d, %d,%d,%d,{random.random()},"varchar_%d"),' % (start_ts + j * ts_step + randrange(500), j % + 10 + randrange(200), j % 10, j % 10, j % 10 + randrange(100)) + tsql.execute(sql) + + def insert_data(self, tsql, dbName, ctbPrefix, ctbNum, rowsPerTbl, batchNum, startTs, tsStep): + tdLog.debug("start to insert data ............") + tsql.execute("use %s" % dbName) + pre_insert = "insert into " + sql = pre_insert + + for i in range(ctbNum): + rowsBatched = 0 + sql += " %s.%s%d values " % (dbName, ctbPrefix, i) + for j in range(rowsPerTbl): + if (i < ctbNum/2): + sql += "(%d, %d, %d, %d,%d,%d,%d,true,'binary%d', 'nchar%d') " % (startTs + j*tsStep + randrange( + 500), j % 10 + randrange(100), j % 10 + randrange(200), j % 10, j % 10, j % 10, j % 10, j % 10, j % 10) + else: + sql += "(%d, %d, NULL, %d,NULL,%d,%d,true,'binary%d', 'nchar%d') " % ( + startTs + j*tsStep + randrange(500), j % 10, j % 10, j % 10, j % 10, j % 10, j % 10) + rowsBatched += 1 + if ((rowsBatched == batchNum) or (j == rowsPerTbl - 1)): + tsql.execute(sql) + rowsBatched = 0 + if j < rowsPerTbl - 1: + sql = "insert into %s.%s%d values " % (dbName, ctbPrefix, i) + else: + sql = "insert into " + if sql != pre_insert: + tsql.execute(sql) + tdLog.debug("insert data ............ [OK]") + return + + def init_data(self, db: str = 'test', ctb_num: int = 10, rows_per_ctb: int = 10000, start_ts: int = 1537146000000, ts_step: int = 500): + tdLog.printNoPrefix( + "======== prepare test env include database, stable, ctables, and insert data: ") + paraDict = {'dbName': db, + 'dropFlag': 1, + 'vgroups': 2, + 'stbName': 'meters', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count': 1}, {'type': 'BIGINT', 'count': 1}, {'type': 'FLOAT', 'count': 1}, {'type': 'DOUBLE', 'count': 1}, {'type': 'smallint', 'count': 1}, {'type': 'tinyint', 'count': 1}, {'type': 'bool', 'count': 1}, {'type': 'binary', 'len': 10, 'count': 1}, {'type': 'nchar', 'len': 10, 'count': 1}], + 'tagSchema': [{'type': 'INT', 'count': 1}, {'type': 'nchar', 'len': 20, 'count': 1}, {'type': 'binary', 'len': 20, 'count': 1}, {'type': 'BIGINT', 'count': 1}, {'type': 'smallint', 'count': 1}, {'type': 'DOUBLE', 'count': 1}], + 'ctbPrefix': 't', + 'ctbStartIdx': 0, + 'ctbNum': ctb_num, + 'rowsPerTbl': rows_per_ctb, + 'batchNum': 3000, + 'startTs': start_ts, + 'tsStep': ts_step} + + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = ctb_num + paraDict['rowsPerTbl'] = rows_per_ctb + + tdLog.info("create database") + self.create_database(tsql=tdSql, dbName=paraDict["dbName"], dropFlag=paraDict["dropFlag"], + vgroups=paraDict["vgroups"], replica=self.replicaVar, duration=self.duraion) + + tdLog.info("create stb") + self.create_stable(tsql=tdSql, paraDict=paraDict) + + tdLog.info("create child tables") + self.create_ctable(tsql=tdSql, dbName=paraDict["dbName"], + stbName=paraDict["stbName"], ctbPrefix=paraDict["ctbPrefix"], + ctbNum=paraDict["ctbNum"], ctbStartIdx=paraDict["ctbStartIdx"]) + self.insert_data(tsql=tdSql, dbName=paraDict["dbName"], + ctbPrefix=paraDict["ctbPrefix"], ctbNum=paraDict["ctbNum"], + rowsPerTbl=paraDict["rowsPerTbl"], batchNum=paraDict["batchNum"], + startTs=paraDict["startTs"], tsStep=paraDict["tsStep"]) + self.init_normal_tb(tdSql, paraDict['dbName'], 'norm_tb', + paraDict['rowsPerTbl'], paraDict['startTs'], paraDict['tsStep']) + + def test_select_asterisk_from_subquery_with_duplicate_aliasname(self): + sql = "select * from (select c8 as a, c9 as a from t1 order by ts desc limit 10)t;" + tdSql.query(sql, queryTimes=1) + tdSql.checkData(0, 0, "binary9") + tdSql.checkData(0, 1, "nchar9") + sql = "select * from (select c8 as a, c9 as a, ts from t1 order by ts desc limit 10)t order by ts desc;" + tdSql.query(sql, queryTimes=1) + tdSql.checkData(0, 0, "binary9") + tdSql.checkData(0, 1, "nchar9") + sql = "select * from (select c8 as a, c9 as a, ts, t1 from t1 order by ts desc limit 10)t partition by t1 order by ts desc;" + tdSql.query(sql, queryTimes=1) + tdSql.checkData(0, 0, "binary9") + tdSql.checkData(0, 1, "nchar9") + sql = " select * from (select a.c8, b.c8, a.ts, a.t1,b.t1 from t1 a, t3 b where a.ts = b.ts order by a.ts)ttt" + tdSql.query(sql, queryTimes=1) + + tdSql.checkData(0, 3, 1) + tdSql.checkData(0, 4, 3) + + def run(self): + self.init_data() + self.test_select_asterisk_from_subquery_with_duplicate_aliasname() + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + + +event = threading.Event() + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/system-test/2-query/tbname_vgroup.py b/tests/system-test/2-query/tbname_vgroup.py index 564c78b47a..7a76a07e7c 100644 --- a/tests/system-test/2-query/tbname_vgroup.py +++ b/tests/system-test/2-query/tbname_vgroup.py @@ -169,7 +169,7 @@ class TDTestCase: tdSql.checkData(3, 2, 4) tdSql.query("explain select * from st where tbname='ct1'") - tdSql.checkRows(2) + tdSql.checkRows(1) tdSql.query("select table_name, vgroup_id from information_schema.ins_tables where db_name='dbvg' and type='CHILD_TABLE'"); print(tdSql.queryResult); diff --git a/tests/system-test/7-tmq/ts-4674.py b/tests/system-test/7-tmq/ts-4674.py new file mode 100644 index 0000000000..709debaef1 --- /dev/null +++ b/tests/system-test/7-tmq/ts-4674.py @@ -0,0 +1,157 @@ + +import taos +import sys +import time +import socket +import os +import threading + +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import * +from util.common import * +from taos.tmq import * +sys.path.append("./7-tmq") +from tmqCommon import * + +class TDTestCase: + clientCfgDict = {'debugFlag': 135} + updatecfgDict = {'debugFlag': 135, 'clientCfg':clientCfgDict} + # updatecfgDict = {'debugFlag': 135, 'clientCfg':clientCfgDict, 'tmqRowSize':1} + + def init(self, conn, logSql, replicaVar=1): + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor()) + + #tdSql.init(conn.cursor(), logSql) # output sql.txt file + + # def consume_TS_4674_Test(self): + # + # os.system("nohup taosBenchmark -y -B 1 -t 4 -S 1000 -n 1000000 -i 1000 -v 1 -a 3 > /dev/null 2>&1 &") + # time.sleep() + # tdSql.execute(f'create topic topic_all with meta as database test') + # consumer_dict = { + # "group.id": "g1", + # "td.connect.user": "root", + # "td.connect.pass": "taosdata", + # "auto.offset.reset": "earliest", + # } + # consumer = Consumer(consumer_dict) + # + # try: + # consumer.subscribe(["topic_all"]) + # except TmqError: + # tdLog.exit(f"subscribe error") + # + # try: + # while True: + # res = consumer.poll(5) + # if not res: + # print(f"null") + # continue + # val = res.value() + # if val is None: + # print(f"null") + # continue + # cnt = 0; + # for block in val: + # cnt += len(block.fetchall()) + # + # print(f"block {cnt} rows") + # + # finally: + # consumer.close() + + def get_leader(self): + tdLog.debug("get leader") + tdSql.query("show vnodes") + for result in tdSql.queryResult: + if result[3] == 'leader': + tdLog.debug("leader is %d"%(result[0])) + return result[0] + return -1 + + def balance_vnode(self): + leader_before = self.get_leader() + + while True: + leader_after = -1 + tdSql.query("balance vgroup leader") + while True: + leader_after = self.get_leader() + if leader_after != -1 : + break; + else: + time.sleep(1) + if leader_after != leader_before: + tdLog.debug("leader changed") + break; + else : + time.sleep(1) + + + def consume_TS_4674_Test(self): + + tdSql.execute(f'create database if not exists d1 replica 3 vgroups 1') + tdSql.execute(f'use d1') + tdSql.execute(f'create table st(ts timestamp, i int) tags(t int)') + tdSql.execute(f'insert into t1 using st tags(1) values(now, 1) (now+1s, 2)') + tdSql.execute(f'insert into t2 using st tags(2) values(now, 1) (now+1s, 2)') + tdSql.execute(f'insert into t3 using st tags(3) values(now, 1) (now+1s, 2)') + + + tdSql.execute(f'create topic topic_all as select * from st') + consumer_dict = { + "group.id": "g1", + "td.connect.user": "root", + "td.connect.pass": "taosdata", + "auto.offset.reset": "earliest", + } + consumer = Consumer(consumer_dict) + + try: + consumer.subscribe(["topic_all"]) + except TmqError: + tdLog.exit(f"subscribe error") + + cnt = 0; + balance = False + try: + while True: + res = consumer.poll(2) + if not res: + print(f"null res") + if balance == False and cnt != 6 : + tdLog.exit(f"subscribe num != 6") + if balance == True : + if cnt != 8 : + tdLog.exit(f"subscribe num != 8") + # tdLog.debug(f"subscribe num != 8") + # continue + else : + break + self.balance_vnode() + balance = True + tdSql.execute(f'insert into t1 using st tags(1) values(now+5s, 11) (now+10s, 12)') + continue + val = res.value() + if val is None: + print(f"null val") + continue + for block in val: + cnt += len(block.fetchall()) + + print(f"block {cnt} rows") + + finally: + consumer.close() + def run(self): + self.consume_TS_4674_Test() + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tools/shell/src/shellEngine.c b/tools/shell/src/shellEngine.c index 6da6f05c67..84da746afd 100644 --- a/tools/shell/src/shellEngine.c +++ b/tools/shell/src/shellEngine.c @@ -613,14 +613,14 @@ void shellPrintGeometry(const unsigned char *val, int32_t length, int32_t width) code = initCtxAsText(); if (code != TSDB_CODE_SUCCESS) { - shellPrintString(getThreadLocalGeosCtx()->errMsg, width); + shellPrintString(getGeosErrMsg(code), width); return; } char *outputWKT = NULL; code = doAsText(val, length, &outputWKT); if (code != TSDB_CODE_SUCCESS) { - shellPrintString(getThreadLocalGeosCtx()->errMsg, width); // should NOT happen + shellPrintString(getGeosErrMsg(code), width); // should NOT happen return; } @@ -1284,7 +1284,6 @@ void *shellThreadLoop(void *arg) { taosResetTerminalMode(); } while (shellRunCommand(command, true) == 0); - destroyThreadLocalGeosCtx(); taosMemoryFreeClear(command); shellWriteHistory(); shellExit(); diff --git a/utils/test/c/CMakeLists.txt b/utils/test/c/CMakeLists.txt index db5eb21ad8..e5902856e6 100644 --- a/utils/test/c/CMakeLists.txt +++ b/utils/test/c/CMakeLists.txt @@ -7,6 +7,7 @@ add_executable(write_raw_block_test write_raw_block_test.c) add_executable(sml_test sml_test.c) add_executable(get_db_name_test get_db_name_test.c) add_executable(tmq_offset tmqOffset.c) +add_executable(tmq_multi_thread_test tmq_multi_thread_test.c) add_executable(tmq_offset_test tmq_offset_test.c) add_executable(varbinary_test varbinary_test.c) add_executable(replay_test replay_test.c) @@ -22,6 +23,15 @@ target_link_libraries( PUBLIC common PUBLIC os ) + +target_link_libraries( + tmq_multi_thread_test + PUBLIC taos + PUBLIC util + PUBLIC common + PUBLIC os +) + target_link_libraries( create_table PUBLIC taos diff --git a/utils/test/c/tmq_multi_thread_test.c b/utils/test/c/tmq_multi_thread_test.c new file mode 100644 index 0000000000..0b6117c89b --- /dev/null +++ b/utils/test/c/tmq_multi_thread_test.c @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#include +#include +#include +#include +#include +#include "taos.h" +#include "types.h" + +void* consumeThreadFunc(void* param) { + int32_t* index = (int32_t*) param; + tmq_conf_t* conf = tmq_conf_new(); + char groupId[64] = {0}; + int64_t t = taosGetTimestampMs(); + sprintf(groupId, "group_%"PRId64"_%d", t, *index); + tmq_conf_set(conf, "enable.auto.commit", "false"); + tmq_conf_set(conf, "auto.commit.interval.ms", "2000"); + tmq_conf_set(conf, "group.id", groupId); + tmq_conf_set(conf, "td.connect.user", "root"); + tmq_conf_set(conf, "td.connect.pass", "taosdata"); + tmq_conf_set(conf, "auto.offset.reset", "earliest"); + tmq_conf_set(conf, "msg.with.table.name", "false"); + + tmq_t* tmq = tmq_consumer_new(conf, NULL, 0); + tmq_conf_destroy(conf); + + // 创建订阅 topics 列表 + tmq_list_t* topicList = tmq_list_new(); + tmq_list_append(topicList, "select_d4"); + + // 启动订阅 + tmq_subscribe(tmq, topicList); + tmq_list_destroy(topicList); + + int32_t timeout = 200; + int32_t totalRows = 0; + while (1) { + printf("start to poll\n"); + + TAOS_RES *pRes = tmq_consumer_poll(tmq, timeout); + if (pRes) { + int32_t rows = 0; + void* data = NULL; + taos_fetch_raw_block(pRes, &rows, &data); + + totalRows+=rows; + int cols = taos_num_fields(pRes); + for(int32_t i = 0; i < cols; ++i) { + int64_t start = taosGetTimestampUs(); + for (int32_t j = 0; j < rows; ++j) { + //int64_t t1 = taosGetTimestampUs(); + taos_is_null(pRes, j, i); + //int64_t t2 = taosGetTimestampUs(); + //printf("taos_is_null gourp:%s cost %"PRId64" us\n", groupId, t2 - t1); + } + int64_t end = taosGetTimestampUs(); + bool* isNULL = taosMemoryCalloc(rows, sizeof(bool)); + int code = taos_is_null_by_column(pRes, i, isNULL, &rows); + printf("taos_fetch_raw_block gourp:%s total rows:%d cost %"PRId64" us, code:%d\n", groupId, totalRows, end - start, code); + } + + taos_free_result(pRes); + } else { + printf("no data\n"); + break; + } + } + tmq_consumer_close(tmq); + return NULL; +} + +int main(int argc, char* argv[]) { + if (argc != 2) { + printf("Usage: %s \n", argv[0]); + return 0; + } + + int32_t numOfThread = atoi(argv[1]); + TdThread *thread = taosMemoryCalloc(numOfThread, sizeof(TdThread)); + TdThreadAttr thattr; + taosThreadAttrInit(&thattr); + taosThreadAttrSetDetachState(&thattr, PTHREAD_CREATE_JOINABLE); + + int64_t t1 = taosGetTimestampUs(); + // pthread_create one thread to consume + int32_t* paras = taosMemoryCalloc(numOfThread, sizeof(int32_t)); + for (int32_t i = 0; i < numOfThread; ++i) { + paras[i] = i; + taosThreadCreate(&(thread[i]), &thattr, consumeThreadFunc, (void*)(¶s[i])); + } + + for (int32_t i = 0; i < numOfThread; i++) { + taosThreadJoin(thread[i], NULL); + taosThreadClear(&thread[i]); + } + + int64_t t2 = taosGetTimestampUs(); + printf("total cost %"PRId64" us\n", t2 - t1); + taosMemoryFree(paras); + return 0; +}