Merge branch '3.0' of https://github.com/taosdata/TDengine into test/3.0/windows-full-ci
This commit is contained in:
commit
67e3019a19
|
@ -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
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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, 对应的组或窗口将不返回查询结果. 注意此参数客户端和服务端值应保持一致. |
|
||||
|
||||
|
|
|
@ -41,4 +41,4 @@ TDengine 客户端驱动提供了应用编程所需要的全部 API,并且在
|
|||
|
||||
## API
|
||||
|
||||
请参考[连接器]
|
||||
请参考[连接器](../../connector)
|
|
@ -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 参数如下:
|
||||
|
||||
|
|
|
@ -293,6 +293,212 @@ taos_cluster_info_first_ep{cluster_id="554014120921134497",value="tdengine:6030"
|
|||
taos_cluster_info_first_ep_dnode_id{cluster_id="554014120921134497"} 1
|
||||
```
|
||||
|
||||
### 监控指标详情
|
||||
|
||||
#### taosd 集群
|
||||
|
||||
##### 监控信息支持的标签
|
||||
- `cluster_id`: 集群 id
|
||||
|
||||
##### 相关指标及其含义
|
||||
| 指标名称 | 类型 | 含义 |
|
||||
| ----------------------------------- | ------- | ------------------------------------- |
|
||||
| taos_cluster_info_connections_total | counter | 总连接数 |
|
||||
| taos_cluster_info_dbs_total | counter | 数据库总数 |
|
||||
| taos_cluster_info_dnodes_alive | counter | 存活的 dnode 数量 |
|
||||
| taos_cluster_info_dnodes_total | counter | dnode 总数 |
|
||||
| taos_cluster_info_first_ep | gauge | 第一个端点,标签 value 表示端点值 |
|
||||
| taos_cluster_info_first_ep_dnode_id | counter | 第一个端点的 dnode id |
|
||||
| taos_cluster_info_master_uptime | gauge | 主节点运行时间,单位天 |
|
||||
| taos_cluster_info_mnodes_alive | counter | 存活的 mnode 数量 |
|
||||
| taos_cluster_info_mnodes_total | counter | mnode 总数 |
|
||||
| taos_cluster_info_stbs_total | counter | 超级表总数 |
|
||||
| taos_cluster_info_streams_total | counter | 流总数 |
|
||||
| taos_cluster_info_tbs_total | counter | 表总数 |
|
||||
| taos_cluster_info_topics_total | counter | 主题总数 |
|
||||
| taos_cluster_info_version | gauge | 版本信息,标签 value 表示版本号 |
|
||||
| taos_cluster_info_vgroups_alive | counter | 存活的虚拟组数量 |
|
||||
| taos_cluster_info_vgroups_total | counter | 虚拟组总数 |
|
||||
| taos_cluster_info_vnodes_alive | counter | 存活的虚拟节点数量 |
|
||||
| taos_cluster_info_vnodes_total | counter | 虚拟节点总数 |
|
||||
| taos_grants_info_expire_time | counter | 集群授权过期剩余时间(单位 秒) |
|
||||
| taos_grants_info_timeseries_total | counter | 集群授权允许使用 time series 的总数量 |
|
||||
| taos_grants_info_timeseries_used | counter | 集群已拥有的 time series 的数量 |
|
||||
|
||||
#### dnode
|
||||
|
||||
##### 监控信息支持的标签
|
||||
- `cluster_id`: 集群 id
|
||||
- `dnode_ep`: dnode 端点
|
||||
- `dnode_id`:dnode id
|
||||
|
||||
##### 相关指标及其含义
|
||||
| 指标名称 | 类型 | 含义 |
|
||||
| ------------------------------ | ------- | ---------------------------------------------------------------------------------------- |
|
||||
| taos_d_info_status | gauge | dnode 状态,标签 value 表示状态, ready 表示正常, offline 表示下线, unknown 表示未知。 |
|
||||
| taos_dnodes_info_cpu_cores | gauge | CPU 核心数 |
|
||||
| taos_dnodes_info_cpu_engine | gauge | 该 dnode 的进程所使用的 CPU 百分比(取值范围 0~100) |
|
||||
| taos_dnodes_info_cpu_system | gauge | 该 dnode 所在节点的系统使用的 CPU 百分比(取值范围 0~100) |
|
||||
| taos_dnodes_info_disk_engine | counter | 该 dnode 的进程使用的磁盘容量(单位 Byte) |
|
||||
| taos_dnodes_info_disk_total | counter | 该 dnode 所在节点的磁盘总容量(单位 Byte) |
|
||||
| taos_dnodes_info_disk_used | counter | 该 dnode 所在节点的磁盘已使用的容量(单位 Byte) |
|
||||
| taos_dnodes_info_has_mnode | counter | 是否有 mnode |
|
||||
| taos_dnodes_info_has_qnode | counter | 是否有 qnode |
|
||||
| taos_dnodes_info_has_snode | counter | 是否有 snode |
|
||||
| taos_dnodes_info_io_read | gauge | 该 dnode 所在节点的 io 读取速率(单位 Byte/s) |
|
||||
| taos_dnodes_info_io_read_disk | gauge | 该 dnode 所在节点的磁盘 io 写入取速率(单位 Byte/s) |
|
||||
| taos_dnodes_info_io_write | gauge | 该 dnode 所在节点的 io 写入取速率(单位 Byte/s) |
|
||||
| taos_dnodes_info_io_write_disk | gauge | 该 dnode 所在节点的磁盘 io 写入取速率(单位 Byte/s) |
|
||||
| taos_dnodes_info_masters | counter | 主节点数量 |
|
||||
| taos_dnodes_info_mem_engine | counter | 该 dnode 的进程所使用的内存(单位 KB) |
|
||||
| taos_dnodes_info_mem_system | counter | 该 dnode 所在节的系统所使用的内存(单位 KB) |
|
||||
| taos_dnodes_info_mem_total | counter | 该 dnode 所在节点的总内存(单位 KB) |
|
||||
| taos_dnodes_info_net_in | gauge | 该 dnode 所在节点的网络传入速率(单位 Byte/s) |
|
||||
| taos_dnodes_info_net_out | gauge | 该 dnode 所在节点的网络传出速率(单位 Byte/s) |
|
||||
| taos_dnodes_info_uptime | gauge | 该 dnode 的启动时间(单位 秒) |
|
||||
| taos_dnodes_info_vnodes_num | counter | 该 dnode 所在节点的 vnode 数量 |
|
||||
|
||||
#### 数据目录
|
||||
|
||||
##### 监控信息支持的标签
|
||||
- `cluster_id`: 集群 id
|
||||
- `dnode_ep`: dnode 端点
|
||||
- `dnode_id`:dnode id
|
||||
- `data_dir_name`:数据目录名
|
||||
- `data_dir_level`:数据目录级别
|
||||
|
||||
##### 相关指标及其含义
|
||||
| 指标名称 | 类型 | 含义 |
|
||||
| --------------------------------- | ----- | -------------------- |
|
||||
| taos_taosd_dnodes_data_dirs_avail | gauge | 可用空间(单位 Byte) |
|
||||
| taos_taosd_dnodes_data_dirs_total | gauge | 总空间(单位 Byte) |
|
||||
| taos_taosd_dnodes_data_dirs_used | gauge | 已用空间(单位 Byte) |
|
||||
|
||||
#### 日志目录
|
||||
|
||||
##### 监控信息支持的标签
|
||||
- `cluster_id`: 集群 id
|
||||
- `dnode_ep`: dnode 端点
|
||||
- `dnode_id`:dnode id
|
||||
- `log_dir_name`:日志目录名
|
||||
|
||||
##### 相关指标及其含义
|
||||
| 指标名称 | 类型 | 含义 |
|
||||
| -------------------------------- | ----- | -------------------- |
|
||||
| taos_taosd_dnodes_log_dirs_avail | gauge | 可用空间(单位 Byte) |
|
||||
| taos_taosd_dnodes_log_dirs_total | gauge | 总空间(单位 Byte) |
|
||||
| taos_taosd_dnodes_log_dirs_used | gauge | 已用空间(单位 Byte) |
|
||||
|
||||
#### 日志数量
|
||||
|
||||
##### 监控信息支持的标签
|
||||
- `cluster_id`: 集群 id
|
||||
- `dnode_ep`: dnode 端点
|
||||
- `dnode_id`:dnode id
|
||||
|
||||
##### 相关指标及其含义
|
||||
| 指标名称 | 类型 | 含义 |
|
||||
| ---------------------- | ------- | ------------ |
|
||||
| taos_log_summary_debug | counter | 调试日志数量 |
|
||||
| taos_log_summary_error | counter | 错误日志数量 |
|
||||
| taos_log_summary_info | counter | 信息日志数量 |
|
||||
| taos_log_summary_trace | counter | 跟踪日志数量 |
|
||||
|
||||
|
||||
#### taosadapter
|
||||
|
||||
##### 监控信息支持的标签
|
||||
- `endpoint`:端点
|
||||
- `req_type`:请求类型,0 表示 rest,1 表示 websocket
|
||||
|
||||
##### 相关指标及其含义
|
||||
| 指标名称 | 类型 | 含义 |
|
||||
| -------------------------------------- | ------- | -------------------- |
|
||||
| taos_adapter_requests_fail | counter | 失败的请求数 |
|
||||
| taos_adapter_requests_in_process | counter | 正在处理的请求数 |
|
||||
| taos_adapter_requests_other | counter | 其他类型的请求数 |
|
||||
| taos_adapter_requests_other_fail | counter | 其他类型的失败请求数 |
|
||||
| taos_adapter_requests_other_success | counter | 其他类型的成功请求数 |
|
||||
| taos_adapter_requests_query | counter | 查询请求数 |
|
||||
| taos_adapter_requests_query_fail | counter | 查询失败请求数 |
|
||||
| taos_adapter_requests_query_in_process | counter | 正在处理的查询请求数 |
|
||||
| taos_adapter_requests_query_success | counter | 查询成功请求数 |
|
||||
| taos_adapter_requests_success | counter | 成功的请求数 |
|
||||
| taos_adapter_requests_total | counter | 总请求数 |
|
||||
| taos_adapter_requests_write | counter | 写请求数 |
|
||||
| taos_adapter_requests_write_fail | counter | 写失败请求数 |
|
||||
| taos_adapter_requests_write_in_process | counter | 正在处理的写请求数 |
|
||||
| taos_adapter_requests_write_success | counter | 写成功请求数 |
|
||||
|
||||
#### taoskeeper
|
||||
|
||||
##### 监控信息支持的标签
|
||||
- `identify`: 节点 endpoint
|
||||
|
||||
##### 相关指标及其含义
|
||||
| 指标名称 | 类型 | 含义 |
|
||||
| ----------------------- | ----- | ------------------------------------- |
|
||||
| taos_keeper_monitor_cpu | gauge | taoskeeper CPU 使用率(取值范围 0~1) |
|
||||
| taos_keeper_monitor_mem | gauge | taoskeeper 内存使用率(取值范围 0~1) |
|
||||
|
||||
#### 其他 taosd 集群监控项
|
||||
|
||||
##### taos_m_info_role
|
||||
- **标签**:
|
||||
- `cluster_id`: 集群 id
|
||||
- `mnode_ep`: mnode 端点
|
||||
- `mnode_id`: mnode id
|
||||
- `value`: 角色值(该 mnode 的状态,取值范围:offline, follower, candidate, leader, error, learner)
|
||||
- **类型**: gauge
|
||||
- **含义**: mnode 角色
|
||||
|
||||
##### taos_taos_sql_req_count
|
||||
- **标签**:
|
||||
- `cluster_id`: 集群 id
|
||||
- `result`: 请求结果(取值范围: Success, Failed)
|
||||
- `sql_type`: SQL 类型(取值范围:select, insert,inserted_rows, delete)
|
||||
- `username`: 用户名
|
||||
- **类型**: gauge
|
||||
- **含义**: SQL 请求数量
|
||||
|
||||
##### taos_taosd_sql_req_count
|
||||
- **标签**:
|
||||
- `cluster_id`: 集群 id
|
||||
- `dnode_ep`: dnode 端点
|
||||
- `dnode_id`: dnode id
|
||||
- `result`: 请求结果(取值范围: Success, Failed)
|
||||
- `sql_type`: SQL 类型(取值范围:select, insert,inserted_rows, delete)
|
||||
- `username`: 用户名
|
||||
- `vgroup_id`: 虚拟组 id
|
||||
- **类型**: gauge
|
||||
- **含义**: SQL 请求数量
|
||||
|
||||
##### taos_taosd_vgroups_info_status
|
||||
- **标签**:
|
||||
- `cluster_id`: 集群 id
|
||||
- `database_name`: 数据库名称
|
||||
- `vgroup_id`: 虚拟组 id
|
||||
- **类型**: gauge
|
||||
- **含义**: 虚拟组状态。 0 为 unsynced,表示没有leader选出;1 为 ready。
|
||||
|
||||
##### taos_taosd_vgroups_info_tables_num
|
||||
- **标签**:
|
||||
- `cluster_id`: 集群 id
|
||||
- `database_name`: 数据库名称
|
||||
- `vgroup_id`: 虚拟组 id
|
||||
- **类型**: gauge
|
||||
- **含义**: 虚拟组表数量
|
||||
|
||||
##### taos_taosd_vnodes_info_role
|
||||
- **标签**:
|
||||
- `cluster_id`: 集群 id
|
||||
- `database_name`: 数据库名称
|
||||
- `dnode_id`: dnode id
|
||||
- `value`: 角色值(取值范围:offline, follower, candidate, leader, error, learner)
|
||||
- `vgroup_id`: 虚拟组 id
|
||||
- **类型**: gauge
|
||||
- **含义**: 虚拟节点角色
|
||||
|
||||
|
||||
### 抽取配置
|
||||
|
||||
|
|
|
@ -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/)
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -121,6 +121,8 @@ void mndGenerateMachineCode();
|
|||
|
||||
void mndDumpSdb();
|
||||
|
||||
void mndDeleteTrans();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[Unit]
|
||||
Description=server service
|
||||
Description=taosd - TDengine time series database core service
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -297,7 +297,7 @@ static int32_t addEpSetInfo(SMnode *pMnode, SMqConsumerObj *pConsumer, int32_t e
|
|||
taosRUnLockLatch(&pSub->lock);
|
||||
mndReleaseSubscribe(pMnode, pSub);
|
||||
mndReleaseTopic(pMnode, pTopic);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
(void)memcpy(topicEp.schema.pSchema, pTopic->schema.pSchema, topicEp.schema.nCols * sizeof(SSchema));
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ int32_t mndInitPerfsTableSchema(const SSysDbTableSchema *pSrc, int32_t colNum, S
|
|||
int32_t code = 0;
|
||||
SSchema *schema = taosMemoryCalloc(colNum, sizeof(SSchema));
|
||||
if (NULL == schema) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ int32_t mndBuildPerfsTableSchema(SMnode *pMnode, const char *dbFName, const char
|
|||
|
||||
pRsp->pSchemas = taosMemoryCalloc(meta->numOfColumns, sizeof(SSchema));
|
||||
if (pRsp->pSchemas == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
pRsp->pSchemas = NULL;
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ int32_t mndBuildPerfsTableCfg(SMnode *pMnode, const char *dbFName, const char *t
|
|||
|
||||
pRsp->pSchemas = taosMemoryCalloc(pMeta->numOfColumns, sizeof(SSchema));
|
||||
if (pRsp->pSchemas == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
pRsp->pSchemas = NULL;
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
*
|
||||
|
|
|
@ -381,7 +381,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};
|
||||
|
@ -409,6 +409,7 @@ static int32_t sdbWriteFileImp(SSdb *pSdb) {
|
|||
}
|
||||
|
||||
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 +551,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 +567,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);
|
||||
|
@ -664,7 +673,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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -757,24 +757,12 @@ static int32_t tsdbCacheDropTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid,
|
|||
rocksdb_free(values_list[0]);
|
||||
rocksdb_free(values_list[1]);
|
||||
|
||||
bool erase = false;
|
||||
LRUHandle *h = taosLRUCacheLookup(pTsdb->lruCache, keys_list[0], klen);
|
||||
if (h) {
|
||||
erase = true;
|
||||
(void)taosLRUCacheRelease(pTsdb->lruCache, h, erase);
|
||||
}
|
||||
if (erase) {
|
||||
taosLRUCacheErase(pTsdb->lruCache, keys_list[0], klen);
|
||||
}
|
||||
|
||||
erase = false;
|
||||
h = taosLRUCacheLookup(pTsdb->lruCache, keys_list[1], klen);
|
||||
if (h) {
|
||||
erase = true;
|
||||
(void)taosLRUCacheRelease(pTsdb->lruCache, h, erase);
|
||||
}
|
||||
if (erase) {
|
||||
taosLRUCacheErase(pTsdb->lruCache, keys_list[1], klen);
|
||||
for (int i = 0; i < 2; i++) {
|
||||
LRUHandle *h = taosLRUCacheLookup(pTsdb->lruCache, keys_list[i], klen);
|
||||
if (h) {
|
||||
(void)taosLRUCacheRelease(pTsdb->lruCache, h, true);
|
||||
taosLRUCacheErase(pTsdb->lruCache, keys_list[i], klen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1027,6 +1015,7 @@ static int32_t tsdbCacheUpdateValue(SValue *pOld, SValue *pNew) {
|
|||
TAOS_RETURN(TSDB_CODE_SUCCESS);
|
||||
}
|
||||
|
||||
#ifdef BUILD_NO_CALL
|
||||
static void tsdbCacheUpdateLastCol(SLastCol *pLastCol, SRowKey *pRowKey, SColVal *pColVal) {
|
||||
// update rowkey
|
||||
pLastCol->rowKey.ts = pRowKey->ts;
|
||||
|
@ -1047,6 +1036,7 @@ static void tsdbCacheUpdateLastCol(SLastCol *pLastCol, SRowKey *pRowKey, SColVal
|
|||
pLastCol->dirty = 1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void tsdbCacheUpdateLastColToNone(SLastCol *pLastCol, ELastCacheStatus cacheStatus) {
|
||||
// update rowkey
|
||||
|
@ -1108,11 +1098,12 @@ static int32_t tsdbCachePutToLRU(STsdb *pTsdb, SLastKey *pLastKey, SLastCol *pLa
|
|||
|
||||
size_t charge = 0;
|
||||
*pLRULastCol = *pLastCol;
|
||||
pLRULastCol->dirty = 1;
|
||||
TAOS_CHECK_EXIT(tsdbCacheReallocSLastCol(pLRULastCol, &charge));
|
||||
|
||||
LRUStatus status = taosLRUCacheInsert(pTsdb->lruCache, pLastKey, ROCKS_KEY_LEN, pLRULastCol, charge, tsdbCacheDeleter,
|
||||
NULL, TAOS_LRU_PRIORITY_LOW, &pTsdb->flushState);
|
||||
if (TAOS_LRU_STATUS_OK != status) {
|
||||
if (TAOS_LRU_STATUS_OK != status && TAOS_LRU_STATUS_OK_OVERWRITTEN != status) {
|
||||
tsdbError("tsdb/cache/putlru: vgId:%d, failed to insert status %d.", TD_VID(pTsdb->pVnode), status);
|
||||
code = TSDB_CODE_INVALID_DATA_FMT;
|
||||
}
|
||||
|
@ -1157,12 +1148,13 @@ static int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, SArray
|
|||
if (pLastCol->cacheStatus != TSDB_LAST_CACHE_NO_CACHE) {
|
||||
int32_t cmp_res = tRowKeyCompare(&pLastCol->rowKey, pRowKey);
|
||||
if (cmp_res < 0 || (cmp_res == 0 && !COL_VAL_IS_NONE(pColVal))) {
|
||||
tsdbCacheUpdateLastCol(pLastCol, pRowKey, pColVal);
|
||||
pLastCol->cacheStatus = TSDB_LAST_CACHE_VALID;
|
||||
SLastCol newLastCol = {.rowKey = *pRowKey, .colVal = *pColVal, .cacheStatus = TSDB_LAST_CACHE_VALID};
|
||||
code = tsdbCachePutToLRU(pTsdb, key, &newLastCol);
|
||||
}
|
||||
}
|
||||
|
||||
(void)taosLRUCacheRelease(pCache, h, false);
|
||||
TAOS_CHECK_EXIT(code);
|
||||
} else {
|
||||
if (!remainCols) {
|
||||
remainCols = taosArrayInit(num_keys * 2, sizeof(SIdxKey));
|
||||
|
@ -1880,9 +1872,13 @@ int32_t tsdbCacheDel(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKE
|
|||
if (h) {
|
||||
SLastCol *pLastCol = (SLastCol *)taosLRUCacheValue(pTsdb->lruCache, h);
|
||||
if (pLastCol->rowKey.ts <= eKey && pLastCol->rowKey.ts >= sKey) {
|
||||
tsdbCacheUpdateLastColToNone(pLastCol, TSDB_LAST_CACHE_NO_CACHE);
|
||||
SLastCol noneCol = {.rowKey.ts = TSKEY_MIN,
|
||||
.colVal = COL_VAL_NONE(cid, pTSchema->columns[i].type),
|
||||
.cacheStatus = TSDB_LAST_CACHE_NO_CACHE};
|
||||
code = tsdbCachePutToLRU(pTsdb, &lastKey, &noneCol);
|
||||
}
|
||||
(void)taosLRUCacheRelease(pTsdb->lruCache, h, false);
|
||||
TAOS_CHECK_EXIT(code);
|
||||
} else {
|
||||
if (!remainCols) {
|
||||
remainCols = taosArrayInit(numCols * 2, sizeof(SLastKey));
|
||||
|
|
|
@ -1734,14 +1734,35 @@ static bool isCleanFileDataBlock(STsdbReader* pReader, SFileDataBlockInfo* pBloc
|
|||
return isCleanFileBlock;
|
||||
}
|
||||
|
||||
static int32_t initRowMergeIfNeeded(STsdbReader* pReader, int64_t uid) {
|
||||
SRowMerger* pMerger = &pReader->status.merger;
|
||||
int32_t code = 0;
|
||||
|
||||
if (pMerger->pArray == NULL) {
|
||||
STSchema* ps = getTableSchemaImpl(pReader, uid);
|
||||
if (ps == NULL) {
|
||||
return terrno;
|
||||
}
|
||||
|
||||
code = tsdbRowMergerInit(pMerger, ps);
|
||||
}
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
static int32_t buildDataBlockFromBuf(STsdbReader* pReader, STableBlockScanInfo* pBlockScanInfo, int64_t endKey) {
|
||||
if (!(pBlockScanInfo->iiter.hasVal || pBlockScanInfo->iter.hasVal)) {
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t code = initRowMergeIfNeeded(pReader, pBlockScanInfo->uid);
|
||||
if (code != 0) {
|
||||
return code;
|
||||
}
|
||||
|
||||
int64_t st = taosGetTimestampUs();
|
||||
SSDataBlock* pBlock = pReader->resBlockInfo.pResBlock;
|
||||
int32_t code = buildDataBlockFromBufImpl(pBlockScanInfo, endKey, pReader->resBlockInfo.capacity, pReader);
|
||||
code = buildDataBlockFromBufImpl(pBlockScanInfo, endKey, pReader->resBlockInfo.capacity, pReader);
|
||||
|
||||
double el = (taosGetTimestampUs() - st) / 1000.0;
|
||||
updateComposedBlockInfo(pReader, el, pBlockScanInfo);
|
||||
|
@ -1943,19 +1964,9 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo*
|
|||
TSDBROW fRow = tsdbRowFromBlockData(pBlockData, pDumpInfo->rowIndex);
|
||||
|
||||
// merge is not initialized yet, due to the fact that the pReader->info.pSchema is not initialized
|
||||
if (pMerger->pArray == NULL) {
|
||||
if (pReader->info.pSchema != NULL) {
|
||||
tsdbError("tsdb failed at %s:%d", __func__, __LINE__);
|
||||
return TSDB_CODE_INTERNAL_ERROR;
|
||||
}
|
||||
STSchema* ps = getTableSchemaImpl(pReader, pBlockScanInfo->uid);
|
||||
if (ps == NULL) {
|
||||
return terrno;
|
||||
}
|
||||
int32_t code = tsdbRowMergerInit(pMerger, ps);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
int32_t code = initRowMergeIfNeeded(pReader, pBlockScanInfo->uid);
|
||||
if (code != 0) {
|
||||
return code;
|
||||
}
|
||||
|
||||
SRowKey minKey = k;
|
||||
|
@ -1983,7 +1994,7 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo*
|
|||
|
||||
// file block ---> stt block -----> mem
|
||||
if (pkCompEx(&minKey, pfKey) == 0) {
|
||||
int32_t code = tsdbRowMergerAdd(pMerger, &fRow, NULL);
|
||||
code = tsdbRowMergerAdd(pMerger, &fRow, NULL);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
|
@ -1996,7 +2007,7 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo*
|
|||
|
||||
if (pkCompEx(&minKey, pSttKey) == 0) {
|
||||
TSDBROW* fRow1 = tMergeTreeGetRow(&pSttBlockReader->mergeTree);
|
||||
int32_t code = tsdbRowMergerAdd(pMerger, fRow1, NULL);
|
||||
code = tsdbRowMergerAdd(pMerger, fRow1, NULL);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
|
@ -2007,7 +2018,7 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo*
|
|||
}
|
||||
|
||||
if (pkCompEx(&minKey, &k) == 0) {
|
||||
int32_t code = tsdbRowMergerAdd(pMerger, pRow, pSchema);
|
||||
code = tsdbRowMergerAdd(pMerger, pRow, pSchema);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
|
@ -2018,7 +2029,7 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo*
|
|||
}
|
||||
}
|
||||
|
||||
int32_t code = tsdbRowMergerGetRow(pMerger, &pTSRow);
|
||||
code = tsdbRowMergerGetRow(pMerger, &pTSRow);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
|
@ -2039,19 +2050,9 @@ static int32_t mergeFileBlockAndSttBlock(STsdbReader* pReader, SSttBlockReader*
|
|||
int32_t pkSrcSlot = pReader->suppInfo.pkSrcSlot;
|
||||
|
||||
// merge is not initialized yet, due to the fact that the pReader->info.pSchema is not initialized
|
||||
if (pMerger->pArray == NULL) {
|
||||
if (pReader->info.pSchema) {
|
||||
tsdbError("tsdb failed at %s %d", __func__, __LINE__);
|
||||
return TSDB_CODE_INTERNAL_ERROR;
|
||||
}
|
||||
STSchema* ps = getTableSchemaImpl(pReader, pBlockScanInfo->uid);
|
||||
if (ps == NULL) {
|
||||
return terrno;
|
||||
}
|
||||
code = tsdbRowMergerInit(pMerger, ps);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
code = initRowMergeIfNeeded(pReader, pBlockScanInfo->uid);
|
||||
if (code != 0) {
|
||||
return code;
|
||||
}
|
||||
|
||||
bool dataInDataFile = hasDataInFileBlock(pBlockData, pDumpInfo);
|
||||
|
@ -2175,20 +2176,9 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
|
|||
}
|
||||
|
||||
// merge is not initialized yet, due to the fact that the pReader->info.pSchema is not initialized
|
||||
if (pMerger->pArray == NULL) {
|
||||
if (pReader->info.pSchema != NULL) {
|
||||
tsdbError("tsdb read failed at: %s:%d", __func__, __LINE__);
|
||||
return TSDB_CODE_INTERNAL_ERROR;
|
||||
}
|
||||
STSchema* ps = getTableSchemaImpl(pReader, pBlockScanInfo->uid);
|
||||
if (ps == NULL) {
|
||||
return terrno;
|
||||
}
|
||||
|
||||
code = tsdbRowMergerInit(pMerger, ps);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
code = initRowMergeIfNeeded(pReader, pBlockScanInfo->uid);
|
||||
if (code != 0) {
|
||||
return code;
|
||||
}
|
||||
|
||||
SRowKey minKey = k;
|
||||
|
@ -2579,20 +2569,9 @@ int32_t mergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pBloc
|
|||
}
|
||||
|
||||
// merge is not initialized yet, due to the fact that the pReader->info.pSchema is not initialized
|
||||
if (pMerger->pArray == NULL) {
|
||||
if (pReader->info.pSchema != NULL) {
|
||||
tsdbError("tsdb reader failed at: %s:%d", __func__, __LINE__);
|
||||
return TSDB_CODE_INTERNAL_ERROR;
|
||||
}
|
||||
STSchema* ps = getTableSchemaImpl(pReader, pBlockScanInfo->uid);
|
||||
if (ps == NULL) {
|
||||
return terrno;
|
||||
}
|
||||
|
||||
code = tsdbRowMergerInit(pMerger, ps);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
code = initRowMergeIfNeeded(pReader, pBlockScanInfo->uid);
|
||||
if (code != 0) {
|
||||
return code;
|
||||
}
|
||||
|
||||
tRowKeyAssign(&pBlockScanInfo->lastProcKey, pKey);
|
||||
|
@ -4770,13 +4749,13 @@ int32_t tsdbReaderOpen2(void* pVnode, SQueryTableDataCond* pCond, void* pTableLi
|
|||
if (pCond->suid != 0) {
|
||||
pReader->info.pSchema = metaGetTbTSchema(pReader->pTsdb->pVnode->pMeta, pReader->info.suid, -1, 1);
|
||||
if (pReader->info.pSchema == NULL) {
|
||||
tsdbError("failed to get table schema, suid:%" PRIu64 ", ver:-1, %s", pReader->info.suid, pReader->idStr);
|
||||
tsdbWarn("failed to get table schema, suid:%" PRIu64 ", ver:-1, %s", pReader->info.suid, pReader->idStr);
|
||||
}
|
||||
} else if (numOfTables > 0) {
|
||||
STableKeyInfo* pKey = pTableList;
|
||||
pReader->info.pSchema = metaGetTbTSchema(pReader->pTsdb->pVnode->pMeta, pKey->uid, -1, 1);
|
||||
if (pReader->info.pSchema == NULL) {
|
||||
tsdbError("failed to get table schema, uid:%" PRIu64 ", ver:-1, %s", pKey->uid, pReader->idStr);
|
||||
tsdbWarn("failed to get table schema, uid:%" PRIu64 ", ver:-1, %s", pKey->uid, pReader->idStr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
@ -753,7 +753,7 @@ int32_t ctgBuildBatchReqMsg(SCtgBatch* pBatch, int32_t vgId, void** msg, int32_t
|
|||
*msg = taosMemoryCalloc(1, msgSize);
|
||||
if (NULL == (*msg)) {
|
||||
qError("calloc batchReq msg failed, size:%d", msgSize);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
if (tSerializeSBatchReq(*msg, msgSize, &batchReq) < 0) {
|
||||
qError("tSerializeSBatchReq failed");
|
||||
|
@ -928,7 +928,7 @@ int32_t ctgGetDBVgInfoFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, SBuildU
|
|||
if (pTask) {
|
||||
void* pOut = taosMemoryCalloc(1, sizeof(SUseDbOutput));
|
||||
if (NULL == pOut) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
CTG_ERR_RET(ctgUpdateMsgCtx(CTG_GET_TASK_MSGCTX(pTask, tReq->msgIdx), reqType, pOut, input->db));
|
||||
|
@ -983,7 +983,7 @@ int32_t ctgGetDBCfgFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, const char
|
|||
if (pTask) {
|
||||
void* pOut = taosMemoryCalloc(1, sizeof(SDbCfgInfo));
|
||||
if (NULL == pOut) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
CTG_ERR_RET(ctgUpdateMsgCtx(CTG_GET_TASK_MSGCTX(pTask, -1), reqType, pOut, (char*)dbFName));
|
||||
|
@ -1041,7 +1041,7 @@ int32_t ctgGetIndexInfoFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, const
|
|||
if (pTask) {
|
||||
void* pOut = taosMemoryCalloc(1, sizeof(SIndexInfo));
|
||||
if (NULL == pOut) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
CTG_ERR_RET(ctgUpdateMsgCtx(CTG_GET_TASK_MSGCTX(pTask, -1), reqType, pOut, (char*)indexName));
|
||||
|
@ -1101,7 +1101,7 @@ int32_t ctgGetTbIndexFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, SName* n
|
|||
if (pTask) {
|
||||
void* pOut = taosMemoryCalloc(1, sizeof(STableIndex));
|
||||
if (NULL == pOut) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
CTG_ERR_RET(ctgUpdateMsgCtx(CTG_GET_TASK_MSGCTX(pTask, -1), reqType, pOut, (char*)tbFName));
|
||||
|
@ -1159,7 +1159,7 @@ int32_t ctgGetUdfInfoFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, const ch
|
|||
if (pTask) {
|
||||
void* pOut = taosMemoryCalloc(1, sizeof(SFuncInfo));
|
||||
if (NULL == pOut) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
CTG_ERR_RET(ctgUpdateMsgCtx(CTG_GET_TASK_MSGCTX(pTask, -1), reqType, pOut, (char*)funcName));
|
||||
|
@ -1217,7 +1217,7 @@ int32_t ctgGetUserDbAuthFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, const
|
|||
if (pTask) {
|
||||
void* pOut = taosMemoryCalloc(1, sizeof(SGetUserAuthRsp));
|
||||
if (NULL == pOut) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
CTG_ERR_RET(ctgUpdateMsgCtx(CTG_GET_TASK_MSGCTX(pTask, -1), reqType, pOut, (char*)user));
|
||||
|
@ -1280,7 +1280,7 @@ int32_t ctgGetTbMetaFromMnodeImpl(SCatalog* pCtg, SRequestConnInfo* pConn, const
|
|||
if (pTask) {
|
||||
void* pOut = taosMemoryCalloc(1, sizeof(STableMetaOutput));
|
||||
if (NULL == pOut) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
CTG_ERR_RET(ctgUpdateMsgCtx(CTG_GET_TASK_MSGCTX(pTask, tReq->msgIdx), reqType, pOut, tbFName));
|
||||
|
@ -1353,7 +1353,7 @@ int32_t ctgGetTbMetaFromVnode(SCatalog* pCtg, SRequestConnInfo* pConn, const SNa
|
|||
if (pTask) {
|
||||
void* pOut = taosMemoryCalloc(1, sizeof(STableMetaOutput));
|
||||
if (NULL == pOut) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
SRequestConnInfo vConn = {.pTrans = pConn->pTrans,
|
||||
|
@ -1597,7 +1597,7 @@ int32_t ctgGetViewInfoFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, SName*
|
|||
if (pTask) {
|
||||
void* pOut = taosMemoryCalloc(1, POINTER_BYTES);
|
||||
if (NULL == pOut) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
CTG_ERR_RET(ctgUpdateMsgCtx(CTG_GET_TASK_MSGCTX(pTask, tReq->msgIdx), reqType, pOut, fullName));
|
||||
|
@ -1654,7 +1654,7 @@ int32_t ctgGetTbTSMAFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, const SNa
|
|||
if (pTask) {
|
||||
void* pOut = taosMemoryCalloc(1, sizeof(STableTSMAInfoRsp));
|
||||
if (NULL == pOut) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
CTG_ERR_RET(ctgUpdateMsgCtx(CTG_GET_TASK_MSGCTX(pTask, tReq->msgIdx), reqType, pOut, (char*)tbFName));
|
||||
|
@ -1715,7 +1715,7 @@ int32_t ctgGetStreamProgressFromVnode(SCatalog* pCtg, SRequestConnInfo* pConn, c
|
|||
if (pTask) {
|
||||
SStreamProgressRsp* pOut = taosMemoryCalloc(1, sizeof(SStreamProgressRsp));
|
||||
if (!pOut) {
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_RET(terrno);
|
||||
}
|
||||
CTG_ERR_RET(ctgUpdateMsgCtx(CTG_GET_TASK_MSGCTX(pTask, tReq->msgIdx), reqType, pOut, (char*)tbFName));
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -536,7 +536,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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ int32_t optrDummyOpenFn(SOperatorInfo* pOperator) {
|
|||
int32_t appendDownstream(SOperatorInfo* p, SOperatorInfo** pDownstream, int32_t num) {
|
||||
p->pDownstream = taosMemoryCalloc(1, num * POINTER_BYTES);
|
||||
if (p->pDownstream == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
memcpy(p->pDownstream, pDownstream, num * POINTER_BYTES);
|
||||
|
@ -824,7 +824,7 @@ int32_t setOperatorParams(struct SOperatorInfo* pOperator, SOperatorParam* pInpu
|
|||
if (NULL == *pppDownstramParam) {
|
||||
*pppDownstramParam = taosMemoryCalloc(pOperator->numOfDownstream, POINTER_BYTES);
|
||||
if (NULL == *pppDownstramParam) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ int32_t createProjectOperatorInfo(SOperatorInfo* downstream, SProjectPhysiNode*
|
|||
SProjectOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SProjectOperatorInfo));
|
||||
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
|
||||
if (pInfo == NULL || pOperator == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _error;
|
||||
}
|
||||
|
||||
|
@ -450,7 +450,7 @@ int32_t createIndefinitOutputOperatorInfo(SOperatorInfo* downstream, SPhysiNode*
|
|||
SIndefOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SIndefOperatorInfo));
|
||||
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
|
||||
if (pInfo == NULL || pOperator == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _error;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ int32_t doCreateTask(uint64_t queryId, uint64_t taskId, int32_t vgId, EOPTR_EXEC
|
|||
|
||||
SExecTaskInfo* p = taosMemoryCalloc(1, sizeof(SExecTaskInfo));
|
||||
if (p == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
setTaskStatus(p, TASK_NOT_COMPLETED);
|
||||
|
@ -217,6 +217,7 @@ SSchemaWrapper* extractQueriedColumnSchema(SScanPhysiNode* pScanNode) {
|
|||
|
||||
pqSw->pSchema = taosMemoryCalloc(numOfCols + numOfTags, sizeof(SSchema));
|
||||
if (pqSw->pSchema == NULL) {
|
||||
taosMemoryFree(pqSw);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -744,9 +744,7 @@ _end:
|
|||
insertRet = taosLRUCacheInsert(pCache->pTableMetaEntryCache, &pBlock->info.id.uid, sizeof(uint64_t), pVal,
|
||||
sizeof(STableCachedVal), freeCachedMetaItem, NULL, TAOS_LRU_PRIORITY_LOW, NULL);
|
||||
if (insertRet != TAOS_LRU_STATUS_OK) {
|
||||
qError("failed to put meta into lru cache, code:%d, %s", insertRet, idStr);
|
||||
taosMemoryFreeClear(pVal);
|
||||
freeTableCachedValObj(&val);
|
||||
qWarn("failed to put meta into lru cache, code:%d, %s", insertRet, idStr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1452,7 +1450,7 @@ int32_t createTableScanOperatorInfo(STableScanPhysiNode* pTableScanNode, SReadHa
|
|||
STableScanInfo* pInfo = taosMemoryCalloc(1, sizeof(STableScanInfo));
|
||||
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
|
||||
if (pInfo == NULL || pOperator == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _error;
|
||||
}
|
||||
|
||||
|
@ -1551,7 +1549,7 @@ int32_t createTableSeqScanOperatorInfo(void* pReadHandle, SExecTaskInfo* pTaskIn
|
|||
STableScanInfo* pInfo = taosMemoryCalloc(1, sizeof(STableScanInfo));
|
||||
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
|
||||
if (pInfo == NULL || pOperator == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _end;
|
||||
}
|
||||
|
||||
|
@ -3122,7 +3120,7 @@ int32_t streamScanOperatorEncode(SStreamScanInfo* pInfo, void** pBuff, int32_t*
|
|||
len += encodeSTimeWindowAggSupp(NULL, &pInfo->twAggSup);
|
||||
*pBuff = taosMemoryCalloc(1, len);
|
||||
if (!(*pBuff)) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
void* buf = *pBuff;
|
||||
|
@ -3842,7 +3840,7 @@ int32_t createRawScanOperatorInfo(SReadHandle* pHandle, SExecTaskInfo* pTaskInfo
|
|||
SStreamRawScanInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamRawScanInfo));
|
||||
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
|
||||
if (pInfo == NULL || pOperator == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
lino = __LINE__;
|
||||
goto _end;
|
||||
}
|
||||
|
@ -3925,7 +3923,7 @@ void streamScanReleaseState(SOperatorInfo* pOperator) {
|
|||
|
||||
pBuff = taosMemoryCalloc(1, len);
|
||||
if (!pBuff) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
|
||||
|
@ -3961,7 +3959,7 @@ void streamScanReloadState(SOperatorInfo* pOperator) {
|
|||
|
||||
SUpdateInfo* pUpInfo = taosMemoryCalloc(1, sizeof(SUpdateInfo));
|
||||
if (!pUpInfo) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
|
||||
|
@ -4038,7 +4036,7 @@ int32_t createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhysiNode*
|
|||
const char* idstr = pTaskInfo->id.str;
|
||||
|
||||
if (pInfo == NULL || pOperator == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _error;
|
||||
}
|
||||
|
||||
|
@ -4341,7 +4339,6 @@ static void tagScanFreeUidTag(void* p) {
|
|||
static int32_t tagScanCreateResultData(SDataType* pType, int32_t numOfRows, SScalarParam* pParam) {
|
||||
SColumnInfoData* pColumnData = taosMemoryCalloc(1, sizeof(SColumnInfoData));
|
||||
if (pColumnData == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
|
@ -4750,7 +4747,7 @@ int32_t createTagScanOperatorInfo(SReadHandle* pReadHandle, STagScanPhysiNode* p
|
|||
STagScanInfo* pInfo = taosMemoryCalloc(1, sizeof(STagScanInfo));
|
||||
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
|
||||
if (pInfo == NULL || pOperator == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _error;
|
||||
}
|
||||
|
||||
|
@ -5030,7 +5027,7 @@ static int32_t initSubTablesMergeInfo(STableMergeScanInfo* pInfo) {
|
|||
}
|
||||
STmsSubTablesMergeInfo* pSubTblsInfo = taosMemoryCalloc(1, sizeof(STmsSubTablesMergeInfo));
|
||||
if (pSubTblsInfo == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
pSubTblsInfo->pTsOrderInfo = taosArrayGet(pInfo->pSortInfo, 0);
|
||||
if (!pSubTblsInfo->pTsOrderInfo) {
|
||||
|
@ -5050,7 +5047,7 @@ static int32_t initSubTablesMergeInfo(STableMergeScanInfo* pInfo) {
|
|||
pSubTblsInfo->aInputs = taosMemoryCalloc(pSubTblsInfo->numSubTables, sizeof(STmsSubTableInput));
|
||||
if (pSubTblsInfo->aInputs == NULL) {
|
||||
taosMemoryFree(pSubTblsInfo);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
int32_t bufPageSize = pInfo->bufPageSize;
|
||||
int32_t inMemSize = (pSubTblsInfo->numSubTables - pSubTblsInfo->numTableBlocksInMem) * bufPageSize;
|
||||
|
@ -5975,7 +5972,7 @@ int32_t createTableMergeScanOperatorInfo(STableScanPhysiNode* pTableScanNode, SR
|
|||
STableMergeScanInfo* pInfo = taosMemoryCalloc(1, sizeof(STableMergeScanInfo));
|
||||
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
|
||||
if (pInfo == NULL || pOperator == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _error;
|
||||
}
|
||||
|
||||
|
@ -6218,7 +6215,7 @@ int32_t createTableCountScanOperatorInfo(SReadHandle* readHandle, STableCountSca
|
|||
STableCountScanOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(STableCountScanOperatorInfo));
|
||||
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
|
||||
if (!pInfo || !pOperator) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _error;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ int32_t createSortOperatorInfo(SOperatorInfo* downstream, SSortPhysiNode* pSortN
|
|||
SSortOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SSortOperatorInfo));
|
||||
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
|
||||
if (pInfo == NULL || pOperator == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _error;
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ int32_t createSortOperatorInfo(SOperatorInfo* downstream, SSortPhysiNode* pSortN
|
|||
int32_t keyLen;
|
||||
SSortOpGroupIdCalc* pGroupIdCalc = pInfo->pGroupIdCalc = taosMemoryCalloc(1, sizeof(SSortOpGroupIdCalc));
|
||||
if (!pGroupIdCalc) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _error;
|
||||
}
|
||||
SNodeList* pSortColsNodeArr = makeColsNodeArrFromSortKeys(pSortNode->pSortKeys);
|
||||
|
@ -784,7 +784,7 @@ int32_t createGroupSortOperatorInfo(SOperatorInfo* downstream, SGroupSortPhysiNo
|
|||
SGroupSortOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SGroupSortOperatorInfo));
|
||||
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
|
||||
if (pInfo == NULL || pOperator == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _error;
|
||||
}
|
||||
|
||||
|
|
|
@ -484,7 +484,7 @@ void doStreamCountSaveCheckpoint(SOperatorInfo* pOperator) {
|
|||
int32_t len = doStreamCountEncodeOpState(NULL, 0, pOperator, true);
|
||||
pBuf = taosMemoryCalloc(1, len);
|
||||
if (!pBuf) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
void* pTmpBuf = pBuf;
|
||||
|
@ -816,7 +816,7 @@ int32_t createStreamCountAggOperatorInfo(SOperatorInfo* downstream, SPhysiNode*
|
|||
SStreamCountAggOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamCountAggOperatorInfo));
|
||||
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
|
||||
if (pInfo == NULL || pOperator == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _error);
|
||||
}
|
||||
|
||||
|
|
|
@ -867,7 +867,7 @@ int32_t createStreamEventAggOperatorInfo(SOperatorInfo* downstream, SPhysiNode*
|
|||
SStreamEventAggOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamEventAggOperatorInfo));
|
||||
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
|
||||
if (pInfo == NULL || pOperator == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _error;
|
||||
}
|
||||
|
||||
|
|
|
@ -1189,7 +1189,7 @@ static SStreamFillSupporter* initStreamFillSup(SStreamFillPhysiNode* pPhyFillNod
|
|||
int32_t lino = 0;
|
||||
SStreamFillSupporter* pFillSup = taosMemoryCalloc(1, sizeof(SStreamFillSupporter));
|
||||
if (!pFillSup) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
pFillSup->numOfFillCols = numOfFillCols;
|
||||
|
@ -1242,7 +1242,7 @@ SStreamFillInfo* initStreamFillInfo(SStreamFillSupporter* pFillSup, SSDataBlock*
|
|||
int32_t lino = 0;
|
||||
SStreamFillInfo* pFillInfo = taosMemoryCalloc(1, sizeof(SStreamFillInfo));
|
||||
if (!pFillInfo) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
|
||||
|
@ -1253,7 +1253,7 @@ SStreamFillInfo* initStreamFillInfo(SStreamFillSupporter* pFillSup, SSDataBlock*
|
|||
pFillInfo->needFill = false;
|
||||
pFillInfo->pLinearInfo = taosMemoryCalloc(1, sizeof(SStreamFillLinearInfo));
|
||||
if (!pFillInfo) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
|
||||
|
@ -1279,7 +1279,7 @@ SStreamFillInfo* initStreamFillInfo(SStreamFillSupporter* pFillSup, SSDataBlock*
|
|||
SPoint value = {0};
|
||||
value.val = taosMemoryCalloc(1, pColData->info.bytes);
|
||||
if (!value.val) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
|
||||
|
@ -1291,7 +1291,7 @@ SStreamFillInfo* initStreamFillInfo(SStreamFillSupporter* pFillSup, SSDataBlock*
|
|||
|
||||
value.val = taosMemoryCalloc(1, pColData->info.bytes);
|
||||
if (!value.val) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
|
||||
|
@ -1309,14 +1309,14 @@ SStreamFillInfo* initStreamFillInfo(SStreamFillSupporter* pFillSup, SSDataBlock*
|
|||
pFillSup->type == TSDB_FILL_NULL || pFillSup->type == TSDB_FILL_NULL_F) {
|
||||
pFillInfo->pResRow = taosMemoryCalloc(1, sizeof(SResultRowData));
|
||||
if (!pFillInfo->pResRow) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
|
||||
pFillInfo->pResRow->key = INT64_MIN;
|
||||
pFillInfo->pResRow->pRowVal = taosMemoryCalloc(1, pFillSup->rowSize);
|
||||
if (!pFillInfo->pResRow->pRowVal) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
|
||||
|
@ -1356,7 +1356,7 @@ int32_t createStreamFillOperatorInfo(SOperatorInfo* downstream, SStreamFillPhysi
|
|||
SStreamFillOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamFillOperatorInfo));
|
||||
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
|
||||
if (pInfo == NULL || pOperator == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _error);
|
||||
}
|
||||
|
||||
|
|
|
@ -1884,7 +1884,7 @@ int32_t createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, SPhysiN
|
|||
SStreamIntervalOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamIntervalOperatorInfo));
|
||||
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
|
||||
if (pInfo == NULL || pOperator == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _error);
|
||||
}
|
||||
|
||||
|
@ -3753,7 +3753,7 @@ int32_t createStreamSessionAggOperatorInfo(SOperatorInfo* downstream, SPhysiNode
|
|||
SStreamSessionAggOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamSessionAggOperatorInfo));
|
||||
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
|
||||
if (pInfo == NULL || pOperator == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _error;
|
||||
}
|
||||
|
||||
|
@ -4931,7 +4931,7 @@ int32_t createStreamStateAggOperatorInfo(SOperatorInfo* downstream, SPhysiNode*
|
|||
SStreamStateAggOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamStateAggOperatorInfo));
|
||||
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
|
||||
if (pInfo == NULL || pOperator == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _error);
|
||||
}
|
||||
|
||||
|
@ -5247,7 +5247,7 @@ int32_t createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SPhysiNode*
|
|||
SStreamIntervalOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamIntervalOperatorInfo));
|
||||
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
|
||||
if (pInfo == NULL || pOperator == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _error);
|
||||
}
|
||||
|
||||
|
|
|
@ -2236,7 +2236,7 @@ int32_t createSysTableScanOperatorInfo(void* readHandle, SSystemTableScanPhysiNo
|
|||
SSysTableScanInfo* pInfo = taosMemoryCalloc(1, sizeof(SSysTableScanInfo));
|
||||
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
|
||||
if (pInfo == NULL || pOperator == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
lino = __LINE__;
|
||||
goto _error;
|
||||
}
|
||||
|
@ -2832,7 +2832,6 @@ static int32_t initTableblockDistQueryCond(uint64_t uid, SQueryTableDataCond* pC
|
|||
pCond->colList = taosMemoryCalloc(1, sizeof(SColumnInfo));
|
||||
pCond->pSlotList = taosMemoryMalloc(sizeof(int32_t));
|
||||
if (pCond->colList == NULL || pCond->pSlotList == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
|
@ -2862,7 +2861,7 @@ int32_t createDataBlockInfoScanOperator(SReadHandle* readHandle, SBlockDistScanP
|
|||
SBlockDistInfo* pInfo = taosMemoryCalloc(1, sizeof(SBlockDistInfo));
|
||||
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
|
||||
if (pInfo == NULL || pOperator == NULL) {
|
||||
pTaskInfo->code = code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
pTaskInfo->code = code = terrno;
|
||||
goto _error;
|
||||
}
|
||||
|
||||
|
|
|
@ -652,7 +652,7 @@ static int32_t initGroupKeyKeeper(STimeSliceOperatorInfo* pInfo, SExprSupp* pExp
|
|||
|
||||
pInfo->pPrevGroupKey = taosMemoryCalloc(1, sizeof(SGroupKeys));
|
||||
if (pInfo->pPrevGroupKey == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < pExprSup->numOfExprs; ++i) {
|
||||
|
@ -1112,7 +1112,7 @@ int32_t createTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pPhyN
|
|||
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
|
||||
|
||||
if (pOperator == NULL || pInfo == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _error;
|
||||
}
|
||||
|
||||
|
|
|
@ -1327,7 +1327,7 @@ int32_t createIntervalOperatorInfo(SOperatorInfo* downstream, SIntervalPhysiNode
|
|||
SIntervalAggOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SIntervalAggOperatorInfo));
|
||||
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
|
||||
if (pInfo == NULL || pOperator == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _error;
|
||||
}
|
||||
|
||||
|
@ -1623,7 +1623,7 @@ int32_t createStatewindowOperatorInfo(SOperatorInfo* downstream, SStateWinodwPhy
|
|||
SStateWindowOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStateWindowOperatorInfo));
|
||||
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
|
||||
if (pInfo == NULL || pOperator == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _error;
|
||||
}
|
||||
|
||||
|
@ -1734,7 +1734,7 @@ int32_t createSessionAggOperatorInfo(SOperatorInfo* downstream, SSessionWinodwPh
|
|||
SSessionAggOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SSessionAggOperatorInfo));
|
||||
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
|
||||
if (pInfo == NULL || pOperator == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _error;
|
||||
}
|
||||
|
||||
|
@ -2034,7 +2034,7 @@ int32_t createMergeAlignedIntervalOperatorInfo(SOperatorInfo* downstream, SMerge
|
|||
SMergeAlignedIntervalAggOperatorInfo* miaInfo = taosMemoryCalloc(1, sizeof(SMergeAlignedIntervalAggOperatorInfo));
|
||||
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
|
||||
if (miaInfo == NULL || pOperator == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _error;
|
||||
}
|
||||
|
||||
|
@ -2372,7 +2372,7 @@ int32_t createMergeIntervalOperatorInfo(SOperatorInfo* downstream, SMergeInterva
|
|||
SMergeIntervalAggOperatorInfo* pMergeIntervalInfo = taosMemoryCalloc(1, sizeof(SMergeIntervalAggOperatorInfo));
|
||||
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
|
||||
if (pMergeIntervalInfo == NULL || pOperator == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _error;
|
||||
}
|
||||
|
||||
|
|
|
@ -260,7 +260,7 @@ static int32_t doAddNewBucket(SLHashObj* pHashObj) {
|
|||
SLHashObj* tHashInit(int32_t inMemPages, int32_t pageSize, _hash_fn_t fn, int32_t numOfTuplePerPage) {
|
||||
SLHashObj* pHashObj = taosMemoryCalloc(1, sizeof(SLHashObj));
|
||||
if (pHashObj == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
terrno = terrno;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -1357,7 +1357,7 @@ static int32_t createSortMemFile(SSortHandle* pHandle) {
|
|||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
SSortMemFile* pMemFile = taosMemoryCalloc(1, sizeof(SSortMemFile));
|
||||
if (pMemFile == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
}
|
||||
if (code == TSDB_CODE_SUCCESS) {
|
||||
taosGetTmpfilePath(tsTempDir, "sort-ext-mem", pMemFile->memFilePath);
|
||||
|
|
|
@ -234,7 +234,7 @@ static int32_t addTimezoneParam(SNodeList* pList) {
|
|||
pVal->datum.p = taosMemoryCalloc(1, len + VARSTR_HEADER_SIZE + 1);
|
||||
if (pVal->datum.p == NULL) {
|
||||
nodesDestroyNode((SNode*)pVal);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
varDataSetLen(pVal->datum.p, len);
|
||||
(void)strncpy(varDataVal(pVal->datum.p), pVal->literal, len);
|
||||
|
@ -1266,7 +1266,7 @@ static int32_t validateHistogramBinDesc(char* binDescStr, int8_t binType, char*
|
|||
if (intervals == NULL) {
|
||||
(void)snprintf(errMsg, msgLen, "%s", msg9);
|
||||
cJSON_Delete(binDesc);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
cJSON* bin = binDesc->child;
|
||||
if (bin == NULL) {
|
||||
|
|
|
@ -1685,7 +1685,7 @@ int32_t stdPartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
|
|||
char* res = taosMemoryCalloc(resultBytes + VARSTR_HEADER_SIZE, sizeof(char));
|
||||
|
||||
if (NULL == res) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
(void)memcpy(varDataVal(res), pInfo, resultBytes);
|
||||
varDataSetLen(res, resultBytes);
|
||||
|
@ -2447,7 +2447,7 @@ int32_t apercentilePartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
|
|||
int32_t resultBytes = getApercentileMaxSize();
|
||||
char* res = taosMemoryCalloc(resultBytes + VARSTR_HEADER_SIZE, sizeof(char));
|
||||
if (NULL == res) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
if (pInfo->algo == APERCT_ALGO_TDIGEST) {
|
||||
|
@ -3107,7 +3107,7 @@ int32_t firstLastPartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
|
|||
// todo check for failure
|
||||
char* res = taosMemoryCalloc(resultBytes + VARSTR_HEADER_SIZE, sizeof(char));
|
||||
if (NULL == res) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
(void)memcpy(varDataVal(res), pRes, resultBytes);
|
||||
|
||||
|
@ -4358,7 +4358,7 @@ int32_t spreadPartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
|
|||
char* res = taosMemoryCalloc(resultBytes + VARSTR_HEADER_SIZE, sizeof(char));
|
||||
|
||||
if (NULL == res) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
(void)memcpy(varDataVal(res), pInfo, resultBytes);
|
||||
varDataSetLen(res, resultBytes);
|
||||
|
@ -4548,7 +4548,7 @@ int32_t elapsedPartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
|
|||
char* res = taosMemoryCalloc(resultBytes + VARSTR_HEADER_SIZE, sizeof(char));
|
||||
|
||||
if (NULL == res) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
(void)memcpy(varDataVal(res), pInfo, resultBytes);
|
||||
varDataSetLen(res, resultBytes);
|
||||
|
@ -4654,7 +4654,7 @@ static int32_t getHistogramBinDesc(SHistoFuncInfo* pInfo, char* binDescStr, int8
|
|||
if (NULL == intervals) {
|
||||
cJSON_Delete(binDesc);
|
||||
qError("histogram function out of memory");
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
if (cJSON_IsNumber(width) && factor == NULL && binType == LINEAR_BIN) {
|
||||
// linear bin process
|
||||
|
@ -4720,7 +4720,7 @@ static int32_t getHistogramBinDesc(SHistoFuncInfo* pInfo, char* binDescStr, int8
|
|||
if (NULL == intervals) {
|
||||
cJSON_Delete(binDesc);
|
||||
qError("histogram function out of memory");
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
cJSON* bin = binDesc->child;
|
||||
if (bin == NULL) {
|
||||
|
@ -4925,7 +4925,7 @@ int32_t histogramPartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
|
|||
char* res = taosMemoryCalloc(resultBytes + VARSTR_HEADER_SIZE, sizeof(char));
|
||||
|
||||
if (NULL == res) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
(void)memcpy(varDataVal(res), pInfo, resultBytes);
|
||||
varDataSetLen(res, resultBytes);
|
||||
|
@ -5158,7 +5158,7 @@ int32_t hllPartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
|
|||
char* res = taosMemoryCalloc(resultBytes + VARSTR_HEADER_SIZE, sizeof(char));
|
||||
|
||||
if (NULL == res) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
(void)memcpy(varDataVal(res), pInfo, resultBytes);
|
||||
varDataSetLen(res, resultBytes);
|
||||
|
@ -6993,7 +6993,7 @@ int32_t iratePartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
|
|||
char* res = taosMemoryCalloc(resultBytes + VARSTR_HEADER_SIZE, sizeof(char));
|
||||
|
||||
if (NULL == res) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
(void)memcpy(varDataVal(res), pInfo, resultBytes);
|
||||
varDataSetLen(res, resultBytes);
|
||||
|
|
|
@ -854,7 +854,7 @@ int32_t avgPartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
|
|||
char* res = taosMemoryCalloc(resultBytes + VARSTR_HEADER_SIZE, sizeof(char));
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
if (NULL == res) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
(void)memcpy(varDataVal(res), pInfo, resultBytes);
|
||||
varDataSetLen(res, resultBytes);
|
||||
|
|
|
@ -594,7 +594,7 @@ int32_t tHistogramMerge(SHistogramInfo* pHisto1, SHistogramInfo* pHisto2, int32_
|
|||
|
||||
SHistBin* pHistoBins = taosMemoryCalloc(1, sizeof(SHistBin) * (pHisto1->numOfEntries + pHisto2->numOfEntries));
|
||||
if (NULL == pHistoBins) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
int32_t i = 0, j = 0, k = 0;
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ static int32_t loadDataFromFilePage(tMemBucket *pMemBucket, int32_t slotIdx, SFi
|
|||
*buffer =
|
||||
(SFilePage *)taosMemoryCalloc(1, pMemBucket->bytes * pMemBucket->pSlots[slotIdx].info.size + sizeof(SFilePage));
|
||||
if (NULL == *buffer) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t groupId = getGroupId(pMemBucket->numOfSlots, slotIdx, pMemBucket->times);
|
||||
|
@ -271,7 +271,7 @@ int32_t tMemBucketCreate(int32_t nElemSize, int16_t dataType, double minval, dou
|
|||
tMemBucket **pBucket) {
|
||||
*pBucket = (tMemBucket *)taosMemoryCalloc(1, sizeof(tMemBucket));
|
||||
if (*pBucket == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
if (hasWindowOrGroup) {
|
||||
|
@ -313,7 +313,7 @@ int32_t tMemBucketCreate(int32_t nElemSize, int16_t dataType, double minval, dou
|
|||
(*pBucket)->pSlots = (tMemBucketSlot *)taosMemoryCalloc((*pBucket)->numOfSlots, sizeof(tMemBucketSlot));
|
||||
if ((*pBucket)->pSlots == NULL) {
|
||||
tMemBucketDestroy(*pBucket);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
resetSlotInfo((*pBucket));
|
||||
|
|
|
@ -474,7 +474,7 @@ void udfdDeinitPythonPlugin(SUdfScriptPlugin *plugin) {
|
|||
int32_t udfdInitScriptPlugin(int8_t scriptType) {
|
||||
SUdfScriptPlugin *plugin = taosMemoryCalloc(1, sizeof(SUdfScriptPlugin));
|
||||
if (plugin == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
int32_t err = 0;
|
||||
switch (scriptType) {
|
||||
|
|
|
@ -44,7 +44,7 @@ FstBuilderNode* fstBuilderNodeDefault();
|
|||
|
||||
FstBuilderNode* fstBuilderNodeClone(FstBuilderNode* src);
|
||||
|
||||
void fstBuilderNodeCloneFrom(FstBuilderNode* dst, FstBuilderNode* src);
|
||||
int32_t fstBuilderNodeCloneFrom(FstBuilderNode* dst, FstBuilderNode* src);
|
||||
|
||||
// bool fstBuilderNodeCompileTo(FstBuilderNode *b, IdxFile' *wrt,
|
||||
// CompiledAddr lastAddr, CompiledAddr startAddr);
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include "indexFst.h"
|
||||
#include "indexFstFile.h"
|
||||
#include "indexInt.h"
|
||||
#include "indexTfile.h"
|
||||
//#include "indexTfile.h"
|
||||
#include "indexUtil.h"
|
||||
#include "tlockfree.h"
|
||||
|
||||
|
@ -129,8 +129,8 @@ void tfileIteratorDestroy(Iterate* iterator);
|
|||
|
||||
TFileValue* tfileValueCreate(char* val);
|
||||
|
||||
int tfileValuePush(TFileValue* tf, uint64_t val);
|
||||
void tfileValueDestroy(TFileValue* tf);
|
||||
int32_t tfileValuePush(TFileValue* tf, uint64_t val);
|
||||
void tfileValueDestroy(TFileValue* tf);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -46,17 +46,17 @@ extern "C" {
|
|||
buf += len; \
|
||||
} while (0)
|
||||
|
||||
#define INDEX_MERGE_ADD_DEL(src, dst, tgt) \
|
||||
{ \
|
||||
bool f = false; \
|
||||
for (int i = 0; i < taosArrayGetSize(src); i++) { \
|
||||
if (*(uint64_t *)taosArrayGet(src, i) == tgt) { \
|
||||
f = true; \
|
||||
} \
|
||||
} \
|
||||
if (f == false) { \
|
||||
(void)taosArrayPush(dst, &tgt); \
|
||||
} \
|
||||
#define INDEX_MERGE_ADD_DEL(src, dst, tgt) \
|
||||
{ \
|
||||
bool f = false; \
|
||||
for (int i = 0; i < taosArrayGetSize(src); i++) { \
|
||||
if (*(uint64_t *)taosArrayGet(src, i) == tgt) { \
|
||||
f = true; \
|
||||
} \
|
||||
} \
|
||||
if (f == false) { \
|
||||
if (taosArrayPush(dst, &tgt) == NULL) code = TSDB_CODE_OUT_OF_MEMORY; \
|
||||
} \
|
||||
}
|
||||
|
||||
/* multi sorted result intersection
|
||||
|
@ -65,7 +65,7 @@ extern "C" {
|
|||
* [1, 4, 5]
|
||||
* output:[4, 5]
|
||||
*/
|
||||
void iIntersection(SArray *in, SArray *out);
|
||||
int32_t iIntersection(SArray *in, SArray *out);
|
||||
|
||||
/* multi sorted result union
|
||||
* input: [1, 2, 4, 5]
|
||||
|
@ -73,7 +73,7 @@ void iIntersection(SArray *in, SArray *out);
|
|||
* [1, 4, 5]
|
||||
* output:[1, 2, 3, 4, 5]
|
||||
*/
|
||||
void iUnion(SArray *in, SArray *out);
|
||||
int32_t iUnion(SArray *in, SArray *out);
|
||||
|
||||
/* see example
|
||||
* total: [1, 2, 4, 5, 7, 8]
|
||||
|
@ -81,7 +81,7 @@ void iUnion(SArray *in, SArray *out);
|
|||
* return: [1, 2, 7, 8] saved in total
|
||||
*/
|
||||
|
||||
void iExcept(SArray *total, SArray *except);
|
||||
int32_t iExcept(SArray *total, SArray *except);
|
||||
|
||||
int uidCompare(const void *a, const void *b);
|
||||
|
||||
|
@ -107,7 +107,7 @@ void idxTRsltClear(SIdxTRslt *tr);
|
|||
|
||||
void idxTRsltDestroy(SIdxTRslt *tr);
|
||||
|
||||
void idxTRsltMergeTo(SIdxTRslt *tr, SArray *out);
|
||||
int32_t idxTRsltMergeTo(SIdxTRslt *tr, SArray *out);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ static int32_t idxMergeFinalResults(SArray* in, EIndexOperatorType oType, SArray
|
|||
static int32_t idxGenTFile(SIndex* index, IndexCache* cache, SArray* batch);
|
||||
|
||||
// merge cache and tfile by opera type
|
||||
static void idxMergeCacheAndTFile(SArray* result, IterateValue* icache, IterateValue* iTfv, SIdxTRslt* helper);
|
||||
static int32_t idxMergeCacheAndTFile(SArray* result, IterateValue* icache, IterateValue* iTfv, SIdxTRslt* helper);
|
||||
|
||||
// static int32_t indexSerialTermKey(SIndexTerm* itm, char* buf);
|
||||
// int32_t indexSerialKey(ICacheKey* key, char* buf);
|
||||
|
@ -212,6 +212,7 @@ void idxReleaseRef(int64_t ref) {
|
|||
|
||||
int32_t indexPut(SIndex* index, SIndexMultiTerm* fVals, uint64_t uid) {
|
||||
// TODO(yihao): reduce the lock range
|
||||
int32_t code = 0;
|
||||
(void)taosThreadMutexLock(&index->mtx);
|
||||
for (int i = 0; i < taosArrayGetSize(fVals); i++) {
|
||||
SIndexTerm* p = taosArrayGetP(fVals, i);
|
||||
|
@ -223,11 +224,19 @@ int32_t indexPut(SIndex* index, SIndexMultiTerm* fVals, uint64_t uid) {
|
|||
IndexCache** cache = taosHashGet(index->colObj, buf, sz);
|
||||
if (cache == NULL) {
|
||||
IndexCache* pCache = idxCacheCreate(index, p->suid, p->colName, p->colType);
|
||||
(void)taosHashPut(index->colObj, buf, sz, &pCache, sizeof(void*));
|
||||
code = taosHashPut(index->colObj, buf, sz, &pCache, sizeof(void*));
|
||||
if (code != 0) {
|
||||
idxCacheDestroy(pCache);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
(void)taosThreadMutexUnlock(&index->mtx);
|
||||
|
||||
if (code != 0) {
|
||||
return code;
|
||||
}
|
||||
|
||||
for (int i = 0; i < taosArrayGetSize(fVals); i++) {
|
||||
SIndexTerm* p = taosArrayGetP(fVals, i);
|
||||
|
||||
|
@ -247,15 +256,27 @@ int32_t indexPut(SIndex* index, SIndexMultiTerm* fVals, uint64_t uid) {
|
|||
return 0;
|
||||
}
|
||||
int32_t indexSearch(SIndex* index, SIndexMultiTermQuery* multiQuerys, SArray* result) {
|
||||
int32_t code = 0;
|
||||
EIndexOperatorType opera = multiQuerys->opera; // relation of querys
|
||||
|
||||
SArray* iRslts = taosArrayInit(4, POINTER_BYTES);
|
||||
int nQuery = taosArrayGetSize(multiQuerys->query);
|
||||
if (iRslts == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
int nQuery = taosArrayGetSize(multiQuerys->query);
|
||||
for (size_t i = 0; i < nQuery; i++) {
|
||||
SIndexTermQuery* qterm = taosArrayGet(multiQuerys->query, i);
|
||||
SArray* trslt = NULL;
|
||||
(void)idxTermSearch(index, qterm, &trslt);
|
||||
(void)taosArrayPush(iRslts, (void*)&trslt);
|
||||
code = idxTermSearch(index, qterm, &trslt);
|
||||
if (code != 0) {
|
||||
idxInterRsltDestroy(iRslts);
|
||||
return code;
|
||||
}
|
||||
if (taosArrayPush(iRslts, (void*)&trslt) == NULL) {
|
||||
idxInterRsltDestroy(iRslts);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
(void)idxMergeFinalResults(iRslts, opera, result);
|
||||
idxInterRsltDestroy(iRslts);
|
||||
|
@ -267,6 +288,9 @@ int indexDelete(SIndex* index, SIndexMultiTermQuery* query) { return 1; }
|
|||
|
||||
SIndexOpts* indexOptsCreate(int32_t cacheSize) {
|
||||
SIndexOpts* opts = taosMemoryCalloc(1, sizeof(SIndexOpts));
|
||||
if (opts == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
opts->cacheSize = cacheSize;
|
||||
return opts;
|
||||
}
|
||||
|
@ -295,7 +319,7 @@ void indexMultiTermQueryDestroy(SIndexMultiTermQuery* pQuery) {
|
|||
int32_t indexMultiTermQueryAdd(SIndexMultiTermQuery* pQuery, SIndexTerm* term, EIndexQueryType qType) {
|
||||
SIndexTermQuery q = {.qType = qType, .term = term};
|
||||
if (taosArrayPush(pQuery->query, &q) == NULL) {
|
||||
return terrno;
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -362,7 +386,9 @@ void indexTermDestroy(SIndexTerm* p) {
|
|||
SIndexMultiTerm* indexMultiTermCreate() { return taosArrayInit(4, sizeof(SIndexTerm*)); }
|
||||
|
||||
int32_t indexMultiTermAdd(SIndexMultiTerm* terms, SIndexTerm* term) {
|
||||
(void)taosArrayPush(terms, &term);
|
||||
if (taosArrayPush(terms, &term) == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
void indexMultiTermDestroy(SIndexMultiTerm* terms) {
|
||||
|
@ -422,6 +448,7 @@ bool indexJsonIsRebuild(SIndexJson* idx) {
|
|||
}
|
||||
|
||||
static int32_t idxTermSearch(SIndex* sIdx, SIndexTermQuery* query, SArray** result) {
|
||||
int32_t code = 0;
|
||||
SIndexTerm* term = query->term;
|
||||
const char* colName = term->colName;
|
||||
int32_t nColName = term->nColName;
|
||||
|
@ -452,6 +479,10 @@ static int32_t idxTermSearch(SIndex* sIdx, SIndexTermQuery* query, SArray** resu
|
|||
int64_t st = taosGetTimestampUs();
|
||||
|
||||
SIdxTRslt* tr = idxTRsltCreate();
|
||||
if (tr == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, END);
|
||||
}
|
||||
|
||||
if (0 == idxCacheSearch(cache, query, tr, &s)) {
|
||||
if (s == kTypeDeletion) {
|
||||
indexInfo("col: %s already drop by", term->colName);
|
||||
|
@ -473,13 +504,14 @@ static int32_t idxTermSearch(SIndex* sIdx, SIndexTermQuery* query, SArray** resu
|
|||
int64_t cost = taosGetTimestampUs() - st;
|
||||
indexInfo("search cost: %" PRIu64 "us", cost);
|
||||
|
||||
idxTRsltMergeTo(tr, *result);
|
||||
code = idxTRsltMergeTo(tr, *result);
|
||||
TAOS_CHECK_GOTO(code, NULL, END);
|
||||
|
||||
idxTRsltDestroy(tr);
|
||||
return 0;
|
||||
END:
|
||||
idxTRsltDestroy(tr);
|
||||
return 0;
|
||||
return code;
|
||||
}
|
||||
static void idxInterRsltDestroy(SArray* results) {
|
||||
if (results == NULL) {
|
||||
|
@ -503,9 +535,9 @@ static int32_t idxMergeFinalResults(SArray* in, EIndexOperatorType oType, SArray
|
|||
}
|
||||
|
||||
if (oType == MUST) {
|
||||
iIntersection(in, out);
|
||||
return iIntersection(in, out);
|
||||
} else if (oType == SHOULD) {
|
||||
iUnion(in, out);
|
||||
return iUnion(in, out);
|
||||
} else if (oType == NOT) {
|
||||
// just one column index, enhance later
|
||||
// taosArrayAddAll(fResults, interResults);
|
||||
|
@ -514,30 +546,53 @@ static int32_t idxMergeFinalResults(SArray* in, EIndexOperatorType oType, SArray
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void idxMayMergeTempToFinalRslt(SArray* result, TFileValue* tfv, SIdxTRslt* tr) {
|
||||
static int32_t idxMayMergeTempToFinalRslt(SArray* result, TFileValue* tfv, SIdxTRslt* tr) {
|
||||
int32_t code = 0;
|
||||
int32_t sz = taosArrayGetSize(result);
|
||||
if (sz > 0) {
|
||||
TFileValue* lv = taosArrayGetP(result, sz - 1);
|
||||
if (tfv != NULL && strcmp(lv->colVal, tfv->colVal) != 0) {
|
||||
idxTRsltMergeTo(tr, lv->tableId);
|
||||
code = idxTRsltMergeTo(tr, lv->tableId);
|
||||
if (code != 0) {
|
||||
indexFatal("failed to merge result since %s", tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
idxTRsltClear(tr);
|
||||
|
||||
(void)taosArrayPush(result, &tfv);
|
||||
if (taosArrayPush(result, &tfv) == NULL) {
|
||||
indexFatal("failed to merge result since %s", tstrerror(TSDB_CODE_OUT_OF_MEMORY));
|
||||
}
|
||||
} else if (tfv == NULL) {
|
||||
// handle last iterator
|
||||
idxTRsltMergeTo(tr, lv->tableId);
|
||||
code = idxTRsltMergeTo(tr, lv->tableId);
|
||||
if (code != 0) {
|
||||
indexFatal("failed to merge result since %s", tstrerror(code));
|
||||
}
|
||||
} else {
|
||||
tfileValueDestroy(tfv);
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
(void)taosArrayPush(result, &tfv);
|
||||
if (taosArrayPush(result, &tfv) == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
return code;
|
||||
}
|
||||
static void idxMergeCacheAndTFile(SArray* result, IterateValue* cv, IterateValue* tv, SIdxTRslt* tr) {
|
||||
static int32_t idxMergeCacheAndTFile(SArray* result, IterateValue* cv, IterateValue* tv, SIdxTRslt* tr) {
|
||||
int32_t code = 0;
|
||||
char* colVal = (cv != NULL) ? cv->colVal : tv->colVal;
|
||||
TFileValue* tfv = tfileValueCreate(colVal);
|
||||
if (tfv == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
idxMayMergeTempToFinalRslt(result, tfv, tr);
|
||||
code = idxMayMergeTempToFinalRslt(result, tfv, tr);
|
||||
if (code != 0) {
|
||||
tfileValueDestroy(tfv);
|
||||
return code;
|
||||
}
|
||||
tfv = NULL;
|
||||
|
||||
if (cv != NULL) {
|
||||
uint64_t id = *(uint64_t*)taosArrayGet(cv->val, 0);
|
||||
|
@ -549,8 +604,11 @@ static void idxMergeCacheAndTFile(SArray* result, IterateValue* cv, IterateValue
|
|||
}
|
||||
}
|
||||
if (tv != NULL) {
|
||||
(void)taosArrayAddAll(tr->total, tv->val);
|
||||
if (taosArrayAddAll(tr->total, tv->val) == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
static void idxDestroyFinalRslt(SArray* result) {
|
||||
int32_t sz = result ? taosArrayGetSize(result) : 0;
|
||||
|
@ -562,6 +620,7 @@ static void idxDestroyFinalRslt(SArray* result) {
|
|||
}
|
||||
|
||||
int32_t idxFlushCacheToTFile(SIndex* sIdx, void* cache, bool quit) {
|
||||
int32_t code = 0;
|
||||
if (sIdx == NULL) {
|
||||
return TSDB_CODE_INVALID_PTR;
|
||||
}
|
||||
|
@ -598,12 +657,16 @@ int32_t idxFlushCacheToTFile(SIndex* sIdx, void* cache, bool quit) {
|
|||
}
|
||||
|
||||
SArray* result = taosArrayInit(1024, sizeof(void*));
|
||||
if (result == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _exception);
|
||||
}
|
||||
|
||||
bool cn = cacheIter ? cacheIter->next(cacheIter) : false;
|
||||
bool tn = tfileIter ? tfileIter->next(tfileIter) : false;
|
||||
|
||||
SIdxTRslt* tr = idxTRsltCreate();
|
||||
if (tr == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _exception);
|
||||
}
|
||||
while (cn == true || tn == true) {
|
||||
IterateValue* cv = (cn == true) ? cacheIter->getValue(cacheIter) : NULL;
|
||||
|
@ -618,27 +681,42 @@ int32_t idxFlushCacheToTFile(SIndex* sIdx, void* cache, bool quit) {
|
|||
comp = 1;
|
||||
}
|
||||
if (comp == 0) {
|
||||
idxMergeCacheAndTFile(result, cv, tv, tr);
|
||||
code = idxMergeCacheAndTFile(result, cv, tv, tr);
|
||||
if (code != 0) {
|
||||
TAOS_CHECK_GOTO(code, NULL, _exception);
|
||||
}
|
||||
|
||||
cn = cacheIter->next(cacheIter);
|
||||
tn = tfileIter->next(tfileIter);
|
||||
} else if (comp < 0) {
|
||||
idxMergeCacheAndTFile(result, cv, NULL, tr);
|
||||
code = idxMergeCacheAndTFile(result, cv, NULL, tr);
|
||||
if (code != 0) {
|
||||
TAOS_CHECK_GOTO(code, NULL, _exception);
|
||||
}
|
||||
cn = cacheIter->next(cacheIter);
|
||||
} else {
|
||||
idxMergeCacheAndTFile(result, NULL, tv, tr);
|
||||
code = idxMergeCacheAndTFile(result, NULL, tv, tr);
|
||||
if (code != 0) {
|
||||
TAOS_CHECK_GOTO(code, NULL, _exception);
|
||||
}
|
||||
tn = tfileIter->next(tfileIter);
|
||||
}
|
||||
}
|
||||
idxMayMergeTempToFinalRslt(result, NULL, tr);
|
||||
if ((code = idxMayMergeTempToFinalRslt(result, NULL, tr)) != 0) {
|
||||
idxTRsltDestroy(tr);
|
||||
TAOS_CHECK_GOTO(code, NULL, _exception);
|
||||
}
|
||||
idxTRsltDestroy(tr);
|
||||
|
||||
int ret = idxGenTFile(sIdx, pCache, result);
|
||||
if (ret != 0) {
|
||||
indexError("failed to merge");
|
||||
code = idxGenTFile(sIdx, pCache, result);
|
||||
if (code != 0) {
|
||||
indexError("failed to merge since %s", tstrerror(code));
|
||||
} else {
|
||||
int64_t cost = taosGetTimestampUs() - st;
|
||||
indexInfo("success to merge , time cost: %" PRId64 "ms", cost / 1000);
|
||||
}
|
||||
|
||||
_exception:
|
||||
idxDestroyFinalRslt(result);
|
||||
|
||||
idxCacheDestroyImm(pCache);
|
||||
|
@ -654,8 +732,11 @@ int32_t idxFlushCacheToTFile(SIndex* sIdx, void* cache, bool quit) {
|
|||
idxPost(sIdx);
|
||||
}
|
||||
idxReleaseRef(sIdx->refId);
|
||||
if (code != 0) {
|
||||
indexError("failed to merge since %s", tstrerror(code));
|
||||
}
|
||||
|
||||
return ret;
|
||||
return code;
|
||||
}
|
||||
void iterateValueDestroy(IterateValue* value, bool destroy) {
|
||||
if (destroy) {
|
||||
|
|
|
@ -75,6 +75,7 @@ static int32_t cacheSearchTerm(void* cache, SIndexTerm* term, SIdxTRslt* tr, STe
|
|||
if (cache == NULL) {
|
||||
return 0;
|
||||
}
|
||||
int32_t code = 0;
|
||||
MemTable* mem = cache;
|
||||
IndexCache* pCache = mem->pCache;
|
||||
|
||||
|
@ -98,6 +99,10 @@ static int32_t cacheSearchTerm(void* cache, SIndexTerm* term, SIdxTRslt* tr, STe
|
|||
} else if (c->operaType == DEL_VALUE) {
|
||||
INDEX_MERGE_ADD_DEL(tr->add, tr->del, c->uid)
|
||||
}
|
||||
|
||||
if (code != 0) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
@ -105,7 +110,7 @@ static int32_t cacheSearchTerm(void* cache, SIndexTerm* term, SIdxTRslt* tr, STe
|
|||
|
||||
taosMemoryFree(pCt);
|
||||
(void)tSkipListDestroyIter(iter);
|
||||
return 0;
|
||||
return code;
|
||||
}
|
||||
static int32_t cacheSearchPrefix(void* cache, SIndexTerm* term, SIdxTRslt* tr, STermValueType* s) {
|
||||
// impl later
|
||||
|
@ -123,6 +128,7 @@ static int32_t cacheSearchCompareFunc(void* cache, SIndexTerm* term, SIdxTRslt*
|
|||
if (cache == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
MemTable* mem = cache;
|
||||
IndexCache* pCache = mem->pCache;
|
||||
|
@ -148,7 +154,7 @@ static int32_t cacheSearchCompareFunc(void* cache, SIndexTerm* term, SIdxTRslt*
|
|||
}
|
||||
CacheTerm* c = (CacheTerm*)SL_GET_NODE_DATA(node);
|
||||
terrno = TSDB_CODE_SUCCESS;
|
||||
TExeCond cond = cmpFn(c->colVal, pCt->colVal, pCt->colType);
|
||||
TExeCond cond = cmpFn(c->colVal, pCt->colVal, pCt->colType);
|
||||
if (terrno != TSDB_CODE_SUCCESS) {
|
||||
code = terrno;
|
||||
goto _return;
|
||||
|
@ -156,11 +162,14 @@ static int32_t cacheSearchCompareFunc(void* cache, SIndexTerm* term, SIdxTRslt*
|
|||
if (cond == MATCH) {
|
||||
if (c->operaType == ADD_VALUE) {
|
||||
INDEX_MERGE_ADD_DEL(tr->del, tr->add, c->uid)
|
||||
// taosArrayPush(result, &c->uid);
|
||||
*s = kTypeValue;
|
||||
} else if (c->operaType == DEL_VALUE) {
|
||||
INDEX_MERGE_ADD_DEL(tr->add, tr->del, c->uid)
|
||||
}
|
||||
|
||||
if (code != 0) {
|
||||
break;
|
||||
}
|
||||
} else if (cond == CONTINUE) {
|
||||
continue;
|
||||
} else if (cond == BREAK) {
|
||||
|
@ -190,6 +199,8 @@ static int32_t cacheSearchTerm_JSON(void* cache, SIndexTerm* term, SIdxTRslt* tr
|
|||
if (cache == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t code = 0;
|
||||
MemTable* mem = cache;
|
||||
IndexCache* pCache = mem->pCache;
|
||||
|
||||
|
@ -223,6 +234,10 @@ static int32_t cacheSearchTerm_JSON(void* cache, SIndexTerm* term, SIdxTRslt* tr
|
|||
} else if (c->operaType == DEL_VALUE) {
|
||||
INDEX_MERGE_ADD_DEL(tr->add, tr->del, c->uid)
|
||||
}
|
||||
|
||||
if (code != 0) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
@ -231,9 +246,7 @@ static int32_t cacheSearchTerm_JSON(void* cache, SIndexTerm* term, SIdxTRslt* tr
|
|||
taosMemoryFree(pCt);
|
||||
taosMemoryFree(exBuf);
|
||||
(void)tSkipListDestroyIter(iter);
|
||||
return 0;
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
return code;
|
||||
}
|
||||
static int32_t cacheSearchSuffix_JSON(void* cache, SIndexTerm* term, SIdxTRslt* tr, STermValueType* s) {
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -338,6 +351,10 @@ static int32_t cacheSearchCompareFunc_JSON(void* cache, SIndexTerm* term, SIdxTR
|
|||
} else if (c->operaType == DEL_VALUE) {
|
||||
INDEX_MERGE_ADD_DEL(tr->add, tr->del, c->uid)
|
||||
}
|
||||
|
||||
if (code != 0) {
|
||||
break;
|
||||
}
|
||||
} else if (cond == CONTINUE) {
|
||||
continue;
|
||||
} else if (cond == BREAK) {
|
||||
|
@ -800,7 +817,13 @@ static bool idxCacheIteratorNext(Iterate* itera) {
|
|||
iv->type = ct->operaType;
|
||||
iv->ver = ct->version;
|
||||
iv->colVal = taosStrdup(ct->colVal);
|
||||
(void)taosArrayPush(iv->val, &ct->uid);
|
||||
if (iv->colVal == NULL) {
|
||||
return false;
|
||||
}
|
||||
if (taosArrayPush(iv->val, &ct->uid) == NULL) {
|
||||
taosMemoryFree(iv->colVal);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return next;
|
||||
}
|
||||
|
|
|
@ -62,7 +62,9 @@ void fstUnFinishedNodesPushEmpty(FstUnFinishedNodes* nodes, bool isFinal) {
|
|||
node->trans = taosArrayInit(16, sizeof(FstTransition));
|
||||
|
||||
FstBuilderNodeUnfinished un = {.node = node, .last = NULL};
|
||||
(void)taosArrayPush(nodes->stack, &un);
|
||||
if (taosArrayPush(nodes->stack, &un) == NULL) {
|
||||
fstBuilderNodeDestroy(node);
|
||||
}
|
||||
}
|
||||
FstBuilderNode* fstUnFinishedNodesPopRoot(FstUnFinishedNodes* nodes) {
|
||||
FstBuilderNodeUnfinished* un = taosArrayPop(nodes->stack);
|
||||
|
@ -120,7 +122,10 @@ void fstUnFinishedNodesAddSuffix(FstUnFinishedNodes* nodes, FstSlice bs, Output
|
|||
FstLastTransition* trn = fstLastTransitionCreate(data[i], 0);
|
||||
|
||||
FstBuilderNodeUnfinished un = {.node = n, .last = trn};
|
||||
(void)taosArrayPush(nodes->stack, &un);
|
||||
if (taosArrayPush(nodes->stack, &un) == NULL) {
|
||||
fstBuilderNodeDestroy(n);
|
||||
taosMemoryFree(trn);
|
||||
}
|
||||
}
|
||||
fstUnFinishedNodesPushEmpty(nodes, true);
|
||||
}
|
||||
|
@ -892,7 +897,9 @@ void fstBuilderNodeUnfinishedLastCompiled(FstBuilderNodeUnfinished* unNode, Comp
|
|||
return;
|
||||
}
|
||||
FstTransition t = {.inp = trn->inp, .out = trn->out, .addr = addr};
|
||||
(void)taosArrayPush(unNode->node->trans, &t);
|
||||
if (taosArrayPush(unNode->node->trans, &t) == NULL) {
|
||||
return;
|
||||
}
|
||||
fstLastTransitionDestroy(trn);
|
||||
unNode->last = NULL;
|
||||
return;
|
||||
|
@ -997,7 +1004,12 @@ bool fstGet(Fst* fst, FstSlice* b, Output* out) {
|
|||
uint8_t* data = fstSliceData(b, &len);
|
||||
|
||||
SArray* nodes = (SArray*)taosArrayInit(len, sizeof(FstNode*));
|
||||
(void)taosArrayPush(nodes, &root);
|
||||
if (nodes == NULL) {
|
||||
return false;
|
||||
}
|
||||
if (taosArrayPush(nodes, &root) == NULL) {
|
||||
goto _return;
|
||||
}
|
||||
for (uint32_t i = 0; i < len; i++) {
|
||||
uint8_t inp = data[i];
|
||||
Output res = 0;
|
||||
|
@ -1009,7 +1021,9 @@ bool fstGet(Fst* fst, FstSlice* b, Output* out) {
|
|||
(void)fstNodeGetTransitionAt(root, res, &trn);
|
||||
tOut += trn.out;
|
||||
root = fstGetNode(fst, trn.addr);
|
||||
(void)taosArrayPush(nodes, &root);
|
||||
if (taosArrayPush(nodes, &root) == NULL) {
|
||||
goto _return;
|
||||
}
|
||||
}
|
||||
if (!FST_NODE_IS_FINAL(root)) {
|
||||
goto _return;
|
||||
|
@ -1156,7 +1170,9 @@ bool stmStSeekMin(FStmSt* sws, FstBoundWithData* min) {
|
|||
.trans = 0,
|
||||
.out = {.null = false, .out = 0},
|
||||
.autState = automFuncs[aut->type].start(aut)}; // auto.start callback
|
||||
(void)taosArrayPush(sws->stack, &s);
|
||||
if (taosArrayPush(sws->stack, &s) == NULL) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
FstSlice* key = NULL;
|
||||
|
@ -1185,12 +1201,16 @@ bool stmStSeekMin(FStmSt* sws, FstBoundWithData* min) {
|
|||
(void)fstNodeGetTransitionAt(node, res, &trn);
|
||||
void* preState = autState;
|
||||
autState = automFuncs[aut->type].accept(aut, preState, b);
|
||||
(void)taosArrayPush(sws->inp, &b);
|
||||
if (taosArrayPush(sws->inp, &b) == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
FstStreamState s = {.node = node, .trans = res + 1, .out = {.null = false, .out = out}, .autState = preState};
|
||||
node = NULL;
|
||||
|
||||
(void)taosArrayPush(sws->stack, &s);
|
||||
if (taosArrayPush(sws->stack, &s) == NULL) {
|
||||
return false;
|
||||
}
|
||||
out += trn.out;
|
||||
node = fstGetNode(sws->fst, trn.addr);
|
||||
} else {
|
||||
|
@ -1209,7 +1229,9 @@ bool stmStSeekMin(FStmSt* sws, FstBoundWithData* min) {
|
|||
}
|
||||
|
||||
FstStreamState s = {.node = node, .trans = i, .out = {.null = false, .out = out}, .autState = autState};
|
||||
(void)taosArrayPush(sws->stack, &s);
|
||||
if (taosArrayPush(sws->stack, &s) == NULL) {
|
||||
return false;
|
||||
}
|
||||
taosMemoryFree(trans);
|
||||
return true;
|
||||
}
|
||||
|
@ -1230,7 +1252,9 @@ bool stmStSeekMin(FStmSt* sws, FstBoundWithData* min) {
|
|||
(void)fstNodeGetTransitionAt(n, trans - 1, &trn);
|
||||
FstStreamState s = {
|
||||
.node = fstGetNode(sws->fst, trn.addr), .trans = 0, .out = {.null = false, .out = out}, .autState = autState};
|
||||
(void)taosArrayPush(sws->stack, &s);
|
||||
if (taosArrayPush(sws->stack, &s) == NULL) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -1273,8 +1297,14 @@ FStmStRslt* stmStNextWith(FStmSt* sws, streamCallback__fn callback) {
|
|||
bool isMatch = automFuncs[aut->type].isMatch(aut, nextState);
|
||||
|
||||
FstNode* nextNode = fstGetNode(sws->fst, trn.addr);
|
||||
(void)taosArrayPush(nodes, &nextNode);
|
||||
(void)taosArrayPush(sws->inp, &(trn.inp));
|
||||
if (taosArrayPush(nodes, &nextNode) == NULL) {
|
||||
taosArrayDestroy(nodes);
|
||||
return NULL;
|
||||
}
|
||||
if (taosArrayPush(sws->inp, &(trn.inp)) == NULL) {
|
||||
taosArrayDestroy(nodes);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (FST_NODE_IS_FINAL(nextNode)) {
|
||||
void* eofState = automFuncs[aut->type].acceptEof(aut, nextState);
|
||||
|
@ -1283,10 +1313,16 @@ FStmStRslt* stmStNextWith(FStmSt* sws, streamCallback__fn callback) {
|
|||
}
|
||||
}
|
||||
FstStreamState s1 = {.node = p->node, .trans = p->trans + 1, .out = p->out, .autState = p->autState};
|
||||
(void)taosArrayPush(sws->stack, &s1);
|
||||
if (taosArrayPush(sws->stack, &s1) == NULL) {
|
||||
taosArrayDestroy(nodes);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
FstStreamState s2 = {.node = nextNode, .trans = 0, .out = {.null = false, .out = out}, .autState = nextState};
|
||||
(void)taosArrayPush(sws->stack, &s2);
|
||||
if (taosArrayPush(sws->stack, &s2) == NULL) {
|
||||
taosArrayDestroy(nodes);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int32_t isz = taosArrayGetSize(sws->inp);
|
||||
uint8_t* buf = (uint8_t*)taosMemoryMalloc(isz * sizeof(uint8_t));
|
||||
|
@ -1357,11 +1393,18 @@ FStmBuilder* stmBuilderCreate(Fst* fst, FAutoCtx* aut) {
|
|||
b->aut = aut;
|
||||
b->min = fstBoundStateCreate(Unbounded, NULL);
|
||||
b->max = fstBoundStateCreate(Unbounded, NULL);
|
||||
|
||||
if (b->min == NULL || b->max == NULL) {
|
||||
stmBuilderDestroy(b);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return b;
|
||||
}
|
||||
void stmBuilderDestroy(FStmBuilder* b) {
|
||||
fstSliceDestroy(&b->min->data);
|
||||
fstSliceDestroy(&b->max->data);
|
||||
if (b->min) fstSliceDestroy(&b->min->data);
|
||||
if (b->max) fstSliceDestroy(&b->max->data);
|
||||
|
||||
taosMemoryFreeClear(b->min);
|
||||
taosMemoryFreeClear(b->max);
|
||||
taosMemoryFree(b);
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
*/
|
||||
|
||||
#include "indexFstDfa.h"
|
||||
#include "indexInt.h"
|
||||
#include "thash.h"
|
||||
|
||||
const static uint32_t STATE_LIMIT = 1000;
|
||||
|
@ -68,23 +69,41 @@ FstDfa *dfaBuilderBuild(FstDfaBuilder *builder) {
|
|||
uint32_t sz = taosArrayGetSize(builder->dfa->insts);
|
||||
FstSparseSet *cur = sparSetCreate(sz);
|
||||
FstSparseSet *nxt = sparSetCreate(sz);
|
||||
if (cur == NULL || nxt == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dfaAdd(builder->dfa, cur, 0);
|
||||
|
||||
uint32_t result;
|
||||
SArray *states = taosArrayInit(0, sizeof(uint32_t));
|
||||
if (states == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return NULL;
|
||||
}
|
||||
if (dfaBuilderCacheState(builder, cur, &result)) {
|
||||
(void)taosArrayPush(states, &result);
|
||||
if (taosArrayPush(states, &result) == NULL) {
|
||||
goto _exception;
|
||||
}
|
||||
}
|
||||
SHashObj *seen = taosHashInit(12, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK);
|
||||
if (seen == NULL) {
|
||||
goto _exception;
|
||||
}
|
||||
|
||||
while (taosArrayGetSize(states) != 0) {
|
||||
result = *(uint32_t *)taosArrayPop(states);
|
||||
for (int i = 0; i < 256; i++) {
|
||||
uint32_t ns, dummpy = 0;
|
||||
if (dfaBuilderRunState(builder, cur, nxt, result, i, &ns)) {
|
||||
if (taosHashGet(seen, &ns, sizeof(ns)) == NULL) {
|
||||
(void)taosHashPut(seen, &ns, sizeof(ns), &dummpy, sizeof(dummpy));
|
||||
(void)taosArrayPush(states, &ns);
|
||||
if (taosHashPut(seen, &ns, sizeof(ns), &dummpy, sizeof(dummpy)) != 0) {
|
||||
goto _exception;
|
||||
}
|
||||
if (taosArrayPush(states, &ns) == NULL) {
|
||||
goto _exception;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (taosArrayGetSize(builder->dfa->states) > STATE_LIMIT) {
|
||||
|
@ -96,6 +115,11 @@ FstDfa *dfaBuilderBuild(FstDfaBuilder *builder) {
|
|||
taosArrayDestroy(states);
|
||||
taosHashCleanup(seen);
|
||||
return builder->dfa;
|
||||
_exception:
|
||||
taosArrayDestroy(states);
|
||||
taosHashCleanup(seen);
|
||||
indexError("failed to build dfa since %s", tstrerror(terrno));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool dfaBuilderRunState(FstDfaBuilder *builder, FstSparseSet *cur, FstSparseSet *next, uint32_t state, uint8_t byte,
|
||||
|
@ -122,8 +146,13 @@ bool dfaBuilderRunState(FstDfaBuilder *builder, FstSparseSet *cur, FstSparseSet
|
|||
}
|
||||
|
||||
bool dfaBuilderCacheState(FstDfaBuilder *builder, FstSparseSet *set, uint32_t *result) {
|
||||
int32_t code = 0;
|
||||
SArray *tinsts = taosArrayInit(4, sizeof(uint32_t));
|
||||
bool isMatch = false;
|
||||
if (tinsts == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto _exception;
|
||||
}
|
||||
bool isMatch = false;
|
||||
|
||||
for (int i = 0; i < sparSetLen(set); i++) {
|
||||
int32_t ip;
|
||||
|
@ -133,10 +162,16 @@ bool dfaBuilderCacheState(FstDfaBuilder *builder, FstSparseSet *set, uint32_t *r
|
|||
if (inst->ty == JUMP || inst->ty == SPLIT) {
|
||||
continue;
|
||||
} else if (inst->ty == RANGE) {
|
||||
(void)taosArrayPush(tinsts, &ip);
|
||||
if (taosArrayPush(tinsts, &ip) == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto _exception;
|
||||
}
|
||||
} else if (inst->ty == MATCH) {
|
||||
isMatch = true;
|
||||
(void)taosArrayPush(tinsts, &ip);
|
||||
if (taosArrayPush(tinsts, &ip) == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto _exception;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (taosArrayGetSize(tinsts) == 0) {
|
||||
|
@ -149,13 +184,23 @@ bool dfaBuilderCacheState(FstDfaBuilder *builder, FstSparseSet *set, uint32_t *r
|
|||
taosArrayDestroy(tinsts);
|
||||
} else {
|
||||
DfaState st = {.insts = tinsts, .isMatch = isMatch};
|
||||
(void)taosArrayPush(builder->dfa->states, &st);
|
||||
if (taosArrayPush(builder->dfa->states, &st) == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto _exception;
|
||||
}
|
||||
|
||||
int32_t sz = taosArrayGetSize(builder->dfa->states) - 1;
|
||||
(void)taosHashPut(builder->cache, &tinsts, sizeof(POINTER_BYTES), &sz, sizeof(sz));
|
||||
if ((code = taosHashPut(builder->cache, &tinsts, sizeof(POINTER_BYTES), &sz, sizeof(sz))) != 0) {
|
||||
goto _exception;
|
||||
}
|
||||
|
||||
*result = sz;
|
||||
}
|
||||
return true;
|
||||
_exception:
|
||||
indexError("failed to create dfa state, code:%d", code);
|
||||
taosArrayDestroy(tinsts);
|
||||
return false;
|
||||
}
|
||||
|
||||
FstDfa *dfaCreate(SArray *insts, SArray *states) {
|
||||
|
|
|
@ -16,9 +16,14 @@
|
|||
|
||||
FstBuilderNode* fstBuilderNodeDefault() {
|
||||
FstBuilderNode* bn = taosMemoryMalloc(sizeof(FstBuilderNode));
|
||||
if (bn == NULL) return NULL;
|
||||
bn->isFinal = false;
|
||||
bn->finalOutput = 0;
|
||||
bn->trans = taosArrayInit(16, sizeof(FstTransition));
|
||||
if (bn->trans == NULL) {
|
||||
taosMemoryFree(bn);
|
||||
return NULL;
|
||||
}
|
||||
return bn;
|
||||
}
|
||||
void fstBuilderNodeDestroy(FstBuilderNode* node) {
|
||||
|
@ -56,30 +61,11 @@ bool fstBuilderNodeEqual(FstBuilderNode* n1, FstBuilderNode* n2) {
|
|||
|
||||
return true;
|
||||
}
|
||||
FstBuilderNode* fstBuilderNodeClone(FstBuilderNode* src) {
|
||||
FstBuilderNode* node = taosMemoryMalloc(sizeof(FstBuilderNode));
|
||||
if (node == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//
|
||||
size_t sz = taosArrayGetSize(src->trans);
|
||||
SArray* trans = taosArrayInit(sz, sizeof(FstTransition));
|
||||
|
||||
for (size_t i = 0; i < sz; i++) {
|
||||
FstTransition* tran = taosArrayGet(src->trans, i);
|
||||
(void)taosArrayPush(trans, tran);
|
||||
}
|
||||
|
||||
node->trans = trans;
|
||||
node->isFinal = src->isFinal;
|
||||
node->finalOutput = src->finalOutput;
|
||||
return node;
|
||||
}
|
||||
// not destroy src, User's bussiness
|
||||
void fstBuilderNodeCloneFrom(FstBuilderNode* dst, FstBuilderNode* src) {
|
||||
int32_t fstBuilderNodeCloneFrom(FstBuilderNode* dst, FstBuilderNode* src) {
|
||||
if (dst == NULL || src == NULL) {
|
||||
return;
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
|
||||
dst->isFinal = src->isFinal;
|
||||
|
@ -89,10 +75,18 @@ void fstBuilderNodeCloneFrom(FstBuilderNode* dst, FstBuilderNode* src) {
|
|||
taosArrayDestroy(dst->trans);
|
||||
size_t sz = taosArrayGetSize(src->trans);
|
||||
dst->trans = taosArrayInit(sz, sizeof(FstTransition));
|
||||
if (dst->trans == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
for (size_t i = 0; i < sz; i++) {
|
||||
FstTransition* trn = taosArrayGet(src->trans, i);
|
||||
(void)taosArrayPush(dst->trans, trn);
|
||||
if (taosArrayPush(dst->trans, trn) == NULL) {
|
||||
taosArrayDestroy(dst->trans);
|
||||
dst->trans = NULL;
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// bool fstBuilderNodeCompileTo(FstBuilderNode *b, IdxFile *wrt, CompiledAddr lastAddr, CompiledAddr
|
||||
|
|
|
@ -39,7 +39,12 @@ FstRegex *regexCreate(const char *str) {
|
|||
|
||||
for (int i = 0; i < strlen(str); i++) {
|
||||
uint8_t v = str[i];
|
||||
(void)taosArrayPush(insts, &v);
|
||||
if (taosArrayPush(insts, &v) == NULL) {
|
||||
taosArrayDestroy(insts);
|
||||
taosMemoryFree(regex->orig);
|
||||
taosMemoryFree(regex);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
FstDfaBuilder *builder = dfaBuilderCreate(insts);
|
||||
regex->dfa = dfaBuilderBuild(builder);
|
||||
|
|
|
@ -84,7 +84,10 @@ FstRegistry* fstRegistryCreate(uint64_t tableSize, uint64_t mruSize) {
|
|||
|
||||
for (uint64_t i = 0; i < nCells; i++) {
|
||||
FstRegistryCell cell = {.addr = NONE_ADDRESS, .node = fstBuilderNodeDefault()};
|
||||
(void)taosArrayPush(tb, &cell);
|
||||
if (taosArrayPush(tb, &cell) == NULL) {
|
||||
fstRegistryDestroy(registry);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
registry->table = tb;
|
||||
|
@ -125,7 +128,7 @@ FstRegistryEntry* fstRegistryGetEntry(FstRegistry* registry, FstBuilderNode* bNo
|
|||
entry->addr = cell->addr;
|
||||
return entry;
|
||||
} else {
|
||||
fstBuilderNodeCloneFrom(cell->node, bNode);
|
||||
(void)fstBuilderNodeCloneFrom(cell->node, bNode);
|
||||
entry->state = NOTFOUND;
|
||||
entry->cell = cell; // copy or not
|
||||
}
|
||||
|
@ -145,7 +148,7 @@ FstRegistryEntry* fstRegistryGetEntry(FstRegistry* registry, FstBuilderNode* bNo
|
|||
return entry;
|
||||
}
|
||||
// clone from bNode, refactor later
|
||||
fstBuilderNodeCloneFrom(cell2->node, bNode);
|
||||
(void)fstBuilderNodeCloneFrom(cell2->node, bNode);
|
||||
|
||||
fstRegistryCellSwap(registry->table, start, start + 1);
|
||||
FstRegistryCell* cCell = taosArrayGet(registry->table, start);
|
||||
|
@ -166,7 +169,7 @@ FstRegistryEntry* fstRegistryGetEntry(FstRegistry* registry, FstBuilderNode* bNo
|
|||
uint64_t last = end - 1;
|
||||
FstRegistryCell* cell = (FstRegistryCell*)taosArrayGet(registry->table, last);
|
||||
// clone from bNode, refactor later
|
||||
fstBuilderNodeCloneFrom(cell->node, bNode);
|
||||
(void)fstBuilderNodeCloneFrom(cell->node, bNode);
|
||||
|
||||
fstRegistryCellPromote(registry->table, last, start);
|
||||
FstRegistryCell* cCell = taosArrayGet(registry->table, start);
|
||||
|
|
|
@ -49,7 +49,7 @@ static int tfileReaderLoadFst(TFileReader* reader);
|
|||
static int tfileReaderVerify(TFileReader* reader);
|
||||
static int tfileReaderLoadTableIds(TFileReader* reader, int32_t offset, SArray* result);
|
||||
|
||||
static SArray* tfileGetFileList(const char* path);
|
||||
static int32_t tfileGetFileList(const char* path, SArray** pResult);
|
||||
static int tfileRmExpireFile(SArray* result);
|
||||
static void tfileDestroyFileName(void* elem);
|
||||
static int tfileCompare(const void* a, const void* b);
|
||||
|
@ -97,9 +97,15 @@ TFileCache* tfileCacheCreate(SIndex* idx, const char* path) {
|
|||
}
|
||||
|
||||
tcache->tableCache = taosHashInit(8, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
|
||||
if (tcache->tableCache == NULL) {
|
||||
indexError("failed to open table cache since%s", tstrerror(terrno));
|
||||
goto End;
|
||||
}
|
||||
|
||||
tcache->capacity = 64;
|
||||
|
||||
SArray* files = tfileGetFileList(path);
|
||||
SArray* files = NULL;
|
||||
int32_t code = tfileGetFileList(path, &files);
|
||||
for (size_t i = 0; i < taosArrayGetSize(files); i++) {
|
||||
char* file = taosArrayGetP(files, i);
|
||||
|
||||
|
@ -125,7 +131,11 @@ TFileCache* tfileCacheCreate(SIndex* idx, const char* path) {
|
|||
|
||||
char buf[128] = {0};
|
||||
int32_t sz = idxSerialCacheKey(&key, buf);
|
||||
(void)taosHashPut(tcache->tableCache, buf, sz, &reader, sizeof(void*));
|
||||
code = taosHashPut(tcache->tableCache, buf, sz, &reader, sizeof(void*));
|
||||
if (code != 0) {
|
||||
tfileReaderDestroy(reader);
|
||||
goto End;
|
||||
}
|
||||
tfileReaderRef(reader);
|
||||
}
|
||||
taosArrayDestroyEx(files, tfileDestroyFileName);
|
||||
|
@ -163,6 +173,7 @@ TFileReader* tfileCacheGet(TFileCache* tcache, ICacheKey* key) {
|
|||
|
||||
return *reader;
|
||||
}
|
||||
|
||||
int32_t tfileCachePut(TFileCache* tcache, ICacheKey* key, TFileReader* reader) {
|
||||
int32_t code = 0;
|
||||
|
||||
|
@ -172,16 +183,18 @@ int32_t tfileCachePut(TFileCache* tcache, ICacheKey* key, TFileReader* reader) {
|
|||
TFileReader** p = taosHashGet(tcache->tableCache, buf, sz);
|
||||
if (p != NULL && *p != NULL) {
|
||||
TFileReader* oldRdr = *p;
|
||||
(void)taosHashRemove(tcache->tableCache, buf, sz);
|
||||
indexInfo("found %s, should remove file %s", buf, oldRdr->ctx->file.buf);
|
||||
oldRdr->remove = true;
|
||||
tfileReaderUnRef(oldRdr);
|
||||
if ((code = taosHashRemove(tcache->tableCache, buf, sz)) != 0) {
|
||||
indexError("failed to remove old reader from cache since %s, suid:%" PRIu64 ", colName:%s", tstrerror(code),
|
||||
oldRdr->header.suid, oldRdr->header.colName);
|
||||
} else {
|
||||
indexInfo("found %s, should remove file %s", buf, oldRdr->ctx->file.buf);
|
||||
oldRdr->remove = true;
|
||||
tfileReaderUnRef(oldRdr);
|
||||
}
|
||||
}
|
||||
|
||||
code = taosHashPut(tcache->tableCache, buf, sz, &reader, sizeof(void*));
|
||||
if (code == 0) {
|
||||
tfileReaderRef(reader);
|
||||
}
|
||||
tfileReaderRef(reader);
|
||||
return code;
|
||||
}
|
||||
int32_t tfileReaderCreate(IFileCtx* ctx, TFileReader** pReader) {
|
||||
|
@ -232,7 +245,7 @@ void tfileReaderDestroy(TFileReader* reader) {
|
|||
}
|
||||
|
||||
static int32_t tfSearchTerm(void* reader, SIndexTerm* tem, SIdxTRslt* tr) {
|
||||
int ret = 0;
|
||||
int32_t ret = 0;
|
||||
char* p = tem->colVal;
|
||||
uint64_t sz = tem->nColVal;
|
||||
|
||||
|
@ -246,6 +259,11 @@ static int32_t tfSearchTerm(void* reader, SIndexTerm* tem, SIdxTRslt* tr) {
|
|||
tem->suid, tem->colName, tem->colVal, cost);
|
||||
|
||||
ret = tfileReaderLoadTableIds((TFileReader*)reader, (int32_t)offset, tr->total);
|
||||
if (ret != 0) {
|
||||
fstSliceDestroy(&key);
|
||||
indexError("faile to search since %s", tstrerror(ret));
|
||||
return ret;
|
||||
}
|
||||
cost = taosGetTimestampUs() - et;
|
||||
indexInfo("index: %" PRIu64 ", col: %s, colVal: %s, load all table info, time cost: %" PRIu64 "us", tem->suid,
|
||||
tem->colName, tem->colVal, cost);
|
||||
|
@ -255,17 +273,29 @@ static int32_t tfSearchTerm(void* reader, SIndexTerm* tem, SIdxTRslt* tr) {
|
|||
}
|
||||
|
||||
static int32_t tfSearchPrefix(void* reader, SIndexTerm* tem, SIdxTRslt* tr) {
|
||||
int32_t lino = 0;
|
||||
int32_t code = 0;
|
||||
char* p = tem->colVal;
|
||||
uint64_t sz = tem->nColVal;
|
||||
|
||||
SArray* offsets = taosArrayInit(16, sizeof(uint64_t));
|
||||
if (offsets == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
FAutoCtx* ctx = automCtxCreate((void*)p, AUTOMATION_PREFIX);
|
||||
if (ctx == NULL) {
|
||||
taosArrayDestroy(offsets);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
FAutoCtx* ctx = automCtxCreate((void*)p, AUTOMATION_PREFIX);
|
||||
FStmBuilder* sb = fstSearch(((TFileReader*)reader)->fst, ctx);
|
||||
FStmSt* st = stmBuilderIntoStm(sb);
|
||||
FStmStRslt* rt = NULL;
|
||||
while ((rt = stmStNextWith(st, NULL)) != NULL) {
|
||||
(void)taosArrayPush(offsets, &(rt->out.out));
|
||||
if (taosArrayPush(offsets, &(rt->out.out)) == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exception);
|
||||
}
|
||||
swsResultDestroy(rt);
|
||||
}
|
||||
stmStDestroy(st);
|
||||
|
@ -275,14 +305,16 @@ static int32_t tfSearchPrefix(void* reader, SIndexTerm* tem, SIdxTRslt* tr) {
|
|||
for (int i = 0; i < taosArrayGetSize(offsets); i++) {
|
||||
uint64_t offset = *(uint64_t*)taosArrayGet(offsets, i);
|
||||
ret = tfileReaderLoadTableIds((TFileReader*)reader, offset, tr->total);
|
||||
if (ret != 0) {
|
||||
taosArrayDestroy(offsets);
|
||||
indexError("failed to find target tablelist");
|
||||
return TSDB_CODE_FILE_CORRUPTED;
|
||||
}
|
||||
TAOS_CHECK_GOTO(ret, &lino, _exception);
|
||||
}
|
||||
taosArrayDestroy(offsets);
|
||||
return 0;
|
||||
_exception:
|
||||
stmStDestroy(st);
|
||||
stmBuilderDestroy(sb);
|
||||
taosArrayDestroy(offsets);
|
||||
indexError("failed to searchPrefix since %s, lino:%d", tstrerror(code), lino);
|
||||
return code;
|
||||
}
|
||||
static int32_t tfSearchSuffix(void* reader, SIndexTerm* tem, SIdxTRslt* tr) {
|
||||
int ret = 0;
|
||||
|
@ -393,6 +425,12 @@ static int32_t tfSearchTerm_JSON(void* reader, SIndexTerm* tem, SIdxTRslt* tr) {
|
|||
tem->suid, tem->colName, tem->colVal, cost);
|
||||
|
||||
ret = tfileReaderLoadTableIds((TFileReader*)reader, offset, tr->total);
|
||||
if (ret != 0) {
|
||||
indexError("failed to search json since %s", tstrerror(ret));
|
||||
taosMemoryFree(p);
|
||||
fstSliceDestroy(&key);
|
||||
return ret;
|
||||
}
|
||||
cost = taosGetTimestampUs() - et;
|
||||
indexInfo("index: %" PRIu64 ", col: %s, colVal: %s, load all table info, offset: %" PRIu64
|
||||
", size: %d, time cost: %" PRIu64 "us",
|
||||
|
@ -863,14 +901,24 @@ TFileValue* tfileValueCreate(char* val) {
|
|||
return NULL;
|
||||
}
|
||||
tf->colVal = taosStrdup(val);
|
||||
if (tf->colVal == NULL) {
|
||||
taosMemoryFree(tf);
|
||||
}
|
||||
tf->tableId = taosArrayInit(32, sizeof(uint64_t));
|
||||
if (tf->tableId == NULL) {
|
||||
taosMemoryFree(tf->colVal);
|
||||
taosMemoryFree(tf);
|
||||
return NULL;
|
||||
}
|
||||
return tf;
|
||||
}
|
||||
int tfileValuePush(TFileValue* tf, uint64_t val) {
|
||||
int32_t tfileValuePush(TFileValue* tf, uint64_t val) {
|
||||
if (tf == NULL) {
|
||||
return -1;
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
if (taosArrayPush(tf->tableId, &val) == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
(void)taosArrayPush(tf->tableId, &val);
|
||||
return 0;
|
||||
}
|
||||
void tfileValueDestroy(TFileValue* tf) {
|
||||
|
@ -986,8 +1034,10 @@ static int tfileReaderLoadFst(TFileReader* reader) {
|
|||
|
||||
return reader->fst != NULL ? 0 : -1;
|
||||
}
|
||||
static int tfileReaderLoadTableIds(TFileReader* reader, int32_t offset, SArray* result) {
|
||||
static int32_t tfileReaderLoadTableIds(TFileReader* reader, int32_t offset, SArray* result) {
|
||||
// TODO(yihao): opt later
|
||||
int32_t code = 0;
|
||||
int32_t lino = 0;
|
||||
IFileCtx* ctx = reader->ctx;
|
||||
// add block cache
|
||||
char block[4096] = {0};
|
||||
|
@ -1003,7 +1053,9 @@ static int tfileReaderLoadTableIds(TFileReader* reader, int32_t offset, SArray*
|
|||
while (nid > 0) {
|
||||
int32_t left = block + sizeof(block) - p;
|
||||
if (left >= sizeof(uint64_t)) {
|
||||
(void)taosArrayPush(result, (uint64_t*)p);
|
||||
if (taosArrayPush(result, (uint64_t*)p) == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
p += sizeof(uint64_t);
|
||||
} else {
|
||||
char buf[sizeof(uint64_t)] = {0};
|
||||
|
@ -1014,7 +1066,9 @@ static int tfileReaderLoadTableIds(TFileReader* reader, int32_t offset, SArray*
|
|||
nread = ctx->readFrom(ctx, (uint8_t*)block, sizeof(block), offset);
|
||||
memcpy(buf + left, block, sizeof(uint64_t) - left);
|
||||
|
||||
(void)taosArrayPush(result, (uint64_t*)buf);
|
||||
if (taosArrayPush(result, (uint64_t*)buf) == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
p = block + sizeof(uint64_t) - left;
|
||||
}
|
||||
nid -= 1;
|
||||
|
@ -1059,16 +1113,19 @@ void tfileReaderUnRef(TFileReader* rd) {
|
|||
}
|
||||
}
|
||||
|
||||
static SArray* tfileGetFileList(const char* path) {
|
||||
static int32_t tfileGetFileList(const char* path, SArray** ppResult) {
|
||||
int32_t code = 0;
|
||||
char buf[128] = {0};
|
||||
uint64_t suid;
|
||||
int64_t version;
|
||||
SArray* files = taosArrayInit(4, sizeof(void*));
|
||||
if (files == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
TdDirPtr pDir = taosOpenDir(path);
|
||||
if (NULL == pDir) {
|
||||
taosArrayDestroy(files);
|
||||
return NULL;
|
||||
TAOS_CHECK_GOTO(TAOS_SYSTEM_ERROR(errno), NULL, _exception);
|
||||
}
|
||||
TdDirEntryPtr pDirEntry;
|
||||
while ((pDirEntry = taosReadDir(pDir)) != NULL) {
|
||||
|
@ -1079,15 +1136,29 @@ static SArray* tfileGetFileList(const char* path) {
|
|||
|
||||
size_t len = strlen(path) + 1 + strlen(file) + 1;
|
||||
char* buf = taosMemoryCalloc(1, len);
|
||||
if (buf == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _exception);
|
||||
}
|
||||
|
||||
sprintf(buf, "%s/%s", path, file);
|
||||
(void)taosArrayPush(files, &buf);
|
||||
if (taosArrayPush(files, &buf) == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _exception);
|
||||
}
|
||||
}
|
||||
(void)taosCloseDir(&pDir);
|
||||
|
||||
taosArraySort(files, tfileCompare);
|
||||
(void)tfileRmExpireFile(files);
|
||||
*ppResult = files;
|
||||
return 0;
|
||||
|
||||
return files;
|
||||
_exception:
|
||||
(void)taosCloseDir(&pDir);
|
||||
if (files != NULL) {
|
||||
taosArrayDestroyEx(files, tfileDestroyFileName);
|
||||
taosArrayDestroy(files);
|
||||
}
|
||||
return code;
|
||||
}
|
||||
static int tfileRmExpireFile(SArray* result) {
|
||||
// TODO(yihao): remove expire tindex after restart
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue