diff --git a/.gitignore b/.gitignore index 334947a64c..1798a920eb 100644 --- a/.gitignore +++ b/.gitignore @@ -100,6 +100,9 @@ tests/examples/JDBC/JDBCDemo/.project tests/examples/JDBC/JDBCDemo/.settings/ source/libs/parser/inc/sql.* tests/script/tmqResult.txt +tests/system-test/case_to_run.txt +tests/develop-test/case_to_run.txt +tests/scripts/case_to_run.txt tests/tmqResult.txt tests/script/jenkins/basic.txt diff --git a/Jenkinsfile2 b/Jenkinsfile2 index a4f765c9fb..b074a0ee05 100644 --- a/Jenkinsfile2 +++ b/Jenkinsfile2 @@ -422,6 +422,10 @@ pipeline { mkdir -p ${WKDIR}/tmp/${BRANCH_NAME}_${BUILD_ID} echo "''' + env.FILE_CHANGED + '''" > ${WKDIR}/tmp/${BRANCH_NAME}_${BUILD_ID}/docs_changed.txt ''' + sh ''' + cd ${WKC}/tests/parallel_test + ./run_check_assert_container.sh -d ${WKDIR} + ''' sh ''' date rm -rf ${WKC}/debug diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt index 33179662fd..2a38bf74c7 100644 --- a/contrib/CMakeLists.txt +++ b/contrib/CMakeLists.txt @@ -321,7 +321,7 @@ if (${BUILD_WITH_ROCKSDB}) endif(${TD_DARWIN_ARM64}) if (${TD_WINDOWS}) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4244 /wd4819") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4244 /wd4819 /std:c++17") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4244 /wd4819") option(WITH_JNI "" OFF) if(CMAKE_C_FLAGS MATCHES "/MT" OR CMAKE_C_FLAGS MATCHES "/MTd") @@ -370,7 +370,7 @@ if (${BUILD_WITH_ROCKSDB}) endif(${TD_DARWIN_ARM64}) if (${TD_WINDOWS}) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4244 /wd4819") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4244 /wd4819 /std:c++17") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4244 /wd4819") option(WITH_JNI "" OFF) if(CMAKE_C_FLAGS MATCHES "/MT" OR CMAKE_C_FLAGS MATCHES "/MTd") 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/14-reference/03-taos-sql/04-stable.md b/docs/en/14-reference/03-taos-sql/04-stable.md index ea8fb42956..73b1c0728e 100644 --- a/docs/en/14-reference/03-taos-sql/04-stable.md +++ b/docs/en/14-reference/03-taos-sql/04-stable.md @@ -20,8 +20,7 @@ table_options: table_option: { COMMENT 'string_value' - | SMA(col_name [, col_name] ...) - | TTL value + | SMA(col_name [, col_name] ...) } ``` 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/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/14-reference/03-taos-sql/04-stable.md b/docs/zh/14-reference/03-taos-sql/04-stable.md index badd08cd57..97e2b95089 100644 --- a/docs/zh/14-reference/03-taos-sql/04-stable.md +++ b/docs/zh/14-reference/03-taos-sql/04-stable.md @@ -20,8 +20,7 @@ table_options: table_option: { COMMENT 'string_value' - | SMA(col_name [, col_name] ...) - | TTL value + | SMA(col_name [, col_name] ...) } ``` 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/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/tglobal.h b/include/common/tglobal.h index 7ecdd2a1b7..2d4d437649 100644 --- a/include/common/tglobal.h +++ b/include/common/tglobal.h @@ -158,6 +158,7 @@ extern int32_t tsCacheLazyLoadThreshold; // cost threshold for last/last_row lo // query client extern int32_t tsQueryPolicy; +extern bool tsQueryTbNotExistAsEmpty; extern int32_t tsQueryRspPolicy; extern int64_t tsQueryMaxConcurrentTables; extern int32_t tsQuerySmaOptimize; 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/dnode/mnode/mnode.h b/include/dnode/mnode/mnode.h index b821231539..1f205b3f11 100644 --- a/include/dnode/mnode/mnode.h +++ b/include/dnode/mnode/mnode.h @@ -121,6 +121,8 @@ void mndGenerateMachineCode(); void mndDumpSdb(); +void mndDeleteTrans(); + #ifdef __cplusplus } #endif diff --git a/include/libs/function/function.h b/include/libs/function/function.h index 24fa2898ea..a71a2a6b7f 100644 --- a/include/libs/function/function.h +++ b/include/libs/function/function.h @@ -36,6 +36,7 @@ typedef struct SFuncExecEnv { } SFuncExecEnv; typedef bool (*FExecGetEnv)(struct SFunctionNode *pFunc, SFuncExecEnv *pEnv); +typedef void (*FExecCleanUp)(struct SqlFunctionCtx* pCtx); typedef int32_t (*FExecInit)(struct SqlFunctionCtx *pCtx, struct SResultRowEntryInfo *pResultCellInfo); typedef int32_t (*FExecProcess)(struct SqlFunctionCtx *pCtx); typedef int32_t (*FExecFinalize)(struct SqlFunctionCtx *pCtx, SSDataBlock *pBlock); @@ -54,6 +55,7 @@ typedef struct SFuncExecFuncs { FExecProcess process; FExecFinalize finalize; FExecCombine combine; + FExecCleanUp cleanup; processFuncByRow processFuncByRow; } SFuncExecFuncs; diff --git a/include/libs/monitorfw/taos_counter.h b/include/libs/monitorfw/taos_counter.h index 28a9eed41c..a9d196d8ec 100644 --- a/include/libs/monitorfw/taos_counter.h +++ b/include/libs/monitorfw/taos_counter.h @@ -15,7 +15,7 @@ #ifndef TAOS_COUNTER_H #define TAOS_COUNTER_H - +#include #include #include "taos_metric.h" @@ -99,4 +99,7 @@ int taos_counter_inc(taos_counter_t *self, const char **label_values); */ int taos_counter_add(taos_counter_t *self, double r_value, const char **label_values); +int taos_counter_get_vgroup_ids(taos_counter_t *self, char ***keys, int32_t **vgroup_ids, int *list_size); +int taos_counter_get_keys_size(taos_counter_t *self); +int taos_counter_delete(taos_counter_t *self, char *key); #endif // TAOS_COUNTER_H diff --git a/include/libs/parser/parser.h b/include/libs/parser/parser.h index cefce8a9c0..a808fccc4a 100644 --- a/include/libs/parser/parser.h +++ b/include/libs/parser/parser.h @@ -65,6 +65,8 @@ typedef struct SParseCsvCxt { const char* pLastSqlPos; // the location of the last parsed sql } SParseCsvCxt; +typedef void(*setQueryFn)(int64_t); + typedef struct SParseContext { uint64_t requestId; int64_t requestRid; @@ -98,6 +100,7 @@ typedef struct SParseContext { void* parseSqlParam; int8_t biMode; SArray* pSubMetaList; + setQueryFn setQueryFp; } SParseContext; int32_t qParseSql(SParseContext* pCxt, SQuery** pQuery); diff --git a/include/util/tdef.h b/include/util/tdef.h index a750074953..46a0d01457 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -499,7 +499,7 @@ typedef enum ELogicConditionType { #ifdef WINDOWS #define TSDB_MAX_RPC_THREADS 4 // windows pipe only support 4 connections. #else -#define TSDB_MAX_RPC_THREADS 10 +#define TSDB_MAX_RPC_THREADS 50 #endif #define TSDB_QUERY_TYPE_NON_TYPE 0x00u // none type 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/inc/clientInt.h b/source/client/inc/clientInt.h index 30424adecd..9811003254 100644 --- a/source/client/inc/clientInt.h +++ b/source/client/inc/clientInt.h @@ -52,11 +52,11 @@ enum { #define SHOW_VARIABLES_RESULT_FIELD2_LEN (TSDB_CONFIG_VALUE_LEN + VARSTR_HEADER_SIZE) #define SHOW_VARIABLES_RESULT_FIELD3_LEN (TSDB_CONFIG_SCOPE_LEN + VARSTR_HEADER_SIZE) -#define TD_RES_QUERY(res) (*(int8_t*)res == RES_TYPE__QUERY) -#define TD_RES_TMQ(res) (*(int8_t*)res == RES_TYPE__TMQ) -#define TD_RES_TMQ_META(res) (*(int8_t*)res == RES_TYPE__TMQ_META) -#define TD_RES_TMQ_METADATA(res) (*(int8_t*)res == RES_TYPE__TMQ_METADATA) -#define TD_RES_TMQ_BATCH_META(res) (*(int8_t*)res == RES_TYPE__TMQ_BATCH_META) +#define TD_RES_QUERY(res) (*(int8_t*)(res) == RES_TYPE__QUERY) +#define TD_RES_TMQ(res) (*(int8_t*)(res) == RES_TYPE__TMQ) +#define TD_RES_TMQ_META(res) (*(int8_t*)(res) == RES_TYPE__TMQ_META) +#define TD_RES_TMQ_METADATA(res) (*(int8_t*)(res) == RES_TYPE__TMQ_METADATA) +#define TD_RES_TMQ_BATCH_META(res) (*(int8_t*)(res) == RES_TYPE__TMQ_BATCH_META) typedef struct SAppInstInfo SAppInstInfo; @@ -284,6 +284,7 @@ typedef struct SRequestObj { bool isSubReq; bool inCallback; bool isStmtBind; // is statement bind parameter + bool isQuery; uint32_t prevCode; // previous error code: todo refactor, add update flag for catalog uint32_t retry; int64_t allocatorRefId; @@ -420,6 +421,7 @@ typedef struct SSqlCallbackWrapper { void* pPlanInfo; } SSqlCallbackWrapper; +void setQueryRequest(int64_t rId); SRequestObj* launchQueryImpl(SRequestObj* pRequest, SQuery* pQuery, bool keepQuery, void** res); int32_t scheduleQuery(SRequestObj* pRequest, SQueryPlan* pDag, SArray* pNodeList); void launchAsyncQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaData* pResultMeta, SSqlCallbackWrapper* pWrapper); diff --git a/source/client/src/clientHb.c b/source/client/src/clientHb.c index 9d6f106336..5d3892d5e0 100644 --- a/source/client/src/clientHb.c +++ b/source/client/src/clientHb.c @@ -16,10 +16,10 @@ #include "catalog.h" #include "clientInt.h" #include "clientLog.h" -#include "scheduler.h" -#include "trpc.h" -#include "tglobal.h" #include "clientMonitor.h" +#include "scheduler.h" +#include "tglobal.h" +#include "trpc.h" typedef struct { union { @@ -244,11 +244,9 @@ static int32_t hbProcessDBInfoRsp(void *value, int32_t valueLen, struct SCatalog goto _return; } - TSC_ERR_JRET(catalogUpdateDBVgInfo(pCatalog, - (rsp->useDbRsp->db[0] == 'i') ? - TSDB_PERFORMANCE_SCHEMA_DB : - TSDB_INFORMATION_SCHEMA_DB, - rsp->useDbRsp->uid, vgInfo)); + TSC_ERR_JRET(catalogUpdateDBVgInfo( + pCatalog, (rsp->useDbRsp->db[0] == 'i') ? TSDB_PERFORMANCE_SCHEMA_DB : TSDB_INFORMATION_SCHEMA_DB, + rsp->useDbRsp->uid, vgInfo)); } } } @@ -556,7 +554,6 @@ static int32_t hbQueryHbRspHandle(SAppHbMgr *pAppHbMgr, SClientHbRsp *pRsp) { } } - taosHashRelease(pAppHbMgr->activeInfo, pReq); return TSDB_CODE_SUCCESS; @@ -609,8 +606,8 @@ static int32_t hbAsyncCallBack(void *param, SDataBuf *pMsg, int32_t code) { } pInst->monitorParas = pRsp.monitorParas; - tscDebug("[monitor] paras from hb, clusterId:%" PRIx64 " monitorParas threshold:%d scope:%d", - pInst->clusterId, pRsp.monitorParas.tsSlowLogThreshold, pRsp.monitorParas.tsSlowLogScope); + tscDebug("[monitor] paras from hb, clusterId:%" PRIx64 " monitorParas threshold:%d scope:%d", pInst->clusterId, + pRsp.monitorParas.tsSlowLogThreshold, pRsp.monitorParas.tsSlowLogScope); if (rspNum) { tscDebug("hb got %d rsp, %d empty rsp received before", rspNum, @@ -1108,7 +1105,8 @@ int32_t hbQueryHbReqHandle(SClientHbKey *connKey, void *param, SClientHbReq *req if (clientHbMgr.appHbHash) { code = taosHashPut(clientHbMgr.appHbHash, &hbParam->clusterId, sizeof(uint64_t), NULL, 0); if (TSDB_CODE_SUCCESS != code) { - tscWarn("hbQueryHbReqHandle put clusterId failed, clusterId:%" PRIx64 ", error:%s", hbParam->clusterId, tstrerror(code)); + tscWarn("hbQueryHbReqHandle put clusterId failed, clusterId:%" PRIx64 ", error:%s", hbParam->clusterId, + tstrerror(code)); return code; } } @@ -1261,7 +1259,7 @@ int32_t hbGatherAppInfo(void) { SAppHbMgr *pAppHbMgr = taosArrayGetP(clientHbMgr.appHbMgrs, i); if (pAppHbMgr == NULL) continue; - int64_t clusterId = pAppHbMgr->pAppInstInfo->clusterId; + int64_t clusterId = pAppHbMgr->pAppInstInfo->clusterId; SAppHbReq *pApp = taosHashGet(clientHbMgr.appSummary, &clusterId, sizeof(clusterId)); if (NULL == pApp) { (void)memcpy(&req.summary, &pAppHbMgr->pAppInstInfo->summary, sizeof(req.summary)); @@ -1303,8 +1301,7 @@ static void *hbThreadFunc(void *param) { return NULL; } if (sz > 1 && !clientHbMgr.appHbHash) { - clientHbMgr.appHbHash = - taosHashInit(0, taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT), true, HASH_NO_LOCK); + clientHbMgr.appHbHash = taosHashInit(0, taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT), true, HASH_NO_LOCK); if (NULL == clientHbMgr.appHbHash) { tscError("taosHashInit failed"); return NULL; @@ -1324,13 +1321,13 @@ static void *hbThreadFunc(void *param) { continue; } SClientHbBatchReq *pReq = NULL; - int32_t code = hbGatherAllInfo(pAppHbMgr, &pReq); + int32_t code = hbGatherAllInfo(pAppHbMgr, &pReq); if (TSDB_CODE_SUCCESS != code || taosArrayGetP(clientHbMgr.appHbMgrs, i) == NULL) { terrno = code ? code : TSDB_CODE_OUT_OF_RANGE; tFreeClientHbBatchReq(pReq); continue; } - int tlen = tSerializeSClientHbBatchReq(NULL, 0, pReq); + int tlen = tSerializeSClientHbBatchReq(NULL, 0, pReq); if (tlen == -1) { tFreeClientHbBatchReq(pReq); break; @@ -1368,9 +1365,8 @@ static void *hbThreadFunc(void *param) { pInfo->requestObjRefId = 0; SAppInstInfo *pAppInstInfo = pAppHbMgr->pAppInstInfo; - int64_t transporterId = 0; SEpSet epSet = getEpSet_s(&pAppInstInfo->mgmtEp); - if (TSDB_CODE_SUCCESS != asyncSendMsgToServer(pAppInstInfo->pTransporter, &epSet, &transporterId, pInfo)) { + if (TSDB_CODE_SUCCESS != asyncSendMsgToServer(pAppInstInfo->pTransporter, &epSet, NULL, pInfo)) { tscWarn("failed to async send msg to server"); } tFreeClientHbBatchReq(pReq); @@ -1389,7 +1385,7 @@ static void *hbThreadFunc(void *param) { } static int32_t hbCreateThread() { - int32_t code = TSDB_CODE_SUCCESS; + int32_t code = TSDB_CODE_SUCCESS; TdThreadAttr thAttr; TSC_ERR_JRET(taosThreadAttrInit(&thAttr)); TSC_ERR_JRET(taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE)); @@ -1467,9 +1463,9 @@ int32_t appHbMgrInit(SAppInstInfo *pAppInstInfo, char *key, SAppHbMgr **pAppHbMg TSC_ERR_JRET(taosThreadMutexLock(&clientHbMgr.lock)); if (taosArrayPush(clientHbMgr.appHbMgrs, &(*pAppHbMgr)) == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - (void)taosThreadMutexUnlock(&clientHbMgr.lock); - goto _return; + code = TSDB_CODE_OUT_OF_MEMORY; + (void)taosThreadMutexUnlock(&clientHbMgr.lock); + goto _return; } (*pAppHbMgr)->idx = taosArrayGetSize(clientHbMgr.appHbMgrs) - 1; TSC_ERR_JRET(taosThreadMutexUnlock(&clientHbMgr.lock)); diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index d1ee26423c..a208cedd65 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -31,6 +31,15 @@ static int32_t initEpSetFromCfg(const char* firstEp, const char* secondEp, SCorEpSet* pEpSet); static int32_t buildConnectMsg(SRequestObj* pRequest, SMsgSendInfo** pMsgSendInfo); +void setQueryRequest(int64_t rId) { + SRequestObj* pReq = acquireRequest(rId); + if (pReq != NULL) { + pReq->isQuery = true; + (void)releaseRequest(rId); + } + +} + static bool stringLengthCheck(const char* str, size_t maxsize) { if (str == NULL) { return false; @@ -286,7 +295,8 @@ int32_t parseSql(SRequestObj* pRequest, bool topicQuery, SQuery** pQuery, SStmtC .enableSysInfo = pTscObj->sysInfo, .svrVer = pTscObj->sVer, .nodeOffline = (pTscObj->pAppInfo->onlineDnodes < pTscObj->pAppInfo->totalDnodes), - .isStmtBind = pRequest->isStmtBind}; + .isStmtBind = pRequest->isStmtBind, + .setQueryFp = setQueryRequest}; cxt.mgmtEpSet = getEpSet_s(&pTscObj->pAppInfo->mgmtEp); int32_t code = catalogGetHandle(pTscObj->pAppInfo->clusterId, &cxt.pCatalog); @@ -339,8 +349,8 @@ int32_t execDdlQuery(SRequestObj* pRequest, SQuery* pQuery) { STscObj* pTscObj = pRequest->pTscObj; SMsgSendInfo* pSendMsg = buildMsgInfoImpl(pRequest); - int64_t transporterId = 0; - TSC_ERR_RET(asyncSendMsgToServer(pTscObj->pAppInfo->pTransporter, &pMsgInfo->epSet, &transporterId, pSendMsg)); + // int64_t transporterId = 0; + TSC_ERR_RET(asyncSendMsgToServer(pTscObj->pAppInfo->pTransporter, &pMsgInfo->epSet, NULL, pSendMsg)); (void)tsem_wait(&pRequest->body.rspSem); return TSDB_CODE_SUCCESS; } @@ -396,8 +406,8 @@ int32_t asyncExecDdlQuery(SRequestObj* pRequest, SQuery* pQuery) { SAppInstInfo* pAppInfo = getAppInfo(pRequest); SMsgSendInfo* pSendMsg = buildMsgInfoImpl(pRequest); - int64_t transporterId = 0; - int32_t code = asyncSendMsgToServer(pAppInfo->pTransporter, &pMsgInfo->epSet, &transporterId, pSendMsg); + // int64_t transporterId = 0; + int32_t code = asyncSendMsgToServer(pAppInfo->pTransporter, &pMsgInfo->epSet, NULL, pSendMsg); if (code) { doRequestCallback(pRequest, code); } @@ -1567,9 +1577,8 @@ int32_t taosConnectImpl(const char* user, const char* auth, const char* db, __ta return code; } - int64_t transporterId = 0; - code = asyncSendMsgToServer((*pTscObj)->pAppInfo->pTransporter, &(*pTscObj)->pAppInfo->mgmtEp.epSet, &transporterId, - body); + // int64_t transporterId = 0; + code = asyncSendMsgToServer((*pTscObj)->pAppInfo->pTransporter, &(*pTscObj)->pAppInfo->mgmtEp.epSet, NULL, body); if (TSDB_CODE_SUCCESS != code) { destroyTscObj(*pTscObj); tscError("failed to send connect msg to server, code:%s", tstrerror(code)); @@ -2954,6 +2963,10 @@ void taosAsyncFetchImpl(SRequestObj* pRequest, __taos_async_fn_t fp, void* param void doRequestCallback(SRequestObj* pRequest, int32_t code) { pRequest->inCallback = true; int64_t this = pRequest->self; + if (tsQueryTbNotExistAsEmpty && TD_RES_QUERY(&pRequest->resType) && pRequest->isQuery && (code == TSDB_CODE_PAR_TABLE_NOT_EXIST || code == TSDB_CODE_TDB_TABLE_NOT_EXIST)) { + code = TSDB_CODE_SUCCESS; + pRequest->type = TSDB_SQL_RETRIEVE_EMPTY_RESULT; + } pRequest->body.queryFp(((SSyncQueryParam*)pRequest->body.interParam)->userParam, pRequest, code); SRequestObj* pReq = acquireRequest(this); if (pReq != NULL) { diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index 4a78ce957d..27c1878dc8 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -296,9 +296,8 @@ void taos_fetch_whitelist_a(TAOS *taos, __taos_async_whitelist_fn_t fp, void *pa pSendInfo->fp = fetchWhiteListCallbackFn; pSendInfo->msgType = TDMT_MND_GET_USER_WHITELIST; - int64_t transportId = 0; - SEpSet epSet = getEpSet_s(&pTsc->pAppInfo->mgmtEp); - if (TSDB_CODE_SUCCESS != asyncSendMsgToServer(pTsc->pAppInfo->pTransporter, &epSet, &transportId, pSendInfo)) { + SEpSet epSet = getEpSet_s(&pTsc->pAppInfo->mgmtEp); + if (TSDB_CODE_SUCCESS != asyncSendMsgToServer(pTsc->pAppInfo->pTransporter, &epSet, NULL, pSendInfo)) { tscWarn("failed to async send msg to server"); } releaseTscObj(connId); @@ -860,9 +859,9 @@ 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)) { +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; } @@ -875,22 +874,22 @@ int taos_is_null_by_column(TAOS_RES *res, int columnIndex, bool result[], int *r TAOS_FIELD *pField = &pResInfo->userFields[columnIndex]; SResultColumn *pCol = &pResInfo->pCol[columnIndex]; - if (*rows > pResInfo->numOfRows){ + 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){ + for (int i = 0; i < *rows; i++) { + if (pCol->offset[i] == -1) { result[i] = true; - }else{ + } else { result[i] = false; } } - }else{ - for(int i = 0; i < *rows; i++){ - if (colDataIsNull_f(pCol->nullbitmap, i)){ + } else { + for (int i = 0; i < *rows; i++) { + if (colDataIsNull_f(pCol->nullbitmap, i)) { result[i] = true; - }else{ + } else { result[i] = false; } } @@ -1235,7 +1234,8 @@ int32_t createParseContext(const SRequestObj *pRequest, SParseContext **pCxt, SS .nodeOffline = (pTscObj->pAppInfo->onlineDnodes < pTscObj->pAppInfo->totalDnodes), .allocatorId = pRequest->allocatorRefId, .parseSqlFp = clientParseSql, - .parseSqlParam = pWrapper}; + .parseSqlParam = pWrapper, + .setQueryFp = setQueryRequest}; int8_t biMode = atomic_load_8(&((STscObj *)pTscObj)->biMode); (*pCxt)->biMode = biMode; return TSDB_CODE_SUCCESS; diff --git a/source/client/src/clientMonitor.c b/source/client/src/clientMonitor.c index 612f57ecdd..9ed6512352 100644 --- a/source/client/src/clientMonitor.c +++ b/source/client/src/clientMonitor.c @@ -113,15 +113,15 @@ static int32_t monitorReportAsyncCB(void* param, SDataBuf* pMsg, int32_t code) { tscError("failed to send slow log:%s, clusterId:%" PRIx64, p->data, p->clusterId); } MonitorSlowLogData tmp = {.clusterId = p->clusterId, - .type = p->type, - .fileName = p->fileName, - .pFile = p->pFile, - .offset = p->offset, - .data = NULL}; + .type = p->type, + .fileName = p->fileName, + .pFile = p->pFile, + .offset = p->offset, + .data = NULL}; if (monitorPutData2MonitorQueue(tmp) == 0) { p->fileName = NULL; } else { - if(taosCloseFile(&(p->pFile)) != 0) { + if (taosCloseFile(&(p->pFile)) != 0) { tscError("failed to close file:%p", p->pFile); } } @@ -165,8 +165,8 @@ static int32_t sendReport(void* pTransporter, SEpSet* epSet, char* pCont, MONITO pInfo->requestId = tGenIdPI64(); pInfo->requestObjRefId = 0; - int64_t transporterId = 0; - return asyncSendMsgToServer(pTransporter, epSet, &transporterId, pInfo); + // int64_t transporterId = 0; + return asyncSendMsgToServer(pTransporter, epSet, NULL, pInfo); FAILED: if (taosCloseFile(&(((MonitorSlowLogData*)param)->pFile)) != 0) { @@ -286,7 +286,7 @@ void monitorCreateClient(int64_t clusterId) { return; - fail: +fail: destroyMonitorClient(&pMonitor); taosWUnLockLatch(&monitorLock); } @@ -302,7 +302,7 @@ void monitorCreateClientCounter(int64_t clusterId, const char* name, const char* taos_counter_t* newCounter = taos_counter_new(name, help, label_key_count, label_keys); if (newCounter == NULL) return; MonitorClient* pMonitor = *ppMonitor; - if (taos_collector_add_metric(pMonitor->colector, newCounter) != 0){ + if (taos_collector_add_metric(pMonitor->colector, newCounter) != 0) { tscError("failed to add metric to collector"); (void)taos_counter_destroy(newCounter); goto end; @@ -315,7 +315,7 @@ void monitorCreateClientCounter(int64_t clusterId, const char* name, const char* tscInfo("[monitor] monitorCreateClientCounter %" PRIx64 "(%p):%s : %p.", pMonitor->clusterId, pMonitor, name, newCounter); - end: +end: taosWUnLockLatch(&monitorLock); } @@ -338,13 +338,13 @@ void monitorCounterInc(int64_t clusterId, const char* counterName, const char** tscError("monitorCounterInc not found pCounter %" PRIx64 ":%s.", clusterId, counterName); goto end; } - if (taos_counter_inc(*ppCounter, label_values) != 0){ + if (taos_counter_inc(*ppCounter, label_values) != 0) { tscError("monitorCounterInc failed to inc %" PRIx64 ":%s.", clusterId, counterName); goto end; } tscDebug("[monitor] monitorCounterInc %" PRIx64 "(%p):%s", pMonitor->clusterId, pMonitor, counterName); - end: +end: taosWUnLockLatch(&monitorLock); } @@ -413,7 +413,7 @@ static char* readFile(TdFilePtr pFile, int64_t* offset, int64_t size) { return NULL; } - if((size <= *offset)){ + if ((size <= *offset)) { tscError("invalid size:%" PRId64 ", offset:%" PRId64, size, *offset); terrno = TSDB_CODE_TSC_INTERNAL_ERROR; return NULL; @@ -510,13 +510,13 @@ static int32_t monitorReadSend(int64_t clusterId, TdFilePtr pFile, int64_t* offs } SEpSet ep = getEpSet_s(&pInst->mgmtEp); char* data = readFile(pFile, offset, size); - if(data == NULL) return terrno; + if (data == NULL) return terrno; return sendSlowLog(clusterId, data, (type == SLOW_LOG_READ_BEGINNIG ? pFile : NULL), *offset, type, fileName, pInst->pTransporter, &ep); } static void monitorSendSlowLogAtBeginning(int64_t clusterId, char** fileName, TdFilePtr pFile, int64_t offset) { - if (fileName == NULL){ + if (fileName == NULL) { return; } int64_t size = getFileSize(*fileName); @@ -525,10 +525,11 @@ static void monitorSendSlowLogAtBeginning(int64_t clusterId, char** fileName, Td tscDebug("[monitor] monitorSendSlowLogAtBeginning delete file:%s", *fileName); } else { int32_t code = monitorReadSend(clusterId, pFile, &offset, size, SLOW_LOG_READ_BEGINNIG, *fileName); - if (code == 0){ + if (code == 0) { tscDebug("[monitor] monitorSendSlowLogAtBeginning send slow log succ, clusterId:%" PRId64, clusterId); - }else{ - tscError("[monitor] monitorSendSlowLogAtBeginning send slow log failed, clusterId:%" PRId64 ",ret:%d", clusterId, code); + } else { + tscError("[monitor] monitorSendSlowLogAtBeginning send slow log failed, clusterId:%" PRId64 ",ret:%d", clusterId, + code); } *fileName = NULL; } 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/clientStmt.c b/source/client/src/clientStmt.c index 9f7aeabbe4..52b56abb91 100644 --- a/source/client/src/clientStmt.c +++ b/source/client/src/clientStmt.c @@ -1241,7 +1241,9 @@ int stmtBindBatch(TAOS_STMT* stmt, TAOS_MULTI_BIND* bind, int32_t colIdx) { .msgLen = ERROR_MSG_BUF_DEFAULT_SIZE, .pTransporter = pStmt->taos->pAppInfo->pTransporter, .pStmtCb = NULL, - .pUser = pStmt->taos->user}; + .pUser = pStmt->taos->user, + .setQueryFp = setQueryRequest}; + ctx.mgmtEpSet = getEpSet_s(&pStmt->taos->pAppInfo->mgmtEp); STMT_ERR_RET(catalogGetHandle(pStmt->taos->pAppInfo->clusterId, &ctx.pCatalog)); diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index b702f79ddf..cb3896f81a 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -567,9 +567,9 @@ static int32_t doSendCommitMsg(tmq_t* tmq, int32_t vgId, SEpSet* epSet, STqOffse pMsgSendInfo->fp = tmqCommitCb; pMsgSendInfo->msgType = TDMT_VND_TMQ_COMMIT_OFFSET; - int64_t transporterId = 0; + // int64_t transporterId = 0; (void)atomic_add_fetch_32(&pParamSet->waitingRspNum, 1); - code = asyncSendMsgToServer(tmq->pTscObj->pAppInfo->pTransporter, epSet, &transporterId, pMsgSendInfo); + code = asyncSendMsgToServer(tmq->pTscObj->pAppInfo->pTransporter, epSet, NULL, pMsgSendInfo); if (code != 0) { (void)atomic_sub_fetch_32(&pParamSet->waitingRspNum, 1); } @@ -953,8 +953,7 @@ void tmqSendHbReq(void* param, void* tmrId) { SEpSet epSet = getEpSet_s(&tmq->pTscObj->pAppInfo->mgmtEp); - int64_t transporterId = 0; - int32_t code = asyncSendMsgToServer(tmq->pTscObj->pAppInfo->pTransporter, &epSet, &transporterId, sendInfo); + int32_t code = asyncSendMsgToServer(tmq->pTscObj->pAppInfo->pTransporter, &epSet, NULL, sendInfo); if (code != 0) { tqErrorC("tmqSendHbReq asyncSendMsgToServer failed"); } @@ -1430,8 +1429,7 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) { SEpSet epSet = getEpSet_s(&tmq->pTscObj->pAppInfo->mgmtEp); - int64_t transporterId = 0; - code = asyncSendMsgToServer(tmq->pTscObj->pAppInfo->pTransporter, &epSet, &transporterId, sendInfo); + code = asyncSendMsgToServer(tmq->pTscObj->pAppInfo->pTransporter, &epSet, NULL, sendInfo); if (code != 0) { goto END; } @@ -2039,11 +2037,10 @@ static int32_t doTmqPollImpl(tmq_t* pTmq, SMqClientTopic* pTopic, SMqClientVg* p sendInfo->fp = tmqPollCb; sendInfo->msgType = TDMT_VND_TMQ_CONSUME; - int64_t transporterId = 0; - char offsetFormatBuf[TSDB_OFFSET_LEN] = {0}; + char offsetFormatBuf[TSDB_OFFSET_LEN] = {0}; tFormatOffset(offsetFormatBuf, tListLen(offsetFormatBuf), &pVg->offsetInfo.endOffset); - code = asyncSendMsgToServer(pTmq->pTscObj->pAppInfo->pTransporter, &pVg->epSet, &transporterId, sendInfo); - tqDebugC("consumer:0x%" PRIx64 " send poll to %s vgId:%d, code:%d, epoch %d, req:%s,QID:0x%" PRIx64, pTmq->consumerId, + code = asyncSendMsgToServer(pTmq->pTscObj->pAppInfo->pTransporter, &pVg->epSet, NULL, 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); if (code != 0) { return code; @@ -3190,8 +3187,7 @@ int64_t getCommittedFromServer(tmq_t* tmq, char* tname, int32_t vgId, SEpSet* ep sendInfo->fp = tmCommittedCb; sendInfo->msgType = TDMT_VND_TMQ_VG_COMMITTEDINFO; - int64_t transporterId = 0; - code = asyncSendMsgToServer(tmq->pTscObj->pAppInfo->pTransporter, epSet, &transporterId, sendInfo); + code = asyncSendMsgToServer(tmq->pTscObj->pAppInfo->pTransporter, epSet, NULL, sendInfo); if (code != 0) { (void)tsem2_destroy(&pParam->sem); taosMemoryFree(pParam); @@ -3467,13 +3463,13 @@ int32_t tmq_get_topic_assignment(tmq_t* tmq, const char* pTopicName, tmq_topic_a sendInfo->fp = tmqGetWalInfoCb; sendInfo->msgType = TDMT_VND_TMQ_VG_WALINFO; - int64_t transporterId = 0; - char offsetFormatBuf[TSDB_OFFSET_LEN] = {0}; + // int64_t transporterId = 0; + char offsetFormatBuf[TSDB_OFFSET_LEN] = {0}; tFormatOffset(offsetFormatBuf, tListLen(offsetFormatBuf), &pClientVg->offsetInfo.beginOffset); tqInfoC("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); + code = asyncSendMsgToServer(tmq->pTscObj->pAppInfo->pTransporter, &pClientVg->epSet, NULL, sendInfo); if (code != 0) { goto end; } @@ -3637,8 +3633,7 @@ int32_t tmq_offset_seek(tmq_t* tmq, const char* pTopicName, int32_t vgId, int64_ sendInfo->fp = tmqSeekCb; sendInfo->msgType = TDMT_VND_TMQ_SEEK; - int64_t transporterId = 0; - code = asyncSendMsgToServer(tmq->pTscObj->pAppInfo->pTransporter, &epSet, &transporterId, sendInfo); + code = asyncSendMsgToServer(tmq->pTscObj->pAppInfo->pTransporter, &epSet, NULL, sendInfo); if (code != 0) { (void)tsem2_destroy(&pParam->sem); taosMemoryFree(pParam); diff --git a/source/common/src/cos.c b/source/common/src/cos.c index 250a4815f4..f02130d468 100644 --- a/source/common/src/cos.c +++ b/source/common/src/cos.c @@ -704,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 { @@ -810,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)) { @@ -858,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; @@ -1831,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/systable.c b/source/common/src/systable.c index 3f27ab2b2b..2f3ffecf61 100644 --- a/source/common/src/systable.c +++ b/source/common/src/systable.c @@ -427,6 +427,7 @@ static const SSysDbTableSchema userMachinesSchema[] = { {.name = "id", .bytes = TSDB_CLUSTER_ID_LEN + 1 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, {.name = "dnode_num", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true}, {.name = "machine", .bytes = 7552 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, + {.name = "version", .bytes = 32 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, }; static const SSysDbTableSchema encryptionsSchema[] = { diff --git a/source/common/src/tdataformat.c b/source/common/src/tdataformat.c index 6f4f4a6162..b831860512 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; @@ -3231,7 +3231,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 100a24f44d..367eb68865 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -162,6 +162,7 @@ int32_t tmqMaxTopicNum = 20; int32_t tmqRowSize = 4096; // query int32_t tsQueryPolicy = 1; +bool tsQueryTbNotExistAsEmpty = false; int32_t tsQueryRspPolicy = 0; int64_t tsQueryMaxConcurrentTables = 200; // unit is TSDB_TABLE_NUM_UNIT bool tsEnableQueryHb = true; @@ -569,6 +570,7 @@ static int32_t taosAddClientCfg(SConfig *pCfg) { TAOS_CHECK_RETURN( cfgAddInt32(pCfg, "compressMsgSize", tsCompressMsgSize, -1, 100000000, CFG_SCOPE_BOTH, CFG_DYN_CLIENT)); TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "queryPolicy", tsQueryPolicy, 1, 4, CFG_SCOPE_CLIENT, CFG_DYN_ENT_CLIENT)); + TAOS_CHECK_RETURN(cfgAddBool(pCfg, "queryTableNotExistAsEmpty", tsQueryTbNotExistAsEmpty, CFG_SCOPE_CLIENT, CFG_DYN_CLIENT)); TAOS_CHECK_RETURN(cfgAddBool(pCfg, "enableQueryHb", tsEnableQueryHb, CFG_SCOPE_CLIENT, CFG_DYN_CLIENT)); TAOS_CHECK_RETURN(cfgAddBool(pCfg, "enableScience", tsEnableScience, CFG_SCOPE_CLIENT, CFG_DYN_NONE)); TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "querySmaOptimize", tsQuerySmaOptimize, 0, 1, CFG_SCOPE_CLIENT, CFG_DYN_CLIENT)); @@ -1181,6 +1183,9 @@ static int32_t taosSetClientCfg(SConfig *pCfg) { TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "queryPolicy"); tsQueryPolicy = pItem->i32; + TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "queryTableNotExistAsEmpty"); + tsQueryTbNotExistAsEmpty = pItem->bval; + TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "enableQueryHb"); tsEnableQueryHb = pItem->bval; @@ -2218,6 +2223,7 @@ static int32_t taosCfgDynamicOptionsForClient(SConfig *pCfg, const char *name) { {"numOfLogLines", &tsNumOfLogLines}, {"querySmaOptimize", &tsQuerySmaOptimize}, {"queryPolicy", &tsQueryPolicy}, + {"queryTableNotExistAsEmpty", &tsQueryTbNotExistAsEmpty}, {"queryPlannerTrace", &tsQueryPlannerTrace}, {"queryNodeChunkSize", &tsQueryNodeChunkSize}, {"queryUseNodeAllocator", &tsQueryUseNodeAllocator}, diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index dd10aa5155..bdbfcd6750 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,266 +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); - int32_t ret = -1; - if (tStartDecode(&decoder) < 0) goto _END; - if (tDecodeI64(&decoder, &pBatchRsp->reqId) < 0) goto _END; - if (tDecodeI64(&decoder, &pBatchRsp->rspId) < 0) goto _END; - if (tDecodeI32(&decoder, &pBatchRsp->svrTimestamp) < 0) goto _END; + 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) goto _END; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &rspNum)); if (pBatchRsp->rsps == NULL) { - if ((pBatchRsp->rsps = taosArrayInit(rspNum, sizeof(SClientHbRsp))) == NULL) goto _END; + 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) goto _END; - if (taosArrayPush(pBatchRsp->rsps, &rsp) == NULL) goto _END; + 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) goto _END; + TAOS_CHECK_EXIT(tDeserializeSMonitorParas(&decoder, &pBatchRsp->monitorParas)); } tEndDecode(&decoder); - ret = 0; -_END: +_exit: tDecoderClear(&decoder); - return ret; + 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) { @@ -766,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) { @@ -905,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) { @@ -1057,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}; @@ -1130,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 @@ -1195,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; } @@ -1256,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 @@ -1450,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); } @@ -1506,185 +1662,179 @@ _exit: int32_t tSerializeSStatusRsp(void *buf, int32_t bufLen, SStatusRsp *pRsp) { 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 (tEncodeI64(&encoder, pRsp->dnodeVer) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pRsp->dnodeVer)); // dnode cfg - if (tEncodeI32(&encoder, pRsp->dnodeCfg.dnodeId) < 0) return -1; - if (tEncodeI64(&encoder, pRsp->dnodeCfg.clusterId) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pRsp->dnodeCfg.dnodeId)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pRsp->dnodeCfg.clusterId)); // dnode eps int32_t dlen = (int32_t)taosArrayGetSize(pRsp->pDnodeEps); - if (tEncodeI32(&encoder, dlen) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, dlen)); for (int32_t i = 0; i < dlen; ++i) { SDnodeEp *pDnodeEp = taosArrayGet(pRsp->pDnodeEps, i); - if (tEncodeI32(&encoder, pDnodeEp->id) < 0) return -1; - if (tEncodeI8(&encoder, pDnodeEp->isMnode) < 0) return -1; - if (tEncodeCStr(&encoder, pDnodeEp->ep.fqdn) < 0) return -1; - if (tEncodeU16(&encoder, pDnodeEp->ep.port) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pDnodeEp->id)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pDnodeEp->isMnode)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pDnodeEp->ep.fqdn)); + TAOS_CHECK_EXIT(tEncodeU16(&encoder, pDnodeEp->ep.port)); } - if (tEncodeI32(&encoder, pRsp->statusSeq) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pRsp->statusSeq)); - if (tEncodeI64(&encoder, pRsp->ipWhiteVer) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pRsp->ipWhiteVer)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSStatusRsp(void *buf, int32_t bufLen, SStatusRsp *pRsp) { 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 (tDecodeI64(&decoder, &pRsp->dnodeVer) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pRsp->dnodeVer)); // cluster cfg - if (tDecodeI32(&decoder, &pRsp->dnodeCfg.dnodeId) < 0) return -1; - if (tDecodeI64(&decoder, &pRsp->dnodeCfg.clusterId) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pRsp->dnodeCfg.dnodeId)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pRsp->dnodeCfg.clusterId)); // dnode eps int32_t dlen = 0; - if (tDecodeI32(&decoder, &dlen) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &dlen)); pRsp->pDnodeEps = taosArrayInit(dlen, sizeof(SDnodeEp)); if (pRsp->pDnodeEps == NULL) { - return -1; + TAOS_CHECK_EXIT(terrno); } for (int32_t i = 0; i < dlen; ++i) { SDnodeEp dnodeEp = {0}; - if (tDecodeI32(&decoder, &dnodeEp.id) < 0) return -1; - if (tDecodeI8(&decoder, &dnodeEp.isMnode) < 0) return -1; - if (tDecodeCStrTo(&decoder, dnodeEp.ep.fqdn) < 0) return -1; - if (tDecodeU16(&decoder, &dnodeEp.ep.port) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &dnodeEp.id)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &dnodeEp.isMnode)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, dnodeEp.ep.fqdn)); + TAOS_CHECK_EXIT(tDecodeU16(&decoder, &dnodeEp.ep.port)); if (taosArrayPush(pRsp->pDnodeEps, &dnodeEp) == NULL) { - return -1; + TAOS_CHECK_EXIT(terrno); } } - if (tDecodeI32(&decoder, &pRsp->statusSeq) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pRsp->statusSeq)); if (!tDecodeIsEnd(&decoder)) { - if (tDecodeI64(&decoder, &pRsp->ipWhiteVer) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pRsp->ipWhiteVer)); } tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSStatusRsp(SStatusRsp *pRsp) { taosArrayDestroy(pRsp->pDnodeEps); } int32_t tSerializeSStatisReq(void *buf, int32_t bufLen, SStatisReq *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->contLen) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->pCont) < 0) return -1; - if (tEncodeI8(&encoder, pReq->type) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->contLen)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->pCont)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->type)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSStatisReq(void *buf, int32_t bufLen, SStatisReq *pReq) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - - if (tDecodeI32(&decoder, &pReq->contLen) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->contLen)); if (pReq->contLen > 0) { pReq->pCont = taosMemoryMalloc(pReq->contLen + 1); - if (pReq->pCont == NULL) return -1; - if (tDecodeCStrTo(&decoder, pReq->pCont) < 0) return -1; + if (pReq->pCont == NULL) { + TAOS_CHECK_EXIT(terrno); + } + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->pCont)); } if (!tDecodeIsEnd(&decoder)) { - if (tDecodeI8(&decoder, (int8_t *)&pReq->type) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI8(&decoder, (int8_t *)&pReq->type)); } tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSStatisReq(SStatisReq *pReq) { taosMemoryFreeClear(pReq->pCont); } -// int32_t tSerializeSCreateAcctReq(void *buf, int32_t bufLen, SCreateAcctReq *pReq) { -// SEncoder encoder = {0}; -// tEncoderInit(&encoder, buf, bufLen); - -// if (tStartEncode(&encoder) < 0) return -1; -// if (tEncodeCStr(&encoder, pReq->user) < 0) return -1; -// if (tEncodeCStr(&encoder, pReq->pass) < 0) return -1; -// if (tEncodeI32(&encoder, pReq->maxUsers) < 0) return -1; -// if (tEncodeI32(&encoder, pReq->maxDbs) < 0) return -1; -// if (tEncodeI32(&encoder, pReq->maxTimeSeries) < 0) return -1; -// if (tEncodeI32(&encoder, pReq->maxStreams) < 0) return -1; -// if (tEncodeI32(&encoder, pReq->accessState) < 0) return -1; -// if (tEncodeI64(&encoder, pReq->maxStorage) < 0) return -1; -// tEndEncode(&encoder); - -// int32_t tlen = encoder.pos; -// tEncoderClear(&encoder); -// return tlen; -// } - -// int32_t tDeserializeSCreateAcctReq(void *buf, int32_t bufLen, SCreateAcctReq *pReq) { -// SDecoder decoder = {0}; -// tDecoderInit(&decoder, buf, bufLen); - -// if (tStartDecode(&decoder) < 0) return -1; -// if (tDecodeCStrTo(&decoder, pReq->user) < 0) return -1; -// if (tDecodeCStrTo(&decoder, pReq->pass) < 0) return -1; -// if (tDecodeI32(&decoder, &pReq->maxUsers) < 0) return -1; -// if (tDecodeI32(&decoder, &pReq->maxDbs) < 0) return -1; -// if (tDecodeI32(&decoder, &pReq->maxTimeSeries) < 0) return -1; -// if (tDecodeI32(&decoder, &pReq->maxStreams) < 0) return -1; -// if (tDecodeI32(&decoder, &pReq->accessState) < 0) return -1; -// if (tDecodeI64(&decoder, &pReq->maxStorage) < 0) return -1; -// tEndDecode(&decoder); - -// tDecoderClear(&decoder); -// return 0; -// } - int32_t tSerializeSDropUserReq(void *buf, int32_t bufLen, SDropUserReq *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->user) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->user)); ENCODESQL(); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSDropUserReq(void *buf, int32_t bufLen, SDropUserReq *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->user) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->user)); DECODESQL(); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSDropUserReq(SDropUserReq *pReq) { FREESQL(); } @@ -1702,113 +1852,143 @@ SIpWhiteList *cloneIpWhiteList(SIpWhiteList *pIpWhiteList) { int32_t tSerializeSCreateUserReq(void *buf, int32_t bufLen, SCreateUserReq *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 (tEncodeI8(&encoder, pReq->createType) < 0) return -1; - if (tEncodeI8(&encoder, pReq->superUser) < 0) return -1; - if (tEncodeI8(&encoder, pReq->sysInfo) < 0) return -1; - if (tEncodeI8(&encoder, pReq->enable) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->user) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->pass) < 0) return -1; - if (tEncodeI32(&encoder, pReq->numIpRanges) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->createType)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->superUser)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->sysInfo)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->enable)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->user)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->pass)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->numIpRanges)); for (int32_t i = 0; i < pReq->numIpRanges; ++i) { - if (tEncodeU32(&encoder, pReq->pIpRanges[i].ip) < 0) return -1; - if (tEncodeU32(&encoder, pReq->pIpRanges[i].mask) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeU32(&encoder, pReq->pIpRanges[i].ip)); + TAOS_CHECK_EXIT(tEncodeU32(&encoder, pReq->pIpRanges[i].mask)); } ENCODESQL(); - if (tEncodeI8(&encoder, pReq->isImport) < 0) return -1; - if (tEncodeI8(&encoder, pReq->createDb) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->isImport)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->createDb)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSCreateUserReq(void *buf, int32_t bufLen, SCreateUserReq *pReq) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->createType) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->superUser) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->sysInfo) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->enable) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->user) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->pass) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->numIpRanges) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->createType)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->superUser)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->sysInfo)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->enable)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->user)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->pass)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->numIpRanges)); pReq->pIpRanges = taosMemoryMalloc(pReq->numIpRanges * sizeof(SIpV4Range)); - if (pReq->pIpRanges == NULL) return -1; + if (pReq->pIpRanges == NULL) { + TAOS_CHECK_EXIT(terrno); + } for (int32_t i = 0; i < pReq->numIpRanges; ++i) { - if (tDecodeU32(&decoder, &(pReq->pIpRanges[i].ip)) < 0) return -1; - if (tDecodeU32(&decoder, &(pReq->pIpRanges[i].mask)) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeU32(&decoder, &(pReq->pIpRanges[i].ip))); + TAOS_CHECK_EXIT(tDecodeU32(&decoder, &(pReq->pIpRanges[i].mask))); } DECODESQL(); if (!tDecodeIsEnd(&decoder)) { - if (tDecodeI8(&decoder, &pReq->createDb) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->isImport) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->createDb)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->isImport)); } tEndDecode(&decoder); + +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSUpdateIpWhite(void *buf, int32_t bufLen, SUpdateIpWhite *pReq) { - // impl later 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, pReq->ver) < 0) return -1; - if (tEncodeI32(&encoder, pReq->numOfUser) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->ver)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->numOfUser)); for (int i = 0; i < pReq->numOfUser; i++) { SUpdateUserIpWhite *pUser = &(pReq->pUserIpWhite[i]); - if (tEncodeI64(&encoder, pUser->ver) < 0) return -1; - if (tEncodeCStr(&encoder, pUser->user) < 0) return -1; - if (tEncodeI32(&encoder, pUser->numOfRange) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pUser->ver)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pUser->user)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pUser->numOfRange)); for (int j = 0; j < pUser->numOfRange; j++) { SIpV4Range *pRange = &pUser->pIpRanges[j]; - if (tEncodeU32(&encoder, pRange->ip) < 0) return -1; - if (tEncodeU32(&encoder, pRange->mask) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeU32(&encoder, pRange->ip)); + TAOS_CHECK_EXIT(tEncodeU32(&encoder, pRange->mask)); } } tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSUpdateIpWhite(void *buf, int32_t bufLen, SUpdateIpWhite *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)); // impl later - if (tDecodeI64(&decoder, &pReq->ver) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->numOfUser) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->ver)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->numOfUser)); - if ((pReq->pUserIpWhite = taosMemoryCalloc(1, sizeof(SUpdateUserIpWhite) * pReq->numOfUser)) == NULL) return -1; + if ((pReq->pUserIpWhite = taosMemoryCalloc(1, sizeof(SUpdateUserIpWhite) * pReq->numOfUser)) == NULL) { + TAOS_CHECK_EXIT(terrno); + } for (int i = 0; i < pReq->numOfUser; i++) { SUpdateUserIpWhite *pUserWhite = &pReq->pUserIpWhite[i]; - if (tDecodeI64(&decoder, &pUserWhite->ver) < 0) return -1; - if (tDecodeCStrTo(&decoder, pUserWhite->user) < 0) return -1; - if (tDecodeI32(&decoder, &pUserWhite->numOfRange) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pUserWhite->ver)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pUserWhite->user)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pUserWhite->numOfRange)); - if ((pUserWhite->pIpRanges = taosMemoryCalloc(1, pUserWhite->numOfRange * sizeof(SIpV4Range))) == NULL) return -1; + if ((pUserWhite->pIpRanges = taosMemoryCalloc(1, pUserWhite->numOfRange * sizeof(SIpV4Range))) == NULL) { + TAOS_CHECK_EXIT(terrno); + } for (int j = 0; j < pUserWhite->numOfRange; j++) { SIpV4Range *pRange = &pUserWhite->pIpRanges[j]; - if (tDecodeU32(&decoder, &pRange->ip) < 0) return -1; - if (tDecodeU32(&decoder, &pRange->mask) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeU32(&decoder, &pRange->ip)); + TAOS_CHECK_EXIT(tDecodeU32(&decoder, &pRange->mask)); } } tEndDecode(&decoder); + +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSUpdateIpWhiteReq(SUpdateIpWhite *pReq) { if (pReq == NULL) return; @@ -1829,7 +2009,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; @@ -1837,7 +2017,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++) { @@ -1851,7 +2031,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); @@ -1867,29 +2047,39 @@ _return: } int32_t tSerializeRetrieveIpWhite(void *buf, int32_t bufLen, SRetrieveIpWhiteReq *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 (tEncodeI64(&encoder, pReq->ipWhiteVer) < 0) { - return -1; - } + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->ipWhiteVer)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeRetrieveIpWhite(void *buf, int32_t bufLen, SRetrieveIpWhiteReq *pReq) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; + tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - // impl later - if (tDecodeI64(&decoder, &pReq->ipWhiteVer) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->ipWhiteVer)); tEndDecode(&decoder); + +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSCreateUserReq(SCreateUserReq *pReq) { @@ -1899,77 +2089,90 @@ void tFreeSCreateUserReq(SCreateUserReq *pReq) { int32_t tSerializeSAlterUserReq(void *buf, int32_t bufLen, SAlterUserReq *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 (tEncodeI8(&encoder, pReq->alterType) < 0) return -1; - if (tEncodeI8(&encoder, pReq->superUser) < 0) return -1; - if (tEncodeI8(&encoder, pReq->sysInfo) < 0) return -1; - if (tEncodeI8(&encoder, pReq->enable) < 0) return -1; - if (tEncodeI8(&encoder, pReq->isView) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->user) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->pass) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->objname) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->alterType)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->superUser)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->sysInfo)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->enable)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->isView)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->user)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->pass)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->objname)); int32_t len = strlen(pReq->tabName); - if (tEncodeI32(&encoder, len) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, len)); if (len > 0) { - if (tEncodeCStr(&encoder, pReq->tabName) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->tabName)); } - if (tEncodeBinary(&encoder, pReq->tagCond, pReq->tagCondLen) < 0) return -1; - if (tEncodeI32(&encoder, pReq->numIpRanges) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeBinary(&encoder, pReq->tagCond, pReq->tagCondLen)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->numIpRanges)); for (int32_t i = 0; i < pReq->numIpRanges; ++i) { - if (tEncodeU32(&encoder, pReq->pIpRanges[i].ip) < 0) return -1; - if (tEncodeU32(&encoder, pReq->pIpRanges[i].mask) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeU32(&encoder, pReq->pIpRanges[i].ip)); + TAOS_CHECK_EXIT(tEncodeU32(&encoder, pReq->pIpRanges[i].mask)); } - if (tEncodeI64(&encoder, pReq->privileges) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->privileges)); ENCODESQL(); - if (tEncodeU8(&encoder, pReq->flag) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeU8(&encoder, pReq->flag)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSAlterUserReq(void *buf, int32_t bufLen, SAlterUserReq *pReq) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->alterType) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->superUser) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->sysInfo) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->enable) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->isView) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->user) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->pass) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->objname) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->alterType)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->superUser)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->sysInfo)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->enable)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->isView)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->user)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->pass)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->objname)); if (!tDecodeIsEnd(&decoder)) { int32_t len = 0; - if (tDecodeI32(&decoder, &len) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &len)); if (len > 0) { - if (tDecodeCStrTo(&decoder, pReq->tabName) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->tabName)); } uint64_t tagCondLen = 0; - if (tDecodeBinaryAlloc(&decoder, (void **)&pReq->tagCond, &tagCondLen) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeBinaryAlloc(&decoder, (void **)&pReq->tagCond, &tagCondLen)); pReq->tagCondLen = tagCondLen; } - if (tDecodeI32(&decoder, &pReq->numIpRanges) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->numIpRanges)); pReq->pIpRanges = taosMemoryMalloc(pReq->numIpRanges * sizeof(SIpV4Range)); - if (pReq->pIpRanges == NULL) return -1; - for (int32_t i = 0; i < pReq->numIpRanges; ++i) { - if (tDecodeU32(&decoder, &(pReq->pIpRanges[i].ip)) < 0) return -1; - if (tDecodeU32(&decoder, &(pReq->pIpRanges[i].mask)) < 0) return -1; + if (pReq->pIpRanges == NULL) { + TAOS_CHECK_EXIT(terrno); } - if (tDecodeI64(&decoder, &pReq->privileges) < 0) return -1; + for (int32_t i = 0; i < pReq->numIpRanges; ++i) { + TAOS_CHECK_EXIT(tDecodeU32(&decoder, &(pReq->pIpRanges[i].ip))); + TAOS_CHECK_EXIT(tDecodeU32(&decoder, &(pReq->pIpRanges[i].mask))); + } + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->privileges)); DECODESQL(); if (!tDecodeIsEnd(&decoder)) { - if (tDecodeU8(&decoder, &pReq->flag) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeU8(&decoder, &pReq->flag)); } tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSAlterUserReq(SAlterUserReq *pReq) { @@ -1980,60 +2183,71 @@ void tFreeSAlterUserReq(SAlterUserReq *pReq) { int32_t tSerializeSGetUserAuthReq(void *buf, int32_t bufLen, SGetUserAuthReq *pReq) { SEncoder encoder = {0}; - tEncoderInit(&encoder, buf, bufLen); + int32_t code = 0; + int32_t lino; + int32_t tlen; - if (tStartEncode(&encoder) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->user) < 0) return -1; + tEncoderInit(&encoder, buf, bufLen); + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->user)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSGetUserAuthReq(void *buf, int32_t bufLen, SGetUserAuthReq *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->user) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->user)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSGetUserAuthRspImpl(SEncoder *pEncoder, SGetUserAuthRsp *pRsp) { - if (tEncodeCStr(pEncoder, pRsp->user) < 0) return -1; - if (tEncodeI8(pEncoder, pRsp->superAuth) < 0) return -1; - if (tEncodeI8(pEncoder, pRsp->sysInfo) < 0) return -1; - if (tEncodeI8(pEncoder, pRsp->enable) < 0) return -1; - if (tEncodeI8(pEncoder, pRsp->dropped) < 0) return -1; - if (tEncodeI32(pEncoder, pRsp->version) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, pRsp->user)); + TAOS_CHECK_RETURN(tEncodeI8(pEncoder, pRsp->superAuth)); + TAOS_CHECK_RETURN(tEncodeI8(pEncoder, pRsp->sysInfo)); + TAOS_CHECK_RETURN(tEncodeI8(pEncoder, pRsp->enable)); + TAOS_CHECK_RETURN(tEncodeI8(pEncoder, pRsp->dropped)); + TAOS_CHECK_RETURN(tEncodeI32(pEncoder, pRsp->version)); int32_t numOfCreatedDbs = taosHashGetSize(pRsp->createdDbs); int32_t numOfReadDbs = taosHashGetSize(pRsp->readDbs); int32_t numOfWriteDbs = taosHashGetSize(pRsp->writeDbs); - if (tEncodeI32(pEncoder, numOfCreatedDbs) < 0) return -1; - if (tEncodeI32(pEncoder, numOfReadDbs) < 0) return -1; - if (tEncodeI32(pEncoder, numOfWriteDbs) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeI32(pEncoder, numOfCreatedDbs)); + TAOS_CHECK_RETURN(tEncodeI32(pEncoder, numOfReadDbs)); + TAOS_CHECK_RETURN(tEncodeI32(pEncoder, numOfWriteDbs)); char *db = taosHashIterate(pRsp->createdDbs, NULL); while (db != NULL) { - if (tEncodeCStr(pEncoder, db) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, db)); db = taosHashIterate(pRsp->createdDbs, db); } db = taosHashIterate(pRsp->readDbs, NULL); while (db != NULL) { - if (tEncodeCStr(pEncoder, db) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, db)); db = taosHashIterate(pRsp->readDbs, db); } db = taosHashIterate(pRsp->writeDbs, NULL); while (db != NULL) { - if (tEncodeCStr(pEncoder, db) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, db)); db = taosHashIterate(pRsp->writeDbs, db); } @@ -2044,25 +2258,25 @@ int32_t tSerializeSGetUserAuthRspImpl(SEncoder *pEncoder, SGetUserAuthRsp *pRsp) int32_t numOfWriteViews = taosHashGetSize(pRsp->writeViews); int32_t numOfAlterViews = taosHashGetSize(pRsp->alterViews); int32_t numOfUseDbs = taosHashGetSize(pRsp->useDbs); - if (tEncodeI32(pEncoder, numOfReadTbs) < 0) return -1; - if (tEncodeI32(pEncoder, numOfWriteTbs) < 0) return -1; - if (tEncodeI32(pEncoder, numOfAlterTbs) < 0) return -1; - if (tEncodeI32(pEncoder, numOfReadViews) < 0) return -1; - if (tEncodeI32(pEncoder, numOfWriteViews) < 0) return -1; - if (tEncodeI32(pEncoder, numOfAlterViews) < 0) return -1; - if (tEncodeI32(pEncoder, numOfUseDbs) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeI32(pEncoder, numOfReadTbs)); + TAOS_CHECK_RETURN(tEncodeI32(pEncoder, numOfWriteTbs)); + TAOS_CHECK_RETURN(tEncodeI32(pEncoder, numOfAlterTbs)); + TAOS_CHECK_RETURN(tEncodeI32(pEncoder, numOfReadViews)); + TAOS_CHECK_RETURN(tEncodeI32(pEncoder, numOfWriteViews)); + TAOS_CHECK_RETURN(tEncodeI32(pEncoder, numOfAlterViews)); + TAOS_CHECK_RETURN(tEncodeI32(pEncoder, numOfUseDbs)); char *tb = taosHashIterate(pRsp->readTbs, NULL); while (tb != NULL) { size_t keyLen = 0; void *key = taosHashGetKey(tb, &keyLen); - if (tEncodeI32(pEncoder, keyLen) < 0) return -1; - if (tEncodeCStr(pEncoder, key) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeI32(pEncoder, keyLen)); + TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, key)); size_t valueLen = 0; valueLen = strlen(tb); - if (tEncodeI32(pEncoder, valueLen) < 0) return -1; - if (tEncodeCStr(pEncoder, tb) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeI32(pEncoder, valueLen)); + TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, tb)); tb = taosHashIterate(pRsp->readTbs, tb); } @@ -2071,13 +2285,13 @@ int32_t tSerializeSGetUserAuthRspImpl(SEncoder *pEncoder, SGetUserAuthRsp *pRsp) while (tb != NULL) { size_t keyLen = 0; void *key = taosHashGetKey(tb, &keyLen); - if (tEncodeI32(pEncoder, keyLen) < 0) return -1; - if (tEncodeCStr(pEncoder, key) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeI32(pEncoder, keyLen)); + TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, key)); size_t valueLen = 0; valueLen = strlen(tb); - if (tEncodeI32(pEncoder, valueLen) < 0) return -1; - if (tEncodeCStr(pEncoder, tb) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeI32(pEncoder, valueLen)); + TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, tb)); tb = taosHashIterate(pRsp->writeTbs, tb); } @@ -2086,13 +2300,13 @@ int32_t tSerializeSGetUserAuthRspImpl(SEncoder *pEncoder, SGetUserAuthRsp *pRsp) while (tb != NULL) { size_t keyLen = 0; void *key = taosHashGetKey(tb, &keyLen); - if (tEncodeI32(pEncoder, keyLen) < 0) return -1; - if (tEncodeCStr(pEncoder, key) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeI32(pEncoder, keyLen)); + TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, key)); size_t valueLen = 0; valueLen = strlen(tb); - if (tEncodeI32(pEncoder, valueLen) < 0) return -1; - if (tEncodeCStr(pEncoder, tb) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeI32(pEncoder, valueLen)); + TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, tb)); tb = taosHashIterate(pRsp->alterTbs, tb); } @@ -2101,13 +2315,13 @@ int32_t tSerializeSGetUserAuthRspImpl(SEncoder *pEncoder, SGetUserAuthRsp *pRsp) while (tb != NULL) { size_t keyLen = 0; void *key = taosHashGetKey(tb, &keyLen); - if (tEncodeI32(pEncoder, keyLen) < 0) return -1; - if (tEncodeCStr(pEncoder, key) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeI32(pEncoder, keyLen)); + TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, key)); size_t valueLen = 0; valueLen = strlen(tb); - if (tEncodeI32(pEncoder, valueLen) < 0) return -1; - if (tEncodeCStr(pEncoder, tb) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeI32(pEncoder, valueLen)); + TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, tb)); tb = taosHashIterate(pRsp->readViews, tb); } @@ -2116,13 +2330,13 @@ int32_t tSerializeSGetUserAuthRspImpl(SEncoder *pEncoder, SGetUserAuthRsp *pRsp) while (tb != NULL) { size_t keyLen = 0; void *key = taosHashGetKey(tb, &keyLen); - if (tEncodeI32(pEncoder, keyLen) < 0) return -1; - if (tEncodeCStr(pEncoder, key) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeI32(pEncoder, keyLen)); + TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, key)); size_t valueLen = 0; valueLen = strlen(tb); - if (tEncodeI32(pEncoder, valueLen) < 0) return -1; - if (tEncodeCStr(pEncoder, tb) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeI32(pEncoder, valueLen)); + TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, tb)); tb = taosHashIterate(pRsp->writeViews, tb); } @@ -2131,13 +2345,13 @@ int32_t tSerializeSGetUserAuthRspImpl(SEncoder *pEncoder, SGetUserAuthRsp *pRsp) while (tb != NULL) { size_t keyLen = 0; void *key = taosHashGetKey(tb, &keyLen); - if (tEncodeI32(pEncoder, keyLen) < 0) return -1; - if (tEncodeCStr(pEncoder, key) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeI32(pEncoder, keyLen)); + TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, key)); size_t valueLen = 0; valueLen = strlen(tb); - if (tEncodeI32(pEncoder, valueLen) < 0) return -1; - if (tEncodeCStr(pEncoder, tb) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeI32(pEncoder, valueLen)); + TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, tb)); tb = taosHashIterate(pRsp->alterViews, tb); } @@ -2146,30 +2360,36 @@ int32_t tSerializeSGetUserAuthRspImpl(SEncoder *pEncoder, SGetUserAuthRsp *pRsp) while (useDb != NULL) { size_t keyLen = 0; void *key = taosHashGetKey(useDb, &keyLen); - if (tEncodeI32(pEncoder, keyLen) < 0) return -1; - if (tEncodeCStr(pEncoder, key) < 0) return -1; - - if (tEncodeI32(pEncoder, *useDb) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeI32(pEncoder, keyLen)); + TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, key)); + TAOS_CHECK_RETURN(tEncodeI32(pEncoder, *useDb)); useDb = taosHashIterate(pRsp->useDbs, useDb); } // since 3.0.7.0 - if (tEncodeI32(pEncoder, pRsp->passVer) < 0) return -1; - if (tEncodeI64(pEncoder, pRsp->whiteListVer) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeI32(pEncoder, pRsp->passVer)); + TAOS_CHECK_RETURN(tEncodeI64(pEncoder, pRsp->whiteListVer)); return 0; } int32_t tSerializeSGetUserAuthRsp(void *buf, int32_t bufLen, SGetUserAuthRsp *pRsp) { SEncoder encoder = {0}; + int32_t code = 0; + int32_t lino; + int32_t tlen; tEncoderInit(&encoder, buf, bufLen); - if (tStartEncode(&encoder) < 0) return -1; - - if (tSerializeSGetUserAuthRspImpl(&encoder, pRsp) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tSerializeSGetUserAuthRspImpl(&encoder, pRsp)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } @@ -2402,16 +2622,18 @@ _err: int32_t tDeserializeSGetUserAuthRsp(void *buf, int32_t bufLen, SGetUserAuthRsp *pRsp) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - - if (tDeserializeSGetUserAuthRspImpl(&decoder, pRsp) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDeserializeSGetUserAuthRspImpl(&decoder, pRsp)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSGetUserAuthRsp(SGetUserAuthRsp *pRsp) { @@ -2429,125 +2651,171 @@ void tFreeSGetUserAuthRsp(SGetUserAuthRsp *pRsp) { int32_t tSerializeSGetUserWhiteListReq(void *buf, int32_t bufLen, SGetUserWhiteListReq *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->user) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->user)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSGetUserWhiteListReq(void *buf, int32_t bufLen, SGetUserWhiteListReq *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->user) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->user)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSGetUserWhiteListRsp(void *buf, int32_t bufLen, SGetUserWhiteListRsp *pRsp) { 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, pRsp->user) < 0) return -1; - if (tEncodeI32(&encoder, pRsp->numWhiteLists) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pRsp->user)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pRsp->numWhiteLists)); for (int i = 0; i < pRsp->numWhiteLists; ++i) { - if (tEncodeU32(&encoder, pRsp->pWhiteLists[i].ip) < 0) return -1; - if (tEncodeU32(&encoder, pRsp->pWhiteLists[i].mask) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeU32(&encoder, pRsp->pWhiteLists[i].ip)); + TAOS_CHECK_EXIT(tEncodeU32(&encoder, pRsp->pWhiteLists[i].mask)); } tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSGetUserWhiteListRsp(void *buf, int32_t bufLen, SGetUserWhiteListRsp *pRsp) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeCStrTo(&decoder, pRsp->user) < 0) return -1; - - if (tDecodeI32(&decoder, &pRsp->numWhiteLists) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pRsp->user)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pRsp->numWhiteLists)); pRsp->pWhiteLists = taosMemoryMalloc(pRsp->numWhiteLists * sizeof(SIpV4Range)); - if (pRsp->pWhiteLists == NULL) return -1; + if (pRsp->pWhiteLists == NULL) { + TAOS_CHECK_EXIT(terrno); + } for (int32_t i = 0; i < pRsp->numWhiteLists; ++i) { - if (tDecodeU32(&decoder, &(pRsp->pWhiteLists[i].ip)) < 0) return -1; - if (tDecodeU32(&decoder, &(pRsp->pWhiteLists[i].mask)) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeU32(&decoder, &(pRsp->pWhiteLists[i].ip))); + TAOS_CHECK_EXIT(tDecodeU32(&decoder, &(pRsp->pWhiteLists[i].mask))); } tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSGetUserWhiteListRsp(SGetUserWhiteListRsp *pRsp) { taosMemoryFree(pRsp->pWhiteLists); } int32_t tSerializeSMCfgClusterReq(void *buf, int32_t bufLen, SMCfgClusterReq *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->config) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->value) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->config)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->value)); ENCODESQL(); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSMCfgClusterReq(void *buf, int32_t bufLen, SMCfgClusterReq *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->config) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->value) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->config)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->value)); DECODESQL(); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSMCfgClusterReq(SMCfgClusterReq *pReq) { FREESQL(); } int32_t tSerializeSCreateDropMQSNodeReq(void *buf, int32_t bufLen, SMCreateQnodeReq *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; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->dnodeId)); ENCODESQL(); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSCreateDropMQSNodeReq(void *buf, int32_t bufLen, SMCreateQnodeReq *pReq) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->dnodeId) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->dnodeId)); DECODESQL(); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSMCreateQnodeReq(SMCreateQnodeReq *pReq) { FREESQL(); } @@ -2556,33 +2824,43 @@ void tFreeSDDropQnodeReq(SDDropQnodeReq *pReq) { FREESQL(); } int32_t tSerializeSDropDnodeReq(void *buf, int32_t bufLen, SDropDnodeReq *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 (tEncodeCStr(&encoder, pReq->fqdn) < 0) return -1; - if (tEncodeI32(&encoder, pReq->port) < 0) return -1; - if (tEncodeI8(&encoder, pReq->force) < 0) return -1; - if (tEncodeI8(&encoder, pReq->unsafe) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->dnodeId)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->fqdn)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->port)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->force)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->unsafe)); ENCODESQL(); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSDropDnodeReq(void *buf, int32_t bufLen, SDropDnodeReq *pReq) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->dnodeId) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->fqdn) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->port) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->force) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->dnodeId)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->fqdn)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->port)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->force)); if (!tDecodeIsEnd(&decoder)) { - if (tDecodeI8(&decoder, &pReq->unsafe) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->unsafe)); } else { pReq->unsafe = false; } @@ -2590,214 +2868,270 @@ int32_t tDeserializeSDropDnodeReq(void *buf, int32_t bufLen, SDropDnodeReq *pReq DECODESQL(); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSDropDnodeReq(SDropDnodeReq *pReq) { FREESQL(); } int32_t tSerializeSRestoreDnodeReq(void *buf, int32_t bufLen, SRestoreDnodeReq *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 (tEncodeI8(&encoder, pReq->restoreType) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->dnodeId)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->restoreType)); ENCODESQL(); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSRestoreDnodeReq(void *buf, int32_t bufLen, SRestoreDnodeReq *pReq) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->dnodeId) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->restoreType) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->dnodeId)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->restoreType)); DECODESQL(); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSRestoreDnodeReq(SRestoreDnodeReq *pReq) { FREESQL(); } int32_t tSerializeSMCfgDnodeReq(void *buf, int32_t bufLen, SMCfgDnodeReq *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 (tEncodeCStr(&encoder, pReq->config) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->value) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->dnodeId)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->config)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->value)); ENCODESQL(); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSMCfgDnodeReq(void *buf, int32_t bufLen, SMCfgDnodeReq *pReq) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->dnodeId) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->config) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->value) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->dnodeId)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->config)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->value)); DECODESQL(); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSMCfgDnodeReq(SMCfgDnodeReq *pReq) { FREESQL(); } int32_t tSerializeSDCfgDnodeReq(void *buf, int32_t bufLen, SDCfgDnodeReq *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->config) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->value) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->config)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->value)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSDCfgDnodeReq(void *buf, int32_t bufLen, SDCfgDnodeReq *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->config) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->value) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->config)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->value)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSCreateDnodeReq(void *buf, int32_t bufLen, SCreateDnodeReq *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->fqdn) < 0) return -1; - if (tEncodeI32(&encoder, pReq->port) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->fqdn)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->port)); ENCODESQL(); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSCreateDnodeReq(void *buf, int32_t bufLen, SCreateDnodeReq *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->fqdn) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->port) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->fqdn)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->port)); DECODESQL(); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSCreateDnodeReq(SCreateDnodeReq *pReq) { FREESQL(); } int32_t tSerializeSCreateFuncReq(void *buf, int32_t bufLen, SCreateFuncReq *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->funcType) < 0) return -1; - if (tEncodeI8(&encoder, pReq->scriptType) < 0) return -1; - if (tEncodeI8(&encoder, pReq->outputType) < 0) return -1; - if (tEncodeI32(&encoder, pReq->outputLen) < 0) return -1; - if (tEncodeI32(&encoder, pReq->bufSize) < 0) return -1; - if (tEncodeI32(&encoder, pReq->codeLen) < 0) return -1; - if (tEncodeI64(&encoder, pReq->signature) < 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->funcType)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->scriptType)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->outputType)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->outputLen)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->bufSize)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->codeLen)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->signature)); if (pReq->pCode != NULL) { - if (tEncodeBinary(&encoder, pReq->pCode, pReq->codeLen) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeBinary(&encoder, pReq->pCode, pReq->codeLen)); } int32_t commentSize = 0; if (pReq->pComment != NULL) { commentSize = strlen(pReq->pComment) + 1; } - if (tEncodeI32(&encoder, commentSize) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, commentSize)); if (pReq->pComment != NULL) { - if (tEncodeCStr(&encoder, pReq->pComment) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->pComment)); } - if (tEncodeI8(&encoder, pReq->orReplace) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->orReplace)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSCreateFuncReq(void *buf, int32_t bufLen, SCreateFuncReq *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->funcType) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->scriptType) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->outputType) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->outputLen) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->bufSize) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->codeLen) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->signature) < 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->funcType)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->scriptType)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->outputType)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->outputLen)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->bufSize)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->codeLen)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->signature)); if (pReq->codeLen > 0) { pReq->pCode = taosMemoryCalloc(1, pReq->codeLen); if (pReq->pCode == NULL) { - return -1; + TAOS_CHECK_EXIT(terrno); } - if (tDecodeCStrTo(&decoder, pReq->pCode) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->pCode)); } int32_t commentSize = 0; - if (tDecodeI32(&decoder, &commentSize) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &commentSize)); if (commentSize > 0) { pReq->pComment = taosMemoryCalloc(1, commentSize); if (pReq->pComment == NULL) { - return -1; + TAOS_CHECK_EXIT(terrno); } - if (tDecodeCStrTo(&decoder, pReq->pComment) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->pComment)); } if (!tDecodeIsEnd(&decoder)) { - if (tDecodeI8(&decoder, &pReq->orReplace) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->orReplace)); } else { pReq->orReplace = false; } tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSCreateFuncReq(SCreateFuncReq *pReq) { @@ -2807,176 +3141,229 @@ void tFreeSCreateFuncReq(SCreateFuncReq *pReq) { int32_t tSerializeSDropFuncReq(void *buf, int32_t bufLen, SDropFuncReq *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; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->name)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->igNotExists)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSDropFuncReq(void *buf, int32_t bufLen, SDropFuncReq *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 tSerializeSRetrieveFuncReq(void *buf, int32_t bufLen, SRetrieveFuncReq *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->numOfFuncs) < 0) return -1; - if (tEncodeI8(&encoder, pReq->ignoreCodeComment) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->numOfFuncs)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->ignoreCodeComment)); - if (pReq->numOfFuncs != (int32_t)taosArrayGetSize(pReq->pFuncNames)) return -1; + if (pReq->numOfFuncs != (int32_t)taosArrayGetSize(pReq->pFuncNames)) { + TAOS_CHECK_EXIT(TSDB_CODE_INVALID_PARA); + } for (int32_t i = 0; i < pReq->numOfFuncs; ++i) { char *fname = taosArrayGet(pReq->pFuncNames, i); - if (tEncodeCStr(&encoder, fname) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, fname)); } tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSRetrieveFuncReq(void *buf, int32_t bufLen, SRetrieveFuncReq *pReq) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->numOfFuncs) < 0) return -1; - if (tDecodeI8(&decoder, (int8_t *)&pReq->ignoreCodeComment) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->numOfFuncs)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, (int8_t *)&pReq->ignoreCodeComment)); pReq->pFuncNames = taosArrayInit(pReq->numOfFuncs, TSDB_FUNC_NAME_LEN); - if (pReq->pFuncNames == NULL) return -1; + if (pReq->pFuncNames == NULL) { + TAOS_CHECK_EXIT(terrno); + } for (int32_t i = 0; i < pReq->numOfFuncs; ++i) { char fname[TSDB_FUNC_NAME_LEN] = {0}; - if (tDecodeCStrTo(&decoder, fname) < 0) return -1; - if (taosArrayPush(pReq->pFuncNames, fname) == NULL) return -1; + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, fname)); + if (taosArrayPush(pReq->pFuncNames, fname) == NULL) { + TAOS_CHECK_EXIT(terrno); + } } tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSRetrieveFuncReq(SRetrieveFuncReq *pReq) { taosArrayDestroy(pReq->pFuncNames); } int32_t tSerializeSRetrieveFuncRsp(void *buf, int32_t bufLen, SRetrieveFuncRsp *pRsp) { 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, pRsp->numOfFuncs) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pRsp->numOfFuncs)); - if (pRsp->numOfFuncs != (int32_t)taosArrayGetSize(pRsp->pFuncInfos)) return -1; + if (pRsp->numOfFuncs != (int32_t)taosArrayGetSize(pRsp->pFuncInfos)) { + TAOS_CHECK_EXIT(TSDB_CODE_INVALID_PARA); + } for (int32_t i = 0; i < pRsp->numOfFuncs; ++i) { SFuncInfo *pInfo = taosArrayGet(pRsp->pFuncInfos, i); - if (tEncodeCStr(&encoder, pInfo->name) < 0) return -1; - if (tEncodeI8(&encoder, pInfo->funcType) < 0) return -1; - if (tEncodeI8(&encoder, pInfo->scriptType) < 0) return -1; - if (tEncodeI8(&encoder, pInfo->outputType) < 0) return -1; - if (tEncodeI32(&encoder, pInfo->outputLen) < 0) return -1; - if (tEncodeI32(&encoder, pInfo->bufSize) < 0) return -1; - if (tEncodeI64(&encoder, pInfo->signature) < 0) return -1; - if (tEncodeI32(&encoder, pInfo->codeSize) < 0) return -1; - if (tEncodeI32(&encoder, pInfo->commentSize) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pInfo->name)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pInfo->funcType)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pInfo->scriptType)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pInfo->outputType)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pInfo->outputLen)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pInfo->bufSize)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pInfo->signature)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pInfo->codeSize)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pInfo->commentSize)); if (pInfo->codeSize) { - if (tEncodeBinary(&encoder, pInfo->pCode, pInfo->codeSize) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeBinary(&encoder, pInfo->pCode, pInfo->codeSize)); } if (pInfo->commentSize) { - if (tEncodeCStr(&encoder, pInfo->pComment) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pInfo->pComment)); } } - if (pRsp->numOfFuncs != (int32_t)taosArrayGetSize(pRsp->pFuncExtraInfos)) return -1; + if (pRsp->numOfFuncs != (int32_t)taosArrayGetSize(pRsp->pFuncExtraInfos)) { + TAOS_CHECK_EXIT(TSDB_CODE_INVALID_PARA); + } for (int32_t i = 0; i < pRsp->numOfFuncs; ++i) { SFuncExtraInfo *extraInfo = taosArrayGet(pRsp->pFuncExtraInfos, i); - if (tEncodeI32(&encoder, extraInfo->funcVersion) < 0) return -1; - if (tEncodeI64(&encoder, extraInfo->funcCreatedTime) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, extraInfo->funcVersion)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, extraInfo->funcCreatedTime)); } tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSRetrieveFuncRsp(void *buf, int32_t bufLen, SRetrieveFuncRsp *pRsp) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeI32(&decoder, &pRsp->numOfFuncs) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pRsp->numOfFuncs)); pRsp->pFuncInfos = taosArrayInit(pRsp->numOfFuncs, sizeof(SFuncInfo)); - if (pRsp->pFuncInfos == NULL) return -1; + if (pRsp->pFuncInfos == NULL) { + TAOS_CHECK_EXIT(terrno); + } for (int32_t i = 0; i < pRsp->numOfFuncs; ++i) { SFuncInfo fInfo = {0}; - if (tDecodeCStrTo(&decoder, fInfo.name) < 0) return -1; - if (tDecodeI8(&decoder, &fInfo.funcType) < 0) return -1; - if (tDecodeI8(&decoder, &fInfo.scriptType) < 0) return -1; - if (tDecodeI8(&decoder, &fInfo.outputType) < 0) return -1; - if (tDecodeI32(&decoder, &fInfo.outputLen) < 0) return -1; - if (tDecodeI32(&decoder, &fInfo.bufSize) < 0) return -1; - if (tDecodeI64(&decoder, &fInfo.signature) < 0) return -1; - if (tDecodeI32(&decoder, &fInfo.codeSize) < 0) return -1; - if (tDecodeI32(&decoder, &fInfo.commentSize) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, fInfo.name)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &fInfo.funcType)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &fInfo.scriptType)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &fInfo.outputType)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &fInfo.outputLen)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &fInfo.bufSize)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &fInfo.signature)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &fInfo.codeSize)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &fInfo.commentSize)); if (fInfo.codeSize) { fInfo.pCode = taosMemoryCalloc(1, fInfo.codeSize); if (fInfo.pCode == NULL) { - return -1; + TAOS_CHECK_EXIT(terrno); } - if (tDecodeCStrTo(&decoder, fInfo.pCode) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, fInfo.pCode)); } if (fInfo.commentSize) { fInfo.pComment = taosMemoryCalloc(1, fInfo.commentSize); if (fInfo.pComment == NULL) { - return -1; + TAOS_CHECK_EXIT(terrno); } - if (tDecodeCStrTo(&decoder, fInfo.pComment) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, fInfo.pComment)); } - if (taosArrayPush(pRsp->pFuncInfos, &fInfo) == NULL) return -1; + if (taosArrayPush(pRsp->pFuncInfos, &fInfo) == NULL) { + TAOS_CHECK_EXIT(terrno); + } } pRsp->pFuncExtraInfos = taosArrayInit(pRsp->numOfFuncs, sizeof(SFuncExtraInfo)); - if (pRsp->pFuncExtraInfos == NULL) return -1; + if (pRsp->pFuncExtraInfos == NULL) { + TAOS_CHECK_EXIT(terrno); + } if (tDecodeIsEnd(&decoder)) { for (int32_t i = 0; i < pRsp->numOfFuncs; ++i) { SFuncExtraInfo extraInfo = {0}; - if (taosArrayPush(pRsp->pFuncExtraInfos, &extraInfo) == NULL) return -1; + if (taosArrayPush(pRsp->pFuncExtraInfos, &extraInfo) == NULL) { + TAOS_CHECK_EXIT(terrno); + } } } else { for (int32_t i = 0; i < pRsp->numOfFuncs; ++i) { SFuncExtraInfo extraInfo = {0}; - if (tDecodeI32(&decoder, &extraInfo.funcVersion) < 0) return -1; - if (tDecodeI64(&decoder, &extraInfo.funcCreatedTime) < 0) return -1; - if (taosArrayPush(pRsp->pFuncExtraInfos, &extraInfo) == NULL) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &extraInfo.funcVersion)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &extraInfo.funcCreatedTime)); + if (taosArrayPush(pRsp->pFuncExtraInfos, &extraInfo) == NULL) { + TAOS_CHECK_EXIT(terrno); + } } } tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSFuncInfo(SFuncInfo *pInfo) { @@ -3046,113 +3433,129 @@ int32_t tDeserializeSTableCfgReq(void *buf, int32_t bufLen, STableCfgReq *pReq) int32_t tSerializeSTableCfgRsp(void *buf, int32_t bufLen, STableCfgRsp *pRsp) { 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, pRsp->tbName) < 0) return -1; - if (tEncodeCStr(&encoder, pRsp->stbName) < 0) return -1; - if (tEncodeCStr(&encoder, pRsp->dbFName) < 0) return -1; - if (tEncodeI32(&encoder, pRsp->numOfTags) < 0) return -1; - if (tEncodeI32(&encoder, pRsp->numOfColumns) < 0) return -1; - if (tEncodeI8(&encoder, pRsp->tableType) < 0) return -1; - if (tEncodeI64(&encoder, pRsp->delay1) < 0) return -1; - if (tEncodeI64(&encoder, pRsp->delay2) < 0) return -1; - if (tEncodeI64(&encoder, pRsp->watermark1) < 0) return -1; - if (tEncodeI64(&encoder, pRsp->watermark2) < 0) return -1; - if (tEncodeI32(&encoder, pRsp->ttl) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pRsp->tbName)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pRsp->stbName)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pRsp->dbFName)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pRsp->numOfTags)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pRsp->numOfColumns)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pRsp->tableType)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pRsp->delay1)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pRsp->delay2)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pRsp->watermark1)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pRsp->watermark2)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pRsp->ttl)); int32_t numOfFuncs = taosArrayGetSize(pRsp->pFuncs); - if (tEncodeI32(&encoder, numOfFuncs) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, numOfFuncs)); for (int32_t i = 0; i < numOfFuncs; ++i) { const char *pFunc = taosArrayGet(pRsp->pFuncs, i); - if (tEncodeCStr(&encoder, pFunc) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pFunc)); } - if (tEncodeI32(&encoder, pRsp->commentLen) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pRsp->commentLen)); if (pRsp->commentLen > 0) { - if (tEncodeCStr(&encoder, pRsp->pComment) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pRsp->pComment)); } for (int32_t i = 0; i < pRsp->numOfColumns + pRsp->numOfTags; ++i) { SSchema *pSchema = &pRsp->pSchemas[i]; - if (tEncodeSSchema(&encoder, pSchema) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeSSchema(&encoder, pSchema)); } - if (tEncodeI32(&encoder, pRsp->tagsLen) < 0) return -1; - if (tEncodeBinary(&encoder, pRsp->pTags, pRsp->tagsLen) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pRsp->tagsLen)); + TAOS_CHECK_EXIT(tEncodeBinary(&encoder, pRsp->pTags, pRsp->tagsLen)); if (useCompress(pRsp->tableType)) { for (int32_t i = 0; i < pRsp->numOfColumns; ++i) { SSchemaExt *pSchemaExt = &pRsp->pSchemaExt[i]; - if (tEncodeSSchemaExt(&encoder, pSchemaExt) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeSSchemaExt(&encoder, pSchemaExt)); } } tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSTableCfgRsp(void *buf, int32_t bufLen, STableCfgRsp *pRsp) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeCStrTo(&decoder, pRsp->tbName) < 0) return -1; - if (tDecodeCStrTo(&decoder, pRsp->stbName) < 0) return -1; - if (tDecodeCStrTo(&decoder, pRsp->dbFName) < 0) return -1; - if (tDecodeI32(&decoder, &pRsp->numOfTags) < 0) return -1; - if (tDecodeI32(&decoder, &pRsp->numOfColumns) < 0) return -1; - if (tDecodeI8(&decoder, &pRsp->tableType) < 0) return -1; - if (tDecodeI64(&decoder, &pRsp->delay1) < 0) return -1; - if (tDecodeI64(&decoder, &pRsp->delay2) < 0) return -1; - if (tDecodeI64(&decoder, &pRsp->watermark1) < 0) return -1; - if (tDecodeI64(&decoder, &pRsp->watermark2) < 0) return -1; - if (tDecodeI32(&decoder, &pRsp->ttl) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pRsp->tbName)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pRsp->stbName)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pRsp->dbFName)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pRsp->numOfTags)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pRsp->numOfColumns)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pRsp->tableType)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pRsp->delay1)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pRsp->delay2)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pRsp->watermark1)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pRsp->watermark2)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pRsp->ttl)); int32_t numOfFuncs = 0; - if (tDecodeI32(&decoder, &numOfFuncs) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &numOfFuncs)); if (numOfFuncs > 0) { pRsp->pFuncs = taosArrayInit(numOfFuncs, TSDB_FUNC_NAME_LEN); - if (NULL == pRsp->pFuncs) return -1; + if (NULL == pRsp->pFuncs) { + TAOS_CHECK_EXIT(terrno); + } } for (int32_t i = 0; i < numOfFuncs; ++i) { char pFunc[TSDB_FUNC_NAME_LEN]; - if (tDecodeCStrTo(&decoder, pFunc) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pFunc)); if (taosArrayPush(pRsp->pFuncs, pFunc) == NULL) { - return -1; + TAOS_CHECK_EXIT(terrno); } } - if (tDecodeI32(&decoder, &pRsp->commentLen) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pRsp->commentLen)); if (pRsp->commentLen > 0) { - if (tDecodeCStrAlloc(&decoder, &pRsp->pComment) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeCStrAlloc(&decoder, &pRsp->pComment)); } else { pRsp->pComment = NULL; } int32_t totalCols = pRsp->numOfTags + pRsp->numOfColumns; pRsp->pSchemas = taosMemoryMalloc(sizeof(SSchema) * totalCols); - if (pRsp->pSchemas == NULL) return -1; + if (pRsp->pSchemas == NULL) { + TAOS_CHECK_EXIT(terrno); + } for (int32_t i = 0; i < totalCols; ++i) { SSchema *pSchema = &pRsp->pSchemas[i]; - if (tDecodeSSchema(&decoder, pSchema) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeSSchema(&decoder, pSchema)); } - if (tDecodeI32(&decoder, &pRsp->tagsLen) < 0) return -1; - if (tDecodeBinaryAlloc(&decoder, (void **)&pRsp->pTags, NULL) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pRsp->tagsLen)); + TAOS_CHECK_EXIT(tDecodeBinaryAlloc(&decoder, (void **)&pRsp->pTags, NULL)); if (!tDecodeIsEnd(&decoder)) { if (useCompress(pRsp->tableType) && pRsp->numOfColumns > 0) { pRsp->pSchemaExt = taosMemoryMalloc(sizeof(SSchemaExt) * pRsp->numOfColumns); - if (pRsp->pSchemaExt == NULL) return -1; + if (pRsp->pSchemaExt == NULL) { + TAOS_CHECK_EXIT(terrno); + } for (int32_t i = 0; i < pRsp->numOfColumns; ++i) { SSchemaExt *pSchemaExt = &pRsp->pSchemaExt[i]; - if (tDecodeSSchemaExt(&decoder, pSchemaExt) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeSSchemaExt(&decoder, pSchemaExt)); } } else { pRsp->pSchemaExt = NULL; @@ -3160,8 +3563,9 @@ int32_t tDeserializeSTableCfgRsp(void *buf, int32_t bufLen, STableCfgRsp *pRsp) } tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSTableCfgRsp(STableCfgRsp *pRsp) { @@ -3179,120 +3583,131 @@ void tFreeSTableCfgRsp(STableCfgRsp *pRsp) { int32_t tSerializeSCreateDbReq(void *buf, int32_t bufLen, SCreateDbReq *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->db) < 0) return -1; - if (tEncodeI32(&encoder, pReq->numOfVgroups) < 0) return -1; - if (tEncodeI32(&encoder, pReq->numOfStables) < 0) return -1; - if (tEncodeI32(&encoder, pReq->buffer) < 0) return -1; - if (tEncodeI32(&encoder, pReq->pageSize) < 0) return -1; - if (tEncodeI32(&encoder, pReq->pages) < 0) return -1; - if (tEncodeI32(&encoder, pReq->cacheLastSize) < 0) return -1; - if (tEncodeI32(&encoder, pReq->daysPerFile) < 0) return -1; - if (tEncodeI32(&encoder, pReq->daysToKeep0) < 0) return -1; - if (tEncodeI32(&encoder, pReq->daysToKeep1) < 0) return -1; - if (tEncodeI32(&encoder, pReq->daysToKeep2) < 0) return -1; - if (tEncodeI32(&encoder, pReq->minRows) < 0) return -1; - if (tEncodeI32(&encoder, pReq->maxRows) < 0) return -1; - if (tEncodeI32(&encoder, pReq->walFsyncPeriod) < 0) return -1; - if (tEncodeI8(&encoder, pReq->walLevel) < 0) return -1; - if (tEncodeI8(&encoder, pReq->precision) < 0) return -1; - if (tEncodeI8(&encoder, pReq->compression) < 0) return -1; - if (tEncodeI8(&encoder, pReq->replications) < 0) return -1; - if (tEncodeI8(&encoder, pReq->strict) < 0) return -1; - if (tEncodeI8(&encoder, pReq->cacheLast) < 0) return -1; - if (tEncodeI8(&encoder, pReq->schemaless) < 0) return -1; - if (tEncodeI32(&encoder, pReq->walRetentionPeriod) < 0) return -1; - if (tEncodeI64(&encoder, pReq->walRetentionSize) < 0) return -1; - if (tEncodeI32(&encoder, pReq->walRollPeriod) < 0) return -1; - if (tEncodeI64(&encoder, pReq->walSegmentSize) < 0) return -1; - if (tEncodeI32(&encoder, pReq->sstTrigger) < 0) return -1; - if (tEncodeI16(&encoder, pReq->hashPrefix) < 0) return -1; - if (tEncodeI16(&encoder, pReq->hashSuffix) < 0) return -1; - if (tEncodeI8(&encoder, pReq->ignoreExist) < 0) return -1; - if (tEncodeI32(&encoder, pReq->numOfRetensions) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->db)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->numOfVgroups)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->numOfStables)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->buffer)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->pageSize)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->pages)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->cacheLastSize)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->daysPerFile)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->daysToKeep0)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->daysToKeep1)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->daysToKeep2)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->minRows)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->maxRows)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->walFsyncPeriod)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->walLevel)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->precision)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->compression)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->replications)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->strict)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->cacheLast)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->schemaless)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->walRetentionPeriod)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->walRetentionSize)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->walRollPeriod)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->walSegmentSize)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->sstTrigger)); + TAOS_CHECK_EXIT(tEncodeI16(&encoder, pReq->hashPrefix)); + TAOS_CHECK_EXIT(tEncodeI16(&encoder, pReq->hashSuffix)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->ignoreExist)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->numOfRetensions)); for (int32_t i = 0; i < pReq->numOfRetensions; ++i) { SRetention *pRetension = taosArrayGet(pReq->pRetensions, i); - if (tEncodeI64(&encoder, pRetension->freq) < 0) return -1; - if (tEncodeI64(&encoder, pRetension->keep) < 0) return -1; - if (tEncodeI8(&encoder, pRetension->freqUnit) < 0) return -1; - if (tEncodeI8(&encoder, pRetension->keepUnit) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pRetension->freq)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pRetension->keep)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pRetension->freqUnit)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pRetension->keepUnit)); } - if (tEncodeI32(&encoder, pReq->tsdbPageSize) < 0) return -1; - if (tEncodeI32(&encoder, pReq->keepTimeOffset) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->tsdbPageSize)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->keepTimeOffset)); ENCODESQL(); - if (tEncodeI8(&encoder, pReq->withArbitrator) < 0) return -1; - if (tEncodeI8(&encoder, pReq->encryptAlgorithm) < 0) return -1; - if (tEncodeI32(&encoder, pReq->s3ChunkSize) < 0) return -1; - if (tEncodeI32(&encoder, pReq->s3KeepLocal) < 0) return -1; - if (tEncodeI8(&encoder, pReq->s3Compact) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->withArbitrator)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->encryptAlgorithm)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->s3ChunkSize)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->s3KeepLocal)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->s3Compact)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSCreateDbReq(void *buf, int32_t bufLen, SCreateDbReq *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->db) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->numOfVgroups) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->numOfStables) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->buffer) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->pageSize) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->pages) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->cacheLastSize) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->daysPerFile) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->daysToKeep0) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->daysToKeep1) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->daysToKeep2) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->minRows) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->maxRows) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->walFsyncPeriod) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->walLevel) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->precision) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->compression) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->replications) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->strict) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->cacheLast) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->schemaless) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->walRetentionPeriod) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->walRetentionSize) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->walRollPeriod) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->walSegmentSize) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->sstTrigger) < 0) return -1; - if (tDecodeI16(&decoder, &pReq->hashPrefix) < 0) return -1; - if (tDecodeI16(&decoder, &pReq->hashSuffix) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->ignoreExist) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->numOfRetensions) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->db)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->numOfVgroups)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->numOfStables)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->buffer)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->pageSize)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->pages)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->cacheLastSize)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->daysPerFile)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->daysToKeep0)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->daysToKeep1)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->daysToKeep2)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->minRows)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->maxRows)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->walFsyncPeriod)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->walLevel)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->precision)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->compression)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->replications)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->strict)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->cacheLast)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->schemaless)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->walRetentionPeriod)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->walRetentionSize)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->walRollPeriod)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->walSegmentSize)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->sstTrigger)); + TAOS_CHECK_EXIT(tDecodeI16(&decoder, &pReq->hashPrefix)); + TAOS_CHECK_EXIT(tDecodeI16(&decoder, &pReq->hashSuffix)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->ignoreExist)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->numOfRetensions)); pReq->pRetensions = taosArrayInit(pReq->numOfRetensions, sizeof(SRetention)); if (pReq->pRetensions == NULL) { - return -1; + TAOS_CHECK_EXIT(terrno); } for (int32_t i = 0; i < pReq->numOfRetensions; ++i) { SRetention rentension = {0}; - if (tDecodeI64(&decoder, &rentension.freq) < 0) return -1; - if (tDecodeI64(&decoder, &rentension.keep) < 0) return -1; - if (tDecodeI8(&decoder, &rentension.freqUnit) < 0) return -1; - if (tDecodeI8(&decoder, &rentension.keepUnit) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &rentension.freq)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &rentension.keep)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &rentension.freqUnit)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &rentension.keepUnit)); if (taosArrayPush(pReq->pRetensions, &rentension) == NULL) { - return -1; + TAOS_CHECK_EXIT(terrno); } } - if (tDecodeI32(&decoder, &pReq->tsdbPageSize) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->tsdbPageSize)); pReq->keepTimeOffset = TSDB_DEFAULT_KEEP_TIME_OFFSET; if (!tDecodeIsEnd(&decoder)) { - if (tDecodeI32(&decoder, &pReq->keepTimeOffset) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->keepTimeOffset)); } DECODESQL(); @@ -3303,16 +3718,18 @@ int32_t tDeserializeSCreateDbReq(void *buf, int32_t bufLen, SCreateDbReq *pReq) pReq->s3KeepLocal = TSDB_DEFAULT_S3_KEEP_LOCAL; pReq->s3Compact = TSDB_DEFAULT_S3_COMPACT; if (!tDecodeIsEnd(&decoder)) { - if (tDecodeI8(&decoder, &pReq->withArbitrator) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->encryptAlgorithm) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->s3ChunkSize) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->s3KeepLocal) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->s3Compact) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->withArbitrator)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->encryptAlgorithm)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->s3ChunkSize)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->s3KeepLocal)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->s3Compact)); } tEndDecode(&decoder); + +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSCreateDbReq(SCreateDbReq *pReq) { @@ -3323,616 +3740,776 @@ void tFreeSCreateDbReq(SCreateDbReq *pReq) { int32_t tSerializeSAlterDbReq(void *buf, int32_t bufLen, SAlterDbReq *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->db) < 0) return -1; - if (tEncodeI32(&encoder, pReq->buffer) < 0) return -1; - if (tEncodeI32(&encoder, pReq->pageSize) < 0) return -1; - if (tEncodeI32(&encoder, pReq->pages) < 0) return -1; - if (tEncodeI32(&encoder, pReq->cacheLastSize) < 0) return -1; - if (tEncodeI32(&encoder, pReq->daysPerFile) < 0) return -1; - if (tEncodeI32(&encoder, pReq->daysToKeep0) < 0) return -1; - if (tEncodeI32(&encoder, pReq->daysToKeep1) < 0) return -1; - if (tEncodeI32(&encoder, pReq->daysToKeep2) < 0) return -1; - if (tEncodeI32(&encoder, pReq->walFsyncPeriod) < 0) return -1; - if (tEncodeI8(&encoder, pReq->walLevel) < 0) return -1; - if (tEncodeI8(&encoder, pReq->strict) < 0) return -1; - if (tEncodeI8(&encoder, pReq->cacheLast) < 0) return -1; - if (tEncodeI8(&encoder, pReq->replications) < 0) return -1; - if (tEncodeI32(&encoder, pReq->sstTrigger) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->db)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->buffer)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->pageSize)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->pages)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->cacheLastSize)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->daysPerFile)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->daysToKeep0)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->daysToKeep1)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->daysToKeep2)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->walFsyncPeriod)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->walLevel)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->strict)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->cacheLast)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->replications)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->sstTrigger)); // 1st modification - if (tEncodeI32(&encoder, pReq->minRows) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->minRows)); // 2nd modification - if (tEncodeI32(&encoder, pReq->walRetentionPeriod) < 0) return -1; - if (tEncodeI32(&encoder, pReq->walRetentionSize) < 0) return -1; - if (tEncodeI32(&encoder, pReq->keepTimeOffset) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->walRetentionPeriod)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->walRetentionSize)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->keepTimeOffset)); - if (tEncodeI32(&encoder, pReq->s3KeepLocal) < 0) return -1; - if (tEncodeI8(&encoder, pReq->s3Compact) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->s3KeepLocal)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->s3Compact)); ENCODESQL(); - if (tEncodeI8(&encoder, pReq->withArbitrator) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->withArbitrator)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSAlterDbReq(void *buf, int32_t bufLen, SAlterDbReq *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->db) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->buffer) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->pageSize) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->pages) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->cacheLastSize) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->daysPerFile) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->daysToKeep0) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->daysToKeep1) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->daysToKeep2) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->walFsyncPeriod) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->walLevel) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->strict) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->cacheLast) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->replications) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->sstTrigger) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->db)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->buffer)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->pageSize)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->pages)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->cacheLastSize)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->daysPerFile)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->daysToKeep0)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->daysToKeep1)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->daysToKeep2)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->walFsyncPeriod)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->walLevel)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->strict)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->cacheLast)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->replications)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->sstTrigger)); // 1st modification if (!tDecodeIsEnd(&decoder)) { - if (tDecodeI32(&decoder, &pReq->minRows) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->minRows)); } else { pReq->minRows = -1; } // 2nd modification if (!tDecodeIsEnd(&decoder)) { - if (tDecodeI32(&decoder, &pReq->walRetentionPeriod) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->walRetentionSize) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->walRetentionPeriod)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->walRetentionSize)); } else { pReq->walRetentionPeriod = -1; pReq->walRetentionSize = -1; } pReq->keepTimeOffset = TSDB_DEFAULT_KEEP_TIME_OFFSET; if (!tDecodeIsEnd(&decoder)) { - if (tDecodeI32(&decoder, &pReq->keepTimeOffset) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->keepTimeOffset)); } pReq->s3KeepLocal = TSDB_DEFAULT_S3_KEEP_LOCAL; pReq->s3Compact = TSDB_DEFAULT_S3_COMPACT; if (!tDecodeIsEnd(&decoder)) { - if (tDecodeI32(&decoder, &pReq->s3KeepLocal) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->s3Compact) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->s3KeepLocal)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->s3Compact)); } DECODESQL(); pReq->withArbitrator = TSDB_DEFAULT_DB_WITH_ARBITRATOR; if (!tDecodeIsEnd(&decoder)) { - if (tDecodeI8(&decoder, &pReq->withArbitrator) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->withArbitrator)); } tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSAlterDbReq(SAlterDbReq *pReq) { FREESQL(); } int32_t tSerializeSDropDbReq(void *buf, int32_t bufLen, SDropDbReq *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->db) < 0) return -1; - if (tEncodeI8(&encoder, pReq->ignoreNotExists) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->db)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->ignoreNotExists)); ENCODESQL(); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSDropDbReq(void *buf, int32_t bufLen, SDropDbReq *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->db) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->ignoreNotExists) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->db)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->ignoreNotExists)); DECODESQL(); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSDropDbReq(SDropDbReq *pReq) { FREESQL(); } int32_t tSerializeSDropDbRsp(void *buf, int32_t bufLen, SDropDbRsp *pRsp) { 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, pRsp->db) < 0) return -1; - if (tEncodeI64(&encoder, pRsp->uid) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pRsp->db)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pRsp->uid)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSDropDbRsp(void *buf, int32_t bufLen, SDropDbRsp *pRsp) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeCStrTo(&decoder, pRsp->db) < 0) return -1; - if (tDecodeI64(&decoder, &pRsp->uid) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pRsp->db)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pRsp->uid)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSUseDbReq(void *buf, int32_t bufLen, SUseDbReq *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->db) < 0) return -1; - if (tEncodeI64(&encoder, pReq->dbId) < 0) return -1; - if (tEncodeI32(&encoder, pReq->vgVersion) < 0) return -1; - if (tEncodeI32(&encoder, pReq->numOfTable) < 0) return -1; - if (tEncodeI64(&encoder, pReq->stateTs) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->db)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->dbId)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->vgVersion)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->numOfTable)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->stateTs)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSUseDbReq(void *buf, int32_t bufLen, SUseDbReq *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->db) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->dbId) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->vgVersion) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->numOfTable) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->stateTs) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->db)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->dbId)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->vgVersion)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->numOfTable)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->stateTs)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSQnodeListReq(void *buf, int32_t bufLen, SQnodeListReq *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->rowNum) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->rowNum)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSQnodeListReq(void *buf, int32_t bufLen, SQnodeListReq *pReq) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->rowNum) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->rowNum)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSDnodeListReq(void *buf, int32_t bufLen, SDnodeListReq *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->rowNum) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->rowNum)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tSerializeSServerVerReq(void *buf, int32_t bufLen, SServerVerReq *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->useless) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->useless)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } -// int32_t tDeserializeSServerVerReq(void *buf, int32_t bufLen, SServerVerReq *pReq) { -// SDecoder decoder = {0}; -// tDecoderInit(&decoder, buf, bufLen); - -// if (tStartDecode(&decoder) < 0) return -1; -// if (tDecodeI32(&decoder, &pReq->useless) < 0) return -1; - -// tEndDecode(&decoder); -// tDecoderClear(&decoder); -// return 0; -// } - int32_t tSerializeSServerVerRsp(void *buf, int32_t bufLen, SServerVerRsp *pRsp) { 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, pRsp->ver) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pRsp->ver)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSServerVerRsp(void *buf, int32_t bufLen, SServerVerRsp *pRsp) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeCStrTo(&decoder, pRsp->ver) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pRsp->ver)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSQnodeListRsp(void *buf, int32_t bufLen, SQnodeListRsp *pRsp) { 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)); int32_t num = taosArrayGetSize(pRsp->qnodeList); - if (tEncodeI32(&encoder, num) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, num)); for (int32_t i = 0; i < num; ++i) { SQueryNodeLoad *pLoad = taosArrayGet(pRsp->qnodeList, i); - if (tEncodeSQueryNodeLoad(&encoder, pLoad) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeSQueryNodeLoad(&encoder, pLoad)); } tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSQnodeListRsp(void *buf, int32_t bufLen, SQnodeListRsp *pRsp) { 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)); int32_t num = 0; - if (tDecodeI32(&decoder, &num) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &num)); if (NULL == pRsp->qnodeList) { pRsp->qnodeList = taosArrayInit(num, sizeof(SQueryNodeLoad)); - if (NULL == pRsp->qnodeList) return -1; + if (NULL == pRsp->qnodeList) { + TAOS_CHECK_EXIT(terrno); + } } for (int32_t i = 0; i < num; ++i) { SQueryNodeLoad load = {0}; - if (tDecodeSQueryNodeLoad(&decoder, &load) < 0) return -1; - if (taosArrayPush(pRsp->qnodeList, &load) == NULL) return -1; + TAOS_CHECK_EXIT(tDecodeSQueryNodeLoad(&decoder, &load)); + if (taosArrayPush(pRsp->qnodeList, &load) == NULL) { + TAOS_CHECK_EXIT(terrno); + } } tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSQnodeListRsp(SQnodeListRsp *pRsp) { taosArrayDestroy(pRsp->qnodeList); } int32_t tSerializeSDnodeListRsp(void *buf, int32_t bufLen, SDnodeListRsp *pRsp) { 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)); int32_t num = taosArrayGetSize(pRsp->dnodeList); - if (tEncodeI32(&encoder, num) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, num)); for (int32_t i = 0; i < num; ++i) { SEpSet *pEpSet = taosArrayGet(pRsp->dnodeList, i); - if (tEncodeSEpSet(&encoder, pEpSet) < 0) return -1; + 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 tDeserializeSDnodeListRsp(void *buf, int32_t bufLen, SDnodeListRsp *pRsp) { 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)); int32_t num = 0; - if (tDecodeI32(&decoder, &num) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &num)); if (NULL == pRsp->dnodeList) { pRsp->dnodeList = taosArrayInit(num, sizeof(SEpSet)); - if (NULL == pRsp->dnodeList) return -1; + if (NULL == pRsp->dnodeList) { + TAOS_CHECK_EXIT(terrno); + } } for (int32_t i = 0; i < num; ++i) { SEpSet epSet = {0}; - if (tDecodeSEpSet(&decoder, &epSet) < 0) return -1; - if (taosArrayPush(pRsp->dnodeList, &epSet) == NULL) return -1; + TAOS_CHECK_EXIT(tDecodeSEpSet(&decoder, &epSet)); + if (taosArrayPush(pRsp->dnodeList, &epSet) == NULL) { + TAOS_CHECK_EXIT(terrno); + } } tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSDnodeListRsp(SDnodeListRsp *pRsp) { taosArrayDestroy(pRsp->dnodeList); } int32_t tSerializeSCompactDbReq(void *buf, int32_t bufLen, SCompactDbReq *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->db) < 0) return -1; - if (tEncodeI64(&encoder, pReq->timeRange.skey) < 0) return -1; - if (tEncodeI64(&encoder, pReq->timeRange.ekey) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->db)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->timeRange.skey)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->timeRange.ekey)); ENCODESQL(); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSCompactDbReq(void *buf, int32_t bufLen, SCompactDbReq *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->db) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->timeRange.skey) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->timeRange.ekey) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->db)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->timeRange.skey)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->timeRange.ekey)); DECODESQL(); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSCompactDbReq(SCompactDbReq *pReq) { FREESQL(); } int32_t tSerializeSCompactDbRsp(void *buf, int32_t bufLen, SCompactDbRsp *pRsp) { 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, pRsp->compactId) < 0) return -1; - if (tEncodeI8(&encoder, pRsp->bAccepted) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pRsp->compactId)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pRsp->bAccepted)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSCompactDbRsp(void *buf, int32_t bufLen, SCompactDbRsp *pRsp) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeI32(&decoder, &pRsp->compactId) < 0) return -1; - if (tDecodeI8(&decoder, &pRsp->bAccepted) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pRsp->compactId)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pRsp->bAccepted)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSKillCompactReq(void *buf, int32_t bufLen, SKillCompactReq *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->compactId) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->compactId)); ENCODESQL(); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSKillCompactReq(void *buf, int32_t bufLen, SKillCompactReq *pReq) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - - if (tDecodeI32(&decoder, &pReq->compactId) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->compactId)); DECODESQL(); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSKillCompactReq(SKillCompactReq *pReq) { FREESQL(); } int32_t tSerializeSUseDbRspImp(SEncoder *pEncoder, const SUseDbRsp *pRsp) { - if (tEncodeCStr(pEncoder, pRsp->db) < 0) return -1; - if (tEncodeI64(pEncoder, pRsp->uid) < 0) return -1; - if (tEncodeI32(pEncoder, pRsp->vgVersion) < 0) return -1; - if (tEncodeI32(pEncoder, pRsp->vgNum) < 0) return -1; - if (tEncodeI16(pEncoder, pRsp->hashPrefix) < 0) return -1; - if (tEncodeI16(pEncoder, pRsp->hashSuffix) < 0) return -1; - if (tEncodeI8(pEncoder, pRsp->hashMethod) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, pRsp->db)); + TAOS_CHECK_RETURN(tEncodeI64(pEncoder, pRsp->uid)); + TAOS_CHECK_RETURN(tEncodeI32(pEncoder, pRsp->vgVersion)); + TAOS_CHECK_RETURN(tEncodeI32(pEncoder, pRsp->vgNum)); + TAOS_CHECK_RETURN(tEncodeI16(pEncoder, pRsp->hashPrefix)); + TAOS_CHECK_RETURN(tEncodeI16(pEncoder, pRsp->hashSuffix)); + TAOS_CHECK_RETURN(tEncodeI8(pEncoder, pRsp->hashMethod)); for (int32_t i = 0; i < pRsp->vgNum; ++i) { SVgroupInfo *pVgInfo = taosArrayGet(pRsp->pVgroupInfos, i); - if (tEncodeI32(pEncoder, pVgInfo->vgId) < 0) return -1; - if (tEncodeU32(pEncoder, pVgInfo->hashBegin) < 0) return -1; - if (tEncodeU32(pEncoder, pVgInfo->hashEnd) < 0) return -1; - if (tEncodeSEpSet(pEncoder, &pVgInfo->epSet) < 0) return -1; - if (tEncodeI32(pEncoder, pVgInfo->numOfTable) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeI32(pEncoder, pVgInfo->vgId)); + TAOS_CHECK_RETURN(tEncodeU32(pEncoder, pVgInfo->hashBegin)); + TAOS_CHECK_RETURN(tEncodeU32(pEncoder, pVgInfo->hashEnd)); + TAOS_CHECK_RETURN(tEncodeSEpSet(pEncoder, &pVgInfo->epSet)); + TAOS_CHECK_RETURN(tEncodeI32(pEncoder, pVgInfo->numOfTable)); } - if (tEncodeI32(pEncoder, pRsp->errCode) < 0) return -1; - if (tEncodeI64(pEncoder, pRsp->stateTs) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeI32(pEncoder, pRsp->errCode)); + TAOS_CHECK_RETURN(tEncodeI64(pEncoder, pRsp->stateTs)); return 0; } int32_t tSerializeSUseDbRsp(void *buf, int32_t bufLen, const SUseDbRsp *pRsp) { SEncoder encoder = {0}; + int32_t code = 0; + int32_t lino; + int32_t tlen; tEncoderInit(&encoder, buf, bufLen); - if (tStartEncode(&encoder) < 0) return -1; - if (tSerializeSUseDbRspImp(&encoder, pRsp) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tSerializeSUseDbRspImp(&encoder, pRsp)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tSerializeSDbHbRspImp(SEncoder *pEncoder, const SDbHbRsp *pRsp) { if (pRsp->useDbRsp) { - if (tEncodeI8(pEncoder, 1) < 0) return -1; - if (tSerializeSUseDbRspImp(pEncoder, pRsp->useDbRsp) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeI8(pEncoder, 1)); + TAOS_CHECK_RETURN(tSerializeSUseDbRspImp(pEncoder, pRsp->useDbRsp)); } else { - if (tEncodeI8(pEncoder, 0) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeI8(pEncoder, 0)); } if (pRsp->cfgRsp) { - if (tEncodeI8(pEncoder, 1) < 0) return -1; - if (tSerializeSDbCfgRspImpl(pEncoder, pRsp->cfgRsp) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeI8(pEncoder, 1)); + TAOS_CHECK_RETURN(tSerializeSDbCfgRspImpl(pEncoder, pRsp->cfgRsp)); } else { - if (tEncodeI8(pEncoder, 0) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeI8(pEncoder, 0)); } if (pRsp->pTsmaRsp) { - if (tEncodeI8(pEncoder, 1) < 0) return -1; - if (tEncodeTableTSMAInfoRsp(pEncoder, pRsp->pTsmaRsp) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeI8(pEncoder, 1)); + TAOS_CHECK_RETURN(tEncodeTableTSMAInfoRsp(pEncoder, pRsp->pTsmaRsp)); } else { - if (tEncodeI8(pEncoder, 0) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeI8(pEncoder, 0)); } - if (tEncodeI32(pEncoder, pRsp->dbTsmaVersion) < 0) return -1; - if (tEncodeCStr(pEncoder, pRsp->db) < 0) return -1; - if (tEncodeI64(pEncoder, pRsp->dbId) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeI32(pEncoder, pRsp->dbTsmaVersion)); + TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, pRsp->db)); + TAOS_CHECK_RETURN(tEncodeI64(pEncoder, pRsp->dbId)); return 0; } int32_t tSerializeSDbHbBatchRsp(void *buf, int32_t bufLen, SDbHbBatchRsp *pRsp) { 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)); int32_t numOfBatch = taosArrayGetSize(pRsp->pArray); - if (tEncodeI32(&encoder, numOfBatch) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, numOfBatch)); for (int32_t i = 0; i < numOfBatch; ++i) { SDbHbRsp *pDbRsp = taosArrayGet(pRsp->pArray, i); - if (tSerializeSDbHbRspImp(&encoder, pDbRsp) < 0) return -1; + TAOS_CHECK_EXIT(tSerializeSDbHbRspImp(&encoder, pDbRsp)); } tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSUseDbRspImp(SDecoder *pDecoder, SUseDbRsp *pRsp) { - if (tDecodeCStrTo(pDecoder, pRsp->db) < 0) return -1; - if (tDecodeI64(pDecoder, &pRsp->uid) < 0) return -1; - if (tDecodeI32(pDecoder, &pRsp->vgVersion) < 0) return -1; - if (tDecodeI32(pDecoder, &pRsp->vgNum) < 0) return -1; - if (tDecodeI16(pDecoder, &pRsp->hashPrefix) < 0) return -1; - if (tDecodeI16(pDecoder, &pRsp->hashSuffix) < 0) return -1; - if (tDecodeI8(pDecoder, &pRsp->hashMethod) < 0) return -1; + TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, pRsp->db)); + TAOS_CHECK_RETURN(tDecodeI64(pDecoder, &pRsp->uid)); + TAOS_CHECK_RETURN(tDecodeI32(pDecoder, &pRsp->vgVersion)); + TAOS_CHECK_RETURN(tDecodeI32(pDecoder, &pRsp->vgNum)); + TAOS_CHECK_RETURN(tDecodeI16(pDecoder, &pRsp->hashPrefix)); + TAOS_CHECK_RETURN(tDecodeI16(pDecoder, &pRsp->hashSuffix)); + TAOS_CHECK_RETURN(tDecodeI8(pDecoder, &pRsp->hashMethod)); if (pRsp->vgNum > 0) { pRsp->pVgroupInfos = taosArrayInit(pRsp->vgNum, sizeof(SVgroupInfo)); if (pRsp->pVgroupInfos == NULL) { - return -1; + TAOS_CHECK_RETURN(terrno); } for (int32_t i = 0; i < pRsp->vgNum; ++i) { SVgroupInfo vgInfo = {0}; - if (tDecodeI32(pDecoder, &vgInfo.vgId) < 0) return -1; - if (tDecodeU32(pDecoder, &vgInfo.hashBegin) < 0) return -1; - if (tDecodeU32(pDecoder, &vgInfo.hashEnd) < 0) return -1; - if (tDecodeSEpSet(pDecoder, &vgInfo.epSet) < 0) return -1; - if (tDecodeI32(pDecoder, &vgInfo.numOfTable) < 0) return -1; - if (taosArrayPush(pRsp->pVgroupInfos, &vgInfo) == NULL) return -1; + TAOS_CHECK_RETURN(tDecodeI32(pDecoder, &vgInfo.vgId)); + TAOS_CHECK_RETURN(tDecodeU32(pDecoder, &vgInfo.hashBegin)); + TAOS_CHECK_RETURN(tDecodeU32(pDecoder, &vgInfo.hashEnd)); + TAOS_CHECK_RETURN(tDecodeSEpSet(pDecoder, &vgInfo.epSet)); + TAOS_CHECK_RETURN(tDecodeI32(pDecoder, &vgInfo.numOfTable)); + if (taosArrayPush(pRsp->pVgroupInfos, &vgInfo) == NULL) { + TAOS_CHECK_RETURN(terrno); + } } } - if (tDecodeI32(pDecoder, &pRsp->errCode) < 0) return -1; - if (tDecodeI64(pDecoder, &pRsp->stateTs) < 0) return -1; + TAOS_CHECK_RETURN(tDecodeI32(pDecoder, &pRsp->errCode)); + TAOS_CHECK_RETURN(tDecodeI64(pDecoder, &pRsp->stateTs)); return 0; } int32_t tDeserializeSUseDbRsp(void *buf, int32_t bufLen, SUseDbRsp *pRsp) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDeserializeSUseDbRspImp(&decoder, pRsp) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDeserializeSUseDbRspImp(&decoder, pRsp)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tDeserializeSDbHbRspImp(SDecoder *decoder, SDbHbRsp *pRsp) { int8_t flag = 0; - if (tDecodeI8(decoder, &flag) < 0) return -1; + TAOS_CHECK_RETURN(tDecodeI8(decoder, &flag)); if (flag) { pRsp->useDbRsp = taosMemoryCalloc(1, sizeof(SUseDbRsp)); - if (NULL == pRsp->useDbRsp) return -1; - if (tDeserializeSUseDbRspImp(decoder, pRsp->useDbRsp) < 0) return -1; + if (NULL == pRsp->useDbRsp) { + TAOS_CHECK_RETURN(terrno); + } + TAOS_CHECK_RETURN(tDeserializeSUseDbRspImp(decoder, pRsp->useDbRsp)); } - if (tDecodeI8(decoder, &flag) < 0) return -1; + TAOS_CHECK_RETURN(tDecodeI8(decoder, &flag)); if (flag) { pRsp->cfgRsp = taosMemoryCalloc(1, sizeof(SDbCfgRsp)); - if (NULL == pRsp->cfgRsp) return -1; - if (tDeserializeSDbCfgRspImpl(decoder, pRsp->cfgRsp) < 0) return -1; + if (NULL == pRsp->cfgRsp) { + TAOS_CHECK_RETURN(terrno); + } + TAOS_CHECK_RETURN(tDeserializeSDbCfgRspImpl(decoder, pRsp->cfgRsp)); } if (!tDecodeIsEnd(decoder)) { - if (tDecodeI8(decoder, &flag) < 0) return -1; + TAOS_CHECK_RETURN(tDecodeI8(decoder, &flag)); if (flag) { pRsp->pTsmaRsp = taosMemoryCalloc(1, sizeof(STableTSMAInfoRsp)); - if (!pRsp->pTsmaRsp) return -1; - if (tDecodeTableTSMAInfoRsp(decoder, pRsp->pTsmaRsp) < 0) return -1; + if (!pRsp->pTsmaRsp) { + TAOS_CHECK_RETURN(terrno); + } + TAOS_CHECK_RETURN(tDecodeTableTSMAInfoRsp(decoder, pRsp->pTsmaRsp)); } } if (!tDecodeIsEnd(decoder)) { - if (tDecodeI32(decoder, &pRsp->dbTsmaVersion) < 0) return -1; + TAOS_CHECK_RETURN(tDecodeI32(decoder, &pRsp->dbTsmaVersion)); } if (!tDecodeIsEnd(decoder)) { - if (tDecodeCStrTo(decoder, pRsp->db) < 0) return -1; - if (tDecodeI64(decoder, &pRsp->dbId) < 0) return -1; + TAOS_CHECK_RETURN(tDecodeCStrTo(decoder, pRsp->db)); + TAOS_CHECK_RETURN(tDecodeI64(decoder, &pRsp->dbId)); } return 0; @@ -3940,33 +4517,33 @@ int32_t tDeserializeSDbHbRspImp(SDecoder *decoder, SDbHbRsp *pRsp) { int32_t tDeserializeSDbHbBatchRsp(void *buf, int32_t bufLen, SDbHbBatchRsp *pRsp) { 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)); int32_t numOfBatch = taosArrayGetSize(pRsp->pArray); - if (tDecodeI32(&decoder, &numOfBatch) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &numOfBatch)); pRsp->pArray = taosArrayInit(numOfBatch, sizeof(SDbHbRsp)); if (pRsp->pArray == NULL) { - return -1; + TAOS_CHECK_EXIT(terrno); } for (int32_t i = 0; i < numOfBatch; ++i) { SDbHbRsp rsp = {0}; - if (tDeserializeSDbHbRspImp(&decoder, &rsp) < 0) { - tDecoderClear(&decoder); - return -1; - } + TAOS_CHECK_EXIT(tDeserializeSDbHbRspImp(&decoder, &rsp)); + if (taosArrayPush(pRsp->pArray, &rsp) == NULL) { - tDecoderClear(&decoder); - return -1; + TAOS_CHECK_EXIT(terrno); } } tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSUsedbRsp(SUseDbRsp *pRsp) { taosArrayDestroy(pRsp->pVgroupInfos); } @@ -4003,46 +4580,59 @@ void tFreeSDbHbBatchRsp(SDbHbBatchRsp *pRsp) { int32_t tSerializeSUserAuthBatchRsp(void *buf, int32_t bufLen, SUserAuthBatchRsp *pRsp) { 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)); int32_t numOfBatch = taosArrayGetSize(pRsp->pArray); - if (tEncodeI32(&encoder, numOfBatch) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, numOfBatch)); for (int32_t i = 0; i < numOfBatch; ++i) { SGetUserAuthRsp *pUserAuthRsp = taosArrayGet(pRsp->pArray, i); - if (tSerializeSGetUserAuthRspImpl(&encoder, pUserAuthRsp) < 0) return -1; + TAOS_CHECK_EXIT(tSerializeSGetUserAuthRspImpl(&encoder, pUserAuthRsp)); } tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSUserAuthBatchRsp(void *buf, int32_t bufLen, SUserAuthBatchRsp *pRsp) { 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)); int32_t numOfBatch = taosArrayGetSize(pRsp->pArray); - if (tDecodeI32(&decoder, &numOfBatch) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &numOfBatch)); pRsp->pArray = taosArrayInit(numOfBatch, sizeof(SGetUserAuthRsp)); if (pRsp->pArray == NULL) { - return -1; + TAOS_CHECK_EXIT(terrno); } for (int32_t i = 0; i < numOfBatch; ++i) { SGetUserAuthRsp rsp = {0}; - if (tDeserializeSGetUserAuthRspImpl(&decoder, &rsp) < 0) return -1; - if (taosArrayPush(pRsp->pArray, &rsp) == NULL) return -1; + TAOS_CHECK_EXIT(tDeserializeSGetUserAuthRspImpl(&decoder, &rsp)); + if (taosArrayPush(pRsp->pArray, &rsp) == NULL) { + TAOS_CHECK_EXIT(terrno); + } } tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSUserAuthBatchRsp(SUserAuthBatchRsp *pRsp) { @@ -4057,27 +4647,38 @@ void tFreeSUserAuthBatchRsp(SUserAuthBatchRsp *pRsp) { int32_t tSerializeSDbCfgReq(void *buf, int32_t bufLen, SDbCfgReq *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->db) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->db)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSDbCfgReq(void *buf, int32_t bufLen, SDbCfgReq *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->db) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->db)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSTrimDbReq(void *buf, int32_t bufLen, STrimDbReq *pReq) { @@ -4096,262 +4697,318 @@ int32_t tSerializeSTrimDbReq(void *buf, int32_t bufLen, STrimDbReq *pReq) { int32_t tDeserializeSTrimDbReq(void *buf, int32_t bufLen, STrimDbReq *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->db) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->maxSpeed) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->db)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->maxSpeed)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSVTrimDbReq(void *buf, int32_t bufLen, SVTrimDbReq *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->timestamp) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->timestamp)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSVTrimDbReq(void *buf, int32_t bufLen, SVTrimDbReq *pReq) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->timestamp) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->timestamp)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSS3MigrateDbReq(void *buf, int32_t bufLen, SS3MigrateDbReq *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->db) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->db)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSS3MigrateDbReq(void *buf, int32_t bufLen, SS3MigrateDbReq *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->db) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->db)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSVS3MigrateDbReq(void *buf, int32_t bufLen, SVS3MigrateDbReq *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->timestamp) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->timestamp)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSVS3MigrateDbReq(void *buf, int32_t bufLen, SVS3MigrateDbReq *pReq) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->timestamp) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->timestamp)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSVDropTtlTableReq(void *buf, int32_t bufLen, SVDropTtlTableReq *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->timestampSec) < 0) return -1; - if (tEncodeI32(&encoder, pReq->ttlDropMaxCount) < 0) return -1; - if (tEncodeI32(&encoder, pReq->nUids) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->timestampSec)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->ttlDropMaxCount)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->nUids)); for (int32_t i = 0; i < pReq->nUids; ++i) { tb_uid_t *pTbUid = taosArrayGet(pReq->pTbUids, i); - if (tEncodeI64(&encoder, *pTbUid) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI64(&encoder, *pTbUid)); } tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSVDropTtlTableReq(void *buf, int32_t bufLen, SVDropTtlTableReq *pReq) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->timestampSec) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->timestampSec)); pReq->ttlDropMaxCount = INT32_MAX; pReq->nUids = 0; pReq->pTbUids = NULL; if (!tDecodeIsEnd(&decoder)) { - if (tDecodeI32(&decoder, &pReq->ttlDropMaxCount) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->nUids) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->ttlDropMaxCount)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->nUids)); if (pReq->nUids > 0) { pReq->pTbUids = taosArrayInit(pReq->nUids, sizeof(tb_uid_t)); if (pReq->pTbUids == NULL) { - return -1; + TAOS_CHECK_EXIT(terrno); } } tb_uid_t tbUid = 0; for (int32_t i = 0; i < pReq->nUids; ++i) { - if (tDecodeI64(&decoder, &tbUid) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &tbUid)); if (taosArrayPush(pReq->pTbUids, &tbUid) == NULL) { - return -1; + TAOS_CHECK_EXIT(terrno); } } } tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSDbCfgRspImpl(SEncoder *encoder, const SDbCfgRsp *pRsp) { - if (tEncodeCStr(encoder, pRsp->db) < 0) return -1; - if (tEncodeI64(encoder, pRsp->dbId) < 0) return -1; - if (tEncodeI32(encoder, pRsp->cfgVersion) < 0) return -1; - if (tEncodeI32(encoder, pRsp->numOfVgroups) < 0) return -1; - if (tEncodeI32(encoder, pRsp->numOfStables) < 0) return -1; - if (tEncodeI32(encoder, pRsp->buffer) < 0) return -1; - if (tEncodeI32(encoder, pRsp->cacheSize) < 0) return -1; - if (tEncodeI32(encoder, pRsp->pageSize) < 0) return -1; - if (tEncodeI32(encoder, pRsp->pages) < 0) return -1; - if (tEncodeI32(encoder, pRsp->daysPerFile) < 0) return -1; - if (tEncodeI32(encoder, pRsp->daysToKeep0) < 0) return -1; - if (tEncodeI32(encoder, pRsp->daysToKeep1) < 0) return -1; - if (tEncodeI32(encoder, pRsp->daysToKeep2) < 0) return -1; - if (tEncodeI32(encoder, pRsp->minRows) < 0) return -1; - if (tEncodeI32(encoder, pRsp->maxRows) < 0) return -1; - if (tEncodeI32(encoder, pRsp->walFsyncPeriod) < 0) return -1; - if (tEncodeI16(encoder, pRsp->hashPrefix) < 0) return -1; - if (tEncodeI16(encoder, pRsp->hashSuffix) < 0) return -1; - if (tEncodeI8(encoder, pRsp->walLevel) < 0) return -1; - if (tEncodeI8(encoder, pRsp->precision) < 0) return -1; - if (tEncodeI8(encoder, pRsp->compression) < 0) return -1; - if (tEncodeI8(encoder, pRsp->replications) < 0) return -1; - if (tEncodeI8(encoder, pRsp->strict) < 0) return -1; - if (tEncodeI8(encoder, pRsp->cacheLast) < 0) return -1; - if (tEncodeI32(encoder, pRsp->tsdbPageSize) < 0) return -1; - if (tEncodeI32(encoder, pRsp->walRetentionPeriod) < 0) return -1; - if (tEncodeI32(encoder, pRsp->walRollPeriod) < 0) return -1; - if (tEncodeI64(encoder, pRsp->walRetentionSize) < 0) return -1; - if (tEncodeI64(encoder, pRsp->walSegmentSize) < 0) return -1; - if (tEncodeI32(encoder, pRsp->numOfRetensions) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeCStr(encoder, pRsp->db)); + TAOS_CHECK_RETURN(tEncodeI64(encoder, pRsp->dbId)); + TAOS_CHECK_RETURN(tEncodeI32(encoder, pRsp->cfgVersion)); + TAOS_CHECK_RETURN(tEncodeI32(encoder, pRsp->numOfVgroups)); + TAOS_CHECK_RETURN(tEncodeI32(encoder, pRsp->numOfStables)); + TAOS_CHECK_RETURN(tEncodeI32(encoder, pRsp->buffer)); + TAOS_CHECK_RETURN(tEncodeI32(encoder, pRsp->cacheSize)); + TAOS_CHECK_RETURN(tEncodeI32(encoder, pRsp->pageSize)); + TAOS_CHECK_RETURN(tEncodeI32(encoder, pRsp->pages)); + TAOS_CHECK_RETURN(tEncodeI32(encoder, pRsp->daysPerFile)); + TAOS_CHECK_RETURN(tEncodeI32(encoder, pRsp->daysToKeep0)); + TAOS_CHECK_RETURN(tEncodeI32(encoder, pRsp->daysToKeep1)); + TAOS_CHECK_RETURN(tEncodeI32(encoder, pRsp->daysToKeep2)); + TAOS_CHECK_RETURN(tEncodeI32(encoder, pRsp->minRows)); + TAOS_CHECK_RETURN(tEncodeI32(encoder, pRsp->maxRows)); + TAOS_CHECK_RETURN(tEncodeI32(encoder, pRsp->walFsyncPeriod)); + TAOS_CHECK_RETURN(tEncodeI16(encoder, pRsp->hashPrefix)); + TAOS_CHECK_RETURN(tEncodeI16(encoder, pRsp->hashSuffix)); + TAOS_CHECK_RETURN(tEncodeI8(encoder, pRsp->walLevel)); + TAOS_CHECK_RETURN(tEncodeI8(encoder, pRsp->precision)); + TAOS_CHECK_RETURN(tEncodeI8(encoder, pRsp->compression)); + TAOS_CHECK_RETURN(tEncodeI8(encoder, pRsp->replications)); + TAOS_CHECK_RETURN(tEncodeI8(encoder, pRsp->strict)); + TAOS_CHECK_RETURN(tEncodeI8(encoder, pRsp->cacheLast)); + TAOS_CHECK_RETURN(tEncodeI32(encoder, pRsp->tsdbPageSize)); + TAOS_CHECK_RETURN(tEncodeI32(encoder, pRsp->walRetentionPeriod)); + TAOS_CHECK_RETURN(tEncodeI32(encoder, pRsp->walRollPeriod)); + TAOS_CHECK_RETURN(tEncodeI64(encoder, pRsp->walRetentionSize)); + TAOS_CHECK_RETURN(tEncodeI64(encoder, pRsp->walSegmentSize)); + TAOS_CHECK_RETURN(tEncodeI32(encoder, pRsp->numOfRetensions)); for (int32_t i = 0; i < pRsp->numOfRetensions; ++i) { SRetention *pRetension = taosArrayGet(pRsp->pRetensions, i); - if (tEncodeI64(encoder, pRetension->freq) < 0) return -1; - if (tEncodeI64(encoder, pRetension->keep) < 0) return -1; - if (tEncodeI8(encoder, pRetension->freqUnit) < 0) return -1; - if (tEncodeI8(encoder, pRetension->keepUnit) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeI64(encoder, pRetension->freq)); + TAOS_CHECK_RETURN(tEncodeI64(encoder, pRetension->keep)); + TAOS_CHECK_RETURN(tEncodeI8(encoder, pRetension->freqUnit)); + TAOS_CHECK_RETURN(tEncodeI8(encoder, pRetension->keepUnit)); } - if (tEncodeI8(encoder, pRsp->schemaless) < 0) return -1; - if (tEncodeI16(encoder, pRsp->sstTrigger) < 0) return -1; - if (tEncodeI32(encoder, pRsp->keepTimeOffset) < 0) return -1; - if (tEncodeI8(encoder, pRsp->withArbitrator) < 0) return -1; - if (tEncodeI8(encoder, pRsp->encryptAlgorithm) < 0) return -1; - if (tEncodeI32(encoder, pRsp->s3ChunkSize) < 0) return -1; - if (tEncodeI32(encoder, pRsp->s3KeepLocal) < 0) return -1; - if (tEncodeI8(encoder, pRsp->s3Compact) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeI8(encoder, pRsp->schemaless)); + TAOS_CHECK_RETURN(tEncodeI16(encoder, pRsp->sstTrigger)); + TAOS_CHECK_RETURN(tEncodeI32(encoder, pRsp->keepTimeOffset)); + TAOS_CHECK_RETURN(tEncodeI8(encoder, pRsp->withArbitrator)); + TAOS_CHECK_RETURN(tEncodeI8(encoder, pRsp->encryptAlgorithm)); + TAOS_CHECK_RETURN(tEncodeI32(encoder, pRsp->s3ChunkSize)); + TAOS_CHECK_RETURN(tEncodeI32(encoder, pRsp->s3KeepLocal)); + TAOS_CHECK_RETURN(tEncodeI8(encoder, pRsp->s3Compact)); return 0; } int32_t tSerializeSDbCfgRsp(void *buf, int32_t bufLen, const SDbCfgRsp *pRsp) { SEncoder encoder = {0}; + int32_t code = 0; + int32_t lino; + int32_t tlen; tEncoderInit(&encoder, buf, bufLen); - if (tStartEncode(&encoder) < 0) return -1; - if (tSerializeSDbCfgRspImpl(&encoder, pRsp) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tSerializeSDbCfgRspImpl(&encoder, pRsp)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; + +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSDbCfgRspImpl(SDecoder *decoder, SDbCfgRsp *pRsp) { - if (tDecodeCStrTo(decoder, pRsp->db) < 0) return -1; - if (tDecodeI64(decoder, &pRsp->dbId) < 0) return -1; - if (tDecodeI32(decoder, &pRsp->cfgVersion) < 0) return -1; - if (tDecodeI32(decoder, &pRsp->numOfVgroups) < 0) return -1; - if (tDecodeI32(decoder, &pRsp->numOfStables) < 0) return -1; - if (tDecodeI32(decoder, &pRsp->buffer) < 0) return -1; - if (tDecodeI32(decoder, &pRsp->cacheSize) < 0) return -1; - if (tDecodeI32(decoder, &pRsp->pageSize) < 0) return -1; - if (tDecodeI32(decoder, &pRsp->pages) < 0) return -1; - if (tDecodeI32(decoder, &pRsp->daysPerFile) < 0) return -1; - if (tDecodeI32(decoder, &pRsp->daysToKeep0) < 0) return -1; - if (tDecodeI32(decoder, &pRsp->daysToKeep1) < 0) return -1; - if (tDecodeI32(decoder, &pRsp->daysToKeep2) < 0) return -1; - if (tDecodeI32(decoder, &pRsp->minRows) < 0) return -1; - if (tDecodeI32(decoder, &pRsp->maxRows) < 0) return -1; - if (tDecodeI32(decoder, &pRsp->walFsyncPeriod) < 0) return -1; - if (tDecodeI16(decoder, &pRsp->hashPrefix) < 0) return -1; - if (tDecodeI16(decoder, &pRsp->hashSuffix) < 0) return -1; - if (tDecodeI8(decoder, &pRsp->walLevel) < 0) return -1; - if (tDecodeI8(decoder, &pRsp->precision) < 0) return -1; - if (tDecodeI8(decoder, &pRsp->compression) < 0) return -1; - if (tDecodeI8(decoder, &pRsp->replications) < 0) return -1; - if (tDecodeI8(decoder, &pRsp->strict) < 0) return -1; - if (tDecodeI8(decoder, &pRsp->cacheLast) < 0) return -1; - if (tDecodeI32(decoder, &pRsp->tsdbPageSize) < 0) return -1; - if (tDecodeI32(decoder, &pRsp->walRetentionPeriod) < 0) return -1; - if (tDecodeI32(decoder, &pRsp->walRollPeriod) < 0) return -1; - if (tDecodeI64(decoder, &pRsp->walRetentionSize) < 0) return -1; - if (tDecodeI64(decoder, &pRsp->walSegmentSize) < 0) return -1; - if (tDecodeI32(decoder, &pRsp->numOfRetensions) < 0) return -1; + TAOS_CHECK_RETURN(tDecodeCStrTo(decoder, pRsp->db)); + TAOS_CHECK_RETURN(tDecodeI64(decoder, &pRsp->dbId)); + TAOS_CHECK_RETURN(tDecodeI32(decoder, &pRsp->cfgVersion)); + TAOS_CHECK_RETURN(tDecodeI32(decoder, &pRsp->numOfVgroups)); + TAOS_CHECK_RETURN(tDecodeI32(decoder, &pRsp->numOfStables)); + TAOS_CHECK_RETURN(tDecodeI32(decoder, &pRsp->buffer)); + TAOS_CHECK_RETURN(tDecodeI32(decoder, &pRsp->cacheSize)); + TAOS_CHECK_RETURN(tDecodeI32(decoder, &pRsp->pageSize)); + TAOS_CHECK_RETURN(tDecodeI32(decoder, &pRsp->pages)); + TAOS_CHECK_RETURN(tDecodeI32(decoder, &pRsp->daysPerFile)); + TAOS_CHECK_RETURN(tDecodeI32(decoder, &pRsp->daysToKeep0)); + TAOS_CHECK_RETURN(tDecodeI32(decoder, &pRsp->daysToKeep1)); + TAOS_CHECK_RETURN(tDecodeI32(decoder, &pRsp->daysToKeep2)); + TAOS_CHECK_RETURN(tDecodeI32(decoder, &pRsp->minRows)); + TAOS_CHECK_RETURN(tDecodeI32(decoder, &pRsp->maxRows)); + TAOS_CHECK_RETURN(tDecodeI32(decoder, &pRsp->walFsyncPeriod)); + TAOS_CHECK_RETURN(tDecodeI16(decoder, &pRsp->hashPrefix)); + TAOS_CHECK_RETURN(tDecodeI16(decoder, &pRsp->hashSuffix)); + TAOS_CHECK_RETURN(tDecodeI8(decoder, &pRsp->walLevel)); + TAOS_CHECK_RETURN(tDecodeI8(decoder, &pRsp->precision)); + TAOS_CHECK_RETURN(tDecodeI8(decoder, &pRsp->compression)); + TAOS_CHECK_RETURN(tDecodeI8(decoder, &pRsp->replications)); + TAOS_CHECK_RETURN(tDecodeI8(decoder, &pRsp->strict)); + TAOS_CHECK_RETURN(tDecodeI8(decoder, &pRsp->cacheLast)); + TAOS_CHECK_RETURN(tDecodeI32(decoder, &pRsp->tsdbPageSize)); + TAOS_CHECK_RETURN(tDecodeI32(decoder, &pRsp->walRetentionPeriod)); + TAOS_CHECK_RETURN(tDecodeI32(decoder, &pRsp->walRollPeriod)); + TAOS_CHECK_RETURN(tDecodeI64(decoder, &pRsp->walRetentionSize)); + TAOS_CHECK_RETURN(tDecodeI64(decoder, &pRsp->walSegmentSize)); + TAOS_CHECK_RETURN(tDecodeI32(decoder, &pRsp->numOfRetensions)); if (pRsp->numOfRetensions > 0) { pRsp->pRetensions = taosArrayInit(pRsp->numOfRetensions, sizeof(SRetention)); if (pRsp->pRetensions == NULL) { - return -1; + TAOS_CHECK_RETURN(terrno); } } for (int32_t i = 0; i < pRsp->numOfRetensions; ++i) { SRetention rentension = {0}; - if (tDecodeI64(decoder, &rentension.freq) < 0) return -1; - if (tDecodeI64(decoder, &rentension.keep) < 0) return -1; - if (tDecodeI8(decoder, &rentension.freqUnit) < 0) return -1; - if (tDecodeI8(decoder, &rentension.keepUnit) < 0) return -1; + TAOS_CHECK_RETURN(tDecodeI64(decoder, &rentension.freq)); + TAOS_CHECK_RETURN(tDecodeI64(decoder, &rentension.keep)); + TAOS_CHECK_RETURN(tDecodeI8(decoder, &rentension.freqUnit)); + TAOS_CHECK_RETURN(tDecodeI8(decoder, &rentension.keepUnit)); if (taosArrayPush(pRsp->pRetensions, &rentension) == NULL) { - return -1; + TAOS_CHECK_RETURN(terrno); } } - if (tDecodeI8(decoder, &pRsp->schemaless) < 0) return -1; - if (tDecodeI16(decoder, &pRsp->sstTrigger) < 0) return -1; + TAOS_CHECK_RETURN(tDecodeI8(decoder, &pRsp->schemaless)); + TAOS_CHECK_RETURN(tDecodeI16(decoder, &pRsp->sstTrigger)); pRsp->keepTimeOffset = TSDB_DEFAULT_KEEP_TIME_OFFSET; if (!tDecodeIsEnd(decoder)) { - if (tDecodeI32(decoder, &pRsp->keepTimeOffset) < 0) return -1; + TAOS_CHECK_RETURN(tDecodeI32(decoder, &pRsp->keepTimeOffset)); } pRsp->withArbitrator = TSDB_DEFAULT_DB_WITH_ARBITRATOR; pRsp->encryptAlgorithm = TSDB_DEFAULT_ENCRYPT_ALGO; @@ -4359,11 +5016,11 @@ int32_t tDeserializeSDbCfgRspImpl(SDecoder *decoder, SDbCfgRsp *pRsp) { pRsp->s3KeepLocal = TSDB_DEFAULT_S3_KEEP_LOCAL; pRsp->s3Compact = TSDB_DEFAULT_S3_COMPACT; if (!tDecodeIsEnd(decoder)) { - if (tDecodeI8(decoder, &pRsp->withArbitrator) < 0) return -1; - if (tDecodeI8(decoder, &pRsp->encryptAlgorithm) < 0) return -1; - if (tDecodeI32(decoder, &pRsp->s3ChunkSize) < 0) return -1; - if (tDecodeI32(decoder, &pRsp->s3KeepLocal) < 0) return -1; - if (tDecodeI8(decoder, &pRsp->s3Compact) < 0) return -1; + TAOS_CHECK_RETURN(tDecodeI8(decoder, &pRsp->withArbitrator)); + TAOS_CHECK_RETURN(tDecodeI8(decoder, &pRsp->encryptAlgorithm)); + TAOS_CHECK_RETURN(tDecodeI32(decoder, &pRsp->s3ChunkSize)); + TAOS_CHECK_RETURN(tDecodeI32(decoder, &pRsp->s3KeepLocal)); + TAOS_CHECK_RETURN(tDecodeI8(decoder, &pRsp->s3Compact)); } return 0; @@ -4371,14 +5028,17 @@ int32_t tDeserializeSDbCfgRspImpl(SDecoder *decoder, SDbCfgRsp *pRsp) { int32_t tDeserializeSDbCfgRsp(void *buf, int32_t bufLen, SDbCfgRsp *pRsp) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDeserializeSDbCfgRspImpl(&decoder, pRsp) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDeserializeSDbCfgRspImpl(&decoder, pRsp)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSDbCfgRsp(SDbCfgRsp *pRsp) { @@ -4391,121 +5051,162 @@ void tFreeSDbCfgRsp(SDbCfgRsp *pRsp) { int32_t tSerializeSUserIndexReq(void *buf, int32_t bufLen, SUserIndexReq *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->indexFName) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->indexFName)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSUserIndexReq(void *buf, int32_t bufLen, SUserIndexReq *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->indexFName) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->indexFName)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSUserIndexRsp(void *buf, int32_t bufLen, const SUserIndexRsp *pRsp) { 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, pRsp->dbFName) < 0) return -1; - if (tEncodeCStr(&encoder, pRsp->tblFName) < 0) return -1; - if (tEncodeCStr(&encoder, pRsp->colName) < 0) return -1; - if (tEncodeCStr(&encoder, pRsp->indexType) < 0) return -1; - if (tEncodeCStr(&encoder, pRsp->indexExts) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pRsp->dbFName)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pRsp->tblFName)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pRsp->colName)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pRsp->indexType)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pRsp->indexExts)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSUserIndexRsp(void *buf, int32_t bufLen, SUserIndexRsp *pRsp) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeCStrTo(&decoder, pRsp->dbFName) < 0) return -1; - if (tDecodeCStrTo(&decoder, pRsp->tblFName) < 0) return -1; - if (tDecodeCStrTo(&decoder, pRsp->colName) < 0) return -1; - if (tDecodeCStrTo(&decoder, pRsp->indexType) < 0) return -1; - if (tDecodeCStrTo(&decoder, pRsp->indexExts) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pRsp->dbFName)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pRsp->tblFName)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pRsp->colName)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pRsp->indexType)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pRsp->indexExts)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSTableIndexReq(void *buf, int32_t bufLen, STableIndexReq *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->tbFName) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->tbFName)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSTableIndexReq(void *buf, int32_t bufLen, STableIndexReq *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->tbFName) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->tbFName)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSTableIndexInfo(SEncoder *pEncoder, STableIndexInfo *pInfo) { - if (tEncodeI8(pEncoder, pInfo->intervalUnit) < 0) return -1; - if (tEncodeI8(pEncoder, pInfo->slidingUnit) < 0) return -1; - if (tEncodeI64(pEncoder, pInfo->interval) < 0) return -1; - if (tEncodeI64(pEncoder, pInfo->offset) < 0) return -1; - if (tEncodeI64(pEncoder, pInfo->sliding) < 0) return -1; - if (tEncodeI64(pEncoder, pInfo->dstTbUid) < 0) return -1; - if (tEncodeI32(pEncoder, pInfo->dstVgId) < 0) return -1; - if (tEncodeSEpSet(pEncoder, &pInfo->epSet) < 0) return -1; - if (tEncodeCStr(pEncoder, pInfo->expr) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeI8(pEncoder, pInfo->intervalUnit)); + TAOS_CHECK_RETURN(tEncodeI8(pEncoder, pInfo->slidingUnit)); + TAOS_CHECK_RETURN(tEncodeI64(pEncoder, pInfo->interval)); + TAOS_CHECK_RETURN(tEncodeI64(pEncoder, pInfo->offset)); + TAOS_CHECK_RETURN(tEncodeI64(pEncoder, pInfo->sliding)); + TAOS_CHECK_RETURN(tEncodeI64(pEncoder, pInfo->dstTbUid)); + TAOS_CHECK_RETURN(tEncodeI32(pEncoder, pInfo->dstVgId)); + TAOS_CHECK_RETURN(tEncodeSEpSet(pEncoder, &pInfo->epSet)); + TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, pInfo->expr)); return 0; } int32_t tSerializeSTableIndexRsp(void *buf, int32_t bufLen, const STableIndexRsp *pRsp) { 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, pRsp->tbName) < 0) return -1; - if (tEncodeCStr(&encoder, pRsp->dbFName) < 0) return -1; - if (tEncodeU64(&encoder, pRsp->suid) < 0) return -1; - if (tEncodeI32(&encoder, pRsp->version) < 0) return -1; - if (tEncodeI32(&encoder, pRsp->indexSize) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pRsp->tbName)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pRsp->dbFName)); + TAOS_CHECK_EXIT(tEncodeU64(&encoder, pRsp->suid)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pRsp->version)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pRsp->indexSize)); int32_t num = taosArrayGetSize(pRsp->pIndex); - if (tEncodeI32(&encoder, num) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, num)); if (num > 0) { for (int32_t i = 0; i < num; ++i) { STableIndexInfo *pInfo = (STableIndexInfo *)taosArrayGet(pRsp->pIndex, i); - if (tSerializeSTableIndexInfo(&encoder, pInfo) < 0) return -1; + TAOS_CHECK_EXIT(tSerializeSTableIndexInfo(&encoder, pInfo)); } } tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } @@ -4518,47 +5219,51 @@ void tFreeSerializeSTableIndexRsp(STableIndexRsp *pRsp) { } int32_t tDeserializeSTableIndexInfo(SDecoder *pDecoder, STableIndexInfo *pInfo) { - if (tDecodeI8(pDecoder, &pInfo->intervalUnit) < 0) return -1; - if (tDecodeI8(pDecoder, &pInfo->slidingUnit) < 0) return -1; - if (tDecodeI64(pDecoder, &pInfo->interval) < 0) return -1; - if (tDecodeI64(pDecoder, &pInfo->offset) < 0) return -1; - if (tDecodeI64(pDecoder, &pInfo->sliding) < 0) return -1; - if (tDecodeI64(pDecoder, &pInfo->dstTbUid) < 0) return -1; - if (tDecodeI32(pDecoder, &pInfo->dstVgId) < 0) return -1; - if (tDecodeSEpSet(pDecoder, &pInfo->epSet) < 0) return -1; - if (tDecodeCStrAlloc(pDecoder, &pInfo->expr) < 0) return -1; - + TAOS_CHECK_RETURN(tDecodeI8(pDecoder, &pInfo->intervalUnit)); + TAOS_CHECK_RETURN(tDecodeI8(pDecoder, &pInfo->slidingUnit)); + TAOS_CHECK_RETURN(tDecodeI64(pDecoder, &pInfo->interval)); + TAOS_CHECK_RETURN(tDecodeI64(pDecoder, &pInfo->offset)); + TAOS_CHECK_RETURN(tDecodeI64(pDecoder, &pInfo->sliding)); + TAOS_CHECK_RETURN(tDecodeI64(pDecoder, &pInfo->dstTbUid)); + TAOS_CHECK_RETURN(tDecodeI32(pDecoder, &pInfo->dstVgId)); + TAOS_CHECK_RETURN(tDecodeSEpSet(pDecoder, &pInfo->epSet)); + TAOS_CHECK_RETURN(tDecodeCStrAlloc(pDecoder, &pInfo->expr)); return 0; } int32_t tDeserializeSTableIndexRsp(void *buf, int32_t bufLen, STableIndexRsp *pRsp) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeCStrTo(&decoder, pRsp->tbName) < 0) return -1; - if (tDecodeCStrTo(&decoder, pRsp->dbFName) < 0) return -1; - if (tDecodeU64(&decoder, &pRsp->suid) < 0) return -1; - if (tDecodeI32(&decoder, &pRsp->version) < 0) return -1; - if (tDecodeI32(&decoder, &pRsp->indexSize) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pRsp->tbName)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pRsp->dbFName)); + TAOS_CHECK_EXIT(tDecodeU64(&decoder, &pRsp->suid)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pRsp->version)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pRsp->indexSize)); int32_t num = 0; - if (tDecodeI32(&decoder, &num) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &num)); if (num > 0) { pRsp->pIndex = taosArrayInit(num, sizeof(STableIndexInfo)); - if (NULL == pRsp->pIndex) return -1; + if (NULL == pRsp->pIndex) { + TAOS_CHECK_EXIT(terrno); + } STableIndexInfo info; for (int32_t i = 0; i < num; ++i) { - if (tDeserializeSTableIndexInfo(&decoder, &info) < 0) return -1; + TAOS_CHECK_EXIT(tDeserializeSTableIndexInfo(&decoder, &info)); if (NULL == taosArrayPush(pRsp->pIndex, &info)) { taosMemoryFree(info.expr); - return -1; + TAOS_CHECK_EXIT(terrno); } } } tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSTableIndexInfo(void *info) { @@ -4573,81 +5278,92 @@ void tFreeSTableIndexInfo(void *info) { int32_t tSerializeSShowVariablesReq(void *buf, int32_t bufLen, SShowVariablesReq *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->useless) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->useless)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } -// int32_t tDeserializeSShowVariablesReq(void *buf, int32_t bufLen, SShowVariablesReq *pReq) { -// SDecoder decoder = {0}; -// tDecoderInit(&decoder, buf, bufLen); - -// if (tStartDecode(&decoder) < 0) return -1; -// if (tDecodeI32(&decoder, &pReq->useless) < 0) return -1; - -// tEndDecode(&decoder); -// tDecoderClear(&decoder); -// return 0; -// } - int32_t tEncodeSVariablesInfo(SEncoder *pEncoder, SVariablesInfo *pInfo) { - if (tEncodeCStr(pEncoder, pInfo->name) < 0) return -1; - if (tEncodeCStr(pEncoder, pInfo->value) < 0) return -1; - if (tEncodeCStr(pEncoder, pInfo->scope) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, pInfo->name)); + TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, pInfo->value)); + TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, pInfo->scope)); return 0; } int32_t tDecodeSVariablesInfo(SDecoder *pDecoder, SVariablesInfo *pInfo) { - if (tDecodeCStrTo(pDecoder, pInfo->name) < 0) return -1; - if (tDecodeCStrTo(pDecoder, pInfo->value) < 0) return -1; - if (tDecodeCStrTo(pDecoder, pInfo->scope) < 0) return -1; + TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, pInfo->name)); + TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, pInfo->value)); + TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, pInfo->scope)); return 0; } int32_t tSerializeSShowVariablesRsp(void *buf, int32_t bufLen, SShowVariablesRsp *pRsp) { 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)); int32_t varNum = taosArrayGetSize(pRsp->variables); - if (tEncodeI32(&encoder, varNum) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, varNum)); for (int32_t i = 0; i < varNum; ++i) { SVariablesInfo *pInfo = taosArrayGet(pRsp->variables, i); - if (tEncodeSVariablesInfo(&encoder, pInfo) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeSVariablesInfo(&encoder, pInfo)); } tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSShowVariablesRsp(void *buf, int32_t bufLen, SShowVariablesRsp *pRsp) { 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)); int32_t varNum = 0; - if (tDecodeI32(&decoder, &varNum) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &varNum)); if (varNum > 0) { pRsp->variables = taosArrayInit(varNum, sizeof(SVariablesInfo)); - if (NULL == pRsp->variables) return -1; + if (NULL == pRsp->variables) { + TAOS_CHECK_EXIT(terrno); + } for (int32_t i = 0; i < varNum; ++i) { SVariablesInfo info = {0}; - if (tDecodeSVariablesInfo(&decoder, &info) < 0) return -1; - if (NULL == taosArrayPush(pRsp->variables, &info)) return -1; + TAOS_CHECK_EXIT(tDecodeSVariablesInfo(&decoder, &info)); + if (NULL == taosArrayPush(pRsp->variables, &info)) { + TAOS_CHECK_EXIT(terrno); + } } } tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSShowVariablesRsp(SShowVariablesRsp *pRsp) { @@ -4660,108 +5376,109 @@ void tFreeSShowVariablesRsp(SShowVariablesRsp *pRsp) { int32_t tSerializeSShowReq(void *buf, int32_t bufLen, SShowReq *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->type) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->db) < 0) return -1; - if (tEncodeI32(&encoder, pReq->payloadLen) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->type)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->db)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->payloadLen)); if (pReq->payloadLen > 0) { - if (tEncodeBinary(&encoder, pReq->payload, pReq->payloadLen) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeBinary(&encoder, pReq->payload, pReq->payloadLen)); } tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } -// int32_t tDeserializeSShowReq(void *buf, int32_t bufLen, SShowReq *pReq) { -// SDecoder decoder = {0}; -// tDecoderInit(&decoder, buf, bufLen); - -// if (tStartDecode(&decoder) < 0) return -1; -// if (tDecodeI32(&decoder, &pReq->type) < 0) return -1; -// if (tDecodeCStrTo(&decoder, pReq->db) < 0) return -1; -// if (tDecodeI32(&decoder, &pReq->payloadLen) < 0) return -1; -// if (pReq->payloadLen > 0) { -// pReq->payload = taosMemoryMalloc(pReq->payloadLen); -// if (pReq->payload == NULL) return -1; -// if (tDecodeCStrTo(&decoder, pReq->payload) < 0) return -1; -// } - -// tEndDecode(&decoder); -// tDecoderClear(&decoder); -// return 0; -// } - void tFreeSShowReq(SShowReq *pReq) { taosMemoryFreeClear(pReq->payload); } int32_t tSerializeSRetrieveTableReq(void *buf, int32_t bufLen, SRetrieveTableReq *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 (tEncodeI64(&encoder, pReq->showId) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->db) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->tb) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->filterTb) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->user) < 0) return -1; - if (tEncodeI64(&encoder, pReq->compactId) < 0) return -1; - if (tEncodeI8(&encoder, pReq->withFull) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->showId)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->db)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->tb)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->filterTb)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->user)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->compactId)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->withFull)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSRetrieveTableReq(void *buf, int32_t bufLen, SRetrieveTableReq *pReq) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; + tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->showId) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->db) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->tb) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->filterTb) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->user) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->showId)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->db)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->tb)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->filterTb)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->user)); if (!tDecodeIsEnd(&decoder)) { - if (tDecodeI64(&decoder, &pReq->compactId) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->compactId)); } else { pReq->compactId = -1; } if (!tDecodeIsEnd(&decoder)) { - if (tDecodeI8(&decoder, (int8_t *)&pReq->withFull) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI8(&decoder, (int8_t *)&pReq->withFull)); } tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } static int32_t tEncodeSTableMetaRsp(SEncoder *pEncoder, STableMetaRsp *pRsp) { - if (tEncodeCStr(pEncoder, pRsp->tbName) < 0) return -1; - if (tEncodeCStr(pEncoder, pRsp->stbName) < 0) return -1; - if (tEncodeCStr(pEncoder, pRsp->dbFName) < 0) return -1; - if (tEncodeI64(pEncoder, pRsp->dbId) < 0) return -1; - if (tEncodeI32(pEncoder, pRsp->numOfTags) < 0) return -1; - if (tEncodeI32(pEncoder, pRsp->numOfColumns) < 0) return -1; - if (tEncodeI8(pEncoder, pRsp->precision) < 0) return -1; - if (tEncodeI8(pEncoder, pRsp->tableType) < 0) return -1; - if (tEncodeI32(pEncoder, pRsp->sversion) < 0) return -1; - if (tEncodeI32(pEncoder, pRsp->tversion) < 0) return -1; - if (tEncodeU64(pEncoder, pRsp->suid) < 0) return -1; - if (tEncodeU64(pEncoder, pRsp->tuid) < 0) return -1; - if (tEncodeI32(pEncoder, pRsp->vgId) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, pRsp->tbName)); + TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, pRsp->stbName)); + TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, pRsp->dbFName)); + TAOS_CHECK_RETURN(tEncodeI64(pEncoder, pRsp->dbId)); + TAOS_CHECK_RETURN(tEncodeI32(pEncoder, pRsp->numOfTags)); + TAOS_CHECK_RETURN(tEncodeI32(pEncoder, pRsp->numOfColumns)); + TAOS_CHECK_RETURN(tEncodeI8(pEncoder, pRsp->precision)); + TAOS_CHECK_RETURN(tEncodeI8(pEncoder, pRsp->tableType)); + TAOS_CHECK_RETURN(tEncodeI32(pEncoder, pRsp->sversion)); + TAOS_CHECK_RETURN(tEncodeI32(pEncoder, pRsp->tversion)); + TAOS_CHECK_RETURN(tEncodeU64(pEncoder, pRsp->suid)); + TAOS_CHECK_RETURN(tEncodeU64(pEncoder, pRsp->tuid)); + TAOS_CHECK_RETURN(tEncodeI32(pEncoder, pRsp->vgId)); for (int32_t i = 0; i < pRsp->numOfColumns + pRsp->numOfTags; ++i) { SSchema *pSchema = &pRsp->pSchemas[i]; - if (tEncodeSSchema(pEncoder, pSchema) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeSSchema(pEncoder, pSchema)); } if (useCompress(pRsp->tableType)) { for (int32_t i = 0; i < pRsp->numOfColumns; ++i) { SSchemaExt *pSchemaExt = &pRsp->pSchemaExt[i]; - if (tEncodeSSchemaExt(pEncoder, pSchemaExt) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeSSchemaExt(pEncoder, pSchemaExt)); } } @@ -4769,28 +5486,30 @@ static int32_t tEncodeSTableMetaRsp(SEncoder *pEncoder, STableMetaRsp *pRsp) { } static int32_t tDecodeSTableMetaRsp(SDecoder *pDecoder, STableMetaRsp *pRsp) { - if (tDecodeCStrTo(pDecoder, pRsp->tbName) < 0) return -1; - if (tDecodeCStrTo(pDecoder, pRsp->stbName) < 0) return -1; - if (tDecodeCStrTo(pDecoder, pRsp->dbFName) < 0) return -1; - if (tDecodeI64(pDecoder, &pRsp->dbId) < 0) return -1; - if (tDecodeI32(pDecoder, &pRsp->numOfTags) < 0) return -1; - if (tDecodeI32(pDecoder, &pRsp->numOfColumns) < 0) return -1; - if (tDecodeI8(pDecoder, &pRsp->precision) < 0) return -1; - if (tDecodeI8(pDecoder, &pRsp->tableType) < 0) return -1; - if (tDecodeI32(pDecoder, &pRsp->sversion) < 0) return -1; - if (tDecodeI32(pDecoder, &pRsp->tversion) < 0) return -1; - if (tDecodeU64(pDecoder, &pRsp->suid) < 0) return -1; - if (tDecodeU64(pDecoder, &pRsp->tuid) < 0) return -1; - if (tDecodeI32(pDecoder, &pRsp->vgId) < 0) return -1; + TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, pRsp->tbName)); + TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, pRsp->stbName)); + TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, pRsp->dbFName)); + TAOS_CHECK_RETURN(tDecodeI64(pDecoder, &pRsp->dbId)); + TAOS_CHECK_RETURN(tDecodeI32(pDecoder, &pRsp->numOfTags)); + TAOS_CHECK_RETURN(tDecodeI32(pDecoder, &pRsp->numOfColumns)); + TAOS_CHECK_RETURN(tDecodeI8(pDecoder, &pRsp->precision)); + TAOS_CHECK_RETURN(tDecodeI8(pDecoder, &pRsp->tableType)); + TAOS_CHECK_RETURN(tDecodeI32(pDecoder, &pRsp->sversion)); + TAOS_CHECK_RETURN(tDecodeI32(pDecoder, &pRsp->tversion)); + TAOS_CHECK_RETURN(tDecodeU64(pDecoder, &pRsp->suid)); + TAOS_CHECK_RETURN(tDecodeU64(pDecoder, &pRsp->tuid)); + TAOS_CHECK_RETURN(tDecodeI32(pDecoder, &pRsp->vgId)); int32_t totalCols = pRsp->numOfTags + pRsp->numOfColumns; if (totalCols > 0) { pRsp->pSchemas = taosMemoryMalloc(sizeof(SSchema) * totalCols); - if (pRsp->pSchemas == NULL) return -1; + if (pRsp->pSchemas == NULL) { + TAOS_CHECK_RETURN(terrno); + } for (int32_t i = 0; i < totalCols; ++i) { SSchema *pSchema = &pRsp->pSchemas[i]; - if (tDecodeSSchema(pDecoder, pSchema) < 0) return -1; + TAOS_CHECK_RETURN(tDecodeSSchema(pDecoder, pSchema)); } } else { pRsp->pSchemas = NULL; @@ -4799,11 +5518,13 @@ static int32_t tDecodeSTableMetaRsp(SDecoder *pDecoder, STableMetaRsp *pRsp) { if (!tDecodeIsEnd(pDecoder)) { if (useCompress(pRsp->tableType) && pRsp->numOfColumns > 0) { pRsp->pSchemaExt = taosMemoryMalloc(sizeof(SSchemaExt) * pRsp->numOfColumns); - if (pRsp->pSchemaExt == NULL) return -1; + if (pRsp->pSchemaExt == NULL) { + TAOS_CHECK_RETURN(terrno); + } for (int32_t i = 0; i < pRsp->numOfColumns; ++i) { SSchemaExt *pSchemaExt = &pRsp->pSchemaExt[i]; - if (tDecodeSSchemaExt(pDecoder, pSchemaExt) < 0) return -1; + TAOS_CHECK_RETURN(tDecodeSSchemaExt(pDecoder, pSchemaExt)); } } else { pRsp->pSchemaExt = NULL; @@ -4815,128 +5536,155 @@ static int32_t tDecodeSTableMetaRsp(SDecoder *pDecoder, STableMetaRsp *pRsp) { int32_t tSerializeSTableMetaRsp(void *buf, int32_t bufLen, STableMetaRsp *pRsp) { SEncoder encoder = {0}; + int32_t code = 0; + int32_t lino; + int32_t tlen; tEncoderInit(&encoder, buf, bufLen); - if (tStartEncode(&encoder) < 0) return -1; - if (tEncodeSTableMetaRsp(&encoder, pRsp) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeSTableMetaRsp(&encoder, pRsp)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tSerializeSSTbHbRsp(void *buf, int32_t bufLen, SSTbHbRsp *pRsp) { 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)); int32_t numOfMeta = taosArrayGetSize(pRsp->pMetaRsp); - if (tEncodeI32(&encoder, numOfMeta) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, numOfMeta)); for (int32_t i = 0; i < numOfMeta; ++i) { STableMetaRsp *pMetaRsp = taosArrayGet(pRsp->pMetaRsp, i); - if (tEncodeSTableMetaRsp(&encoder, pMetaRsp) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeSTableMetaRsp(&encoder, pMetaRsp)); } int32_t numOfIndex = taosArrayGetSize(pRsp->pIndexRsp); - if (tEncodeI32(&encoder, numOfIndex) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, numOfIndex)); for (int32_t i = 0; i < numOfIndex; ++i) { STableIndexRsp *pIndexRsp = taosArrayGet(pRsp->pIndexRsp, i); - if (tEncodeCStr(&encoder, pIndexRsp->tbName) < 0) return -1; - if (tEncodeCStr(&encoder, pIndexRsp->dbFName) < 0) return -1; - if (tEncodeU64(&encoder, pIndexRsp->suid) < 0) return -1; - if (tEncodeI32(&encoder, pIndexRsp->version) < 0) return -1; - if (tEncodeI32(&encoder, pIndexRsp->indexSize) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pIndexRsp->tbName)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pIndexRsp->dbFName)); + TAOS_CHECK_EXIT(tEncodeU64(&encoder, pIndexRsp->suid)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pIndexRsp->version)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pIndexRsp->indexSize)); int32_t num = taosArrayGetSize(pIndexRsp->pIndex); - if (tEncodeI32(&encoder, num) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, num)); for (int32_t j = 0; j < num; ++j) { STableIndexInfo *pInfo = (STableIndexInfo *)taosArrayGet(pIndexRsp->pIndex, j); - if (tSerializeSTableIndexInfo(&encoder, pInfo) < 0) return -1; + TAOS_CHECK_EXIT(tSerializeSTableIndexInfo(&encoder, pInfo)); } } tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSTableMetaRsp(void *buf, int32_t bufLen, STableMetaRsp *pRsp) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; + tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeSTableMetaRsp(&decoder, pRsp) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeSTableMetaRsp(&decoder, pRsp)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tDeserializeSSTbHbRsp(void *buf, int32_t bufLen, SSTbHbRsp *pRsp) { 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)); int32_t numOfMeta = 0; - if (tDecodeI32(&decoder, &numOfMeta) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &numOfMeta)); pRsp->pMetaRsp = taosArrayInit(numOfMeta, sizeof(STableMetaRsp)); if (pRsp->pMetaRsp == NULL) { - return -1; + TAOS_CHECK_EXIT(terrno); } for (int32_t i = 0; i < numOfMeta; ++i) { STableMetaRsp tableMetaRsp = {0}; - if (tDecodeSTableMetaRsp(&decoder, &tableMetaRsp) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeSTableMetaRsp(&decoder, &tableMetaRsp)); if (taosArrayPush(pRsp->pMetaRsp, &tableMetaRsp) == NULL) { taosMemoryFree(tableMetaRsp.pSchemas); taosMemoryFree(tableMetaRsp.pSchemaExt); - return -1; + TAOS_CHECK_EXIT(terrno); } } int32_t numOfIndex = 0; - if (tDecodeI32(&decoder, &numOfIndex) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &numOfIndex)); pRsp->pIndexRsp = taosArrayInit(numOfIndex, sizeof(STableIndexRsp)); if (pRsp->pIndexRsp == NULL) { - return -1; + TAOS_CHECK_EXIT(terrno); } for (int32_t i = 0; i < numOfIndex; ++i) { STableIndexRsp tableIndexRsp = {0}; - if (tDecodeCStrTo(&decoder, tableIndexRsp.tbName) < 0) return -1; - if (tDecodeCStrTo(&decoder, tableIndexRsp.dbFName) < 0) return -1; - if (tDecodeU64(&decoder, &tableIndexRsp.suid) < 0) return -1; - if (tDecodeI32(&decoder, &tableIndexRsp.version) < 0) return -1; - if (tDecodeI32(&decoder, &tableIndexRsp.indexSize) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, tableIndexRsp.tbName)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, tableIndexRsp.dbFName)); + TAOS_CHECK_EXIT(tDecodeU64(&decoder, &tableIndexRsp.suid)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &tableIndexRsp.version)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &tableIndexRsp.indexSize)); int32_t num = 0; - if (tDecodeI32(&decoder, &num) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &num)); if (num > 0) { tableIndexRsp.pIndex = taosArrayInit(num, sizeof(STableIndexInfo)); - if (NULL == tableIndexRsp.pIndex) return -1; + if (NULL == tableIndexRsp.pIndex) { + TAOS_CHECK_EXIT(terrno); + } STableIndexInfo info; for (int32_t j = 0; j < num; ++j) { - if (tDeserializeSTableIndexInfo(&decoder, &info) < 0) return -1; + TAOS_CHECK_EXIT(tDeserializeSTableIndexInfo(&decoder, &info)); if (NULL == taosArrayPush(tableIndexRsp.pIndex, &info)) { taosMemoryFree(info.expr); - return -1; + TAOS_CHECK_EXIT(terrno); } } } if (taosArrayPush(pRsp->pIndexRsp, &tableIndexRsp) == NULL) { taosArrayDestroyEx(tableIndexRsp.pIndex, tFreeSTableIndexInfo); - return -1; + TAOS_CHECK_EXIT(terrno); } } tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSTableMetaRsp(void *pRsp) { @@ -4976,35 +5724,6 @@ void tFreeSSTbHbRsp(SSTbHbRsp *pRsp) { taosArrayDestroy(pRsp->pIndexRsp); } -// int32_t tSerializeSShowRsp(void *buf, int32_t bufLen, SShowRsp *pRsp) { -// SEncoder encoder = {0}; -// tEncoderInit(&encoder, buf, bufLen); - -// if (tStartEncode(&encoder) < 0) return -1; -// if (tEncodeI64(&encoder, pRsp->showId) < 0) return -1; -// if (tEncodeSTableMetaRsp(&encoder, &pRsp->tableMeta) < 0) return -1; -// tEndEncode(&encoder); - -// int32_t tlen = encoder.pos; -// tEncoderClear(&encoder); -// return tlen; -// } - -// int32_t tDeserializeSShowRsp(void *buf, int32_t bufLen, SShowRsp *pRsp) { -// SDecoder decoder = {0}; -// tDecoderInit(&decoder, buf, bufLen); - -// if (tStartDecode(&decoder) < 0) return -1; -// if (tDecodeI64(&decoder, &pRsp->showId) < 0) return -1; -// if (tDecodeSTableMetaRsp(&decoder, &pRsp->tableMeta) < 0) return -1; - -// tEndDecode(&decoder); -// tDecoderClear(&decoder); -// return 0; -// } - -// void tFreeSShowRsp(SShowRsp *pRsp) { tFreeSTableMetaRsp(&pRsp->tableMeta); } - int32_t tSerializeSTableInfoReq(void *buf, int32_t bufLen, STableInfoReq *pReq) { int32_t headLen = sizeof(SMsgHead); if (buf != NULL) { @@ -5053,132 +5772,169 @@ int32_t tDeserializeSTableInfoReq(void *buf, int32_t bufLen, STableInfoReq *pReq int32_t tSerializeSMDropTopicReq(void *buf, int32_t bufLen, SMDropTopicReq *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; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->name)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->igNotExists)); ENCODESQL(); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSMDropTopicReq(void *buf, int32_t bufLen, SMDropTopicReq *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)); DECODESQL(); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSMDropTopicReq(SMDropTopicReq *pReq) { FREESQL(); } int32_t tSerializeSMDropCgroupReq(void *buf, int32_t bufLen, SMDropCgroupReq *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->topic) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->cgroup) < 0) return -1; - if (tEncodeI8(&encoder, pReq->igNotExists) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->topic)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->cgroup)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->igNotExists)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSMDropCgroupReq(void *buf, int32_t bufLen, SMDropCgroupReq *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->topic) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->cgroup) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->igNotExists) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->topic)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->cgroup)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->igNotExists)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSCMCreateTopicReq(void *buf, int32_t bufLen, const SCMCreateTopicReq *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->subType) < 0) return -1; - if (tEncodeI8(&encoder, pReq->withMeta) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->subDbName) < 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->subType)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->withMeta)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->subDbName)); if (TOPIC_SUB_TYPE__DB == pReq->subType) { } else { if (TOPIC_SUB_TYPE__TABLE == pReq->subType) { - if (tEncodeCStr(&encoder, pReq->subStbName) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->subStbName)); } if (pReq->ast && strlen(pReq->ast) > 0) { - if (tEncodeI32(&encoder, strlen(pReq->ast)) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->ast) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, strlen(pReq->ast))); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->ast)); } else { - if (tEncodeI32(&encoder, 0) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, 0)); } } - if (tEncodeI32(&encoder, strlen(pReq->sql)) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->sql) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, strlen(pReq->sql))); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->sql)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSCMCreateTopicReq(void *buf, int32_t bufLen, SCMCreateTopicReq *pReq) { - int32_t sqlLen = 0; - int32_t astLen = 0; - + int32_t sqlLen = 0; + int32_t astLen = 0; + int32_t code = 0; + int32_t lino; SDecoder decoder = {0}; 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->subType) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->withMeta) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->subDbName) < 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->subType)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->withMeta)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->subDbName)); if (TOPIC_SUB_TYPE__DB == pReq->subType) { } else { if (TOPIC_SUB_TYPE__TABLE == pReq->subType) { - if (tDecodeCStrTo(&decoder, pReq->subStbName) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->subStbName)); } - if (tDecodeI32(&decoder, &astLen) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &astLen)); if (astLen > 0) { pReq->ast = taosMemoryCalloc(1, astLen + 1); - 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 (tDecodeI32(&decoder, &sqlLen) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &sqlLen)); if (sqlLen > 0) { pReq->sql = taosMemoryCalloc(1, sqlLen + 1); - 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)); } tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSCMCreateTopicReq(SCMCreateTopicReq *pReq) { @@ -5190,196 +5946,224 @@ void tFreeSCMCreateTopicReq(SCMCreateTopicReq *pReq) { int32_t tSerializeSConnectReq(void *buf, int32_t bufLen, SConnectReq *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 (tEncodeI8(&encoder, pReq->connType) < 0) return -1; - if (tEncodeI32(&encoder, pReq->pid) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->app) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->db) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->user) < 0) return -1; - if (tEncodeCStrWithLen(&encoder, pReq->passwd, TSDB_PASSWORD_LEN) < 0) return -1; - if (tEncodeI64(&encoder, pReq->startTime) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->sVer) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->connType)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->pid)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->app)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->db)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->user)); + TAOS_CHECK_EXIT(tEncodeCStrWithLen(&encoder, pReq->passwd, TSDB_PASSWORD_LEN)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->startTime)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->sVer)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSConnectReq(void *buf, int32_t bufLen, SConnectReq *pReq) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->connType) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->pid) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->app) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->db) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->user) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->passwd) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->startTime) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->connType)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->pid)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->app)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->db)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->user)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->passwd)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->startTime)); // Check the client version from version 3.0.3.0 if (tDecodeIsEnd(&decoder)) { tDecoderClear(&decoder); - return TSDB_CODE_VERSION_NOT_COMPATIBLE; + TAOS_CHECK_EXIT(TSDB_CODE_VERSION_NOT_COMPATIBLE); } - if (tDecodeCStrTo(&decoder, pReq->sVer) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->sVer)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSConnectRsp(void *buf, int32_t bufLen, SConnectRsp *pRsp) { 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, pRsp->acctId) < 0) return -1; - if (tEncodeI64(&encoder, pRsp->clusterId) < 0) return -1; - if (tEncodeU32(&encoder, pRsp->connId) < 0) return -1; - if (tEncodeI32(&encoder, pRsp->dnodeNum) < 0) return -1; - if (tEncodeI8(&encoder, pRsp->superUser) < 0) return -1; - if (tEncodeI8(&encoder, pRsp->sysInfo) < 0) return -1; - if (tEncodeI8(&encoder, pRsp->connType) < 0) return -1; - if (tEncodeSEpSet(&encoder, &pRsp->epSet) < 0) return -1; - if (tEncodeI32(&encoder, pRsp->svrTimestamp) < 0) return -1; - if (tEncodeCStr(&encoder, pRsp->sVer) < 0) return -1; - if (tEncodeCStr(&encoder, pRsp->sDetailVer) < 0) return -1; - if (tEncodeI32(&encoder, pRsp->passVer) < 0) return -1; - if (tEncodeI32(&encoder, pRsp->authVer) < 0) return -1; - if (tEncodeI64(&encoder, pRsp->whiteListVer) < 0) return -1; - if (tSerializeSMonitorParas(&encoder, &pRsp->monitorParas) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pRsp->acctId)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pRsp->clusterId)); + TAOS_CHECK_EXIT(tEncodeU32(&encoder, pRsp->connId)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pRsp->dnodeNum)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pRsp->superUser)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pRsp->sysInfo)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pRsp->connType)); + TAOS_CHECK_EXIT(tEncodeSEpSet(&encoder, &pRsp->epSet)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pRsp->svrTimestamp)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pRsp->sVer)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pRsp->sDetailVer)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pRsp->passVer)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pRsp->authVer)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pRsp->whiteListVer)); + TAOS_CHECK_EXIT(tSerializeSMonitorParas(&encoder, &pRsp->monitorParas)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSConnectRsp(void *buf, int32_t bufLen, SConnectRsp *pRsp) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - int32_t ret = -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; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pRsp->acctId)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pRsp->clusterId)); + TAOS_CHECK_EXIT(tDecodeU32(&decoder, &pRsp->connId)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pRsp->dnodeNum)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pRsp->superUser)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pRsp->sysInfo)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pRsp->connType)); + TAOS_CHECK_EXIT(tDecodeSEpSet(&decoder, &pRsp->epSet)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pRsp->svrTimestamp)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pRsp->sVer)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pRsp->sDetailVer)); if (!tDecodeIsEnd(&decoder)) { - if (tDecodeI32(&decoder, &pRsp->passVer) < 0) goto _END; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pRsp->passVer)); } else { pRsp->passVer = 0; } // since 3.0.7.0 if (!tDecodeIsEnd(&decoder)) { - if (tDecodeI32(&decoder, &pRsp->authVer) < 0) goto _END; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pRsp->authVer)); } else { pRsp->authVer = 0; } if (!tDecodeIsEnd(&decoder)) { - if (tDecodeI64(&decoder, &pRsp->whiteListVer) < 0) goto _END; + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pRsp->whiteListVer)); } else { pRsp->whiteListVer = 0; } if (!tDecodeIsEnd(&decoder)) { - if (tDeserializeSMonitorParas(&decoder, &pRsp->monitorParas) < 0) goto _END; + TAOS_CHECK_EXIT(tDeserializeSMonitorParas(&decoder, &pRsp->monitorParas)); } tEndDecode(&decoder); - ret = 0; -_END: +_exit: tDecoderClear(&decoder); - return ret; + return code; } int32_t tSerializeSMTimerMsg(void *buf, int32_t bufLen, SMTimerReq *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->reserved) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->reserved)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } -// int32_t tDeserializeSMTimerMsg(void *buf, int32_t bufLen, SMTimerReq *pReq) { -// SDecoder decoder = {0}; -// tDecoderInit(&decoder, buf, bufLen); - -// if (tStartDecode(&decoder) < 0) return -1; -// if (tDecodeI32(&decoder, &pReq->reserved) < 0) return -1; -// tEndDecode(&decoder); - -// tDecoderClear(&decoder); -// return 0; -// } - int32_t tSerializeDropOrphanTaskMsg(void *buf, int32_t bufLen, SMStreamDropOrphanMsg *pMsg) { 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)); int32_t size = taosArrayGetSize(pMsg->pList); - if (tEncodeI32(&encoder, size) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, size)); for (int32_t i = 0; i < size; i++) { SOrphanTask *pTask = taosArrayGet(pMsg->pList, i); - if (tEncodeI64(&encoder, pTask->streamId) < 0) return -1; - if (tEncodeI32(&encoder, pTask->taskId) < 0) return -1; - if (tEncodeI32(&encoder, pTask->nodeId) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pTask->streamId)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pTask->taskId)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pTask->nodeId)); } tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeDropOrphanTaskMsg(void *buf, int32_t bufLen, SMStreamDropOrphanMsg *pMsg) { 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)); int32_t num = 0; - if (tDecodeI32(&decoder, &num) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &num)); if (num > 0) { pMsg->pList = taosArrayInit(num, sizeof(SOrphanTask)); - if (NULL == pMsg->pList) return -1; + if (NULL == pMsg->pList) { + TAOS_CHECK_EXIT(terrno); + } for (int32_t i = 0; i < num; ++i) { SOrphanTask info = {0}; - if (tDecodeI64(&decoder, &info.streamId) < 0) return -1; - if (tDecodeI32(&decoder, &info.taskId) < 0) return -1; - if (tDecodeI32(&decoder, &info.nodeId) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &info.streamId)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &info.taskId)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &info.nodeId)); if (taosArrayPush(pMsg->pList, &info) == NULL) { - return -1; + TAOS_CHECK_EXIT(terrno); } } } tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tDestroyDropOrphanTaskMsg(SMStreamDropOrphanMsg *pMsg) { @@ -5391,196 +6175,209 @@ void tDestroyDropOrphanTaskMsg(SMStreamDropOrphanMsg *pMsg) { } int32_t tEncodeSReplica(SEncoder *pEncoder, SReplica *pReplica) { - if (tEncodeI32(pEncoder, pReplica->id) < 0) return -1; - if (tEncodeU16(pEncoder, pReplica->port) < 0) return -1; - if (tEncodeCStr(pEncoder, pReplica->fqdn) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeI32(pEncoder, pReplica->id)); + TAOS_CHECK_RETURN(tEncodeU16(pEncoder, pReplica->port)); + TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, pReplica->fqdn)); return 0; } int32_t tDecodeSReplica(SDecoder *pDecoder, SReplica *pReplica) { - if (tDecodeI32(pDecoder, &pReplica->id) < 0) return -1; - if (tDecodeU16(pDecoder, &pReplica->port) < 0) return -1; - if (tDecodeCStrTo(pDecoder, pReplica->fqdn) < 0) return -1; + TAOS_CHECK_RETURN(tDecodeI32(pDecoder, &pReplica->id)); + TAOS_CHECK_RETURN(tDecodeU16(pDecoder, &pReplica->port)); + TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, pReplica->fqdn)); return 0; } int32_t tSerializeSCreateVnodeReq(void *buf, int32_t bufLen, SCreateVnodeReq *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->vgId) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->db) < 0) return -1; - if (tEncodeI64(&encoder, pReq->dbUid) < 0) return -1; - if (tEncodeI32(&encoder, pReq->vgVersion) < 0) return -1; - if (tEncodeI32(&encoder, pReq->numOfStables) < 0) return -1; - if (tEncodeI32(&encoder, pReq->buffer) < 0) return -1; - if (tEncodeI32(&encoder, pReq->pageSize) < 0) return -1; - if (tEncodeI32(&encoder, pReq->pages) < 0) return -1; - if (tEncodeI32(&encoder, pReq->cacheLastSize) < 0) return -1; - if (tEncodeI32(&encoder, pReq->daysPerFile) < 0) return -1; - if (tEncodeI32(&encoder, pReq->daysToKeep0) < 0) return -1; - if (tEncodeI32(&encoder, pReq->daysToKeep1) < 0) return -1; - if (tEncodeI32(&encoder, pReq->daysToKeep2) < 0) return -1; - if (tEncodeI32(&encoder, pReq->minRows) < 0) return -1; - if (tEncodeI32(&encoder, pReq->maxRows) < 0) return -1; - if (tEncodeI32(&encoder, pReq->walFsyncPeriod) < 0) return -1; - if (tEncodeU32(&encoder, pReq->hashBegin) < 0) return -1; - if (tEncodeU32(&encoder, pReq->hashEnd) < 0) return -1; - if (tEncodeI8(&encoder, pReq->hashMethod) < 0) return -1; - if (tEncodeI8(&encoder, pReq->walLevel) < 0) return -1; - if (tEncodeI8(&encoder, pReq->precision) < 0) return -1; - if (tEncodeI8(&encoder, pReq->compression) < 0) return -1; - if (tEncodeI8(&encoder, pReq->strict) < 0) return -1; - if (tEncodeI8(&encoder, pReq->cacheLast) < 0) return -1; - if (tEncodeI8(&encoder, pReq->replica) < 0) return -1; - if (tEncodeI8(&encoder, pReq->selfIndex) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->vgId)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->db)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->dbUid)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->vgVersion)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->numOfStables)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->buffer)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->pageSize)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->pages)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->cacheLastSize)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->daysPerFile)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->daysToKeep0)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->daysToKeep1)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->daysToKeep2)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->minRows)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->maxRows)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->walFsyncPeriod)); + TAOS_CHECK_EXIT(tEncodeU32(&encoder, pReq->hashBegin)); + TAOS_CHECK_EXIT(tEncodeU32(&encoder, pReq->hashEnd)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->hashMethod)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->walLevel)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->precision)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->compression)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->strict)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->cacheLast)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->replica)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->selfIndex)); for (int32_t i = 0; i < TSDB_MAX_REPLICA; ++i) { SReplica *pReplica = &pReq->replicas[i]; - if (tEncodeSReplica(&encoder, pReplica) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeSReplica(&encoder, pReplica)); } - if (tEncodeI32(&encoder, pReq->numOfRetensions) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->numOfRetensions)); for (int32_t i = 0; i < pReq->numOfRetensions; ++i) { SRetention *pRetension = taosArrayGet(pReq->pRetensions, i); - if (tEncodeI64(&encoder, pRetension->freq) < 0) return -1; - if (tEncodeI64(&encoder, pRetension->keep) < 0) return -1; - if (tEncodeI8(&encoder, pRetension->freqUnit) < 0) return -1; - if (tEncodeI8(&encoder, pRetension->keepUnit) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pRetension->freq)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pRetension->keep)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pRetension->freqUnit)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pRetension->keepUnit)); } - if (tEncodeI8(&encoder, pReq->isTsma) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->isTsma)); if (pReq->isTsma) { uint32_t tsmaLen = (uint32_t)(htonl(((SMsgHead *)pReq->pTsma)->contLen)); - if (tEncodeBinary(&encoder, (const uint8_t *)pReq->pTsma, tsmaLen) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeBinary(&encoder, (const uint8_t *)pReq->pTsma, tsmaLen)); } - if (tEncodeI32(&encoder, pReq->walRetentionPeriod) < 0) return -1; - if (tEncodeI64(&encoder, pReq->walRetentionSize) < 0) return -1; - if (tEncodeI32(&encoder, pReq->walRollPeriod) < 0) return -1; - if (tEncodeI64(&encoder, pReq->walSegmentSize) < 0) return -1; - if (tEncodeI16(&encoder, pReq->sstTrigger) < 0) return -1; - if (tEncodeI16(&encoder, pReq->hashPrefix) < 0) return -1; - if (tEncodeI16(&encoder, pReq->hashSuffix) < 0) return -1; - if (tEncodeI32(&encoder, pReq->tsdbPageSize) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->walRetentionPeriod)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->walRetentionSize)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->walRollPeriod)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->walSegmentSize)); + TAOS_CHECK_EXIT(tEncodeI16(&encoder, pReq->sstTrigger)); + TAOS_CHECK_EXIT(tEncodeI16(&encoder, pReq->hashPrefix)); + TAOS_CHECK_EXIT(tEncodeI16(&encoder, pReq->hashSuffix)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->tsdbPageSize)); for (int32_t i = 0; i < 6; ++i) { - if (tEncodeI64(&encoder, pReq->reserved[i]) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->reserved[i])); } - if (tEncodeI8(&encoder, pReq->learnerReplica) < 0) return -1; - if (tEncodeI8(&encoder, pReq->learnerSelfIndex) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->learnerReplica)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->learnerSelfIndex)); for (int32_t i = 0; i < TSDB_MAX_LEARNER_REPLICA; ++i) { SReplica *pReplica = &pReq->learnerReplicas[i]; - if (tEncodeSReplica(&encoder, pReplica) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeSReplica(&encoder, pReplica)); } - if (tEncodeI32(&encoder, pReq->changeVersion) < 0) return -1; - if (tEncodeI32(&encoder, pReq->keepTimeOffset) < 0) return -1; - if (tEncodeI8(&encoder, pReq->encryptAlgorithm) < 0) return -1; - if (tEncodeI32(&encoder, pReq->s3ChunkSize) < 0) return -1; - if (tEncodeI32(&encoder, pReq->s3KeepLocal) < 0) return -1; - if (tEncodeI8(&encoder, pReq->s3Compact) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->changeVersion)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->keepTimeOffset)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->encryptAlgorithm)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->s3ChunkSize)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->s3KeepLocal)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->s3Compact)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSCreateVnodeReq(void *buf, int32_t bufLen, SCreateVnodeReq *pReq) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; + tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->vgId) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->db) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->dbUid) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->vgVersion) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->numOfStables) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->buffer) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->pageSize) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->pages) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->cacheLastSize) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->daysPerFile) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->daysToKeep0) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->daysToKeep1) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->daysToKeep2) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->minRows) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->maxRows) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->walFsyncPeriod) < 0) return -1; - if (tDecodeU32(&decoder, &pReq->hashBegin) < 0) return -1; - if (tDecodeU32(&decoder, &pReq->hashEnd) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->hashMethod) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->walLevel) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->precision) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->compression) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->strict) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->cacheLast) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->replica) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->selfIndex) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->vgId)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->db)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->dbUid)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->vgVersion)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->numOfStables)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->buffer)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->pageSize)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->pages)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->cacheLastSize)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->daysPerFile)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->daysToKeep0)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->daysToKeep1)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->daysToKeep2)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->minRows)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->maxRows)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->walFsyncPeriod)); + TAOS_CHECK_EXIT(tDecodeU32(&decoder, &pReq->hashBegin)); + TAOS_CHECK_EXIT(tDecodeU32(&decoder, &pReq->hashEnd)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->hashMethod)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->walLevel)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->precision)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->compression)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->strict)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->cacheLast)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->replica)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->selfIndex)); for (int32_t i = 0; i < TSDB_MAX_REPLICA; ++i) { SReplica *pReplica = &pReq->replicas[i]; - if (tDecodeSReplica(&decoder, pReplica) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeSReplica(&decoder, pReplica)); } - if (tDecodeI32(&decoder, &pReq->numOfRetensions) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->numOfRetensions)); pReq->pRetensions = taosArrayInit(pReq->numOfRetensions, sizeof(SRetention)); if (pReq->pRetensions == NULL) { - return -1; + TAOS_CHECK_EXIT(terrno); } for (int32_t i = 0; i < pReq->numOfRetensions; ++i) { SRetention rentension = {0}; - if (tDecodeI64(&decoder, &rentension.freq) < 0) return -1; - if (tDecodeI64(&decoder, &rentension.keep) < 0) return -1; - if (tDecodeI8(&decoder, &rentension.freqUnit) < 0) return -1; - if (tDecodeI8(&decoder, &rentension.keepUnit) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &rentension.freq)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &rentension.keep)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &rentension.freqUnit)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &rentension.keepUnit)); if (taosArrayPush(pReq->pRetensions, &rentension) == NULL) { - return -1; + TAOS_CHECK_EXIT(terrno); } } - if (tDecodeI8(&decoder, &pReq->isTsma) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->isTsma)); if (pReq->isTsma) { - if (tDecodeBinary(&decoder, (uint8_t **)&pReq->pTsma, NULL) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeBinary(&decoder, (uint8_t **)&pReq->pTsma, NULL)); } - if (tDecodeI32(&decoder, &pReq->walRetentionPeriod) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->walRetentionSize) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->walRollPeriod) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->walSegmentSize) < 0) return -1; - if (tDecodeI16(&decoder, &pReq->sstTrigger) < 0) return -1; - if (tDecodeI16(&decoder, &pReq->hashPrefix) < 0) return -1; - if (tDecodeI16(&decoder, &pReq->hashSuffix) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->tsdbPageSize) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->walRetentionPeriod)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->walRetentionSize)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->walRollPeriod)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->walSegmentSize)); + TAOS_CHECK_EXIT(tDecodeI16(&decoder, &pReq->sstTrigger)); + TAOS_CHECK_EXIT(tDecodeI16(&decoder, &pReq->hashPrefix)); + TAOS_CHECK_EXIT(tDecodeI16(&decoder, &pReq->hashSuffix)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->tsdbPageSize)); for (int32_t i = 0; i < 6; ++i) { - if (tDecodeI64(&decoder, &pReq->reserved[i]) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->reserved[i])); } if (!tDecodeIsEnd(&decoder)) { - if (tDecodeI8(&decoder, &pReq->learnerReplica) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->learnerSelfIndex) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->learnerReplica)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->learnerSelfIndex)); for (int32_t i = 0; i < TSDB_MAX_LEARNER_REPLICA; ++i) { SReplica *pReplica = &pReq->learnerReplicas[i]; - if (tDecodeSReplica(&decoder, pReplica) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeSReplica(&decoder, pReplica)); } } if (!tDecodeIsEnd(&decoder)) { - if (tDecodeI32(&decoder, &pReq->changeVersion) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->changeVersion)); } pReq->keepTimeOffset = TSDB_DEFAULT_KEEP_TIME_OFFSET; if (!tDecodeIsEnd(&decoder)) { - if (tDecodeI32(&decoder, &pReq->keepTimeOffset) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->keepTimeOffset)); } pReq->encryptAlgorithm = TSDB_DEFAULT_ENCRYPT_ALGO; pReq->s3ChunkSize = TSDB_DEFAULT_S3_CHUNK_SIZE; pReq->s3KeepLocal = TSDB_DEFAULT_S3_KEEP_LOCAL; pReq->s3Compact = TSDB_DEFAULT_S3_COMPACT; if (!tDecodeIsEnd(&decoder)) { - if (tDecodeI8(&decoder, &pReq->encryptAlgorithm) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->s3ChunkSize) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->s3KeepLocal) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->s3Compact) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->encryptAlgorithm)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->s3ChunkSize)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->s3KeepLocal)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->s3Compact)); } tEndDecode(&decoder); + +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tFreeSCreateVnodeReq(SCreateVnodeReq *pReq) { @@ -5591,241 +6388,281 @@ int32_t tFreeSCreateVnodeReq(SCreateVnodeReq *pReq) { int32_t tSerializeSQueryCompactProgressReq(void *buf, int32_t bufLen, SQueryCompactProgressReq *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->compactId) < 0) return -1; - if (tEncodeI32(&encoder, pReq->vgId) < 0) return -1; - if (tEncodeI32(&encoder, pReq->dnodeId) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->compactId)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->vgId)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->dnodeId)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSQueryCompactProgressReq(void *buf, int32_t bufLen, SQueryCompactProgressReq *pReq) { - int32_t headLen = sizeof(SMsgHead); - + int32_t headLen = sizeof(SMsgHead); SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, ((uint8_t *)buf) + headLen, bufLen - headLen); - if (tStartDecode(&decoder) < 0) return -1; - - if (tDecodeI32(&decoder, &pReq->compactId) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->vgId) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->dnodeId) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->compactId)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->vgId)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->dnodeId)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSQueryCompactProgressRsp(void *buf, int32_t bufLen, SQueryCompactProgressRsp *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->compactId) < 0) return -1; - if (tEncodeI32(&encoder, pReq->vgId) < 0) return -1; - if (tEncodeI32(&encoder, pReq->dnodeId) < 0) return -1; - if (tEncodeI32(&encoder, pReq->numberFileset) < 0) return -1; - if (tEncodeI32(&encoder, pReq->finished) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->compactId)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->vgId)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->dnodeId)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->numberFileset)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->finished)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSQueryCompactProgressRsp(void *buf, int32_t bufLen, SQueryCompactProgressRsp *pReq) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - - if (tDecodeI32(&decoder, &pReq->compactId) < 0) return -2; - if (tDecodeI32(&decoder, &pReq->vgId) < 0) return -3; - if (tDecodeI32(&decoder, &pReq->dnodeId) < 0) return -4; - if (tDecodeI32(&decoder, &pReq->numberFileset) < 0) return -5; - if (tDecodeI32(&decoder, &pReq->finished) < 0) return -6; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->compactId)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->vgId)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->dnodeId)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->numberFileset)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->finished)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSDropVnodeReq(void *buf, int32_t bufLen, SDropVnodeReq *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->vgId) < 0) return -1; - if (tEncodeI32(&encoder, pReq->dnodeId) < 0) return -1; - if (tEncodeI64(&encoder, pReq->dbUid) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->db) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->vgId)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->dnodeId)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->dbUid)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->db)); for (int32_t i = 0; i < 8; ++i) { - if (tEncodeI64(&encoder, pReq->reserved[i]) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->reserved[i])); } tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSDropVnodeReq(void *buf, int32_t bufLen, SDropVnodeReq *pReq) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->vgId) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->dnodeId) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->dbUid) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->db) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->vgId)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->dnodeId)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->dbUid)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->db)); for (int32_t i = 0; i < 8; ++i) { - if (tDecodeI64(&decoder, &pReq->reserved[i]) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->reserved[i])); } tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSDropIdxReq(void *buf, int32_t bufLen, SDropIndexReq *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->colName) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->stb) < 0) return -1; - if (tEncodeI64(&encoder, pReq->stbUid) < 0) return -1; - if (tEncodeI64(&encoder, pReq->dbUid) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->colName)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->stb)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->stbUid)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->dbUid)); for (int32_t i = 0; i < 8; ++i) { - if (tEncodeI64(&encoder, pReq->reserved[i]) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->reserved[i])); } tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; - // TODO - return 0; } + int32_t tDeserializeSDropIdxReq(void *buf, int32_t bufLen, SDropIndexReq *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->colName) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->stb) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->stbUid) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->dbUid) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->colName)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->stb)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->stbUid)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->dbUid)); for (int32_t i = 0; i < 8; ++i) { - if (tDecodeI64(&decoder, &pReq->reserved[i]) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->reserved[i])); } tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - // TODO - return 0; + return code; } int32_t tSerializeSCompactVnodeReq(void *buf, int32_t bufLen, SCompactVnodeReq *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 (tEncodeI64(&encoder, pReq->dbUid) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->db) < 0) return -1; - if (tEncodeI64(&encoder, pReq->compactStartTime) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->dbUid)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->db)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->compactStartTime)); // 1.1 add tw.skey and tw.ekey - if (tEncodeI64(&encoder, pReq->tw.skey) < 0) return -1; - if (tEncodeI64(&encoder, pReq->tw.ekey) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->tw.skey)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->tw.ekey)); - if (tEncodeI32(&encoder, pReq->compactId) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->compactId)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSCompactVnodeReq(void *buf, int32_t bufLen, SCompactVnodeReq *pReq) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - - if (tDecodeI64(&decoder, &pReq->dbUid) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->db) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->compactStartTime) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->dbUid)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->db)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->compactStartTime)); // 1.1 if (tDecodeIsEnd(&decoder)) { pReq->tw.skey = TSKEY_MIN; pReq->tw.ekey = TSKEY_MAX; } else { - if (tDecodeI64(&decoder, &pReq->tw.skey) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->tw.ekey) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->tw.skey)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->tw.ekey)); } if (!tDecodeIsEnd(&decoder)) { - if (tDecodeI32(&decoder, &pReq->compactId) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->compactId)); } tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSVKillCompactReq(void *buf, int32_t bufLen, SVKillCompactReq *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->compactId) < 0) return -1; - if (tEncodeI32(&encoder, pReq->vgId) < 0) return -1; - if (tEncodeI32(&encoder, pReq->dnodeId) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->compactId)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->vgId)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->dnodeId)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSVKillCompactReq(void *buf, int32_t bufLen, SVKillCompactReq *pReq) { int32_t code = 0; + int32_t lino; SDecoder decoder = {0}; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) { - code = TSDB_CODE_MSG_DECODE_ERROR; - goto _exit; - } - - if (tDecodeI32(&decoder, &pReq->compactId) < 0) { - code = TSDB_CODE_MSG_DECODE_ERROR; - goto _exit; - } - - if (tDecodeI32(&decoder, &pReq->vgId) < 0) { - code = TSDB_CODE_MSG_DECODE_ERROR; - goto _exit; - } - - if (tDecodeI32(&decoder, &pReq->dnodeId) < 0) { - code = TSDB_CODE_MSG_DECODE_ERROR; - goto _exit; - } - + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->compactId)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->vgId)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->dnodeId)); tEndDecode(&decoder); _exit: @@ -5834,46 +6671,47 @@ _exit: } int32_t tSerializeSAlterVnodeConfigReq(void *buf, int32_t bufLen, SAlterVnodeConfigReq *pReq) { + int32_t code = 0; + int32_t lino; int32_t tlen; SEncoder encoder = {0}; tEncoderInit(&encoder, buf, bufLen); - TAOS_CHECK_ERRNO(tStartEncode(&encoder)); - TAOS_CHECK_ERRNO(tEncodeI32(&encoder, pReq->vgVersion)); - TAOS_CHECK_ERRNO(tEncodeI32(&encoder, pReq->buffer)); - TAOS_CHECK_ERRNO(tEncodeI32(&encoder, pReq->pageSize)); - TAOS_CHECK_ERRNO(tEncodeI32(&encoder, pReq->pages)); - TAOS_CHECK_ERRNO(tEncodeI32(&encoder, pReq->cacheLastSize)); - TAOS_CHECK_ERRNO(tEncodeI32(&encoder, pReq->daysPerFile)); - TAOS_CHECK_ERRNO(tEncodeI32(&encoder, pReq->daysToKeep0)); - TAOS_CHECK_ERRNO(tEncodeI32(&encoder, pReq->daysToKeep1)); - TAOS_CHECK_ERRNO(tEncodeI32(&encoder, pReq->daysToKeep2)); - TAOS_CHECK_ERRNO(tEncodeI32(&encoder, pReq->walFsyncPeriod)); - TAOS_CHECK_ERRNO(tEncodeI8(&encoder, pReq->walLevel)); - TAOS_CHECK_ERRNO(tEncodeI8(&encoder, pReq->strict)); - TAOS_CHECK_ERRNO(tEncodeI8(&encoder, pReq->cacheLast)); + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->vgVersion)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->buffer)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->pageSize)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->pages)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->cacheLastSize)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->daysPerFile)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->daysToKeep0)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->daysToKeep1)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->daysToKeep2)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->walFsyncPeriod)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->walLevel)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->strict)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->cacheLast)); for (int32_t i = 0; i < 7; ++i) { - TAOS_CHECK_ERRNO(tEncodeI64(&encoder, pReq->reserved[i])); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->reserved[i])); } // 1st modification - TAOS_CHECK_ERRNO(tEncodeI16(&encoder, pReq->sttTrigger)); - TAOS_CHECK_ERRNO(tEncodeI32(&encoder, pReq->minRows)); + TAOS_CHECK_EXIT(tEncodeI16(&encoder, pReq->sttTrigger)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->minRows)); // 2nd modification - TAOS_CHECK_ERRNO(tEncodeI32(&encoder, pReq->walRetentionPeriod)); - TAOS_CHECK_ERRNO(tEncodeI32(&encoder, pReq->walRetentionSize)); - TAOS_CHECK_ERRNO(tEncodeI32(&encoder, pReq->keepTimeOffset)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->walRetentionPeriod)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->walRetentionSize)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->keepTimeOffset)); - TAOS_CHECK_ERRNO(tEncodeI32(&encoder, pReq->s3KeepLocal)); - TAOS_CHECK_ERRNO(tEncodeI8(&encoder, pReq->s3Compact)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->s3KeepLocal)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->s3Compact)); tEndEncode(&encoder); _exit: - if (terrno) { - uError("%s failed at line %d since %s", __func__, terrln, terrstr()); - tlen = -1; + if (code) { + tlen = code; } else { tlen = encoder.pos; } @@ -5883,25 +6721,26 @@ _exit: int32_t tDeserializeSAlterVnodeConfigReq(void *buf, int32_t bufLen, SAlterVnodeConfigReq *pReq) { SDecoder decoder = {0}; - + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - TAOS_CHECK_ERRNO(tStartDecode(&decoder)); - TAOS_CHECK_ERRNO(tDecodeI32(&decoder, &pReq->vgVersion)); - TAOS_CHECK_ERRNO(tDecodeI32(&decoder, &pReq->buffer)); - TAOS_CHECK_ERRNO(tDecodeI32(&decoder, &pReq->pageSize)); - TAOS_CHECK_ERRNO(tDecodeI32(&decoder, &pReq->pages)); - TAOS_CHECK_ERRNO(tDecodeI32(&decoder, &pReq->cacheLastSize)); - TAOS_CHECK_ERRNO(tDecodeI32(&decoder, &pReq->daysPerFile)); - TAOS_CHECK_ERRNO(tDecodeI32(&decoder, &pReq->daysToKeep0)); - TAOS_CHECK_ERRNO(tDecodeI32(&decoder, &pReq->daysToKeep1)); - TAOS_CHECK_ERRNO(tDecodeI32(&decoder, &pReq->daysToKeep2)); - TAOS_CHECK_ERRNO(tDecodeI32(&decoder, &pReq->walFsyncPeriod)); - TAOS_CHECK_ERRNO(tDecodeI8(&decoder, &pReq->walLevel)); - TAOS_CHECK_ERRNO(tDecodeI8(&decoder, &pReq->strict)); - TAOS_CHECK_ERRNO(tDecodeI8(&decoder, &pReq->cacheLast)); + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->vgVersion)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->buffer)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->pageSize)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->pages)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->cacheLastSize)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->daysPerFile)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->daysToKeep0)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->daysToKeep1)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->daysToKeep2)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->walFsyncPeriod)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->walLevel)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->strict)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->cacheLast)); for (int32_t i = 0; i < 7; ++i) { - TAOS_CHECK_ERRNO(tDecodeI64(&decoder, &pReq->reserved[i])); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->reserved[i])); } // 1st modification @@ -5909,8 +6748,8 @@ int32_t tDeserializeSAlterVnodeConfigReq(void *buf, int32_t bufLen, SAlterVnodeC pReq->sttTrigger = -1; pReq->minRows = -1; } else { - TAOS_CHECK_ERRNO(tDecodeI16(&decoder, &pReq->sttTrigger)); - TAOS_CHECK_ERRNO(tDecodeI32(&decoder, &pReq->minRows)); + TAOS_CHECK_EXIT(tDecodeI16(&decoder, &pReq->sttTrigger)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->minRows)); } // 2n modification @@ -5918,508 +6757,650 @@ int32_t tDeserializeSAlterVnodeConfigReq(void *buf, int32_t bufLen, SAlterVnodeC pReq->walRetentionPeriod = -1; pReq->walRetentionSize = -1; } else { - TAOS_CHECK_ERRNO(tDecodeI32(&decoder, &pReq->walRetentionPeriod)); - TAOS_CHECK_ERRNO(tDecodeI32(&decoder, &pReq->walRetentionSize)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->walRetentionPeriod)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->walRetentionSize)); } pReq->keepTimeOffset = TSDB_DEFAULT_KEEP_TIME_OFFSET; if (!tDecodeIsEnd(&decoder)) { - TAOS_CHECK_ERRNO(tDecodeI32(&decoder, &pReq->keepTimeOffset)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->keepTimeOffset)); } pReq->s3KeepLocal = TSDB_DEFAULT_S3_KEEP_LOCAL; pReq->s3Compact = TSDB_DEFAULT_S3_COMPACT; if (!tDecodeIsEnd(&decoder)) { - TAOS_CHECK_ERRNO(tDecodeI32(&decoder, &pReq->s3KeepLocal) < 0); - TAOS_CHECK_ERRNO(tDecodeI8(&decoder, &pReq->s3Compact) < 0); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->s3KeepLocal) < 0); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->s3Compact) < 0); } tEndDecode(&decoder); _exit: tDecoderClear(&decoder); - if (terrno) { - uError("%s failed at line %d since %s", __func__, terrln, terrstr()); - } - return terrno; + return code; } int32_t tSerializeSAlterVnodeReplicaReq(void *buf, int32_t bufLen, SAlterVnodeReplicaReq *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->vgId) < 0) return -1; - if (tEncodeI8(&encoder, pReq->strict) < 0) return -1; - if (tEncodeI8(&encoder, pReq->selfIndex) < 0) return -1; - if (tEncodeI8(&encoder, pReq->replica) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->vgId)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->strict)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->selfIndex)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->replica)); for (int32_t i = 0; i < TSDB_MAX_REPLICA; ++i) { SReplica *pReplica = &pReq->replicas[i]; - if (tEncodeSReplica(&encoder, pReplica) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeSReplica(&encoder, pReplica)); } for (int32_t i = 0; i < 8; ++i) { - if (tEncodeI64(&encoder, pReq->reserved[i]) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->reserved[i])); } - if (tEncodeI8(&encoder, pReq->learnerSelfIndex) < 0) return -1; - if (tEncodeI8(&encoder, pReq->learnerReplica) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->learnerSelfIndex)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->learnerReplica)); for (int32_t i = 0; i < TSDB_MAX_LEARNER_REPLICA; ++i) { SReplica *pReplica = &pReq->learnerReplicas[i]; - if (tEncodeSReplica(&encoder, pReplica) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeSReplica(&encoder, pReplica)); } - if (tEncodeI32(&encoder, pReq->changeVersion) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->changeVersion)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSAlterVnodeReplicaReq(void *buf, int32_t bufLen, SAlterVnodeReplicaReq *pReq) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->vgId) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->strict) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->selfIndex) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->replica) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->vgId)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->strict)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->selfIndex)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->replica)); for (int32_t i = 0; i < TSDB_MAX_REPLICA; ++i) { SReplica *pReplica = &pReq->replicas[i]; - if (tDecodeSReplica(&decoder, pReplica) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeSReplica(&decoder, pReplica)); } for (int32_t i = 0; i < 8; ++i) { - if (tDecodeI64(&decoder, &pReq->reserved[i]) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->reserved[i])); } if (!tDecodeIsEnd(&decoder)) { - if (tDecodeI8(&decoder, &pReq->learnerSelfIndex) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->learnerReplica) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->learnerSelfIndex)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->learnerReplica)); for (int32_t i = 0; i < TSDB_MAX_LEARNER_REPLICA; ++i) { SReplica *pReplica = &pReq->learnerReplicas[i]; - if (tDecodeSReplica(&decoder, pReplica) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeSReplica(&decoder, pReplica)); } } if (!tDecodeIsEnd(&decoder)) { - if (tDecodeI32(&decoder, &pReq->changeVersion) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->changeVersion)); } tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSDisableVnodeWriteReq(void *buf, int32_t bufLen, SDisableVnodeWriteReq *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->vgId) < 0) return -1; - if (tEncodeI8(&encoder, pReq->disable) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->vgId)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->disable)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSDisableVnodeWriteReq(void *buf, int32_t bufLen, SDisableVnodeWriteReq *pReq) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->vgId) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->disable) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->vgId)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->disable)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSAlterVnodeHashRangeReq(void *buf, int32_t bufLen, SAlterVnodeHashRangeReq *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->srcVgId) < 0) return -1; - if (tEncodeI32(&encoder, pReq->dstVgId) < 0) return -1; - if (tEncodeI32(&encoder, pReq->hashBegin) < 0) return -1; - if (tEncodeI32(&encoder, pReq->hashEnd) < 0) return -1; - if (tEncodeI32(&encoder, pReq->changeVersion) < 0) return -1; - if (tEncodeI32(&encoder, pReq->reserved) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->srcVgId)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->dstVgId)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->hashBegin)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->hashEnd)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->changeVersion)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->reserved)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSAlterVnodeHashRangeReq(void *buf, int32_t bufLen, SAlterVnodeHashRangeReq *pReq) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->srcVgId) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->dstVgId) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->hashBegin) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->hashEnd) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->changeVersion) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->reserved) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->srcVgId)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->dstVgId)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->hashBegin)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->hashEnd)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->changeVersion)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->reserved)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSKillQueryReq(void *buf, int32_t bufLen, SKillQueryReq *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->queryStrId) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->queryStrId)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSKillQueryReq(void *buf, int32_t bufLen, SKillQueryReq *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->queryStrId) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->queryStrId)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSKillConnReq(void *buf, int32_t bufLen, SKillConnReq *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 (tEncodeU32(&encoder, pReq->connId) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeU32(&encoder, pReq->connId)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSKillConnReq(void *buf, int32_t bufLen, SKillConnReq *pReq) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeU32(&decoder, &pReq->connId) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeU32(&decoder, &pReq->connId)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSKillTransReq(void *buf, int32_t bufLen, SKillTransReq *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->transId) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->transId)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSKillTransReq(void *buf, int32_t bufLen, SKillTransReq *pReq) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->transId) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->transId)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSBalanceVgroupReq(void *buf, int32_t bufLen, SBalanceVgroupReq *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->useless) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->useless)); ENCODESQL(); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSBalanceVgroupReq(void *buf, int32_t bufLen, SBalanceVgroupReq *pReq) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->useless) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->useless)); DECODESQL(); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSBalanceVgroupReq(SBalanceVgroupReq *pReq) { FREESQL(); } int32_t tSerializeSBalanceVgroupLeaderReq(void *buf, int32_t bufLen, SBalanceVgroupLeaderReq *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->reserved) < 0) return -1; - if (tEncodeI32(&encoder, pReq->vgId) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->reserved)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->vgId)); ENCODESQL(); - if (tEncodeCStr(&encoder, pReq->db) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->db)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSBalanceVgroupLeaderReq(void *buf, int32_t bufLen, SBalanceVgroupLeaderReq *pReq) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->reserved) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->reserved)); if (!tDecodeIsEnd(&decoder)) { - if (tDecodeI32(&decoder, &pReq->vgId) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->vgId)); } DECODESQL(); if (!tDecodeIsEnd(&decoder)) { - if (tDecodeCStrTo(&decoder, pReq->db) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->db)); } tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSBalanceVgroupLeaderReq(SBalanceVgroupLeaderReq *pReq) { FREESQL(); } int32_t tSerializeSMergeVgroupReq(void *buf, int32_t bufLen, SMergeVgroupReq *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->vgId1) < 0) return -1; - if (tEncodeI32(&encoder, pReq->vgId2) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->vgId1)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->vgId2)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSMergeVgroupReq(void *buf, int32_t bufLen, SMergeVgroupReq *pReq) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->vgId1) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->vgId2) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->vgId1)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->vgId2)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSRedistributeVgroupReq(void *buf, int32_t bufLen, SRedistributeVgroupReq *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->vgId) < 0) return -1; - if (tEncodeI32(&encoder, pReq->dnodeId1) < 0) return -1; - if (tEncodeI32(&encoder, pReq->dnodeId2) < 0) return -1; - if (tEncodeI32(&encoder, pReq->dnodeId3) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->vgId)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->dnodeId1)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->dnodeId2)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->dnodeId3)); ENCODESQL(); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSRedistributeVgroupReq(void *buf, int32_t bufLen, SRedistributeVgroupReq *pReq) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->vgId) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->dnodeId1) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->dnodeId2) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->dnodeId3) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->vgId)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->dnodeId1)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->dnodeId2)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->dnodeId3)); DECODESQL(); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSRedistributeVgroupReq(SRedistributeVgroupReq *pReq) { FREESQL(); } int32_t tSerializeSSplitVgroupReq(void *buf, int32_t bufLen, SSplitVgroupReq *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->vgId) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->vgId)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSSplitVgroupReq(void *buf, int32_t bufLen, SSplitVgroupReq *pReq) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->vgId) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->vgId)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSForceBecomeFollowerReq(void *buf, int32_t bufLen, SForceBecomeFollowerReq *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->vgId) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->vgId)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } -// int32_t tDeserializeSForceBecomeFollowerReq(void *buf, int32_t bufLen, SForceBecomeFollowerReq *pReq) { -// SDecoder decoder = {0}; -// tDecoderInit(&decoder, buf, bufLen); - -// if (tStartDecode(&decoder) < 0) return -1; -// if (tDecodeI32(&decoder, &pReq->vgId) < 0) return -1; -// tEndDecode(&decoder); - -// tDecoderClear(&decoder); -// return 0; -// } - int32_t tSerializeSDCreateMnodeReq(void *buf, int32_t bufLen, SDCreateMnodeReq *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 (tEncodeI8(&encoder, pReq->replica) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->replica)); for (int32_t i = 0; i < TSDB_MAX_REPLICA; ++i) { SReplica *pReplica = &pReq->replicas[i]; - if (tEncodeSReplica(&encoder, pReplica) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeSReplica(&encoder, pReplica)); } - if (tEncodeI8(&encoder, pReq->learnerReplica) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->learnerReplica)); for (int32_t i = 0; i < TSDB_MAX_LEARNER_REPLICA; ++i) { SReplica *pReplica = &pReq->learnerReplicas[i]; - if (tEncodeSReplica(&encoder, pReplica) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeSReplica(&encoder, pReplica)); } - if (tEncodeI64(&encoder, pReq->lastIndex) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->lastIndex)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSDCreateMnodeReq(void *buf, int32_t bufLen, SDCreateMnodeReq *pReq) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->replica) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->replica)); for (int32_t i = 0; i < TSDB_MAX_REPLICA; ++i) { SReplica *pReplica = &pReq->replicas[i]; - if (tDecodeSReplica(&decoder, pReplica) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeSReplica(&decoder, pReplica)); } if (!tDecodeIsEnd(&decoder)) { - if (tDecodeI8(&decoder, &pReq->learnerReplica) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->learnerReplica)); for (int32_t i = 0; i < TSDB_MAX_LEARNER_REPLICA; ++i) { SReplica *pReplica = &pReq->learnerReplicas[i]; - if (tDecodeSReplica(&decoder, pReplica) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeSReplica(&decoder, pReplica)); } - if (tDecodeI64(&decoder, &pReq->lastIndex) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->lastIndex)); } tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSVArbHeartBeatReq(void *buf, int32_t bufLen, SVArbHeartBeatReq *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 (tEncodeCStr(&encoder, pReq->arbToken) < 0) return -1; - if (tEncodeI64(&encoder, pReq->arbTerm) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->dnodeId)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->arbToken)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->arbTerm)); int32_t size = taosArrayGetSize(pReq->hbMembers); - if (tEncodeI32(&encoder, size) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, size)); for (int32_t i = 0; i < size; i++) { SVArbHbReqMember *pMember = taosArrayGet(pReq->hbMembers, i); - if (tEncodeI32(&encoder, pMember->vgId) < 0) return -1; - if (tEncodeI32(&encoder, pMember->hbSeq) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pMember->vgId)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pMember->hbSeq)); } tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSVArbHeartBeatReq(void *buf, int32_t bufLen, SVArbHeartBeatReq *pReq) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->dnodeId) < 0) return -1; - if ((pReq->arbToken = taosMemoryMalloc(TSDB_ARB_TOKEN_SIZE)) == NULL) return -1; - if (tDecodeCStrTo(&decoder, pReq->arbToken) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->arbTerm) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->dnodeId)); + if ((pReq->arbToken = taosMemoryMalloc(TSDB_ARB_TOKEN_SIZE)) == NULL) { + TAOS_CHECK_EXIT(terrno); + } + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->arbToken)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->arbTerm)); - if ((pReq->hbMembers = taosArrayInit(16, sizeof(SVArbHbReqMember))) == NULL) return -1; + if ((pReq->hbMembers = taosArrayInit(16, sizeof(SVArbHbReqMember))) == NULL) { + TAOS_CHECK_EXIT(terrno); + } int32_t size = 0; - if (tDecodeI32(&decoder, &size) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &size)); for (int32_t i = 0; i < size; i++) { SVArbHbReqMember member = {0}; - if (tDecodeI32(&decoder, &member.vgId) < 0) return -1; - if (tDecodeI32(&decoder, &member.hbSeq) < 0) return -1; - if (taosArrayPush(pReq->hbMembers, &member) == NULL) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &member.vgId)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &member.hbSeq)); + if (taosArrayPush(pReq->hbMembers, &member) == NULL) { + TAOS_CHECK_EXIT(terrno); + } } tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSVArbHeartBeatReq(SVArbHeartBeatReq *pReq) { @@ -6430,47 +7411,62 @@ void tFreeSVArbHeartBeatReq(SVArbHeartBeatReq *pReq) { int32_t tSerializeSVArbHeartBeatRsp(void *buf, int32_t bufLen, SVArbHeartBeatRsp *pRsp) { 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, pRsp->arbToken) < 0) return -1; - if (tEncodeI32(&encoder, pRsp->dnodeId) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pRsp->arbToken)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pRsp->dnodeId)); int32_t sz = taosArrayGetSize(pRsp->hbMembers); - if (tEncodeI32(&encoder, sz) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, sz)); for (int32_t i = 0; i < sz; i++) { SVArbHbRspMember *pMember = taosArrayGet(pRsp->hbMembers, i); - if (tEncodeI32(&encoder, pMember->vgId) < 0) return -1; - if (tEncodeI32(&encoder, pMember->hbSeq) < 0) return -1; - if (tEncodeCStr(&encoder, pMember->memberToken) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pMember->vgId)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pMember->hbSeq)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pMember->memberToken)); } tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSVArbHeartBeatRsp(void *buf, int32_t bufLen, SVArbHeartBeatRsp *pRsp) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeCStrTo(&decoder, pRsp->arbToken) < 0) return -1; - if (tDecodeI32(&decoder, &pRsp->dnodeId) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pRsp->arbToken)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pRsp->dnodeId)); int32_t sz = 0; - if (tDecodeI32(&decoder, &sz) < 0) return -1; - if ((pRsp->hbMembers = taosArrayInit(sz, sizeof(SVArbHbRspMember))) == NULL) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &sz)); + if ((pRsp->hbMembers = taosArrayInit(sz, sizeof(SVArbHbRspMember))) == NULL) { + TAOS_CHECK_EXIT(terrno); + } for (int32_t i = 0; i < sz; i++) { SVArbHbRspMember hbMember = {0}; - if (tDecodeI32(&decoder, &hbMember.vgId) < 0) return -1; - if (tDecodeI32(&decoder, &hbMember.hbSeq) < 0) return -1; - if (tDecodeCStrTo(&decoder, hbMember.memberToken) < 0) return -1; - if (taosArrayPush(pRsp->hbMembers, &hbMember) == NULL) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &hbMember.vgId)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &hbMember.hbSeq)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, hbMember.memberToken)); + if (taosArrayPush(pRsp->hbMembers, &hbMember) == NULL) { + TAOS_CHECK_EXIT(terrno); + } } tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSVArbHeartBeatRsp(SVArbHeartBeatRsp *pRsp) { @@ -6482,38 +7478,55 @@ void tFreeSVArbHeartBeatRsp(SVArbHeartBeatRsp *pRsp) { int32_t tSerializeSVArbCheckSyncReq(void *buf, int32_t bufLen, SVArbCheckSyncReq *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->arbToken) < 0) return -1; - if (tEncodeI64(&encoder, pReq->arbTerm) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->member0Token) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->member1Token) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->arbToken)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->arbTerm)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->member0Token)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->member1Token)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSVArbCheckSyncReq(void *buf, int32_t bufLen, SVArbCheckSyncReq *pReq) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if ((pReq->arbToken = taosMemoryMalloc(TSDB_ARB_TOKEN_SIZE)) == NULL) return -1; - if (tDecodeCStrTo(&decoder, pReq->arbToken) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->arbTerm) < 0) return -1; - if ((pReq->member0Token = taosMemoryMalloc(TSDB_ARB_TOKEN_SIZE)) == NULL) return -1; - if (tDecodeCStrTo(&decoder, pReq->member0Token) < 0) return -1; - if ((pReq->member1Token = taosMemoryMalloc(TSDB_ARB_TOKEN_SIZE)) == NULL) return -1; - if (tDecodeCStrTo(&decoder, pReq->member1Token) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + if ((pReq->arbToken = taosMemoryMalloc(TSDB_ARB_TOKEN_SIZE)) == NULL) { + TAOS_CHECK_EXIT(terrno); + } + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->arbToken)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->arbTerm)); + if ((pReq->member0Token = taosMemoryMalloc(TSDB_ARB_TOKEN_SIZE)) == NULL) { + TAOS_CHECK_EXIT(terrno); + } + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->member0Token)); + if ((pReq->member1Token = taosMemoryMalloc(TSDB_ARB_TOKEN_SIZE)) == NULL) { + TAOS_CHECK_EXIT(terrno); + } + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->member1Token)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSVArbCheckSyncReq(SVArbCheckSyncReq *pRsp) { @@ -6527,40 +7540,57 @@ void tFreeSVArbCheckSyncReq(SVArbCheckSyncReq *pRsp) { int32_t tSerializeSVArbCheckSyncRsp(void *buf, int32_t bufLen, SVArbCheckSyncRsp *pRsp) { 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, pRsp->arbToken) < 0) return -1; - if (tEncodeCStr(&encoder, pRsp->member0Token) < 0) return -1; - if (tEncodeCStr(&encoder, pRsp->member1Token) < 0) return -1; - if (tEncodeI32(&encoder, pRsp->vgId) < 0) return -1; - if (tEncodeI32(&encoder, pRsp->errCode) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pRsp->arbToken)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pRsp->member0Token)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pRsp->member1Token)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pRsp->vgId)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pRsp->errCode)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSVArbCheckSyncRsp(void *buf, int32_t bufLen, SVArbCheckSyncRsp *pRsp) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if ((pRsp->arbToken = taosMemoryMalloc(TSDB_ARB_TOKEN_SIZE)) == NULL) return -1; - if (tDecodeCStrTo(&decoder, pRsp->arbToken) < 0) return -1; - if ((pRsp->member0Token = taosMemoryMalloc(TSDB_ARB_TOKEN_SIZE)) == NULL) return -1; - if (tDecodeCStrTo(&decoder, pRsp->member0Token) < 0) return -1; - if ((pRsp->member1Token = taosMemoryMalloc(TSDB_ARB_TOKEN_SIZE)) == NULL) return -1; - if (tDecodeCStrTo(&decoder, pRsp->member1Token) < 0) return -1; - if (tDecodeI32(&decoder, &pRsp->vgId) < 0) return -1; - if (tDecodeI32(&decoder, &pRsp->errCode) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + if ((pRsp->arbToken = taosMemoryMalloc(TSDB_ARB_TOKEN_SIZE)) == NULL) { + TAOS_CHECK_EXIT(terrno); + } + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pRsp->arbToken)); + if ((pRsp->member0Token = taosMemoryMalloc(TSDB_ARB_TOKEN_SIZE)) == NULL) { + TAOS_CHECK_EXIT(terrno); + } + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pRsp->member0Token)); + if ((pRsp->member1Token = taosMemoryMalloc(TSDB_ARB_TOKEN_SIZE)) == NULL) { + TAOS_CHECK_EXIT(terrno); + } + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pRsp->member1Token)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pRsp->vgId)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pRsp->errCode)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSVArbCheckSyncRsp(SVArbCheckSyncRsp *pRsp) { @@ -6574,35 +7604,50 @@ void tFreeSVArbCheckSyncRsp(SVArbCheckSyncRsp *pRsp) { int32_t tSerializeSVArbSetAssignedLeaderReq(void *buf, int32_t bufLen, SVArbSetAssignedLeaderReq *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->arbToken) < 0) return -1; - if (tEncodeI64(&encoder, pReq->arbTerm) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->memberToken) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->arbToken)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->arbTerm)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->memberToken)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSVArbSetAssignedLeaderReq(void *buf, int32_t bufLen, SVArbSetAssignedLeaderReq *pReq) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if ((pReq->arbToken = taosMemoryMalloc(TSDB_ARB_TOKEN_SIZE)) == NULL) return -1; - if (tDecodeCStrTo(&decoder, pReq->arbToken) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->arbTerm) < 0) return -1; - if ((pReq->memberToken = taosMemoryMalloc(TSDB_ARB_TOKEN_SIZE)) == NULL) return -1; - if (tDecodeCStrTo(&decoder, pReq->memberToken) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + if ((pReq->arbToken = taosMemoryMalloc(TSDB_ARB_TOKEN_SIZE)) == NULL) { + TAOS_CHECK_EXIT(terrno); + } + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->arbToken)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->arbTerm)); + if ((pReq->memberToken = taosMemoryMalloc(TSDB_ARB_TOKEN_SIZE)) == NULL) { + TAOS_CHECK_EXIT(terrno); + } + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->memberToken)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSVArbSetAssignedLeaderReq(SVArbSetAssignedLeaderReq *pReq) { @@ -6615,35 +7660,50 @@ void tFreeSVArbSetAssignedLeaderReq(SVArbSetAssignedLeaderReq *pReq) { int32_t tSerializeSVArbSetAssignedLeaderRsp(void *buf, int32_t bufLen, SVArbSetAssignedLeaderRsp *pRsp) { 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, pRsp->arbToken) < 0) return -1; - if (tEncodeCStr(&encoder, pRsp->memberToken) < 0) return -1; - if (tEncodeI32(&encoder, pRsp->vgId) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pRsp->arbToken)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pRsp->memberToken)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pRsp->vgId)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSVArbSetAssignedLeaderRsp(void *buf, int32_t bufLen, SVArbSetAssignedLeaderRsp *pRsp) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if ((pRsp->arbToken = taosMemoryMalloc(TSDB_ARB_TOKEN_SIZE)) == NULL) return -1; - if (tDecodeCStrTo(&decoder, pRsp->arbToken) < 0) return -1; - if ((pRsp->memberToken = taosMemoryMalloc(TSDB_ARB_TOKEN_SIZE)) == NULL) return -1; - if (tDecodeCStrTo(&decoder, pRsp->memberToken) < 0) return -1; - if (tDecodeI32(&decoder, &pRsp->vgId) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + if ((pRsp->arbToken = taosMemoryMalloc(TSDB_ARB_TOKEN_SIZE)) == NULL) { + TAOS_CHECK_EXIT(terrno); + } + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pRsp->arbToken)); + if ((pRsp->memberToken = taosMemoryMalloc(TSDB_ARB_TOKEN_SIZE)) == NULL) { + TAOS_CHECK_EXIT(terrno); + } + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pRsp->memberToken)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pRsp->vgId)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSVArbSetAssignedLeaderRsp(SVArbSetAssignedLeaderRsp *pRsp) { @@ -6656,73 +7716,89 @@ void tFreeSVArbSetAssignedLeaderRsp(SVArbSetAssignedLeaderRsp *pRsp) { int32_t tSerializeSMArbUpdateGroupBatchReq(void *buf, int32_t bufLen, SMArbUpdateGroupBatchReq *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)); int32_t sz = taosArrayGetSize(pReq->updateArray); - if (tEncodeI32(&encoder, sz) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, sz)); for (int32_t i = 0; i < sz; i++) { SMArbUpdateGroup *pGroup = taosArrayGet(pReq->updateArray, i); - if (tEncodeI32(&encoder, pGroup->vgId) < 0) return -1; - if (tEncodeI64(&encoder, pGroup->dbUid) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pGroup->vgId)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pGroup->dbUid)); for (int i = 0; i < TSDB_ARB_GROUP_MEMBER_NUM; i++) { - if (tEncodeI32(&encoder, pGroup->members[i].dnodeId) < 0) return -1; - if (tEncodeCStr(&encoder, pGroup->members[i].token) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pGroup->members[i].dnodeId)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pGroup->members[i].token)); } - if (tEncodeI8(&encoder, pGroup->isSync) < 0) return -1; - if (tEncodeI32(&encoder, pGroup->assignedLeader.dnodeId) < 0) return -1; - if (tEncodeCStr(&encoder, pGroup->assignedLeader.token) < 0) return -1; - if (tEncodeI64(&encoder, pGroup->version) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pGroup->isSync)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pGroup->assignedLeader.dnodeId)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pGroup->assignedLeader.token)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pGroup->version)); } for (int32_t i = 0; i < sz; i++) { SMArbUpdateGroup *pGroup = taosArrayGet(pReq->updateArray, i); - if (tEncodeI8(&encoder, pGroup->assignedLeader.acked) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pGroup->assignedLeader.acked)); } tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSMArbUpdateGroupBatchReq(void *buf, int32_t bufLen, SMArbUpdateGroupBatchReq *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)); int32_t sz = 0; - if (tDecodeI32(&decoder, &sz) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &sz)); SArray *updateArray = taosArrayInit(sz, sizeof(SMArbUpdateGroup)); if (!updateArray) return -1; for (int32_t i = 0; i < sz; i++) { SMArbUpdateGroup group = {0}; - if (tDecodeI32(&decoder, &group.vgId) < 0) return -1; - if (tDecodeI64(&decoder, &group.dbUid) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &group.vgId)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &group.dbUid)); for (int i = 0; i < TSDB_ARB_GROUP_MEMBER_NUM; i++) { - if (tDecodeI32(&decoder, &group.members[i].dnodeId) < 0) return -1; - if ((group.members[i].token = taosMemoryMalloc(TSDB_ARB_TOKEN_SIZE)) == NULL) return -1; - if (tDecodeCStrTo(&decoder, group.members[i].token) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &group.members[i].dnodeId)); + if ((group.members[i].token = taosMemoryMalloc(TSDB_ARB_TOKEN_SIZE)) == NULL) { + TAOS_CHECK_EXIT(terrno); + } + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, group.members[i].token)); } - if (tDecodeI8(&decoder, &group.isSync) < 0) return -1; - if (tDecodeI32(&decoder, &group.assignedLeader.dnodeId) < 0) return -1; - if ((group.assignedLeader.token = taosMemoryMalloc(TSDB_ARB_TOKEN_SIZE)) == NULL) return -1; - if (tDecodeCStrTo(&decoder, group.assignedLeader.token) < 0) return -1; - if (tDecodeI64(&decoder, &group.version) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &group.isSync)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &group.assignedLeader.dnodeId)); + if ((group.assignedLeader.token = taosMemoryMalloc(TSDB_ARB_TOKEN_SIZE)) == NULL) { + TAOS_CHECK_EXIT(terrno); + } + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, group.assignedLeader.token)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &group.version)); group.assignedLeader.acked = false; - if (taosArrayPush(updateArray, &group) == NULL) return -1; + if (taosArrayPush(updateArray, &group) == NULL) { + TAOS_CHECK_EXIT(terrno); + } } if (!tDecodeIsEnd(&decoder)) { for (int32_t i = 0; i < sz; i++) { SMArbUpdateGroup *pGroup = taosArrayGet(updateArray, i); - if (tDecodeI8(&decoder, &pGroup->assignedLeader.acked) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pGroup->assignedLeader.acked)); } } @@ -6730,8 +7806,9 @@ int32_t tDeserializeSMArbUpdateGroupBatchReq(void *buf, int32_t bufLen, SMArbUpd tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSMArbUpdateGroupBatchReq(SMArbUpdateGroupBatchReq *pReq) { @@ -6750,111 +7827,102 @@ void tFreeSMArbUpdateGroupBatchReq(SMArbUpdateGroupBatchReq *pReq) { taosArrayDestroy(pReq->updateArray); } -// int32_t tSerializeSAuthReq(void *buf, int32_t bufLen, SAuthReq *pReq) { -// SEncoder encoder = {0}; -// tEncoderInit(&encoder, buf, bufLen); - -// if (tStartEncode(&encoder) < 0) return -1; -// if (tEncodeCStr(&encoder, pReq->user) < 0) return -1; -// if (tEncodeI8(&encoder, pReq->spi) < 0) return -1; -// if (tEncodeI8(&encoder, pReq->encrypt) < 0) return -1; -// if (tEncodeBinary(&encoder, pReq->secret, TSDB_PASSWORD_LEN) < 0) return -1; -// if (tEncodeBinary(&encoder, pReq->ckey, TSDB_PASSWORD_LEN) < 0) return -1; -// tEndEncode(&encoder); - -// int32_t tlen = encoder.pos; -// tEncoderClear(&encoder); -// return tlen; -// } - -// int32_t tDeserializeSAuthReq(void *buf, int32_t bufLen, SAuthReq *pReq) { -// SDecoder decoder = {0}; -// tDecoderInit(&decoder, buf, bufLen); - -// if (tStartDecode(&decoder) < 0) return -1; -// if (tDecodeCStrTo(&decoder, pReq->user) < 0) return -1; -// if (tDecodeI8(&decoder, &pReq->spi) < 0) return -1; -// if (tDecodeI8(&decoder, &pReq->encrypt) < 0) return -1; -// if (tDecodeCStrTo(&decoder, pReq->secret) < 0) return -1; -// if (tDecodeCStrTo(&decoder, pReq->ckey) < 0) return -1; -// tEndDecode(&decoder); - -// tDecoderClear(&decoder); -// return 0; -// } - int32_t tSerializeSServerStatusRsp(void *buf, int32_t bufLen, SServerStatusRsp *pRsp) { 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, pRsp->statusCode) < 0) return -1; - if (tEncodeCStr(&encoder, pRsp->details) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pRsp->statusCode)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pRsp->details)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSServerStatusRsp(void *buf, int32_t bufLen, SServerStatusRsp *pRsp) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeI32(&decoder, &pRsp->statusCode) < 0) return -1; - if (tDecodeCStrTo(&decoder, pRsp->details) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pRsp->statusCode)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pRsp->details)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSExplainRsp(void *buf, int32_t bufLen, SExplainRsp *pRsp) { 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, pRsp->numOfPlans) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pRsp->numOfPlans)); for (int32_t i = 0; i < pRsp->numOfPlans; ++i) { SExplainExecInfo *info = &pRsp->subplanInfo[i]; - if (tEncodeDouble(&encoder, info->startupCost) < 0) return -1; - if (tEncodeDouble(&encoder, info->totalCost) < 0) return -1; - if (tEncodeU64(&encoder, info->numOfRows) < 0) return -1; - if (tEncodeU32(&encoder, info->verboseLen) < 0) return -1; - if (tEncodeBinary(&encoder, info->verboseInfo, info->verboseLen) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeDouble(&encoder, info->startupCost)); + TAOS_CHECK_EXIT(tEncodeDouble(&encoder, info->totalCost)); + TAOS_CHECK_EXIT(tEncodeU64(&encoder, info->numOfRows)); + TAOS_CHECK_EXIT(tEncodeU32(&encoder, info->verboseLen)); + TAOS_CHECK_EXIT(tEncodeBinary(&encoder, info->verboseInfo, info->verboseLen)); } tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSExplainRsp(void *buf, int32_t bufLen, SExplainRsp *pRsp) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeI32(&decoder, &pRsp->numOfPlans) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pRsp->numOfPlans)); if (pRsp->numOfPlans > 0) { pRsp->subplanInfo = taosMemoryCalloc(pRsp->numOfPlans, sizeof(SExplainExecInfo)); - if (pRsp->subplanInfo == NULL) return -1; + if (pRsp->subplanInfo == NULL) { + TAOS_CHECK_EXIT(terrno); + } } for (int32_t i = 0; i < pRsp->numOfPlans; ++i) { - if (tDecodeDouble(&decoder, &pRsp->subplanInfo[i].startupCost) < 0) return -1; - if (tDecodeDouble(&decoder, &pRsp->subplanInfo[i].totalCost) < 0) return -1; - if (tDecodeU64(&decoder, &pRsp->subplanInfo[i].numOfRows) < 0) return -1; - if (tDecodeU32(&decoder, &pRsp->subplanInfo[i].verboseLen) < 0) return -1; - if (tDecodeBinaryAlloc(&decoder, &pRsp->subplanInfo[i].verboseInfo, NULL) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeDouble(&decoder, &pRsp->subplanInfo[i].startupCost)); + TAOS_CHECK_EXIT(tDecodeDouble(&decoder, &pRsp->subplanInfo[i].totalCost)); + TAOS_CHECK_EXIT(tDecodeU64(&decoder, &pRsp->subplanInfo[i].numOfRows)); + TAOS_CHECK_EXIT(tDecodeU32(&decoder, &pRsp->subplanInfo[i].verboseLen)); + TAOS_CHECK_EXIT(tDecodeBinaryAlloc(&decoder, &pRsp->subplanInfo[i].verboseInfo, NULL)); } tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSExplainRsp(SExplainRsp *pRsp) { @@ -6946,36 +8014,45 @@ int32_t tDeserializeSBatchReq(void *buf, int32_t bufLen, SBatchReq *pReq) { int32_t tSerializeSBatchRsp(void *buf, int32_t bufLen, SBatchRsp *pRsp) { 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)); int32_t num = taosArrayGetSize(pRsp->pRsps); - if (tEncodeI32(&encoder, num) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, num)); for (int32_t i = 0; i < num; ++i) { SBatchRspMsg *pMsg = taosArrayGet(pRsp->pRsps, i); - if (tEncodeI32(&encoder, pMsg->reqType) < 0) return -1; - if (tEncodeI32(&encoder, pMsg->msgIdx) < 0) return -1; - if (tEncodeI32(&encoder, pMsg->msgLen) < 0) return -1; - if (tEncodeI32(&encoder, pMsg->rspCode) < 0) return -1; - if (tEncodeBinary(&encoder, pMsg->msg, pMsg->msgLen) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pMsg->reqType)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pMsg->msgIdx)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pMsg->msgLen)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pMsg->rspCode)); + TAOS_CHECK_EXIT(tEncodeBinary(&encoder, pMsg->msg, pMsg->msgLen)); } tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); - return tlen; } int32_t tDeserializeSBatchRsp(void *buf, int32_t bufLen, SBatchRsp *pRsp) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, (char *)buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); int32_t num = 0; - if (tDecodeI32(&decoder, &num) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &num)); if (num <= 0) { pRsp->pRsps = NULL; tEndDecode(&decoder); @@ -6985,95 +8062,119 @@ int32_t tDeserializeSBatchRsp(void *buf, int32_t bufLen, SBatchRsp *pRsp) { } pRsp->pRsps = taosArrayInit(num, sizeof(SBatchRspMsg)); - if (NULL == pRsp->pRsps) return -1; + if (NULL == pRsp->pRsps) { + TAOS_CHECK_EXIT(terrno); + } for (int32_t i = 0; i < num; ++i) { SBatchRspMsg msg = {0}; - if (tDecodeI32(&decoder, &msg.reqType) < 0) return -1; - if (tDecodeI32(&decoder, &msg.msgIdx) < 0) return -1; - if (tDecodeI32(&decoder, &msg.msgLen) < 0) return -1; - if (tDecodeI32(&decoder, &msg.rspCode) < 0) return -1; - if (tDecodeBinaryAlloc(&decoder, &msg.msg, NULL) < 0) return -1; - if (NULL == taosArrayPush(pRsp->pRsps, &msg)) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &msg.reqType)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &msg.msgIdx)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &msg.msgLen)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &msg.rspCode)); + TAOS_CHECK_EXIT(tDecodeBinaryAlloc(&decoder, &msg.msg, NULL)); + if (NULL == taosArrayPush(pRsp->pRsps, &msg)) { + TAOS_CHECK_EXIT(terrno); + } } tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSMqAskEpReq(void *buf, int32_t bufLen, SMqAskEpReq *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 (tEncodeI64(&encoder, pReq->consumerId) < 0) return -1; - if (tEncodeI32(&encoder, pReq->epoch) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->cgroup) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->consumerId)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->epoch)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->cgroup)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); - return tlen; } int32_t tDeserializeSMqAskEpReq(void *buf, int32_t bufLen, SMqAskEpReq *pReq) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, (char *)buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); - if (tDecodeI64(&decoder, &pReq->consumerId) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->epoch) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->cgroup) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->consumerId)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->epoch)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->cgroup)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tDestroySMqHbRsp(SMqHbRsp *pRsp) { taosArrayDestroy(pRsp->topicPrivileges); } int32_t tSerializeSMqHbRsp(void *buf, int32_t bufLen, SMqHbRsp *pRsp) { 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)); int32_t sz = taosArrayGetSize(pRsp->topicPrivileges); - if (tEncodeI32(&encoder, sz) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, sz)); for (int32_t i = 0; i < sz; ++i) { STopicPrivilege *privilege = (STopicPrivilege *)taosArrayGet(pRsp->topicPrivileges, i); - if (tEncodeCStr(&encoder, privilege->topic) < 0) return -1; - if (tEncodeI8(&encoder, privilege->noPrivilege) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, privilege->topic)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, privilege->noPrivilege)); } if (tEncodeI32(&encoder, pRsp->debugFlag) < 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 tDeserializeSMqHbRsp(void *buf, int32_t bufLen, SMqHbRsp *pRsp) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, (char *)buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); int32_t sz = 0; - if (tDecodeI32(&decoder, &sz) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &sz)); if (sz > 0) { pRsp->topicPrivileges = taosArrayInit(sz, sizeof(STopicPrivilege)); if (NULL == pRsp->topicPrivileges) return -1; for (int32_t i = 0; i < sz; ++i) { STopicPrivilege *data = taosArrayReserve(pRsp->topicPrivileges, 1); - if (tDecodeCStrTo(&decoder, data->topic) < 0) return -1; - if (tDecodeI8(&decoder, &data->noPrivilege) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, data->topic)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &data->noPrivilege)); } } @@ -7082,8 +8183,9 @@ int32_t tDeserializeSMqHbRsp(void *buf, int32_t bufLen, SMqHbRsp *pRsp) { } tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tDestroySMqHbReq(SMqHbReq *pReq) { @@ -7096,78 +8198,94 @@ void tDestroySMqHbReq(SMqHbReq *pReq) { int32_t tSerializeSMqHbReq(void *buf, int32_t bufLen, SMqHbReq *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)); - if (tEncodeI64(&encoder, pReq->consumerId) < 0) return -1; - if (tEncodeI32(&encoder, pReq->epoch) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->consumerId)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->epoch)); int32_t sz = taosArrayGetSize(pReq->topics); - if (tEncodeI32(&encoder, sz) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, sz)); for (int32_t i = 0; i < sz; ++i) { TopicOffsetRows *vgs = (TopicOffsetRows *)taosArrayGet(pReq->topics, i); - if (tEncodeCStr(&encoder, vgs->topicName) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, vgs->topicName)); int32_t szVgs = taosArrayGetSize(vgs->offsetRows); - if (tEncodeI32(&encoder, szVgs) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, szVgs)); for (int32_t j = 0; j < szVgs; ++j) { OffsetRows *offRows = taosArrayGet(vgs->offsetRows, j); - if (tEncodeI32(&encoder, offRows->vgId) < 0) return -1; - if (tEncodeI64(&encoder, offRows->rows) < 0) return -1; - if (tEncodeSTqOffsetVal(&encoder, &offRows->offset) < 0) return -1; - if (tEncodeI64(&encoder, offRows->ever) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, offRows->vgId)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, offRows->rows)); + TAOS_CHECK_EXIT(tEncodeSTqOffsetVal(&encoder, &offRows->offset)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, offRows->ever)); } } - if (tEncodeI8(&encoder, pReq->pollFlag) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->pollFlag)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); - return tlen; } int32_t tDeserializeSMqHbReq(void *buf, int32_t bufLen, SMqHbReq *pReq) { + int32_t code = 0; + int32_t lino; SDecoder decoder = {0}; tDecoderInit(&decoder, (char *)buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); - if (tDecodeI64(&decoder, &pReq->consumerId) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->epoch) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->consumerId)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->epoch)); int32_t sz = 0; - if (tDecodeI32(&decoder, &sz) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &sz)); if (sz > 0) { pReq->topics = taosArrayInit(sz, sizeof(TopicOffsetRows)); - if (NULL == pReq->topics) return -1; + if (NULL == pReq->topics) { + TAOS_CHECK_EXIT(terrno); + } for (int32_t i = 0; i < sz; ++i) { TopicOffsetRows *data = taosArrayReserve(pReq->topics, 1); - if (tDecodeCStrTo(&decoder, data->topicName) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, data->topicName)); int32_t szVgs = 0; - if (tDecodeI32(&decoder, &szVgs) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &szVgs)); if (szVgs > 0) { data->offsetRows = taosArrayInit(szVgs, sizeof(OffsetRows)); - if (NULL == data->offsetRows) return -1; + if (NULL == data->offsetRows) { + TAOS_CHECK_EXIT(terrno); + } for (int32_t j = 0; j < szVgs; ++j) { OffsetRows *offRows = taosArrayReserve(data->offsetRows, 1); - if (tDecodeI32(&decoder, &offRows->vgId) < 0) return -1; - if (tDecodeI64(&decoder, &offRows->rows) < 0) return -1; - if (tDecodeSTqOffsetVal(&decoder, &offRows->offset) < 0) return -1; - if (tDecodeI64(&decoder, &offRows->ever) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &offRows->vgId)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &offRows->rows)); + TAOS_CHECK_EXIT(tDecodeSTqOffsetVal(&decoder, &offRows->offset)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &offRows->ever)); } } } } if (!tDecodeIsEnd(&decoder)) { - if (tDecodeI8(&decoder, &pReq->pollFlag) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->pollFlag)); } tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSMqSeekReq(void *buf, int32_t bufLen, SMqSeekReq *pReq) { + int32_t code = 0; + int32_t lino; int32_t headLen = sizeof(SMsgHead); if (buf != NULL) { buf = (char *)buf + headLen; @@ -7175,40 +8293,50 @@ int32_t tSerializeSMqSeekReq(void *buf, int32_t bufLen, SMqSeekReq *pReq) { } SEncoder encoder = {0}; tEncoderInit(&encoder, buf, bufLen); - if (tStartEncode(&encoder) < 0) return -1; - if (tEncodeI64(&encoder, pReq->consumerId) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->subKey) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->consumerId)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->subKey)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; - tEncoderClear(&encoder); +_exit: + if (code) { + tEncoderClear(&encoder); + return code; + } else { + int32_t tlen = encoder.pos; + tEncoderClear(&encoder); - if (buf != NULL) { - SMsgHead *pHead = (SMsgHead *)((char *)buf - headLen); - pHead->vgId = htonl(pReq->head.vgId); - pHead->contLen = htonl(tlen + headLen); + if (buf != NULL) { + SMsgHead *pHead = (SMsgHead *)((char *)buf - headLen); + pHead->vgId = htonl(pReq->head.vgId); + pHead->contLen = htonl(tlen + headLen); + } + + return tlen + headLen; } - - return tlen + headLen; } int32_t tDeserializeSMqSeekReq(void *buf, int32_t bufLen, SMqSeekReq *pReq) { - int32_t headLen = sizeof(SMsgHead); - + int32_t code = 0; + int32_t lino; + int32_t headLen = sizeof(SMsgHead); SDecoder decoder = {0}; tDecoderInit(&decoder, (char *)buf + headLen, bufLen - headLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->consumerId) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->subKey) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->consumerId)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->subKey)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSSubQueryMsg(void *buf, int32_t bufLen, SSubQueryMsg *pReq) { + int32_t code = 0; + int32_t lino; int32_t headLen = sizeof(SMsgHead); if (buf != NULL) { buf = (char *)buf + headLen; @@ -7217,40 +8345,47 @@ int32_t tSerializeSSubQueryMsg(void *buf, int32_t bufLen, SSubQueryMsg *pReq) { SEncoder encoder = {0}; tEncoderInit(&encoder, buf, bufLen); - if (tStartEncode(&encoder) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); - if (tEncodeU64(&encoder, pReq->sId) < 0) return -1; - if (tEncodeU64(&encoder, pReq->queryId) < 0) return -1; - if (tEncodeU64(&encoder, pReq->taskId) < 0) return -1; - if (tEncodeI64(&encoder, pReq->refId) < 0) return -1; - if (tEncodeI32(&encoder, pReq->execId) < 0) return -1; - if (tEncodeI32(&encoder, pReq->msgMask) < 0) return -1; - if (tEncodeI8(&encoder, pReq->taskType) < 0) return -1; - if (tEncodeI8(&encoder, pReq->explain) < 0) return -1; - if (tEncodeI8(&encoder, pReq->needFetch) < 0) return -1; - if (tEncodeI8(&encoder, pReq->compress) < 0) return -1; - if (tEncodeU32(&encoder, pReq->sqlLen) < 0) return -1; - if (tEncodeCStrWithLen(&encoder, pReq->sql, pReq->sqlLen) < 0) return -1; - if (tEncodeU32(&encoder, pReq->msgLen) < 0) return -1; - if (tEncodeBinary(&encoder, (uint8_t *)pReq->msg, pReq->msgLen) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeU64(&encoder, pReq->sId)); + TAOS_CHECK_EXIT(tEncodeU64(&encoder, pReq->queryId)); + TAOS_CHECK_EXIT(tEncodeU64(&encoder, pReq->taskId)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->refId)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->execId)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->msgMask)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->taskType)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->explain)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->needFetch)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->compress)); + TAOS_CHECK_EXIT(tEncodeU32(&encoder, pReq->sqlLen)); + TAOS_CHECK_EXIT(tEncodeCStrWithLen(&encoder, pReq->sql, pReq->sqlLen)); + TAOS_CHECK_EXIT(tEncodeU32(&encoder, pReq->msgLen)); + TAOS_CHECK_EXIT(tEncodeBinary(&encoder, (uint8_t *)pReq->msg, pReq->msgLen)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; - tEncoderClear(&encoder); +_exit: + if (code) { + tEncoderClear(&encoder); + return code; + } else { + int32_t tlen = encoder.pos; + tEncoderClear(&encoder); - if (buf != NULL) { - SMsgHead *pHead = (SMsgHead *)((char *)buf - headLen); - pHead->vgId = htonl(pReq->header.vgId); - pHead->contLen = htonl(tlen + headLen); + if (buf != NULL) { + SMsgHead *pHead = (SMsgHead *)((char *)buf - headLen); + pHead->vgId = htonl(pReq->header.vgId); + pHead->contLen = htonl(tlen + headLen); + } + + return tlen + headLen; } - - return tlen + headLen; } int32_t tDeserializeSSubQueryMsg(void *buf, int32_t bufLen, SSubQueryMsg *pReq) { - int32_t headLen = sizeof(SMsgHead); - + int32_t code = 0; + int32_t lino; + int32_t headLen = sizeof(SMsgHead); SMsgHead *pHead = buf; pHead->vgId = pReq->header.vgId; pHead->contLen = pReq->header.contLen; @@ -7258,27 +8393,28 @@ int32_t tDeserializeSSubQueryMsg(void *buf, int32_t bufLen, SSubQueryMsg *pReq) SDecoder decoder = {0}; tDecoderInit(&decoder, (char *)buf + headLen, bufLen - headLen); - if (tStartDecode(&decoder) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); - if (tDecodeU64(&decoder, &pReq->sId) < 0) return -1; - if (tDecodeU64(&decoder, &pReq->queryId) < 0) return -1; - if (tDecodeU64(&decoder, &pReq->taskId) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->refId) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->execId) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->msgMask) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->taskType) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->explain) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->needFetch) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->compress) < 0) return -1; - if (tDecodeU32(&decoder, &pReq->sqlLen) < 0) return -1; - if (tDecodeCStrAlloc(&decoder, &pReq->sql) < 0) return -1; - if (tDecodeU32(&decoder, &pReq->msgLen) < 0) return -1; - if (tDecodeBinaryAlloc(&decoder, (void **)&pReq->msg, NULL) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeU64(&decoder, &pReq->sId)); + TAOS_CHECK_EXIT(tDecodeU64(&decoder, &pReq->queryId)); + TAOS_CHECK_EXIT(tDecodeU64(&decoder, &pReq->taskId)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->refId)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->execId)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->msgMask)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->taskType)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->explain)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->needFetch)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->compress)); + TAOS_CHECK_EXIT(tDecodeU32(&decoder, &pReq->sqlLen)); + TAOS_CHECK_EXIT(tDecodeCStrAlloc(&decoder, &pReq->sql)); + TAOS_CHECK_EXIT(tDecodeU32(&decoder, &pReq->msgLen)); + TAOS_CHECK_EXIT(tDecodeBinaryAlloc(&decoder, (void **)&pReq->msg, NULL)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSSubQueryMsg(SSubQueryMsg *pReq) { @@ -7291,17 +8427,17 @@ void tFreeSSubQueryMsg(SSubQueryMsg *pReq) { } int32_t tSerializeSOperatorParam(SEncoder *pEncoder, SOperatorParam *pOpParam) { - if (tEncodeI32(pEncoder, pOpParam->opType) < 0) return -1; - if (tEncodeI32(pEncoder, pOpParam->downstreamIdx) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeI32(pEncoder, pOpParam->opType)); + TAOS_CHECK_RETURN(tEncodeI32(pEncoder, pOpParam->downstreamIdx)); switch (pOpParam->opType) { case QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN: { STableScanOperatorParam *pScan = (STableScanOperatorParam *)pOpParam->value; - if (tEncodeI8(pEncoder, pScan->tableSeq) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeI8(pEncoder, pScan->tableSeq)); int32_t uidNum = taosArrayGetSize(pScan->pUidList); - if (tEncodeI32(pEncoder, uidNum) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeI32(pEncoder, uidNum)); for (int32_t m = 0; m < uidNum; ++m) { int64_t *pUid = taosArrayGet(pScan->pUidList, m); - if (tEncodeI64(pEncoder, *pUid) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeI64(pEncoder, *pUid)); } break; } @@ -7310,33 +8446,39 @@ int32_t tSerializeSOperatorParam(SEncoder *pEncoder, SOperatorParam *pOpParam) { } int32_t n = taosArrayGetSize(pOpParam->pChildren); - if (tEncodeI32(pEncoder, n) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeI32(pEncoder, n)); for (int32_t i = 0; i < n; ++i) { SOperatorParam *pChild = *(SOperatorParam **)taosArrayGet(pOpParam->pChildren, i); - if (tSerializeSOperatorParam(pEncoder, pChild) < 0) return -1; + TAOS_CHECK_RETURN(tSerializeSOperatorParam(pEncoder, pChild)); } return 0; } int32_t tDeserializeSOperatorParam(SDecoder *pDecoder, SOperatorParam *pOpParam) { - if (tDecodeI32(pDecoder, &pOpParam->opType) < 0) return -1; - if (tDecodeI32(pDecoder, &pOpParam->downstreamIdx) < 0) return -1; + TAOS_CHECK_RETURN(tDecodeI32(pDecoder, &pOpParam->opType)); + TAOS_CHECK_RETURN(tDecodeI32(pDecoder, &pOpParam->downstreamIdx)); switch (pOpParam->opType) { case QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN: { STableScanOperatorParam *pScan = taosMemoryMalloc(sizeof(STableScanOperatorParam)); - if (NULL == pScan) return -1; - if (tDecodeI8(pDecoder, (int8_t *)&pScan->tableSeq) < 0) return -1; + if (NULL == pScan) { + TAOS_CHECK_RETURN(terrno); + } + TAOS_CHECK_RETURN(tDecodeI8(pDecoder, (int8_t *)&pScan->tableSeq)); int32_t uidNum = 0; int64_t uid = 0; - if (tDecodeI32(pDecoder, &uidNum) < 0) return -1; + TAOS_CHECK_RETURN(tDecodeI32(pDecoder, &uidNum)); if (uidNum > 0) { pScan->pUidList = taosArrayInit(uidNum, sizeof(int64_t)); - if (NULL == pScan->pUidList) return -1; + if (NULL == pScan->pUidList) { + TAOS_CHECK_RETURN(terrno); + } for (int32_t m = 0; m < uidNum; ++m) { - if (tDecodeI64(pDecoder, &uid) < 0) return -1; - if (taosArrayPush(pScan->pUidList, &uid) == NULL) return -1; + TAOS_CHECK_RETURN(tDecodeI64(pDecoder, &uid)); + if (taosArrayPush(pScan->pUidList, &uid) == NULL) { + TAOS_CHECK_RETURN(terrno); + } } } else { pScan->pUidList = NULL; @@ -7349,16 +8491,22 @@ int32_t tDeserializeSOperatorParam(SDecoder *pDecoder, SOperatorParam *pOpParam) } int32_t childrenNum = 0; - if (tDecodeI32(pDecoder, &childrenNum) < 0) return -1; + TAOS_CHECK_RETURN(tDecodeI32(pDecoder, &childrenNum)); if (childrenNum > 0) { pOpParam->pChildren = taosArrayInit(childrenNum, POINTER_BYTES); - if (NULL == pOpParam->pChildren) return -1; + if (NULL == pOpParam->pChildren) { + TAOS_CHECK_RETURN(terrno); + } for (int32_t i = 0; i < childrenNum; ++i) { SOperatorParam *pChild = taosMemoryCalloc(1, sizeof(SOperatorParam)); - if (NULL == pChild) return -1; - if (tDeserializeSOperatorParam(pDecoder, pChild) < 0) return -1; - if (taosArrayPush(pOpParam->pChildren, &pChild) == NULL) return -1; + if (NULL == pChild) { + TAOS_CHECK_RETURN(terrno); + } + TAOS_CHECK_RETURN(tDeserializeSOperatorParam(pDecoder, pChild)); + if (taosArrayPush(pOpParam->pChildren, &pChild) == NULL) { + TAOS_CHECK_RETURN(terrno); + } } } else { pOpParam->pChildren = NULL; @@ -7368,6 +8516,8 @@ int32_t tDeserializeSOperatorParam(SDecoder *pDecoder, SOperatorParam *pOpParam) } int32_t tSerializeSResFetchReq(void *buf, int32_t bufLen, SResFetchReq *pReq) { + int32_t code = 0; + int32_t lino; int32_t headLen = sizeof(SMsgHead); if (buf != NULL) { buf = (char *)buf + headLen; @@ -7376,34 +8526,42 @@ int32_t tSerializeSResFetchReq(void *buf, int32_t bufLen, SResFetchReq *pReq) { SEncoder encoder = {0}; tEncoderInit(&encoder, buf, bufLen); - if (tStartEncode(&encoder) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); - if (tEncodeU64(&encoder, pReq->sId) < 0) return -1; - if (tEncodeU64(&encoder, pReq->queryId) < 0) return -1; - if (tEncodeU64(&encoder, pReq->taskId) < 0) return -1; - if (tEncodeI32(&encoder, pReq->execId) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeU64(&encoder, pReq->sId)); + TAOS_CHECK_EXIT(tEncodeU64(&encoder, pReq->queryId)); + TAOS_CHECK_EXIT(tEncodeU64(&encoder, pReq->taskId)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->execId)); if (pReq->pOpParam) { - if (tEncodeI32(&encoder, 1) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, 1)); if (tSerializeSOperatorParam(&encoder, pReq->pOpParam) < 0) return -1; } else { - if (tEncodeI32(&encoder, 0) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, 0)); } tEndEncode(&encoder); - int32_t tlen = encoder.pos; - tEncoderClear(&encoder); +_exit: + if (code) { + tEncoderClear(&encoder); + return code; + } else { + int32_t tlen = encoder.pos; + tEncoderClear(&encoder); - if (buf != NULL) { - SMsgHead *pHead = (SMsgHead *)((char *)buf - headLen); - pHead->vgId = htonl(pReq->header.vgId); - pHead->contLen = htonl(tlen + headLen); + if (buf != NULL) { + SMsgHead *pHead = (SMsgHead *)((char *)buf - headLen); + pHead->vgId = htonl(pReq->header.vgId); + pHead->contLen = htonl(tlen + headLen); + } + + return tlen + headLen; } - - return tlen + headLen; } int32_t tDeserializeSResFetchReq(void *buf, int32_t bufLen, SResFetchReq *pReq) { + int32_t code = 0; + int32_t lino; int32_t headLen = sizeof(SMsgHead); SMsgHead *pHead = buf; @@ -7413,29 +8571,34 @@ int32_t tDeserializeSResFetchReq(void *buf, int32_t bufLen, SResFetchReq *pReq) SDecoder decoder = {0}; tDecoderInit(&decoder, (char *)buf + headLen, bufLen - headLen); - if (tStartDecode(&decoder) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); - if (tDecodeU64(&decoder, &pReq->sId) < 0) return -1; - if (tDecodeU64(&decoder, &pReq->queryId) < 0) return -1; - if (tDecodeU64(&decoder, &pReq->taskId) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->execId) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeU64(&decoder, &pReq->sId)); + TAOS_CHECK_EXIT(tDecodeU64(&decoder, &pReq->queryId)); + TAOS_CHECK_EXIT(tDecodeU64(&decoder, &pReq->taskId)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->execId)); int32_t paramNum = 0; - if (tDecodeI32(&decoder, ¶mNum) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, ¶mNum)); if (paramNum > 0) { pReq->pOpParam = taosMemoryMalloc(sizeof(*pReq->pOpParam)); - if (NULL == pReq->pOpParam) return -1; - if (tDeserializeSOperatorParam(&decoder, pReq->pOpParam) < 0) return -1; + if (NULL == pReq->pOpParam) { + TAOS_CHECK_EXIT(terrno); + } + TAOS_CHECK_EXIT(tDeserializeSOperatorParam(&decoder, pReq->pOpParam)); } tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSMqPollReq(void *buf, int32_t bufLen, SMqPollReq *pReq) { int32_t headLen = sizeof(SMsgHead); + int32_t code = 0; + int32_t lino; if (buf != NULL) { buf = (char *)buf + headLen; bufLen -= headLen; @@ -7443,73 +8606,84 @@ int32_t tSerializeSMqPollReq(void *buf, int32_t bufLen, SMqPollReq *pReq) { SEncoder encoder = {0}; tEncoderInit(&encoder, buf, bufLen); - if (tStartEncode(&encoder) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); - if (tEncodeCStr(&encoder, pReq->subKey) < 0) return -1; - if (tEncodeI8(&encoder, pReq->withTbName) < 0) return -1; - if (tEncodeI8(&encoder, pReq->useSnapshot) < 0) return -1; - if (tEncodeI32(&encoder, pReq->epoch) < 0) return -1; - if (tEncodeU64(&encoder, pReq->reqId) < 0) return -1; - if (tEncodeI64(&encoder, pReq->consumerId) < 0) return -1; - if (tEncodeI64(&encoder, pReq->timeout) < 0) return -1; - if (tEncodeSTqOffsetVal(&encoder, &pReq->reqOffset) < 0) return -1; - if (tEncodeI8(&encoder, pReq->enableReplay) < 0) return -1; - if (tEncodeI8(&encoder, pReq->sourceExcluded) < 0) return -1; - if (tEncodeI8(&encoder, pReq->enableBatchMeta) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->subKey)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->withTbName)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->useSnapshot)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->epoch)); + TAOS_CHECK_EXIT(tEncodeU64(&encoder, pReq->reqId)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->consumerId)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->timeout)); + TAOS_CHECK_EXIT(tEncodeSTqOffsetVal(&encoder, &pReq->reqOffset)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->enableReplay)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->sourceExcluded)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->enableBatchMeta)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; - tEncoderClear(&encoder); +_exit: + if (code) { + tEncoderClear(&encoder); + return code; + } else { + int32_t tlen = encoder.pos; + tEncoderClear(&encoder); - if (buf != NULL) { - SMsgHead *pHead = (SMsgHead *)((char *)buf - headLen); - pHead->vgId = htonl(pReq->head.vgId); - pHead->contLen = htonl(tlen + headLen); + if (buf != NULL) { + SMsgHead *pHead = (SMsgHead *)((char *)buf - headLen); + pHead->vgId = htonl(pReq->head.vgId); + pHead->contLen = htonl(tlen + headLen); + } + + return tlen + headLen; } - - return tlen + headLen; } int32_t tDeserializeSMqPollReq(void *buf, int32_t bufLen, SMqPollReq *pReq) { - int32_t headLen = sizeof(SMsgHead); - + int32_t code = 0; + int32_t lino; + int32_t headLen = sizeof(SMsgHead); SDecoder decoder = {0}; tDecoderInit(&decoder, (char *)buf + headLen, bufLen - headLen); - if (tStartDecode(&decoder) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); - if (tDecodeCStrTo(&decoder, pReq->subKey) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->withTbName) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->useSnapshot) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->epoch) < 0) return -1; - if (tDecodeU64(&decoder, &pReq->reqId) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->consumerId) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->timeout) < 0) return -1; - if (tDecodeSTqOffsetVal(&decoder, &pReq->reqOffset) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->subKey)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->withTbName)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->useSnapshot)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->epoch)); + TAOS_CHECK_EXIT(tDecodeU64(&decoder, &pReq->reqId)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->consumerId)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->timeout)); + TAOS_CHECK_EXIT(tDecodeSTqOffsetVal(&decoder, &pReq->reqOffset)); if (!tDecodeIsEnd(&decoder)) { - if (tDecodeI8(&decoder, &pReq->enableReplay) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->enableReplay)); } if (!tDecodeIsEnd(&decoder)) { - if (tDecodeI8(&decoder, &pReq->sourceExcluded) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->sourceExcluded)); } if (!tDecodeIsEnd(&decoder)) { - if (tDecodeI8(&decoder, &pReq->enableBatchMeta) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->enableBatchMeta)); } else { pReq->enableBatchMeta = false; } tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tDestroySMqPollReq(SMqPollReq *pReq) { tOffsetDestroy(&pReq->reqOffset); } int32_t tSerializeSTaskDropReq(void *buf, int32_t bufLen, STaskDropReq *pReq) { + int32_t code = 0; + int32_t lino; + int32_t tlen; int32_t headLen = sizeof(SMsgHead); if (buf != NULL) { buf = (char *)buf + headLen; @@ -7518,30 +8692,38 @@ int32_t tSerializeSTaskDropReq(void *buf, int32_t bufLen, STaskDropReq *pReq) { SEncoder encoder = {0}; tEncoderInit(&encoder, buf, bufLen); - if (tStartEncode(&encoder) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); - if (tEncodeU64(&encoder, pReq->sId) < 0) return -1; - if (tEncodeU64(&encoder, pReq->queryId) < 0) return -1; - if (tEncodeU64(&encoder, pReq->taskId) < 0) return -1; - if (tEncodeI64(&encoder, pReq->refId) < 0) return -1; - if (tEncodeI32(&encoder, pReq->execId) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeU64(&encoder, pReq->sId)); + TAOS_CHECK_EXIT(tEncodeU64(&encoder, pReq->queryId)); + TAOS_CHECK_EXIT(tEncodeU64(&encoder, pReq->taskId)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->refId)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->execId)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; - tEncoderClear(&encoder); +_exit: + if (code) { + tEncoderClear(&encoder); + return code; + } else { + tlen = encoder.pos; + tEncoderClear(&encoder); - if (buf != NULL) { - SMsgHead *pHead = (SMsgHead *)((char *)buf - headLen); - pHead->vgId = htonl(pReq->header.vgId); - pHead->contLen = htonl(tlen + headLen); + if (buf != NULL) { + SMsgHead *pHead = (SMsgHead *)((char *)buf - headLen); + pHead->vgId = htonl(pReq->header.vgId); + pHead->contLen = htonl(tlen + headLen); + } + + return tlen + headLen; } - - return tlen + headLen; } int32_t tDeserializeSTaskDropReq(void *buf, int32_t bufLen, STaskDropReq *pReq) { int32_t headLen = sizeof(SMsgHead); + int32_t code = 0; + int32_t lino; SMsgHead *pHead = buf; pHead->vgId = pReq->header.vgId; @@ -7550,21 +8732,25 @@ int32_t tDeserializeSTaskDropReq(void *buf, int32_t bufLen, STaskDropReq *pReq) SDecoder decoder = {0}; tDecoderInit(&decoder, (char *)buf + headLen, bufLen - headLen); - if (tStartDecode(&decoder) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); - if (tDecodeU64(&decoder, &pReq->sId) < 0) return -1; - if (tDecodeU64(&decoder, &pReq->queryId) < 0) return -1; - if (tDecodeU64(&decoder, &pReq->taskId) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->refId) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->execId) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeU64(&decoder, &pReq->sId)); + TAOS_CHECK_EXIT(tDecodeU64(&decoder, &pReq->queryId)); + TAOS_CHECK_EXIT(tDecodeU64(&decoder, &pReq->taskId)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->refId)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->execId)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSTaskNotifyReq(void *buf, int32_t bufLen, STaskNotifyReq *pReq) { + int32_t code = 0; + int32_t lino; + int32_t tlen; int32_t headLen = sizeof(SMsgHead); if (buf != NULL) { buf = (char *)buf + headLen; @@ -7573,31 +8759,39 @@ int32_t tSerializeSTaskNotifyReq(void *buf, int32_t bufLen, STaskNotifyReq *pReq SEncoder encoder = {0}; tEncoderInit(&encoder, buf, bufLen); - if (tStartEncode(&encoder) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); - if (tEncodeU64(&encoder, pReq->sId) < 0) return -1; - if (tEncodeU64(&encoder, pReq->queryId) < 0) return -1; - if (tEncodeU64(&encoder, pReq->taskId) < 0) return -1; - if (tEncodeI64(&encoder, pReq->refId) < 0) return -1; - if (tEncodeI32(&encoder, pReq->execId) < 0) return -1; - if (tEncodeI32(&encoder, pReq->type) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeU64(&encoder, pReq->sId)); + TAOS_CHECK_EXIT(tEncodeU64(&encoder, pReq->queryId)); + TAOS_CHECK_EXIT(tEncodeU64(&encoder, pReq->taskId)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->refId)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->execId)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->type)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; - tEncoderClear(&encoder); +_exit: + if (code) { + tEncoderClear(&encoder); + return code; + } else { + tlen = encoder.pos; + tEncoderClear(&encoder); - if (buf != NULL) { - SMsgHead *pHead = (SMsgHead *)((char *)buf - headLen); - pHead->vgId = htonl(pReq->header.vgId); - pHead->contLen = htonl(tlen + headLen); + if (buf != NULL) { + SMsgHead *pHead = (SMsgHead *)((char *)buf - headLen); + pHead->vgId = htonl(pReq->header.vgId); + pHead->contLen = htonl(tlen + headLen); + } + + return tlen + headLen; } - - return tlen + headLen; } int32_t tDeserializeSTaskNotifyReq(void *buf, int32_t bufLen, STaskNotifyReq *pReq) { int32_t headLen = sizeof(SMsgHead); + int32_t code = 0; + int32_t lino; SMsgHead *pHead = buf; pHead->vgId = pReq->header.vgId; @@ -7606,74 +8800,92 @@ int32_t tDeserializeSTaskNotifyReq(void *buf, int32_t bufLen, STaskNotifyReq *pR SDecoder decoder = {0}; tDecoderInit(&decoder, (char *)buf + headLen, bufLen - headLen); - if (tStartDecode(&decoder) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); - if (tDecodeU64(&decoder, &pReq->sId) < 0) return -1; - if (tDecodeU64(&decoder, &pReq->queryId) < 0) return -1; - if (tDecodeU64(&decoder, &pReq->taskId) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->refId) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->execId) < 0) return -1; - if (tDecodeI32(&decoder, (int32_t *)&pReq->type) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeU64(&decoder, &pReq->sId)); + TAOS_CHECK_EXIT(tDecodeU64(&decoder, &pReq->queryId)); + TAOS_CHECK_EXIT(tDecodeU64(&decoder, &pReq->taskId)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->refId)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->execId)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, (int32_t *)&pReq->type)); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSQueryTableRsp(void *buf, int32_t bufLen, SQueryTableRsp *pRsp) { 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)); - if (tEncodeI32(&encoder, pRsp->code) < 0) return -1; - if (tEncodeI64(&encoder, pRsp->affectedRows) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pRsp->code)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pRsp->affectedRows)); int32_t tbNum = taosArrayGetSize(pRsp->tbVerInfo); - if (tEncodeI32(&encoder, tbNum) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, tbNum)); if (tbNum > 0) { for (int32_t i = 0; i < tbNum; ++i) { STbVerInfo *pVer = taosArrayGet(pRsp->tbVerInfo, i); - if (tEncodeCStr(&encoder, pVer->tbFName) < 0) return -1; - if (tEncodeI32(&encoder, pVer->sversion) < 0) return -1; - if (tEncodeI32(&encoder, pVer->tversion) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pVer->tbFName)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pVer->sversion)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pVer->tversion)); } } tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); - return tlen; } int32_t tDeserializeSQueryTableRsp(void *buf, int32_t bufLen, SQueryTableRsp *pRsp) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, (char *)buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); - if (tDecodeI32(&decoder, &pRsp->code) < 0) return -1; - if (tDecodeI64(&decoder, &pRsp->affectedRows) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pRsp->code)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pRsp->affectedRows)); int32_t tbNum = 0; - if (tDecodeI32(&decoder, &tbNum) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &tbNum)); if (tbNum > 0) { pRsp->tbVerInfo = taosArrayInit(tbNum, sizeof(STbVerInfo)); - if (NULL == pRsp->tbVerInfo) return -1; + if (NULL == pRsp->tbVerInfo) { + TAOS_CHECK_EXIT(terrno); + } STbVerInfo tbVer; - if (tDecodeCStrTo(&decoder, tbVer.tbFName) < 0) return -1; - if (tDecodeI32(&decoder, &tbVer.sversion) < 0) return -1; - if (tDecodeI32(&decoder, &tbVer.tversion) < 0) return -1; - if (NULL == taosArrayPush(pRsp->tbVerInfo, &tbVer)) return -1; + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, tbVer.tbFName)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &tbVer.sversion)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &tbVer.tversion)); + if (NULL == taosArrayPush(pRsp->tbVerInfo, &tbVer)) { + TAOS_CHECK_EXIT(terrno); + } } tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSSchedulerHbReq(void *buf, int32_t bufLen, SSchedulerHbReq *pReq) { + int32_t code = 0; + int32_t lino; + int32_t tlen; int32_t headLen = sizeof(SMsgHead); if (buf != NULL) { buf = (char *)buf + headLen; @@ -7683,208 +8895,185 @@ int32_t tSerializeSSchedulerHbReq(void *buf, int32_t bufLen, SSchedulerHbReq *pR SEncoder encoder = {0}; tEncoderInit(&encoder, buf, bufLen); - if (tStartEncode(&encoder) < 0) return -1; - if (tEncodeU64(&encoder, pReq->sId) < 0) return -1; - if (tEncodeI32(&encoder, pReq->epId.nodeId) < 0) return -1; - if (tEncodeU16(&encoder, pReq->epId.ep.port) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->epId.ep.fqdn) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeU64(&encoder, pReq->sId)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->epId.nodeId)); + TAOS_CHECK_EXIT(tEncodeU16(&encoder, pReq->epId.ep.port)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->epId.ep.fqdn)); if (pReq->taskAction) { int32_t num = taosArrayGetSize(pReq->taskAction); - if (tEncodeI32(&encoder, num) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, num)); for (int32_t i = 0; i < num; ++i) { STaskAction *action = taosArrayGet(pReq->taskAction, i); - if (tEncodeU64(&encoder, action->queryId) < 0) return -1; - if (tEncodeU64(&encoder, action->taskId) < 0) return -1; - if (tEncodeI8(&encoder, action->action) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeU64(&encoder, action->queryId)); + TAOS_CHECK_EXIT(tEncodeU64(&encoder, action->taskId)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, action->action)); } } else { - if (tEncodeI32(&encoder, 0) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, 0)); } tEndEncode(&encoder); - int32_t tlen = encoder.pos; - tEncoderClear(&encoder); +_exit: + if (code) { + tEncoderClear(&encoder); + return code; + } else { + tlen = encoder.pos; + tEncoderClear(&encoder); - if (buf != NULL) { - SMsgHead *pHead = (SMsgHead *)((char *)buf - headLen); - pHead->vgId = htonl(pReq->header.vgId); - pHead->contLen = htonl(tlen + headLen); + if (buf != NULL) { + SMsgHead *pHead = (SMsgHead *)((char *)buf - headLen); + pHead->vgId = htonl(pReq->header.vgId); + pHead->contLen = htonl(tlen + headLen); + } + return tlen + headLen; } - - return tlen + headLen; } int32_t tDeserializeSSchedulerHbReq(void *buf, int32_t bufLen, SSchedulerHbReq *pReq) { - int32_t headLen = sizeof(SMsgHead); - + int32_t headLen = sizeof(SMsgHead); SMsgHead *pHead = buf; pHead->vgId = pReq->header.vgId; pHead->contLen = pReq->header.contLen; + int32_t code = 0; + int32_t lino; SDecoder decoder = {0}; tDecoderInit(&decoder, (char *)buf + headLen, bufLen - headLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeU64(&decoder, &pReq->sId) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->epId.nodeId) < 0) return -1; - if (tDecodeU16(&decoder, &pReq->epId.ep.port) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->epId.ep.fqdn) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeU64(&decoder, &pReq->sId)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->epId.nodeId)); + TAOS_CHECK_EXIT(tDecodeU16(&decoder, &pReq->epId.ep.port)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->epId.ep.fqdn)); int32_t num = 0; - if (tDecodeI32(&decoder, &num) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &num)); if (num > 0) { pReq->taskAction = taosArrayInit(num, sizeof(STaskStatus)); - if (NULL == pReq->taskAction) return -1; + if (NULL == pReq->taskAction) { + TAOS_CHECK_EXIT(terrno); + } for (int32_t i = 0; i < num; ++i) { STaskAction action = {0}; - if (tDecodeU64(&decoder, &action.queryId) < 0) return -1; - if (tDecodeU64(&decoder, &action.taskId) < 0) return -1; - if (tDecodeI8(&decoder, &action.action) < 0) return -1; - if (taosArrayPush(pReq->taskAction, &action) == NULL) return -1; + TAOS_CHECK_EXIT(tDecodeU64(&decoder, &action.queryId)); + TAOS_CHECK_EXIT(tDecodeU64(&decoder, &action.taskId)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &action.action)); + if (taosArrayPush(pReq->taskAction, &action) == NULL) { + TAOS_CHECK_EXIT(terrno); + } } } else { pReq->taskAction = NULL; } tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSSchedulerHbReq(SSchedulerHbReq *pReq) { taosArrayDestroy(pReq->taskAction); } int32_t tSerializeSSchedulerHbRsp(void *buf, int32_t bufLen, SSchedulerHbRsp *pRsp) { 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, pRsp->epId.nodeId) < 0) return -1; - if (tEncodeU16(&encoder, pRsp->epId.ep.port) < 0) return -1; - if (tEncodeCStr(&encoder, pRsp->epId.ep.fqdn) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pRsp->epId.nodeId)); + TAOS_CHECK_EXIT(tEncodeU16(&encoder, pRsp->epId.ep.port)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pRsp->epId.ep.fqdn)); if (pRsp->taskStatus) { int32_t num = taosArrayGetSize(pRsp->taskStatus); - if (tEncodeI32(&encoder, num) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, num)); for (int32_t i = 0; i < num; ++i) { STaskStatus *status = taosArrayGet(pRsp->taskStatus, i); - if (tEncodeU64(&encoder, status->queryId) < 0) return -1; - if (tEncodeU64(&encoder, status->taskId) < 0) return -1; - if (tEncodeI64(&encoder, status->refId) < 0) return -1; - if (tEncodeI32(&encoder, status->execId) < 0) return -1; - if (tEncodeI8(&encoder, status->status) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeU64(&encoder, status->queryId)); + TAOS_CHECK_EXIT(tEncodeU64(&encoder, status->taskId)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, status->refId)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, status->execId)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, status->status)); } } else { - if (tEncodeI32(&encoder, 0) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, 0)); } tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSSchedulerHbRsp(void *buf, int32_t bufLen, SSchedulerHbRsp *pRsp) { SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeI32(&decoder, &pRsp->epId.nodeId) < 0) return -1; - if (tDecodeU16(&decoder, &pRsp->epId.ep.port) < 0) return -1; - if (tDecodeCStrTo(&decoder, pRsp->epId.ep.fqdn) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pRsp->epId.nodeId)); + TAOS_CHECK_EXIT(tDecodeU16(&decoder, &pRsp->epId.ep.port)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pRsp->epId.ep.fqdn)); int32_t num = 0; - if (tDecodeI32(&decoder, &num) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &num)); if (num > 0) { pRsp->taskStatus = taosArrayInit(num, sizeof(STaskStatus)); if (NULL == pRsp->taskStatus) return -1; for (int32_t i = 0; i < num; ++i) { STaskStatus status = {0}; - if (tDecodeU64(&decoder, &status.queryId) < 0) return -1; - if (tDecodeU64(&decoder, &status.taskId) < 0) return -1; - if (tDecodeI64(&decoder, &status.refId) < 0) return -1; - if (tDecodeI32(&decoder, &status.execId) < 0) return -1; - if (tDecodeI8(&decoder, &status.status) < 0) return -1; - if (taosArrayPush(pRsp->taskStatus, &status) == NULL) return -1; + TAOS_CHECK_EXIT(tDecodeU64(&decoder, &status.queryId)); + TAOS_CHECK_EXIT(tDecodeU64(&decoder, &status.taskId)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &status.refId)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &status.execId)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &status.status)); + if (taosArrayPush(pRsp->taskStatus, &status) == NULL) { + TAOS_CHECK_EXIT(terrno); + } } } else { pRsp->taskStatus = NULL; } tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeSSchedulerHbRsp(SSchedulerHbRsp *pRsp) { taosArrayDestroy(pRsp->taskStatus); } -// int32_t tSerializeSVCreateTbBatchRsp(void *buf, int32_t bufLen, SVCreateTbBatchRsp *pRsp) { -// // SEncoder encoder = {0}; -// // tEncoderInit(&encoder, buf, bufLen); - -// // if (tStartEncode(&encoder) < 0) return -1; -// // if (pRsp->rspList) { -// // int32_t num = taosArrayGetSize(pRsp->rspList); -// // if (tEncodeI32(&encoder, num) < 0) return -1; -// // for (int32_t i = 0; i < num; ++i) { -// // SVCreateTbRsp *rsp = taosArrayGet(pRsp->rspList, i); -// // if (tEncodeI32(&encoder, rsp->code) < 0) return -1; -// // } -// // } else { -// // if (tEncodeI32(&encoder, 0) < 0) return -1; -// // } -// // tEndEncode(&encoder); - -// // int32_t tlen = encoder.pos; -// // tEncoderClear(&encoder); -// // reture tlen; -// return 0; -// } - -// int32_t tDeserializeSVCreateTbBatchRsp(void *buf, int32_t bufLen, SVCreateTbBatchRsp *pRsp) { -// SDecoder decoder = {0}; -// int32_t num = 0; -// tDecoderInit(&decoder, buf, bufLen); - -// if (tStartDecode(&decoder) < 0) return -1; -// if (tDecodeI32(&decoder, &num) < 0) return -1; -// if (num > 0) { -// pRsp->rspList = taosArrayInit(num, sizeof(SVCreateTbRsp)); -// if (NULL == pRsp->rspList) return -1; -// for (int32_t i = 0; i < num; ++i) { -// SVCreateTbRsp rsp = {0}; -// if (tDecodeI32(&decoder, &rsp.code) < 0) return -1; -// if (NULL == taosArrayPush(pRsp->rspList, &rsp)) return -1; -// } -// } else { -// pRsp->rspList = NULL; -// } -// tEndDecode(&decoder); - -// tDecoderClear(&decoder); -// return 0; -//} - int tEncodeSVCreateTbBatchRsp(SEncoder *pCoder, const SVCreateTbBatchRsp *pRsp) { int32_t nRsps = taosArrayGetSize(pRsp->pArray); SVCreateTbRsp *pCreateRsp; - if (tStartEncode(pCoder) < 0) return -1; - - if (tEncodeI32v(pCoder, nRsps) < 0) return -1; + TAOS_CHECK_RETURN(tStartEncode(pCoder)); + TAOS_CHECK_RETURN(tEncodeI32v(pCoder, nRsps)); for (int32_t i = 0; i < nRsps; i++) { pCreateRsp = taosArrayGet(pRsp->pArray, i); - if (tEncodeSVCreateTbRsp(pCoder, pCreateRsp) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeSVCreateTbRsp(pCoder, pCreateRsp)); } tEndEncode(pCoder); - return 0; } int tDecodeSVCreateTbBatchRsp(SDecoder *pCoder, SVCreateTbBatchRsp *pRsp) { - if (tStartDecode(pCoder) < 0) return -1; - - if (tDecodeI32v(pCoder, &pRsp->nRsps) < 0) return -1; + TAOS_CHECK_RETURN(tStartDecode(pCoder)); + TAOS_CHECK_RETURN(tDecodeI32v(pCoder, &pRsp->nRsps)); pRsp->pRsps = (SVCreateTbRsp *)tDecoderMalloc(pCoder, sizeof(*pRsp->pRsps) * pRsp->nRsps); + if (pRsp->pRsps == NULL) { + TAOS_CHECK_RETURN(terrno); + } for (int32_t i = 0; i < pRsp->nRsps; i++) { - if (tDecodeSVCreateTbRsp(pCoder, pRsp->pRsps + i) < 0) return -1; + TAOS_CHECK_RETURN(tDecodeSVCreateTbRsp(pCoder, pRsp->pRsps + i)); } tEndDecode(pCoder); @@ -7892,119 +9081,110 @@ int tDecodeSVCreateTbBatchRsp(SDecoder *pCoder, SVCreateTbBatchRsp *pRsp) { } int32_t tEncodeTSma(SEncoder *pCoder, const STSma *pSma) { - if (tEncodeI8(pCoder, pSma->version) < 0) return -1; - if (tEncodeI8(pCoder, pSma->intervalUnit) < 0) return -1; - if (tEncodeI8(pCoder, pSma->slidingUnit) < 0) return -1; - if (tEncodeI8(pCoder, pSma->timezoneInt) < 0) return -1; - if (tEncodeI32(pCoder, pSma->dstVgId) < 0) return -1; - if (tEncodeCStr(pCoder, pSma->indexName) < 0) return -1; - if (tEncodeI32(pCoder, pSma->exprLen) < 0) return -1; - if (tEncodeI32(pCoder, pSma->tagsFilterLen) < 0) return -1; - if (tEncodeI64(pCoder, pSma->indexUid) < 0) return -1; - if (tEncodeI64(pCoder, pSma->tableUid) < 0) return -1; - if (tEncodeI64(pCoder, pSma->dstTbUid) < 0) return -1; - if (tEncodeCStr(pCoder, pSma->dstTbName) < 0) return -1; - if (tEncodeI64(pCoder, pSma->interval) < 0) return -1; - if (tEncodeI64(pCoder, pSma->offset) < 0) return -1; - if (tEncodeI64(pCoder, pSma->sliding) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeI8(pCoder, pSma->version)); + TAOS_CHECK_RETURN(tEncodeI8(pCoder, pSma->intervalUnit)); + TAOS_CHECK_RETURN(tEncodeI8(pCoder, pSma->slidingUnit)); + TAOS_CHECK_RETURN(tEncodeI8(pCoder, pSma->timezoneInt)); + TAOS_CHECK_RETURN(tEncodeI32(pCoder, pSma->dstVgId)); + TAOS_CHECK_RETURN(tEncodeCStr(pCoder, pSma->indexName)); + TAOS_CHECK_RETURN(tEncodeI32(pCoder, pSma->exprLen)); + TAOS_CHECK_RETURN(tEncodeI32(pCoder, pSma->tagsFilterLen)); + TAOS_CHECK_RETURN(tEncodeI64(pCoder, pSma->indexUid)); + TAOS_CHECK_RETURN(tEncodeI64(pCoder, pSma->tableUid)); + TAOS_CHECK_RETURN(tEncodeI64(pCoder, pSma->dstTbUid)); + TAOS_CHECK_RETURN(tEncodeCStr(pCoder, pSma->dstTbName)); + TAOS_CHECK_RETURN(tEncodeI64(pCoder, pSma->interval)); + TAOS_CHECK_RETURN(tEncodeI64(pCoder, pSma->offset)); + TAOS_CHECK_RETURN(tEncodeI64(pCoder, pSma->sliding)); if (pSma->exprLen > 0) { - if (tEncodeCStr(pCoder, pSma->expr) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeCStr(pCoder, pSma->expr)); } if (pSma->tagsFilterLen > 0) { - if (tEncodeCStr(pCoder, pSma->tagsFilter) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeCStr(pCoder, pSma->tagsFilter)); } - if (tEncodeSSchemaWrapper(pCoder, &pSma->schemaRow) < 0) return -1; - if (tEncodeSSchemaWrapper(pCoder, &pSma->schemaTag) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeSSchemaWrapper(pCoder, &pSma->schemaRow)); + TAOS_CHECK_RETURN(tEncodeSSchemaWrapper(pCoder, &pSma->schemaTag)); return 0; } int32_t tDecodeTSma(SDecoder *pCoder, STSma *pSma, bool deepCopy) { - if (tDecodeI8(pCoder, &pSma->version) < 0) return -1; - if (tDecodeI8(pCoder, &pSma->intervalUnit) < 0) return -1; - if (tDecodeI8(pCoder, &pSma->slidingUnit) < 0) return -1; - if (tDecodeI8(pCoder, &pSma->timezoneInt) < 0) return -1; - if (tDecodeI32(pCoder, &pSma->dstVgId) < 0) return -1; - if (tDecodeCStrTo(pCoder, pSma->indexName) < 0) return -1; - if (tDecodeI32(pCoder, &pSma->exprLen) < 0) return -1; - if (tDecodeI32(pCoder, &pSma->tagsFilterLen) < 0) return -1; - if (tDecodeI64(pCoder, &pSma->indexUid) < 0) return -1; - if (tDecodeI64(pCoder, &pSma->tableUid) < 0) return -1; - if (tDecodeI64(pCoder, &pSma->dstTbUid) < 0) return -1; + int32_t code = 0; + int32_t lino; + + TAOS_CHECK_EXIT(tDecodeI8(pCoder, &pSma->version)); + TAOS_CHECK_EXIT(tDecodeI8(pCoder, &pSma->intervalUnit)); + TAOS_CHECK_EXIT(tDecodeI8(pCoder, &pSma->slidingUnit)); + TAOS_CHECK_EXIT(tDecodeI8(pCoder, &pSma->timezoneInt)); + TAOS_CHECK_EXIT(tDecodeI32(pCoder, &pSma->dstVgId)); + TAOS_CHECK_EXIT(tDecodeCStrTo(pCoder, pSma->indexName)); + TAOS_CHECK_EXIT(tDecodeI32(pCoder, &pSma->exprLen)); + TAOS_CHECK_EXIT(tDecodeI32(pCoder, &pSma->tagsFilterLen)); + TAOS_CHECK_EXIT(tDecodeI64(pCoder, &pSma->indexUid)); + TAOS_CHECK_EXIT(tDecodeI64(pCoder, &pSma->tableUid)); + TAOS_CHECK_EXIT(tDecodeI64(pCoder, &pSma->dstTbUid)); if (deepCopy) { - if (tDecodeCStrAlloc(pCoder, &pSma->dstTbName) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeCStrAlloc(pCoder, &pSma->dstTbName)); } else { - if (tDecodeCStr(pCoder, &pSma->dstTbName) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeCStr(pCoder, &pSma->dstTbName)); } - if (tDecodeI64(pCoder, &pSma->interval) < 0) return -1; - if (tDecodeI64(pCoder, &pSma->offset) < 0) return -1; - if (tDecodeI64(pCoder, &pSma->sliding) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI64(pCoder, &pSma->interval)); + TAOS_CHECK_EXIT(tDecodeI64(pCoder, &pSma->offset)); + TAOS_CHECK_EXIT(tDecodeI64(pCoder, &pSma->sliding)); if (pSma->exprLen > 0) { if (deepCopy) { - if (tDecodeCStrAlloc(pCoder, &pSma->expr) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeCStrAlloc(pCoder, &pSma->expr)); } else { - if (tDecodeCStr(pCoder, &pSma->expr) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeCStr(pCoder, &pSma->expr)); } } else { pSma->expr = NULL; } if (pSma->tagsFilterLen > 0) { if (deepCopy) { - if (tDecodeCStrAlloc(pCoder, &pSma->tagsFilter) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeCStrAlloc(pCoder, &pSma->tagsFilter)); } else { - if (tDecodeCStr(pCoder, &pSma->tagsFilter) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeCStr(pCoder, &pSma->tagsFilter)); } } else { pSma->tagsFilter = NULL; } // only needed in dstVgroup - if (tDecodeSSchemaWrapperEx(pCoder, &pSma->schemaRow) < 0) return -1; - if (tDecodeSSchemaWrapperEx(pCoder, &pSma->schemaTag) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeSSchemaWrapperEx(pCoder, &pSma->schemaRow)); + TAOS_CHECK_EXIT(tDecodeSSchemaWrapperEx(pCoder, &pSma->schemaTag)); - return 0; +_exit: + return code; } int32_t tEncodeSVCreateTSmaReq(SEncoder *pCoder, const SVCreateTSmaReq *pReq) { - if (tStartEncode(pCoder) < 0) return -1; - - if (tEncodeTSma(pCoder, pReq) < 0) return -1; - + TAOS_CHECK_RETURN(tStartEncode(pCoder)); + TAOS_CHECK_RETURN(tEncodeTSma(pCoder, pReq)); tEndEncode(pCoder); return 0; } int32_t tDecodeSVCreateTSmaReq(SDecoder *pCoder, SVCreateTSmaReq *pReq) { - if (tStartDecode(pCoder) < 0) return -1; - - if (tDecodeTSma(pCoder, pReq, false) < 0) return -1; - + TAOS_CHECK_RETURN(tStartDecode(pCoder)); + TAOS_CHECK_RETURN(tDecodeTSma(pCoder, pReq, false)); tEndDecode(pCoder); return 0; } int32_t tEncodeSVDropTSmaReq(SEncoder *pCoder, const SVDropTSmaReq *pReq) { - if (tStartEncode(pCoder) < 0) return -1; - - if (tEncodeI64(pCoder, pReq->indexUid) < 0) return -1; - if (tEncodeCStr(pCoder, pReq->indexName) < 0) return -1; + TAOS_CHECK_RETURN(tStartEncode(pCoder)); + TAOS_CHECK_RETURN(tEncodeI64(pCoder, pReq->indexUid)); + TAOS_CHECK_RETURN(tEncodeCStr(pCoder, pReq->indexName)); tEndEncode(pCoder); return 0; } -// int32_t tDecodeSVDropTSmaReq(SDecoder *pCoder, SVDropTSmaReq *pReq) { -// if (tStartDecode(pCoder) < 0) return -1; - -// if (tDecodeI64(pCoder, &pReq->indexUid) < 0) return -1; -// if (tDecodeCStrTo(pCoder, pReq->indexName) < 0) return -1; - -// tEndDecode(pCoder); -// return 0; -// } - int32_t tSerializeSVDeleteReq(void *buf, int32_t bufLen, SVDeleteReq *pReq) { + int32_t code = 0; + int32_t lino; int32_t headLen = sizeof(SMsgHead); if (buf != NULL) { buf = (char *)buf + headLen; @@ -8014,31 +9194,38 @@ int32_t tSerializeSVDeleteReq(void *buf, int32_t bufLen, SVDeleteReq *pReq) { SEncoder encoder = {0}; tEncoderInit(&encoder, buf, bufLen); - if (tStartEncode(&encoder) < 0) return -1; - if (tEncodeU64(&encoder, pReq->sId) < 0) return -1; - if (tEncodeU64(&encoder, pReq->queryId) < 0) return -1; - if (tEncodeU64(&encoder, pReq->taskId) < 0) return -1; - if (tEncodeU32(&encoder, pReq->sqlLen) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->sql) < 0) return -1; - if (tEncodeBinary(&encoder, pReq->msg, pReq->phyLen) < 0) return -1; - if (tEncodeI8(&encoder, pReq->source) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeU64(&encoder, pReq->sId)); + TAOS_CHECK_EXIT(tEncodeU64(&encoder, pReq->queryId)); + TAOS_CHECK_EXIT(tEncodeU64(&encoder, pReq->taskId)); + TAOS_CHECK_EXIT(tEncodeU32(&encoder, pReq->sqlLen)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->sql)); + TAOS_CHECK_EXIT(tEncodeBinary(&encoder, pReq->msg, pReq->phyLen)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->source)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; - tEncoderClear(&encoder); +_exit: + if (code) { + tEncoderClear(&encoder); + return code; + } else { + int32_t tlen = encoder.pos; + tEncoderClear(&encoder); - if (buf != NULL) { - SMsgHead *pHead = (SMsgHead *)((char *)buf - headLen); - pHead->vgId = htonl(pReq->header.vgId); - pHead->contLen = htonl(tlen + headLen); + if (buf != NULL) { + SMsgHead *pHead = (SMsgHead *)((char *)buf - headLen); + pHead->vgId = htonl(pReq->header.vgId); + pHead->contLen = htonl(tlen + headLen); + } + + return tlen + headLen; } - - return tlen + headLen; } int32_t tDeserializeSVDeleteReq(void *buf, int32_t bufLen, SVDeleteReq *pReq) { - int32_t headLen = sizeof(SMsgHead); - + int32_t code = 0; + int32_t lino; + int32_t headLen = sizeof(SMsgHead); SMsgHead *pHead = buf; pHead->vgId = pReq->header.vgId; pHead->contLen = pReq->header.contLen; @@ -8046,41 +9233,40 @@ int32_t tDeserializeSVDeleteReq(void *buf, int32_t bufLen, SVDeleteReq *pReq) { SDecoder decoder = {0}; tDecoderInit(&decoder, (char *)buf + headLen, bufLen - headLen); - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeU64(&decoder, &pReq->sId) < 0) return -1; - if (tDecodeU64(&decoder, &pReq->queryId) < 0) return -1; - if (tDecodeU64(&decoder, &pReq->taskId) < 0) return -1; - if (tDecodeU32(&decoder, &pReq->sqlLen) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeU64(&decoder, &pReq->sId)); + TAOS_CHECK_EXIT(tDecodeU64(&decoder, &pReq->queryId)); + TAOS_CHECK_EXIT(tDecodeU64(&decoder, &pReq->taskId)); + TAOS_CHECK_EXIT(tDecodeU32(&decoder, &pReq->sqlLen)); pReq->sql = taosMemoryCalloc(1, pReq->sqlLen + 1); - if (NULL == pReq->sql) return -1; - if (tDecodeCStrTo(&decoder, pReq->sql) < 0) return -1; + if (NULL == pReq->sql) { + TAOS_CHECK_EXIT(terrno); + } + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->sql)); uint64_t msgLen = 0; - if (tDecodeBinaryAlloc(&decoder, (void **)&pReq->msg, &msgLen) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeBinaryAlloc(&decoder, (void **)&pReq->msg, &msgLen)); pReq->phyLen = msgLen; if (!tDecodeIsEnd(&decoder)) { - if (tDecodeI8(&decoder, &pReq->source) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->source)); } tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); return 0; } int32_t tEncodeSVDeleteRsp(SEncoder *pCoder, const SVDeleteRsp *pReq) { - if (tStartEncode(pCoder) < 0) return -1; - - if (tEncodeI64(pCoder, pReq->affectedRows) < 0) return -1; - + TAOS_CHECK_RETURN(tStartEncode(pCoder)); + TAOS_CHECK_RETURN(tEncodeI64(pCoder, pReq->affectedRows)); tEndEncode(pCoder); return 0; } int32_t tDecodeSVDeleteRsp(SDecoder *pCoder, SVDeleteRsp *pReq) { - if (tStartDecode(pCoder) < 0) return -1; - - if (tDecodeI64(pCoder, &pReq->affectedRows) < 0) return -1; - + TAOS_CHECK_RETURN(tStartDecode(pCoder)); + TAOS_CHECK_RETURN(tDecodeI64(pCoder, &pReq->affectedRows)); tEndDecode(pCoder); return 0; } @@ -8093,69 +9279,77 @@ int32_t tSerializeSCMCreateStreamReq(void *buf, int32_t bufLen, const SCMCreateS SEncoder encoder = {0}; tEncoderInit(&encoder, buf, bufLen); + int32_t code = 0; + int32_t lino; - if (tStartEncode(&encoder) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->name) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->sourceDB) < 0) return -1; - if (tEncodeCStr(&encoder, pReq->targetStbFullName) < 0) return -1; - if (tEncodeI8(&encoder, pReq->igExists) < 0) return -1; - if (tEncodeI8(&encoder, pReq->fillHistory) < 0) return -1; - if (tEncodeI32(&encoder, sqlLen) < 0) return -1; - if (tEncodeI32(&encoder, astLen) < 0) return -1; - if (tEncodeI8(&encoder, pReq->triggerType) < 0) return -1; - if (tEncodeI64(&encoder, pReq->maxDelay) < 0) return -1; - if (tEncodeI64(&encoder, pReq->watermark) < 0) return -1; - if (tEncodeI8(&encoder, pReq->igExpired) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->name)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->sourceDB)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->targetStbFullName)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->igExists)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->fillHistory)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, sqlLen)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, astLen)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->triggerType)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->maxDelay)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->watermark)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->igExpired)); if (sqlLen > 0 && tEncodeCStr(&encoder, pReq->sql) < 0) return -1; if (astLen > 0 && tEncodeCStr(&encoder, pReq->ast) < 0) return -1; - if (tEncodeI32(&encoder, pReq->numOfTags) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->numOfTags)); 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)); } - if (tEncodeI8(&encoder, pReq->createStb) < 0) return -1; - if (tEncodeU64(&encoder, pReq->targetStbUid) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->createStb)); + TAOS_CHECK_EXIT(tEncodeU64(&encoder, pReq->targetStbUid)); - if (tEncodeI32(&encoder, taosArrayGetSize(pReq->fillNullCols)) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, taosArrayGetSize(pReq->fillNullCols))); for (int32_t i = 0; i < taosArrayGetSize(pReq->fillNullCols); ++i) { SColLocation *pCol = taosArrayGet(pReq->fillNullCols, i); - if (tEncodeI16(&encoder, pCol->slotId) < 0) return -1; - if (tEncodeI16(&encoder, pCol->colId) < 0) return -1; - if (tEncodeI8(&encoder, pCol->type) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI16(&encoder, pCol->slotId)); + TAOS_CHECK_EXIT(tEncodeI16(&encoder, pCol->colId)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pCol->type)); } - if (tEncodeI64(&encoder, pReq->deleteMark) < 0) return -1; - if (tEncodeI8(&encoder, pReq->igUpdate) < 0) return -1; - if (tEncodeI64(&encoder, pReq->lastTs) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->deleteMark)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->igUpdate)); + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->lastTs)); - if (tEncodeI32(&encoder, taosArrayGetSize(pReq->pVgroupVerList)) < 0) return -1; + 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)); } int32_t colSize = taosArrayGetSize(pReq->pCols); - if (tEncodeI32(&encoder, colSize) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(&encoder, colSize)); for (int32_t i = 0; i < colSize; ++i) { SFieldWithOptions *pField = taosArrayGet(pReq->pCols, 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)); } - if (tEncodeI64(&encoder, pReq->smaId) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->smaId)); tEndEncode(&encoder); - int32_t tlen = encoder.pos; - tEncoderClear(&encoder); - return tlen; +_exit: + if (code) { + tEncoderClear(&encoder); + return code; + } else { + int32_t tlen = encoder.pos; + tEncoderClear(&encoder); + return tlen; + } } int32_t tDeserializeSCMCreateStreamReq(void *buf, int32_t bufLen, SCMCreateStreamReq *pReq) { @@ -8166,183 +9360,171 @@ int32_t tDeserializeSCMCreateStreamReq(void *buf, int32_t bufLen, SCMCreateStrea SDecoder decoder = {0}; tDecoderInit(&decoder, buf, bufLen); + int32_t code = 0; + int32_t lino; - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->name) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->sourceDB) < 0) return -1; - if (tDecodeCStrTo(&decoder, pReq->targetStbFullName) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->igExists) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->fillHistory) < 0) return -1; - if (tDecodeI32(&decoder, &sqlLen) < 0) return -1; - if (tDecodeI32(&decoder, &astLen) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->triggerType) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->maxDelay) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->watermark) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->igExpired) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->name)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->sourceDB)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->targetStbFullName)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->igExists)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->fillHistory)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &sqlLen)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &astLen)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->triggerType)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->maxDelay)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->watermark)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->igExpired)); if (sqlLen > 0) { pReq->sql = taosMemoryCalloc(1, sqlLen + 1); - 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 (astLen > 0) { pReq->ast = taosMemoryCalloc(1, astLen + 1); - 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 (tDecodeI32(&decoder, &pReq->numOfTags) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->numOfTags)); if (pReq->numOfTags > 0) { pReq->pTags = taosArrayInit(pReq->numOfTags, sizeof(SField)); if (pReq->pTags == 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); } } } - if (tDecodeI8(&decoder, &pReq->createStb) < 0) return -1; - if (tDecodeU64(&decoder, &pReq->targetStbUid) < 0) return -1; - if (tDecodeI32(&decoder, &numOfFillNullCols) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->createStb)); + TAOS_CHECK_EXIT(tDecodeU64(&decoder, &pReq->targetStbUid)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &numOfFillNullCols)); if (numOfFillNullCols > 0) { pReq->fillNullCols = taosArrayInit(numOfFillNullCols, sizeof(SColLocation)); if (pReq->fillNullCols == NULL) { - return -1; + TAOS_CHECK_EXIT(terrno); } for (int32_t i = 0; i < numOfFillNullCols; ++i) { SColLocation col = {0}; - if (tDecodeI16(&decoder, &col.slotId) < 0) return -1; - if (tDecodeI16(&decoder, &col.colId) < 0) return -1; - if (tDecodeI8(&decoder, &col.type) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI16(&decoder, &col.slotId)); + TAOS_CHECK_EXIT(tDecodeI16(&decoder, &col.colId)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &col.type)); if (taosArrayPush(pReq->fillNullCols, &col) == NULL) { - return -1; + TAOS_CHECK_EXIT(terrno); } } } - if (tDecodeI64(&decoder, &pReq->deleteMark) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->igUpdate) < 0) return -1; - if (tDecodeI64(&decoder, &pReq->lastTs) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->deleteMark)); + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->igUpdate)); + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->lastTs)); - 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); } } } int32_t colSize = 0; - if (tDecodeI32(&decoder, &colSize) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &colSize)); if (colSize > 0) { pReq->pCols = taosArrayInit(colSize, sizeof(SField)); if (pReq->pCols == NULL) { - return -1; + TAOS_CHECK_EXIT(terrno); } for (int32_t i = 0; i < colSize; ++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->pCols, &field) == NULL) { - return -1; + TAOS_CHECK_EXIT(terrno); } } } if (!tDecodeIsEnd(&decoder)) { - if (tDecodeI64(&decoder, &pReq->smaId) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->smaId)); } tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - - return 0; + return code; } int32_t tSerializeSMDropStreamReq(void *buf, int32_t bufLen, const SMDropStreamReq *pReq) { + int32_t code = 0; + int32_t lino; + int32_t tlen; SEncoder encoder = {0}; 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; + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->name)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->igNotExists)); ENCODESQL(); tEndEncode(&encoder); - int32_t tlen = encoder.pos; +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } tEncoderClear(&encoder); return tlen; } int32_t tDeserializeSMDropStreamReq(void *buf, int32_t bufLen, SMDropStreamReq *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)); DECODESQL(); tEndDecode(&decoder); +_exit: tDecoderClear(&decoder); - return 0; + return code; } void tFreeMDropStreamReq(SMDropStreamReq *pReq) { FREESQL(); } -// int32_t tSerializeSMRecoverStreamReq(void *buf, int32_t bufLen, const SMRecoverStreamReq *pReq) { -// SEncoder encoder = {0}; -// 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; - -// tEndEncode(&encoder); - -// int32_t tlen = encoder.pos; -// tEncoderClear(&encoder); -// return tlen; -// } - -// int32_t tDeserializeSMRecoverStreamReq(void *buf, int32_t bufLen, SMRecoverStreamReq *pReq) { -// SDecoder decoder = {0}; -// 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; - -// tEndDecode(&decoder); - -// tDecoderClear(&decoder); -// return 0; -// } - void tFreeSCMCreateStreamReq(SCMCreateStreamReq *pReq) { if (NULL == pReq) { return; @@ -8356,215 +9538,253 @@ void tFreeSCMCreateStreamReq(SCMCreateStreamReq *pReq) { } int32_t tEncodeSRSmaParam(SEncoder *pCoder, const SRSmaParam *pRSmaParam) { + int32_t code = 0; + int32_t lino; for (int32_t i = 0; i < 2; ++i) { - if (tEncodeI64v(pCoder, pRSmaParam->maxdelay[i]) < 0) return -1; - if (tEncodeI64v(pCoder, pRSmaParam->watermark[i]) < 0) return -1; - if (tEncodeI32v(pCoder, pRSmaParam->qmsgLen[i]) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI64v(pCoder, pRSmaParam->maxdelay[i])); + TAOS_CHECK_EXIT(tEncodeI64v(pCoder, pRSmaParam->watermark[i])); + TAOS_CHECK_EXIT(tEncodeI32v(pCoder, pRSmaParam->qmsgLen[i])); if (pRSmaParam->qmsgLen[i] > 0) { - if (tEncodeBinary(pCoder, pRSmaParam->qmsg[i], (uint64_t)pRSmaParam->qmsgLen[i]) < - 0) // qmsgLen contains len of '\0' - return -1; + TAOS_CHECK_EXIT(tEncodeBinary(pCoder, pRSmaParam->qmsg[i], (uint64_t)pRSmaParam->qmsgLen[i])); } } - return 0; +_exit: + return code; } int32_t tDecodeSRSmaParam(SDecoder *pCoder, SRSmaParam *pRSmaParam) { + int32_t code = 0; + int32_t lino; for (int32_t i = 0; i < 2; ++i) { - if (tDecodeI64v(pCoder, &pRSmaParam->maxdelay[i]) < 0) return -1; - if (tDecodeI64v(pCoder, &pRSmaParam->watermark[i]) < 0) return -1; - if (tDecodeI32v(pCoder, &pRSmaParam->qmsgLen[i]) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI64v(pCoder, &pRSmaParam->maxdelay[i])); + TAOS_CHECK_EXIT(tDecodeI64v(pCoder, &pRSmaParam->watermark[i])); + TAOS_CHECK_EXIT(tDecodeI32v(pCoder, &pRSmaParam->qmsgLen[i])); if (pRSmaParam->qmsgLen[i] > 0) { - if (tDecodeBinary(pCoder, (uint8_t **)&pRSmaParam->qmsg[i], NULL) < 0) return -1; // qmsgLen contains len of '\0' + TAOS_CHECK_EXIT(tDecodeBinary(pCoder, (uint8_t **)&pRSmaParam->qmsg[i], NULL)); // qmsgLen contains len of '\0' } else { pRSmaParam->qmsg[i] = NULL; } } - return 0; +_exit: + return code; } int32_t tEncodeSColCmprWrapper(SEncoder *pCoder, const SColCmprWrapper *pWrapper) { - if (tEncodeI32v(pCoder, pWrapper->nCols) < 0) return -1; - if (tEncodeI32v(pCoder, pWrapper->version) < 0) return -1; + int32_t code = 0; + int32_t lino; + + TAOS_CHECK_EXIT(tEncodeI32v(pCoder, pWrapper->nCols)); + TAOS_CHECK_EXIT(tEncodeI32v(pCoder, pWrapper->version)); for (int32_t i = 0; i < pWrapper->nCols; i++) { SColCmpr *p = &pWrapper->pColCmpr[i]; - if (tEncodeI16v(pCoder, p->id) < 0) return -1; - if (tEncodeU32(pCoder, p->alg) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI16v(pCoder, p->id)); + TAOS_CHECK_EXIT(tEncodeU32(pCoder, p->alg)); } - return 0; + +_exit: + return code; } + int32_t tDecodeSColCmprWrapperEx(SDecoder *pDecoder, SColCmprWrapper *pWrapper) { - if (tDecodeI32v(pDecoder, &pWrapper->nCols) < 0) return -1; - if (tDecodeI32v(pDecoder, &pWrapper->version) < 0) return -1; + int32_t code = 0; + int32_t lino; + + TAOS_CHECK_EXIT(tDecodeI32v(pDecoder, &pWrapper->nCols)); + TAOS_CHECK_EXIT(tDecodeI32v(pDecoder, &pWrapper->version)); pWrapper->pColCmpr = (SColCmpr *)tDecoderMalloc(pDecoder, pWrapper->nCols * sizeof(SColCmpr)); - if (pWrapper->pColCmpr == NULL) return -1; + if (pWrapper->pColCmpr == NULL) { + TAOS_CHECK_EXIT(terrno); + } for (int i = 0; i < pWrapper->nCols; i++) { SColCmpr *p = &pWrapper->pColCmpr[i]; - if (tDecodeI16v(pDecoder, &p->id) < 0) goto END; - if (tDecodeU32(pDecoder, &p->alg) < 0) goto END; + TAOS_CHECK_EXIT(tDecodeI16v(pDecoder, &p->id)); + TAOS_CHECK_EXIT(tDecodeU32(pDecoder, &p->alg)); } - return 0; -END: - taosMemoryFree(pWrapper->pColCmpr); - return -1; + +_exit: + if (code) { + taosMemoryFree(pWrapper->pColCmpr); + } + return code; } + int tEncodeSVCreateStbReq(SEncoder *pCoder, const SVCreateStbReq *pReq) { - if (tStartEncode(pCoder) < 0) return -1; + int32_t code = 0; + int32_t lino; - if (tEncodeCStr(pCoder, pReq->name) < 0) return -1; - if (tEncodeI64(pCoder, pReq->suid) < 0) return -1; - if (tEncodeI8(pCoder, pReq->rollup) < 0) return -1; - if (tEncodeSSchemaWrapper(pCoder, &pReq->schemaRow) < 0) return -1; - if (tEncodeSSchemaWrapper(pCoder, &pReq->schemaTag) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(pCoder)); + + TAOS_CHECK_EXIT(tEncodeCStr(pCoder, pReq->name)); + TAOS_CHECK_EXIT(tEncodeI64(pCoder, pReq->suid)); + TAOS_CHECK_EXIT(tEncodeI8(pCoder, pReq->rollup)); + TAOS_CHECK_EXIT(tEncodeSSchemaWrapper(pCoder, &pReq->schemaRow)); + TAOS_CHECK_EXIT(tEncodeSSchemaWrapper(pCoder, &pReq->schemaTag)); if (pReq->rollup) { - if (tEncodeSRSmaParam(pCoder, &pReq->rsmaParam) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeSRSmaParam(pCoder, &pReq->rsmaParam)); } - if (tEncodeI32(pCoder, pReq->alterOriDataLen) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(pCoder, pReq->alterOriDataLen)); if (pReq->alterOriDataLen > 0) { - if (tEncodeBinary(pCoder, pReq->alterOriData, pReq->alterOriDataLen) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeBinary(pCoder, pReq->alterOriData, pReq->alterOriDataLen)); } - if (tEncodeI8(pCoder, pReq->source) < 0) return -1; - - if (tEncodeI8(pCoder, pReq->colCmpred) < 0) return -1; - if (tEncodeSColCmprWrapper(pCoder, &pReq->colCmpr) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI8(pCoder, pReq->source)); + TAOS_CHECK_EXIT(tEncodeI8(pCoder, pReq->colCmpred)); + TAOS_CHECK_EXIT(tEncodeSColCmprWrapper(pCoder, &pReq->colCmpr)); tEndEncode(pCoder); - return 0; + +_exit: + return code; } int tDecodeSVCreateStbReq(SDecoder *pCoder, SVCreateStbReq *pReq) { - if (tStartDecode(pCoder) < 0) return -1; + int32_t code = 0; + int32_t lino; - if (tDecodeCStr(pCoder, &pReq->name) < 0) return -1; - if (tDecodeI64(pCoder, &pReq->suid) < 0) return -1; - if (tDecodeI8(pCoder, &pReq->rollup) < 0) return -1; - if (tDecodeSSchemaWrapperEx(pCoder, &pReq->schemaRow) < 0) return -1; - if (tDecodeSSchemaWrapperEx(pCoder, &pReq->schemaTag) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(pCoder)); + + TAOS_CHECK_EXIT(tDecodeCStr(pCoder, &pReq->name)); + TAOS_CHECK_EXIT(tDecodeI64(pCoder, &pReq->suid)); + TAOS_CHECK_EXIT(tDecodeI8(pCoder, &pReq->rollup)); + TAOS_CHECK_EXIT(tDecodeSSchemaWrapperEx(pCoder, &pReq->schemaRow)); + TAOS_CHECK_EXIT(tDecodeSSchemaWrapperEx(pCoder, &pReq->schemaTag)); if (pReq->rollup) { - if (tDecodeSRSmaParam(pCoder, &pReq->rsmaParam) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeSRSmaParam(pCoder, &pReq->rsmaParam)); } - if (tDecodeI32(pCoder, &pReq->alterOriDataLen) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(pCoder, &pReq->alterOriDataLen)); if (pReq->alterOriDataLen > 0) { - if (tDecodeBinary(pCoder, (uint8_t **)&pReq->alterOriData, NULL) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeBinary(pCoder, (uint8_t **)&pReq->alterOriData, NULL)); } if (!tDecodeIsEnd(pCoder)) { - if (tDecodeI8(pCoder, &pReq->source) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI8(pCoder, &pReq->source)); if (!tDecodeIsEnd(pCoder)) { - if (tDecodeI8(pCoder, &pReq->colCmpred) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI8(pCoder, &pReq->colCmpred)); } if (!tDecodeIsEnd(pCoder)) { - if (tDecodeSColCmprWrapperEx(pCoder, &pReq->colCmpr) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeSColCmprWrapperEx(pCoder, &pReq->colCmpr)); } } - tEndDecode(pCoder); - return 0; + +_exit: + return code; } int tEncodeSVCreateTbReq(SEncoder *pCoder, const SVCreateTbReq *pReq) { - if (tStartEncode(pCoder) < 0) return -1; + int32_t code = 0; + int32_t lino; - if (tEncodeI32v(pCoder, pReq->flags) < 0) return -1; - if (tEncodeCStr(pCoder, pReq->name) < 0) return -1; - if (tEncodeI64(pCoder, pReq->uid) < 0) return -1; - if (tEncodeI64(pCoder, pReq->btime) < 0) return -1; - if (tEncodeI32(pCoder, pReq->ttl) < 0) return -1; - if (tEncodeI8(pCoder, pReq->type) < 0) return -1; - if (tEncodeI32(pCoder, pReq->commentLen) < 0) return -1; + TAOS_CHECK_EXIT(tStartEncode(pCoder)); + + TAOS_CHECK_EXIT(tEncodeI32v(pCoder, pReq->flags)); + TAOS_CHECK_EXIT(tEncodeCStr(pCoder, pReq->name)); + TAOS_CHECK_EXIT(tEncodeI64(pCoder, pReq->uid)); + TAOS_CHECK_EXIT(tEncodeI64(pCoder, pReq->btime)); + TAOS_CHECK_EXIT(tEncodeI32(pCoder, pReq->ttl)); + TAOS_CHECK_EXIT(tEncodeI8(pCoder, pReq->type)); + TAOS_CHECK_EXIT(tEncodeI32(pCoder, pReq->commentLen)); if (pReq->commentLen > 0) { - if (tEncodeCStr(pCoder, pReq->comment) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeCStr(pCoder, pReq->comment)); } if (pReq->type == TSDB_CHILD_TABLE) { - if (tEncodeCStr(pCoder, pReq->ctb.stbName) < 0) return -1; - if (tEncodeU8(pCoder, pReq->ctb.tagNum) < 0) return -1; - if (tEncodeI64(pCoder, pReq->ctb.suid) < 0) return -1; - if (tEncodeTag(pCoder, (const STag *)pReq->ctb.pTag) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeCStr(pCoder, pReq->ctb.stbName)); + TAOS_CHECK_EXIT(tEncodeU8(pCoder, pReq->ctb.tagNum)); + TAOS_CHECK_EXIT(tEncodeI64(pCoder, pReq->ctb.suid)); + TAOS_CHECK_EXIT(tEncodeTag(pCoder, (const STag *)pReq->ctb.pTag)); int32_t len = taosArrayGetSize(pReq->ctb.tagName); - if (tEncodeI32(pCoder, len) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(pCoder, len)); for (int32_t i = 0; i < len; i++) { char *name = taosArrayGet(pReq->ctb.tagName, i); - if (tEncodeCStr(pCoder, name) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeCStr(pCoder, name)); } } else if (pReq->type == TSDB_NORMAL_TABLE) { - if (tEncodeSSchemaWrapper(pCoder, &pReq->ntb.schemaRow) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeSSchemaWrapper(pCoder, &pReq->ntb.schemaRow)); } else { return TSDB_CODE_INVALID_MSG; } // ENCODESQL - if (tEncodeI32(pCoder, pReq->sqlLen) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeI32(pCoder, pReq->sqlLen)); if (pReq->sqlLen > 0) { - if (tEncodeBinary(pCoder, pReq->sql, pReq->sqlLen) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeBinary(pCoder, pReq->sql, pReq->sqlLen)); } // Encode Column Options: encode compress level if (pReq->type == TSDB_SUPER_TABLE || pReq->type == TSDB_NORMAL_TABLE) { - if (tEncodeSColCmprWrapper(pCoder, &pReq->colCmpr) < 0) return -1; + TAOS_CHECK_EXIT(tEncodeSColCmprWrapper(pCoder, &pReq->colCmpr)); } tEndEncode(pCoder); - return 0; +_exit: + return code; } int tDecodeSVCreateTbReq(SDecoder *pCoder, SVCreateTbReq *pReq) { - if (tStartDecode(pCoder) < 0) return -1; + int32_t code = 0; + int32_t lino; - if (tDecodeI32v(pCoder, &pReq->flags) < 0) return -1; - if (tDecodeCStr(pCoder, &pReq->name) < 0) return -1; - if (tDecodeI64(pCoder, &pReq->uid) < 0) return -1; - if (tDecodeI64(pCoder, &pReq->btime) < 0) return -1; - if (tDecodeI32(pCoder, &pReq->ttl) < 0) return -1; - if (tDecodeI8(pCoder, &pReq->type) < 0) return -1; - if (tDecodeI32(pCoder, &pReq->commentLen) < 0) return -1; + TAOS_CHECK_EXIT(tStartDecode(pCoder)); + + TAOS_CHECK_EXIT(tDecodeI32v(pCoder, &pReq->flags)); + TAOS_CHECK_EXIT(tDecodeCStr(pCoder, &pReq->name)); + TAOS_CHECK_EXIT(tDecodeI64(pCoder, &pReq->uid)); + TAOS_CHECK_EXIT(tDecodeI64(pCoder, &pReq->btime)); + TAOS_CHECK_EXIT(tDecodeI32(pCoder, &pReq->ttl)); + TAOS_CHECK_EXIT(tDecodeI8(pCoder, &pReq->type)); + TAOS_CHECK_EXIT(tDecodeI32(pCoder, &pReq->commentLen)); if (pReq->commentLen > 0) { pReq->comment = taosMemoryMalloc(pReq->commentLen + 1); if (pReq->comment == NULL) return -1; - if (tDecodeCStrTo(pCoder, pReq->comment) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeCStrTo(pCoder, pReq->comment)); } if (pReq->type == TSDB_CHILD_TABLE) { - if (tDecodeCStr(pCoder, &pReq->ctb.stbName) < 0) return -1; - if (tDecodeU8(pCoder, &pReq->ctb.tagNum) < 0) return -1; - if (tDecodeI64(pCoder, &pReq->ctb.suid) < 0) return -1; - if (tDecodeTag(pCoder, (STag **)&pReq->ctb.pTag) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeCStr(pCoder, &pReq->ctb.stbName)); + TAOS_CHECK_EXIT(tDecodeU8(pCoder, &pReq->ctb.tagNum)); + TAOS_CHECK_EXIT(tDecodeI64(pCoder, &pReq->ctb.suid)); + TAOS_CHECK_EXIT(tDecodeTag(pCoder, (STag **)&pReq->ctb.pTag)); int32_t len = 0; - if (tDecodeI32(pCoder, &len) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(pCoder, &len)); pReq->ctb.tagName = taosArrayInit(len, TSDB_COL_NAME_LEN); - if (pReq->ctb.tagName == NULL) return -1; + if (pReq->ctb.tagName == NULL) { + TAOS_CHECK_EXIT(terrno); + } for (int32_t i = 0; i < len; i++) { char name[TSDB_COL_NAME_LEN] = {0}; char *tmp = NULL; - if (tDecodeCStr(pCoder, &tmp) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeCStr(pCoder, &tmp)); strncpy(name, tmp, TSDB_COL_NAME_LEN - 1); - if (taosArrayPush(pReq->ctb.tagName, name) == NULL) return -1; + if (taosArrayPush(pReq->ctb.tagName, name) == NULL) { + TAOS_CHECK_EXIT(terrno); + } } } else if (pReq->type == TSDB_NORMAL_TABLE) { - if (tDecodeSSchemaWrapperEx(pCoder, &pReq->ntb.schemaRow) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeSSchemaWrapperEx(pCoder, &pReq->ntb.schemaRow)); } else { return TSDB_CODE_INVALID_MSG; } // DECODESQL if (!tDecodeIsEnd(pCoder)) { - if (tDecodeI32(pCoder, &pReq->sqlLen) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeI32(pCoder, &pReq->sqlLen)); if (pReq->sqlLen > 0) { - if (tDecodeBinaryAlloc(pCoder, (void **)&pReq->sql, NULL) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeBinaryAlloc(pCoder, (void **)&pReq->sql, NULL)); } if (pReq->type == TSDB_NORMAL_TABLE || pReq->type == TSDB_SUPER_TABLE) if (!tDecodeIsEnd(pCoder)) { - if (tDecodeSColCmprWrapperEx(pCoder, &pReq->colCmpr) < 0) return -1; + TAOS_CHECK_EXIT(tDecodeSColCmprWrapperEx(pCoder, &pReq->colCmpr)); } } tEndDecode(pCoder); - return 0; +_exit: + return code; } void tDestroySVCreateTbReq(SVCreateTbReq *pReq, int32_t flags) { @@ -8597,31 +9817,32 @@ void tDestroySVCreateTbReq(SVCreateTbReq *pReq, int32_t flags) { int tEncodeSVCreateTbBatchReq(SEncoder *pCoder, const SVCreateTbBatchReq *pReq) { int32_t nReq = taosArrayGetSize(pReq->pArray); - if (tStartEncode(pCoder) < 0) return -1; - - if (tEncodeI32v(pCoder, nReq) < 0) return -1; + TAOS_CHECK_RETURN(tStartEncode(pCoder)); + TAOS_CHECK_RETURN(tEncodeI32v(pCoder, nReq)); for (int iReq = 0; iReq < nReq; iReq++) { - if (tEncodeSVCreateTbReq(pCoder, (SVCreateTbReq *)taosArrayGet(pReq->pArray, iReq)) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeSVCreateTbReq(pCoder, (SVCreateTbReq *)taosArrayGet(pReq->pArray, iReq))); } - if (tEncodeI8(pCoder, pReq->source) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeI8(pCoder, pReq->source)); tEndEncode(pCoder); return 0; } int tDecodeSVCreateTbBatchReq(SDecoder *pCoder, SVCreateTbBatchReq *pReq) { - if (tStartDecode(pCoder) < 0) return -1; + TAOS_CHECK_RETURN(tStartDecode(pCoder)); - if (tDecodeI32v(pCoder, &pReq->nReqs) < 0) return -1; + TAOS_CHECK_RETURN(tDecodeI32v(pCoder, &pReq->nReqs)); pReq->pReqs = (SVCreateTbReq *)tDecoderMalloc(pCoder, sizeof(SVCreateTbReq) * pReq->nReqs); - if (pReq->pReqs == NULL) return -1; + if (pReq->pReqs == NULL) { + TAOS_CHECK_RETURN(terrno); + } for (int iReq = 0; iReq < pReq->nReqs; iReq++) { - if (tDecodeSVCreateTbReq(pCoder, pReq->pReqs + iReq) < 0) return -1; + TAOS_CHECK_RETURN(tDecodeSVCreateTbReq(pCoder, pReq->pReqs + iReq)); } if (!tDecodeIsEnd(pCoder)) { - if (tDecodeI8(pCoder, &pReq->source) < 0) return -1; + TAOS_CHECK_RETURN(tDecodeI8(pCoder, &pReq->source)); } tEndDecode(pCoder); @@ -8641,12 +9862,12 @@ void tDeleteSVCreateTbBatchReq(SVCreateTbBatchReq *pReq) { } int tEncodeSVCreateTbRsp(SEncoder *pCoder, const SVCreateTbRsp *pRsp) { - if (tStartEncode(pCoder) < 0) return -1; + TAOS_CHECK_RETURN(tStartEncode(pCoder)); - if (tEncodeI32(pCoder, pRsp->code) < 0) return -1; - if (tEncodeI32(pCoder, pRsp->pMeta ? 1 : 0) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeI32(pCoder, pRsp->code)); + TAOS_CHECK_RETURN(tEncodeI32(pCoder, pRsp->pMeta ? 1 : 0)); if (pRsp->pMeta) { - if (tEncodeSTableMetaRsp(pCoder, pRsp->pMeta) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeSTableMetaRsp(pCoder, pRsp->pMeta)); } tEndEncode(pCoder); @@ -8654,16 +9875,18 @@ int tEncodeSVCreateTbRsp(SEncoder *pCoder, const SVCreateTbRsp *pRsp) { } int tDecodeSVCreateTbRsp(SDecoder *pCoder, SVCreateTbRsp *pRsp) { - if (tStartDecode(pCoder) < 0) return -1; + TAOS_CHECK_RETURN(tStartDecode(pCoder)); - if (tDecodeI32(pCoder, &pRsp->code) < 0) return -1; + TAOS_CHECK_RETURN(tDecodeI32(pCoder, &pRsp->code)); int32_t meta = 0; - if (tDecodeI32(pCoder, &meta) < 0) return -1; + TAOS_CHECK_RETURN(tDecodeI32(pCoder, &meta)); if (meta) { pRsp->pMeta = taosMemoryCalloc(1, sizeof(STableMetaRsp)); - if (NULL == pRsp->pMeta) return -1; - if (tDecodeSTableMetaRsp(pCoder, pRsp->pMeta) < 0) return -1; + if (NULL == pRsp->pMeta) { + TAOS_CHECK_RETURN(terrno); + } + TAOS_CHECK_RETURN(tDecodeSTableMetaRsp(pCoder, pRsp->pMeta)); } else { pRsp->pMeta = NULL; } @@ -8687,41 +9910,35 @@ void tFreeSVCreateTbRsp(void *param) { // TDMT_VND_DROP_TABLE ================= static int32_t tEncodeSVDropTbReq(SEncoder *pCoder, const SVDropTbReq *pReq) { - if (tStartEncode(pCoder) < 0) return -1; - - if (tEncodeCStr(pCoder, pReq->name) < 0) return -1; - if (tEncodeU64(pCoder, pReq->suid) < 0) return -1; - if (tEncodeI8(pCoder, pReq->igNotExists) < 0) return -1; + TAOS_CHECK_RETURN(tStartEncode(pCoder)); + TAOS_CHECK_RETURN(tEncodeCStr(pCoder, pReq->name)); + TAOS_CHECK_RETURN(tEncodeU64(pCoder, pReq->suid)); + TAOS_CHECK_RETURN(tEncodeI8(pCoder, pReq->igNotExists)); tEndEncode(pCoder); return 0; } static int32_t tDecodeSVDropTbReq(SDecoder *pCoder, SVDropTbReq *pReq) { - if (tStartDecode(pCoder) < 0) return -1; - - if (tDecodeCStr(pCoder, &pReq->name) < 0) return -1; - if (tDecodeU64(pCoder, &pReq->suid) < 0) return -1; - if (tDecodeI8(pCoder, &pReq->igNotExists) < 0) return -1; + TAOS_CHECK_RETURN(tStartDecode(pCoder)); + TAOS_CHECK_RETURN(tDecodeCStr(pCoder, &pReq->name)); + TAOS_CHECK_RETURN(tDecodeU64(pCoder, &pReq->suid)); + TAOS_CHECK_RETURN(tDecodeI8(pCoder, &pReq->igNotExists)); tEndDecode(pCoder); return 0; } static int32_t tEncodeSVDropTbRsp(SEncoder *pCoder, const SVDropTbRsp *pReq) { - if (tStartEncode(pCoder) < 0) return -1; - - if (tEncodeI32(pCoder, pReq->code) < 0) return -1; - + TAOS_CHECK_RETURN(tStartEncode(pCoder)); + TAOS_CHECK_RETURN(tEncodeI32(pCoder, pReq->code)); tEndEncode(pCoder); return 0; } static int32_t tDecodeSVDropTbRsp(SDecoder *pCoder, SVDropTbRsp *pReq) { - if (tStartDecode(pCoder) < 0) return -1; - - if (tDecodeI32(pCoder, &pReq->code) < 0) return -1; - + TAOS_CHECK_RETURN(tStartDecode(pCoder)); + TAOS_CHECK_RETURN(tDecodeI32(pCoder, &pReq->code)); tEndDecode(pCoder); return 0; } @@ -8730,12 +9947,11 @@ int32_t tEncodeSVDropTbBatchReq(SEncoder *pCoder, const SVDropTbBatchReq *pReq) int32_t nReqs = taosArrayGetSize(pReq->pArray); SVDropTbReq *pDropTbReq; - if (tStartEncode(pCoder) < 0) return -1; - - if (tEncodeI32v(pCoder, nReqs) < 0) return -1; + TAOS_CHECK_RETURN(tStartEncode(pCoder)); + TAOS_CHECK_RETURN(tEncodeI32v(pCoder, nReqs)); for (int iReq = 0; iReq < nReqs; iReq++) { pDropTbReq = (SVDropTbReq *)taosArrayGet(pReq->pArray, iReq); - if (tEncodeSVDropTbReq(pCoder, pDropTbReq) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeSVDropTbReq(pCoder, pDropTbReq)); } tEndEncode(pCoder); @@ -8743,13 +9959,14 @@ int32_t tEncodeSVDropTbBatchReq(SEncoder *pCoder, const SVDropTbBatchReq *pReq) } int32_t tDecodeSVDropTbBatchReq(SDecoder *pCoder, SVDropTbBatchReq *pReq) { - if (tStartDecode(pCoder) < 0) return -1; - - if (tDecodeI32v(pCoder, &pReq->nReqs) < 0) return -1; + TAOS_CHECK_RETURN(tStartDecode(pCoder)); + TAOS_CHECK_RETURN(tDecodeI32v(pCoder, &pReq->nReqs)); pReq->pReqs = (SVDropTbReq *)tDecoderMalloc(pCoder, sizeof(SVDropTbReq) * pReq->nReqs); - if (pReq->pReqs == NULL) return -1; + if (pReq->pReqs == NULL) { + TAOS_CHECK_RETURN(terrno); + } for (int iReq = 0; iReq < pReq->nReqs; iReq++) { - if (tDecodeSVDropTbReq(pCoder, pReq->pReqs + iReq) < 0) return -1; + TAOS_CHECK_RETURN(tDecodeSVDropTbReq(pCoder, pReq->pReqs + iReq)); } tEndDecode(pCoder); @@ -8758,11 +9975,10 @@ int32_t tDecodeSVDropTbBatchReq(SDecoder *pCoder, SVDropTbBatchReq *pReq) { int32_t tEncodeSVDropTbBatchRsp(SEncoder *pCoder, const SVDropTbBatchRsp *pRsp) { int32_t nRsps = taosArrayGetSize(pRsp->pArray); - if (tStartEncode(pCoder) < 0) return -1; - - if (tEncodeI32v(pCoder, nRsps) < 0) return -1; + TAOS_CHECK_RETURN(tStartEncode(pCoder)); + TAOS_CHECK_RETURN(tEncodeI32v(pCoder, nRsps)); for (int iRsp = 0; iRsp < nRsps; iRsp++) { - if (tEncodeSVDropTbRsp(pCoder, (SVDropTbRsp *)taosArrayGet(pRsp->pArray, iRsp)) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeSVDropTbRsp(pCoder, (SVDropTbRsp *)taosArrayGet(pRsp->pArray, iRsp))); } tEndEncode(pCoder); @@ -8770,13 +9986,14 @@ int32_t tEncodeSVDropTbBatchRsp(SEncoder *pCoder, const SVDropTbBatchRsp *pRsp) } int32_t tDecodeSVDropTbBatchRsp(SDecoder *pCoder, SVDropTbBatchRsp *pRsp) { - if (tStartDecode(pCoder) < 0) return -1; - - if (tDecodeI32v(pCoder, &pRsp->nRsps) < 0) return -1; + TAOS_CHECK_RETURN(tStartDecode(pCoder)); + TAOS_CHECK_RETURN(tDecodeI32v(pCoder, &pRsp->nRsps)); pRsp->pRsps = (SVDropTbRsp *)tDecoderMalloc(pCoder, sizeof(SVDropTbRsp) * pRsp->nRsps); - if (pRsp->pRsps == NULL) return -1; + if (pRsp->pRsps == NULL) { + TAOS_CHECK_RETURN(terrno); + } for (int iRsp = 0; iRsp < pRsp->nRsps; iRsp++) { - if (tDecodeSVDropTbRsp(pCoder, pRsp->pRsps + iRsp) < 0) return -1; + TAOS_CHECK_RETURN(tDecodeSVDropTbRsp(pCoder, pRsp->pRsps + iRsp)); } tEndDecode(pCoder); @@ -8784,57 +10001,21 @@ int32_t tDecodeSVDropTbBatchRsp(SDecoder *pCoder, SVDropTbBatchRsp *pRsp) { } int32_t tEncodeSVDropStbReq(SEncoder *pCoder, const SVDropStbReq *pReq) { - if (tStartEncode(pCoder) < 0) return -1; - - if (tEncodeCStr(pCoder, pReq->name) < 0) return -1; - if (tEncodeI64(pCoder, pReq->suid) < 0) return -1; - + TAOS_CHECK_RETURN(tStartEncode(pCoder)); + TAOS_CHECK_RETURN(tEncodeCStr(pCoder, pReq->name)); + TAOS_CHECK_RETURN(tEncodeI64(pCoder, pReq->suid)); tEndEncode(pCoder); return 0; } int32_t tDecodeSVDropStbReq(SDecoder *pCoder, SVDropStbReq *pReq) { - if (tStartDecode(pCoder) < 0) return -1; - - if (tDecodeCStr(pCoder, &pReq->name) < 0) return -1; - if (tDecodeI64(pCoder, &pReq->suid) < 0) return -1; - + TAOS_CHECK_RETURN(tStartDecode(pCoder)); + TAOS_CHECK_RETURN(tDecodeCStr(pCoder, &pReq->name)); + TAOS_CHECK_RETURN(tDecodeI64(pCoder, &pReq->suid)); tEndDecode(pCoder); return 0; } -// static int32_t tEncodeSVSubmitBlk(SEncoder *pCoder, const SVSubmitBlk *pBlock, int32_t flags) { -// if (tStartEncode(pCoder) < 0) return -1; - -// if (tEncodeI64(pCoder, pBlock->suid) < 0) return -1; -// if (tEncodeI64(pCoder, pBlock->uid) < 0) return -1; -// if (tEncodeI32v(pCoder, pBlock->sver) < 0) return -1; -// if (tEncodeBinary(pCoder, pBlock->pData, pBlock->nData) < 0) return -1; - -// if (flags & TD_AUTO_CREATE_TABLE) { -// if (tEncodeSVCreateTbReq(pCoder, &pBlock->cTbReq) < 0) return -1; -// } - -// tEndEncode(pCoder); -// return 0; -// } - -// static int32_t tDecodeSVSubmitBlk(SDecoder *pCoder, SVSubmitBlk *pBlock, int32_t flags) { -// if (tStartDecode(pCoder) < 0) return -1; - -// if (tDecodeI64(pCoder, &pBlock->suid) < 0) return -1; -// if (tDecodeI64(pCoder, &pBlock->uid) < 0) return -1; -// if (tDecodeI32v(pCoder, &pBlock->sver) < 0) return -1; -// if (tDecodeBinary(pCoder, &pBlock->pData, &pBlock->nData) < 0) return -1; - -// if (flags & TD_AUTO_CREATE_TABLE) { -// if (tDecodeSVCreateTbReq(pCoder, &pBlock->cTbReq) < 0) return -1; -// } - -// tEndDecode(pCoder); -// return 0; -// } - static int32_t tEncodeSSubmitBlkRsp(SEncoder *pEncoder, const SSubmitBlkRsp *pBlock) { if (tStartEncode(pEncoder) < 0) return -1; @@ -10674,7 +11855,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/exe/dmMain.c b/source/dnode/mgmt/exe/dmMain.c index e5c37e3d55..9b0cd7d5a5 100644 --- a/source/dnode/mgmt/exe/dmMain.c +++ b/source/dnode/mgmt/exe/dmMain.c @@ -59,6 +59,7 @@ static struct { #endif bool dumpConfig; bool dumpSdb; + bool deleteTrans; bool generateGrant; bool memDbg; bool checkS3; @@ -187,6 +188,8 @@ static int32_t dmParseArgs(int32_t argc, char const *argv[]) { } } else if (strcmp(argv[i], "-s") == 0) { global.dumpSdb = true; + } else if (strcmp(argv[i], "-dTxn") == 0) { + global.deleteTrans = true; } else if (strcmp(argv[i], "-E") == 0) { if (i < argc - 1) { if (strlen(argv[++i]) >= PATH_MAX) { @@ -436,6 +439,22 @@ int mainWindows(int argc, char **argv) { return 0; } + if (global.deleteTrans) { + TdFilePtr pFile; + if ((code = dmCheckRunning(tsDataDir, &pFile)) != 0) { + printf("failed to generate encrypt code since taosd is running, please stop it first, reason:%s", + tstrerror(code)); + return code; + } + + mndDeleteTrans(); + taosCleanupCfg(); + taosCloseLog(); + taosCleanupArgs(); + taosConvDestroy(); + return 0; + } + osSetProcPath(argc, (char **)argv); taosCleanupArgs(); diff --git a/source/dnode/mgmt/mgmt_dnode/inc/dmInt.h b/source/dnode/mgmt/mgmt_dnode/inc/dmInt.h index be9ff56674..18b3f66a60 100644 --- a/source/dnode/mgmt/mgmt_dnode/inc/dmInt.h +++ b/source/dnode/mgmt/mgmt_dnode/inc/dmInt.h @@ -23,26 +23,27 @@ extern "C" { #endif typedef struct SDnodeMgmt { - SDnodeData *pData; - SMsgCb msgCb; - const char *path; - const char *name; - TdThread statusThread; - TdThread notifyThread; - TdThread monitorThread; - TdThread auditThread; - TdThread crashReportThread; - SSingleWorker mgmtWorker; - ProcessCreateNodeFp processCreateNodeFp; - ProcessAlterNodeTypeFp processAlterNodeTypeFp; - ProcessDropNodeFp processDropNodeFp; - SendMonitorReportFp sendMonitorReportFp; - SendAuditRecordsFp sendAuditRecordsFp; - GetVnodeLoadsFp getVnodeLoadsFp; - GetVnodeLoadsFp getVnodeLoadsLiteFp; - GetMnodeLoadsFp getMnodeLoadsFp; - GetQnodeLoadsFp getQnodeLoadsFp; - int32_t statusSeq; + SDnodeData *pData; + SMsgCb msgCb; + const char *path; + const char *name; + TdThread statusThread; + TdThread notifyThread; + TdThread monitorThread; + TdThread auditThread; + TdThread crashReportThread; + SSingleWorker mgmtWorker; + ProcessCreateNodeFp processCreateNodeFp; + ProcessAlterNodeTypeFp processAlterNodeTypeFp; + ProcessDropNodeFp processDropNodeFp; + SendMonitorReportFp sendMonitorReportFp; + MonitorCleanExpiredSamplesFp monitorCleanExpiredSamplesFp; + SendAuditRecordsFp sendAuditRecordsFp; + GetVnodeLoadsFp getVnodeLoadsFp; + GetVnodeLoadsFp getVnodeLoadsLiteFp; + GetMnodeLoadsFp getMnodeLoadsFp; + GetQnodeLoadsFp getQnodeLoadsFp; + int32_t statusSeq; } SDnodeMgmt; // dmHandle.c 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_dnode/src/dmInt.c b/source/dnode/mgmt/mgmt_dnode/src/dmInt.c index 958b411881..d7170398fb 100644 --- a/source/dnode/mgmt/mgmt_dnode/src/dmInt.c +++ b/source/dnode/mgmt/mgmt_dnode/src/dmInt.c @@ -65,6 +65,7 @@ static int32_t dmOpenMgmt(SMgmtInputOpt *pInput, SMgmtOutputOpt *pOutput) { pMgmt->processAlterNodeTypeFp = pInput->processAlterNodeTypeFp; pMgmt->processDropNodeFp = pInput->processDropNodeFp; pMgmt->sendMonitorReportFp = pInput->sendMonitorReportFp; + pMgmt->monitorCleanExpiredSamplesFp = pInput->monitorCleanExpiredSamplesFp; pMgmt->sendAuditRecordsFp = pInput->sendAuditRecordFp; pMgmt->getVnodeLoadsFp = pInput->getVnodeLoadsFp; pMgmt->getVnodeLoadsLiteFp = pInput->getVnodeLoadsLiteFp; diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c b/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c index aeb519596d..4cfadc8f59 100644 --- a/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c +++ b/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c @@ -168,6 +168,7 @@ static void *dmMonitorThreadFp(void *param) { float interval = (curTime - lastTime) / 1000.0f; if (interval >= tsMonitorInterval) { (*pMgmt->sendMonitorReportFp)(); + (*pMgmt->monitorCleanExpiredSamplesFp)(); lastTime = curTime; trimCount = (trimCount + 1) % TRIM_FREQ; 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/vmHandle.c b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c index 4cb6c5c724..2abf292e73 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c @@ -14,8 +14,11 @@ */ #define _DEFAULT_SOURCE +#include "taos_monitor.h" #include "vmInt.h" +extern taos_counter_t *tsInsertCounter; + void vmGetVnodeLoads(SVnodeMgmt *pMgmt, SMonVloadInfo *pInfo, bool isReset) { pInfo->pVloads = taosArrayInit(pMgmt->state.totalVnodes, sizeof(SVnodeLoad)); if (pInfo->pVloads == NULL) return; @@ -117,6 +120,34 @@ void vmGetMonitorInfo(SVnodeMgmt *pMgmt, SMonVmInfo *pInfo) { taosArrayDestroy(pVloads); } +void vmCleanExpriedSamples(SVnodeMgmt *pMgmt) { + int list_size = taos_counter_get_keys_size(tsInsertCounter); + if (list_size == 0) return; + int32_t *vgroup_ids; + char **keys; + int r = 0; + r = taos_counter_get_vgroup_ids(tsInsertCounter, &keys, &vgroup_ids, &list_size); + if (r) { + dError("failed to get vgroup ids"); + return; + } + (void)taosThreadRwlockRdlock(&pMgmt->lock); + for (int i = 0; i < list_size; i++) { + int32_t vgroup_id = vgroup_ids[i]; + void *vnode = taosHashGet(pMgmt->hash, &vgroup_id, sizeof(int32_t)); + if (vnode == NULL) { + r = taos_counter_delete(tsInsertCounter, keys[i]); + if (r) { + dError("failed to delete monitor sample key:%s", keys[i]); + } + } + } + (void)taosThreadRwlockUnlock(&pMgmt->lock); + if (vgroup_ids) taosMemoryFree(vgroup_ids); + if (keys) taosMemoryFree(keys); + return; +} + static void vmGenerateVnodeCfg(SCreateVnodeReq *pCreate, SVnodeCfg *pCfg) { memcpy(pCfg, &vnodeCfgDefault, sizeof(SVnodeCfg)); 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_mgmt/inc/dmMgmt.h b/source/dnode/mgmt/node_mgmt/inc/dmMgmt.h index 9548d0cad9..5196987f28 100644 --- a/source/dnode/mgmt/node_mgmt/inc/dmMgmt.h +++ b/source/dnode/mgmt/node_mgmt/inc/dmMgmt.h @@ -128,6 +128,7 @@ int32_t dmProcessNodeMsg(SMgmtWrapper *pWrapper, SRpcMsg *pMsg); // dmMonitor.c void dmSendMonitorReport(); +void dmMonitorCleanExpiredSamples(); void dmSendAuditRecords(); void dmGetVnodeLoads(SMonVloadInfo *pInfo); void dmGetVnodeLoadsLite(SMonVloadInfo *pInfo); diff --git a/source/dnode/mgmt/node_mgmt/inc/dmNodes.h b/source/dnode/mgmt/node_mgmt/inc/dmNodes.h index 7d635c6bdc..2561a13b92 100644 --- a/source/dnode/mgmt/node_mgmt/inc/dmNodes.h +++ b/source/dnode/mgmt/node_mgmt/inc/dmNodes.h @@ -39,6 +39,8 @@ void vmGetVnodeLoadsLite(void *pMgmt, SMonVloadInfo *pInfo); void mmGetMnodeLoads(void *pMgmt, SMonMloadInfo *pInfo); void qmGetQnodeLoads(void *pMgmt, SQnodeLoad *pInfo); +void vmCleanExpriedSamples(void *pMgmt); + #ifdef __cplusplus } #endif diff --git a/source/dnode/mgmt/node_mgmt/src/dmEnv.c b/source/dnode/mgmt/node_mgmt/src/dmEnv.c index 0a75847d96..620aed709f 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmEnv.c +++ b/source/dnode/mgmt/node_mgmt/src/dmEnv.c @@ -409,6 +409,7 @@ SMgmtInputOpt dmBuildMgmtInputOpt(SMgmtWrapper *pWrapper) { .processAlterNodeTypeFp = dmProcessAlterNodeTypeReq, .processDropNodeFp = dmProcessDropNodeReq, .sendMonitorReportFp = dmSendMonitorReport, + .monitorCleanExpiredSamplesFp = dmMonitorCleanExpiredSamples, .sendAuditRecordFp = auditSendRecordsInBatch, .getVnodeLoadsFp = dmGetVnodeLoads, .getVnodeLoadsLiteFp = dmGetVnodeLoadsLite, diff --git a/source/dnode/mgmt/node_mgmt/src/dmMonitor.c b/source/dnode/mgmt/node_mgmt/src/dmMonitor.c index d3197282b6..ce0b2b59e0 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmMonitor.c +++ b/source/dnode/mgmt/node_mgmt/src/dmMonitor.c @@ -33,8 +33,8 @@ static void dmGetMonitorBasicInfoBasic(SDnode *pDnode, SMonBasicInfo *pInfo) { } static void dmGetMonitorDnodeInfo(SDnode *pDnode, SMonDnodeInfo *pInfo) { - //pInfo->uptime = (taosGetTimestampMs() - pDnode->data.rebootTime) / (86400000.0f); - pInfo->uptime = (taosGetTimestampMs() - pDnode->data.rebootTime) /1000.0f; + // pInfo->uptime = (taosGetTimestampMs() - pDnode->data.rebootTime) / (86400000.0f); + pInfo->uptime = (taosGetTimestampMs() - pDnode->data.rebootTime) / 1000.0f; pInfo->has_mnode = pDnode->wrappers[MNODE].required; pInfo->has_qnode = pDnode->wrappers[QNODE].required; pInfo->has_snode = pDnode->wrappers[SNODE].required; @@ -52,6 +52,17 @@ static void dmGetDmMonitorInfo(SDnode *pDnode) { monSetDmInfo(&dmInfo); } +void dmCleanExpriedSamples(SDnode *pDnode) { + SMgmtWrapper *pWrapper = &pDnode->wrappers[VNODE]; + if (dmMarkWrapper(pWrapper) == 0) { + if (pWrapper->pMgmt != NULL) { + vmCleanExpriedSamples(pWrapper->pMgmt); + } + } + dmReleaseWrapper(pWrapper); + return; +} + static void dmGetDmMonitorInfoBasic(SDnode *pDnode) { SMonDmInfo dmInfo = {0}; dmGetMonitorBasicInfoBasic(pDnode, &dmInfo.basic); @@ -123,11 +134,17 @@ void dmSendMonitorReport() { monGenAndSendReport(); } -//Todo: put this in seperate file in the future -void dmSendAuditRecords() { - auditSendRecordsInBatch(); +void dmMonitorCleanExpiredSamples() { + if (!tsEnableMonitor || tsMonitorFqdn[0] == 0 || tsMonitorPort == 0) return; + dTrace("clean monitor expired samples"); + + SDnode *pDnode = dmInstance(); + (void)dmCleanExpriedSamples(pDnode); } +// Todo: put this in seperate file in the future +void dmSendAuditRecords() { auditSendRecordsInBatch(); } + void dmGetVnodeLoads(SMonVloadInfo *pInfo) { SDnode *pDnode = dmInstance(); SMgmtWrapper *pWrapper = &pDnode->wrappers[VNODE]; diff --git a/source/dnode/mgmt/node_util/inc/dmUtil.h b/source/dnode/mgmt/node_util/inc/dmUtil.h index 4ad4ea7c30..425f10392f 100644 --- a/source/dnode/mgmt/node_util/inc/dmUtil.h +++ b/source/dnode/mgmt/node_util/inc/dmUtil.h @@ -116,6 +116,7 @@ typedef enum { typedef int32_t (*ProcessCreateNodeFp)(EDndNodeType ntype, SRpcMsg *pMsg); typedef int32_t (*ProcessDropNodeFp)(EDndNodeType ntype, SRpcMsg *pMsg); typedef void (*SendMonitorReportFp)(); +typedef void (*MonitorCleanExpiredSamplesFp)(); typedef void (*SendAuditRecordsFp)(); typedef void (*GetVnodeLoadsFp)(SMonVloadInfo *pInfo); typedef void (*GetMnodeLoadsFp)(SMonMloadInfo *pInfo); @@ -146,21 +147,22 @@ typedef struct { } SDnodeData; typedef struct { - const char *path; - const char *name; - STfs *pTfs; - SDnodeData *pData; - SMsgCb msgCb; - ProcessCreateNodeFp processCreateNodeFp; - ProcessAlterNodeTypeFp processAlterNodeTypeFp; - ProcessDropNodeFp processDropNodeFp; - SendMonitorReportFp sendMonitorReportFp; - SendAuditRecordsFp sendAuditRecordFp; - GetVnodeLoadsFp getVnodeLoadsFp; - GetVnodeLoadsFp getVnodeLoadsLiteFp; - GetMnodeLoadsFp getMnodeLoadsFp; - GetQnodeLoadsFp getQnodeLoadsFp; - StopDnodeFp stopDnodeFp; + const char *path; + const char *name; + STfs *pTfs; + SDnodeData *pData; + SMsgCb msgCb; + ProcessCreateNodeFp processCreateNodeFp; + ProcessAlterNodeTypeFp processAlterNodeTypeFp; + ProcessDropNodeFp processDropNodeFp; + SendMonitorReportFp sendMonitorReportFp; + MonitorCleanExpiredSamplesFp monitorCleanExpiredSamplesFp; + SendAuditRecordsFp sendAuditRecordFp; + GetVnodeLoadsFp getVnodeLoadsFp; + GetVnodeLoadsFp getVnodeLoadsLiteFp; + GetMnodeLoadsFp getMnodeLoadsFp; + GetQnodeLoadsFp getQnodeLoadsFp; + StopDnodeFp stopDnodeFp; } SMgmtInputOpt; typedef struct { diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c index 136d3f9c6c..d37ab090b5 100644 --- a/source/dnode/mnode/impl/src/mndConsumer.c +++ b/source/dnode/mnode/impl/src/mndConsumer.c @@ -298,7 +298,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)); } diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index 2792ea79f7..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); 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/mndDump.c b/source/dnode/mnode/impl/src/mndDump.c index 565e244014..04c9093c11 100644 --- a/source/dnode/mnode/impl/src/mndDump.c +++ b/source/dnode/mnode/impl/src/mndDump.c @@ -630,4 +630,30 @@ void mndDumpSdb() { mInfo("dump sdb info success"); } +void mndDeleteTrans() { + mInfo("start to dump sdb info to sdb.json"); + + char path[PATH_MAX * 2] = {0}; + (void)snprintf(path, sizeof(path), "%s%smnode", tsDataDir, TD_DIRSEP); + + SMsgCb msgCb = {0}; + msgCb.reportStartupFp = reportStartup; + msgCb.sendReqFp = sendReq; + msgCb.sendSyncReqFp = sendSyncReq; + msgCb.sendRspFp = sendRsp; + msgCb.mgmt = (SMgmtWrapper *)(&msgCb); // hack + tmsgSetDefault(&msgCb); + + (void)walInit(NULL); + (void)syncInit(); + + SMnodeOpt opt = {.msgCb = msgCb}; + SMnode *pMnode = mndOpen(path, &opt); + if (pMnode == NULL) return; + + (void)sdbWriteFileForDump(pMnode->pSdb); + + mInfo("dump sdb info success"); +} + #pragma GCC diagnostic pop 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/mndPerfSchema.c b/source/dnode/mnode/impl/src/mndPerfSchema.c index d54c27ce30..da5e201c05 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); } @@ -42,7 +42,7 @@ int32_t mndPerfsInitMeta(SHashObj *hash) { int32_t code = 0; STableMetaRsp meta = {0}; - tstrncpy(meta.dbFName, TSDB_INFORMATION_SCHEMA_DB, sizeof(meta.dbFName)); + tstrncpy(meta.dbFName, TSDB_PERFORMANCE_SCHEMA_DB, sizeof(meta.dbFName)); meta.tableType = TSDB_SYSTEM_TABLE; meta.sversion = 1; meta.tversion = 1; @@ -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/mndSma.c b/source/dnode/mnode/impl/src/mndSma.c index 5e32b2ad52..284d65cd9c 100644 --- a/source/dnode/mnode/impl/src/mndSma.c +++ b/source/dnode/mnode/impl/src/mndSma.c @@ -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)) { @@ -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/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index 7220203ce6..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; } @@ -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 97eb7d609b..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); @@ -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; } diff --git a/source/dnode/mnode/impl/src/mndStreamUtil.c b/source/dnode/mnode/impl/src/mndStreamUtil.c index 3bb5617a9c..ef91ccef34 100644 --- a/source/dnode/mnode/impl/src/mndStreamUtil.c +++ b/source/dnode/mnode/impl/src/mndStreamUtil.c @@ -305,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; } @@ -406,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; } @@ -471,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; } @@ -526,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; } diff --git a/source/dnode/mnode/impl/src/mndSync.c b/source/dnode/mnode/impl/src/mndSync.c index 36f5d31676..d669994128 100644 --- a/source/dnode/mnode/impl/src/mndSync.c +++ b/source/dnode/mnode/impl/src/mndSync.c @@ -475,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; @@ -502,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); } @@ -606,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/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c index 521539759c..63cab4168a 100644 --- a/source/dnode/mnode/impl/src/mndTrans.c +++ b/source/dnode/mnode/impl/src/mndTrans.c @@ -837,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; @@ -905,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); } @@ -948,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); } diff --git a/source/dnode/mnode/impl/src/mndUser.c b/source/dnode/mnode/impl/src/mndUser.c index 7f29fc0d6d..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) { diff --git a/source/dnode/mnode/impl/src/mndVgroup.c b/source/dnode/mnode/impl/src/mndVgroup.c index b2f1c3cf55..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; } 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 4584cb817a..c33b1d4366 100644 --- a/source/dnode/mnode/sdb/inc/sdb.h +++ b/source/dnode/mnode/sdb/inc/sdb.h @@ -280,6 +280,7 @@ int32_t sdbReadFile(SSdb *pSdb); */ int32_t sdbWriteFile(SSdb *pSdb, int32_t delta); +int32_t sdbWriteFileForDump(SSdb *pSdb); /** * @brief Parse and write raw data to sdb, then free the pRaw object * diff --git a/source/dnode/mnode/sdb/src/sdb.c b/source/dnode/mnode/sdb/src/sdb.c index 7244f2d7c9..576ba736b5 100644 --- a/source/dnode/mnode/sdb/src/sdb.c +++ b/source/dnode/mnode/sdb/src/sdb.c @@ -68,7 +68,11 @@ SSdb *sdbInit(SSdbOpt *pOption) { void sdbCleanup(SSdb *pSdb) { mInfo("start to cleanup sdb"); - (void)sdbWriteFile(pSdb, 0); + int32_t code = 0; + + if ((code = sdbWriteFile(pSdb, 0)) != 0) { + mError("failed to write sdb file since %s", tstrerror(code)); + } if (pSdb->currDir != NULL) { taosMemoryFreeClear(pSdb->currDir); diff --git a/source/dnode/mnode/sdb/src/sdbFile.c b/source/dnode/mnode/sdb/src/sdbFile.c index 9073032738..94826405dc 100644 --- a/source/dnode/mnode/sdb/src/sdbFile.c +++ b/source/dnode/mnode/sdb/src/sdbFile.c @@ -258,8 +258,11 @@ static int32_t sdbReadFileImp(SSdb *pSdb) { if (code != 0) { mError("failed to read sdb file:%s head since %s", file, tstrerror(code)); taosMemoryFree(pRaw); - (void)taosCloseFile(&pFile); - return -1; + int32_t ret = 0; + if ((ret = taosCloseFile(&pFile)) != 0) { + mError("failed to close sdb file:%s since %s", file, tstrerror(ret)); + } + return code; } int64_t tableVer[SDB_MAX] = {0}; @@ -361,7 +364,9 @@ static int32_t sdbReadFileImp(SSdb *pSdb) { pSdb->commitTerm, pSdb->commitConfig); _OVER: - (void)taosCloseFile(&pFile); + if ((ret = taosCloseFile(&pFile)) != 0) { + mError("failed to close sdb file:%s since %s", file, tstrerror(ret)); + } sdbFreeRaw(pRaw); TAOS_RETURN(code); @@ -381,7 +386,7 @@ int32_t sdbReadFile(SSdb *pSdb) { return code; } -static int32_t sdbWriteFileImp(SSdb *pSdb) { +static int32_t sdbWriteFileImp(SSdb *pSdb, int32_t skip_type) { int32_t code = 0; char tmpfile[PATH_MAX] = {0}; @@ -404,11 +409,15 @@ static int32_t sdbWriteFileImp(SSdb *pSdb) { code = sdbWriteFileHead(pSdb, pFile); if (code != 0) { mError("failed to write sdb file:%s head since %s", tmpfile, tstrerror(code)); - (void)taosCloseFile(&pFile); - return -1; + int32_t ret = 0; + if ((ret = taosCloseFile(&pFile)) != 0) { + mError("failed to close sdb file:%s since %s", tmpfile, tstrerror(ret)); + } + return code; } for (int32_t i = SDB_MAX - 1; i >= 0; --i) { + if (i == skip_type) continue; SdbEncodeFp encodeFp = pSdb->encodeFps[i]; if (encodeFp == NULL) continue; @@ -550,7 +559,7 @@ int32_t sdbWriteFile(SSdb *pSdb, int32_t delta) { } } if (code == 0) { - code = sdbWriteFileImp(pSdb); + code = sdbWriteFileImp(pSdb, -1); } if (code == 0) { if (pSdb->pWal != NULL) { @@ -566,6 +575,14 @@ int32_t sdbWriteFile(SSdb *pSdb, int32_t delta) { return code; } +int32_t sdbWriteFileForDump(SSdb *pSdb) { + int32_t code = 0; + + code = sdbWriteFileImp(pSdb, 0); + + return code; +} + int32_t sdbDeploy(SSdb *pSdb) { int32_t code = 0; code = sdbDeployData(pSdb); @@ -604,12 +621,18 @@ static void sdbCloseIter(SSdbIter *pIter) { if (pIter == NULL) return; if (pIter->file != NULL) { - (void)taosCloseFile(&pIter->file); + int32_t ret = 0; + if ((ret = taosCloseFile(&pIter->file)) != 0) { + mError("failed to close sdb file since %s", tstrerror(ret)); + } pIter->file = NULL; } if (pIter->name != NULL) { - (void)taosRemoveFile(pIter->name); + int32_t ret = 0; + if ((ret = taosRemoveFile(pIter->name)) != 0) { + mError("failed to remove sdb file:%s since %s", pIter->name, tstrerror(ret)); + } taosMemoryFree(pIter->name); pIter->name = NULL; } @@ -664,7 +687,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 0e41e0732f..5a2d1c981c 100644 --- a/source/dnode/mnode/sdb/src/sdbHash.c +++ b/source/dnode/mnode/sdb/src/sdbHash.c @@ -174,12 +174,12 @@ static int32_t sdbInsertRow(SSdb *pSdb, SHashObj *hash, SSdbRaw *pRaw, SSdbRow * if (insertFp != NULL) { code = (*insertFp)(pSdb, pRow->pObj); if (code != 0) { - if (terrno == 0) terrno = TSDB_CODE_MND_TRANS_UNKNOW_ERROR; - code = terrno; - (void)taosHashRemove(hash, pRow->pObj, keySize); + if (taosHashRemove(hash, pRow->pObj, keySize) != 0) { + mError("failed to remove row from hash"); + } sdbFreeRow(pSdb, pRow, false); - terrno = code; sdbUnLock(pSdb, type); + terrno = code; return terrno; } } diff --git a/source/dnode/vnode/src/sma/smaEnv.c b/source/dnode/vnode/src/sma/smaEnv.c index 96992e2fa5..c26708bd68 100644 --- a/source/dnode/vnode/src/sma/smaEnv.c +++ b/source/dnode/vnode/src/sma/smaEnv.c @@ -174,10 +174,14 @@ static void tRSmaInfoHashFreeNode(void *data) { if ((pRSmaInfo = *(SRSmaInfo **)data)) { if ((pItem = RSMA_INFO_ITEM((SRSmaInfo *)pRSmaInfo, 0)) && pItem->level) { - (void)taosHashRemove(smaMgmt.refHash, &pItem, POINTER_BYTES); + if (TSDB_CODE_SUCCESS != taosHashRemove(smaMgmt.refHash, &pItem, POINTER_BYTES)) { + smaError("failed to hash remove %s:%d", __FUNCTION__, __LINE__); + } } if ((pItem = RSMA_INFO_ITEM((SRSmaInfo *)pRSmaInfo, 1)) && pItem->level) { - (void)taosHashRemove(smaMgmt.refHash, &pItem, POINTER_BYTES); + if (TSDB_CODE_SUCCESS != taosHashRemove(smaMgmt.refHash, &pItem, POINTER_BYTES)) { + smaError("failed to hash remove %s:%d", __FUNCTION__, __LINE__); + } } (void)tdFreeRSmaInfo(pRSmaInfo->pSma, pRSmaInfo); } diff --git a/source/dnode/vnode/src/tq/tqStreamTaskSnap.c b/source/dnode/vnode/src/tq/tqStreamTaskSnap.c index 742d165062..a279b58d32 100644 --- a/source/dnode/vnode/src/tq/tqStreamTaskSnap.c +++ b/source/dnode/vnode/src/tq/tqStreamTaskSnap.c @@ -50,10 +50,14 @@ int32_t streamTaskSnapReaderOpen(STQ* pTq, int64_t sver, int64_t ever, SStreamTa } STablePair pair1 = {.tbl = pTq->pStreamMeta->pTaskDb, .type = SNAP_DATA_STREAM_TASK}; - (void)taosArrayPush(pReader->tdbTbList, &pair1); + if (NULL == taosArrayPush(pReader->tdbTbList, &pair1)) { + TAOS_CHECK_GOTO(terrno, NULL, _err); + } STablePair pair2 = {.tbl = pTq->pStreamMeta->pCheckpointDb, .type = SNAP_DATA_STREAM_TASK_CHECKPOINT}; - (void)taosArrayPush(pReader->tdbTbList, &pair2); + if (NULL == taosArrayPush(pReader->tdbTbList, &pair2)) { + TAOS_CHECK_GOTO(terrno, NULL, _err); + } pReader->pos = 0; diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index 586a9d7df9..2a321289d1 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCache.c +++ b/source/dnode/vnode/src/tsdb/tsdbCache.c @@ -678,14 +678,14 @@ int32_t tsdbCacheCommitNoLock(STsdb *pTsdb) { static int32_t tsdbCacheGetValuesFromRocks(STsdb *pTsdb, size_t numKeys, const char *const *ppKeysList, size_t *pKeysListSizes, char ***pppValuesList, size_t **ppValuesListSizes) { - char **valuesList = taosMemoryCalloc(numKeys, sizeof(char *)); - if(!valuesList) return terrno; + char **valuesList = taosMemoryCalloc(numKeys, sizeof(char *)); + if (!valuesList) return terrno; size_t *valuesListSizes = taosMemoryCalloc(numKeys, sizeof(size_t)); - if(!valuesListSizes) { + if (!valuesListSizes) { taosMemoryFreeClear(valuesList); return terrno; } - char **errs = taosMemoryCalloc(numKeys, sizeof(char *)); + char **errs = taosMemoryCalloc(numKeys, sizeof(char *)); if (!errs) { taosMemoryFreeClear(valuesList); taosMemoryFreeClear(valuesListSizes); @@ -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)); @@ -1186,7 +1178,7 @@ static int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, SArray size_t *values_list_sizes = NULL; char **errs = NULL; keys_list = taosMemoryCalloc(num_keys, sizeof(char *)); - if(!keys_list) { + if (!keys_list) { (void)taosThreadMutexUnlock(&pTsdb->lruMutex); return terrno; } @@ -1700,19 +1692,18 @@ static int32_t tsdbCacheLoadFromRocks(STsdb *pTsdb, tb_uid_t uid, SArray *pLastA goto _exit; } + SLastCol lastCol = *pLastCol; + TAOS_CHECK_EXIT(tsdbCacheReallocSLastCol(&lastCol, NULL)); + LRUStatus status = taosLRUCacheInsert(pCache, &idxKey->key, ROCKS_KEY_LEN, pLastCol, charge, tsdbCacheDeleter, NULL, TAOS_LRU_PRIORITY_LOW, &pTsdb->flushState); if (status != TAOS_LRU_STATUS_OK) { code = -1; } - SLastCol lastCol = *pLastCol; - TAOS_CHECK_EXIT(tsdbCacheReallocSLastCol(&lastCol, NULL)); - taosArraySet(pLastArray, idxKey->idx, &lastCol); taosArrayRemove(remainCols, j); taosArrayRemove(ignoreFromRocks, j); - } else { ++j; } @@ -1880,9 +1871,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)); diff --git a/source/dnode/vnode/src/tsdb/tsdbRead2.c b/source/dnode/vnode/src/tsdb/tsdbRead2.c index b7bfd045d1..34280326a0 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead2.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead2.c @@ -211,7 +211,7 @@ static int32_t updateBlockSMAInfo(STSchema* pSchema, SBlockLoadSuppInfo* pSupInf while (i < pSchema->numOfCols && j < pSupInfo->numOfCols) { STColumn* pTCol = &pSchema->columns[i]; if (pTCol->colId == pSupInfo->colId[j]) { - if (!IS_BSMA_ON(pTCol)) { + if (!IS_BSMA_ON(pTCol) && (PRIMARYKEY_TIMESTAMP_COL_ID != pTCol->colId)) { pSupInfo->smaValid = false; return TSDB_CODE_SUCCESS; } @@ -1734,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); @@ -1943,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; @@ -1983,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; } @@ -1996,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; } @@ -2007,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; } @@ -2018,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; } @@ -2039,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); @@ -2175,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; @@ -2579,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); @@ -4770,13 +4749,13 @@ int32_t tsdbReaderOpen2(void* pVnode, SQueryTableDataCond* pCond, void* pTableLi if (pCond->suid != 0) { pReader->info.pSchema = metaGetTbTSchema(pReader->pTsdb->pVnode->pMeta, pReader->info.suid, -1, 1); if (pReader->info.pSchema == NULL) { - tsdbError("failed to get table schema, suid:%" PRIu64 ", ver:-1, %s", pReader->info.suid, pReader->idStr); + tsdbWarn("failed to get table schema, suid:%" PRIu64 ", ver:-1, %s", pReader->info.suid, pReader->idStr); } } else if (numOfTables > 0) { STableKeyInfo* pKey = pTableList; pReader->info.pSchema = metaGetTbTSchema(pReader->pTsdb->pVnode->pMeta, pKey->uid, -1, 1); if (pReader->info.pSchema == NULL) { - tsdbError("failed to get table schema, uid:%" PRIu64 ", ver:-1, %s", pKey->uid, pReader->idStr); + tsdbWarn("failed to get table schema, uid:%" PRIu64 ", ver:-1, %s", pKey->uid, pReader->idStr); } } diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index c02ff465c6..8052be46f9 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -253,11 +253,6 @@ static int32_t vnodePreProcessSubmitTbData(SVnode *pVnode, SDecoder *pCoder, int version = (submitTbData.flags >> 8) & 0xff; submitTbData.flags = submitTbData.flags & 0xff; - if (submitTbData.flags & SUBMIT_REQ_FROM_FILE) { - code = grantCheck(TSDB_GRANT_CSV); - TSDB_CHECK_CODE(code, lino, _exit); - } - int64_t uid; if (submitTbData.flags & SUBMIT_REQ_AUTO_CREATE_TABLE) { code = vnodePreprocessCreateTableReq(pVnode, pCoder, btimeMs, &uid); 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 ff37b3fd41..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; @@ -829,7 +829,7 @@ 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); + 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 ef29907b96..00b1d7ad79 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; @@ -530,8 +530,7 @@ int32_t ctgAsyncSendMsg(SCatalog* pCtg, SRequestConnInfo* pConn, SCtgJob* pJob, pMsgSendInfo->msgInfo.handle = NULL; pMsgSendInfo->msgType = msgType; - int64_t transporterId = 0; - code = asyncSendMsgToServer(pConn->pTrans, &pConn->mgmtEps, &transporterId, pMsgSendInfo); + code = asyncSendMsgToServer(pConn->pTrans, &pConn->mgmtEps, NULL, pMsgSendInfo); pMsgSendInfo = NULL; if (code) { ctgError("asyncSendMsgToSever failed, error: %s", tstrerror(code)); @@ -753,7 +752,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 +927,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 +982,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 +1040,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 +1100,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 +1158,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 +1216,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 +1279,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 +1352,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 +1596,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 +1653,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 +1714,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/src/aggregateoperator.c b/source/libs/executor/src/aggregateoperator.c index f0e0f81cf5..61f1339c82 100644 --- a/source/libs/executor/src/aggregateoperator.c +++ b/source/libs/executor/src/aggregateoperator.c @@ -82,7 +82,7 @@ int32_t createAggregateOperatorInfo(SOperatorInfo* downstream, SAggPhysiNode* pA SAggOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SAggOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); if (pInfo == NULL || pOperator == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto _error; } @@ -326,6 +326,9 @@ int32_t doAggregateImpl(SOperatorInfo* pOperator, SqlFunctionCtx* pCtx) { } if (code != TSDB_CODE_SUCCESS) { + if (pCtx[k].fpSet.cleanup != NULL) { + pCtx[k].fpSet.cleanup(&pCtx[k]); + } qError("%s aggregate function error happens, code: %s", GET_TASKID(pOperator->pTaskInfo), tstrerror(code)); return code; } @@ -536,7 +539,7 @@ int32_t doInitAggInfoSup(SAggSupporter* pAggSup, SqlFunctionCtx* pCtx, int32_t n pAggSup->pResultRowHashTable = tSimpleHashInit(100, taosFastHash); if (pAggSup->keyBuf == NULL || pAggSup->pResultRowHashTable == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } uint32_t defaultPgsz = 0; @@ -640,6 +643,9 @@ void applyAggFunctionOnPartialTuples(SExecTaskInfo* taskInfo, SqlFunctionCtx* pC } if (code != TSDB_CODE_SUCCESS) { + if (pCtx[k].fpSet.cleanup != NULL) { + pCtx[k].fpSet.cleanup(&pCtx[k]); + } qError("%s apply functions error, code: %s", GET_TASKID(taskInfo), tstrerror(code)); taskInfo->code = code; T_LONG_JMP(taskInfo->env, code); diff --git a/source/libs/executor/src/cachescanoperator.c b/source/libs/executor/src/cachescanoperator.c index c26d193a06..fdf20b4613 100644 --- a/source/libs/executor/src/cachescanoperator.c +++ b/source/libs/executor/src/cachescanoperator.c @@ -107,7 +107,7 @@ int32_t createCacherowsScanOperator(SLastRowScanPhysiNode* pScanNode, SReadHandl SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); if (pInfo == NULL || pOperator == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto _error; } diff --git a/source/libs/executor/src/countwindowoperator.c b/source/libs/executor/src/countwindowoperator.c index 28b2c22053..713116d605 100644 --- a/source/libs/executor/src/countwindowoperator.c +++ b/source/libs/executor/src/countwindowoperator.c @@ -302,7 +302,7 @@ int32_t createCountwindowOperatorInfo(SOperatorInfo* downstream, SPhysiNode* phy SCountWindowOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SCountWindowOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); if (pInfo == NULL || pOperator == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto _error; } diff --git a/source/libs/executor/src/dataInserter.c b/source/libs/executor/src/dataInserter.c index 44342b0ac9..5ed97c8db6 100644 --- a/source/libs/executor/src/dataInserter.c +++ b/source/libs/executor/src/dataInserter.c @@ -61,14 +61,14 @@ int32_t inserterCallback(void* param, SDataBuf* pMsg, int32_t code) { if (code) { pInserter->submitRes.code = code; } - + if (code == TSDB_CODE_SUCCESS) { pInserter->submitRes.pRsp = taosMemoryCalloc(1, sizeof(SSubmitRsp2)); if (NULL == pInserter->submitRes.pRsp) { pInserter->submitRes.code = terrno; goto _return; } - + SDecoder coder = {0}; tDecoderInit(&coder, pMsg->pData, pMsg->len); code = tDecodeSSubmitRsp2(&coder, pInserter->submitRes.pRsp); @@ -108,7 +108,7 @@ _return: (void)tsem_post(&pInserter->ready); taosMemoryFree(pMsg->pData); - + return TSDB_CODE_SUCCESS; } @@ -136,8 +136,7 @@ static int32_t sendSubmitRequest(SDataInserterHandle* pInserter, void* pMsg, int pMsgSendInfo->msgType = TDMT_VND_SUBMIT; pMsgSendInfo->fp = inserterCallback; - int64_t transporterId = 0; - return asyncSendMsgToServer(pTransporter, pEpset, &transporterId, pMsgSendInfo); + return asyncSendMsgToServer(pTransporter, pEpset, NULL, pMsgSendInfo); } static int32_t submitReqToMsg(int32_t vgId, SSubmitReq2* pReq, void** pData, int32_t* pLen) { @@ -166,7 +165,7 @@ static int32_t submitReqToMsg(int32_t vgId, SSubmitReq2* pReq, void** pData, int } else { taosMemoryFree(pBuf); } - + return code; } @@ -228,14 +227,15 @@ int32_t buildSubmitReqFromBlock(SDataInserterHandle* pInserter, SSubmitReq2** pp terrno = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR; goto _end; } - void* var = POINTER_SHIFT(pColInfoData->pData, j * pColInfoData->info.bytes); + void* var = POINTER_SHIFT(pColInfoData->pData, j * pColInfoData->info.bytes); switch (pColInfoData->info.type) { case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_VARCHAR: { // TSDB_DATA_TYPE_BINARY if (pColInfoData->info.type != pCol->type) { - qError("column:%d type:%d in block dismatch with schema col:%d type:%d", colIdx, pColInfoData->info.type, k, pCol->type); + qError("column:%d type:%d in block dismatch with schema col:%d type:%d", colIdx, pColInfoData->info.type, k, + pCol->type); terrno = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR; goto _end; } @@ -331,11 +331,11 @@ _end: tDestroySubmitReq(pReq, TSDB_MSG_FLG_ENCODE); taosMemoryFree(pReq); } - + return terrno; } *ppReq = pReq; - + return TSDB_CODE_SUCCESS; } @@ -462,7 +462,8 @@ int32_t createDataInserter(SDataSinkManager* pManager, const SDataSinkNode* pDat inserter->explain = pInserterNode->explain; int64_t suid = 0; - int32_t code = pManager->pAPI->metaFn.getTableSchema(inserter->pParam->readHandle->vnode, pInserterNode->tableId, &inserter->pSchema, &suid); + int32_t code = pManager->pAPI->metaFn.getTableSchema(inserter->pParam->readHandle->vnode, pInserterNode->tableId, + &inserter->pSchema, &suid); if (code) { terrno = code; goto _return; @@ -484,9 +485,9 @@ int32_t createDataInserter(SDataSinkManager* pManager, const SDataSinkNode* pDat inserter->pCols = taosHashInit(pInserterNode->pCols->length, taosGetDefaultHashFunction(TSDB_DATA_TYPE_SMALLINT), false, HASH_NO_LOCK); if (NULL == inserter->pCols) { - goto _return; + goto _return; } - + SNode* pNode = NULL; int32_t i = 0; FOREACH(pNode, pInserterNode->pCols) { diff --git a/source/libs/executor/src/eventwindowoperator.c b/source/libs/executor/src/eventwindowoperator.c index 591590a261..a4be2ddf7d 100644 --- a/source/libs/executor/src/eventwindowoperator.c +++ b/source/libs/executor/src/eventwindowoperator.c @@ -68,7 +68,7 @@ int32_t createEventwindowOperatorInfo(SOperatorInfo* downstream, SPhysiNode* phy SEventWindowOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SEventWindowOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); if (pInfo == NULL || pOperator == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto _error; } diff --git a/source/libs/executor/src/exchangeoperator.c b/source/libs/executor/src/exchangeoperator.c index 120dcbc205..f6f3570804 100644 --- a/source/libs/executor/src/exchangeoperator.c +++ b/source/libs/executor/src/exchangeoperator.c @@ -408,7 +408,7 @@ int32_t createExchangeOperatorInfo(void* pTransporter, SExchangePhysiNode* pExNo SExchangeInfo* pInfo = taosMemoryCalloc(1, sizeof(SExchangeInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); if (pInfo == NULL || pOperator == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto _error; } diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c index 757192b9b0..db3017468d 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; @@ -321,13 +322,13 @@ int32_t prepareDataBlockBuf(SSDataBlock* pDataBlock, SColMatchInfo* pMatchInfo) if (IS_VAR_DATA_TYPE(pItem->dataType.type)) { pBlockInfo->pks[0].pData = taosMemoryCalloc(1, pInfoData->info.bytes); if (pBlockInfo->pks[0].pData == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } pBlockInfo->pks[1].pData = taosMemoryCalloc(1, pInfoData->info.bytes); if (pBlockInfo->pks[1].pData == NULL) { taosMemoryFreeClear(pBlockInfo->pks[0].pData); - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } pBlockInfo->pks[0].nData = pInfoData->info.bytes; @@ -519,7 +520,6 @@ static EDealRes getColumn(SNode** pNode, void* pContext) { static int32_t createResultData(SDataType* pType, int32_t numOfRows, SScalarParam* pParam) { SColumnInfoData* pColumnData = taosMemoryCalloc(1, sizeof(SColumnInfoData)); if (pColumnData == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; return terrno; } @@ -531,7 +531,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; } @@ -758,7 +758,7 @@ int32_t getColInfoResultForGroupby(void* pVnode, SNodeList* group, STableListInf keyBuf = taosMemoryCalloc(1, keyLen); if (keyBuf == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto end; } @@ -1980,7 +1980,7 @@ static int32_t setSelectValueColumnInfo(SqlFunctionCtx* pCtx, int32_t numOfOutpu SqlFunctionCtx* p = NULL; SqlFunctionCtx** pValCtx = taosMemoryCalloc(numOfOutput, POINTER_BYTES); if (pValCtx == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } SHashObj* pSelectFuncs = taosHashInit(8, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_ENTRY_LOCK); diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index c13104fc07..117eb8d80a 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -1220,7 +1220,6 @@ int32_t initQueryTableDataCondForTmq(SQueryTableDataCond* pCond, SSnapContext* s if (pCond->colList == NULL || pCond->pSlotList == NULL) { taosMemoryFreeClear(pCond->colList); taosMemoryFreeClear(pCond->pSlotList); - terrno = TSDB_CODE_OUT_OF_MEMORY; return terrno; } @@ -1611,6 +1610,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..a1bf64a10d 100644 --- a/source/libs/executor/src/executorInt.c +++ b/source/libs/executor/src/executorInt.c @@ -421,7 +421,7 @@ static int32_t doCreateConstantValColumnSMAInfo(SInputColumnInfoData* pInput, SF if (pInput->pData[paramIndex] == NULL) { pInput->pData[paramIndex] = taosMemoryCalloc(1, sizeof(SColumnInfoData)); if (pInput->pData[paramIndex] == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } // Set the correct column info (data type and bytes) @@ -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; @@ -1090,7 +1092,7 @@ int32_t createDataSinkParam(SDataSinkNode* pNode, void** pParam, SExecTaskInfo* case QUERY_NODE_PHYSICAL_PLAN_QUERY_INSERT: { SInserterParam* pInserterParam = taosMemoryCalloc(1, sizeof(SInserterParam)); if (NULL == pInserterParam) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } pInserterParam->readHandle = readHandle; @@ -1100,12 +1102,13 @@ int32_t createDataSinkParam(SDataSinkNode* pNode, void** pParam, SExecTaskInfo* case QUERY_NODE_PHYSICAL_PLAN_DELETE: { SDeleterParam* pDeleterParam = taosMemoryCalloc(1, sizeof(SDeleterParam)); if (NULL == pDeleterParam) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } 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 246a5e2a6d..21b67c8ffb 100644 --- a/source/libs/executor/src/filloperator.c +++ b/source/libs/executor/src/filloperator.c @@ -430,7 +430,7 @@ int32_t createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode* pPhyFi SFillOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SFillOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); if (pInfo == NULL || pOperator == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto _error; } diff --git a/source/libs/executor/src/groupcacheoperator.c b/source/libs/executor/src/groupcacheoperator.c index f0e0894bd2..6a9482e31c 100644 --- a/source/libs/executor/src/groupcacheoperator.c +++ b/source/libs/executor/src/groupcacheoperator.c @@ -1298,7 +1298,7 @@ static int32_t initGroupCacheExecInfo(SOperatorInfo* pOperator) { SGroupCacheOperatorInfo* pInfo = pOperator->info; pInfo->execInfo.pDownstreamBlkNum = taosMemoryCalloc(pOperator->numOfDownstream, sizeof(int64_t)); if (NULL == pInfo->execInfo.pDownstreamBlkNum) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } return TSDB_CODE_SUCCESS; } @@ -1342,7 +1342,7 @@ static int32_t initGroupCacheDownstreamCtx(SOperatorInfo* pOperator) { SGroupCacheOperatorInfo* pInfo = pOperator->info; pInfo->pDownstreams = taosMemoryCalloc(pOperator->numOfDownstream, sizeof(*pInfo->pDownstreams)); if (NULL == pInfo->pDownstreams) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } pInfo->downstreamNum = pOperator->numOfDownstream; @@ -1450,7 +1450,7 @@ int32_t createGroupCacheOperatorInfo(SOperatorInfo** pDownstream, int32_t numOfD SGroupCacheOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SGroupCacheOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); if (pOperator == NULL || pInfo == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto _error; } diff --git a/source/libs/executor/src/groupoperator.c b/source/libs/executor/src/groupoperator.c index 9b46db609f..47b35fe9f3 100644 --- a/source/libs/executor/src/groupoperator.c +++ b/source/libs/executor/src/groupoperator.c @@ -112,7 +112,7 @@ static int32_t initGroupOptrInfo(SArray** pGroupColVals, int32_t* keyLen, char** key.isNull = false; key.pData = taosMemoryCalloc(1, pCol->bytes); if (key.pData == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } void* tmp = taosArrayPush((*pGroupColVals), &key); @@ -126,7 +126,7 @@ static int32_t initGroupOptrInfo(SArray** pGroupColVals, int32_t* keyLen, char** (*keyBuf) = taosMemoryCalloc(1, (*keyLen)); if ((*keyBuf) == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } return TSDB_CODE_SUCCESS; @@ -1675,7 +1675,7 @@ int32_t createStreamPartitionOperatorInfo(SOperatorInfo* downstream, SStreamPart SStreamPartitionOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamPartitionOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); if (pInfo == NULL || pOperator == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto _error; } diff --git a/source/libs/executor/src/hashjoinoperator.c b/source/libs/executor/src/hashjoinoperator.c index f253aefe95..4e630dbd18 100644 --- a/source/libs/executor/src/hashjoinoperator.c +++ b/source/libs/executor/src/hashjoinoperator.c @@ -388,7 +388,7 @@ static int32_t hJoinBuildResColsMap(SHJoinOperatorInfo* pInfo, SHashJoinPhysiNod pInfo->pResColNum = pJoinNode->pTargets->length; pInfo->pResColMap = taosMemoryCalloc(pJoinNode->pTargets->length, sizeof(int8_t)); if (NULL == pInfo->pResColMap) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } SNode* pNode = NULL; @@ -1188,7 +1188,7 @@ int32_t createHashJoinOperatorInfo(SOperatorInfo** pDownstream, int32_t numOfDow SHJoinOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SHJoinOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); if (pOperator == NULL || pInfo == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto _return; } diff --git a/source/libs/executor/src/mergejoinoperator.c b/source/libs/executor/src/mergejoinoperator.c index 14f3a08e17..30cc596a44 100644 --- a/source/libs/executor/src/mergejoinoperator.c +++ b/source/libs/executor/src/mergejoinoperator.c @@ -1919,10 +1919,10 @@ _return: if (pInfo != NULL) { destroyMergeJoinOperator(pInfo); } + destroyOperatorAndDownstreams(pOperator, pDownstream, oldNum); if (newDownstreams) { taosMemoryFree(pDownstream); } - 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 c12bfd8798..93bddb0787 100644 --- a/source/libs/executor/src/mergeoperator.c +++ b/source/libs/executor/src/mergeoperator.c @@ -565,7 +565,7 @@ int32_t createMultiwayMergeOperatorInfo(SOperatorInfo** downStreams, size_t numS SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); SDataBlockDescNode* pDescNode = pPhyNode->pOutputDataBlockDesc; if (pInfo == NULL || pOperator == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto _error; } diff --git a/source/libs/executor/src/operator.c b/source/libs/executor/src/operator.c index 3f48d0f0a8..983b70c575 100644 --- a/source/libs/executor/src/operator.c +++ b/source/libs/executor/src/operator.c @@ -63,7 +63,7 @@ int32_t optrDummyOpenFn(SOperatorInfo* pOperator) { int32_t appendDownstream(SOperatorInfo* p, SOperatorInfo** pDownstream, int32_t num) { p->pDownstream = taosMemoryCalloc(1, num * POINTER_BYTES); if (p->pDownstream == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } memcpy(p->pDownstream, pDownstream, num * POINTER_BYTES); @@ -824,7 +824,7 @@ int32_t setOperatorParams(struct SOperatorInfo* pOperator, SOperatorParam* pInpu if (NULL == *pppDownstramParam) { *pppDownstramParam = taosMemoryCalloc(pOperator->numOfDownstream, POINTER_BYTES); if (NULL == *pppDownstramParam) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } } diff --git a/source/libs/executor/src/projectoperator.c b/source/libs/executor/src/projectoperator.c index a9ba57e1d4..633eda6bf9 100644 --- a/source/libs/executor/src/projectoperator.c +++ b/source/libs/executor/src/projectoperator.c @@ -99,7 +99,7 @@ int32_t createProjectOperatorInfo(SOperatorInfo* downstream, SProjectPhysiNode* SProjectOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SProjectOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); if (pInfo == NULL || pOperator == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto _error; } @@ -450,7 +450,7 @@ int32_t createIndefinitOutputOperatorInfo(SOperatorInfo* downstream, SPhysiNode* SIndefOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SIndefOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); if (pInfo == NULL || pOperator == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto _error; } @@ -1057,6 +1057,9 @@ int32_t projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBloc code = pfCtx->fpSet.process(pfCtx); if (code != TSDB_CODE_SUCCESS) { + if (pCtx[k].fpSet.cleanup != NULL) { + pCtx[k].fpSet.cleanup(&pCtx[k]); + } goto _exit; } diff --git a/source/libs/executor/src/querytask.c b/source/libs/executor/src/querytask.c index b050143ac0..67b05af120 100644 --- a/source/libs/executor/src/querytask.c +++ b/source/libs/executor/src/querytask.c @@ -43,7 +43,7 @@ int32_t doCreateTask(uint64_t queryId, uint64_t taskId, int32_t vgId, EOPTR_EXEC SExecTaskInfo* p = taosMemoryCalloc(1, sizeof(SExecTaskInfo)); if (p == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } setTaskStatus(p, TASK_NOT_COMPLETED); @@ -217,6 +217,7 @@ SSchemaWrapper* extractQueriedColumnSchema(SScanPhysiNode* pScanNode) { pqSw->pSchema = taosMemoryCalloc(numOfCols + numOfTags, sizeof(SSchema)); if (pqSw->pSchema == NULL) { + taosMemoryFree(pqSw); return NULL; } diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 5bafac396e..3cc1d41924 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -744,9 +744,7 @@ _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); } } @@ -1452,7 +1450,7 @@ int32_t createTableScanOperatorInfo(STableScanPhysiNode* pTableScanNode, SReadHa STableScanInfo* pInfo = taosMemoryCalloc(1, sizeof(STableScanInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); if (pInfo == NULL || pOperator == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto _error; } @@ -1551,7 +1549,7 @@ int32_t createTableSeqScanOperatorInfo(void* pReadHandle, SExecTaskInfo* pTaskIn STableScanInfo* pInfo = taosMemoryCalloc(1, sizeof(STableScanInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); if (pInfo == NULL || pOperator == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto _end; } @@ -3122,7 +3120,7 @@ int32_t streamScanOperatorEncode(SStreamScanInfo* pInfo, void** pBuff, int32_t* len += encodeSTimeWindowAggSupp(NULL, &pInfo->twAggSup); *pBuff = taosMemoryCalloc(1, len); if (!(*pBuff)) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; QUERY_CHECK_CODE(code, lino, _end); } void* buf = *pBuff; @@ -3842,7 +3840,7 @@ int32_t createRawScanOperatorInfo(SReadHandle* pHandle, SExecTaskInfo* pTaskInfo SStreamRawScanInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamRawScanInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); if (pInfo == NULL || pOperator == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; lino = __LINE__; goto _end; } @@ -3925,7 +3923,7 @@ void streamScanReleaseState(SOperatorInfo* pOperator) { pBuff = taosMemoryCalloc(1, len); if (!pBuff) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; QUERY_CHECK_CODE(code, lino, _end); } @@ -3961,7 +3959,7 @@ void streamScanReloadState(SOperatorInfo* pOperator) { SUpdateInfo* pUpInfo = taosMemoryCalloc(1, sizeof(SUpdateInfo)); if (!pUpInfo) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; QUERY_CHECK_CODE(code, lino, _end); } @@ -4038,7 +4036,7 @@ int32_t createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhysiNode* const char* idstr = pTaskInfo->id.str; if (pInfo == NULL || pOperator == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto _error; } @@ -4341,7 +4339,6 @@ static void tagScanFreeUidTag(void* p) { static int32_t tagScanCreateResultData(SDataType* pType, int32_t numOfRows, SScalarParam* pParam) { SColumnInfoData* pColumnData = taosMemoryCalloc(1, sizeof(SColumnInfoData)); if (pColumnData == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; return terrno; } @@ -4750,7 +4747,7 @@ int32_t createTagScanOperatorInfo(SReadHandle* pReadHandle, STagScanPhysiNode* p STagScanInfo* pInfo = taosMemoryCalloc(1, sizeof(STagScanInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); if (pInfo == NULL || pOperator == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto _error; } @@ -5030,7 +5027,7 @@ static int32_t initSubTablesMergeInfo(STableMergeScanInfo* pInfo) { } STmsSubTablesMergeInfo* pSubTblsInfo = taosMemoryCalloc(1, sizeof(STmsSubTablesMergeInfo)); if (pSubTblsInfo == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } pSubTblsInfo->pTsOrderInfo = taosArrayGet(pInfo->pSortInfo, 0); if (!pSubTblsInfo->pTsOrderInfo) { @@ -5050,7 +5047,7 @@ static int32_t initSubTablesMergeInfo(STableMergeScanInfo* pInfo) { pSubTblsInfo->aInputs = taosMemoryCalloc(pSubTblsInfo->numSubTables, sizeof(STmsSubTableInput)); if (pSubTblsInfo->aInputs == NULL) { taosMemoryFree(pSubTblsInfo); - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } int32_t bufPageSize = pInfo->bufPageSize; int32_t inMemSize = (pSubTblsInfo->numSubTables - pSubTblsInfo->numTableBlocksInMem) * bufPageSize; @@ -5975,7 +5972,7 @@ int32_t createTableMergeScanOperatorInfo(STableScanPhysiNode* pTableScanNode, SR STableMergeScanInfo* pInfo = taosMemoryCalloc(1, sizeof(STableMergeScanInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); if (pInfo == NULL || pOperator == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto _error; } @@ -6218,7 +6215,7 @@ int32_t createTableCountScanOperatorInfo(SReadHandle* readHandle, STableCountSca STableCountScanOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(STableCountScanOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); if (!pInfo || !pOperator) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto _error; } diff --git a/source/libs/executor/src/sortoperator.c b/source/libs/executor/src/sortoperator.c index 8b50cd20ae..bb494cacfa 100644 --- a/source/libs/executor/src/sortoperator.c +++ b/source/libs/executor/src/sortoperator.c @@ -63,7 +63,7 @@ int32_t createSortOperatorInfo(SOperatorInfo* downstream, SSortPhysiNode* pSortN SSortOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SSortOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); if (pInfo == NULL || pOperator == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto _error; } @@ -108,7 +108,7 @@ int32_t createSortOperatorInfo(SOperatorInfo* downstream, SSortPhysiNode* pSortN int32_t keyLen; SSortOpGroupIdCalc* pGroupIdCalc = pInfo->pGroupIdCalc = taosMemoryCalloc(1, sizeof(SSortOpGroupIdCalc)); if (!pGroupIdCalc) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto _error; } SNodeList* pSortColsNodeArr = makeColsNodeArrFromSortKeys(pSortNode->pSortKeys); @@ -784,7 +784,7 @@ int32_t createGroupSortOperatorInfo(SOperatorInfo* downstream, SGroupSortPhysiNo SGroupSortOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SGroupSortOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); if (pInfo == NULL || pOperator == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto _error; } diff --git a/source/libs/executor/src/streamcountwindowoperator.c b/source/libs/executor/src/streamcountwindowoperator.c index 4f11afd35a..b086b41611 100644 --- a/source/libs/executor/src/streamcountwindowoperator.c +++ b/source/libs/executor/src/streamcountwindowoperator.c @@ -484,7 +484,7 @@ void doStreamCountSaveCheckpoint(SOperatorInfo* pOperator) { int32_t len = doStreamCountEncodeOpState(NULL, 0, pOperator, true); pBuf = taosMemoryCalloc(1, len); if (!pBuf) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; QUERY_CHECK_CODE(code, lino, _end); } void* pTmpBuf = pBuf; @@ -816,7 +816,7 @@ int32_t createStreamCountAggOperatorInfo(SOperatorInfo* downstream, SPhysiNode* SStreamCountAggOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamCountAggOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); if (pInfo == NULL || pOperator == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; QUERY_CHECK_CODE(code, lino, _error); } diff --git a/source/libs/executor/src/streameventwindowoperator.c b/source/libs/executor/src/streameventwindowoperator.c index d7519d90e9..70f88fc37f 100644 --- a/source/libs/executor/src/streameventwindowoperator.c +++ b/source/libs/executor/src/streameventwindowoperator.c @@ -867,7 +867,7 @@ int32_t createStreamEventAggOperatorInfo(SOperatorInfo* downstream, SPhysiNode* SStreamEventAggOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamEventAggOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); if (pInfo == NULL || pOperator == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto _error; } diff --git a/source/libs/executor/src/streamfilloperator.c b/source/libs/executor/src/streamfilloperator.c index 9a66f6d688..d87e78ede3 100644 --- a/source/libs/executor/src/streamfilloperator.c +++ b/source/libs/executor/src/streamfilloperator.c @@ -1189,7 +1189,7 @@ static SStreamFillSupporter* initStreamFillSup(SStreamFillPhysiNode* pPhyFillNod int32_t lino = 0; SStreamFillSupporter* pFillSup = taosMemoryCalloc(1, sizeof(SStreamFillSupporter)); if (!pFillSup) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; QUERY_CHECK_CODE(code, lino, _end); } pFillSup->numOfFillCols = numOfFillCols; @@ -1242,7 +1242,7 @@ SStreamFillInfo* initStreamFillInfo(SStreamFillSupporter* pFillSup, SSDataBlock* int32_t lino = 0; SStreamFillInfo* pFillInfo = taosMemoryCalloc(1, sizeof(SStreamFillInfo)); if (!pFillInfo) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; QUERY_CHECK_CODE(code, lino, _end); } @@ -1253,7 +1253,7 @@ SStreamFillInfo* initStreamFillInfo(SStreamFillSupporter* pFillSup, SSDataBlock* pFillInfo->needFill = false; pFillInfo->pLinearInfo = taosMemoryCalloc(1, sizeof(SStreamFillLinearInfo)); if (!pFillInfo) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; QUERY_CHECK_CODE(code, lino, _end); } @@ -1279,7 +1279,7 @@ SStreamFillInfo* initStreamFillInfo(SStreamFillSupporter* pFillSup, SSDataBlock* SPoint value = {0}; value.val = taosMemoryCalloc(1, pColData->info.bytes); if (!value.val) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; QUERY_CHECK_CODE(code, lino, _end); } @@ -1291,7 +1291,7 @@ SStreamFillInfo* initStreamFillInfo(SStreamFillSupporter* pFillSup, SSDataBlock* value.val = taosMemoryCalloc(1, pColData->info.bytes); if (!value.val) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; QUERY_CHECK_CODE(code, lino, _end); } @@ -1309,14 +1309,14 @@ SStreamFillInfo* initStreamFillInfo(SStreamFillSupporter* pFillSup, SSDataBlock* pFillSup->type == TSDB_FILL_NULL || pFillSup->type == TSDB_FILL_NULL_F) { pFillInfo->pResRow = taosMemoryCalloc(1, sizeof(SResultRowData)); if (!pFillInfo->pResRow) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; QUERY_CHECK_CODE(code, lino, _end); } pFillInfo->pResRow->key = INT64_MIN; pFillInfo->pResRow->pRowVal = taosMemoryCalloc(1, pFillSup->rowSize); if (!pFillInfo->pResRow->pRowVal) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; QUERY_CHECK_CODE(code, lino, _end); } @@ -1356,7 +1356,7 @@ int32_t createStreamFillOperatorInfo(SOperatorInfo* downstream, SStreamFillPhysi SStreamFillOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamFillOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); if (pInfo == NULL || pOperator == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; QUERY_CHECK_CODE(code, lino, _error); } diff --git a/source/libs/executor/src/streamtimewindowoperator.c b/source/libs/executor/src/streamtimewindowoperator.c index 8d5aa7104f..0036618d9f 100644 --- a/source/libs/executor/src/streamtimewindowoperator.c +++ b/source/libs/executor/src/streamtimewindowoperator.c @@ -1884,7 +1884,7 @@ int32_t createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, SPhysiN SStreamIntervalOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamIntervalOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); if (pInfo == NULL || pOperator == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; QUERY_CHECK_CODE(code, lino, _error); } @@ -3753,7 +3753,7 @@ int32_t createStreamSessionAggOperatorInfo(SOperatorInfo* downstream, SPhysiNode SStreamSessionAggOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamSessionAggOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); if (pInfo == NULL || pOperator == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto _error; } @@ -4931,7 +4931,7 @@ int32_t createStreamStateAggOperatorInfo(SOperatorInfo* downstream, SPhysiNode* SStreamStateAggOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamStateAggOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); if (pInfo == NULL || pOperator == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; QUERY_CHECK_CODE(code, lino, _error); } @@ -5247,7 +5247,7 @@ int32_t createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SPhysiNode* SStreamIntervalOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamIntervalOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); if (pInfo == NULL || pOperator == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; QUERY_CHECK_CODE(code, lino, _error); } diff --git a/source/libs/executor/src/sysscanoperator.c b/source/libs/executor/src/sysscanoperator.c index 439782253f..85a8b035da 100644 --- a/source/libs/executor/src/sysscanoperator.c +++ b/source/libs/executor/src/sysscanoperator.c @@ -1575,8 +1575,8 @@ static SSDataBlock* sysTableBuildUserTablesByUids(SOperatorInfo* pOperator) { SMetaReader mr = {0}; pAPI->metaReaderFn.initReader(&mr, pInfo->readHandle.vnode, META_READER_LOCK, &pAPI->metaFn); - code = doSetUserTableMetaInfo(&pAPI->metaReaderFn, &pAPI->metaFn, pInfo->readHandle.vnode, &mr, *uid, dbname, vgId, p, - numOfRows, GET_TASKID(pTaskInfo)); + code = doSetUserTableMetaInfo(&pAPI->metaReaderFn, &pAPI->metaFn, pInfo->readHandle.vnode, &mr, *uid, dbname, vgId, + p, numOfRows, GET_TASKID(pTaskInfo)); pAPI->metaReaderFn.clearReader(&mr); QUERY_CHECK_CODE(code, lino, _end); @@ -2170,8 +2170,7 @@ static SSDataBlock* sysTableScanFromMNode(SOperatorInfo* pOperator, SSysTableSca pMsgSendInfo->fp = loadSysTableCallback; pMsgSendInfo->requestId = pTaskInfo->id.queryId; - int64_t transporterId = 0; - code = asyncSendMsgToServer(pInfo->readHandle.pMsgCb->clientRpc, &pInfo->epSet, &transporterId, pMsgSendInfo); + code = asyncSendMsgToServer(pInfo->readHandle.pMsgCb->clientRpc, &pInfo->epSet, NULL, pMsgSendInfo); if (code != TSDB_CODE_SUCCESS) { qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(code)); pTaskInfo->code = code; @@ -2236,7 +2235,7 @@ int32_t createSysTableScanOperatorInfo(void* readHandle, SSystemTableScanPhysiNo SSysTableScanInfo* pInfo = taosMemoryCalloc(1, sizeof(SSysTableScanInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); if (pInfo == NULL || pOperator == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; lino = __LINE__; goto _error; } @@ -2832,7 +2831,6 @@ static int32_t initTableblockDistQueryCond(uint64_t uid, SQueryTableDataCond* pC pCond->colList = taosMemoryCalloc(1, sizeof(SColumnInfo)); pCond->pSlotList = taosMemoryMalloc(sizeof(int32_t)); if (pCond->colList == NULL || pCond->pSlotList == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; return terrno; } @@ -2862,7 +2860,7 @@ int32_t createDataBlockInfoScanOperator(SReadHandle* readHandle, SBlockDistScanP SBlockDistInfo* pInfo = taosMemoryCalloc(1, sizeof(SBlockDistInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); if (pInfo == NULL || pOperator == NULL) { - pTaskInfo->code = code = TSDB_CODE_OUT_OF_MEMORY; + pTaskInfo->code = code = terrno; goto _error; } @@ -2881,7 +2879,7 @@ int32_t createDataBlockInfoScanOperator(SReadHandle* readHandle, SBlockDistScanP code = tableListGetSize(pTableListInfo, &num); QUERY_CHECK_CODE(code, lino, _error); - void* pList = tableListGetInfo(pTableListInfo, 0); + void* pList = tableListGetInfo(pTableListInfo, 0); code = readHandle->api.tsdReader.tsdReaderOpen(readHandle->vnode, &cond, pList, num, pInfo->pResBlock, (void**)&pInfo->pHandle, pTaskInfo->id.str, NULL); diff --git a/source/libs/executor/src/timesliceoperator.c b/source/libs/executor/src/timesliceoperator.c index d57a8c7c5b..32a769ade3 100644 --- a/source/libs/executor/src/timesliceoperator.c +++ b/source/libs/executor/src/timesliceoperator.c @@ -652,7 +652,7 @@ static int32_t initGroupKeyKeeper(STimeSliceOperatorInfo* pInfo, SExprSupp* pExp pInfo->pPrevGroupKey = taosMemoryCalloc(1, sizeof(SGroupKeys)); if (pInfo->pPrevGroupKey == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } for (int32_t i = 0; i < pExprSup->numOfExprs; ++i) { @@ -1112,7 +1112,7 @@ int32_t createTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pPhyN SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); if (pOperator == NULL || pInfo == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto _error; } diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index 5499fa3026..fc91877b66 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -1327,7 +1327,7 @@ int32_t createIntervalOperatorInfo(SOperatorInfo* downstream, SIntervalPhysiNode SIntervalAggOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SIntervalAggOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); if (pInfo == NULL || pOperator == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto _error; } @@ -1623,7 +1623,7 @@ int32_t createStatewindowOperatorInfo(SOperatorInfo* downstream, SStateWinodwPhy SStateWindowOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStateWindowOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); if (pInfo == NULL || pOperator == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto _error; } @@ -1734,7 +1734,7 @@ int32_t createSessionAggOperatorInfo(SOperatorInfo* downstream, SSessionWinodwPh SSessionAggOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SSessionAggOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); if (pInfo == NULL || pOperator == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto _error; } @@ -2034,7 +2034,7 @@ int32_t createMergeAlignedIntervalOperatorInfo(SOperatorInfo* downstream, SMerge SMergeAlignedIntervalAggOperatorInfo* miaInfo = taosMemoryCalloc(1, sizeof(SMergeAlignedIntervalAggOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); if (miaInfo == NULL || pOperator == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto _error; } @@ -2372,7 +2372,7 @@ int32_t createMergeIntervalOperatorInfo(SOperatorInfo* downstream, SMergeInterva SMergeIntervalAggOperatorInfo* pMergeIntervalInfo = taosMemoryCalloc(1, sizeof(SMergeIntervalAggOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); if (pMergeIntervalInfo == NULL || pOperator == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto _error; } diff --git a/source/libs/executor/src/tlinearhash.c b/source/libs/executor/src/tlinearhash.c index 83716d72ad..763fc6a412 100644 --- a/source/libs/executor/src/tlinearhash.c +++ b/source/libs/executor/src/tlinearhash.c @@ -260,7 +260,7 @@ static int32_t doAddNewBucket(SLHashObj* pHashObj) { SLHashObj* tHashInit(int32_t inMemPages, int32_t pageSize, _hash_fn_t fn, int32_t numOfTuplePerPage) { SLHashObj* pHashObj = taosMemoryCalloc(1, sizeof(SLHashObj)); if (pHashObj == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; + terrno = terrno; return NULL; } diff --git a/source/libs/executor/src/tsort.c b/source/libs/executor/src/tsort.c index 5a6428a30e..2792e6a197 100644 --- a/source/libs/executor/src/tsort.c +++ b/source/libs/executor/src/tsort.c @@ -1357,7 +1357,7 @@ static int32_t createSortMemFile(SSortHandle* pHandle) { int32_t code = TSDB_CODE_SUCCESS; SSortMemFile* pMemFile = taosMemoryCalloc(1, sizeof(SSortMemFile)); if (pMemFile == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; } if (code == TSDB_CODE_SUCCESS) { taosGetTmpfilePath(tsTempDir, "sort-ext-mem", pMemFile->memFilePath); diff --git a/source/libs/function/inc/builtins.h b/source/libs/function/inc/builtins.h index 343f5b8367..5707ee76f4 100644 --- a/source/libs/function/inc/builtins.h +++ b/source/libs/function/inc/builtins.h @@ -40,6 +40,7 @@ typedef struct SBuiltinFuncDefinition { FExecProcess processFunc; FScalarExecProcess sprocessFunc; FExecFinalize finalizeFunc; + FExecCleanUp cleanupFunc; #ifdef BUILD_NO_CALL FExecProcess invertFunc; #endif diff --git a/source/libs/function/inc/builtinsimpl.h b/source/libs/function/inc/builtinsimpl.h index 7403a4ce31..77d6bda35b 100644 --- a/source/libs/function/inc/builtinsimpl.h +++ b/source/libs/function/inc/builtinsimpl.h @@ -239,6 +239,7 @@ bool getModeFuncEnv(struct SFunctionNode* pFunc, SFuncExecEnv* pEnv); int32_t modeFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResultInfo); int32_t modeFunction(SqlFunctionCtx* pCtx); int32_t modeFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock); +void modeFunctionCleanupExt(SqlFunctionCtx* pCtx); bool getTwaFuncEnv(struct SFunctionNode* pFunc, SFuncExecEnv* pEnv); int32_t twaFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResultInfo); diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index bff7d6804b..17ba430150 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) { @@ -3658,6 +3658,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .processFunc = modeFunction, .sprocessFunc = modeScalarFunction, .finalizeFunc = modeFinalize, + .cleanupFunc = modeFunctionCleanupExt }, { .name = "abs", diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index 6397b92191..84ab103456 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); @@ -6019,6 +6019,12 @@ static void modeFunctionCleanup(SModeInfo * pInfo) { taosMemoryFreeClear(pInfo->buf); } +void modeFunctionCleanupExt(SqlFunctionCtx* pCtx) { + SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx); + SModeInfo* pInfo = GET_ROWCELL_INTERBUF(pResInfo); + modeFunctionCleanup(pInfo); +} + static int32_t saveModeTupleData(SqlFunctionCtx* pCtx, char* data, SModeInfo *pInfo, STuplePos* pPos) { if (IS_VAR_DATA_TYPE(pInfo->colType)) { (void)memcpy(pInfo->buf, data, varDataTLen(data)); @@ -6993,7 +6999,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/functionMgt.c b/source/libs/function/src/functionMgt.c index 254a06426c..2f71ab8e24 100644 --- a/source/libs/function/src/functionMgt.c +++ b/source/libs/function/src/functionMgt.c @@ -142,6 +142,7 @@ int32_t fmGetFuncExecFuncs(int32_t funcId, SFuncExecFuncs* pFpSet) { pFpSet->finalize = funcMgtBuiltins[funcId].finalizeFunc; pFpSet->combine = funcMgtBuiltins[funcId].combineFunc; pFpSet->processFuncByRow = funcMgtBuiltins[funcId].processFuncByRow; + pFpSet->cleanup = funcMgtBuiltins[funcId].cleanupFunc; return TSDB_CODE_SUCCESS; } 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/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/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/monitorfw/inc/taos_metric_formatter_i.h b/source/libs/monitorfw/inc/taos_metric_formatter_i.h index ab60359f4a..54e683fa91 100644 --- a/source/libs/monitorfw/inc/taos_metric_formatter_i.h +++ b/source/libs/monitorfw/inc/taos_metric_formatter_i.h @@ -16,6 +16,7 @@ #ifndef TAOS_METRIC_FORMATTER_I_H #define TAOS_METRIC_FORMATTER_I_H +#include // Private #include "taos_metric_formatter_t.h" @@ -57,8 +58,8 @@ int taos_metric_formatter_load_l_value(taos_metric_formatter_t *metric_formatter /** * @brief API PRIVATE Loads the formatter with a metric sample */ -int taos_metric_formatter_load_sample(taos_metric_formatter_t *metric_formatter, taos_metric_sample_t *sample, - char *ts, char *format); +int taos_metric_formatter_load_sample(taos_metric_formatter_t *metric_formatter, taos_metric_sample_t *sample, char *ts, + char *format); /** * @brief API PRIVATE Loads a metric in the string exposition format @@ -80,4 +81,5 @@ int taos_metric_formatter_clear(taos_metric_formatter_t *self); */ char *taos_metric_formatter_dump(taos_metric_formatter_t *metric_formatter); +int32_t taos_metric_formatter_get_vgroup_id(char *key); #endif // TAOS_METRIC_FORMATTER_I_H diff --git a/source/libs/monitorfw/src/taos_counter.c b/source/libs/monitorfw/src/taos_counter.c index ef7d41cf2c..096d19c190 100644 --- a/source/libs/monitorfw/src/taos_counter.c +++ b/source/libs/monitorfw/src/taos_counter.c @@ -20,13 +20,14 @@ #include "taos_alloc.h" // Private -#include "taos_test.h" #include "taos_errors.h" #include "taos_log.h" +#include "taos_metric_formatter_i.h" #include "taos_metric_i.h" #include "taos_metric_sample_i.h" #include "taos_metric_sample_t.h" #include "taos_metric_t.h" +#include "taos_test.h" taos_counter_t *taos_counter_new(const char *name, const char *help, size_t label_key_count, const char **label_keys) { return (taos_counter_t *)taos_metric_new(TAOS_COUNTER, name, help, label_key_count, label_keys); @@ -64,3 +65,49 @@ int taos_counter_add(taos_counter_t *self, double r_value, const char **label_va if (sample == NULL) return 1; return taos_metric_sample_add(sample, r_value); } + +int taos_counter_get_keys_size(taos_counter_t *self) { return self->samples->keys->size; } + +int taos_counter_get_vgroup_ids(taos_counter_t *self, char ***keys, int32_t **vgroup_ids, int *list_size) { + TAOS_TEST_PARA(self != NULL); + if (self == NULL) return 1; + if (self->type != TAOS_COUNTER) { + TAOS_LOG(TAOS_METRIC_INCORRECT_TYPE); + return 1; + } + if (self->samples == NULL) return 1; + (void)pthread_rwlock_rdlock(self->rwlock); + taos_linked_list_t *key_list = self->samples->keys; + *list_size = key_list->size; + int r = 0; + *vgroup_ids = (int32_t *)taos_malloc(*list_size * sizeof(int32_t)); + if (vgroup_ids == NULL) { + (void)pthread_rwlock_unlock(self->rwlock); + return 1; + } + *keys = (char **)taos_malloc(*list_size * sizeof(char *)); + if (keys == NULL) { + (void)pthread_rwlock_unlock(self->rwlock); + return 1; + } + int index = 0; + for (taos_linked_list_node_t *current_key = key_list->head; current_key != NULL; current_key = current_key->next) { + char *key = (char *)current_key->item; + int32_t vgroup_id = taos_metric_formatter_get_vgroup_id(key); + (*vgroup_ids)[index] = vgroup_id; + (*keys)[index] = key; + index++; + } + (void)pthread_rwlock_unlock(self->rwlock); + return r; +} + +int taos_counter_delete(taos_counter_t *self, char *key) { + TAOS_TEST_PARA(self != NULL); + if (self == NULL) return 1; + if (self->type != TAOS_COUNTER) { + TAOS_LOG(TAOS_METRIC_INCORRECT_TYPE); + return 1; + } + return taos_map_delete(self->samples, key); +} \ No newline at end of file diff --git a/source/libs/monitorfw/src/taos_metric_formatter.c b/source/libs/monitorfw/src/taos_metric_formatter.c index a20a8d919c..cb1edd30b6 100644 --- a/source/libs/monitorfw/src/taos_metric_formatter.c +++ b/source/libs/monitorfw/src/taos_metric_formatter.c @@ -156,6 +156,21 @@ int taos_metric_formatter_load_l_value(taos_metric_formatter_t *self, const char } return 0; } +int32_t taos_metric_formatter_get_vgroup_id(char *key) { + char *start, *end; + char vgroupid[10]; + start = strstr(key, "vgroup_id=\""); + if (start) { + start += strlen("vgroup_id=\""); + end = strchr(start, '\"'); + if (end) { + strncpy(vgroupid, start, end - start); + vgroupid[end - start] = '\0'; + } + return strtol(vgroupid, NULL, 10); + } + return 0; +} /* int taos_metric_formatter_load_sample(taos_metric_formatter_t *self, taos_metric_sample_t *sample, char *ts, char *format) { 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/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 57a21af091..62943cb6d5 100755 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -409,16 +409,19 @@ static int32_t addNamespace(STranslateContext* pCxt, void* pTable) { return TSDB_CODE_OUT_OF_MEMORY; } if (pCxt->currLevel == currTotalLevel) { - (void)taosArrayPush(pTables, &pTable); + if (NULL == taosArrayPush(pTables, &pTable)) { + taosArrayDestroy(pTables); + return terrno; + } if (hasSameTableAlias(pTables)) { - (void)taosArrayDestroy(pTables); + taosArrayDestroy(pTables); return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_UNIQUE_TABLE_ALIAS, "Not unique table/alias: '%s'", ((STableNode*)pTable)->tableAlias); } } if (NULL == taosArrayPush(pCxt->pNsLevel, &pTables)) { code = TSDB_CODE_OUT_OF_MEMORY; - (void)taosArrayDestroy(pTables); + taosArrayDestroy(pTables); break; } ++currTotalLevel; @@ -820,7 +823,7 @@ static int32_t resetHighLevelTranslateNamespace(STranslateContext* pCxt) { } for (int32_t i = size - 1; i >= pCxt->currLevel; --i) { - (void)taosArrayDestroy(taosArrayGetP(pCxt->pNsLevel, i)); + taosArrayDestroy(taosArrayGetP(pCxt->pNsLevel, i)); } taosArrayPopTailBatch(pCxt->pNsLevel, levelNum); @@ -837,9 +840,9 @@ static int32_t resetTranslateNamespace(STranslateContext* pCxt) { if (NULL != pCxt->pNsLevel) { size_t size = taosArrayGetSize(pCxt->pNsLevel); for (size_t i = 0; i < size; ++i) { - (void)taosArrayDestroy(taosArrayGetP(pCxt->pNsLevel, i)); + taosArrayDestroy(taosArrayGetP(pCxt->pNsLevel, i)); } - (void)taosArrayDestroy(pCxt->pNsLevel); + taosArrayDestroy(pCxt->pNsLevel); } pCxt->pNsLevel = taosArrayInit(TARRAY_MIN_SIZE, POINTER_BYTES); if (NULL == pCxt->pNsLevel) { @@ -852,9 +855,9 @@ static void destroyTranslateContext(STranslateContext* pCxt) { if (NULL != pCxt->pNsLevel) { size_t size = taosArrayGetSize(pCxt->pNsLevel); for (size_t i = 0; i < size; ++i) { - (void)taosArrayDestroy(taosArrayGetP(pCxt->pNsLevel, i)); + taosArrayDestroy(taosArrayGetP(pCxt->pNsLevel, i)); } - (void)taosArrayDestroy(pCxt->pNsLevel); + taosArrayDestroy(pCxt->pNsLevel); } if (NULL != pCxt->pCmdMsg) { @@ -1208,7 +1211,9 @@ static int32_t setColumnInfoByExpr(STempTableNode* pTable, SExprNode* pExpr, SCo SAssociationNode assNode; assNode.pPlace = (SNode**)pColRef; assNode.pAssociationNode = (SNode*)*pColRef; - (void)taosArrayPush(pExpr->pAssociation, &assNode); + if (NULL == taosArrayPush(pExpr->pAssociation, &assNode)) { + return terrno; + } strcpy(pCol->tableAlias, pTable->table.tableAlias); pCol->isPrimTs = isPrimaryKeyImpl((SNode*)pExpr); @@ -3882,7 +3887,7 @@ static int32_t setVnodeSysTableVgroupList(STranslateContext* pCxt, SName* pName, if (TSDB_CODE_SUCCESS == code) { code = toVgroupsInfo(pVgs, &pRealTable->pVgroupList); } - (void)taosArrayDestroy(pVgs); + taosArrayDestroy(pVgs); return code; } @@ -3893,7 +3898,7 @@ static int32_t setDnodeSysTableVgroupList(STranslateContext* pCxt, SName* pName, if (TSDB_CODE_SUCCESS == code) { code = dnodeToVgroupsInfo(pDnodes, &pRealTable->pVgroupList); } - (void)taosArrayDestroy(pDnodes); + taosArrayDestroy(pDnodes); return code; } @@ -3913,7 +3918,7 @@ static int32_t setSuperTableVgroupList(STranslateContext* pCxt, SName* pName, SR if (TSDB_CODE_SUCCESS == code) { code = toVgroupsInfo(vgroupList, &pRealTable->pVgroupList); } - (void)taosArrayDestroy(vgroupList); + taosArrayDestroy(vgroupList); return code; } @@ -4033,7 +4038,10 @@ static int32_t setTableTsmas(STranslateContext* pCxt, SName* pName, SRealTableNo } pVgpsInfo->numOfVgroups = 1; pVgpsInfo->vgroups[0] = vgInfo; - (void)taosArrayPush(pRealTable->tsmaTargetTbVgInfo, &pVgpsInfo); + if (NULL == taosArrayPush(pRealTable->tsmaTargetTbVgInfo, &pVgpsInfo)) { + code = terrno; + break; + } } else { break; } @@ -4062,7 +4070,10 @@ static int32_t setTableTsmas(STranslateContext* pCxt, SName* pName, SRealTableNo // ignore table not exists error code = TSDB_CODE_SUCCESS; } - (void)taosArrayPush(pRealTable->tsmaTargetTbInfo, &ctbInfo); + if (NULL == taosArrayPush(pRealTable->tsmaTargetTbInfo, &ctbInfo)) { + code = terrno; + break; + } } } } @@ -4670,10 +4681,11 @@ int32_t translateTable(STranslateContext* pCxt, SNode** pTable, SNode* pJoinPare pCxt, toName(pCxt->pParseCxt->acctId, pRealTable->table.dbName, pRealTable->table.tableName, &name), &(pRealTable->pMeta), true); if (TSDB_CODE_SUCCESS != code) { - return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_GET_META_ERROR, tstrerror(code)); + (void)generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_GET_META_ERROR, tstrerror(code)); + return 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); @@ -5991,20 +6003,28 @@ static int32_t isOperatorEqTbnameCond(STranslateContext* pCxt, SOperatorNode* pO return TSDB_CODE_SUCCESS; } + char* pTableAlias = NULL; if (LIST_LENGTH(pTbnameFunc->pParameterList) == 0) { - *ppTableAlias = NULL; } else if (LIST_LENGTH(pTbnameFunc->pParameterList) == 1) { SNode* pQualNode = nodesListGetNode(pTbnameFunc->pParameterList, 0); if (nodeType(pQualNode) != QUERY_NODE_VALUE) return false; SValueNode* pQualValNode = (SValueNode*)pQualNode; - *ppTableAlias = pQualValNode->literal; + pTableAlias = pQualValNode->literal; } else { *pRet = false; return TSDB_CODE_SUCCESS; } - *ppTabNames = taosArrayInit(1, sizeof(void*)); - if (!*ppTabNames) return TSDB_CODE_OUT_OF_MEMORY; - (void)taosArrayPush(*ppTabNames, &(pValueNode->literal)); + SArray* pTabNames = NULL; + pTabNames = taosArrayInit(1, sizeof(void*)); + if (!pTabNames) { + return terrno; + } + if (NULL == taosArrayPush(pTabNames, &(pValueNode->literal))) { + taosArrayDestroy(pTabNames); + return terrno; + } + *ppTableAlias = pTableAlias; + *ppTabNames = pTabNames; *pRet = true; return TSDB_CODE_SUCCESS; } @@ -6042,7 +6062,11 @@ static int32_t isOperatorTbnameInCond(STranslateContext* pCxt, SOperatorNode* pO *pRet = false; return TSDB_CODE_SUCCESS; } - (void)taosArrayPush(*ppTbNames, &((SValueNode*)pValNode)->literal); + if (NULL == taosArrayPush(*ppTbNames, &((SValueNode*)pValNode)->literal)) { + taosArrayDestroy(*ppTbNames); + *ppTbNames = NULL; + return terrno; + } } *pRet = true; return TSDB_CODE_SUCCESS; @@ -6070,7 +6094,7 @@ static int32_t findEqCondTbNameInOperatorNode(STranslateContext* pCxt, SNode* pW *pRet = true; return TSDB_CODE_SUCCESS; } - (void)taosArrayDestroy(pInfo->aTbnames); + taosArrayDestroy(pInfo->aTbnames); pInfo->aTbnames = NULL; } *pRet = false; @@ -6104,7 +6128,7 @@ static int32_t findEqualCondTbnameInLogicCondAnd(STranslateContext* pCxt, SNode* break; } } else { - (void)taosArrayDestroy(info.aTbnames); + taosArrayDestroy(info.aTbnames); } } } @@ -6123,7 +6147,7 @@ static int32_t unionEqualCondTbnamesOfSameTable(SArray* aTableTbnames, SEqCondTb code = TSDB_CODE_OUT_OF_MEMORY; break; } - (void)taosArrayDestroy(pInfo->aTbnames); + taosArrayDestroy(pInfo->aTbnames); pInfo->aTbnames = NULL; bFoundTable = true; break; @@ -6163,7 +6187,7 @@ static int32_t findEqualCondTbnameInLogicCondOr(STranslateContext* pCxt, SNode* if (TSDB_CODE_SUCCESS == code && !bAllTbName) { for (int i = 0; i < taosArrayGetSize(aTableTbnames); ++i) { SEqCondTbNameTableInfo* pInfo = taosArrayGet(aTableTbnames, i); - (void)taosArrayDestroy(pInfo->aTbnames); + taosArrayDestroy(pInfo->aTbnames); pInfo->aTbnames = NULL; } taosArrayClear(aTableTbnames); @@ -6326,7 +6350,10 @@ static int32_t setEqualTbnameTableVgroups(STranslateContext* pCxt, SSelectStmt* code = TSDB_CODE_OUT_OF_MEMORY; break; } - (void)taosArrayPush(pTbNames, &pNewTbName); + if (NULL == taosArrayPush(pTbNames, &pNewTbName)) { + code = terrno; + break; + } sprintf(pNewTbName, "%s.%s_%s", pTsma->dbFName, pTsma->name, pTbName); int32_t len = taosCreateMD5Hash(pNewTbName, strlen(pNewTbName)); } @@ -6337,7 +6364,9 @@ static int32_t setEqualTbnameTableVgroups(STranslateContext* pCxt, SSelectStmt* if (TSDB_CODE_SUCCESS == code) { findVgroupsFromEqualTbname(pCxt, pTbNames, pInfo->pRealTable->table.dbName, numOfVgs, vgsInfo); if (vgsInfo->numOfVgroups != 0) { - (void)taosArrayPush(pInfo->pRealTable->tsmaTargetTbVgInfo, &vgsInfo); + if (NULL == taosArrayPush(pInfo->pRealTable->tsmaTargetTbVgInfo, &vgsInfo)) { + code = terrno; + } } else { taosMemoryFree(vgsInfo); } @@ -6366,9 +6395,9 @@ static int32_t setTableVgroupsFromEqualTbnameCond(STranslateContext* pCxt, SSele } for (int i = 0; i < taosArrayGetSize(aTables); ++i) { SEqCondTbNameTableInfo* pInfo = taosArrayGet(aTables, i); - (void)taosArrayDestroy(pInfo->aTbnames); + taosArrayDestroy(pInfo->aTbnames); } - (void)taosArrayDestroy(aTables); + taosArrayDestroy(aTables); return code; } @@ -6755,6 +6784,10 @@ static int32_t translateSelectFrom(STranslateContext* pCxt, SSelectStmt* pSelect } static int32_t translateSelect(STranslateContext* pCxt, SSelectStmt* pSelect) { + if (pCxt->pParseCxt && pCxt->pParseCxt->setQueryFp) { + (*pCxt->pParseCxt->setQueryFp)(pCxt->pParseCxt->requestRid); + } + if (NULL == pSelect->pFromTable) { return translateSelectWithoutFrom(pCxt, pSelect); } else { @@ -6879,6 +6912,10 @@ static int32_t checkSetOperLimit(STranslateContext* pCxt, SLimitNode* pLimit) { } static int32_t translateSetOperator(STranslateContext* pCxt, SSetOperator* pSetOperator) { + if (pCxt->pParseCxt && pCxt->pParseCxt->setQueryFp) { + (*pCxt->pParseCxt->setQueryFp)(pCxt->pParseCxt->requestRid); + } + int32_t code = translateQuery(pCxt, pSetOperator->pLeft); if (TSDB_CODE_SUCCESS == code) { code = resetHighLevelTranslateNamespace(pCxt); @@ -7968,7 +8005,7 @@ static int32_t columnDefNodeToField(SNodeList* pList, SArray** pArray, bool calB } } if (TSDB_CODE_SUCCESS != code) { - (void)taosArrayDestroy(*pArray); + taosArrayDestroy(*pArray); *pArray = NULL; } return code; @@ -7992,7 +8029,11 @@ static int32_t tagDefNodeToField(SNodeList* pList, SArray** pArray, bool calByte if (pCol->sma) { field.flags |= COL_SMA_ON; } - (void)taosArrayPush(*pArray, &field); + if (NULL == taosArrayPush(*pArray, &field)) { + taosArrayDestroy(*pArray); + *pArray = NULL; + return terrno; + } } return TSDB_CODE_SUCCESS; } @@ -8734,7 +8775,13 @@ static int32_t buildRollupFuncs(SNodeList* pFuncs, SArray** pArray) { *pArray = taosArrayInit(LIST_LENGTH(pFuncs), TSDB_FUNC_NAME_LEN); if (!*pArray) return TSDB_CODE_OUT_OF_MEMORY; SNode* pNode; - FOREACH(pNode, pFuncs) { (void)taosArrayPush(*pArray, ((SFunctionNode*)pNode)->functionName); } + FOREACH(pNode, pFuncs) { + if (NULL == taosArrayPush(*pArray, ((SFunctionNode*)pNode)->functionName)) { + taosArrayDestroy(*pArray); + *pArray = NULL; + return terrno; + } + } return TSDB_CODE_SUCCESS; } @@ -8899,7 +8946,7 @@ static int32_t buildAlterSuperTableReq(STranslateContext* pCxt, SAlterTableStmt* break; } case TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION: { - (void)taosArrayDestroy(pAlterReq->pFields); + taosArrayDestroy(pAlterReq->pFields); pAlterReq->pFields = taosArrayInit(1, sizeof(SFieldWithOptions)); if (!pAlterReq->pFields) return TSDB_CODE_OUT_OF_MEMORY; @@ -10593,7 +10640,7 @@ static int32_t adjustOrderOfProjections(STranslateContext* pCxt, SNodeList** ppC } if (TSDB_CODE_SUCCESS == code) { - (void)taosArrayDestroy(pProjColPos); + taosArrayDestroy(pProjColPos); nodesDestroyList(*pProjections); nodesDestroyList(*ppCols); *pProjections = pNewProjections; @@ -10705,7 +10752,7 @@ static int32_t adjustOrderOfTags(STranslateContext* pCxt, SNodeList* pTags, cons } if (TSDB_CODE_SUCCESS == code) { - (void)taosArrayDestroy(pTagPos); + taosArrayDestroy(pTagPos); nodesDestroyList(*pTagExprs); *pTagExprs = pNewTagExprs; } else { @@ -13331,7 +13378,7 @@ static void destroyCreateTbReqBatch(void* data) { tdDestroySVCreateTbReq(pTableReq); } - (void)taosArrayDestroy(pTbBatch->req.pArray); + taosArrayDestroy(pTbBatch->req.pArray); } int32_t rewriteToVnodeModifyOpStmt(SQuery* pQuery, SArray* pBufArray) { @@ -13354,7 +13401,7 @@ static void destroyCreateTbReqArray(SArray* pArray) { taosMemoryFreeClear(pVg->pData); taosMemoryFreeClear(pVg); } - (void)taosArrayDestroy(pArray); + taosArrayDestroy(pArray); } static int32_t buildCreateTableDataBlock(int32_t acctId, const SCreateTableStmt* pStmt, const SVgroupInfo* pInfo, @@ -13443,12 +13490,12 @@ static int32_t addCreateTbReqIntoVgroup(SHashObj* pVgroupHashmap, const char* db if (!tBatch.req.pArray) { code = terrno; } else if (NULL == taosArrayPush(tBatch.req.pArray, &req)) { - (void)taosArrayDestroy(tBatch.req.pArray); + taosArrayDestroy(tBatch.req.pArray); code = TSDB_CODE_OUT_OF_MEMORY; } else { code = taosHashPut(pVgroupHashmap, &pVgInfo->vgId, sizeof(pVgInfo->vgId), &tBatch, sizeof(tBatch)); if (TSDB_CODE_SUCCESS != code) { - (void)taosArrayDestroy(tBatch.req.pArray); + taosArrayDestroy(tBatch.req.pArray); } } } else { // add to the correct vgroup @@ -13545,7 +13592,7 @@ static int32_t buildKVRowForBindTags(STranslateContext* pCxt, SCreateSubTableCla taosMemoryFreeClear(p->pData); } } - (void)taosArrayDestroy(pTagArray); + taosArrayDestroy(pTagArray); return code; } @@ -13608,7 +13655,7 @@ static int32_t buildKVRowForAllTags(STranslateContext* pCxt, SCreateSubTableClau taosMemoryFreeClear(p->pData); } } - (void)taosArrayDestroy(pTagArray); + taosArrayDestroy(pTagArray); return code; } @@ -13659,7 +13706,7 @@ static int32_t rewriteCreateSubTable(STranslateContext* pCxt, SCreateSubTableCla taosMemoryFree(pTag); } - (void)taosArrayDestroy(tagName); + taosArrayDestroy(tagName); taosMemoryFreeClear(pSuperTableMeta); return code; } @@ -14066,10 +14113,9 @@ _ERR: return code; } -static int32_t resetParseFileContext(SParseFileContext* pParFileCxt) { +static void resetParseFileContext(SParseFileContext* pParFileCxt) { taosArrayClear(pParFileCxt->aCreateTbData); taosArrayClearEx(pParFileCxt->aTagVals, clearTagValArrayFp); - return TSDB_CODE_SUCCESS; } static int32_t createSubTableFromFile(SMsgBuf* pMsgBuf, SParseContext* pParseCxt, SVnodeModifyOpStmt* pModifyStmt) { @@ -14104,7 +14150,7 @@ static int32_t createSubTableFromFile(SMsgBuf* pMsgBuf, SParseContext* pParseCxt } } - (void)resetParseFileContext(pModifyStmt->pParFileCxt); + resetParseFileContext(pModifyStmt->pParFileCxt); return code; } @@ -14132,7 +14178,7 @@ int32_t serializeVgroupsCreateTableBatch(SHashObj* pVgroupHashmap, SArray** pOut } while (true); if (TSDB_CODE_SUCCESS != code) { - (void)taosArrayDestroy(pBufArray); + taosArrayDestroy(pBufArray); } else { *pOut = pBufArray; } @@ -14258,14 +14304,14 @@ static int32_t addDropTbReqIntoVgroup(SHashObj* pVgroupHashmap, SVgroupInfo* pVg tBatch.info = *pVgInfo; tBatch.req.pArray = taosArrayInit(TARRAY_MIN_SIZE, sizeof(SVDropTbReq)); if (NULL == taosArrayPush(tBatch.req.pArray, pReq)) { - (void)taosArrayDestroy(tBatch.req.pArray); + taosArrayDestroy(tBatch.req.pArray); tBatch.req.pArray = NULL; return TSDB_CODE_OUT_OF_MEMORY; } code = taosHashPut(pVgroupHashmap, &pVgInfo->vgId, sizeof(pVgInfo->vgId), &tBatch, sizeof(tBatch)); if (TSDB_CODE_SUCCESS != code) { - (void)taosArrayDestroy(tBatch.req.pArray); + taosArrayDestroy(tBatch.req.pArray); tBatch.req.pArray = NULL; return code; } @@ -14312,7 +14358,7 @@ over: static void destroyDropTbReqBatch(void* data) { SVgroupDropTableBatch* pTbBatch = (SVgroupDropTableBatch*)data; - (void)taosArrayDestroy(pTbBatch->req.pArray); + taosArrayDestroy(pTbBatch->req.pArray); } static int32_t serializeVgroupDropTableBatch(SVgroupDropTableBatch* pTbBatch, SArray* pBufArray) { @@ -14374,7 +14420,7 @@ int32_t serializeVgroupsDropTableBatch(SHashObj* pVgroupHashmap, SArray** pOut) code = serializeVgroupDropTableBatch(pTbBatch, pBufArray); if (TSDB_CODE_SUCCESS != code) { taosHashCancelIterate(pVgroupHashmap, pTbBatch); - (void)taosArrayDestroy(pBufArray); + taosArrayDestroy(pBufArray); break; } } while (true); @@ -14452,7 +14498,7 @@ static int32_t rewriteDropTable(STranslateContext* pCxt, SQuery* pQuery) { if (TSDB_CODE_SUCCESS == code) { code = buildCmdMsg(pCxt, TDMT_MND_DROP_TB_WITH_TSMA, (FSerializeFunc)tSerializeSMDropTbsReq, &req); } - (void)taosArrayDestroy(req.pVgReqs); + taosArrayDestroy(req.pVgReqs); } taosHashCleanup(pVgroupHashmap); return code; @@ -14817,7 +14863,7 @@ static int32_t buildModifyVnodeArray(STranslateContext* pCxt, SAlterTableStmt* p if (TSDB_CODE_SUCCESS == code) { *pArray = pTmpArray; } else { - (void)taosArrayDestroy(pTmpArray); + taosArrayDestroy(pTmpArray); } return code; @@ -14835,7 +14881,7 @@ static void destoryAlterTbReq(SVAlterTbReq* pReq) { taosMemoryFreeClear(p->pData); } } - (void)taosArrayDestroy(pReq->pTagArray); + taosArrayDestroy(pReq->pTagArray); if (pReq->tagFree) tTagFree((STag*)pReq->pTagVal); } @@ -14920,7 +14966,7 @@ static int32_t serializeFlushDb(SArray* pVgs, SArray** pOutput) { for (int32_t i = 0; i < numOfVgs; ++i) { int32_t code = serializeFlushVgroup((SVgroupInfo*)taosArrayGet(pVgs, i), pBufArray); if (TSDB_CODE_SUCCESS != code) { - (void)taosArrayDestroy(pBufArray); + taosArrayDestroy(pBufArray); return code; } } @@ -14942,9 +14988,9 @@ static int32_t rewriteFlushDatabase(STranslateContext* pCxt, SQuery* pQuery) { code = rewriteToVnodeModifyOpStmt(pQuery, pBufArray); } if (TSDB_CODE_SUCCESS != code) { - (void)taosArrayDestroy(pBufArray); + taosArrayDestroy(pBufArray); } - (void)taosArrayDestroy(pVgs); + taosArrayDestroy(pVgs); return code; } @@ -15577,7 +15623,7 @@ static int32_t toMsgType(ENodeType type) { static int32_t setRefreshMeta(STranslateContext* pCxt, SQuery* pQuery) { if (NULL != pCxt->pDbs) { - (void)taosArrayDestroy(pQuery->pDbList); + taosArrayDestroy(pQuery->pDbList); pQuery->pDbList = taosArrayInit(taosHashGetSize(pCxt->pDbs), TSDB_DB_FNAME_LEN); if (NULL == pQuery->pDbList) { return TSDB_CODE_OUT_OF_MEMORY; @@ -15593,7 +15639,7 @@ static int32_t setRefreshMeta(STranslateContext* pCxt, SQuery* pQuery) { } if (NULL != pCxt->pTables) { - (void)taosArrayDestroy(pQuery->pTableList); + taosArrayDestroy(pQuery->pTableList); pQuery->pTableList = taosArrayInit(taosHashGetSize(pCxt->pTables), sizeof(SName)); if (NULL == pQuery->pTableList) { return TSDB_CODE_OUT_OF_MEMORY; @@ -15609,7 +15655,7 @@ static int32_t setRefreshMeta(STranslateContext* pCxt, SQuery* pQuery) { } if (NULL != pCxt->pTargetTables) { - (void)taosArrayDestroy(pQuery->pTargetTableList); + taosArrayDestroy(pQuery->pTargetTableList); pQuery->pTargetTableList = taosArrayInit(taosHashGetSize(pCxt->pTargetTables), sizeof(SName)); if (NULL == pQuery->pTargetTableList) { return TSDB_CODE_OUT_OF_MEMORY; 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/parser/test/parSelectTest.cpp b/source/libs/parser/test/parSelectTest.cpp index 028bb8f910..61d9134f41 100644 --- a/source/libs/parser/test/parSelectTest.cpp +++ b/source/libs/parser/test/parSelectTest.cpp @@ -366,9 +366,9 @@ TEST_F(ParserSelectTest, semanticCheck) { run("SELECT t1.c1, t1.cc1 FROM t1", TSDB_CODE_PAR_INVALID_COLUMN); // TSDB_CODE_PAR_GET_META_ERROR - run("SELECT * FROM t10", TSDB_CODE_PAR_GET_META_ERROR); + run("SELECT * FROM t10", TSDB_CODE_PAR_TABLE_NOT_EXIST); - run("SELECT * FROM test.t10", TSDB_CODE_PAR_GET_META_ERROR); + run("SELECT * FROM test.t10", TSDB_CODE_PAR_TABLE_NOT_EXIST); // TSDB_CODE_PAR_TABLE_NOT_EXIST run("SELECT t2.c1 FROM t1", TSDB_CODE_PAR_TABLE_NOT_EXIST); diff --git a/source/libs/qcom/src/queryUtil.c b/source/libs/qcom/src/queryUtil.c index d47a183121..34821d05cd 100644 --- a/source/libs/qcom/src/queryUtil.c +++ b/source/libs/qcom/src/queryUtil.c @@ -586,7 +586,7 @@ int32_t cloneDbVgInfo(SDBVgInfo* pSrc, SDBVgInfo** pDst) { } memcpy(*pDst, pSrc, sizeof(*pSrc)); (*pDst)->vgArray = NULL; - + if (pSrc->vgHash) { (*pDst)->vgHash = taosHashInit(taosHashGetSize(pSrc->vgHash), taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_ENTRY_LOCK); diff --git a/source/libs/qcom/src/querymsg.c b/source/libs/qcom/src/querymsg.c index 207bd91bd9..b5b660a51b 100644 --- a/source/libs/qcom/src/querymsg.c +++ b/source/libs/qcom/src/querymsg.c @@ -574,7 +574,7 @@ int32_t queryProcessTableMetaRsp(void *output, char *msg, int32_t msgSize) { goto PROCESS_META_OVER; } - if (0 != strcmp(metaRsp.dbFName, TSDB_INFORMATION_SCHEMA_DB) && + if (!IS_SYS_DBNAME(metaRsp.dbFName) && !tIsValidSchema(metaRsp.pSchemas, metaRsp.numOfColumns, metaRsp.numOfTags)) { code = TSDB_CODE_TSC_INVALID_VALUE; goto PROCESS_META_OVER; diff --git a/source/libs/scalar/src/filter.c b/source/libs/scalar/src/filter.c index fb3845c032..696222784e 100644 --- a/source/libs/scalar/src/filter.c +++ b/source/libs/scalar/src/filter.c @@ -1706,7 +1706,9 @@ EDealRes fltTreeToGroup(SNode *pNode, void *pContext) { cell = cell->pNext; } - (void)taosArrayAddAll(ctx->group, preGroup); + if (NULL == taosArrayAddAll(ctx->group, preGroup)) { + FLT_ERR_JRET(terrno); + } taosArrayDestroy(preGroup); @@ -5236,22 +5238,20 @@ int32_t filterExecute(SFilterInfo *info, SSDataBlock *pSrc, SColumnInfoData **p, *pResultStatus = FILTER_RESULT_ALL_QUALIFIED; return TSDB_CODE_SUCCESS; } - + int32_t code = TSDB_CODE_SUCCESS; SScalarParam output = {0}; SDataType type = {.type = TSDB_DATA_TYPE_BOOL, .bytes = sizeof(bool)}; - int32_t code = sclCreateColumnInfoData(&type, pSrc->info.rows, &output); - if (code != TSDB_CODE_SUCCESS) { - return code; - } + FLT_ERR_JRET(sclCreateColumnInfoData(&type, pSrc->info.rows, &output)); if (info->scalarMode) { SArray *pList = taosArrayInit(1, POINTER_BYTES); if (NULL == pList) { - FLT_ERR_RET(terrno); + FLT_ERR_JRET(terrno); } if (NULL == taosArrayPush(pList, &pSrc)) { - FLT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + taosArrayDestroy(pList); + FLT_ERR_JRET(terrno); } code = scalarCalculate(info->sclCtx.node, pList, &output); @@ -5259,7 +5259,7 @@ int32_t filterExecute(SFilterInfo *info, SSDataBlock *pSrc, SColumnInfoData **p, *p = output.columnData; - FLT_ERR_RET(code); + FLT_ERR_JRET(code); if (output.numOfQualified == output.numOfRows) { *pResultStatus = FILTER_RESULT_ALL_QUALIFIED; @@ -5275,11 +5275,12 @@ int32_t filterExecute(SFilterInfo *info, SSDataBlock *pSrc, SColumnInfoData **p, output.numOfRows = pSrc->info.rows; if (*p == NULL) { - return TSDB_CODE_APP_ERROR; + fltError("filterExecute failed, column data is NULL"); + FLT_ERR_JRET(TSDB_CODE_APP_ERROR); } bool keepAll = false; - FLT_ERR_RET((info->func)(info, pSrc->info.rows, *p, statis, numOfCols, &output.numOfQualified, &keepAll)); + FLT_ERR_JRET((info->func)(info, pSrc->info.rows, *p, statis, numOfCols, &output.numOfQualified, &keepAll)); // todo this should be return during filter procedure if (keepAll) { @@ -5302,6 +5303,10 @@ int32_t filterExecute(SFilterInfo *info, SSDataBlock *pSrc, SColumnInfoData **p, } return TSDB_CODE_SUCCESS; +_return: + sclFreeParam(&output); + *p = NULL; + return code; } typedef struct SClassifyConditionCxt { 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/schRemote.c b/source/libs/scheduler/src/schRemote.c index ad720e15f5..4e34a47902 100644 --- a/source/libs/scheduler/src/schRemote.c +++ b/source/libs/scheduler/src/schRemote.c @@ -982,6 +982,7 @@ int32_t schAsyncSendMsg(SSchJob *pJob, SSchTask *pTask, SSchTrans *trans, SQuery SCH_ERR_JRET(code); } trans->pHandle = (void *)refId; + pMsgSendInfo->msgInfo.handle =trans->pHandle; } if (pJob && pTask) { @@ -996,8 +997,7 @@ int32_t schAsyncSendMsg(SSchJob *pJob, SSchTask *pTask, SSchTrans *trans, SQuery pTask->lastMsgType = msgType; } - int64_t transporterId = 0; - code = asyncSendMsgToServerExt(trans->pTrans, epSet, &transporterId, pMsgSendInfo, persistHandle, ctx); + code = asyncSendMsgToServerExt(trans->pTrans, epSet, NULL, pMsgSendInfo, persistHandle, ctx); pMsgSendInfo = NULL; if (code) { SCH_ERR_JRET(code); 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/streamDispatch.c b/source/libs/stream/src/streamDispatch.c index 17aef821f8..0bc090cdfe 100644 --- a/source/libs/stream/src/streamDispatch.c +++ b/source/libs/stream/src/streamDispatch.c @@ -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); @@ -845,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); @@ -1168,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); diff --git a/source/libs/stream/src/streamHb.c b/source/libs/stream/src/streamHb.c index 1ef938494e..1fd3106cff 100644 --- a/source/libs/stream/src/streamHb.c +++ b/source/libs/stream/src/streamHb.c @@ -95,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; } diff --git a/source/libs/stream/src/streamTask.c b/source/libs/stream/src/streamTask.c index 416faa7487..0791784656 100644 --- a/source/libs/stream/src/streamTask.c +++ b/source/libs/stream/src/streamTask.c @@ -870,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; } @@ -1021,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; } 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/transComm.h b/source/libs/transport/inc/transComm.h index 84f0ffc8cb..95ea6944e3 100644 --- a/source/libs/transport/inc/transComm.h +++ b/source/libs/transport/inc/transComm.h @@ -272,19 +272,19 @@ bool transAsyncPoolIsEmpty(SAsyncPool* pool); } \ } while (0) -#define ASYNC_CHECK_HANDLE(exh1, id) \ - do { \ - if (id > 0) { \ - SExHandle* exh2 = transAcquireExHandle(transGetRefMgt(), id); \ - if (exh2 == NULL || id != exh2->refId) { \ - tDebug("ref:%" PRId64 " already released" PRIu64, id); \ - code = terrno; \ - goto _return1; \ - } \ - } else { \ - tWarn("invalid handle to release"); \ - goto _return2; \ - } \ +#define ASYNC_CHECK_HANDLE(exh1, id) \ + do { \ + if (id > 0) { \ + SExHandle* exh2 = transAcquireExHandle(transGetSvrRefMgt(), id); \ + if (exh2 == NULL || id != exh2->refId) { \ + tDebug("ref:%" PRId64 " already released", id); \ + code = terrno; \ + goto _return1; \ + } \ + } else { \ + tDebug("invalid handle to release"); \ + goto _return2; \ + } \ } while (0) int32_t transInitBuffer(SConnBuffer* buf); @@ -443,6 +443,7 @@ int32_t transReleaseExHandle(int32_t refMgt, int64_t refId); void transDestroyExHandle(void* handle); int32_t transGetRefMgt(); +int32_t transGetSvrRefMgt(); int32_t transGetInstMgt(); int32_t transGetSyncMsgMgt(); diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index dfa9595eb0..78320c450c 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -1496,9 +1496,10 @@ static void cliHandleFastFail(SCliConn* pConn, int status) { } } else { SFailFastItem item = {.count = 1, .timestamp = cTimestamp}; - int32_t code = 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)); + tError("failed to put fail-fast item to cache, reason:%s", tstrerror(code)); } } } @@ -2980,7 +2981,9 @@ int32_t transSendRequest(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, S QUEUE_PUSH(&exh->q, &pCliMsg->seqq); taosWUnLockLatch(&exh->latch); + tDebug("msg refId: %" PRId64 "", handle); + (void)transReleaseExHandle(transGetRefMgt(), handle); (void)transReleaseExHandle(transGetInstMgt(), (int64_t)shandle); return 0; } else { diff --git a/source/libs/transport/src/transComm.c b/source/libs/transport/src/transComm.c index 1758ca65cc..1329489be6 100644 --- a/source/libs/transport/src/transComm.c +++ b/source/libs/transport/src/transComm.c @@ -20,6 +20,7 @@ static TdThreadOnce transModuleInit = PTHREAD_ONCE_INIT; static int32_t refMgt; +static int32_t svrRefMgt; static int32_t instMgt; static int32_t transSyncMsgMgt; @@ -704,12 +705,14 @@ bool transEpSetIsEqual2(SEpSet* a, SEpSet* b) { static void transInitEnv() { refMgt = transOpenRefMgt(50000, transDestroyExHandle); + svrRefMgt = transOpenRefMgt(50000, transDestroyExHandle); instMgt = taosOpenRef(50, rpcCloseImpl); transSyncMsgMgt = taosOpenRef(50, transDestroySyncMsg); (void)uv_os_setenv("UV_TCP_SINGLE_ACCEPT", "1"); } static void transDestroyEnv() { transCloseRefMgt(refMgt); + transCloseRefMgt(svrRefMgt); transCloseRefMgt(instMgt); transCloseRefMgt(transSyncMsgMgt); } @@ -724,6 +727,7 @@ int32_t transInit() { } int32_t transGetRefMgt() { return refMgt; } +int32_t transGetSvrRefMgt() { return svrRefMgt; } int32_t transGetInstMgt() { return instMgt; } int32_t transGetSyncMsgMgt() { return transSyncMsgMgt; } diff --git a/source/libs/transport/src/transSvr.c b/source/libs/transport/src/transSvr.c index 53a7dee7be..11aa468b19 100644 --- a/source/libs/transport/src/transSvr.c +++ b/source/libs/transport/src/transSvr.c @@ -373,6 +373,7 @@ static bool uvHandleReq(SSvrConn* pConn) { STrans* pTransInst = pConn->pTransInst; SWorkThrd* pThrd = pConn->hostThrd; + int8_t acquire = 0; STransMsgHead* pHead = NULL; int8_t resetBuf = pConn->status == ConnAcquire ? 0 : 1; @@ -459,7 +460,13 @@ static bool uvHandleReq(SSvrConn* pConn) { // 2. once send out data, cli conn released to conn pool immediately // 3. not mixed with persist transMsg.info.ahandle = (void*)pHead->ahandle; - transMsg.info.handle = (void*)transAcquireExHandle(transGetRefMgt(), pConn->refId); + + if (pHead->noResp == 1) { + transMsg.info.handle = NULL; + } else { + transMsg.info.handle = (void*)transAcquireExHandle(transGetSvrRefMgt(), pConn->refId); + acquire = 1; + } transMsg.info.refId = pConn->refId; transMsg.info.traceId = pHead->traceId; transMsg.info.cliVer = htonl(pHead->compatibilityVer); @@ -468,10 +475,10 @@ static bool uvHandleReq(SSvrConn* pConn) { tGTrace("%s handle %p conn:%p translated to app, refId:%" PRIu64, transLabel(pTransInst), transMsg.info.handle, pConn, pConn->refId); - if (transMsg.info.handle == NULL) { - tError("%s handle %p conn:%p handle failed to init" PRIu64, transLabel(pTransInst), transMsg.info.handle, pConn); - return false; - } + // if (transMsg.info.handle == NULL) { + // tError("%s handle %p conn:%p handle failed to init" PRIu64, transLabel(pTransInst), transMsg.info.handle, pConn); + // return false; + // } if (pHead->noResp == 1) { transMsg.info.refId = -1; @@ -483,7 +490,7 @@ static bool uvHandleReq(SSvrConn* pConn) { pConnInfo->clientPort = pConn->port; tstrncpy(pConnInfo->user, pConn->user, sizeof(pConnInfo->user)); - (void)transReleaseExHandle(transGetRefMgt(), pConn->refId); + if (acquire) transReleaseExHandle(transGetSvrRefMgt(), pConn->refId); (*pTransInst->cfp)(pTransInst->parent, &transMsg, NULL); return true; @@ -770,15 +777,15 @@ void uvWorkerAsyncCb(uv_async_t* handle) { SExHandle* exh1 = transMsg.info.handle; int64_t refId = transMsg.info.refId; - SExHandle* exh2 = transAcquireExHandle(transGetRefMgt(), refId); + SExHandle* exh2 = transAcquireExHandle(transGetSvrRefMgt(), refId); if (exh2 == NULL || exh1 != exh2) { tTrace("handle except msg %p, ignore it", exh1); - (void)transReleaseExHandle(transGetRefMgt(), refId); + (void)transReleaseExHandle(transGetSvrRefMgt(), refId); destroySmsg(msg); continue; } msg->pConn = exh1->handle; - (void)transReleaseExHandle(transGetRefMgt(), refId); + (void)transReleaseExHandle(transGetSvrRefMgt(), refId); (*transAsyncHandle[msg->type])(msg, pThrd); } } @@ -874,15 +881,15 @@ static void uvPrepareCb(uv_prepare_t* handle) { SExHandle* exh1 = transMsg.info.handle; int64_t refId = transMsg.info.refId; - SExHandle* exh2 = transAcquireExHandle(transGetRefMgt(), refId); + SExHandle* exh2 = transAcquireExHandle(transGetSvrRefMgt(), refId); if (exh2 == NULL || exh1 != exh2) { tTrace("handle except msg %p, ignore it", exh1); - (void)transReleaseExHandle(transGetRefMgt(), refId); + (void)transReleaseExHandle(transGetSvrRefMgt(), refId); destroySmsg(msg); continue; } msg->pConn = exh1->handle; - (void)transReleaseExHandle(transGetRefMgt(), refId); + (void)transReleaseExHandle(transGetSvrRefMgt(), refId); (*transAsyncHandle[msg->type])(msg, pThrd); } } @@ -1215,14 +1222,14 @@ static FORCE_INLINE SSvrConn* createConn(void* hThrd) { exh->handle = pConn; exh->pThrd = pThrd; - exh->refId = transAddExHandle(transGetRefMgt(), exh); + exh->refId = transAddExHandle(transGetSvrRefMgt(), exh); if (exh->refId < 0) { TAOS_CHECK_GOTO(TSDB_CODE_REF_INVALID_ID, NULL, _end); } QUEUE_INIT(&exh->q); - SExHandle* pSelf = transAcquireExHandle(transGetRefMgt(), exh->refId); + SExHandle* pSelf = transAcquireExHandle(transGetSvrRefMgt(), exh->refId); if (pSelf != exh) { TAOS_CHECK_GOTO(TSDB_CODE_REF_INVALID_ID, NULL, _end); } @@ -1284,8 +1291,8 @@ static FORCE_INLINE void destroyConnRegArg(SSvrConn* conn) { } static int32_t reallocConnRef(SSvrConn* conn) { if (conn->refId > 0) { - (void)transReleaseExHandle(transGetRefMgt(), conn->refId); - (void)transRemoveExHandle(transGetRefMgt(), conn->refId); + (void)transReleaseExHandle(transGetSvrRefMgt(), conn->refId); + (void)transRemoveExHandle(transGetSvrRefMgt(), conn->refId); } // avoid app continue to send msg on invalid handle SExHandle* exh = taosMemoryMalloc(sizeof(SExHandle)); @@ -1295,14 +1302,14 @@ static int32_t reallocConnRef(SSvrConn* conn) { exh->handle = conn; exh->pThrd = conn->hostThrd; - exh->refId = transAddExHandle(transGetRefMgt(), exh); + exh->refId = transAddExHandle(transGetSvrRefMgt(), exh); if (exh->refId < 0) { taosMemoryFree(exh); return TSDB_CODE_REF_INVALID_ID; } QUEUE_INIT(&exh->q); - SExHandle* pSelf = transAcquireExHandle(transGetRefMgt(), exh->refId); + SExHandle* pSelf = transAcquireExHandle(transGetSvrRefMgt(), exh->refId); if (pSelf != exh) { tError("conn %p failed to acquire handle", conn); taosMemoryFree(exh); @@ -1321,8 +1328,8 @@ static void uvDestroyConn(uv_handle_t* handle) { } SWorkThrd* thrd = conn->hostThrd; - (void)transReleaseExHandle(transGetRefMgt(), conn->refId); - (void)transRemoveExHandle(transGetRefMgt(), conn->refId); + (void)transReleaseExHandle(transGetSvrRefMgt(), conn->refId); + (void)transRemoveExHandle(transGetSvrRefMgt(), conn->refId); STrans* pTransInst = thrd->pTransInst; tDebug("%s conn %p destroy", transLabel(pTransInst), conn); @@ -1752,15 +1759,15 @@ int32_t transReleaseSrvHandle(void* handle) { tDebug("%s conn %p start to release", transLabel(pThrd->pTransInst), exh->handle); if ((code = transAsyncSend(pThrd->asyncPool, &m->q)) != 0) { destroySmsg(m); - (void)transReleaseExHandle(transGetRefMgt(), refId); + (void)transReleaseExHandle(transGetSvrRefMgt(), refId); return code; } - (void)transReleaseExHandle(transGetRefMgt(), refId); + (void)transReleaseExHandle(transGetSvrRefMgt(), refId); return 0; _return1: tDebug("handle %p failed to send to release handle", exh); - (void)transReleaseExHandle(transGetRefMgt(), refId); + (void)transReleaseExHandle(transGetSvrRefMgt(), refId); return code; _return2: tDebug("handle %p failed to send to release handle", exh); @@ -1803,17 +1810,17 @@ int32_t transSendResponse(const STransMsg* msg) { tGDebug("conn %p start to send resp (1/2)", exh->handle); if ((code = transAsyncSend(pThrd->asyncPool, &m->q)) != 0) { destroySmsg(m); - (void)transReleaseExHandle(transGetRefMgt(), refId); + (void)transReleaseExHandle(transGetSvrRefMgt(), refId); return code; } - (void)transReleaseExHandle(transGetRefMgt(), refId); + (void)transReleaseExHandle(transGetSvrRefMgt(), refId); return 0; _return1: tDebug("handle %p failed to send resp", exh); rpcFreeCont(msg->pCont); - (void)transReleaseExHandle(transGetRefMgt(), refId); + (void)transReleaseExHandle(transGetSvrRefMgt(), refId); return code; _return2: tDebug("handle %p failed to send resp", exh); @@ -1848,17 +1855,17 @@ int32_t transRegisterMsg(const STransMsg* msg) { tDebug("%s conn %p start to register brokenlink callback", transLabel(pTransInst), exh->handle); if ((code = transAsyncSend(pThrd->asyncPool, &m->q)) != 0) { destroySmsg(m); - (void)transReleaseExHandle(transGetRefMgt(), refId); + (void)transReleaseExHandle(transGetSvrRefMgt(), refId); return code; } - (void)transReleaseExHandle(transGetRefMgt(), refId); + (void)transReleaseExHandle(transGetSvrRefMgt(), refId); return 0; _return1: tDebug("handle %p failed to register brokenlink", exh); rpcFreeCont(msg->pCont); - (void)transReleaseExHandle(transGetRefMgt(), refId); + (void)transReleaseExHandle(transGetSvrRefMgt(), refId); return code; _return2: tDebug("handle %p failed to register brokenlink", exh); 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/tlrucache.c b/source/util/src/tlrucache.c index 24b60e8d13..7faff88155 100644 --- a/source/util/src/tlrucache.c +++ b/source/util/src/tlrucache.c @@ -445,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/tests/army/frame/taosadapter.py b/tests/army/frame/taosadapter.py index 7830aab08c..e52f555ace 100644 --- a/tests/army/frame/taosadapter.py +++ b/tests/army/frame/taosadapter.py @@ -64,7 +64,7 @@ class TAdapter: "enable" : True }, "node_exporter" : { - "enable" : True + "enable" : False }, "prometheus" : { "enable" : True diff --git a/tests/army/insert/test_column_tag_boundary.py b/tests/army/insert/test_column_tag_boundary.py index 4f1245d728..a3a865ee8f 100644 --- a/tests/army/insert/test_column_tag_boundary.py +++ b/tests/army/insert/test_column_tag_boundary.py @@ -20,8 +20,11 @@ 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.row_num_per_round_varbia_json = 8 + self.rows_all1 = self.insert_round_num * self.row_num_per_round + self.rows_all2 = self.insert_round_num * self.row_num_per_round_varbia_json self.start_ts = 1704082431000 def prepare_data(self): @@ -47,8 +50,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(self.rows_all1) + row_num = random.randint(0, self.rows_all1-1) 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 +74,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(self.rows_all1) + row_num = random.randint(0, self.rows_all1-1) 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,14 +109,14 @@ 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(self.rows_all1) + row_num = random.randint(0, self.rows_all1-1) tdSql.checkData(row_num, 1, column) tdSql.query(f"show tags from ct_nchar{i+1};") tdSql.checkData(0, 5, tag) def test_varbinary_boundary(self): - row_num_per_round = 8 + # create tables tdSql.execute(f"create table st_varbinary (ts timestamp, c1 varbinary({self.max_column_length})) tags (t1 varbinary({self.max_tag_length}));") for i in range(self.child_table_num): @@ -124,22 +127,21 @@ class TDTestCase(TBase): # insert data for j in range(self.insert_round_num): sql = "insert into ct_varbinary%s values" % (i+1) - for k in range(row_num_per_round): + for k in range(self.row_num_per_round_varbia_json): sql += "(%s, '%s')," % (str(self.start_ts + (j * self.insert_round_num + k * self.row_num_per_round + 1)), '\\x' + column) tdSql.execute(sql) - tdLog.info(f"Insert {row_num_per_round} rows data into ct_varbinary{i+1} {j+1} times successfully") + tdLog.info(f"Insert {self.row_num_per_round_varbia_json} rows data into ct_varbinary{i+1} {j+1} times successfully") tdSql.execute("flush database db;") # 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(self.rows_all2) + row_num = random.randint(0, self.rows_all2-1) 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()) def test_json_tag_boundary(self): - row_num_per_round = 8 max_json_tag_length = 4095 max_json_tag_key_length = 256 # create tables @@ -153,16 +155,16 @@ class TDTestCase(TBase): # insert data for j in range(self.insert_round_num): sql = "insert into ct_json_tag%s values" % (i+1) - for k in range(row_num_per_round): + for k in range(self.row_num_per_round_varbia_json): sql += "(%s, '%s')," % (str(self.start_ts + (j * self.insert_round_num + k * self.row_num_per_round + 1)), '\\x' + column) tdSql.execute(sql) - tdLog.info(f"Insert {row_num_per_round} rows data into ct_json_tag{i+1} {j+1} times successfully") + tdLog.info(f"Insert {self.row_num_per_round_varbia_json} rows data into ct_json_tag{i+1} {j+1} times successfully") tdSql.execute("flush database db;") # 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(self.rows_all2) + row_num = random.randint(0, self.rows_all2-1) tdSql.checkData(row_num, 1, bytes.fromhex(column)) def run(self): diff --git a/tests/army/query/function/test_function.py b/tests/army/query/function/test_function.py index d9bc255700..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 @@ -508,6 +506,11 @@ class TDTestCase(TBase): 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__}") @@ -547,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/army/win-test-file b/tests/army/win-test-file new file mode 100644 index 0000000000..b4f5c9312d --- /dev/null +++ b/tests/army/win-test-file @@ -0,0 +1,29 @@ +python3 ./test.py -f multi-level/mlevel_basic.py -N 3 -L 3 -D 2 +python3 ./test.py -f db-encrypt/basic.py +python3 ./test.py -f s3/s3Basic.py -N 3 +python3 ./test.py -f cluster/snapshot.py -N 3 -L 3 -D 2 +python3 ./test.py -f query/function/test_func_elapsed.py +python3 ./test.py -f query/function/concat.py +python3 ./test.py -f query/function/cast.py +python3 ./test.py -f query/test_join.py +python3 ./test.py -f query/test_compare.py +python3 ./test.py -f insert/test_column_tag_boundary.py +python3 ./test.py -f query/fill/fill_desc.py -N 3 -L 3 -D 2 +python3 ./test.py -f query/fill/fill_null.py +python3 ./test.py -f cluster/incSnapshot.py -N 3 +python3 ./test.py -f query/query_basic.py -N 3 +python3 ./test.py -f query/accuracy/test_query_accuracy.py +python3 ./test.py -f insert/insert_basic.py -N 3 +python3 ./test.py -f cluster/splitVgroupByLearner.py -N 3 +python3 ./test.py -f authorith/authBasic.py -N 3 +python3 ./test.py -f cmdline/fullopt.py +python3 ./test.py -f query/show.py -N 3 +python3 ./test.py -f alter/alterConfig.py -N 3 +python3 ./test.py -f query/subquery/subqueryBugs.py -N 3 +python3 ./test.py -f storage/oneStageComp.py -N 3 -L 3 -D 1 +python3 ./test.py -f storage/compressBasic.py -N 3 +python3 ./test.py -f grant/grantBugs.py -N 3 +python3 ./test.py -f query/queryBugs.py -N 3 +python3 ./test.py -f tmq/tmqBugs.py -N 3 +python3 ./test.py -f query/fill/fill_compare_asc_desc.py +python3 ./test.py -f query/last/test_last.py diff --git a/tests/ci/count_assert.py b/tests/ci/count_assert.py index 415c197b3f..aecc57578d 100644 --- a/tests/ci/count_assert.py +++ b/tests/ci/count_assert.py @@ -1,23 +1,47 @@ import os import re +from loguru import logger # List of source directories to search + +self_path = os.path.dirname(os.path.realpath(__file__)) + +# Check if "community" or "tests" is in self_path +index_community = self_path.find("community") +if index_community != -1: + TD_project_path = self_path[:index_community] + index_TDinternal = TD_project_path.find("TDinternal") + # Check if index_TDinternal is valid and set work_path accordingly + if index_TDinternal != -1: + work_path = TD_project_path[:index_TDinternal] +else: + index_tests = self_path.find("tests") + if index_tests != -1: + TD_project_path = self_path[:index_tests] + # Check if index_TDengine is valid and set work_path accordingly + index_TDengine = TD_project_path.find("TDengine") + if index_TDengine != -1: + work_path = TD_project_path[:index_TDengine] +TD_project_path = TD_project_path.rstrip('/') +print(TD_project_path) source_dirs = [ - "community/source", - "community/include", - "enterprise/src/plugins/" + f"{TD_project_path}/community/source", + f"{TD_project_path}/community/include", + f"{TD_project_path}/enterprise/src/plugins/" ] # List of directories to exclude exclude_dirs = [ - "community/source/client/jni" + f"{TD_project_path}/community/source/client/jni", + f"{TD_project_path}/enterprise/src/plugins/taosx", + f"{TD_project_path}/enterprise/src/plugins/explorer", ] # 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" + f"{TD_project_path}/community/source/libs/parser/src/sql.c", + f"{TD_project_path}/community/source/util/src/tlog.c", + f"{TD_project_path}/community/include/util/tlog.h" ] def grep_asserts_in_file(file_path, summary_list, detaild_list): @@ -26,10 +50,10 @@ def grep_asserts_in_file(file_path, summary_list, detaild_list): 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()}") + detaild_list.append(f"{file_path}:{line.strip()}:{line_number}") match_count += 1 if match_count > 0: - summary_list.append(f"Total matches in {file_path}: {match_count}") + 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.""" @@ -47,7 +71,52 @@ def traverse_and_grep(source_dirs, exclude_dirs, exclude_source_files): grep_asserts_in_file(file_path, summary_list, detaild_list) return summary_list, detaild_list +def check_list_result(result_list,detaild_list): + logger.debug("check assert in source code") + error_message = "ERROR: do not add `assert` statements in new code." + error_message2 = "ERROR: Please check the detailed information below: assert statement with file name and line number" + remove_detail_items = [ + f"{TD_project_path}/community/source/dnode/vnode/src/tsdb/tsdbCommit2.c:ASSERT_CORE(tsdb->imem == NULL, \"imem should be null to commit mem\");", + f"{TD_project_path}/community/include/util/types.h:assert(sizeof(float) == sizeof(uint32_t));", + f"{TD_project_path}/community/include/util/types.h:assert(sizeof(double) == sizeof(uint64_t));" + ] + expected_strings = [ + f"Total matches in {TD_project_path}/community/source/dnode/vnode/src/tsdb/tsdbCommit2.c:1", + f"Total matches in {TD_project_path}/community/include/util/types.h:2" + ] + # logger.debug(len(result_list)) + if len(result_list) != 2: + logger.error(f"{error_message}") + for item in expected_strings: + if item in result_list: + result_list.remove(item) + logger.error("\n" + "\n".join(result_list)) + logger.error(f"{error_message2}") + for item in remove_detail_items: + if item in detaild_list: + detaild_list.remove(item) + logger.error("\n" + "\n".join(detaild_list)) + exit(1) + else: + # check if all expected strings are in the result list + if all(item in result_list for item in expected_strings): + # logger.debug(result_list) + # logger.debug(detaild_list) + if all(any(remove_detail_item in detaild for remove_detail_item in remove_detail_items) for detaild in detaild_list): + logger.info("Validation successful.") + else: + logger.error(f"{error_message}") + for item in expected_strings: + if item in result_list: + result_list.remove(item) + logger.error("\n" + "\n".join(result_list)) + logger.error(f"{error_message2}") + for item in remove_detail_items: + if item in detaild_list: + detaild_list.remove(item) + logger.error("\n" + "\n".join(detaild_list)) + exit(1) 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 + check_list_result(summary_list,detaild_list) + diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 00b17ec73f..e8c765a218 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 diff --git a/tests/parallel_test/run_check_assert_container.sh b/tests/parallel_test/run_check_assert_container.sh new file mode 100755 index 0000000000..e8d78d62ae --- /dev/null +++ b/tests/parallel_test/run_check_assert_container.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +function usage() { + echo "$0" + echo -e "\t -d work dir" + echo -e "\t -h help" +} + +while getopts "d:h" opt; do + case $opt in + d) + WORKDIR=$OPTARG + ;; + h) + usage + exit 0 + ;; + \?) + echo "Invalid option: -$OPTARG" + usage + exit 0 + ;; + esac +done + +if [ -z "$WORKDIR" ]; then + usage + exit 1 +fi + + + # enterprise edition +INTERNAL_REPDIR=$WORKDIR/TDinternal +REPDIR_DEBUG=$WORKDIR/debugNoSan/ + +REP_MOUNT_PARAM="$INTERNAL_REPDIR:/home/TDinternal" + +CONTAINER_TESTDIR=/home/TDinternal/community + +check_assert_scripts="$CONTAINER_TESTDIR/tests/ci/count_assert.py" + +ulimit -c unlimited +cat << EOF +docker run \ + -v $REP_MOUNT_PARAM \ + --rm --ulimit core=-1 taos_test:v1.0 python3 $check_assert_scripts +EOF +docker run \ + -v $REP_MOUNT_PARAM \ + --rm --ulimit core=-1 taos_test:v1.0 python3 $check_assert_scripts + +ret=$? +exit $ret + diff --git a/tests/parallel_test/split_case.sh b/tests/parallel_test/split_case.sh index e237cbf984..3d9bd612d1 100755 --- a/tests/parallel_test/split_case.sh +++ b/tests/parallel_test/split_case.sh @@ -5,20 +5,35 @@ parm_path=$(pwd ${parm_path}) echo "execute path:${parm_path}" cd ${parm_path} cp cases.task ${case_file} -# comment udf and stream case in windows +# comment udf and stream and sma case in windows sed -i '/udf/d' ${case_file} sed -i '/Udf/d' ${case_file} sed -i '/stream/d' ${case_file} sed -i '/^$/d' ${case_file} sed -i '$a\%%FINISHED%%' ${case_file} +#unsupported case:sma +sed -i '/tsim\/sync\/vnodesnapshot-rsma-test.sim/d' ${case_file} +sed -i '/tsim\/sma/d' ${case_file} +sed -i '/tsim\/tagindex\/sma_and_tag_index.sim/d' ${case_file} +#unsupported case:to_char +sed -i '/tsim\/query\/sort-pre-cols.sim/d' ${case_file} +sed -i '/2-query\/nestedQueryInterval.py/d' ${case_file} +#unsupported case:stream +sed -i '/database_pre_suf/d' ${case_file} +sed -i '/tsma/d' ${case_file} + utest="unit-test" tsimtest="script" systest="system-test" devtest="develop-test" doctest="docs-examples-test" -rm -rf win-${utest}.log win-${tsimtest}.log win-${systest}.log win-${devtest}.log win-${doctest}.log -rm -rf ${parm_path}/../${utest}/win-test-file ${parm_path}/../${tsimtest}/win-test-file ${parm_path}/../${systest}/win-test-file ${parm_path}/../${devtest}/win-test-file +armytest="army" + +rm -rf win-${utest}.log win-${tsimtest}.log win-${systest}.log win-${devtest}.log win-${doctest}.log win-${armytest}.log + +rm -rf ${parm_path}/../${utest}/win-test-file ${parm_path}/../${tsimtest}/win-test-file ${parm_path}/../${systest}/win-test-file ${parm_path}/../${devtest}/win-test-file ${parm_path}/../${doctest}/win-test-file ${parm_path}/../${armytest}/win-test-file + while read -r line do echo "$line"|grep -q "^#" @@ -44,6 +59,15 @@ do fi continue fi + if [[ "${exec_dir}" == "${armytest}" ]]; then + if [[ "${case_cmd}" =~ "pytest.sh" ]]; then + case_cmd=$(echo "$case_cmd"|cut -d ' ' -f 2-) + echo "${case_cmd}" >> win-${armytest}.log + else + echo "${case_cmd}" >> win-${armytest}.log + fi + continue + fi if [[ "${exec_dir}" == "${devtest}" ]]; then echo ${case_cmd} >> win-${devtest}.log continue @@ -57,6 +81,7 @@ mv win-${utest}.log ${parm_path}/../${utest}/win-test-file mv win-${tsimtest}.log ${parm_path}/../${tsimtest}/win-test-file mv win-${systest}.log ${parm_path}/../${systest}/win-test-file mv win-${devtest}.log ${parm_path}/../${devtest}/win-test-file - +mv win-${armytest}.log ${parm_path}/../${armytest}/win-test-file +mv win-${doctest}.log ${parm_path}/../${armytest}/win-test-file rm -rf ${case_file} diff --git a/tests/pytest/util/common.py b/tests/pytest/util/common.py index 1141ca403d..1dfcf8b5dd 100644 --- a/tests/pytest/util/common.py +++ b/tests/pytest/util/common.py @@ -979,6 +979,155 @@ class TDCom: for stream_name in stream_name_list: tdSql.execute(f'drop stream if exists {stream_name};') + + def check_stream_wal_info(self, wal_info): + # This method is defined for the 'info' column of the 'information_schema.ins_stream_tasks'. + # Define the regular expression pattern to match the required format + # This pattern looks for a number followed by an optional space and then a pair of square brackets + # containing two numbers separated by a comma. + pattern = r'(\d+)\s*\[(\d+),\s*(\d+)\]' + + # Use the search function from the re module to find a match in the string + match = re.search(pattern, wal_info) + + # Check if a match was found + if match: + # Extract the numbers from the matching groups + first_number = int(match.group(1)) # The number before the brackets + second_number = int(match.group(3)) # The second number inside the brackets + + # Compare the extracted numbers and return the result + if second_number >=5 : + if first_number >= second_number-5 and first_number <= second_number: + return True + elif second_number < 5: + if first_number >= second_number-1 and first_number <= second_number: + return True + + # If no match was found, or the pattern does not match the expected format, return False + return False + + def check_stream_task_status(self, stream_name, vgroups, stream_timeout=None): + """check stream status + + Args: + stream_name (str): stream_name + vgroups (int): vgroups + Returns: + str: status + """ + timeout = self.stream_timeout if stream_timeout is None else stream_timeout + + #check stream task rows + sql_task_all = f"select `task_id`,node_id,stream_name,status,info,history_task_id from information_schema.ins_stream_tasks where stream_name='{stream_name}' and `level`='source';" + sql_task_status = f"select distinct(status) from information_schema.ins_stream_tasks where stream_name='{stream_name}' and `level`='source';" + sql_task_history = f"select distinct(history_task_id) from information_schema.ins_stream_tasks where stream_name='{stream_name}' and `level`='source';" + tdSql.query(sql_task_all) + tdSql.checkRows(vgroups) + + #check stream task status + checktimes = 1 + check_stream_success = 0 + vgroup_num = 0 + while checktimes <= timeout: + tdLog.notice(f"checktimes:{checktimes}") + try: + result_task_alll = tdSql.query(sql_task_all,row_tag=True) + result_task_alll_rows = tdSql.query(sql_task_all) + result_task_status = tdSql.query(sql_task_status,row_tag=True) + result_task_status_rows = tdSql.query(sql_task_status) + result_task_history = tdSql.query(sql_task_history,row_tag=True) + result_task_history_rows = tdSql.query(sql_task_history) + + tdLog.notice(f"Try to check stream status, check times: {checktimes} and stream task list[{check_stream_success}]") + print(f"result_task_status:{result_task_status},result_task_history:{result_task_history},result_task_alll:{result_task_alll}") + if result_task_status_rows == 1 and result_task_status ==[('ready',)] : + if result_task_history_rows == 1 and result_task_history == [(None,)] : + for vgroup_num in range(vgroups): + if self.check_stream_wal_info(result_task_alll[vgroup_num][4]) : + check_stream_success += 1 + tdLog.info(f"check stream task list[{check_stream_success}] sucessfully :") + else: + check_stream_success = 0 + break + + if check_stream_success == vgroups: + break + time.sleep(1) + checktimes += 1 + vgroup_num = vgroup_num + except Exception as e: + tdLog.notice(f"Try to check stream status again, check times: {checktimes}") + checktimes += 1 + tdSql.print_error_frame_info(result_task_alll[vgroup_num],"status is ready,info is finished and history_task_id is NULL",sql_task_all) + else: + checktimes_end = checktimes - 1 + tdLog.notice(f"it has spend {checktimes_end} for checking stream task status but it failed") + if checktimes_end == timeout: + tdSql.print_error_frame_info(result_task_alll[vgroup_num],"status is ready,info is finished and history_task_id is NULL",sql_task_all) + + # def check_stream_task_status(self, stream_name, vgroups, stream_timeout=None): + # """check stream status + + # Args: + # stream_name (str): stream_name + # vgroups (int): vgroups + # Returns: + # str: status + # """ + # timeout = self.stream_timeout if stream_timeout is None else stream_timeout + + # #check stream task rows + # sql_task_all = f"select `task_id`,node_id,stream_name,status,info,history_task_id from information_schema.ins_stream_tasks where stream_name='{stream_name}' and `level`='source';" + # sql_task_status = f"select distinct(status) from information_schema.ins_stream_tasks where stream_name='{stream_name}' and `level`='source';" + # sql_task_history = f"select distinct(history_task_id) from information_schema.ins_stream_tasks where stream_name='{stream_name}' and `level`='source';" + # tdSql.query(sql_task_all) + # tdSql.checkRows(vgroups) + + # #check stream task status + # checktimes = 1 + # check_stream_success = 0 + # vgroup_num = 0 + # while checktimes <= timeout: + # print(f"checktimes:{checktimes}") + # try: + # result_task_alll = tdSql.query(sql_task_all,row_tag=True) + # result_task_alll_rows = tdSql.query(sql_task_all) + # result_task_status = tdSql.query(sql_task_status,row_tag=True) + # result_task_status_rows = tdSql.query(sql_task_status) + # result_task_history = tdSql.query(sql_task_history,row_tag=True) + # result_task_history_rows = tdSql.query(sql_task_history) + + # tdLog.notice(f"Try to check stream status, check times: {checktimes} and stream task list[{check_stream_success}]") + # print(f"result_task_status:{result_task_status},result_task_history:{result_task_history},result_task_alll:{result_task_alll}") + # for vgroup_num in range(vgroups): + # if result_task_alll[vgroup_num][3] == "ready" and self.check_stream_wal_info(result_task_alll[vgroup_num][4]) and result_task_alll[vgroup_num][5] == None: + # check_stream_success += 1 + # tdLog.info(f"check stream task list[{check_stream_success}] sucessfully :") + # else: + # check_stream_success = 0 + # break + + # if check_stream_success == vgroups: + # break + # time.sleep(1) + # checktimes += 1 + # vgroup_num = vgroup_num + # except Exception as e: + # tdLog.notice(f"Try to check stream status again, check times: {checktimes}") + # checktimes += 1 + # tdSql.print_error_frame_info(result_task_alll[vgroup_num],"status is ready,info is finished and history_task_id is NULL",sql_task_all) + + # else: + # checktimes_end = checktimes - 1 + # tdLog.notice(f"it has spend {checktimes_end} for checking stream task status but it failed") + # if checktimes_end == timeout: + # tdSql.print_error_frame_info(result_task_alll[vgroup_num],"status is ready,info is finished and history_task_id is NULL",sql_task_all) + + + + + def drop_db(self, dbname="test"): """drop a db diff --git a/tests/pytest/util/sql.py b/tests/pytest/util/sql.py index 7f6b129bb9..90d3f2fe6c 100644 --- a/tests/pytest/util/sql.py +++ b/tests/pytest/util/sql.py @@ -61,6 +61,13 @@ class TDSql: def close(self): self.cursor.close() + def print_error_frame_info(self, elm, expect_elm, sql=None): + caller = inspect.getframeinfo(inspect.stack()[1][0]) + print_sql = self.sql if sql is None else sql + args = (caller.filename, caller.lineno, print_sql, elm, expect_elm) + # tdLog.info("%s(%d) failed: sql:%s, elm:%s != expect_elm:%s" % args) + raise Exception("%s(%d) failed: sql:%s, elm:%s != expect_elm:%s" % args) + def prepare(self, dbname="db", drop=True, **kwargs): tdLog.info(f"prepare database:{dbname}") s = 'reset query cache' @@ -331,13 +338,14 @@ class TDSql: return self.queryRows def checkRows(self, expectedRows): - if self.queryRows == expectedRows: - tdLog.info("sql:%s, queryRows:%d == expect:%d" % (self.sql, self.queryRows, expectedRows)) - return True - else: - caller = inspect.getframeinfo(inspect.stack()[1][0]) - args = (caller.filename, caller.lineno, self.sql, self.queryRows, expectedRows) - tdLog.exit("%s(%d) failed: sql:%s, queryRows:%d != expect:%d" % args) + return self.checkEqual(self.queryRows, expectedRows) + # if self.queryRows == expectedRows: + # tdLog.info("sql:%s, queryRows:%d == expect:%d" % (self.sql, self.queryRows, expectedRows)) + # return True + # else: + # caller = inspect.getframeinfo(inspect.stack()[1][0]) + # args = (caller.filename, caller.lineno, self.sql, self.queryRows, expectedRows) + # tdLog.exit("%s(%d) failed: sql:%s, queryRows:%d != expect:%d" % args) def checkRows_not_exited(self, expectedRows): """ @@ -636,16 +644,12 @@ class TDSql: def checkEqual(self, elm, expect_elm): if elm == expect_elm: tdLog.info("sql:%s, elm:%s == expect_elm:%s" % (self.sql, elm, expect_elm)) - return + return True if self.__check_equal(elm, expect_elm): tdLog.info("sql:%s, elm:%s == expect_elm:%s" % (self.sql, elm, expect_elm)) - return - - caller = inspect.getframeinfo(inspect.stack()[1][0]) - args = (caller.filename, caller.lineno, self.sql, elm, expect_elm) - # tdLog.info("%s(%d) failed: sql:%s, elm:%s != expect_elm:%s" % args) - raise Exception("%s(%d) failed: sql:%s, elm:%s != expect_elm:%s" % args) - + return True + self.print_error_frame_info(elm, expect_elm) + def checkNotEqual(self, elm, expect_elm): if elm != expect_elm: tdLog.info("sql:%s, elm:%s != expect_elm:%s" % (self.sql, elm, expect_elm)) diff --git a/tests/script/sh/checkAsan.sh b/tests/script/sh/checkAsan.sh index aa73d4cb23..7cba62560d 100755 --- a/tests/script/sh/checkAsan.sh +++ b/tests/script/sh/checkAsan.sh @@ -97,6 +97,6 @@ else if [ $python_error -ne 0 ] || [ $python_taos_error -ne 0 ] ; then cat ${LOG_DIR}/*.info |grep "#" | grep -w "TDinternal" fi - cat ${LOG_DIR}/*.asan + cat ${LOG_DIR}/*.asan |grep "#" | grep -w "TDinternal" exit 1 fi \ No newline at end of file diff --git a/tests/script/sh/stop_dnodes.bat b/tests/script/sh/stop_dnodes.bat index 65aee26ed4..6b82fb4d1d 100644 --- a/tests/script/sh/stop_dnodes.bat +++ b/tests/script/sh/stop_dnodes.bat @@ -4,5 +4,5 @@ rem echo taskkill /F /IM taosd.exe wmic process where "name='taosd.exe'" call terminate > NUL 2>&1 taskkill /F /IM taosd.exe > NUL 2>&1 - +sleep 2 rem echo taskkill /F /IM taosd.exe finished \ No newline at end of file diff --git a/tests/script/sh/stop_dnodes.sh b/tests/script/sh/stop_dnodes.sh index b447a7325e..c462442fa2 100755 --- a/tests/script/sh/stop_dnodes.sh +++ b/tests/script/sh/stop_dnodes.sh @@ -15,42 +15,42 @@ fi PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'` while [ -n "$PID" ]; do - echo kill -15 $PID - #pkill -15 taosd - kill -15 $PID + echo kill -9 $PID + #pkill -9 taosd + kill -9 $PID echo "Killing taosd processes" if [ "$OS_TYPE" != "Darwin" ]; then fuser -k -n tcp 6030 else - lsof -nti:6030 | xargs kill -15 + lsof -nti:6030 | xargs kill -9 fi PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'` done PID=`ps -ef|grep -w taos | grep -v grep | awk '{print $2}'` while [ -n "$PID" ]; do - echo kill -15 $PID + echo kill -9 $PID #pkill -9 taos - kill -15 $PID + kill -9 $PID echo "Killing taos processes" if [ "$OS_TYPE" != "Darwin" ]; then fuser -k -n tcp 6030 else - lsof -nti:6030 | xargs kill -15 + lsof -nti:6030 | xargs kill -9 fi PID=`ps -ef|grep -w taos | grep -v grep | awk '{print $2}'` done PID=`ps -ef|grep -w tmq_sim | grep -v grep | awk '{print $2}'` while [ -n "$PID" ]; do - echo kill -15 $PID - #pkill -15 tmq_sim - kill -15 $PID + echo kill -9 $PID + #pkill -9 tmq_sim + kill -9 $PID echo "Killing tmq_sim processes" if [ "$OS_TYPE" != "Darwin" ]; then fuser -k -n tcp 6030 else - lsof -nti:6030 | xargs kill -15 + lsof -nti:6030 | xargs kill -9 fi PID=`ps -ef|grep -w tmq_sim | grep -v grep | awk '{print $2}'` done \ No newline at end of file diff --git a/tests/script/tsim/query/sys_tbname.sim b/tests/script/tsim/query/sys_tbname.sim index 7739ea5373..dabe4fcdde 100644 --- a/tests/script/tsim/query/sys_tbname.sim +++ b/tests/script/tsim/query/sys_tbname.sim @@ -308,4 +308,4 @@ if $rows != 2 then return -1 endi -#system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/win-test-file b/tests/script/win-test-file index 8c96722c9f..ff69e91967 100644 --- a/tests/script/win-test-file +++ b/tests/script/win-test-file @@ -200,7 +200,6 @@ ./test.sh -f tsim/query/unionall_as_table.sim ./test.sh -f tsim/query/multi_order_by.sim ./test.sh -f tsim/query/sys_tbname.sim -./test.sh -f tsim/query/sort-pre-cols.sim ./test.sh -f tsim/query/groupby.sim ./test.sh -f tsim/query/groupby_distinct.sim ./test.sh -f tsim/query/event.sim @@ -289,12 +288,6 @@ ./test.sh -f tsim/stable/tag_rename.sim ./test.sh -f tsim/stable/values.sim ./test.sh -f tsim/stable/vnode3.sim -./test.sh -f tsim/sma/drop_sma.sim -./test.sh -f tsim/sma/sma_leak.sim -./test.sh -f tsim/sma/tsmaCreateInsertQuery.sim -./test.sh -f tsim/sma/rsmaCreateInsertQuery.sim -./test.sh -f tsim/sma/rsmaCreateInsertQueryDelete.sim -./test.sh -f tsim/sync/vnodesnapshot-rsma-test.sim ./test.sh -f tsim/valgrind/checkError1.sim ./test.sh -f tsim/valgrind/checkError2.sim ./test.sh -f tsim/valgrind/checkError3.sim @@ -406,7 +399,6 @@ ./test.sh -f tsim/tag/tbNameIn.sim ./test.sh -f tmp/monitor.sim ./test.sh -f tsim/tagindex/add_index.sim -./test.sh -f tsim/tagindex/sma_and_tag_index.sim ./test.sh -f tsim/tagindex/indexOverflow.sim ./test.sh -f tsim/view/view.sim ./test.sh -f tsim/query/cache_last.sim diff --git a/tests/system-test/0-others/backquote_check.py b/tests/system-test/0-others/backquote_check.py index 2858373ced..8cb268fb3d 100644 --- a/tests/system-test/0-others/backquote_check.py +++ b/tests/system-test/0-others/backquote_check.py @@ -42,19 +42,19 @@ class TDTestCase: type = 'stable' tdSql.execute(f'create topic if not exists {name} as {type} {name}') tdSql.query('show topics') - tdSql.checkEqual(tdSql.queryResult[0][0],name) + tdSql.checkData(0, 0, name) tdSql.execute(f'drop topic {name}') tdSql.execute(f'create topic if not exists `{name}` as {type} {name}') tdSql.query('show topics') - tdSql.checkEqual(tdSql.queryResult[0][0],name) + tdSql.checkData(0, 0, name) tdSql.execute(f'drop topic {name}') tdSql.execute(f'create topic if not exists `{name}` as {type} `{name}`') tdSql.query('show topics') - tdSql.checkEqual(tdSql.queryResult[0][0],name) + tdSql.checkData(0, 0, name) tdSql.execute(f'drop topic {name}') tdSql.execute(f'create topic if not exists `{name}` as {type} `{name}`') tdSql.query('show topics') - tdSql.checkEqual(tdSql.queryResult[0][0],name) + tdSql.checkData(0, 0, name) tdSql.execute(f'drop topic `{name}`') def db_name_check(self): @@ -70,14 +70,14 @@ class TDTestCase: time.sleep(15) tdSql.query('show streams') - tdSql.checkEqual(tdSql.queryResult[0][0],self.streamname) + tdSql.checkData(0, 0, self.streamname) tdSql.execute(f'drop stream {self.streamname}') tdSql.execute(f'drop stable {self.streamtb}') tdSql.execute(f'create stream {self.streamname} into `{self.streamtb}` as select count(*) from {self.stbname} interval(10s);') time.sleep(10) tdSql.query('show streams') - tdSql.checkEqual(tdSql.queryResult[0][0],self.streamname) + tdSql.checkData(0, 0, self.streamname) tdSql.execute(f'drop stream `{self.streamname}`') tdSql.execute(f'drop database {self.dbname}') @@ -89,17 +89,17 @@ class TDTestCase: tdSql.execute(f'insert into {self.ntbname1} values(now(),1,1)') tdSql.execute(f'insert into {self.ntbname2} values(now(),2,2)') tdSql.query(f'select `{self.ntbname1}`.`c0`, `{self.ntbname1}`.`c1` from `{self.ntbname1}`') - tdSql.checkEqual(tdSql.queryResult[0][0], 1) + tdSql.checkData(0, 0, 1) tdSql.query(f'select `{self.ntbname1}`.`c0`, `{self.ntbname1}`.`c1` from `{self.dbname}`.`{self.ntbname1}`') - tdSql.checkEqual(tdSql.queryResult[0][0], 1) + tdSql.checkData(0, 0, 1) tdSql.query(f'select `{self.ntbname1}`.`c0` from `{self.ntbname2}` `{self.ntbname1}`') - tdSql.checkEqual(tdSql.queryResult[0][0], 2) + tdSql.checkData(0, 0, 2) tdSql.query(f'select `{self.ntbname1}`.`c0` from (select * from `{self.ntbname2}`) `{self.ntbname1}`') - tdSql.checkEqual(tdSql.queryResult[0][0], 2) + tdSql.checkData(0, 0, 2) # select `t1`.`col1`, `col2`, `col3` from (select ts `col1`, 123 `col2`, c0 + c1 as `col3` from t2) `t1`; tdSql.query(f'select `{self.ntbname1}`.`col1`, `col2`, `col3` from (select ts `col1`, 123 `col2`, c0 + c1 as `col3` from {self.ntbname2}) `{self.ntbname1}`') - tdSql.checkEqual(tdSql.queryResult[0][1], 123) - tdSql.checkEqual(tdSql.queryResult[0][2], 4) + tdSql.checkData(0, 1, 123) + tdSql.checkData(0, 2, 4) # tdSql.execute(f'drop database {self.dbname}') @@ -117,15 +117,15 @@ class TDTestCase: tdSql.query(f'select `t1`.`ts`, `t1`.`c0` + `t2`.`c0` as `c0`, `t1`.`c1` * `t2`.`c1` as `c1` from `{self.ntbname1}` `t1` join `{self.ntbname2}` `t2` on timetruncate(`t1`.`ts`, 1s) = timetruncate(`t2`.`ts`, 1s);') tdSql.checkRows(1) - tdSql.checkEqual(tdSql.queryResult[0][1], 3) + tdSql.checkData(0, 1, 3) tdSql.query(f'select `t1`.`ts`, `t1`.`c1`, `t1`.`c2` from (select `ts`, `c0` + 1 as `c1`, `c1` + 2 as `c2` from `{self.ntbname1}`) `t1`;') - tdSql.checkEqual(tdSql.queryResult[0][1], 2) - tdSql.checkEqual(tdSql.queryResult[0][2], 3) + tdSql.checkData(0, 1, 2) + tdSql.checkData(0, 2, 3) tdSql.query(f'select `t`.`ts`, cast(`t`.`v1` as int) + `t`.`c0` as `v` from (select `ts`, "12" as `v1`, `c0`, `c1` from `ntb1`) `t`;') tdSql.checkRows(1) - tdSql.checkEqual(tdSql.queryResult[0][1], 13) + tdSql.checkData(0, 1, 13) tdSql.query(f'select count(`t1`.`ts`) from (select `t`.`ts` from `{self.ntbname1}` `t`) `t1`;') tdSql.checkRows(1) @@ -133,7 +133,8 @@ class TDTestCase: def run(self): self.topic_name_check() self.db_name_check() - self.stream_name_check() + if platform.system().lower() == 'windows': + self.stream_name_check() self.table_name_check() self.view_name_check() self.query_check() diff --git a/tests/system-test/0-others/information_schema.py b/tests/system-test/0-others/information_schema.py index 616cd034ab..b342bc7b0e 100644 --- a/tests/system-test/0-others/information_schema.py +++ b/tests/system-test/0-others/information_schema.py @@ -222,7 +222,7 @@ class TDTestCase: tdSql.query("select * from information_schema.ins_columns where db_name ='information_schema'") tdLog.info(len(tdSql.queryResult)) - tdSql.checkEqual(True, len(tdSql.queryResult) in range(261, 271)) + tdSql.checkEqual(True, len(tdSql.queryResult) in range(271, 272)) tdSql.query("select * from information_schema.ins_columns where db_name ='performance_schema'") tdSql.checkEqual(56, len(tdSql.queryResult)) diff --git a/tests/system-test/0-others/splitVGroup.py b/tests/system-test/0-others/splitVGroup.py index c49713fc6d..df52828a6e 100644 --- a/tests/system-test/0-others/splitVGroup.py +++ b/tests/system-test/0-others/splitVGroup.py @@ -16,7 +16,7 @@ import random import time import copy import string - +import platform import taos from util.log import * from util.cases import * @@ -380,14 +380,15 @@ class TDTestCase: # forbid def checkForbid(self): # stream - tdLog.info("check forbid split having stream...") - tdSql.execute("create database streamdb;") - tdSql.execute("use streamdb;") - tdSql.execute("create table ta(ts timestamp, age int);") - tdSql.execute("create stream ma into sta as select count(*) from ta interval(1s);") - self.expectSplitError("streamdb") - tdSql.execute("drop stream ma;") - self.expectSplitOk("streamdb") + if platform.system().lower() != 'windows': + tdLog.info("check forbid split having stream...") + tdSql.execute("create database streamdb;") + tdSql.execute("use streamdb;") + tdSql.execute("create table ta(ts timestamp, age int);") + tdSql.execute("create stream ma into sta as select count(*) from ta interval(1s);") + self.expectSplitError("streamdb") + tdSql.execute("drop stream ma;") + self.expectSplitOk("streamdb") # topic tdLog.info("check forbid split having topic...") diff --git a/tests/system-test/0-others/splitVGroupWal.py b/tests/system-test/0-others/splitVGroupWal.py index d11d63b5a9..ecffd0f7c6 100644 --- a/tests/system-test/0-others/splitVGroupWal.py +++ b/tests/system-test/0-others/splitVGroupWal.py @@ -16,7 +16,7 @@ import random import time import copy import string - +import platform import taos from util.log import * from util.cases import * @@ -380,14 +380,15 @@ class TDTestCase: # forbid def checkForbid(self): # stream - tdLog.info("check forbid split having stream...") - tdSql.execute("create database streamdb;") - tdSql.execute("use streamdb;") - tdSql.execute("create table ta(ts timestamp, age int);") - tdSql.execute("create stream ma into sta as select count(*) from ta interval(1s);") - self.expectSplitError("streamdb") - tdSql.execute("drop stream ma;") - self.expectSplitOk("streamdb") + if platform.system().lower() != 'windows': + tdLog.info("check forbid split having stream...") + tdSql.execute("create database streamdb;") + tdSql.execute("use streamdb;") + tdSql.execute("create table ta(ts timestamp, age int);") + tdSql.execute("create stream ma into sta as select count(*) from ta interval(1s);") + self.expectSplitError("streamdb") + tdSql.execute("drop stream ma;") + self.expectSplitOk("streamdb") # topic tdLog.info("check forbid split having topic...") diff --git a/tests/system-test/0-others/taosdShell.py b/tests/system-test/0-others/taosdShell.py index 3d1162c370..9b0628ec12 100644 --- a/tests/system-test/0-others/taosdShell.py +++ b/tests/system-test/0-others/taosdShell.py @@ -154,7 +154,10 @@ class TDTestCase: tdSql.query("use source_db") tdSql.query("create table if not exists source_db.stb (ts timestamp, k int) tags (a int);") tdSql.query("create table source_db.ct1 using source_db.stb tags(1000);create table source_db.ct2 using source_db.stb tags(2000);create table source_db.ct3 using source_db.stb tags(3000);") - tdSql.query("create stream s1 into source_db.output_stb as select _wstart AS startts, min(k), max(k), sum(k) from source_db.stb interval(10m);") + if platform.system().lower() == 'windows': + pass + else: + tdSql.query("create stream s1 into source_db.output_stb as select _wstart AS startts, min(k), max(k), sum(k) from source_db.stb interval(10m);") #TD-19944 -Q=3 diff --git a/tests/system-test/1-insert/alter_database.py b/tests/system-test/1-insert/alter_database.py index e3ff797baa..f58bb7517e 100644 --- a/tests/system-test/1-insert/alter_database.py +++ b/tests/system-test/1-insert/alter_database.py @@ -17,7 +17,10 @@ class TDTestCase: self.replicaVar = int(replicaVar) tdLog.debug("start to execute %s" % __file__) tdSql.init(conn.cursor(), logSql) - self.buffer_boundary = [3, 4097, 8193, 12289, 16384] + if platform.system().lower() == 'windows': + self.buffer_boundary = [3, 4097] + else: + self.buffer_boundary = [3, 4097, 8193, 12289, 16384] # remove the value > free_memory, 70% is the weight to calculate the max value # if platform.system() == "Linux" and platform.machine() == "aarch64": # mem = psutil.virtual_memory() diff --git a/tests/system-test/1-insert/database_pre_suf.py b/tests/system-test/1-insert/database_pre_suf.py index 2e993b9a40..2bef94081e 100755 --- a/tests/system-test/1-insert/database_pre_suf.py +++ b/tests/system-test/1-insert/database_pre_suf.py @@ -22,6 +22,7 @@ from util.cases import tdCases from util.sql import tdSql from util.dnodes import tdDnodes from util.dnodes import * +from util.common import * class TDTestCase: updatecfgDict = {'maxSQLLength':1048576,'debugFlag': 135} @@ -158,7 +159,8 @@ class TDTestCase: fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1))) # create stream - tdSql.execute('''create stream current_stream trigger at_once IGNORE EXPIRED 0 into stream_max_stable_1 as select _wstart as startts, _wend as wend, max(q_int) as max_int, min(q_bigint) as min_int from stable_1 where ts is not null interval (5s);''') + stream_name="current_stream" + tdSql.execute(f'''create stream {stream_name} trigger at_once IGNORE EXPIRED 0 into stream_max_stable_1 as select _wstart as startts, _wend as wend, max(q_int) as max_int, min(q_bigint) as min_int from stable_1 where ts is not null interval (5s);''') # insert data positive for i in range(num_random*n): @@ -287,8 +289,8 @@ class TDTestCase: tdSql.query("select count(*) from hn_table_1_r;") tdSql.checkData(0,0,num_random*n) - sleep(5) # stream data check + tdCom.check_stream_task_status(stream_name,vgroups,90) tdSql.query("select startts,wend,max_int from stream_max_stable_1 ;") tdSql.checkRows(20) tdSql.query("select sum(max_int) from stream_max_stable_1 ;") diff --git a/tests/system-test/1-insert/drop.py b/tests/system-test/1-insert/drop.py index b467276fce..bd5e4cab49 100644 --- a/tests/system-test/1-insert/drop.py +++ b/tests/system-test/1-insert/drop.py @@ -162,7 +162,8 @@ class TDTestCase: self.drop_ntb_check() self.drop_stb_ctb_check() self.drop_topic_check() - self.drop_stream_check() + if platform.system().lower() == 'windows': + self.drop_stream_check() pass def stop(self): tdSql.close() diff --git a/tests/system-test/1-insert/precisionNS.py b/tests/system-test/1-insert/precisionNS.py index 3de60b718a..8302f6ed28 100644 --- a/tests/system-test/1-insert/precisionNS.py +++ b/tests/system-test/1-insert/precisionNS.py @@ -14,7 +14,7 @@ import sys import random import time - +import platform import taos from util.log import * from util.cases import * @@ -149,9 +149,10 @@ class TDTestCase: tdSql.execute(sql) # create stream - sql = "create stream ma into sta as select count(ts) from st interval(100b)" - tdLog.info(sql) - tdSql.execute(sql) + if platform.system().lower() != 'windows': + sql = "create stream ma into sta as select count(ts) from st interval(100b)" + tdLog.info(sql) + tdSql.execute(sql) # insert data self.insertData() @@ -315,7 +316,8 @@ class TDTestCase: self.checkWhere() # check stream - self.checkStream() + if platform.system().lower() != 'windows': + self.checkStream() # stop def stop(self): diff --git a/tests/system-test/1-insert/precisionUS.py b/tests/system-test/1-insert/precisionUS.py index 25171ddd88..bce51dddb2 100644 --- a/tests/system-test/1-insert/precisionUS.py +++ b/tests/system-test/1-insert/precisionUS.py @@ -14,7 +14,7 @@ import sys import random import time - +import platform import taos from util.log import * from util.cases import * @@ -149,9 +149,10 @@ class TDTestCase: tdSql.execute(sql) # create stream - sql = "create stream ma into sta as select count(ts) from st interval(100u)" - tdLog.info(sql) - tdSql.execute(sql) + if platform.system().lower() != 'windows': + sql = "create stream ma into sta as select count(ts) from st interval(100u)" + tdLog.info(sql) + tdSql.execute(sql) # insert data self.insertData() @@ -289,7 +290,8 @@ class TDTestCase: self.checkWhere() # check stream - self.checkStream() + if platform.system().lower() != 'windows': + self.checkStream() # stop def stop(self): diff --git a/tests/system-test/1-insert/ts-4272.py b/tests/system-test/1-insert/ts-4272.py index f2bacd0c2b..4aaab11346 100644 --- a/tests/system-test/1-insert/ts-4272.py +++ b/tests/system-test/1-insert/ts-4272.py @@ -25,7 +25,9 @@ class TDTestCase: self.tag2 = f'using {self.stable0}(groupId) tags(2)' self.file1 = f"{self.testcasePath}/b.csv" self.file2 = f"{self.testcasePath}/c.csv" - + if platform.system().lower() == 'windows': + self.file1 = self.file1.replace("\\","\\\\") + self.file2 = self.file2.replace("\\","\\\\") tdLog.debug(f"start to excute {__file__}") tdSql.init(conn.cursor(), logSql) diff --git a/tests/system-test/2-query/last+last_row.py b/tests/system-test/2-query/last+last_row.py index 1ee1b4afa7..e1b4fe68dd 100644 --- a/tests/system-test/2-query/last+last_row.py +++ b/tests/system-test/2-query/last+last_row.py @@ -56,26 +56,33 @@ class TDTestCase(TDTestCase): def check_sql_result_include(self, sql,include_result): - result = os.popen("taos -s 'reset query cache; %s'" %sql) + result = os.popen(f"taos -s \"reset query cache; {sql}\"" ) res = result.read() - #tdLog.info(res) - if (include_result in res): - tdLog.info(f"check_sql_result_include : checkEqual success") - else : - tdLog.info(res) + if res is None or res == '': tdLog.info(sql) - tdLog.exit(f"check_sql_result_include : checkEqual error") + tdLog.exit(f"check_sql_result_include : taos -s return null") + else: + if (include_result in res): + tdLog.info(f"check_sql_result_include : checkEqual success") + else : + tdLog.info(res) + tdLog.info(sql) + tdLog.exit(f"check_sql_result_include : checkEqual error") def check_sql_result_not_include(self, sql,not_include_result): - result = os.popen("taos -s 'reset query cache; %s'" %sql) + result = os.popen(f"taos -s \"reset query cache; {sql}\"" ) res = result.read() #tdLog.info(res) - if (not_include_result in res): - tdLog.info(res) + if res is None or res == '': tdLog.info(sql) - tdLog.exit(f"check_sql_result_not_include : checkEqual error") - else : - tdLog.info(f"check_sql_result_not_include : checkEqual success") + tdLog.exit(f"check_sql_result_not_include : taos -s return null") + else: + if (not_include_result in res): + tdLog.info(res) + tdLog.info(sql) + tdLog.exit(f"check_sql_result_not_include : checkEqual error") + else : + tdLog.info(f"check_sql_result_not_include : checkEqual success") def cachemodel_none(self, dbname="nested"): @@ -325,6 +332,7 @@ class TDTestCase(TDTestCase): for i in range(2): self.cachemodel_none() + tdLog.info("last_row") tdSql.query("alter database nested cachemodel 'last_row' ") tdSql.query("reset query cache;") self.cachemodel_last_row() diff --git a/tests/system-test/7-tmq/tmq3mnodeSwitch.py b/tests/system-test/7-tmq/tmq3mnodeSwitch.py index 8c5dc5e693..17eed3bd5c 100644 --- a/tests/system-test/7-tmq/tmq3mnodeSwitch.py +++ b/tests/system-test/7-tmq/tmq3mnodeSwitch.py @@ -65,9 +65,12 @@ class TDTestCase: while count < self.mnodeCheckCnt: time.sleep(1) tdSql.query("select * from information_schema.ins_mnodes;") + rst = tdSql.checkRows(self.mnodes) + print(f"rst: {rst}") if tdSql.checkRows(self.mnodes) : tdLog.debug("mnode is three nodes") else: + tdSql.print_error_frame_info(tdSql.queryRows,3) tdLog.exit("mnode number is correct") roleOfMnode0 = tdSql.queryResult[0][self.roleIndex] diff --git a/tests/system-test/7-tmq/tmq_offset.py b/tests/system-test/7-tmq/tmq_offset.py index 8272449ccb..07d1a4bc04 100644 --- a/tests/system-test/7-tmq/tmq_offset.py +++ b/tests/system-test/7-tmq/tmq_offset.py @@ -15,6 +15,10 @@ sys.path.append("./7-tmq") from tmqCommon import * class TDTestCase: + clientCfgDict = {'debugFlag': 135} + updatecfgDict = {'debugFlag': 135, 'asynclog': 0} + updatecfgDict["clientCfg"] = clientCfgDict + def init(self, conn, logSql, replicaVar=1): self.replicaVar = int(replicaVar) tdLog.debug(f"start to excute {__file__}") diff --git a/tests/system-test/failed.txt b/tests/system-test/failed.txt index 59c4d625d9..d34f8b7fb5 100644 --- a/tests/system-test/failed.txt +++ b/tests/system-test/failed.txt @@ -1,2 +1,19 @@ -#python3 ./test.py -f 2-query/last.py -Q 3 -#./test.sh -f tsim/mnode/basic4.sim +python3 ./test.py -f 2-query/match.py +python3 ./test.py -f 0-others/splitVGroup.py -N 3 -n 1 +python3 ./test.py -f 2-query/tsma.py +python3 ./test.py -f 2-query/tsma2.py +python3 ./test.py -f 1-insert/database_pre_suf.py +python3 ./test.py -f 0-others/splitVGroup.py -N 3 -n 1 +python3 ./test.py -f 0-others/splitVGroupWal.py -N 3 -n 1 +python3 ./test.py -f 0-others/delete_check.py +python3 ./test.py -f 1-insert/alter_database.py +python3 ./test.py -f 1-insert/db_tb_name_check.py +python3 ./test.py -f 1-insert/precisionUS.py +python3 ./test.py -f 1-insert/precisionNS.py +python3 ./test.py -f 1-insert/ts-4272.py +python3 ./test.py -f 2-query/last+last_row.py +python3 ./test.py -f 2-query/normal.py +python3 ./test.py -f 2-query/To_iso8601.py +python3 ./test.py -f 2-query/normal.py +python3 ./test.py -f 5-taos-tools/taosbenchmark/insertMix.py -N 3 +python3 ./test.py -f 7-tmq/tmq_taosx.py \ No newline at end of file diff --git a/tests/system-test/test.py b/tests/system-test/test.py index ad5e1a06f3..9defcd083a 100644 --- a/tests/system-test/test.py +++ b/tests/system-test/test.py @@ -44,7 +44,7 @@ def checkRunTimeError(): time.sleep(1) timeCount = timeCount + 1 print("checkRunTimeError",timeCount) - if (timeCount>600): + if (timeCount>1200): print("stop the test.") os.system("TASKKILL /F /IM taosd.exe") os.system("TASKKILL /F /IM taos.exe") diff --git a/tests/system-test/win-test-file b/tests/system-test/win-test-file index 41eb28e071..1f2b3f476c 100644 --- a/tests/system-test/win-test-file +++ b/tests/system-test/win-test-file @@ -104,7 +104,6 @@ python3 ./test.py -f 2-query/insert_null_none.py -R python3 ./test.py -f 2-query/insert_null_none.py -Q 2 python3 ./test.py -f 2-query/insert_null_none.py -Q 3 python3 ./test.py -f 2-query/insert_null_none.py -Q 4 -python3 ./test.py -f 1-insert/database_pre_suf.py python3 ./test.py -f 2-query/concat.py -Q 3 python3 ./test.py -f 2-query/out_of_order.py -Q 2 python3 ./test.py -f 2-query/out_of_order.py -Q 4 @@ -572,7 +571,6 @@ python3 ./test.py -f 2-query/join2.py python3 ./test.py -f 2-query/union1.py python3 ./test.py -f 2-query/concat2.py python3 ./test.py -f 2-query/json_tag.py -python3 ./test.py -f 2-query/nestedQueryInterval.py python3 ./test.py -f 2-query/systable_func.py python3 ./test.py -f 2-query/test_ts4382.py python3 ./test.py -f 2-query/test_ts4403.py @@ -687,7 +685,6 @@ python3 ./test.py -f 2-query/arctan.py -Q 2 python3 ./test.py -f 2-query/query_cols_tags_and_or.py -Q 2 python3 ./test.py -f 2-query/interp.py -Q 2 python3 ./test.py -f 2-query/fill.py -Q 2 -python3 ./test.py -f 2-query/nestedQueryInterval.py -Q 2 python3 ./test.py -f 2-query/stablity.py -Q 2 python3 ./test.py -f 2-query/stablity_1.py -Q 2 python3 ./test.py -f 2-query/avg.py -Q 2 @@ -783,7 +780,6 @@ python3 ./test.py -f 2-query/arcsin.py -Q 3 python3 ./test.py -f 2-query/arccos.py -Q 3 python3 ./test.py -f 2-query/arctan.py -Q 3 python3 ./test.py -f 2-query/query_cols_tags_and_or.py -Q 3 -python3 ./test.py -f 2-query/nestedQueryInterval.py -Q 3 python3 ./test.py -f 2-query/stablity.py -Q 3 python3 ./test.py -f 2-query/stablity_1.py -Q 3 python3 ./test.py -f 2-query/avg.py -Q 3 @@ -881,7 +877,6 @@ python3 ./test.py -f 2-query/arcsin.py -Q 4 python3 ./test.py -f 2-query/arccos.py -Q 4 python3 ./test.py -f 2-query/arctan.py -Q 4 python3 ./test.py -f 2-query/query_cols_tags_and_or.py -Q 4 -python3 ./test.py -f 2-query/nestedQueryInterval.py -Q 4 python3 ./test.py -f 2-query/stablity.py -Q 4 python3 ./test.py -f 2-query/stablity_1.py -Q 4 python3 ./test.py -f 2-query/avg.py -Q 4 @@ -914,7 +909,6 @@ python3 ./test.py -f 2-query/last_row.py -Q 4 python3 ./test.py -f 2-query/tsbsQuery.py -Q 4 python3 ./test.py -f 2-query/sml.py -Q 4 python3 ./test.py -f 2-query/interp.py -Q 4 -python3 ./test.py -f 2-query/fill.py -Q 4 python3 ./test.py -f 2-query/case_when.py -Q 4 python3 ./test.py -f 2-query/insert_select.py python3 ./test.py -f 2-query/insert_select.py -R