Merge branch '3.0' into fix/TD-30270

This commit is contained in:
WANG MINGMING 2024-09-05 18:23:25 +08:00 committed by GitHub
commit 0ad18421bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
203 changed files with 10439 additions and 7399 deletions

3
.gitignore vendored
View File

@ -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

View File

@ -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

View File

@ -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")

View File

@ -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';

View File

@ -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.

View File

@ -21,7 +21,6 @@ table_options:
table_option: {
COMMENT 'string_value'
| SMA(col_name [, col_name] ...)
| TTL value
}
```

View File

@ -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,

View File

@ -17,7 +17,7 @@
<dependency>
<groupId>com.taosdata.jdbc</groupId>
<artifactId>taos-jdbcdriver</artifactId>
<version>3.2.1</version>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>

View File

@ -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 对应的组或窗口将不返回查询结果. 注意此参数客户端和服务端值应保持一致. |

View File

@ -41,4 +41,4 @@ TDengine 客户端驱动提供了应用编程所需要的全部 API并且在
## API
请参考[连接器]
请参考[连接器](../../connector)

View File

@ -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 格式写入
- \<http://opentsdb.net/docs/build/html/api_http/put.html>
- \<http://opentsdb.net/docs/build/html/api_telnet/put.html>
- 与 collectd 无缝连接
- \<http://opentsdb.net/docs/build/html/api_http/put.html\>
- \<http://opentsdb.net/docs/build/html/api_telnet/put.html\>
- 与 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://<fqdn>:6041/rest/sql` 来写入数据到 TDengine 或从 TDengine 中查询数据。细节请参考[官方文档](../../connector/rest-api/)。
您可以使用任何支持 http 协议的客户端通过访问 RESTful 接口地址 `http://<fqdn>:6041/rest/sql` 来写入数据到 TDengine 或从 TDengine 中查询数据。细节请参考[REST API 文档](../../connector/rest-api/)。
### InfluxDB
您可以使用任何支持 http 协议的客户端访问 Restful 接口地址 `http://<fqdn>:6041/<APIEndPoint>` 来写入 InfluxDB 兼容格式的数据到 TDengine。EndPoint 如下:
```text
/influxdb/v1/write
```
您可以使用任何支持 http 协议的客户端访问 Restful 接口地址 `http://<fqdn>:6041/influxdb/v1/write` 来写入 InfluxDB 兼容格式的数据到 TDengine。
支持 InfluxDB 参数如下:

View File

@ -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 表示 rest1 表示 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, insertinserted_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, insertinserted_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
- **含义**: 虚拟节点角色
### 抽取配置

View File

@ -21,7 +21,6 @@ table_options:
table_option: {
COMMENT 'string_value'
| SMA(col_name [, col_name] ...)
| TTL value
}
```

View File

@ -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 插件, 请参考官方文档:\<https://kafka.apache.org/documentation/#connect>
1. 关于如何在独立安装的 Kafka 环境使用 Kafka Connect 插件, 请参考官方文档:[https://kafka.apache.org/documentation/#connect](https://kafka.apache.org/documentation/#connect)
## 问题反馈
无论遇到任何问题,都欢迎在本项目的 Github 仓库反馈:\<https://github.com/taosdata/kafka-connect-tdengine/issues>
无论遇到任何问题,都欢迎在本项目的 Github 仓库反馈:[https://github.com/taosdata/kafka-connect-tdengine/issues](https://github.com/taosdata/kafka-connect-tdengine/issues)
## 参考
1. \<https://kafka.apache.org/documentation/>
1. [https://kafka.apache.org/documentation/](https://kafka.apache.org/documentation/)

View File

@ -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];

View File

@ -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;

View File

@ -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

View File

@ -121,6 +121,8 @@ void mndGenerateMachineCode();
void mndDumpSdb();
void mndDeleteTrans();
#ifdef __cplusplus
}
#endif

View File

@ -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;

View File

@ -15,7 +15,7 @@
#ifndef TAOS_COUNTER_H
#define TAOS_COUNTER_H
#include <stdint.h>
#include <stdlib.h>
#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

View File

@ -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);

View File

@ -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

View File

@ -1,5 +1,5 @@
[Unit]
Description=server service
Description=taosd - TDengine time series database core service
After=network-online.target
Wants=network-online.target

View File

@ -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);

View File

@ -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,10 +244,8 @@ 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,
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;
}
}
@ -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;
@ -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);

View File

@ -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) {

View File

@ -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)) {
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;

View File

@ -121,7 +121,7 @@ static int32_t monitorReportAsyncCB(void* param, SDataBuf* pMsg, int32_t code) {
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;
}

View File

@ -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);

View File

@ -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));

View File

@ -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};
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;
// 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);

View File

@ -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';

View File

@ -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[] = {

View File

@ -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);

View File

@ -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},

File diff suppressed because it is too large Load Diff

View File

@ -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) {

View File

@ -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) {

View File

@ -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();

View File

@ -37,6 +37,7 @@ typedef struct SDnodeMgmt {
ProcessAlterNodeTypeFp processAlterNodeTypeFp;
ProcessDropNodeFp processDropNodeFp;
SendMonitorReportFp sendMonitorReportFp;
MonitorCleanExpiredSamplesFp monitorCleanExpiredSamplesFp;
SendAuditRecordsFp sendAuditRecordsFp;
GetVnodeLoadsFp getVnodeLoadsFp;
GetVnodeLoadsFp getVnodeLoadsLiteFp;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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) {

View File

@ -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));

View File

@ -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;
}
}

View File

@ -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);

View File

@ -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

View File

@ -409,6 +409,7 @@ SMgmtInputOpt dmBuildMgmtInputOpt(SMgmtWrapper *pWrapper) {
.processAlterNodeTypeFp = dmProcessAlterNodeTypeReq,
.processDropNodeFp = dmProcessDropNodeReq,
.sendMonitorReportFp = dmSendMonitorReport,
.monitorCleanExpiredSamplesFp = dmMonitorCleanExpiredSamples,
.sendAuditRecordFp = auditSendRecordsInBatch,
.getVnodeLoadsFp = dmGetVnodeLoads,
.getVnodeLoadsLiteFp = dmGetVnodeLoadsLite,

View File

@ -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];

View File

@ -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);
@ -155,6 +156,7 @@ typedef struct {
ProcessAlterNodeTypeFp processAlterNodeTypeFp;
ProcessDropNodeFp processDropNodeFp;
SendMonitorReportFp sendMonitorReportFp;
MonitorCleanExpiredSamplesFp monitorCleanExpiredSamplesFp;
SendAuditRecordsFp sendAuditRecordFp;
GetVnodeLoadsFp getVnodeLoadsFp;
GetVnodeLoadsFp getVnodeLoadsLiteFp;

View File

@ -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));
}

View File

@ -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);

View File

@ -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;
}

View File

@ -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

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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) {

View File

@ -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);
}

View File

@ -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) {

View File

@ -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;
}

View File

@ -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);

View File

@ -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
*

View File

@ -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);

View File

@ -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);
}

View File

@ -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;
}
}

View File

@ -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);
}

View File

@ -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;

View File

@ -679,9 +679,9 @@ 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;
if (!valuesList) return terrno;
size_t *valuesListSizes = taosMemoryCalloc(numKeys, sizeof(size_t));
if(!valuesListSizes) {
if (!valuesListSizes) {
taosMemoryFreeClear(valuesList);
return terrno;
}
@ -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);
for (int i = 0; i < 2; i++) {
LRUHandle *h = taosLRUCacheLookup(pTsdb->lruCache, keys_list[i], klen);
if (h) {
erase = true;
(void)taosLRUCacheRelease(pTsdb->lruCache, h, erase);
(void)taosLRUCacheRelease(pTsdb->lruCache, h, true);
taosLRUCacheErase(pTsdb->lruCache, keys_list[i], klen);
}
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);
}
}
@ -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));

View File

@ -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,20 +1964,10 @@ 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) {
int32_t code = initRowMergeIfNeeded(pReader, pBlockScanInfo->uid);
if (code != 0) {
return code;
}
}
SRowKey minKey = k;
if (pReader->info.order == TSDB_ORDER_ASC) {
@ -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,20 +2050,10 @@ 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) {
code = initRowMergeIfNeeded(pReader, pBlockScanInfo->uid);
if (code != 0) {
return code;
}
}
bool dataInDataFile = hasDataInFileBlock(pBlockData, pDumpInfo);
bool dataInSttFile = hasDataInSttBlock(pBlockScanInfo);
@ -2175,21 +2176,10 @@ 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) {
code = initRowMergeIfNeeded(pReader, pBlockScanInfo->uid);
if (code != 0) {
return code;
}
}
SRowKey minKey = k;
if (ASCENDING_TRAVERSE(pReader->info.order)) {
@ -2579,21 +2569,10 @@ 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) {
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);
}
}

View File

@ -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);

View File

@ -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;

View File

@ -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) {

View File

@ -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;

View File

@ -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));

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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) {
@ -235,7 +234,8 @@ int32_t buildSubmitReqFromBlock(SDataInserterHandle* pInserter, SSubmitReq2** pp
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;
}
@ -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;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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;
}

Some files were not shown because too many files have changed in this diff Show More