Merge branch '3.0' of https://github.com/taosdata/TDengine into fix/TD-30837
This commit is contained in:
commit
de44c5dc5e
|
@ -2,7 +2,7 @@
|
|||
# taosadapter
|
||||
ExternalProject_Add(taosadapter
|
||||
GIT_REPOSITORY https://github.com/taosdata/taosadapter.git
|
||||
GIT_TAG main
|
||||
GIT_TAG 3.0
|
||||
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter"
|
||||
BINARY_DIR ""
|
||||
#BUILD_IN_SOURCE TRUE
|
||||
|
|
|
@ -54,95 +54,102 @@ Command-line arguments take precedence over environment variables over configura
|
|||
|
||||
```shell
|
||||
Usage of taosAdapter:
|
||||
--collectd.db string collectd db name. Env "TAOS_ADAPTER_COLLECTD_DB" (default "collectd")
|
||||
--collectd.enable enable collectd. Env "TAOS_ADAPTER_COLLECTD_ENABLE" (default true)
|
||||
--collectd.password string collectd password. Env "TAOS_ADAPTER_COLLECTD_PASSWORD" (default "taosdata")
|
||||
--collectd.port int collectd server port. Env "TAOS_ADAPTER_COLLECTD_PORT" (default 6045)
|
||||
--collectd.ttl int collectd data ttl. Env "TAOS_ADAPTER_COLLECTD_TTL"
|
||||
--collectd.user string collectd user. Env "TAOS_ADAPTER_COLLECTD_USER" (default "root")
|
||||
--collectd.worker int collectd write worker. Env "TAOS_ADAPTER_COLLECTD_WORKER" (default 10)
|
||||
-c, --config string config path default /etc/taos/taosadapter.toml
|
||||
--cors.allowAllOrigins cors allow all origins. Env "TAOS_ADAPTER_CORS_ALLOW_ALL_ORIGINS" (default true)
|
||||
--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"
|
||||
--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.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)
|
||||
--log.sqlRotationSize string record sql log rotation size(KB MB GB), must be a positive integer. Env "TAOS_ADAPTER_LOG_SQL_ROTATION_SIZE" (default "1GB")
|
||||
--log.sqlRotationTime duration record sql log rotation time. Env "TAOS_ADAPTER_LOG_SQL_ROTATION_TIME" (default 24h0m0s)
|
||||
--logLevel string log level (panic fatal error warn warning info debug trace). Env "TAOS_ADAPTER_LOG_LEVEL" (default "info")
|
||||
--monitor.collectDuration duration Set monitor duration. Env "TAOS_ADAPTER_MONITOR_COLLECT_DURATION" (default 3s)
|
||||
--monitor.disable Whether to disable monitoring. Env "TAOS_ADAPTER_MONITOR_DISABLE"
|
||||
--monitor.disableCollectClientIP Whether to disable collecting clientIP. Env "TAOS_ADAPTER_MONITOR_DISABLE_COLLECT_CLIENT_IP"
|
||||
--monitor.identity string The identity of the current instance, or 'hostname:port' if it is empty. Env "TAOS_ADAPTER_MONITOR_IDENTITY"
|
||||
--monitor.incgroup Whether running in cgroup. Env "TAOS_ADAPTER_MONITOR_INCGROUP"
|
||||
--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.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"
|
||||
--node_exporter.db string node_exporter db name. Env "TAOS_ADAPTER_NODE_EXPORTER_DB" (default "node_exporter")
|
||||
--node_exporter.enable enable node_exporter. Env "TAOS_ADAPTER_NODE_EXPORTER_ENABLE"
|
||||
--node_exporter.gatherDuration duration node_exporter gather duration. Env "TAOS_ADAPTER_NODE_EXPORTER_GATHER_DURATION" (default 5s)
|
||||
--node_exporter.httpBearerTokenString string node_exporter http bearer token. Env "TAOS_ADAPTER_NODE_EXPORTER_HTTP_BEARER_TOKEN_STRING"
|
||||
--node_exporter.httpPassword string node_exporter http password. Env "TAOS_ADAPTER_NODE_EXPORTER_HTTP_PASSWORD"
|
||||
--node_exporter.httpUsername string node_exporter http username. Env "TAOS_ADAPTER_NODE_EXPORTER_HTTP_USERNAME"
|
||||
--node_exporter.insecureSkipVerify node_exporter skip ssl check. Env "TAOS_ADAPTER_NODE_EXPORTER_INSECURE_SKIP_VERIFY" (default true)
|
||||
--node_exporter.keyFile string node_exporter cert key file path. Env "TAOS_ADAPTER_NODE_EXPORTER_KEY_FILE"
|
||||
--node_exporter.password string node_exporter password. Env "TAOS_ADAPTER_NODE_EXPORTER_PASSWORD" (default "taosdata")
|
||||
--node_exporter.responseTimeout duration node_exporter response timeout. Env "TAOS_ADAPTER_NODE_EXPORTER_RESPONSE_TIMEOUT" (default 5s)
|
||||
--node_exporter.ttl int node_exporter data ttl. Env "TAOS_ADAPTER_NODE_EXPORTER_TTL"
|
||||
--node_exporter.urls strings node_exporter urls. Env "TAOS_ADAPTER_NODE_EXPORTER_URLS" (default [http://localhost:9100])
|
||||
--node_exporter.user string node_exporter user. Env "TAOS_ADAPTER_NODE_EXPORTER_USER" (default "root")
|
||||
--opentsdb.enable enable opentsdb. Env "TAOS_ADAPTER_OPENTSDB_ENABLE" (default true)
|
||||
--opentsdb_telnet.batchSize int opentsdb_telnet batch size. Env "TAOS_ADAPTER_OPENTSDB_TELNET_BATCH_SIZE" (default 1)
|
||||
--opentsdb_telnet.dbs strings opentsdb_telnet db names. Env "TAOS_ADAPTER_OPENTSDB_TELNET_DBS" (default [opentsdb_telnet,collectd_tsdb,icinga2_tsdb,tcollector_tsdb])
|
||||
--opentsdb_telnet.enable enable opentsdb telnet,warning: without auth info(default false). Env "TAOS_ADAPTER_OPENTSDB_TELNET_ENABLE"
|
||||
--opentsdb_telnet.flushInterval duration opentsdb_telnet flush interval (0s means not valid) . Env "TAOS_ADAPTER_OPENTSDB_TELNET_FLUSH_INTERVAL"
|
||||
--opentsdb_telnet.maxTCPConnections int max tcp connections. Env "TAOS_ADAPTER_OPENTSDB_TELNET_MAX_TCP_CONNECTIONS" (default 250)
|
||||
--opentsdb_telnet.password string opentsdb_telnet password. Env "TAOS_ADAPTER_OPENTSDB_TELNET_PASSWORD" (default "taosdata")
|
||||
--opentsdb_telnet.ports ints opentsdb telnet tcp port. Env "TAOS_ADAPTER_OPENTSDB_TELNET_PORTS" (default [6046,6047,6048,6049])
|
||||
--opentsdb_telnet.tcpKeepAlive enable tcp keep alive. Env "TAOS_ADAPTER_OPENTSDB_TELNET_TCP_KEEP_ALIVE"
|
||||
--opentsdb_telnet.ttl int opentsdb_telnet data ttl. Env "TAOS_ADAPTER_OPENTSDB_TELNET_TTL"
|
||||
--opentsdb_telnet.user string opentsdb_telnet user. Env "TAOS_ADAPTER_OPENTSDB_TELNET_USER" (default "root")
|
||||
--pool.idleTimeout duration Set idle connection timeout. Env "TAOS_ADAPTER_POOL_IDLE_TIMEOUT"
|
||||
--pool.maxConnect int max connections to server. Env "TAOS_ADAPTER_POOL_MAX_CONNECT"
|
||||
--pool.maxIdle int max idle connections to server. Env "TAOS_ADAPTER_POOL_MAX_IDLE"
|
||||
-P, --port int http port. Env "TAOS_ADAPTER_PORT" (default 6041)
|
||||
--prometheus.enable enable prometheus. Env "TAOS_ADAPTER_PROMETHEUS_ENABLE" (default true)
|
||||
--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.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)
|
||||
--statsd.enable enable statsd. Env "TAOS_ADAPTER_STATSD_ENABLE" (default true)
|
||||
--statsd.gatherInterval duration statsd gather interval. Env "TAOS_ADAPTER_STATSD_GATHER_INTERVAL" (default 5s)
|
||||
--statsd.maxTCPConnections int statsd max tcp connections. Env "TAOS_ADAPTER_STATSD_MAX_TCP_CONNECTIONS" (default 250)
|
||||
--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.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"
|
||||
--tmq.releaseIntervalMultiplierForAutocommit int When set to autocommit, the interval for message release is a multiple of the autocommit interval, with a default value of 2 and a minimum value of 1 and a maximum value of 10. Env "TAOS_ADAPTER_TMQ_RELEASE_INTERVAL_MULTIPLIER_FOR_AUTOCOMMIT" (default 2)
|
||||
--version Print the version and exit
|
||||
--collectd.db string collectd db name. Env "TAOS_ADAPTER_COLLECTD_DB" (default "collectd")
|
||||
--collectd.enable enable collectd. Env "TAOS_ADAPTER_COLLECTD_ENABLE" (default true)
|
||||
--collectd.password string collectd password. Env "TAOS_ADAPTER_COLLECTD_PASSWORD" (default "taosdata")
|
||||
--collectd.port int collectd server port. Env "TAOS_ADAPTER_COLLECTD_PORT" (default 6045)
|
||||
--collectd.ttl int collectd data ttl. Env "TAOS_ADAPTER_COLLECTD_TTL"
|
||||
--collectd.user string collectd user. Env "TAOS_ADAPTER_COLLECTD_USER" (default "root")
|
||||
--collectd.worker int collectd write worker. Env "TAOS_ADAPTER_COLLECTD_WORKER" (default 10)
|
||||
-c, --config string config path default /etc/taos/taosadapter.toml
|
||||
--cors.allowAllOrigins cors allow all origins. Env "TAOS_ADAPTER_CORS_ALLOW_ALL_ORIGINS" (default true)
|
||||
--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"
|
||||
--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)
|
||||
--instanceId int instance ID. Env "TAOS_ADAPTER_INSTANCE_ID" (default 32)
|
||||
--log.compress whether to compress old log. Env "TAOS_ADAPTER_LOG_COMPRESS"
|
||||
--log.enableRecordHttpSql whether to record http sql. Env "TAOS_ADAPTER_LOG_ENABLE_RECORD_HTTP_SQL"
|
||||
--log.level string log level (trace debug info warning error). Env "TAOS_ADAPTER_LOG_LEVEL" (default "info")
|
||||
--log.path string log path. Env "TAOS_ADAPTER_LOG_PATH" (default "/var/log/taos")
|
||||
--log.reservedDiskSize string reserved disk size for log dir (KB MB GB), must be a positive integer. Env "TAOS_ADAPTER_LOG_RESERVED_DISK_SIZE" (default "1GB")
|
||||
--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 deprecated: log rotation time always 24 hours. 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)
|
||||
--log.sqlRotationSize string record sql log rotation size(KB MB GB), must be a positive integer. Env "TAOS_ADAPTER_LOG_SQL_ROTATION_SIZE" (default "1GB")
|
||||
--log.sqlRotationTime duration record sql log rotation time. Env "TAOS_ADAPTER_LOG_SQL_ROTATION_TIME" (default 24h0m0s)
|
||||
--logLevel string log level (trace debug info warning error). Env "TAOS_ADAPTER_LOG_LEVEL" (default "info")
|
||||
--monitor.collectDuration duration Set monitor duration. Env "TAOS_ADAPTER_MONITOR_COLLECT_DURATION" (default 3s)
|
||||
--monitor.disable Whether to disable monitoring. Env "TAOS_ADAPTER_MONITOR_DISABLE" (default true)
|
||||
--monitor.identity string The identity of the current instance, or 'hostname:port' if it is empty. Env "TAOS_ADAPTER_MONITOR_IDENTITY"
|
||||
--monitor.incgroup Whether running in cgroup. Env "TAOS_ADAPTER_MONITOR_INCGROUP"
|
||||
--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)
|
||||
--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"
|
||||
--node_exporter.db string node_exporter db name. Env "TAOS_ADAPTER_NODE_EXPORTER_DB" (default "node_exporter")
|
||||
--node_exporter.enable enable node_exporter. Env "TAOS_ADAPTER_NODE_EXPORTER_ENABLE"
|
||||
--node_exporter.gatherDuration duration node_exporter gather duration. Env "TAOS_ADAPTER_NODE_EXPORTER_GATHER_DURATION" (default 5s)
|
||||
--node_exporter.httpBearerTokenString string node_exporter http bearer token. Env "TAOS_ADAPTER_NODE_EXPORTER_HTTP_BEARER_TOKEN_STRING"
|
||||
--node_exporter.httpPassword string node_exporter http password. Env "TAOS_ADAPTER_NODE_EXPORTER_HTTP_PASSWORD"
|
||||
--node_exporter.httpUsername string node_exporter http username. Env "TAOS_ADAPTER_NODE_EXPORTER_HTTP_USERNAME"
|
||||
--node_exporter.insecureSkipVerify node_exporter skip ssl check. Env "TAOS_ADAPTER_NODE_EXPORTER_INSECURE_SKIP_VERIFY" (default true)
|
||||
--node_exporter.keyFile string node_exporter cert key file path. Env "TAOS_ADAPTER_NODE_EXPORTER_KEY_FILE"
|
||||
--node_exporter.password string node_exporter password. Env "TAOS_ADAPTER_NODE_EXPORTER_PASSWORD" (default "taosdata")
|
||||
--node_exporter.responseTimeout duration node_exporter response timeout. Env "TAOS_ADAPTER_NODE_EXPORTER_RESPONSE_TIMEOUT" (default 5s)
|
||||
--node_exporter.ttl int node_exporter data ttl. Env "TAOS_ADAPTER_NODE_EXPORTER_TTL"
|
||||
--node_exporter.urls strings node_exporter urls. Env "TAOS_ADAPTER_NODE_EXPORTER_URLS" (default [http://localhost:9100])
|
||||
--node_exporter.user string node_exporter user. Env "TAOS_ADAPTER_NODE_EXPORTER_USER" (default "root")
|
||||
--opentsdb.enable enable opentsdb. Env "TAOS_ADAPTER_OPENTSDB_ENABLE" (default true)
|
||||
--opentsdb_telnet.batchSize int opentsdb_telnet batch size. Env "TAOS_ADAPTER_OPENTSDB_TELNET_BATCH_SIZE" (default 1)
|
||||
--opentsdb_telnet.dbs strings opentsdb_telnet db names. Env "TAOS_ADAPTER_OPENTSDB_TELNET_DBS" (default [opentsdb_telnet,collectd_tsdb,icinga2_tsdb,tcollector_tsdb])
|
||||
--opentsdb_telnet.enable enable opentsdb telnet,warning: without auth info(default false). Env "TAOS_ADAPTER_OPENTSDB_TELNET_ENABLE"
|
||||
--opentsdb_telnet.flushInterval duration opentsdb_telnet flush interval (0s means not valid) . Env "TAOS_ADAPTER_OPENTSDB_TELNET_FLUSH_INTERVAL"
|
||||
--opentsdb_telnet.maxTCPConnections int max tcp connections. Env "TAOS_ADAPTER_OPENTSDB_TELNET_MAX_TCP_CONNECTIONS" (default 250)
|
||||
--opentsdb_telnet.password string opentsdb_telnet password. Env "TAOS_ADAPTER_OPENTSDB_TELNET_PASSWORD" (default "taosdata")
|
||||
--opentsdb_telnet.ports ints opentsdb telnet tcp port. Env "TAOS_ADAPTER_OPENTSDB_TELNET_PORTS" (default [6046,6047,6048,6049])
|
||||
--opentsdb_telnet.tcpKeepAlive enable tcp keep alive. Env "TAOS_ADAPTER_OPENTSDB_TELNET_TCP_KEEP_ALIVE"
|
||||
--opentsdb_telnet.ttl int opentsdb_telnet data ttl. Env "TAOS_ADAPTER_OPENTSDB_TELNET_TTL"
|
||||
--opentsdb_telnet.user string opentsdb_telnet user. Env "TAOS_ADAPTER_OPENTSDB_TELNET_USER" (default "root")
|
||||
--pool.idleTimeout duration Set idle connection timeout. Env "TAOS_ADAPTER_POOL_IDLE_TIMEOUT"
|
||||
--pool.maxConnect int max connections to server. Env "TAOS_ADAPTER_POOL_MAX_CONNECT"
|
||||
--pool.maxIdle int max idle connections to server. Env "TAOS_ADAPTER_POOL_MAX_IDLE"
|
||||
--pool.maxWait int max count of waiting for connection. Env "TAOS_ADAPTER_POOL_MAX_WAIT"
|
||||
--pool.waitTimeout int wait for connection timeout seconds. Env "TAOS_ADAPTER_POOL_WAIT_TIMEOUT" (default 60)
|
||||
-P, --port int http port. Env "TAOS_ADAPTER_PORT" (default 6041)
|
||||
--prometheus.enable enable prometheus. Env "TAOS_ADAPTER_PROMETHEUS_ENABLE" (default true)
|
||||
--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.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)
|
||||
--statsd.enable enable statsd. Env "TAOS_ADAPTER_STATSD_ENABLE"
|
||||
--statsd.gatherInterval duration statsd gather interval. Env "TAOS_ADAPTER_STATSD_GATHER_INTERVAL" (default 5s)
|
||||
--statsd.maxTCPConnections int statsd max tcp connections. Env "TAOS_ADAPTER_STATSD_MAX_TCP_CONNECTIONS" (default 250)
|
||||
--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 "udp4")
|
||||
--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"
|
||||
--uploadKeeper.enable Whether to enable sending metrics to keeper. Env "TAOS_ADAPTER_UPLOAD_KEEPER_ENABLE" (default true)
|
||||
--uploadKeeper.interval duration send to Keeper interval. Env "TAOS_ADAPTER_UPLOAD_KEEPER_INTERVAL" (default 15s)
|
||||
--uploadKeeper.retryInterval duration retry interval. Env "TAOS_ADAPTER_UPLOAD_KEEPER_RETRY_INTERVAL" (default 5s)
|
||||
--uploadKeeper.retryTimes uint retry times. Env "TAOS_ADAPTER_UPLOAD_KEEPER_RETRY_TIMES" (default 3)
|
||||
--uploadKeeper.timeout duration send to Keeper timeout. Env "TAOS_ADAPTER_UPLOAD_KEEPER_TIMEOUT" (default 5s)
|
||||
--uploadKeeper.url string Keeper url. Env "TAOS_ADAPTER_UPLOAD_KEEPER_URL" (default "http://127.0.0.1:6043/adapter_report")
|
||||
-V, --version Print the version and exit
|
||||
```
|
||||
|
||||
Note:
|
||||
|
@ -163,6 +170,17 @@ For details on the CORS protocol, please refer to: [https://www.w3.org/wiki/CORS
|
|||
|
||||
See [example/config/taosadapter.toml](https://github.com/taosdata/taosadapter/blob/3.0/example/config/taosadapter.toml) for sample configuration files.
|
||||
|
||||
### Connection Pool Parameters
|
||||
|
||||
When using the RESTful interface, TDengine connections are managed through a connection pool. The pool can be configured with the following parameters:
|
||||
|
||||
- **`pool.maxConnect`**: The maximum number of connections allowed in the pool. The default value is 2 times the number of CPU cores. It is recommended to keep the default setting.
|
||||
- **`pool.maxIdle`**: The maximum number of idle connections allowed in the pool. By default, this is the same as `pool.maxConnect`. It is recommended to keep the default setting.
|
||||
- **`pool.idleTimeout`**: The idle timeout duration for connections. By default, connections never time out. It is recommended to keep the default setting.
|
||||
- **`pool.waitTimeout`**: The timeout for acquiring a connection from the pool. The default value is 60 seconds. If a connection cannot be acquired within the timeout, an HTTP 503 status code will be returned. This parameter is available starting from version 3.3.3.0.
|
||||
- **`pool.maxWait`**: The maximum number of requests waiting to acquire a connection from the pool. The default value is 0, meaning there is no limit. If the number of queued requests exceeds this value, new requests will return an HTTP 503 status code. This parameter is available starting from version 3.3.3.0.
|
||||
|
||||
|
||||
## Feature List
|
||||
|
||||
- RESTful interface
|
||||
|
|
|
@ -7,21 +7,29 @@ sidebar_label: "PI"
|
|||
|
||||
## 功能概述
|
||||
|
||||
PI 系统是一套用于数据收集、查找、分析、传递和可视化的软件产品,可以作为管理实时数据和事件的企业级系统的基础架构。
|
||||
PI 系统是一套用于数据收集、查找、分析、传递和可视化的软件产品,可以作为管理实时数据和事件的企业级系统的基础架构。taosX 可以 PI 连接器插件从 PI 系统中提取实时数据或历史数据。
|
||||
|
||||
taosX 可以通过 PI 连接器插件从 PI 系统中提取实时数据。
|
||||
从数据的实时性角度来看 PI 数据源任务分为两类:**实时任务**和**回填任务**。在任务类型下拉列表两类任务分别对应名称: **PI** 和 **PI backfill**。
|
||||
|
||||
从数据模型角度来看, PI 数据源任务分为**单列模型**任务和**多列模型**任务:
|
||||
1. **单列模型**任务将一个 PI Point 映射为 TDengine 一张表
|
||||
2. **多列模型**任务将一个 PI AF 元素映射为一张表
|
||||
|
||||
有两类 PI 任务: 实时同步任务和历史数据迁移任务,在任务下拉列表的名称分别对应 “PI” 和 “PI backfill”。
|
||||
从连接的数据源类型来讲,PI 数据源任务又分为 **Archive Server** 数据源和 **AF Server** 数据源。对于 **Archive Server** 数据源,只能使用**单列模型**。对于 **AF Server** 数据源,既可以选择**单列模型**,又可以选择**多列模型**。
|
||||
|
||||
用户通过一个 CSV 文件配置从 PI 到 TDengine 的数据映射规则,这个 CSV 文件称为**模型配置文件**:
|
||||
1. 对于使用 AF Server 单列模型的任务,taosX 会自动识别元素的哪些属性是引用 PI Point 的数据,并把一个 PI Point 属性对应到一张表。
|
||||
2. 对于使用 AF Server 的多列模型任务,一个元素对应一张表。taosX 默认会把 PI Point 属性映射到 TDengine Metric 列,把其它属性映射到 TDengine TAG 列。
|
||||
|
||||
## 创建任务
|
||||
|
||||
### 1. 新增数据源
|
||||
### 新增数据源
|
||||
|
||||
在数据写入页面中,点击 **+新增数据源** 按钮,进入新增数据源页面。
|
||||
|
||||

|
||||
|
||||
### 2. 配置基本信息
|
||||
### 基本配置
|
||||
|
||||
在 **名称** 中输入任务名称,如:“test”;
|
||||
|
||||
|
@ -33,7 +41,7 @@ taosX 可以通过 PI 连接器插件从 PI 系统中提取实时数据。
|
|||
|
||||

|
||||
|
||||
### 3. 配置连接信息
|
||||
### 连接配置
|
||||
|
||||
PI 连接器支持两种连接方式:
|
||||
|
||||
|
@ -46,21 +54,130 @@ PI 连接器支持两种连接方式:
|
|||
|
||||
点击 **连通性检查** 按钮,检查数据源是否可用。
|
||||
|
||||
### 4. 配置数据模型
|
||||
### 数据模型配置
|
||||
|
||||
这一部分,我们用一个 csv 文件配置 PI 的数据模型到 TDengine 的数据模型的映射规则。这里所说的映射规则包含 3 方面内容:
|
||||
这一部分有两个 Tab,分别对应单列模型的配置和多列模型的配置。如果你是第一次配置,无论选择单列模型还是多列模型,请务必点击“下载默认配置”按钮。这个操作会触发生成默认的**模型配置文件**,同时也会把**模型配置文件**下载到本地,你可以查看或编辑。编辑后还可以再上传,来覆盖默认的配置。
|
||||
|
||||
1. 定义源数据范围,即哪些点或哪些模板需要同步到 TDengine。
|
||||
2. 定义过滤规则,即符合什么条件的数据才需要同步到 TDengine。
|
||||
3. 定义转换规则,即对原始数据做什么样的变换后再写入 TDengine。
|
||||
如果你想同步所有点位或所有模板的元素,那么用默认的配置就好了。如果你想要过滤特定命名模式的点位或元素模板,那么需要先填写过滤条件再点击“下载默认配置”。
|
||||
|
||||
如果您不知道具体怎么操作,可以点击“下载默认配置”按钮,下载得到的 csv 文件有详细的使用说明。
|
||||
#### 多列模型配置文件
|
||||
|
||||
### 5. 其他配置
|
||||
下面是一个多列模型配置文件的示例。这个配置文件包含两个超级表的配置:一个是 metertemplate 表,它的数据来自模板 MeterTemplate 的元素;另一个是 farm 表,它的数据来自 Farm 模板的元素。
|
||||
|
||||
其余的配置,比较重要的是:
|
||||
```csv
|
||||
SuperTable,metertemplate
|
||||
SubTable,${element_name}_${element_id}
|
||||
Template,MeterTemplate
|
||||
Filter,
|
||||
ts,KEY,TIMESTAMP,$ts
|
||||
voltage,COLUMN,DOUBLE,$voltage
|
||||
voltage_status,COLUMN,INT,$voltage_status
|
||||
current,COLUMN,DOUBLE,$current
|
||||
current_status,COLUMN,INT,$current_status
|
||||
element_id,TAG,VARCHAR(100),$element_id
|
||||
element_name,TAG,VARCHAR(100),$element_name
|
||||
path,TAG,VARCHAR(100),$path
|
||||
categories,TAG,VARCHAR(100),$categories
|
||||
|
||||
1. 对于 PI 任务,配置“重启补偿时间”,如果任务意外中断,重启时配置这个参数非常有用,它会让 taosX 自动 backfill 一段时间的数据。
|
||||
2. 对于 PI backfill 任务,需要配置 backfill 的开始和结束时间。
|
||||
SuperTable,farm
|
||||
SubTable,${element_name}_${element_id}
|
||||
Template,Farm
|
||||
Filter,
|
||||
ts,KEY,TIMESTAMP,$ts
|
||||
wind_speed,COLUMN,FLOAT,$wind_speed
|
||||
wind_speed_status,COLUMN,INT,$wind_speed_status
|
||||
power_production,COLUMN,FLOAT,$power_production
|
||||
power_production_status,COLUMN,INT,$power_production_status
|
||||
lost_power,COLUMN,FLOAT,$lost_power
|
||||
lost_power_status,COLUMN,INT,$lost_power_status
|
||||
farm_lifetime_production__weekly_,COLUMN,FLOAT,$farm_lifetime_production__weekly_
|
||||
farm_lifetime_production__weekly__status,COLUMN,INT,$farm_lifetime_production__weekly__status
|
||||
farm_lifetime_production__hourly_,COLUMN,FLOAT,$farm_lifetime_production__hourly_
|
||||
farm_lifetime_production__hourly__status,COLUMN,INT,$farm_lifetime_production__hourly__status
|
||||
element_id,TAG,VARCHAR(100),$element_id
|
||||
element_name,TAG,VARCHAR(100),$element_name
|
||||
path,TAG,VARCHAR(100),$path
|
||||
categories,TAG,VARCHAR(100),$categories
|
||||
```
|
||||
|
||||
多列模型配置文件由一个或多个超级表的定义组成。每个超级表的配置都包括:
|
||||
|
||||
1. 超级表和模板的对应关系
|
||||
2. 属性和 TDengine Metric 列的对应关系
|
||||
3. 属性和 TDengine TAG 列的对应关系
|
||||
4. 源数据过滤条件
|
||||
5. 对于每一列,无论是 Metrics 列还是 TAG 列,都可以配置一个映射规则,详见[零代码第三方数据接入](../)“数据提取、过滤和转换”部分
|
||||
|
||||
#### 单列模型配置文件
|
||||
|
||||
下面是一个单列模型配置文件的示例。
|
||||
|
||||
```csv
|
||||
SuperTable,volt_float32
|
||||
SubTable,${point_name}
|
||||
Filter,
|
||||
ts,KEY,TIMESTAMP,$ts
|
||||
value,COLUMN,FLOAT,$value
|
||||
status,COLUMN,INT,$status
|
||||
path,TAG,VARCHAR(200),$path
|
||||
point_name,TAG,VARCHAR(100),$point_name
|
||||
ptclassname,TAG,VARCHAR(100),$ptclassname
|
||||
sourcetag,TAG,VARCHAR(100),$sourcetag
|
||||
tag,TAG,VARCHAR(100),$tag
|
||||
descriptor,TAG,VARCHAR(100),$descriptor
|
||||
exdesc,TAG,VARCHAR(100),$exdesc
|
||||
engunits,TAG,VARCHAR(100),$engunits
|
||||
pointsource,TAG,VARCHAR(100),$pointsource
|
||||
step,TAG,VARCHAR(100),$step
|
||||
future,TAG,VARCHAR(100),$future
|
||||
element_paths,TAG,VARCHAR(512),`$element_paths.replace("\\", ".")`
|
||||
|
||||
SuperTable,milliampere_float32
|
||||
SubTable,${point_name}
|
||||
Filter,
|
||||
ts,KEY,TIMESTAMP,$ts
|
||||
value,COLUMN,FLOAT,$value
|
||||
status,COLUMN,INT,$status
|
||||
path,TAG,VARCHAR(200),$path
|
||||
point_name,TAG,VARCHAR(100),$point_name
|
||||
ptclassname,TAG,VARCHAR(100),$ptclassname
|
||||
sourcetag,TAG,VARCHAR(100),$sourcetag
|
||||
tag,TAG,VARCHAR(100),$tag
|
||||
descriptor,TAG,VARCHAR(100),$descriptor
|
||||
exdesc,TAG,VARCHAR(100),$exdesc
|
||||
engunits,TAG,VARCHAR(100),$engunits
|
||||
pointsource,TAG,VARCHAR(100),$pointsource
|
||||
step,TAG,VARCHAR(100),$step
|
||||
future,TAG,VARCHAR(100),$future
|
||||
element_paths,TAG,VARCHAR(512),`$element_paths.replace("\\", ".")`
|
||||
|
||||
Meter_1000004_Voltage,POINT,volt_float32
|
||||
Meter_1000004_Current,POINT,milliampere_float32
|
||||
Meter_1000001_Voltage,POINT,volt_float32
|
||||
Meter_1000001_Current,POINT,milliampere_float32
|
||||
Meter_1000474_Voltage,POINT,volt_float32
|
||||
Meter_1000474_Current,POINT,milliampere_float32
|
||||
```
|
||||
|
||||
单列模型配置文件分为两个部分,第一部分通多列模型配置文件,由若干个超级表的定义组成。第二部分是点位列表,这一部分配置了点位和超级表的映射关系。默认生成的配置把 UOM 相同且数据类型相同的点映射到同一个超级表。
|
||||
|
||||
### Backfill 配置
|
||||
|
||||
1. 对于 PI 任务,可配置“重启补偿时间”,如果任务意外中断,重启时配置这个参数非常有用,它会让 taosX 自动回填一段时间的数据。
|
||||
2. 对于 PI backfill 任务,必须配置 backfill 的开始和结束时间。
|
||||
|
||||
### 高级选项
|
||||
|
||||
对于不同的任务类型高级选项部分有所不同。通用的高级选项有:
|
||||
1. 连接器日志级别
|
||||
2. 连接器查询和发送数据的批次大小
|
||||
3. 单次读取最大延迟
|
||||
|
||||
对于**多列模型的实时任务**,还有以下开关选项:
|
||||
|
||||
1. 是否同步新增的元素。如果打开,则 PI 连接器会监听模板下新增的元素,无需重启任务,即可自动同步新增元素的数据。
|
||||
2. 是否同步静态属性的变化。如果打开,PI 连接器会同步所有静态属性(非 PI Point 属性)的变化。也就是说如果在 PI AF Server 一个元素的静态属性值做了修改,那么 TDengine 表相应 TAG 的值也会修改。
|
||||
3. 是否同步删除元素的操作。如果打开,则 PI 连接器会监听配置的模板下删除元素的事件,并同步删除 TDengine 对应子表。
|
||||
4. 是否同步删除历史数据。如果打开,则对于某个元素的时序数据,如果在 PI 中某个时间的数据被删除了,TDengine 对应时间对应列的数据会被置空。
|
||||
5. 是否同步修改历史数据。如果打开,则对于某个元素的时序数据,如果在 PI 中历史数据被修改了,TDengine 对应时间的数据也会更新。
|
||||
|
||||
高级配置部分可以配置连接器日志的级别、批次大小、和批次延迟。用于 Debug 和 性能优化。
|
|
@ -54,96 +54,102 @@ taosAdapter 支持通过命令行参数、环境变量和配置文件来进行
|
|||
|
||||
```shell
|
||||
Usage of taosAdapter:
|
||||
--collectd.db string collectd db name. Env "TAOS_ADAPTER_COLLECTD_DB" (default "collectd")
|
||||
--collectd.enable enable collectd. Env "TAOS_ADAPTER_COLLECTD_ENABLE" (default true)
|
||||
--collectd.password string collectd password. Env "TAOS_ADAPTER_COLLECTD_PASSWORD" (default "taosdata")
|
||||
--collectd.port int collectd server port. Env "TAOS_ADAPTER_COLLECTD_PORT" (default 6045)
|
||||
--collectd.ttl int collectd data ttl. Env "TAOS_ADAPTER_COLLECTD_TTL"
|
||||
--collectd.user string collectd user. Env "TAOS_ADAPTER_COLLECTD_USER" (default "root")
|
||||
--collectd.worker int collectd write worker. Env "TAOS_ADAPTER_COLLECTD_WORKER" (default 10)
|
||||
-c, --config string config path default /etc/taos/taosadapter.toml
|
||||
--cors.allowAllOrigins cors allow all origins. Env "TAOS_ADAPTER_CORS_ALLOW_ALL_ORIGINS" (default true)
|
||||
--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"
|
||||
--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.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)
|
||||
--log.sqlRotationSize string record sql log rotation size(KB MB GB), must be a positive integer. Env "TAOS_ADAPTER_LOG_SQL_ROTATION_SIZE" (default "1GB")
|
||||
--log.sqlRotationTime duration record sql log rotation time. Env "TAOS_ADAPTER_LOG_SQL_ROTATION_TIME" (default 24h0m0s)
|
||||
--logLevel string log level (panic fatal error warn warning info debug trace). Env "TAOS_ADAPTER_LOG_LEVEL" (default "info")
|
||||
--monitor.collectDuration duration Set monitor duration. Env "TAOS_ADAPTER_MONITOR_COLLECT_DURATION" (default 3s)
|
||||
--monitor.disable Whether to disable monitoring. Env "TAOS_ADAPTER_MONITOR_DISABLE"
|
||||
--monitor.disableCollectClientIP Whether to disable collecting clientIP. Env "TAOS_ADAPTER_MONITOR_DISABLE_COLLECT_CLIENT_IP"
|
||||
--monitor.identity string The identity of the current instance, or 'hostname:port' if it is empty. Env "TAOS_ADAPTER_MONITOR_IDENTITY"
|
||||
--monitor.incgroup Whether running in cgroup. Env "TAOS_ADAPTER_MONITOR_INCGROUP"
|
||||
--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.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"
|
||||
--node_exporter.db string node_exporter db name. Env "TAOS_ADAPTER_NODE_EXPORTER_DB" (default "node_exporter")
|
||||
--node_exporter.enable enable node_exporter. Env "TAOS_ADAPTER_NODE_EXPORTER_ENABLE"
|
||||
--node_exporter.gatherDuration duration node_exporter gather duration. Env "TAOS_ADAPTER_NODE_EXPORTER_GATHER_DURATION" (default 5s)
|
||||
--node_exporter.httpBearerTokenString string node_exporter http bearer token. Env "TAOS_ADAPTER_NODE_EXPORTER_HTTP_BEARER_TOKEN_STRING"
|
||||
--node_exporter.httpPassword string node_exporter http password. Env "TAOS_ADAPTER_NODE_EXPORTER_HTTP_PASSWORD"
|
||||
--node_exporter.httpUsername string node_exporter http username. Env "TAOS_ADAPTER_NODE_EXPORTER_HTTP_USERNAME"
|
||||
--node_exporter.insecureSkipVerify node_exporter skip ssl check. Env "TAOS_ADAPTER_NODE_EXPORTER_INSECURE_SKIP_VERIFY" (default true)
|
||||
--node_exporter.keyFile string node_exporter cert key file path. Env "TAOS_ADAPTER_NODE_EXPORTER_KEY_FILE"
|
||||
--node_exporter.password string node_exporter password. Env "TAOS_ADAPTER_NODE_EXPORTER_PASSWORD" (default "taosdata")
|
||||
--node_exporter.responseTimeout duration node_exporter response timeout. Env "TAOS_ADAPTER_NODE_EXPORTER_RESPONSE_TIMEOUT" (default 5s)
|
||||
--node_exporter.ttl int node_exporter data ttl. Env "TAOS_ADAPTER_NODE_EXPORTER_TTL"
|
||||
--node_exporter.urls strings node_exporter urls. Env "TAOS_ADAPTER_NODE_EXPORTER_URLS" (default [http://localhost:9100])
|
||||
--node_exporter.user string node_exporter user. Env "TAOS_ADAPTER_NODE_EXPORTER_USER" (default "root")
|
||||
--opentsdb.enable enable opentsdb. Env "TAOS_ADAPTER_OPENTSDB_ENABLE" (default true)
|
||||
--opentsdb_telnet.batchSize int opentsdb_telnet batch size. Env "TAOS_ADAPTER_OPENTSDB_TELNET_BATCH_SIZE" (default 1)
|
||||
--opentsdb_telnet.dbs strings opentsdb_telnet db names. Env "TAOS_ADAPTER_OPENTSDB_TELNET_DBS" (default [opentsdb_telnet,collectd_tsdb,icinga2_tsdb,tcollector_tsdb])
|
||||
--opentsdb_telnet.enable enable opentsdb telnet,warning: without auth info(default false). Env "TAOS_ADAPTER_OPENTSDB_TELNET_ENABLE"
|
||||
--opentsdb_telnet.flushInterval duration opentsdb_telnet flush interval (0s means not valid) . Env "TAOS_ADAPTER_OPENTSDB_TELNET_FLUSH_INTERVAL"
|
||||
--opentsdb_telnet.maxTCPConnections int max tcp connections. Env "TAOS_ADAPTER_OPENTSDB_TELNET_MAX_TCP_CONNECTIONS" (default 250)
|
||||
--opentsdb_telnet.password string opentsdb_telnet password. Env "TAOS_ADAPTER_OPENTSDB_TELNET_PASSWORD" (default "taosdata")
|
||||
--opentsdb_telnet.ports ints opentsdb telnet tcp port. Env "TAOS_ADAPTER_OPENTSDB_TELNET_PORTS" (default [6046,6047,6048,6049])
|
||||
--opentsdb_telnet.tcpKeepAlive enable tcp keep alive. Env "TAOS_ADAPTER_OPENTSDB_TELNET_TCP_KEEP_ALIVE"
|
||||
--opentsdb_telnet.ttl int opentsdb_telnet data ttl. Env "TAOS_ADAPTER_OPENTSDB_TELNET_TTL"
|
||||
--opentsdb_telnet.user string opentsdb_telnet user. Env "TAOS_ADAPTER_OPENTSDB_TELNET_USER" (default "root")
|
||||
--pool.idleTimeout duration Set idle connection timeout. Env "TAOS_ADAPTER_POOL_IDLE_TIMEOUT"
|
||||
--pool.maxConnect int max connections to server. Env "TAOS_ADAPTER_POOL_MAX_CONNECT"
|
||||
--pool.maxIdle int max idle connections to server. Env "TAOS_ADAPTER_POOL_MAX_IDLE"
|
||||
-P, --port int http port. Env "TAOS_ADAPTER_PORT" (default 6041)
|
||||
--prometheus.enable enable prometheus. Env "TAOS_ADAPTER_PROMETHEUS_ENABLE" (default true)
|
||||
--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.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)
|
||||
--statsd.enable enable statsd. Env "TAOS_ADAPTER_STATSD_ENABLE" (default true)
|
||||
--statsd.gatherInterval duration statsd gather interval. Env "TAOS_ADAPTER_STATSD_GATHER_INTERVAL" (default 5s)
|
||||
--statsd.maxTCPConnections int statsd max tcp connections. Env "TAOS_ADAPTER_STATSD_MAX_TCP_CONNECTIONS" (default 250)
|
||||
--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.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"
|
||||
--tmq.releaseIntervalMultiplierForAutocommit int When set to autocommit, the interval for message release is a multiple of the autocommit interval, with a default value of 2 and a minimum value of 1 and a maximum value of 10. Env "TAOS_ADAPTER_TMQ_RELEASE_INTERVAL_MULTIPLIER_FOR_AUTOCOMMIT" (default 2)
|
||||
--version Print the version and exit
|
||||
--collectd.db string collectd db name. Env "TAOS_ADAPTER_COLLECTD_DB" (default "collectd")
|
||||
--collectd.enable enable collectd. Env "TAOS_ADAPTER_COLLECTD_ENABLE" (default true)
|
||||
--collectd.password string collectd password. Env "TAOS_ADAPTER_COLLECTD_PASSWORD" (default "taosdata")
|
||||
--collectd.port int collectd server port. Env "TAOS_ADAPTER_COLLECTD_PORT" (default 6045)
|
||||
--collectd.ttl int collectd data ttl. Env "TAOS_ADAPTER_COLLECTD_TTL"
|
||||
--collectd.user string collectd user. Env "TAOS_ADAPTER_COLLECTD_USER" (default "root")
|
||||
--collectd.worker int collectd write worker. Env "TAOS_ADAPTER_COLLECTD_WORKER" (default 10)
|
||||
-c, --config string config path default /etc/taos/taosadapter.toml
|
||||
--cors.allowAllOrigins cors allow all origins. Env "TAOS_ADAPTER_CORS_ALLOW_ALL_ORIGINS" (default true)
|
||||
--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"
|
||||
--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)
|
||||
--instanceId int instance ID. Env "TAOS_ADAPTER_INSTANCE_ID" (default 32)
|
||||
--log.compress whether to compress old log. Env "TAOS_ADAPTER_LOG_COMPRESS"
|
||||
--log.enableRecordHttpSql whether to record http sql. Env "TAOS_ADAPTER_LOG_ENABLE_RECORD_HTTP_SQL"
|
||||
--log.level string log level (trace debug info warning error). Env "TAOS_ADAPTER_LOG_LEVEL" (default "info")
|
||||
--log.path string log path. Env "TAOS_ADAPTER_LOG_PATH" (default "/var/log/taos")
|
||||
--log.reservedDiskSize string reserved disk size for log dir (KB MB GB), must be a positive integer. Env "TAOS_ADAPTER_LOG_RESERVED_DISK_SIZE" (default "1GB")
|
||||
--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 deprecated: log rotation time always 24 hours. 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)
|
||||
--log.sqlRotationSize string record sql log rotation size(KB MB GB), must be a positive integer. Env "TAOS_ADAPTER_LOG_SQL_ROTATION_SIZE" (default "1GB")
|
||||
--log.sqlRotationTime duration record sql log rotation time. Env "TAOS_ADAPTER_LOG_SQL_ROTATION_TIME" (default 24h0m0s)
|
||||
--logLevel string log level (trace debug info warning error). Env "TAOS_ADAPTER_LOG_LEVEL" (default "info")
|
||||
--monitor.collectDuration duration Set monitor duration. Env "TAOS_ADAPTER_MONITOR_COLLECT_DURATION" (default 3s)
|
||||
--monitor.disable Whether to disable monitoring. Env "TAOS_ADAPTER_MONITOR_DISABLE" (default true)
|
||||
--monitor.identity string The identity of the current instance, or 'hostname:port' if it is empty. Env "TAOS_ADAPTER_MONITOR_IDENTITY"
|
||||
--monitor.incgroup Whether running in cgroup. Env "TAOS_ADAPTER_MONITOR_INCGROUP"
|
||||
--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)
|
||||
--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"
|
||||
--node_exporter.db string node_exporter db name. Env "TAOS_ADAPTER_NODE_EXPORTER_DB" (default "node_exporter")
|
||||
--node_exporter.enable enable node_exporter. Env "TAOS_ADAPTER_NODE_EXPORTER_ENABLE"
|
||||
--node_exporter.gatherDuration duration node_exporter gather duration. Env "TAOS_ADAPTER_NODE_EXPORTER_GATHER_DURATION" (default 5s)
|
||||
--node_exporter.httpBearerTokenString string node_exporter http bearer token. Env "TAOS_ADAPTER_NODE_EXPORTER_HTTP_BEARER_TOKEN_STRING"
|
||||
--node_exporter.httpPassword string node_exporter http password. Env "TAOS_ADAPTER_NODE_EXPORTER_HTTP_PASSWORD"
|
||||
--node_exporter.httpUsername string node_exporter http username. Env "TAOS_ADAPTER_NODE_EXPORTER_HTTP_USERNAME"
|
||||
--node_exporter.insecureSkipVerify node_exporter skip ssl check. Env "TAOS_ADAPTER_NODE_EXPORTER_INSECURE_SKIP_VERIFY" (default true)
|
||||
--node_exporter.keyFile string node_exporter cert key file path. Env "TAOS_ADAPTER_NODE_EXPORTER_KEY_FILE"
|
||||
--node_exporter.password string node_exporter password. Env "TAOS_ADAPTER_NODE_EXPORTER_PASSWORD" (default "taosdata")
|
||||
--node_exporter.responseTimeout duration node_exporter response timeout. Env "TAOS_ADAPTER_NODE_EXPORTER_RESPONSE_TIMEOUT" (default 5s)
|
||||
--node_exporter.ttl int node_exporter data ttl. Env "TAOS_ADAPTER_NODE_EXPORTER_TTL"
|
||||
--node_exporter.urls strings node_exporter urls. Env "TAOS_ADAPTER_NODE_EXPORTER_URLS" (default [http://localhost:9100])
|
||||
--node_exporter.user string node_exporter user. Env "TAOS_ADAPTER_NODE_EXPORTER_USER" (default "root")
|
||||
--opentsdb.enable enable opentsdb. Env "TAOS_ADAPTER_OPENTSDB_ENABLE" (default true)
|
||||
--opentsdb_telnet.batchSize int opentsdb_telnet batch size. Env "TAOS_ADAPTER_OPENTSDB_TELNET_BATCH_SIZE" (default 1)
|
||||
--opentsdb_telnet.dbs strings opentsdb_telnet db names. Env "TAOS_ADAPTER_OPENTSDB_TELNET_DBS" (default [opentsdb_telnet,collectd_tsdb,icinga2_tsdb,tcollector_tsdb])
|
||||
--opentsdb_telnet.enable enable opentsdb telnet,warning: without auth info(default false). Env "TAOS_ADAPTER_OPENTSDB_TELNET_ENABLE"
|
||||
--opentsdb_telnet.flushInterval duration opentsdb_telnet flush interval (0s means not valid) . Env "TAOS_ADAPTER_OPENTSDB_TELNET_FLUSH_INTERVAL"
|
||||
--opentsdb_telnet.maxTCPConnections int max tcp connections. Env "TAOS_ADAPTER_OPENTSDB_TELNET_MAX_TCP_CONNECTIONS" (default 250)
|
||||
--opentsdb_telnet.password string opentsdb_telnet password. Env "TAOS_ADAPTER_OPENTSDB_TELNET_PASSWORD" (default "taosdata")
|
||||
--opentsdb_telnet.ports ints opentsdb telnet tcp port. Env "TAOS_ADAPTER_OPENTSDB_TELNET_PORTS" (default [6046,6047,6048,6049])
|
||||
--opentsdb_telnet.tcpKeepAlive enable tcp keep alive. Env "TAOS_ADAPTER_OPENTSDB_TELNET_TCP_KEEP_ALIVE"
|
||||
--opentsdb_telnet.ttl int opentsdb_telnet data ttl. Env "TAOS_ADAPTER_OPENTSDB_TELNET_TTL"
|
||||
--opentsdb_telnet.user string opentsdb_telnet user. Env "TAOS_ADAPTER_OPENTSDB_TELNET_USER" (default "root")
|
||||
--pool.idleTimeout duration Set idle connection timeout. Env "TAOS_ADAPTER_POOL_IDLE_TIMEOUT"
|
||||
--pool.maxConnect int max connections to server. Env "TAOS_ADAPTER_POOL_MAX_CONNECT"
|
||||
--pool.maxIdle int max idle connections to server. Env "TAOS_ADAPTER_POOL_MAX_IDLE"
|
||||
--pool.maxWait int max count of waiting for connection. Env "TAOS_ADAPTER_POOL_MAX_WAIT"
|
||||
--pool.waitTimeout int wait for connection timeout seconds. Env "TAOS_ADAPTER_POOL_WAIT_TIMEOUT" (default 60)
|
||||
-P, --port int http port. Env "TAOS_ADAPTER_PORT" (default 6041)
|
||||
--prometheus.enable enable prometheus. Env "TAOS_ADAPTER_PROMETHEUS_ENABLE" (default true)
|
||||
--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.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)
|
||||
--statsd.enable enable statsd. Env "TAOS_ADAPTER_STATSD_ENABLE"
|
||||
--statsd.gatherInterval duration statsd gather interval. Env "TAOS_ADAPTER_STATSD_GATHER_INTERVAL" (default 5s)
|
||||
--statsd.maxTCPConnections int statsd max tcp connections. Env "TAOS_ADAPTER_STATSD_MAX_TCP_CONNECTIONS" (default 250)
|
||||
--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 "udp4")
|
||||
--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"
|
||||
--uploadKeeper.enable Whether to enable sending metrics to keeper. Env "TAOS_ADAPTER_UPLOAD_KEEPER_ENABLE" (default true)
|
||||
--uploadKeeper.interval duration send to Keeper interval. Env "TAOS_ADAPTER_UPLOAD_KEEPER_INTERVAL" (default 15s)
|
||||
--uploadKeeper.retryInterval duration retry interval. Env "TAOS_ADAPTER_UPLOAD_KEEPER_RETRY_INTERVAL" (default 5s)
|
||||
--uploadKeeper.retryTimes uint retry times. Env "TAOS_ADAPTER_UPLOAD_KEEPER_RETRY_TIMES" (default 3)
|
||||
--uploadKeeper.timeout duration send to Keeper timeout. Env "TAOS_ADAPTER_UPLOAD_KEEPER_TIMEOUT" (default 5s)
|
||||
--uploadKeeper.url string Keeper url. Env "TAOS_ADAPTER_UPLOAD_KEEPER_URL" (default "http://127.0.0.1:6043/adapter_report")
|
||||
-V, --version Print the version and exit
|
||||
```
|
||||
|
||||
备注:
|
||||
|
@ -164,6 +170,16 @@ AllowWebSockets
|
|||
|
||||
示例配置文件参见 [example/config/taosadapter.toml](https://github.com/taosdata/taosadapter/blob/3.0/example/config/taosadapter.toml)。
|
||||
|
||||
### 连接池参数说明
|
||||
|
||||
在使用 RESTful 接口请求时,系统将通过连接池管理 TDengine 连接。连接池可通过以下参数进行配置:
|
||||
|
||||
- **`pool.maxConnect`**:连接池允许的最大连接数,默认值为 2 倍 CPU 核心数。建议保持默认设置。
|
||||
- **`pool.maxIdle`**:连接池中允许的最大空闲连接数,默认与 `pool.maxConnect` 相同。建议保持默认设置。
|
||||
- **`pool.idleTimeout`**:连接空闲超时时间,默认永不超时。建议保持默认设置。
|
||||
- **`pool.waitTimeout`**:从连接池获取连接的超时时间,默认设置为 60 秒。如果在超时时间内未能获取连接,将返回 HTTP 状态码 503。该参数从版本 3.3.3.0 开始提供。
|
||||
- **`pool.maxWait`**:连接池中等待获取连接的请求数上限,默认值为 0,表示不限制。当排队请求数超过此值时,新的请求将返回 HTTP 状态码 503。该参数从版本 3.3.3.0 开始提供。
|
||||
|
||||
## 功能列表
|
||||
|
||||
- RESTful 接口
|
||||
|
|
|
@ -110,6 +110,8 @@ typedef struct SFirstLastRes {
|
|||
int32_t pkBytes;
|
||||
int8_t pkType;
|
||||
STuplePos pos;
|
||||
STuplePos nullTuplePos;
|
||||
bool nullTupleSaved;
|
||||
char buf[];
|
||||
} SFirstLastRes;
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ typedef struct SName {
|
|||
char tname[TSDB_TABLE_NAME_LEN];
|
||||
} SName;
|
||||
|
||||
SName* toName(int32_t acctId, const char* pDbName, const char* pTableName, SName* pName);
|
||||
void toName(int32_t acctId, const char* pDbName, const char* pTableName, SName* pName);
|
||||
|
||||
int32_t tNameExtractFullName(const SName* name, char* dst);
|
||||
|
||||
|
|
|
@ -29,5 +29,6 @@ int32_t qExecExplainBegin(SQueryPlan *pDag, SExplainCtx **pCtx, int64_t startTs)
|
|||
int32_t qExecExplainEnd(SExplainCtx *pCtx, SRetrieveTableRsp **pRsp);
|
||||
int32_t qExplainUpdateExecInfo(SExplainCtx *pCtx, SExplainRsp *pRspMsg, int32_t groupId, SRetrieveTableRsp **pRsp);
|
||||
void qExplainFreeCtx(SExplainCtx *pCtx);
|
||||
int32_t formatDurationOrKeep(char* buffer, int32_t timeInMinutes);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -280,6 +280,7 @@ bool fmIsSkipScanCheckFunc(int32_t funcId);
|
|||
bool fmIsPrimaryKeyFunc(int32_t funcId);
|
||||
bool fmIsProcessByRowFunc(int32_t funcId);
|
||||
bool fmisSelectGroupConstValueFunc(int32_t funcId);
|
||||
bool fmIsElapsedFunc(int32_t funcId);
|
||||
|
||||
void getLastCacheDataType(SDataType* pType, int32_t pkBytes);
|
||||
int32_t createFunction(const char* pName, SNodeList* pParameterList, SFunctionNode** pFunc);
|
||||
|
|
|
@ -129,6 +129,14 @@ extern int64_t tsRandErrDivisor;
|
|||
extern int64_t tsRandErrScope;
|
||||
extern threadlocal bool tsEnableRandErr;
|
||||
|
||||
#define TAOS_UNUSED(expr) (void)(expr)
|
||||
#define TAOS_SKIP_ERROR(expr) \
|
||||
{ \
|
||||
int32_t _code = terrno; \
|
||||
(void)(expr); \
|
||||
terrno = _code; \
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -55,7 +55,7 @@ extern SDiskSpace tsLogSpace;
|
|||
extern SDiskSpace tsTempSpace;
|
||||
|
||||
int32_t osDefaultInit();
|
||||
void osUpdate();
|
||||
int32_t osUpdate();
|
||||
void osCleanup();
|
||||
|
||||
bool osLogSpaceAvailable();
|
||||
|
|
|
@ -27,11 +27,11 @@ extern "C" {
|
|||
// typedef struct tsem_s *tsem_t;
|
||||
typedef dispatch_semaphore_t tsem_t;
|
||||
|
||||
int tsem_init(tsem_t *sem, int pshared, unsigned int value);
|
||||
int tsem_wait(tsem_t *sem);
|
||||
int tsem_timewait(tsem_t *sim, int64_t milis);
|
||||
int tsem_post(tsem_t *sem);
|
||||
int tsem_destroy(tsem_t *sem);
|
||||
int32_t tsem_init(tsem_t *sem, int pshared, unsigned int value);
|
||||
int32_t tsem_wait(tsem_t *sem);
|
||||
int32_t tsem_timewait(tsem_t *sim, int64_t milis);
|
||||
int32_t tsem_post(tsem_t *sem);
|
||||
int32_t tsem_destroy(tsem_t *sem);
|
||||
|
||||
#define tsem2_t tsem_t
|
||||
#define tsem2_init tsem_init
|
||||
|
@ -45,11 +45,11 @@ int tsem_destroy(tsem_t *sem);
|
|||
|
||||
#define tsem_t HANDLE
|
||||
|
||||
int tsem_init(tsem_t *sem, int pshared, unsigned int value);
|
||||
int tsem_wait(tsem_t *sem);
|
||||
int tsem_timewait(tsem_t *sim, int64_t milis);
|
||||
int tsem_post(tsem_t *sem);
|
||||
int tsem_destroy(tsem_t *sem);
|
||||
int32_t tsem_init(tsem_t *sem, int pshared, unsigned int value);
|
||||
int32_t tsem_wait(tsem_t *sem);
|
||||
int32_t tsem_timewait(tsem_t *sim, int64_t milis);
|
||||
int32_t tsem_post(tsem_t *sem);
|
||||
int32_t tsem_destroy(tsem_t *sem);
|
||||
|
||||
#define tsem2_t tsem_t
|
||||
#define tsem2_init tsem_init
|
||||
|
@ -61,11 +61,11 @@ int tsem_destroy(tsem_t *sem);
|
|||
#else
|
||||
|
||||
#define tsem_t sem_t
|
||||
#define tsem_init sem_init
|
||||
int tsem_wait(tsem_t *sem);
|
||||
int tsem_timewait(tsem_t *sim, int64_t milis);
|
||||
#define tsem_post sem_post
|
||||
#define tsem_destroy sem_destroy
|
||||
int32_t tsem_init(tsem_t *sem, int pshared, unsigned int value);
|
||||
int32_t tsem_wait(tsem_t *sem);
|
||||
int32_t tsem_timewait(tsem_t *sim, int64_t milis);
|
||||
int32_t tsem_post(tsem_t *sem);
|
||||
int32_t tsem_destroy(tsem_t *sem);
|
||||
|
||||
typedef struct tsem2_t {
|
||||
TdThreadMutex mutex;
|
||||
|
|
|
@ -65,7 +65,10 @@ typedef enum { M2C = 0, C2M } ConvType;
|
|||
|
||||
char *tstrdup(const char *src);
|
||||
int32_t taosUcs4len(TdUcs4 *ucs4);
|
||||
int64_t taosStr2int64(const char *str);
|
||||
int32_t taosStr2int64(const char *str, int64_t *val);
|
||||
int32_t taosStr2int16(const char *str, int16_t *val);
|
||||
int32_t taosStr2int32(const char *str, int32_t *val);
|
||||
int32_t taosStr2int8(const char *str, int8_t *val);
|
||||
|
||||
int32_t taosConvInit(void);
|
||||
void taosConvDestroy();
|
||||
|
|
|
@ -39,15 +39,17 @@ int64_t taosGetOsUptime();
|
|||
int32_t taosGetEmail(char *email, int32_t maxLen);
|
||||
int32_t taosGetOsReleaseName(char *releaseName, char* sName, char* ver, int32_t maxLen);
|
||||
int32_t taosGetCpuInfo(char *cpuModel, int32_t maxLen, float *numOfCores);
|
||||
void taosGetCpuCores(float *numOfCores, bool physical);
|
||||
void taosGetCpuUsage(double *cpu_system, double *cpu_engine);
|
||||
int32_t taosGetCpuCores(float *numOfCores, bool physical);
|
||||
int32_t taosGetCpuUsage(double *cpu_system, double *cpu_engine);
|
||||
int32_t taosGetCpuInstructions(char* sse42, char* avx, char* avx2, char* fma, char* avx512);
|
||||
int32_t taosGetTotalMemory(int64_t *totalKB);
|
||||
int32_t taosGetProcMemory(int64_t *usedKB);
|
||||
int32_t taosGetSysMemory(int64_t *usedKB);
|
||||
int32_t taosGetDiskSize(char *dataDir, SDiskSize *diskSize);
|
||||
void taosGetProcIODelta(int64_t *rchars, int64_t *wchars, int64_t *read_bytes, int64_t *write_bytes);
|
||||
void taosGetCardInfoDelta(int64_t *receive_bytes, int64_t *transmit_bytes);
|
||||
int32_t taosGetProcIODelta(int64_t *rchars, int64_t *wchars, int64_t *read_bytes, int64_t *write_bytes);
|
||||
void taosSetDefaultProcIODelta(int64_t *rchars, int64_t *wchars, int64_t *read_bytes, int64_t *write_bytes);
|
||||
int32_t taosGetCardInfoDelta(int64_t *receive_bytes, int64_t *transmit_bytes);
|
||||
void taosSetDefaultCardInfoDelta(int64_t *receive_bytes, int64_t *transmit_bytes);
|
||||
|
||||
void taosKillSystem();
|
||||
int32_t taosGetSystemUUID(char *uid, int32_t uidlen);
|
||||
|
|
|
@ -156,6 +156,7 @@ int32_t taosGetErrSize();
|
|||
#define TSDB_CODE_OUT_OF_BUFFER TAOS_DEF_ERROR_CODE(0, 0x0137)
|
||||
#define TSDB_CODE_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x0138)
|
||||
#define TSDB_CODE_SOCKET_ERROR TAOS_DEF_ERROR_CODE(0, 0x0139)
|
||||
#define TSDB_CODE_UNSUPPORT_OS TAOS_DEF_ERROR_CODE(0, 0x013A)
|
||||
|
||||
//client
|
||||
#define TSDB_CODE_TSC_INVALID_OPERATION TAOS_DEF_ERROR_CODE(0, 0x0200)
|
||||
|
|
|
@ -79,7 +79,7 @@ void taosSetQueueFp(STaosQueue *queue, FItem itemFp, FItems itemsFp);
|
|||
int32_t taosAllocateQitem(int32_t size, EQItype itype, int64_t dataSize, void **item);
|
||||
void taosFreeQitem(void *pItem);
|
||||
int32_t taosWriteQitem(STaosQueue *queue, void *pItem);
|
||||
int32_t taosReadQitem(STaosQueue *queue, void **ppItem);
|
||||
void taosReadQitem(STaosQueue *queue, void **ppItem);
|
||||
bool taosQueueEmpty(STaosQueue *queue);
|
||||
void taosUpdateItemSize(STaosQueue *queue, int32_t items);
|
||||
int32_t taosQueueItemSize(STaosQueue *queue);
|
||||
|
|
|
@ -55,7 +55,8 @@ Source: favicon.ico; DestDir: "{app}\include"; Flags: igNoreversion;
|
|||
Source: {#MyAppSourceDir}{#MyAppDLLName}; DestDir: "{win}\System32"; Flags: igNoreversion recursesubdirs createallsubdirs 64bit;Check:IsWin64;
|
||||
Source: {#MyAppSourceDir}{#MyAppCfgName}; DestDir: "{app}\cfg"; Flags: igNoreversion recursesubdirs createallsubdirs onlyifdoesntexist uninsneveruninstall
|
||||
Source: {#MyAppSourceDir}{#MyAppDriverName}; DestDir: "{app}\driver"; Flags: igNoreversion recursesubdirs createallsubdirs
|
||||
Source: {#MyAppSourceDir}\taos_odbc\*; DestDir: "{app}\taos_odbc\"; Flags: igNoreversion recursesubdirs createallsubdirs
|
||||
Source: {#MyAppSourceDir}\taos_odbc\*; DestDir: "{app}\taos_odbc"; Flags: igNoreversion recursesubdirs createallsubdirs
|
||||
Source: {#MyAppSourceDir}\*.dll; DestDir: "{app}"; Flags: igNoreversion recursesubdirs createallsubdirs
|
||||
;Source: {#MyAppSourceDir}{#MyAppConnectorName}; DestDir: "{app}\connector"; Flags: igNoreversion recursesubdirs createallsubdirs
|
||||
;Source: {#MyAppSourceDir}{#MyAppExamplesName}; DestDir: "{app}\examples"; Flags: igNoreversion recursesubdirs createallsubdirs
|
||||
Source: {#MyAppSourceDir}{#MyAppIncludeName}; DestDir: "{app}\include"; Flags: igNoreversion recursesubdirs createallsubdirs
|
||||
|
@ -69,7 +70,9 @@ Source: {#MyAppSourceDir}\taosdump.exe; DestDir: "{app}"; DestName: "{#CusPrompt
|
|||
[run]
|
||||
Filename: {sys}\sc.exe; Parameters: "create taosd start= DEMAND binPath= ""C:\\TDengine\\taosd.exe --win_service""" ; Flags: runhidden
|
||||
Filename: {sys}\sc.exe; Parameters: "create taosadapter start= DEMAND binPath= ""C:\\TDengine\\taosadapter.exe""" ; Flags: runhidden
|
||||
Filename: "{cmd}"; Parameters: "/c odbcconf /F ""C:\TDengine\taos_odbc\win_odbcinst.in"""; WorkingDir: "{app}"; Flags: runhidden; StatusMsg: "Configuring ODBC"
|
||||
|
||||
Filename: "C:\Windows\System32\odbcconf.exe"; Parameters: "/S /F win_odbcinst.ini"; WorkingDir: "{app}\taos_odbc\x64"; Flags: runhidden; StatusMsg: "Configuring ODBC x64"
|
||||
Filename: "C:\Windows\SysWOW64\odbcconf.exe"; Parameters: "/S /F win_odbcinst.ini"; WorkingDir: "{app}\taos_odbc\x86"; Flags: runhidden; StatusMsg: "Configuring ODBC x86"
|
||||
|
||||
[UninstallRun]
|
||||
RunOnceId: "stoptaosd"; Filename: {sys}\sc.exe; Parameters: "stop taosd" ; Flags: runhidden
|
||||
|
@ -100,32 +103,26 @@ begin
|
|||
end;
|
||||
|
||||
function DeleteOdbcDsnRegistry: Boolean;
|
||||
var
|
||||
Names: TArrayOfString;
|
||||
I: Integer;
|
||||
Value: String;
|
||||
begin
|
||||
if RegGetValueNames(HKCU64, 'SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources', Names) then
|
||||
begin
|
||||
for I := 0 to GetArrayLength(Names) - 1 do
|
||||
begin
|
||||
if RegQueryStringValue(HKCU64, 'SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources', Names[I], Value) then
|
||||
begin
|
||||
if Value = 'TDengine' then
|
||||
begin
|
||||
RegDeleteKeyIncludingSubkeys(HKCU64, 'SOFTWARE\ODBC\ODBC.INI\' + Names[I]);
|
||||
RegDeleteValue(HKCU64, 'SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources\', Names[I]);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
RegDeleteKeyIncludingSubkeys(HKCU, 'SOFTWARE\ODBC\ODBC.INI\TAOS_ODBC_DSN');
|
||||
RegDeleteKeyIncludingSubkeys(HKCU, 'SOFTWARE\ODBC\ODBC.INI\TAOS_ODBC_WS_DSN')
|
||||
|
||||
RegDeleteValue(HKCU, 'SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources', 'TAOS_ODBC_DSN');
|
||||
RegDeleteValue(HKCU, 'SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources', 'TAOS_ODBC_WS_DSN');
|
||||
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
function DeleteOdbcDriverRegistry: Boolean;
|
||||
begin
|
||||
RegDeleteKeyIncludingSubkeys(HKLM64, 'SOFTWARE\ODBC\ODBCINST.INI\TDengine');
|
||||
RegDeleteValue(HKLM64, 'SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers', 'TDengine');
|
||||
// Delete 64-bit ODBC driver registry
|
||||
RegDeleteKeyIncludingSubkeys(HKLM64, 'SOFTWARE\ODBC\ODBCINST.INI\TAOS_ODBC_DRIVER');
|
||||
RegDeleteValue(HKLM64, 'SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers', 'TAOS_ODBC_DRIVER');
|
||||
|
||||
// Delete 32-bit ODBC driver registry
|
||||
RegDeleteKeyIncludingSubkeys(HKLM64, 'SOFTWARE\Wow6432Node\ODBC\ODBCINST.INI\TAOS_ODBC_DRIVER');
|
||||
RegDeleteValue(HKLM64, 'SOFTWARE\Wow6432Node\ODBC\ODBCINST.INI\ODBC Drivers', 'TAOS_ODBC_DRIVER');
|
||||
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
|
|
|
@ -150,10 +150,10 @@ typedef struct {
|
|||
SStmtExecInfo exec;
|
||||
SStmtBindInfo bInfo;
|
||||
|
||||
int64_t reqid;
|
||||
int32_t errCode;
|
||||
tsem_t asyncQuerySem;
|
||||
|
||||
int64_t reqid;
|
||||
int32_t errCode;
|
||||
tsem_t asyncQuerySem;
|
||||
bool semWaited;
|
||||
SStmtStatInfo stat;
|
||||
} STscStmt2;
|
||||
/*
|
||||
|
|
|
@ -180,7 +180,7 @@ static int32_t hbGenerateVgInfoFromRsp(SDBVgInfo **pInfo, SUseDbRsp *rsp) {
|
|||
vgInfo->vgHash = taosHashInit(rsp->vgNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_ENTRY_LOCK);
|
||||
if (NULL == vgInfo->vgHash) {
|
||||
tscError("hash init[%d] failed", rsp->vgNum);
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _return;
|
||||
}
|
||||
|
||||
|
@ -188,7 +188,7 @@ static int32_t hbGenerateVgInfoFromRsp(SDBVgInfo **pInfo, SUseDbRsp *rsp) {
|
|||
SVgroupInfo *pInfo = taosArrayGet(rsp->pVgroupInfos, j);
|
||||
if (taosHashPut(vgInfo->vgHash, &pInfo->vgId, sizeof(int32_t), pInfo, sizeof(SVgroupInfo)) != 0) {
|
||||
tscError("hash push failed, errno:%d", errno);
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _return;
|
||||
}
|
||||
}
|
||||
|
@ -689,7 +689,7 @@ int32_t hbBuildQueryDesc(SQueryHbReqBasic *hbBasic, STscObj *pObj) {
|
|||
(void)releaseRequest(*rid);
|
||||
if (NULL == taosArrayPush(hbBasic->queryDesc, &desc)) {
|
||||
taosArrayDestroy(desc.subDesc);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
pIter = taosHashIterate(pObj->pRequests, pIter);
|
||||
|
@ -777,7 +777,7 @@ static int32_t hbGetUserAuthInfo(SClientHbKey *connKey, SHbParam *param, SClient
|
|||
pKv->value = qUserAuth;
|
||||
pKv->valueLen += sizeof(SUserAuthVersion);
|
||||
} else {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
}
|
||||
goto _return;
|
||||
}
|
||||
|
@ -785,7 +785,7 @@ static int32_t hbGetUserAuthInfo(SClientHbKey *connKey, SHbParam *param, SClient
|
|||
// key/user not exist, add user
|
||||
SUserAuthVersion *user = taosMemoryMalloc(sizeof(SUserAuthVersion));
|
||||
if (!user) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _return;
|
||||
}
|
||||
tstrncpy(user->user, pTscObj->user, TSDB_USER_LEN);
|
||||
|
@ -1436,7 +1436,7 @@ int32_t appHbMgrInit(SAppInstInfo *pAppInstInfo, char *key, SAppHbMgr **pAppHbMg
|
|||
TSC_ERR_RET(hbMgrInit());
|
||||
*pAppHbMgr = taosMemoryMalloc(sizeof(SAppHbMgr));
|
||||
if (*pAppHbMgr == NULL) {
|
||||
TSC_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TSC_ERR_JRET(terrno);
|
||||
}
|
||||
// init stat
|
||||
(*pAppHbMgr)->startTime = taosGetTimestampMs();
|
||||
|
@ -1456,14 +1456,14 @@ int32_t appHbMgrInit(SAppInstInfo *pAppInstInfo, char *key, SAppHbMgr **pAppHbMg
|
|||
(*pAppHbMgr)->activeInfo = taosHashInit(64, hbKeyHashFunc, 1, HASH_ENTRY_LOCK);
|
||||
|
||||
if ((*pAppHbMgr)->activeInfo == NULL) {
|
||||
TSC_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TSC_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
// taosHashSetFreeFp(pAppHbMgr->activeInfo, tFreeClientHbReq);
|
||||
|
||||
TSC_ERR_JRET(taosThreadMutexLock(&clientHbMgr.lock));
|
||||
if (taosArrayPush(clientHbMgr.appHbMgrs, &(*pAppHbMgr)) == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
(void)taosThreadMutexUnlock(&clientHbMgr.lock);
|
||||
goto _return;
|
||||
}
|
||||
|
|
|
@ -228,7 +228,7 @@ int32_t buildRequest(uint64_t connId, const char* sql, int sqlLen, void* param,
|
|||
tscError("0x%" PRIx64 " failed to prepare sql string buffer, %s", (*pRequest)->self, sql);
|
||||
destroyRequest(*pRequest);
|
||||
*pRequest = NULL;
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
(void)strntolower((*pRequest)->sqlstr, sql, (int32_t)sqlLen);
|
||||
|
@ -247,7 +247,7 @@ int32_t buildRequest(uint64_t connId, const char* sql, int sqlLen, void* param,
|
|||
(*pRequest)->self, (*pRequest)->requestId, pTscObj->id, sql);
|
||||
destroyRequest(*pRequest);
|
||||
*pRequest = NULL;
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
(*pRequest)->allocatorRefId = -1;
|
||||
|
@ -258,7 +258,7 @@ int32_t buildRequest(uint64_t connId, const char* sql, int sqlLen, void* param,
|
|||
(*pRequest)->requestId, pTscObj->id, sql);
|
||||
destroyRequest(*pRequest);
|
||||
*pRequest = NULL;
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -595,7 +595,7 @@ int32_t buildVnodePolicyNodeList(SRequestObj* pRequest, SArray** pNodeList, SArr
|
|||
|
||||
if (NULL == taosArrayPush(nodeList, &load)) {
|
||||
taosArrayDestroy(nodeList);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -619,7 +619,7 @@ int32_t buildVnodePolicyNodeList(SRequestObj* pRequest, SArray** pNodeList, SArr
|
|||
}
|
||||
if (NULL == taosArrayAddBatch(nodeList, pData, mnodeNum)) {
|
||||
taosArrayDestroy(nodeList);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
tscDebug("0x%" PRIx64 " %s policy, use mnode list, num:%d", pRequest->requestId, policy, mnodeNum);
|
||||
|
@ -646,7 +646,7 @@ int32_t buildQnodePolicyNodeList(SRequestObj* pRequest, SArray** pNodeList, SArr
|
|||
}
|
||||
if (NULL == taosArrayAddBatch(nodeList, pData, qNodeNum)) {
|
||||
taosArrayDestroy(nodeList);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
tscDebug("0x%" PRIx64 " qnode policy, use qnode list, num:%d", pRequest->requestId, qNodeNum);
|
||||
goto _return;
|
||||
|
@ -665,7 +665,7 @@ int32_t buildQnodePolicyNodeList(SRequestObj* pRequest, SArray** pNodeList, SArr
|
|||
}
|
||||
if (NULL == taosArrayAddBatch(nodeList, pData, mnodeNum)) {
|
||||
taosArrayDestroy(nodeList);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
tscDebug("0x%" PRIx64 " qnode policy, use mnode list, num:%d", pRequest->requestId, mnodeNum);
|
||||
|
@ -699,7 +699,7 @@ int32_t buildAsyncExecNodeList(SRequestObj* pRequest, SArray** pNodeList, SArray
|
|||
}
|
||||
|
||||
if (NULL == taosArrayPush(pDbVgList, &pRes->pRes)) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _return;
|
||||
}
|
||||
}
|
||||
|
@ -791,7 +791,7 @@ int32_t buildSyncExecNodeList(SRequestObj* pRequest, SArray** pNodeList, SArray*
|
|||
}
|
||||
|
||||
if (NULL == taosArrayPush(pDbVgList, &pVgList)) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _return;
|
||||
}
|
||||
}
|
||||
|
@ -903,8 +903,7 @@ int32_t handleQueryExecRes(SRequestObj* pRequest, void* res, SCatalog* pCatalog,
|
|||
|
||||
pArray = taosArrayInit(tbNum, sizeof(STbSVersion));
|
||||
if (NULL == pArray) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < tbNum; ++i) {
|
||||
|
@ -915,7 +914,7 @@ int32_t handleQueryExecRes(SRequestObj* pRequest, void* res, SCatalog* pCatalog,
|
|||
}
|
||||
STbSVersion tbSver = {.tbFName = tbInfo->tbFName, .sver = tbInfo->sversion, .tver = tbInfo->tversion};
|
||||
if (NULL == taosArrayPush(pArray, &tbSver)) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _return;
|
||||
}
|
||||
}
|
||||
|
@ -1662,7 +1661,7 @@ static int32_t buildConnectMsg(SRequestObj* pRequest, SMsgSendInfo** pMsgSendInf
|
|||
void* pReq = taosMemoryMalloc(contLen);
|
||||
if (NULL == pReq) {
|
||||
taosMemoryFree(*pMsgSendInfo);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
if (-1 == tSerializeSConnectReq(pReq, contLen, &connectReq)) {
|
||||
|
@ -2050,7 +2049,7 @@ static int32_t doConvertUCS4(SReqResultInfo* pResultInfo, int32_t numOfRows, int
|
|||
char* p = taosMemoryRealloc(pResultInfo->convertBuf[i], colLength[i]);
|
||||
if (p == NULL) {
|
||||
taosReleaseConv(idx, conv, C2M);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
pResultInfo->convertBuf[i] = p;
|
||||
|
@ -2441,7 +2440,6 @@ int32_t setQueryResultFromRsp(SReqResultInfo* pResultInfo, const SRetrieveTableR
|
|||
if (pResultInfo->decompBuf == NULL) {
|
||||
pResultInfo->decompBuf = taosMemoryMalloc(payloadLen);
|
||||
if (pResultInfo->decompBuf == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
tscError("failed to prepare the decompress buffer, size:%d", payloadLen);
|
||||
return terrno;
|
||||
}
|
||||
|
@ -2450,7 +2448,6 @@ int32_t setQueryResultFromRsp(SReqResultInfo* pResultInfo, const SRetrieveTableR
|
|||
if (pResultInfo->decompBufSize < payloadLen) {
|
||||
char* p = taosMemoryRealloc(pResultInfo->decompBuf, payloadLen);
|
||||
if (p == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
tscError("failed to prepare the decompress buffer, size:%d", payloadLen);
|
||||
return terrno;
|
||||
}
|
||||
|
@ -2871,7 +2868,6 @@ TAOS_RES* taosQueryImpl(TAOS* taos, const char* sql, bool validateOnly, int8_t s
|
|||
}
|
||||
int32_t code = tsem_init(¶m->sem, 0, 0);
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
terrno = code;
|
||||
taosMemoryFree(param);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -2879,7 +2875,6 @@ TAOS_RES* taosQueryImpl(TAOS* taos, const char* sql, bool validateOnly, int8_t s
|
|||
taosAsyncQueryImpl(*(int64_t*)taos, sql, syncQueryFn, param, validateOnly, source);
|
||||
code = tsem_wait(¶m->sem);
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
terrno = code;
|
||||
taosMemoryFree(param);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -2910,7 +2905,6 @@ TAOS_RES* taosQueryImplWithReqid(TAOS* taos, const char* sql, bool validateOnly,
|
|||
}
|
||||
int32_t code = tsem_init(¶m->sem, 0, 0);
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
terrno = code;
|
||||
taosMemoryFree(param);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -2918,7 +2912,6 @@ TAOS_RES* taosQueryImplWithReqid(TAOS* taos, const char* sql, bool validateOnly,
|
|||
taosAsyncQueryImplWithReqid(*(int64_t*)taos, sql, syncQueryFn, param, validateOnly, reqid);
|
||||
code = tsem_wait(¶m->sem);
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
terrno = code;
|
||||
taosMemoryFree(param);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -216,7 +216,7 @@ int32_t fetchWhiteListCallbackFn(void *param, SDataBuf *pMsg, int32_t code) {
|
|||
taosMemoryFree(pMsg->pEpSet);
|
||||
taosMemoryFree(pInfo);
|
||||
tFreeSGetUserWhiteListRsp(&wlRsp);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
for (int i = 0; i < wlRsp.numWhiteLists; ++i) {
|
||||
|
@ -1317,8 +1317,8 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) {
|
|||
tscDebug("0x%" PRIx64 " client retry to handle the error, code:%d - %s, tryCount:%d,QID:0x%" PRIx64,
|
||||
pRequest->self, code, tstrerror(code), pRequest->retry, pRequest->requestId);
|
||||
if (TSDB_CODE_SUCCESS != refreshMeta(pRequest->pTscObj, pRequest)) {
|
||||
tscWarn("0x%" PRIx64 " refresh meta failed, code:%d - %s,QID:0x%" PRIx64, pRequest->self, code,
|
||||
tstrerror(code), pRequest->requestId);
|
||||
tscWarn("0x%" PRIx64 " refresh meta failed, code:%d - %s,QID:0x%" PRIx64, pRequest->self, code, tstrerror(code),
|
||||
pRequest->requestId);
|
||||
}
|
||||
pRequest->prevCode = code;
|
||||
doAsyncQuery(pRequest, true);
|
||||
|
@ -1369,7 +1369,7 @@ typedef struct SAsyncFetchParam {
|
|||
void *param;
|
||||
} SAsyncFetchParam;
|
||||
|
||||
static int32_t doAsyncFetch(void* pParam) {
|
||||
static int32_t doAsyncFetch(void *pParam) {
|
||||
SAsyncFetchParam *param = pParam;
|
||||
taosAsyncFetchImpl(param->pReq, param->fp, param->param);
|
||||
taosMemoryFree(param);
|
||||
|
@ -1393,7 +1393,7 @@ void taos_fetch_rows_a(TAOS_RES *res, __taos_async_fn_t fp, void *param) {
|
|||
return;
|
||||
}
|
||||
|
||||
SAsyncFetchParam* pParam = taosMemoryCalloc(1, sizeof(SAsyncFetchParam));
|
||||
SAsyncFetchParam *pParam = taosMemoryCalloc(1, sizeof(SAsyncFetchParam));
|
||||
if (!pParam) {
|
||||
fp(param, res, terrno);
|
||||
return;
|
||||
|
@ -1526,7 +1526,7 @@ int taos_get_table_vgId(TAOS *taos, const char *db, const char *table, int *vgId
|
|||
conn.mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp);
|
||||
|
||||
SName tableName;
|
||||
(void)toName(pTscObj->acctId, db, table, &tableName);
|
||||
toName(pTscObj->acctId, db, table, &tableName);
|
||||
|
||||
SVgroupInfo vgInfo;
|
||||
code = catalogGetTableHashVgroup(pCtg, &conn, &tableName, &vgInfo);
|
||||
|
@ -1983,6 +1983,12 @@ int taos_stmt2_bind_param(TAOS_STMT2 *stmt, TAOS_STMT2_BINDV *bindv, int32_t col
|
|||
return terrno;
|
||||
}
|
||||
|
||||
STscStmt2 *pStmt = (STscStmt2 *)stmt;
|
||||
if (pStmt->options.asyncExecFn && !pStmt->semWaited) {
|
||||
(void)tsem_wait(&pStmt->asyncQuerySem);
|
||||
pStmt->semWaited = true;
|
||||
}
|
||||
|
||||
int32_t code = 0;
|
||||
for (int i = 0; i < bindv->count; ++i) {
|
||||
if (bindv->tbnames && bindv->tbnames[i]) {
|
||||
|
|
|
@ -34,19 +34,19 @@ static void processFileInTheEnd(TdFilePtr pFile, char* path) {
|
|||
return;
|
||||
}
|
||||
if (taosFtruncateFile(pFile, 0) != 0) {
|
||||
tscError("failed to truncate file:%s, errno:%d", path, terrno);
|
||||
tscError("failed to truncate file:%s, terrno:%d", path, terrno);
|
||||
return;
|
||||
}
|
||||
if (taosUnLockFile(pFile) != 0) {
|
||||
tscError("failed to unlock file:%s, errno:%d", path, terrno);
|
||||
tscError("failed to unlock file:%s, terrno:%d", path, terrno);
|
||||
return;
|
||||
}
|
||||
if (taosCloseFile(&(pFile)) != 0) {
|
||||
tscError("failed to close file:%s, errno:%d", path, errno);
|
||||
tscError("failed to close file:%s, terrno:%d", path, terrno);
|
||||
return;
|
||||
}
|
||||
if (taosRemoveFile(path) != 0) {
|
||||
tscError("failed to remove file:%s, errno:%d", path, errno);
|
||||
tscError("failed to remove file:%s, terrno:%d", path, terrno);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -730,7 +730,7 @@ static void* monitorThreadFunc(void* param) {
|
|||
}
|
||||
|
||||
MonitorSlowLogData* slowLogData = NULL;
|
||||
(void)taosReadQitem(monitorQueue, (void**)&slowLogData);
|
||||
taosReadQitem(monitorQueue, (void**)&slowLogData);
|
||||
if (slowLogData != NULL) {
|
||||
if (slowLogData->type == SLOW_LOG_READ_BEGINNIG && quitCnt == 0) {
|
||||
if (slowLogData->pFile != NULL) {
|
||||
|
|
|
@ -511,19 +511,19 @@ static int32_t buildShowVariablesBlock(SArray* pVars, SSDataBlock** block) {
|
|||
pBlock->info.hasVarCol = true;
|
||||
|
||||
pBlock->pDataBlock = taosArrayInit(SHOW_VARIABLES_RESULT_COLS, sizeof(SColumnInfoData));
|
||||
TSDB_CHECK_NULL(pBlock->pDataBlock, code, line, END, TSDB_CODE_OUT_OF_MEMORY);
|
||||
TSDB_CHECK_NULL(pBlock->pDataBlock, code, line, END, terrno);
|
||||
SColumnInfoData infoData = {0};
|
||||
infoData.info.type = TSDB_DATA_TYPE_VARCHAR;
|
||||
infoData.info.bytes = SHOW_VARIABLES_RESULT_FIELD1_LEN;
|
||||
TSDB_CHECK_NULL(taosArrayPush(pBlock->pDataBlock, &infoData), code, line, END, TSDB_CODE_OUT_OF_MEMORY);
|
||||
TSDB_CHECK_NULL(taosArrayPush(pBlock->pDataBlock, &infoData), code, line, END, terrno);
|
||||
|
||||
infoData.info.type = TSDB_DATA_TYPE_VARCHAR;
|
||||
infoData.info.bytes = SHOW_VARIABLES_RESULT_FIELD2_LEN;
|
||||
TSDB_CHECK_NULL(taosArrayPush(pBlock->pDataBlock, &infoData), code, line, END, TSDB_CODE_OUT_OF_MEMORY);
|
||||
TSDB_CHECK_NULL(taosArrayPush(pBlock->pDataBlock, &infoData), code, line, END, terrno);
|
||||
|
||||
infoData.info.type = TSDB_DATA_TYPE_VARCHAR;
|
||||
infoData.info.bytes = SHOW_VARIABLES_RESULT_FIELD3_LEN;
|
||||
TSDB_CHECK_NULL(taosArrayPush(pBlock->pDataBlock, &infoData), code, line, END, TSDB_CODE_OUT_OF_MEMORY);
|
||||
TSDB_CHECK_NULL(taosArrayPush(pBlock->pDataBlock, &infoData), code, line, END, terrno);
|
||||
|
||||
int32_t numOfCfg = taosArrayGetSize(pVars);
|
||||
code = blockDataEnsureCapacity(pBlock, numOfCfg);
|
||||
|
@ -531,26 +531,26 @@ static int32_t buildShowVariablesBlock(SArray* pVars, SSDataBlock** block) {
|
|||
|
||||
for (int32_t i = 0, c = 0; i < numOfCfg; ++i, c = 0) {
|
||||
SVariablesInfo* pInfo = taosArrayGet(pVars, i);
|
||||
TSDB_CHECK_NULL(pInfo, code, line, END, TSDB_CODE_OUT_OF_MEMORY);
|
||||
TSDB_CHECK_NULL(pInfo, code, line, END, terrno);
|
||||
|
||||
char name[TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(name, pInfo->name, TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE);
|
||||
SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, c++);
|
||||
TSDB_CHECK_NULL(pColInfo, code, line, END, TSDB_CODE_OUT_OF_MEMORY);
|
||||
TSDB_CHECK_NULL(pColInfo, code, line, END, terrno);
|
||||
code = colDataSetVal(pColInfo, i, name, false);
|
||||
TSDB_CHECK_CODE(code, line, END);
|
||||
|
||||
char value[TSDB_CONFIG_VALUE_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(value, pInfo->value, TSDB_CONFIG_VALUE_LEN + VARSTR_HEADER_SIZE);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, c++);
|
||||
TSDB_CHECK_NULL(pColInfo, code, line, END, TSDB_CODE_OUT_OF_MEMORY);
|
||||
TSDB_CHECK_NULL(pColInfo, code, line, END, terrno);
|
||||
code = colDataSetVal(pColInfo, i, value, false);
|
||||
TSDB_CHECK_CODE(code, line, END);
|
||||
|
||||
char scope[TSDB_CONFIG_SCOPE_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(scope, pInfo->scope, TSDB_CONFIG_SCOPE_LEN + VARSTR_HEADER_SIZE);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, c++);
|
||||
TSDB_CHECK_NULL(pColInfo, code, line, END, TSDB_CODE_OUT_OF_MEMORY);
|
||||
TSDB_CHECK_NULL(pColInfo, code, line, END, terrno);
|
||||
code = colDataSetVal(pColInfo, i, scope, false);
|
||||
TSDB_CHECK_CODE(code, line, END);
|
||||
}
|
||||
|
@ -662,29 +662,29 @@ static int32_t buildCompactDbBlock(SCompactDbRsp* pRsp, SSDataBlock** block) {
|
|||
pBlock->info.hasVarCol = true;
|
||||
|
||||
pBlock->pDataBlock = taosArrayInit(COMPACT_DB_RESULT_COLS, sizeof(SColumnInfoData));
|
||||
TSDB_CHECK_NULL(pBlock->pDataBlock, code, line, END, TSDB_CODE_OUT_OF_MEMORY);
|
||||
TSDB_CHECK_NULL(pBlock->pDataBlock, code, line, END, terrno);
|
||||
SColumnInfoData infoData = {0};
|
||||
infoData.info.type = TSDB_DATA_TYPE_VARCHAR;
|
||||
infoData.info.bytes = COMPACT_DB_RESULT_FIELD1_LEN;
|
||||
TSDB_CHECK_NULL(taosArrayPush(pBlock->pDataBlock, &infoData), code, line, END, TSDB_CODE_OUT_OF_MEMORY);
|
||||
TSDB_CHECK_NULL(taosArrayPush(pBlock->pDataBlock, &infoData), code, line, END, terrno);
|
||||
|
||||
infoData.info.type = TSDB_DATA_TYPE_INT;
|
||||
infoData.info.bytes = tDataTypes[TSDB_DATA_TYPE_INT].bytes;
|
||||
TSDB_CHECK_NULL(taosArrayPush(pBlock->pDataBlock, &infoData), code, line, END, TSDB_CODE_OUT_OF_MEMORY);
|
||||
TSDB_CHECK_NULL(taosArrayPush(pBlock->pDataBlock, &infoData), code, line, END, terrno);
|
||||
|
||||
infoData.info.type = TSDB_DATA_TYPE_VARCHAR;
|
||||
infoData.info.bytes = COMPACT_DB_RESULT_FIELD3_LEN;
|
||||
TSDB_CHECK_NULL(taosArrayPush(pBlock->pDataBlock, &infoData), code, line, END, TSDB_CODE_OUT_OF_MEMORY);
|
||||
TSDB_CHECK_NULL(taosArrayPush(pBlock->pDataBlock, &infoData), code, line, END, terrno);
|
||||
|
||||
code = blockDataEnsureCapacity(pBlock, 1);
|
||||
TSDB_CHECK_CODE(code, line, END);
|
||||
|
||||
SColumnInfoData* pResultCol = taosArrayGet(pBlock->pDataBlock, 0);
|
||||
TSDB_CHECK_NULL(pResultCol, code, line, END, TSDB_CODE_OUT_OF_MEMORY);
|
||||
TSDB_CHECK_NULL(pResultCol, code, line, END, terrno);
|
||||
SColumnInfoData* pIdCol = taosArrayGet(pBlock->pDataBlock, 1);
|
||||
TSDB_CHECK_NULL(pIdCol, code, line, END, TSDB_CODE_OUT_OF_MEMORY);
|
||||
TSDB_CHECK_NULL(pIdCol, code, line, END, terrno);
|
||||
SColumnInfoData* pReasonCol = taosArrayGet(pBlock->pDataBlock, 2);
|
||||
TSDB_CHECK_NULL(pReasonCol, code, line, END, TSDB_CODE_OUT_OF_MEMORY);
|
||||
TSDB_CHECK_NULL(pReasonCol, code, line, END, terrno);
|
||||
|
||||
char result[COMPACT_DB_RESULT_FIELD1_LEN] = {0};
|
||||
char reason[COMPACT_DB_RESULT_FIELD3_LEN] = {0};
|
||||
|
|
|
@ -946,7 +946,8 @@ static int32_t taosCreateStb(TAOS* taos, void* meta, int32_t metaLen) {
|
|||
pReq.suid);
|
||||
STscObj* pTscObj = pRequest->pTscObj;
|
||||
SName tableName = {0};
|
||||
RAW_RETURN_CHECK(tNameExtractFullName(toName(pTscObj->acctId, pRequest->pDb, req.name, &tableName), pReq.name));
|
||||
toName(pTscObj->acctId, pRequest->pDb, req.name, &tableName);
|
||||
RAW_RETURN_CHECK(tNameExtractFullName(&tableName, pReq.name));
|
||||
SCmdMsgInfo pCmdMsg = {0};
|
||||
pCmdMsg.epSet = getEpSet_s(&pTscObj->pAppInfo->mgmtEp);
|
||||
pCmdMsg.msgType = TDMT_MND_CREATE_STB;
|
||||
|
@ -1021,7 +1022,7 @@ static int32_t taosDropStb(TAOS* taos, void* meta, int32_t metaLen) {
|
|||
.requestObjRefId = pRequest->self,
|
||||
.mgmtEps = getEpSet_s(&pRequest->pTscObj->pAppInfo->mgmtEp)};
|
||||
SName pName = {0};
|
||||
(void)toName(pRequest->pTscObj->acctId, pRequest->pDb, req.name,
|
||||
toName(pRequest->pTscObj->acctId, pRequest->pDb, req.name,
|
||||
&pName); // ignore the return value, always return pName
|
||||
STableMeta* pTableMeta = NULL;
|
||||
code = catalogGetTableMeta(pCatalog, &conn, &pName, &pTableMeta);
|
||||
|
@ -1045,7 +1046,8 @@ static int32_t taosDropStb(TAOS* taos, void* meta, int32_t metaLen) {
|
|||
pReq.suid);
|
||||
STscObj* pTscObj = pRequest->pTscObj;
|
||||
SName tableName = {0};
|
||||
if (tNameExtractFullName(toName(pTscObj->acctId, pRequest->pDb, req.name, &tableName), pReq.name) != 0) {
|
||||
toName(pTscObj->acctId, pRequest->pDb, req.name, &tableName);
|
||||
if (tNameExtractFullName(&tableName, pReq.name) != 0) {
|
||||
code = TSDB_CODE_INVALID_PARA;
|
||||
goto end;
|
||||
}
|
||||
|
@ -1150,7 +1152,7 @@ static int32_t taosCreateTable(TAOS* taos, void* meta, int32_t metaLen) {
|
|||
|
||||
SVgroupInfo pInfo = {0};
|
||||
SName pName = {0};
|
||||
(void)toName(pTscObj->acctId, pRequest->pDb, pCreateReq->name, &pName);
|
||||
toName(pTscObj->acctId, pRequest->pDb, pCreateReq->name, &pName);
|
||||
code = catalogGetTableHashVgroup(pCatalog, &conn, &pName, &pInfo);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
goto end;
|
||||
|
@ -1163,7 +1165,7 @@ static int32_t taosCreateTable(TAOS* taos, void* meta, int32_t metaLen) {
|
|||
SName sName = {0};
|
||||
tb_uid_t oldSuid = pCreateReq->ctb.suid;
|
||||
// pCreateReq->ctb.suid = processSuid(pCreateReq->ctb.suid, pRequest->pDb);
|
||||
(void)toName(pTscObj->acctId, pRequest->pDb, pCreateReq->ctb.stbName, &sName);
|
||||
toName(pTscObj->acctId, pRequest->pDb, pCreateReq->ctb.stbName, &sName);
|
||||
code = catalogGetTableMeta(pCatalog, &conn, &sName, &pTableMeta);
|
||||
if (code == TSDB_CODE_PAR_TABLE_NOT_EXIST) {
|
||||
code = TSDB_CODE_SUCCESS;
|
||||
|
@ -1307,7 +1309,7 @@ static int32_t taosDropTable(TAOS* taos, void* meta, int32_t metaLen) {
|
|||
|
||||
SVgroupInfo pInfo = {0};
|
||||
SName pName = {0};
|
||||
(void)toName(pTscObj->acctId, pRequest->pDb, pDropReq->name, &pName);
|
||||
toName(pTscObj->acctId, pRequest->pDb, pDropReq->name, &pName);
|
||||
RAW_RETURN_CHECK(catalogGetTableHashVgroup(pCatalog, &conn, &pName, &pInfo));
|
||||
|
||||
STableMeta* pTableMeta = NULL;
|
||||
|
@ -1451,7 +1453,7 @@ static int32_t taosAlterTable(TAOS* taos, void* meta, int32_t metaLen) {
|
|||
|
||||
SVgroupInfo pInfo = {0};
|
||||
SName pName = {0};
|
||||
(void)toName(pTscObj->acctId, pRequest->pDb, req.tbName, &pName);
|
||||
toName(pTscObj->acctId, pRequest->pDb, req.tbName, &pName);
|
||||
RAW_RETURN_CHECK(catalogGetTableHashVgroup(pCatalog, &conn, &pName, &pInfo));
|
||||
pArray = taosArrayInit(1, sizeof(void*));
|
||||
RAW_NULL_CHECK(pArray);
|
||||
|
|
|
@ -116,7 +116,7 @@ static int32_t smlCheckAuth(SSmlHandle *info, SRequestConnInfo *conn, const char
|
|||
return TSDB_CODE_SML_INVALID_DATA;
|
||||
}
|
||||
} else {
|
||||
(void)toName(info->taos->acctId, info->pRequest->pDb, pTabName, &pAuth.tbName); //ignore
|
||||
toName(info->taos->acctId, info->pRequest->pDb, pTabName, &pAuth.tbName); //ignore
|
||||
}
|
||||
pAuth.type = type;
|
||||
|
||||
|
@ -178,7 +178,7 @@ int32_t smlBuildTableInfo(int numRows, const char *measure, int32_t measureLen,
|
|||
if (tag->cols == NULL) {
|
||||
uError("SML:smlBuildTableInfo failed to allocate memory");
|
||||
taosMemoryFree(tag);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
*tInfo = tag;
|
||||
|
@ -210,7 +210,7 @@ int32_t smlBuildSuperTableInfo(SSmlHandle *info, SSmlLineInfo *currElement, SSml
|
|||
if (currElement->measureEscaped) {
|
||||
measure = (char *)taosMemoryMalloc(measureLen);
|
||||
if (measure == NULL){
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
(void)memcpy(measure, currElement->measure, measureLen);
|
||||
PROCESS_SLASH_IN_MEASUREMENT(measure, measureLen);
|
||||
|
@ -251,11 +251,11 @@ int32_t smlBuildSuperTableInfo(SSmlHandle *info, SSmlLineInfo *currElement, SSml
|
|||
|
||||
if (i < pTableMeta->tableInfo.numOfColumns) {
|
||||
if(taosArrayPush((*sMeta)->cols, &kv) == NULL){
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
} else {
|
||||
if(taosArrayPush((*sMeta)->tags, &kv) == NULL){
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -328,7 +328,7 @@ END:
|
|||
int32_t smlJoinMeasureTag(SSmlLineInfo *elements) {
|
||||
elements->measureTag = (char *)taosMemoryMalloc(elements->measureLen + elements->tagsLen);
|
||||
if (elements->measureTag == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
(void)memcpy(elements->measureTag, elements->measure, elements->measureLen);
|
||||
(void)memcpy(elements->measureTag + elements->measureLen, elements->tags, elements->tagsLen);
|
||||
|
@ -455,14 +455,14 @@ int32_t smlParseEndTelnetJson(SSmlHandle *info, SSmlLineInfo *elements, SSmlKv *
|
|||
if (elements->colArray == NULL) {
|
||||
elements->colArray = taosArrayInit(16, sizeof(SSmlKv));
|
||||
if (elements->colArray == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
if (taosArrayPush(elements->colArray, kvTs) == NULL){
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
if (taosArrayPush(elements->colArray, kv) == NULL){
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
info->preLine = *elements;
|
||||
|
@ -937,7 +937,7 @@ static int32_t smlCheckMeta(SSchema *schema, int32_t length, SArray *cols, bool
|
|||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
SHashObj *hashTmp = taosHashInit(length, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK);
|
||||
if (hashTmp == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto END;
|
||||
}
|
||||
int32_t i = 0;
|
||||
|
@ -997,7 +997,7 @@ static int32_t smlBuildFieldsList(SSmlHandle *info, SSchema *schemaField, SHashO
|
|||
field.bytes = getBytes(kv->type, kv->length);
|
||||
(void)memcpy(field.name, kv->key, kv->keyLen);
|
||||
if (taosArrayPush(results, &field) == NULL){
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
} else if (action == SCHEMA_ACTION_CHANGE_COLUMN_SIZE || action == SCHEMA_ACTION_CHANGE_TAG_SIZE) {
|
||||
uint16_t *index = (uint16_t *)taosHashGet(schemaHash, kv->key, kv->keyLen);
|
||||
|
@ -1046,7 +1046,7 @@ static int32_t smlSendMetaMsg(SSmlHandle *info, SName *pName, SArray *pColumns,
|
|||
|
||||
pReq.pColumns = taosArrayInit(pReq.numOfColumns, sizeof(SFieldWithOptions));
|
||||
if (pReq.pColumns == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto end;
|
||||
}
|
||||
for (int32_t i = 0; i < pReq.numOfColumns; ++i) {
|
||||
|
@ -1059,7 +1059,7 @@ static int32_t smlSendMetaMsg(SSmlHandle *info, SName *pName, SArray *pColumns,
|
|||
setFieldWithOptions(&fieldWithOption, pField);
|
||||
setDefaultOptionsForField(&fieldWithOption);
|
||||
if (taosArrayPush(pReq.pColumns, &fieldWithOption) == NULL){
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
@ -1106,14 +1106,17 @@ static int32_t smlSendMetaMsg(SSmlHandle *info, SName *pName, SArray *pColumns,
|
|||
field.bytes = TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE;
|
||||
tstrncpy(field.name, tsSmlTagName, sizeof(field.name));
|
||||
if (taosArrayPush(pReq.pTags, &field) == NULL){
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
pReq.commentLen = -1;
|
||||
pReq.igExists = true;
|
||||
(void)tNameExtractFullName(pName, pReq.name);
|
||||
code = tNameExtractFullName(pName, pReq.name);
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
goto end;
|
||||
}
|
||||
|
||||
pCmdMsg.epSet = getEpSet_s(&info->taos->pAppInfo->mgmtEp);
|
||||
pCmdMsg.msgType = TDMT_MND_CREATE_STB;
|
||||
|
@ -1124,7 +1127,7 @@ static int32_t smlSendMetaMsg(SSmlHandle *info, SName *pName, SArray *pColumns,
|
|||
}
|
||||
pCmdMsg.pMsg = taosMemoryMalloc(pCmdMsg.msgLen);
|
||||
if (NULL == pCmdMsg.pMsg) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
@ -1185,7 +1188,7 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) {
|
|||
void *superTable = taosHashGetKey(tmp, &superTableLen);
|
||||
char *measure = taosMemoryMalloc(superTableLen);
|
||||
if (measure == NULL){
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto end;
|
||||
}
|
||||
(void)memcpy(measure, superTable, superTableLen);
|
||||
|
@ -1205,12 +1208,12 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) {
|
|||
uDebug("SML:0x%" PRIx64 " smlModifyDBSchemas create table:%s", info->id, pName.tname);
|
||||
SArray *pColumns = taosArrayInit(taosArrayGetSize(sTableData->cols), sizeof(SField));
|
||||
if (pColumns == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto end;
|
||||
}
|
||||
SArray *pTags = taosArrayInit(taosArrayGetSize(sTableData->tags), sizeof(SField));
|
||||
if (pTags == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
taosArrayDestroy(pColumns);
|
||||
goto end;
|
||||
}
|
||||
|
@ -1252,7 +1255,7 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) {
|
|||
hashTmp = taosHashInit(pTableMeta->tableInfo.numOfTags, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true,
|
||||
HASH_NO_LOCK);
|
||||
if (hashTmp == NULL){
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto end;
|
||||
}
|
||||
for (uint16_t i = pTableMeta->tableInfo.numOfColumns;
|
||||
|
@ -1278,14 +1281,14 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) {
|
|||
SArray *pColumns =
|
||||
taosArrayInit(taosArrayGetSize(sTableData->cols) + pTableMeta->tableInfo.numOfColumns, sizeof(SField));
|
||||
if (pColumns == NULL){
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto end;
|
||||
}
|
||||
SArray *pTags =
|
||||
taosArrayInit(taosArrayGetSize(sTableData->tags) + pTableMeta->tableInfo.numOfTags, sizeof(SField));
|
||||
if (pTags == NULL){
|
||||
taosArrayDestroy(pColumns);
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto end;
|
||||
}
|
||||
for (uint16_t i = 0; i < pTableMeta->tableInfo.numOfColumns + pTableMeta->tableInfo.numOfTags; i++) {
|
||||
|
@ -1297,14 +1300,14 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) {
|
|||
if (taosArrayPush(pColumns, &field) == NULL){
|
||||
taosArrayDestroy(pColumns);
|
||||
taosArrayDestroy(pTags);
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto end;
|
||||
}
|
||||
} else {
|
||||
if (taosArrayPush(pTags, &field) == NULL){
|
||||
taosArrayDestroy(pColumns);
|
||||
taosArrayDestroy(pTags);
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
@ -1374,14 +1377,14 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) {
|
|||
SArray *pColumns =
|
||||
taosArrayInit(taosArrayGetSize(sTableData->cols) + pTableMeta->tableInfo.numOfColumns, sizeof(SField));
|
||||
if (pColumns == NULL){
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto end;
|
||||
}
|
||||
SArray *pTags =
|
||||
taosArrayInit(taosArrayGetSize(sTableData->tags) + pTableMeta->tableInfo.numOfTags, sizeof(SField));
|
||||
if (pTags == NULL){
|
||||
taosArrayDestroy(pColumns);
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto end;
|
||||
}
|
||||
for (uint16_t i = 0; i < pTableMeta->tableInfo.numOfColumns + pTableMeta->tableInfo.numOfTags; i++) {
|
||||
|
@ -1393,14 +1396,14 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) {
|
|||
if (taosArrayPush(pColumns, &field) == NULL){
|
||||
taosArrayDestroy(pColumns);
|
||||
taosArrayDestroy(pTags);
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto end;
|
||||
}
|
||||
} else {
|
||||
if (taosArrayPush(pTags, &field) == NULL){
|
||||
taosArrayDestroy(pColumns);
|
||||
taosArrayDestroy(pTags);
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
@ -1497,7 +1500,7 @@ static int32_t smlInsertMeta(SHashObj *metaHash, SArray *metaArray, SArray *cols
|
|||
int ret = taosHashPut(metaHash, kv->key, kv->keyLen, &i, SHORT_BYTES);
|
||||
if (ret == 0) {
|
||||
if (taosArrayPush(metaArray, kv) == NULL){
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
if(taosHashGet(checkDuplicate, kv->key, kv->keyLen) != NULL) {
|
||||
return TSDB_CODE_PAR_DUPLICATED_COLUMN;
|
||||
|
@ -1547,7 +1550,7 @@ static int32_t smlUpdateMeta(SHashObj *metaHash, SArray *metaArray, SArray *cols
|
|||
int ret = taosHashPut(metaHash, kv->key, kv->keyLen, &size, SHORT_BYTES);
|
||||
if (ret == 0) {
|
||||
if(taosArrayPush(metaArray, kv) == NULL){
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
if(taosHashGet(checkDuplicate, kv->key, kv->keyLen) != NULL) {
|
||||
return TSDB_CODE_PAR_DUPLICATED_COLUMN;
|
||||
|
@ -1646,7 +1649,7 @@ int32_t smlBuildSmlInfo(TAOS *taos, SSmlHandle **handle) {
|
|||
info->superTables = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK);
|
||||
if (info->pVgHash == NULL || info->childTables == NULL || info->superTables == NULL || info->tableUids == NULL) {
|
||||
uError("create SSmlHandle hash obj failed");
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto FAILED;
|
||||
}
|
||||
taosHashSetFreeFp(info->superTables, smlDestroySTableMeta);
|
||||
|
@ -1665,7 +1668,7 @@ int32_t smlBuildSmlInfo(TAOS *taos, SSmlHandle **handle) {
|
|||
|
||||
if (info->tagJsonArray == NULL || info->valueJsonArray == NULL || info->preLineTagKV == NULL) {
|
||||
uError("SML:0x%" PRIx64 " failed to allocate memory", info->id);
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto FAILED;
|
||||
}
|
||||
|
||||
|
@ -1681,7 +1684,7 @@ static int32_t smlPushCols(SArray *colsArray, SArray *cols) {
|
|||
SHashObj *kvHash = taosHashInit(32, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK);
|
||||
if (!kvHash) {
|
||||
uError("SML:smlDealCols failed to allocate memory");
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
for (size_t i = 0; i < taosArrayGetSize(cols); i++) {
|
||||
SSmlKv *kv = (SSmlKv *)taosArrayGet(cols, i);
|
||||
|
@ -1703,7 +1706,7 @@ static int32_t smlPushCols(SArray *colsArray, SArray *cols) {
|
|||
|
||||
if (taosArrayPush(colsArray, &kvHash) == NULL) {
|
||||
taosHashCleanup(kvHash);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
@ -1799,12 +1802,12 @@ static int32_t smlInsertData(SSmlHandle *info) {
|
|||
if (info->pRequest->dbList == NULL) {
|
||||
info->pRequest->dbList = taosArrayInit(1, TSDB_DB_FNAME_LEN);
|
||||
if (info->pRequest->dbList == NULL){
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
char *data = (char *)taosArrayReserve(info->pRequest->dbList, 1);
|
||||
if (data == NULL){
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
SName pName = {TSDB_TABLE_NAME_T, info->taos->acctId, {0}, {0}};
|
||||
tstrncpy(pName.dbname, info->pRequest->pDb, sizeof(pName.dbname));
|
||||
|
@ -1817,7 +1820,7 @@ static int32_t smlInsertData(SSmlHandle *info) {
|
|||
int measureLen = tableData->sTableNameLen;
|
||||
char *measure = (char *)taosMemoryMalloc(tableData->sTableNameLen);
|
||||
if (measure == NULL){
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
(void)memcpy(measure, tableData->sTableName, tableData->sTableNameLen);
|
||||
PROCESS_SLASH_IN_MEASUREMENT(measure, measureLen);
|
||||
|
@ -1828,11 +1831,11 @@ static int32_t smlInsertData(SSmlHandle *info) {
|
|||
if (info->pRequest->tableList == NULL) {
|
||||
info->pRequest->tableList = taosArrayInit(1, sizeof(SName));
|
||||
if (info->pRequest->tableList == NULL){
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
if (taosArrayPush(info->pRequest->tableList, &pName) == NULL){
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
tstrncpy(pName.tname, tableData->childTableName, sizeof(pName.tname));
|
||||
|
|
|
@ -526,7 +526,7 @@ static int32_t smlProcessTagJson(SSmlHandle *info, cJSON *tags){
|
|||
return ret;
|
||||
}
|
||||
if (taosArrayPush(preLineKV, &kv) == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
if (info->dataFormat && !isSmlTagAligned(info, cnt, &kv)) {
|
||||
|
@ -873,7 +873,7 @@ static int32_t smlParseJSONString(SSmlHandle *info, char **start, SSmlLineInfo *
|
|||
if (taosArrayPush(info->tagJsonArray, &valueJson) == NULL){
|
||||
cJSON_Delete(valueJson);
|
||||
elements->cols[elements->colsLen] = tmp;
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
ret = smlParseValueFromJSONObj(valueJson, &kv);
|
||||
if (ret != TSDB_CODE_SUCCESS) {
|
||||
|
@ -901,7 +901,7 @@ static int32_t smlParseJSONString(SSmlHandle *info, char **start, SSmlLineInfo *
|
|||
if (taosArrayPush(info->tagJsonArray, &tagsJson) == NULL){
|
||||
cJSON_Delete(tagsJson);
|
||||
uError("SML:0x%" PRIx64 " taosArrayPush failed", info->id);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
ret = smlParseTagsFromJSON(info, tagsJson, elements);
|
||||
if (unlikely(ret)) {
|
||||
|
@ -965,7 +965,7 @@ int32_t smlParseJSON(SSmlHandle *info, char *payload) {
|
|||
payloadNum = payloadNum << 1;
|
||||
void *tmp = taosMemoryRealloc(info->lines, payloadNum * sizeof(SSmlLineInfo));
|
||||
if (tmp == NULL) {
|
||||
ret = TSDB_CODE_OUT_OF_MEMORY;
|
||||
ret = terrno;
|
||||
return ret;
|
||||
}
|
||||
info->lines = (SSmlLineInfo *)tmp;
|
||||
|
|
|
@ -150,7 +150,7 @@ int32_t smlParseValue(SSmlKv *pVal, SSmlMsgBuf *msg) {
|
|||
}
|
||||
void *data = taosMemoryMalloc(pVal->length);
|
||||
if(data == NULL){
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
(void)memcpy(data, pVal->value + (NCHAR_ADD_LEN - 1), pVal->length);
|
||||
pVal->value = data;
|
||||
|
@ -271,7 +271,7 @@ static int32_t smlProcessTagLine(SSmlHandle *info, char **sql, char *sqlEnd){
|
|||
if (keyEscaped) {
|
||||
char *tmp = (char *)taosMemoryMalloc(keyLen);
|
||||
if (tmp == NULL){
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
(void)memcpy(tmp, key, keyLen);
|
||||
PROCESS_SLASH_IN_TAG_FIELD_KEY(tmp, keyLen);
|
||||
|
@ -280,7 +280,7 @@ static int32_t smlProcessTagLine(SSmlHandle *info, char **sql, char *sqlEnd){
|
|||
if (valueEscaped) {
|
||||
char *tmp = (char *)taosMemoryMalloc(valueLen);
|
||||
if (tmp == NULL){
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
(void)memcpy(tmp, value, valueLen);
|
||||
PROCESS_SLASH_IN_TAG_FIELD_KEY(tmp, valueLen);
|
||||
|
@ -294,7 +294,7 @@ static int32_t smlProcessTagLine(SSmlHandle *info, char **sql, char *sqlEnd){
|
|||
.keyEscaped = keyEscaped,
|
||||
.valueEscaped = valueEscaped};
|
||||
if(taosArrayPush(preLineKV, &kv) == NULL){
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
if (info->dataFormat && !isSmlTagAligned(info, cnt, &kv)) {
|
||||
|
@ -422,7 +422,7 @@ static int32_t smlParseColLine(SSmlHandle *info, char **sql, char *sqlEnd, SSmlL
|
|||
if (keyEscaped) {
|
||||
char *tmp = (char *)taosMemoryMalloc(kv.keyLen);
|
||||
if (tmp == NULL){
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
(void)memcpy(tmp, key, kv.keyLen);
|
||||
PROCESS_SLASH_IN_TAG_FIELD_KEY(tmp, kv.keyLen);
|
||||
|
@ -433,7 +433,7 @@ static int32_t smlParseColLine(SSmlHandle *info, char **sql, char *sqlEnd, SSmlL
|
|||
if (valueEscaped) {
|
||||
char *tmp = (char *)taosMemoryMalloc(kv.length);
|
||||
if (tmp == NULL){
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
(void)memcpy(tmp, kv.value, kv.length);
|
||||
PROCESS_SLASH_IN_FIELD_VALUE(tmp, kv.length);
|
||||
|
@ -459,11 +459,11 @@ static int32_t smlParseColLine(SSmlHandle *info, char **sql, char *sqlEnd, SSmlL
|
|||
if (currElement->colArray == NULL) {
|
||||
currElement->colArray = taosArrayInit_s(sizeof(SSmlKv), 1);
|
||||
if (currElement->colArray == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
if (taosArrayPush(currElement->colArray, &kv) == NULL){ // reserve for timestamp
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ static int32_t smlProcessTagTelnet(SSmlHandle *info, char *data, char *sqlEnd){
|
|||
.keyEscaped = false,
|
||||
.valueEscaped = false};
|
||||
if (taosArrayPush(preLineKV, &kv) == NULL){
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
if (info->dataFormat && !isSmlTagAligned(info, cnt, &kv)) {
|
||||
return TSDB_CODE_SML_INVALID_DATA;
|
||||
|
|
|
@ -15,7 +15,7 @@ static FORCE_INLINE int32_t stmtAllocQNodeFromBuf(STableBufInfo* pTblBuf, void**
|
|||
} else if (pTblBuf->buffIdx < taosArrayGetSize(pTblBuf->pBufList)) {
|
||||
pTblBuf->pCurBuff = taosArrayGetP(pTblBuf->pBufList, pTblBuf->buffIdx++);
|
||||
if (NULL == pTblBuf->pCurBuff) {
|
||||
return TAOS_GET_TERRNO(TSDB_CODE_OUT_OF_MEMORY);
|
||||
return TAOS_GET_TERRNO(terrno);
|
||||
}
|
||||
*pBuf = pTblBuf->pCurBuff;
|
||||
pTblBuf->buffOffset = pTblBuf->buffUnit;
|
||||
|
@ -186,7 +186,7 @@ int32_t stmtBackupQueryFields(STscStmt* pStmt) {
|
|||
pRes->fields = taosMemoryMalloc(size);
|
||||
pRes->userFields = taosMemoryMalloc(size);
|
||||
if (NULL == pRes->fields || NULL == pRes->userFields) {
|
||||
STMT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
STMT_ERR_RET(terrno);
|
||||
}
|
||||
(void)memcpy(pRes->fields, pStmt->exec.pRequest->body.resInfo.fields, size);
|
||||
(void)memcpy(pRes->userFields, pStmt->exec.pRequest->body.resInfo.userFields, size);
|
||||
|
@ -204,7 +204,7 @@ int32_t stmtRestoreQueryFields(STscStmt* pStmt) {
|
|||
if (NULL == pStmt->exec.pRequest->body.resInfo.fields) {
|
||||
pStmt->exec.pRequest->body.resInfo.fields = taosMemoryMalloc(size);
|
||||
if (NULL == pStmt->exec.pRequest->body.resInfo.fields) {
|
||||
STMT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
STMT_ERR_RET(terrno);
|
||||
}
|
||||
(void)memcpy(pStmt->exec.pRequest->body.resInfo.fields, pRes->fields, size);
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ int32_t stmtRestoreQueryFields(STscStmt* pStmt) {
|
|||
if (NULL == pStmt->exec.pRequest->body.resInfo.userFields) {
|
||||
pStmt->exec.pRequest->body.resInfo.userFields = taosMemoryMalloc(size);
|
||||
if (NULL == pStmt->exec.pRequest->body.resInfo.userFields) {
|
||||
STMT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
STMT_ERR_RET(terrno);
|
||||
}
|
||||
(void)memcpy(pStmt->exec.pRequest->body.resInfo.userFields, pRes->userFields, size);
|
||||
}
|
||||
|
@ -306,7 +306,7 @@ int32_t stmtCacheBlock(STscStmt* pStmt) {
|
|||
};
|
||||
|
||||
if (taosHashPut(pStmt->sql.pTableCache, &cacheUid, sizeof(cacheUid), &cache, sizeof(cache))) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
if (pStmt->sql.autoCreateTbl) {
|
||||
|
@ -369,7 +369,7 @@ int32_t stmtParseSql(STscStmt* pStmt) {
|
|||
if (NULL == pStmt->sql.pBindInfo) {
|
||||
pStmt->sql.pBindInfo = taosMemoryMalloc(pTableCtx->boundColsInfo.numOfBound * sizeof(*pStmt->sql.pBindInfo));
|
||||
if (NULL == pStmt->sql.pBindInfo) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -612,7 +612,7 @@ int32_t stmtGetFromCache(STscStmt* pStmt) {
|
|||
|
||||
if (taosHashPut(pStmt->exec.pBlockHash, pStmt->bInfo.tbFName, strlen(pStmt->bInfo.tbFName), &pNewBlock,
|
||||
POINTER_BYTES)) {
|
||||
STMT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
STMT_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
pStmt->exec.pCurrBlock = pNewBlock;
|
||||
|
@ -702,7 +702,7 @@ int32_t stmtGetFromCache(STscStmt* pStmt) {
|
|||
|
||||
if (taosHashPut(pStmt->exec.pBlockHash, pStmt->bInfo.tbFName, strlen(pStmt->bInfo.tbFName), &pNewBlock,
|
||||
POINTER_BYTES)) {
|
||||
STMT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
STMT_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
pStmt->exec.pCurrBlock = pNewBlock;
|
||||
|
@ -722,7 +722,6 @@ int32_t stmtResetStmt(STscStmt* pStmt) {
|
|||
|
||||
pStmt->sql.pTableCache = taosHashInit(100, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
|
||||
if (NULL == pStmt->sql.pTableCache) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
STMT_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
|
@ -739,7 +738,7 @@ int32_t stmtAsyncOutput(STscStmt* pStmt, void* param) {
|
|||
SArray** p = (SArray**)TARRAY_GET_ELEM(pStmt->sql.siInfo.pTableCols, i);
|
||||
*p = taosArrayInit(20, POINTER_BYTES);
|
||||
if (*p == NULL) {
|
||||
STMT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
STMT_ERR_RET(terrno);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -812,15 +811,15 @@ int32_t stmtInitTableBuf(STableBufInfo* pTblBuf) {
|
|||
pTblBuf->buffSize = pTblBuf->buffUnit * 1000;
|
||||
pTblBuf->pBufList = taosArrayInit(100, POINTER_BYTES);
|
||||
if (NULL == pTblBuf->pBufList) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
void* buff = taosMemoryMalloc(pTblBuf->buffSize);
|
||||
if (NULL == buff) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
if (taosArrayPush(pTblBuf->pBufList, &buff) == NULL){
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
pTblBuf->pCurBuff = buff;
|
||||
|
@ -948,11 +947,11 @@ int32_t stmtInitStbInterlaceTableInfo(STscStmt* pStmt) {
|
|||
for (int32_t i = 0; i < STMT_TABLE_COLS_NUM; i++) {
|
||||
pTblCols = taosArrayInit(20, POINTER_BYTES);
|
||||
if (NULL == pTblCols) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
if (taosArrayPush(pStmt->sql.siInfo.pTableCols, &pTblCols) == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1184,11 +1183,11 @@ static FORCE_INLINE int32_t stmtGetTableColsFromCache(STscStmt* pStmt, SArray**
|
|||
for (int32_t i = 0; i < 100; i++) {
|
||||
pTblCols = taosArrayInit(20, POINTER_BYTES);
|
||||
if (NULL == pTblCols) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
if (taosArrayPush(pStmt->sql.siInfo.pTableCols, &pTblCols) == NULL){
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -643,7 +643,6 @@ static int32_t stmtResetStmt(STscStmt2* pStmt) {
|
|||
|
||||
pStmt->sql.pTableCache = taosHashInit(100, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
|
||||
if (NULL == pStmt->sql.pTableCache) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
STMT_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
|
@ -660,7 +659,7 @@ static int32_t stmtAsyncOutput(STscStmt2* pStmt, void* param) {
|
|||
SArray** p = (SArray**)TARRAY_GET_ELEM(pStmt->sql.siInfo.pTableCols, i);
|
||||
*p = taosArrayInit(20, POINTER_BYTES);
|
||||
if (*p == NULL) {
|
||||
STMT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
STMT_ERR_RET(terrno);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -733,15 +732,15 @@ static int32_t stmtInitTableBuf(STableBufInfo* pTblBuf) {
|
|||
pTblBuf->buffSize = pTblBuf->buffUnit * 1000;
|
||||
pTblBuf->pBufList = taosArrayInit(100, POINTER_BYTES);
|
||||
if (NULL == pTblBuf->pBufList) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
void* buff = taosMemoryMalloc(pTblBuf->buffSize);
|
||||
if (NULL == buff) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
if (taosArrayPush(pTblBuf->pBufList, &buff) == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
pTblBuf->pCurBuff = buff;
|
||||
|
@ -796,7 +795,7 @@ TAOS_STMT2* stmtInit2(STscObj* taos, TAOS_STMT2_OPTION* pOptions) {
|
|||
}
|
||||
pStmt->sql.siInfo.pTableCols = taosArrayInit(STMT_TABLE_COLS_NUM, POINTER_BYTES);
|
||||
if (NULL == pStmt->sql.siInfo.pTableCols) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
terrno = terrno;
|
||||
(void)stmtClose(pStmt);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -819,6 +818,7 @@ TAOS_STMT2* stmtInit2(STscObj* taos, TAOS_STMT2_OPTION* pOptions) {
|
|||
if (pStmt->options.asyncExecFn) {
|
||||
(void)tsem_init(&pStmt->asyncQuerySem, 0, 1);
|
||||
}
|
||||
pStmt->semWaited = false;
|
||||
|
||||
STMT_LOG_SEQ(STMT_INIT);
|
||||
|
||||
|
@ -889,11 +889,11 @@ static int32_t stmtInitStbInterlaceTableInfo(STscStmt2* pStmt) {
|
|||
for (int32_t i = 0; i < STMT_TABLE_COLS_NUM; i++) {
|
||||
pTblCols = taosArrayInit(20, POINTER_BYTES);
|
||||
if (NULL == pTblCols) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
if (taosArrayPush(pStmt->sql.siInfo.pTableCols, &pTblCols) == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1121,11 +1121,11 @@ static FORCE_INLINE int32_t stmtGetTableColsFromCache(STscStmt2* pStmt, SArray**
|
|||
for (int32_t i = 0; i < 100; i++) {
|
||||
pTblCols = taosArrayInit(20, POINTER_BYTES);
|
||||
if (NULL == pTblCols) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
if (taosArrayPush(pStmt->sql.siInfo.pTableCols, &pTblCols) == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1160,7 +1160,7 @@ static int32_t stmtCacheBlock(STscStmt2* pStmt) {
|
|||
};
|
||||
|
||||
if (taosHashPut(pStmt->sql.pTableCache, &cacheUid, sizeof(cacheUid), &cache, sizeof(cache))) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
if (pStmt->sql.autoCreateTbl) {
|
||||
|
@ -1263,10 +1263,6 @@ int stmtBindBatch2(TAOS_STMT2* stmt, TAOS_STMT2_BIND* bind, int32_t colIdx) {
|
|||
|
||||
STMT_ERR_RET(stmtSwitchStatus(pStmt, STMT_BIND));
|
||||
|
||||
if (pStmt->options.asyncExecFn) {
|
||||
(void)tsem_wait(&pStmt->asyncQuerySem);
|
||||
}
|
||||
|
||||
if (pStmt->bInfo.needParse && pStmt->sql.runTimes && pStmt->sql.type > 0 &&
|
||||
STMT_TYPE_MULTI_INSERT != pStmt->sql.type) {
|
||||
pStmt->bInfo.needParse = false;
|
||||
|
@ -1554,7 +1550,7 @@ static int32_t createParseContext(const SRequestObj* pRequest, SParseContext** p
|
|||
|
||||
*pCxt = taosMemoryCalloc(1, sizeof(SParseContext));
|
||||
if (*pCxt == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
**pCxt = (SParseContext){.requestId = pRequest->requestId,
|
||||
|
@ -1667,11 +1663,10 @@ int stmtExec2(TAOS_STMT2* stmt, int* affected_rows) {
|
|||
STMT_ERR_RET(stmtCleanExecInfo(pStmt, (code ? false : true), false));
|
||||
|
||||
++pStmt->sql.runTimes;
|
||||
|
||||
} else {
|
||||
SSqlCallbackWrapper* pWrapper = taosMemoryCalloc(1, sizeof(SSqlCallbackWrapper));
|
||||
if (pWrapper == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
} else {
|
||||
pWrapper->pRequest = pRequest;
|
||||
pRequest->pWrapper = pWrapper;
|
||||
|
@ -1683,6 +1678,7 @@ int stmtExec2(TAOS_STMT2* stmt, int* affected_rows) {
|
|||
pRequest->body.queryFp = asyncQueryCb;
|
||||
((SSyncQueryParam*)(pRequest)->body.interParam)->userParam = pStmt;
|
||||
|
||||
pStmt->semWaited = false;
|
||||
launchAsyncQuery(pRequest, pStmt->sql.pQuery, NULL, pWrapper);
|
||||
}
|
||||
|
||||
|
@ -1704,6 +1700,10 @@ int stmtClose2(TAOS_STMT2* stmt) {
|
|||
pStmt->bindThreadInUse = false;
|
||||
}
|
||||
|
||||
if (pStmt->options.asyncExecFn && !pStmt->semWaited) {
|
||||
(void)tsem_wait(&pStmt->asyncQuerySem);
|
||||
}
|
||||
|
||||
STMT_DLOG("stmt %p closed, stbInterlaceMode: %d, statInfo: ctgGetTbMetaNum=>%" PRId64 ", getCacheTbInfo=>%" PRId64
|
||||
", parseSqlNum=>%" PRId64 ", pStmt->stat.bindDataNum=>%" PRId64
|
||||
", settbnameAPI:%u, bindAPI:%u, addbatchAPI:%u, execAPI:%u"
|
||||
|
|
|
@ -298,6 +298,7 @@ void tmq_conf_destroy(tmq_conf_t* conf) {
|
|||
}
|
||||
|
||||
tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value) {
|
||||
int32_t code = 0;
|
||||
if (conf == NULL || key == NULL || value == NULL) {
|
||||
return TMQ_CONF_INVALID;
|
||||
}
|
||||
|
@ -324,8 +325,9 @@ tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value
|
|||
}
|
||||
|
||||
if (strcasecmp(key, "auto.commit.interval.ms") == 0) {
|
||||
int64_t tmp = taosStr2int64(value);
|
||||
if (tmp < 0 || EINVAL == errno || ERANGE == errno) {
|
||||
int64_t tmp;
|
||||
code = taosStr2int64(value, &tmp);
|
||||
if (tmp < 0 || code != 0) {
|
||||
return TMQ_CONF_INVALID;
|
||||
}
|
||||
conf->autoCommitInterval = (tmp > INT32_MAX ? INT32_MAX : tmp);
|
||||
|
@ -333,8 +335,9 @@ tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value
|
|||
}
|
||||
|
||||
if (strcasecmp(key, "session.timeout.ms") == 0) {
|
||||
int64_t tmp = taosStr2int64(value);
|
||||
if (tmp < 6000 || tmp > 1800000) {
|
||||
int64_t tmp;
|
||||
code = taosStr2int64(value, &tmp);
|
||||
if (tmp < 6000 || tmp > 1800000 || code != 0) {
|
||||
return TMQ_CONF_INVALID;
|
||||
}
|
||||
conf->sessionTimeoutMs = tmp;
|
||||
|
@ -342,8 +345,9 @@ tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value
|
|||
}
|
||||
|
||||
if (strcasecmp(key, "heartbeat.interval.ms") == 0) {
|
||||
int64_t tmp = taosStr2int64(value);
|
||||
if (tmp < 1000 || tmp >= conf->sessionTimeoutMs) {
|
||||
int64_t tmp;
|
||||
code = taosStr2int64(value, &tmp);
|
||||
if (tmp < 1000 || tmp >= conf->sessionTimeoutMs || code != 0) {
|
||||
return TMQ_CONF_INVALID;
|
||||
}
|
||||
conf->heartBeatIntervalMs = tmp;
|
||||
|
@ -351,8 +355,9 @@ tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value
|
|||
}
|
||||
|
||||
if (strcasecmp(key, "max.poll.interval.ms") == 0) {
|
||||
int64_t tmp = taosStr2int64(value);
|
||||
if (tmp < 1000 || tmp > INT32_MAX) {
|
||||
int32_t tmp;
|
||||
code = taosStr2int32(value, &tmp);
|
||||
if (tmp < 1000 || code != 0) {
|
||||
return TMQ_CONF_INVALID;
|
||||
}
|
||||
conf->maxPollIntervalMs = tmp;
|
||||
|
@ -414,8 +419,9 @@ tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value
|
|||
}
|
||||
|
||||
if (strcasecmp(key, "td.connect.port") == 0) {
|
||||
int64_t tmp = taosStr2int64(value);
|
||||
if (tmp <= 0 || tmp > 65535) {
|
||||
int64_t tmp;
|
||||
code = taosStr2int64(value, &tmp);
|
||||
if (tmp <= 0 || tmp > 65535 || code != 0) {
|
||||
return TMQ_CONF_INVALID;
|
||||
}
|
||||
|
||||
|
@ -435,7 +441,9 @@ tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value
|
|||
}
|
||||
}
|
||||
if (strcasecmp(key, "msg.consume.excluded") == 0) {
|
||||
conf->sourceExcluded = (taosStr2int64(value) != 0) ? TD_REQ_FROM_TAOX : 0;
|
||||
int64_t tmp;
|
||||
code = taosStr2int64(value, &tmp);
|
||||
conf->sourceExcluded = (0 == code && tmp != 0) ? TD_REQ_FROM_TAOX : 0;
|
||||
return TMQ_CONF_OK;
|
||||
}
|
||||
|
||||
|
@ -444,7 +452,9 @@ tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value
|
|||
}
|
||||
|
||||
if (strcasecmp(key, "msg.enable.batchmeta") == 0) {
|
||||
conf->enableBatchMeta = (taosStr2int64(value) != 0) ? true : false;
|
||||
int64_t tmp;
|
||||
code = taosStr2int64(value, &tmp);
|
||||
conf->enableBatchMeta = (0 == code && tmp != 0) ? true : false;
|
||||
return TMQ_CONF_OK;
|
||||
}
|
||||
|
||||
|
@ -1094,7 +1104,7 @@ int32_t tmq_subscription(tmq_t* tmq, tmq_list_t** topics) {
|
|||
if (*topics == NULL) {
|
||||
*topics = tmq_list_new();
|
||||
if (*topics == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
taosRLockLatch(&tmq->lock);
|
||||
|
@ -1353,7 +1363,7 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) {
|
|||
|
||||
req.topicNames = taosArrayInit(sz, sizeof(void*));
|
||||
if (req.topicNames == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto FAIL;
|
||||
}
|
||||
|
||||
|
@ -1394,7 +1404,7 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) {
|
|||
}
|
||||
|
||||
if (taosArrayPush(req.topicNames, &topicFName) == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
taosMemoryFree(topicFName);
|
||||
goto FAIL;
|
||||
}
|
||||
|
@ -1404,7 +1414,7 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) {
|
|||
int32_t tlen = tSerializeSCMSubscribeReq(NULL, &req);
|
||||
buf = taosMemoryMalloc(tlen);
|
||||
if (buf == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto FAIL;
|
||||
}
|
||||
|
||||
|
@ -2017,7 +2027,7 @@ static int32_t doTmqPollImpl(tmq_t* pTmq, SMqClientTopic* pTopic, SMqClientVg* p
|
|||
|
||||
pParam = taosMemoryMalloc(sizeof(SMqPollCbParam));
|
||||
if (pParam == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
taosMemoryFreeClear(msg);
|
||||
return code;
|
||||
}
|
||||
|
@ -2713,7 +2723,7 @@ int32_t tmq_commit_sync(tmq_t* tmq, const TAOS_RES* pRes) {
|
|||
SSyncCommitInfo* pInfo = taosMemoryMalloc(sizeof(SSyncCommitInfo));
|
||||
if (pInfo == NULL) {
|
||||
tscError("failed to allocate memory for sync commit");
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
if (tsem2_init(&pInfo->sem, 0, 0) != 0) {
|
||||
tscError("failed to init sem for sync commit");
|
||||
|
@ -2785,7 +2795,7 @@ int32_t tmq_commit_offset_sync(tmq_t* tmq, const char* pTopicName, int32_t vgId,
|
|||
SSyncCommitInfo* pInfo = taosMemoryMalloc(sizeof(SSyncCommitInfo));
|
||||
if (pInfo == NULL) {
|
||||
tscError("consumer:0x%" PRIx64 " failed to prepare seek operation", tmq->consumerId);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
if (tsem2_init(&pInfo->sem, 0, 0) != 0) {
|
||||
|
@ -2922,7 +2932,7 @@ FAIL:
|
|||
|
||||
int32_t syncAskEp(tmq_t* pTmq) {
|
||||
SAskEpInfo* pInfo = taosMemoryMalloc(sizeof(SAskEpInfo));
|
||||
if (pInfo == NULL) return TSDB_CODE_OUT_OF_MEMORY;
|
||||
if (pInfo == NULL) return terrno;
|
||||
if (tsem2_init(&pInfo->sem, 0, 0) != 0) {
|
||||
taosMemoryFree(pInfo);
|
||||
return TSDB_CODE_TSC_INTERNAL_ERROR;
|
||||
|
@ -3427,7 +3437,7 @@ int32_t tmq_get_topic_assignment(tmq_t* tmq, const char* pTopicName, tmq_topic_a
|
|||
|
||||
pCommon->pList = taosArrayInit(4, sizeof(tmq_topic_assignment));
|
||||
if (pCommon->pList == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto end;
|
||||
}
|
||||
if (tsem2_init(&pCommon->rsp, 0, 0) != 0) {
|
||||
|
@ -3445,7 +3455,7 @@ int32_t tmq_get_topic_assignment(tmq_t* tmq, const char* pTopicName, tmq_topic_a
|
|||
}
|
||||
SMqVgWalInfoParam* pParam = taosMemoryMalloc(sizeof(SMqVgWalInfoParam));
|
||||
if (pParam == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
@ -3649,7 +3659,7 @@ int32_t tmq_offset_seek(tmq_t* tmq, const char* pTopicName, int32_t vgId, int64_
|
|||
if (pParam == NULL) {
|
||||
taosMemoryFree(msg);
|
||||
taosMemoryFree(sendInfo);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
if (tsem2_init(&pParam->sem, 0, 0) != 0) {
|
||||
taosMemoryFree(msg);
|
||||
|
|
|
@ -1412,7 +1412,7 @@ static int32_t s3GetObjectToFileByEp(const char *object_name, const char *fileNa
|
|||
|
||||
TdFilePtr pFile = taosOpenFile(fileName, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC);
|
||||
if (pFile == NULL) {
|
||||
uError("[s3] open file error, errno:%d, fileName:%s", terrno, fileName);
|
||||
uError("[s3] open file error, terrno:%d, fileName:%s", terrno, fileName);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
|
||||
|
@ -1871,7 +1871,6 @@ void s3EvictCache(const char *path, long object_size) {
|
|||
taosDirName(dir_name);
|
||||
|
||||
if (taosGetDiskSize((char *)dir_name, &disk_size) < 0) {
|
||||
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||
vError("failed to get disk:%s size since %s", path, terrstr());
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -197,7 +197,6 @@ int32_t taosGenCrashJsonMsg(int signum, char** pMsg, int64_t clusterId, int64_t
|
|||
|
||||
code = taosGetAppName(tmp, NULL);
|
||||
if (code != 0) {
|
||||
code = TAOS_SYSTEM_ERROR(errno);
|
||||
TAOS_CHECK_GOTO(code, NULL, _exit);
|
||||
}
|
||||
TAOS_CHECK_GOTO(tjsonAddStringToObject(pJson, "appName", tmp), NULL, _exit);
|
||||
|
|
|
@ -87,12 +87,11 @@ int64_t taosGetIntervalStartTimestamp(int64_t startTime, int64_t slidingTime, in
|
|||
|
||||
#endif
|
||||
|
||||
SName* toName(int32_t acctId, const char* pDbName, const char* pTableName, SName* pName) {
|
||||
void toName(int32_t acctId, const char* pDbName, const char* pTableName, SName* pName) {
|
||||
pName->type = TSDB_TABLE_NAME_T;
|
||||
pName->acctId = acctId;
|
||||
snprintf(pName->dbname, sizeof(pName->dbname), "%s", pDbName);
|
||||
snprintf(pName->tname, sizeof(pName->tname), "%s", pTableName);
|
||||
return pName;
|
||||
}
|
||||
|
||||
int32_t tNameExtractFullName(const SName* name, char* dst) {
|
||||
|
|
|
@ -89,9 +89,13 @@ static bool dmDataSpaceAvailable() {
|
|||
}
|
||||
|
||||
static int32_t dmCheckDiskSpace() {
|
||||
osUpdate();
|
||||
// availability
|
||||
int32_t code = 0;
|
||||
code = osUpdate();
|
||||
if(code != 0) {
|
||||
code = 0; // ignore the error, just log it
|
||||
dError("failed to update os info since %s", tstrerror(code));
|
||||
}
|
||||
if (!dmDataSpaceAvailable()) {
|
||||
code = TSDB_CODE_NO_DISKSPACE;
|
||||
return code;
|
||||
|
|
|
@ -159,7 +159,9 @@ int32_t dmRunDnode(SDnode *pDnode) {
|
|||
}
|
||||
|
||||
if (count == 10) {
|
||||
osUpdate();
|
||||
if(osUpdate() != 0) {
|
||||
dError("failed to update os info");
|
||||
}
|
||||
count = 0;
|
||||
} else {
|
||||
count++;
|
||||
|
|
|
@ -55,14 +55,36 @@ void *dmSetMgmtHandle(SArray *pArray, tmsg_t msgType, void *nodeMsgFp, bool need
|
|||
}
|
||||
|
||||
void dmGetMonitorSystemInfo(SMonSysInfo *pInfo) {
|
||||
taosGetCpuUsage(&pInfo->cpu_system, &pInfo->cpu_engine);
|
||||
taosGetCpuCores(&pInfo->cpu_cores, false);
|
||||
(void)taosGetProcMemory(&pInfo->mem_engine);
|
||||
(void)taosGetSysMemory(&pInfo->mem_system);
|
||||
int32_t code = 0;
|
||||
code = taosGetCpuUsage(&pInfo->cpu_system, &pInfo->cpu_engine);
|
||||
if (code != 0) {
|
||||
dError("failed to get cpu usage since %s", tstrerror(code));
|
||||
}
|
||||
code = taosGetCpuCores(&pInfo->cpu_cores, false);
|
||||
if (code != 0) {
|
||||
dError("failed to get cpu cores since %s", tstrerror(code));
|
||||
}
|
||||
code = taosGetProcMemory(&pInfo->mem_engine);
|
||||
if (code != 0) {
|
||||
dError("failed to get proc memory since %s", tstrerror(code));
|
||||
}
|
||||
code = taosGetSysMemory(&pInfo->mem_system);
|
||||
if (code != 0) {
|
||||
dError("failed to get sys memory since %s", tstrerror(code));
|
||||
}
|
||||
pInfo->mem_total = tsTotalMemoryKB;
|
||||
pInfo->disk_engine = 0;
|
||||
pInfo->disk_used = tsDataSpace.size.used;
|
||||
pInfo->disk_total = tsDataSpace.size.total;
|
||||
taosGetCardInfoDelta(&pInfo->net_in, &pInfo->net_out);
|
||||
taosGetProcIODelta(&pInfo->io_read, &pInfo->io_write, &pInfo->io_read_disk, &pInfo->io_write_disk);
|
||||
code = taosGetCardInfoDelta(&pInfo->net_in, &pInfo->net_out);
|
||||
if (code != 0) {
|
||||
dError("failed to get card info since %s", tstrerror(code));
|
||||
taosSetDefaultCardInfoDelta(&pInfo->net_in, &pInfo->net_out);
|
||||
}
|
||||
code = taosGetProcIODelta(&pInfo->io_read, &pInfo->io_write, &pInfo->io_read_disk, &pInfo->io_write_disk);
|
||||
if (code != 0) {
|
||||
dError("failed to get proc io delta since %s", tstrerror(code));
|
||||
taosSetDefaultProcIODelta(&pInfo->io_read, &pInfo->io_write, &pInfo->io_read_disk, &pInfo->io_write_disk);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -55,8 +55,8 @@ void *mndBuildCreateVnodeReq(SMnode *, SDnodeObj *pDnode, SDbObj *pDb, SVgObj *p
|
|||
void *mndBuildDropVnodeReq(SMnode *, SDnodeObj *pDnode, SDbObj *pDb, SVgObj *pVgroup, int32_t *pContLen);
|
||||
bool mndVgroupInDb(SVgObj *pVgroup, int64_t dbUid);
|
||||
bool mndVgroupInDnode(SVgObj *pVgroup, int32_t dnodeId);
|
||||
int32_t mndBuildRestoreAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *db, SVgObj *pVgroup,
|
||||
SDnodeObj *pDnode);
|
||||
int32_t mndBuildRestoreAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *db, SVgObj *pVgroup, SDnodeObj *pDnode,
|
||||
SDnodeObj *pAnotherDnode);
|
||||
|
||||
int32_t mndSplitVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SVgObj *pVgroup);
|
||||
|
||||
|
|
|
@ -678,7 +678,7 @@ static int32_t mndProcessArbCheckSyncTimer(SRpcMsg *pReq) {
|
|||
mndArbGroupSetAssignedLeader(&newGroup, candidateIndex);
|
||||
if (taosArrayPush(pUpdateArray, &newGroup) == NULL) {
|
||||
taosArrayDestroy(pUpdateArray);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
sdbRelease(pSdb, pArbGroup);
|
||||
|
|
|
@ -216,7 +216,7 @@ static int32_t buildMqHbRsp(SRpcMsg *pMsg, SMqHbRsp *rsp){
|
|||
}
|
||||
void *buf = rpcMallocCont(tlen);
|
||||
if (buf == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
if(tSerializeSMqHbRsp(buf, tlen, rsp) <= 0){
|
||||
|
@ -261,7 +261,7 @@ static int32_t addEpSetInfo(SMnode *pMnode, SMqConsumerObj *pConsumer, int32_t e
|
|||
rsp->topics = taosArrayInit(numOfTopics, sizeof(SMqSubTopicEp));
|
||||
if (rsp->topics == NULL) {
|
||||
taosRUnLockLatch(&pConsumer->lock);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
// handle all topics subscribed by this consumer
|
||||
|
@ -318,7 +318,7 @@ static int32_t addEpSetInfo(SMnode *pMnode, SMqConsumerObj *pConsumer, int32_t e
|
|||
taosRUnLockLatch(&pConsumer->lock);
|
||||
taosRUnLockLatch(&pSub->lock);
|
||||
mndReleaseSubscribe(pMnode, pSub);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
for (int32_t j = 0; j < vgNum; j++) {
|
||||
|
@ -339,7 +339,7 @@ static int32_t addEpSetInfo(SMnode *pMnode, SMqConsumerObj *pConsumer, int32_t e
|
|||
taosRUnLockLatch(&pConsumer->lock);
|
||||
taosRUnLockLatch(&pSub->lock);
|
||||
mndReleaseSubscribe(pMnode, pSub);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
if (taosArrayPush(rsp->topics, &topicEp) == NULL) {
|
||||
|
@ -347,7 +347,7 @@ static int32_t addEpSetInfo(SMnode *pMnode, SMqConsumerObj *pConsumer, int32_t e
|
|||
taosRUnLockLatch(&pConsumer->lock);
|
||||
taosRUnLockLatch(&pSub->lock);
|
||||
mndReleaseSubscribe(pMnode, pSub);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
taosRUnLockLatch(&pSub->lock);
|
||||
mndReleaseSubscribe(pMnode, pSub);
|
||||
|
@ -362,7 +362,7 @@ static int32_t buildAskEpRsp(SRpcMsg *pMsg, SMqAskEpRsp *rsp, int32_t serverEpoc
|
|||
int32_t tlen = sizeof(SMqRspHead) + tEncodeSMqAskEpRsp(NULL, rsp);
|
||||
void *buf = rpcMallocCont(tlen);
|
||||
if (buf == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
SMqRspHead *pHead = buf;
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "systable.h"
|
||||
#include "thttp.h"
|
||||
#include "tjson.h"
|
||||
#include "command.h"
|
||||
|
||||
#define DB_VER_NUMBER 1
|
||||
#define DB_RESERVE_SIZE 27
|
||||
|
@ -1557,7 +1558,7 @@ static int32_t mndBuildDropDbRsp(SDbObj *pDb, int32_t *pRspLen, void **ppRsp, bo
|
|||
}
|
||||
|
||||
if (pRsp == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
|
@ -1728,7 +1729,7 @@ int32_t mndExtractDbInfo(SMnode *pMnode, SDbObj *pDb, SUseDbRsp *pRsp, const SUs
|
|||
int32_t code = 0;
|
||||
pRsp->pVgroupInfos = taosArrayInit(pDb->cfg.numOfVgroups, sizeof(SVgroupInfo));
|
||||
if (pRsp->pVgroupInfos == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
|
@ -2321,18 +2322,25 @@ static void mndDumpDbInfoData(SMnode *pMnode, SSDataBlock *pBlock, SDbObj *pDb,
|
|||
(void)colDataSetVal(pColInfo, rows, (const char *)strictVstr, false);
|
||||
|
||||
char durationVstr[128] = {0};
|
||||
int32_t len = sprintf(&durationVstr[VARSTR_HEADER_SIZE], "%dm", pDb->cfg.daysPerFile);
|
||||
int32_t len = formatDurationOrKeep(&durationVstr[VARSTR_HEADER_SIZE], pDb->cfg.daysPerFile);
|
||||
|
||||
varDataSetLen(durationVstr, len);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
(void)colDataSetVal(pColInfo, rows, (const char *)durationVstr, false);
|
||||
|
||||
char keepVstr[128] = {0};
|
||||
char keepVstr[512] = {0};
|
||||
char keep0Str[128] = {0};
|
||||
char keep1Str[128] = {0};
|
||||
char keep2Str[128] = {0};
|
||||
|
||||
int32_t lenKeep0 = formatDurationOrKeep(keep0Str, pDb->cfg.daysToKeep0);
|
||||
int32_t lenKeep1 = formatDurationOrKeep(keep1Str, pDb->cfg.daysToKeep1);
|
||||
int32_t lenKeep2 = formatDurationOrKeep(keep2Str, pDb->cfg.daysToKeep2);
|
||||
|
||||
if (pDb->cfg.daysToKeep0 > pDb->cfg.daysToKeep1 || pDb->cfg.daysToKeep0 > pDb->cfg.daysToKeep2) {
|
||||
len = sprintf(&keepVstr[VARSTR_HEADER_SIZE], "%dm,%dm,%dm", pDb->cfg.daysToKeep1, pDb->cfg.daysToKeep2,
|
||||
pDb->cfg.daysToKeep0);
|
||||
len = sprintf(&keepVstr[VARSTR_HEADER_SIZE], "%s,%s,%s", keep1Str, keep2Str, keep0Str);
|
||||
} else {
|
||||
len = sprintf(&keepVstr[VARSTR_HEADER_SIZE], "%dm,%dm,%dm", pDb->cfg.daysToKeep0, pDb->cfg.daysToKeep1,
|
||||
pDb->cfg.daysToKeep2);
|
||||
len = sprintf(&keepVstr[VARSTR_HEADER_SIZE], "%s,%s,%s", keep0Str, keep1Str, keep2Str);
|
||||
}
|
||||
varDataSetLen(keepVstr, len);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
|
|
|
@ -137,7 +137,7 @@ int32_t tDecodeSStreamObj(SDecoder *pDecoder, SStreamObj *pObj, int32_t sver) {
|
|||
if (sz != 0) {
|
||||
pObj->tasks = taosArrayInit(sz, sizeof(void *));
|
||||
if (pObj->tasks == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
|
@ -161,14 +161,14 @@ int32_t tDecodeSStreamObj(SDecoder *pDecoder, SStreamObj *pObj, int32_t sver) {
|
|||
if (taosArrayPush(pArray, &pTask) == NULL) {
|
||||
taosMemoryFree(pTask);
|
||||
taosArrayDestroy(pArray);
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (taosArrayPush(pObj->tasks, &pArray) == NULL) {
|
||||
taosArrayDestroy(pArray);
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
}
|
||||
|
@ -297,24 +297,24 @@ int32_t tNewSMqConsumerObj(int64_t consumerId, char *cgroup, int8_t updateType,
|
|||
if (updateType == CONSUMER_ADD_REB){
|
||||
pConsumer->rebNewTopics = taosArrayInit(0, sizeof(void *));
|
||||
if(pConsumer->rebNewTopics == NULL){
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto END;
|
||||
}
|
||||
|
||||
char* topicTmp = taosStrdup(topic);
|
||||
if (taosArrayPush(pConsumer->rebNewTopics, &topicTmp) == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto END;
|
||||
}
|
||||
}else if (updateType == CONSUMER_REMOVE_REB) {
|
||||
pConsumer->rebRemovedTopics = taosArrayInit(0, sizeof(void *));
|
||||
if(pConsumer->rebRemovedTopics == NULL){
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto END;
|
||||
}
|
||||
char* topicTmp = taosStrdup(topic);
|
||||
if (taosArrayPush(pConsumer->rebRemovedTopics, &topicTmp) == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto END;
|
||||
}
|
||||
}else if (updateType == CONSUMER_INSERT_SUB){
|
||||
|
@ -330,7 +330,7 @@ int32_t tNewSMqConsumerObj(int64_t consumerId, char *cgroup, int8_t updateType,
|
|||
|
||||
pConsumer->rebNewTopics = taosArrayDup(subscribe->topicNames, topicNameDup);
|
||||
if (pConsumer->rebNewTopics == NULL){
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto END;
|
||||
}
|
||||
pConsumer->assignedTopics = subscribe->topicNames;
|
||||
|
@ -612,7 +612,7 @@ int32_t tCloneSubscribeObj(const SMqSubscribeObj *pSub, SMqSubscribeObj **ppSub)
|
|||
int32_t code = 0;
|
||||
SMqSubscribeObj *pSubNew = taosMemoryMalloc(sizeof(SMqSubscribeObj));
|
||||
if (pSubNew == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto END;
|
||||
}
|
||||
(void)memcpy(pSubNew->key, pSub->key, TSDB_SUBSCRIBE_KEY_LEN);
|
||||
|
|
|
@ -461,7 +461,7 @@ int32_t mndGetDnodeData(SMnode *pMnode, SArray *pDnodeInfo) {
|
|||
}
|
||||
|
||||
if(taosArrayPush(pDnodeInfo, &dInfo) == NULL){
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
sdbCancelFetch(pSdb, pIter);
|
||||
break;
|
||||
}
|
||||
|
@ -618,7 +618,7 @@ static int32_t mndUpdateDnodeObj(SMnode *pMnode, SDnodeObj *pDnode) {
|
|||
}
|
||||
pReq = rpcMallocCont(contLen);
|
||||
if (pReq == NULL) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
|
||||
(void)tSerializeSDnodeInfoReq(pReq, contLen, &infoReq);
|
||||
|
@ -980,7 +980,7 @@ static int32_t mndProcessDnodeListReq(SRpcMsg *pReq) {
|
|||
rsp.dnodeList = taosArrayInit(5, sizeof(SEpSet));
|
||||
if (NULL == rsp.dnodeList) {
|
||||
mError("failed to alloc epSet while process dnode list req");
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
|
@ -1006,7 +1006,7 @@ static int32_t mndProcessDnodeListReq(SRpcMsg *pReq) {
|
|||
int32_t rspLen = tSerializeSDnodeListRsp(NULL, 0, &rsp);
|
||||
void *pRsp = rpcMallocCont(rspLen);
|
||||
if (pRsp == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
|
@ -1064,7 +1064,7 @@ static int32_t mndProcessShowVariablesReq(SRpcMsg *pReq) {
|
|||
rsp.variables = taosArrayInit(16, sizeof(SVariablesInfo));
|
||||
if (NULL == rsp.variables) {
|
||||
mError("failed to alloc SVariablesInfo array while process show variables req");
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
|
@ -1074,7 +1074,7 @@ static int32_t mndProcessShowVariablesReq(SRpcMsg *pReq) {
|
|||
(void)snprintf(info.value, TSDB_CONFIG_VALUE_LEN, "%d", tsStatusInterval);
|
||||
(void)strcpy(info.scope, "server");
|
||||
if (taosArrayPush(rsp.variables, &info) == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
|
@ -1082,7 +1082,7 @@ static int32_t mndProcessShowVariablesReq(SRpcMsg *pReq) {
|
|||
(void)snprintf(info.value, TSDB_CONFIG_VALUE_LEN, "%s", tsTimezoneStr);
|
||||
(void)strcpy(info.scope, "both");
|
||||
if (taosArrayPush(rsp.variables, &info) == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
|
@ -1090,7 +1090,7 @@ static int32_t mndProcessShowVariablesReq(SRpcMsg *pReq) {
|
|||
(void)snprintf(info.value, TSDB_CONFIG_VALUE_LEN, "%s", tsLocale);
|
||||
(void)strcpy(info.scope, "both");
|
||||
if (taosArrayPush(rsp.variables, &info) == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
|
@ -1098,7 +1098,7 @@ static int32_t mndProcessShowVariablesReq(SRpcMsg *pReq) {
|
|||
(void)snprintf(info.value, TSDB_CONFIG_VALUE_LEN, "%s", tsCharset);
|
||||
(void)strcpy(info.scope, "both");
|
||||
if (taosArrayPush(rsp.variables, &info) == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
|
@ -1106,7 +1106,7 @@ static int32_t mndProcessShowVariablesReq(SRpcMsg *pReq) {
|
|||
(void)snprintf(info.value, TSDB_CONFIG_VALUE_LEN, "%d", tsEnableMonitor);
|
||||
(void)strcpy(info.scope, "server");
|
||||
if (taosArrayPush(rsp.variables, &info) == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
|
@ -1114,7 +1114,7 @@ static int32_t mndProcessShowVariablesReq(SRpcMsg *pReq) {
|
|||
(void)snprintf(info.value, TSDB_CONFIG_VALUE_LEN, "%d", tsMonitorInterval);
|
||||
(void)strcpy(info.scope, "server");
|
||||
if (taosArrayPush(rsp.variables, &info) == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
|
@ -1122,7 +1122,7 @@ static int32_t mndProcessShowVariablesReq(SRpcMsg *pReq) {
|
|||
(void)snprintf(info.value, TSDB_CONFIG_VALUE_LEN, "%d", tsSlowLogThreshold);
|
||||
(void)strcpy(info.scope, "server");
|
||||
if (taosArrayPush(rsp.variables, &info) == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
|
@ -1130,7 +1130,7 @@ static int32_t mndProcessShowVariablesReq(SRpcMsg *pReq) {
|
|||
(void)snprintf(info.value, TSDB_CONFIG_VALUE_LEN, "%d", tsSlowLogMaxLen);
|
||||
(void)strcpy(info.scope, "server");
|
||||
if (taosArrayPush(rsp.variables, &info) == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
|
@ -1140,14 +1140,14 @@ static int32_t mndProcessShowVariablesReq(SRpcMsg *pReq) {
|
|||
(void)snprintf(info.value, TSDB_CONFIG_VALUE_LEN, "%s", scopeStr);
|
||||
(void)strcpy(info.scope, "server");
|
||||
if (taosArrayPush(rsp.variables, &info) == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
int32_t rspLen = tSerializeSShowVariablesRsp(NULL, 0, &rsp);
|
||||
void *pRsp = rpcMallocCont(rspLen);
|
||||
if (pRsp == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
|
|
|
@ -265,7 +265,7 @@ static int32_t mndCreateFunc(SMnode *pMnode, SRpcMsg *pReq, SCreateFuncReq *pCre
|
|||
func.codeSize = pCreate->codeLen;
|
||||
func.pCode = taosMemoryMalloc(func.codeSize);
|
||||
if (func.pCode == NULL || func.pCode == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
|
@ -528,13 +528,13 @@ static int32_t mndProcessRetrieveFuncReq(SRpcMsg *pReq) {
|
|||
retrieveRsp.numOfFuncs = retrieveReq.numOfFuncs;
|
||||
retrieveRsp.pFuncInfos = taosArrayInit(retrieveReq.numOfFuncs, sizeof(SFuncInfo));
|
||||
if (retrieveRsp.pFuncInfos == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto RETRIEVE_FUNC_OVER;
|
||||
}
|
||||
|
||||
retrieveRsp.pFuncExtraInfos = taosArrayInit(retrieveReq.numOfFuncs, sizeof(SFuncExtraInfo));
|
||||
if (retrieveRsp.pFuncExtraInfos == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto RETRIEVE_FUNC_OVER;
|
||||
}
|
||||
|
||||
|
@ -563,28 +563,28 @@ static int32_t mndProcessRetrieveFuncReq(SRpcMsg *pReq) {
|
|||
funcInfo.codeSize = pFunc->codeSize;
|
||||
funcInfo.pCode = taosMemoryCalloc(1, funcInfo.codeSize);
|
||||
if (funcInfo.pCode == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
terrno = terrno;
|
||||
goto RETRIEVE_FUNC_OVER;
|
||||
}
|
||||
(void)memcpy(funcInfo.pCode, pFunc->pCode, pFunc->codeSize);
|
||||
if (funcInfo.commentSize > 0) {
|
||||
funcInfo.pComment = taosMemoryCalloc(1, funcInfo.commentSize);
|
||||
if (funcInfo.pComment == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
terrno = terrno;
|
||||
goto RETRIEVE_FUNC_OVER;
|
||||
}
|
||||
(void)memcpy(funcInfo.pComment, pFunc->pComment, pFunc->commentSize);
|
||||
}
|
||||
}
|
||||
if (taosArrayPush(retrieveRsp.pFuncInfos, &funcInfo) == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
terrno = terrno;
|
||||
goto RETRIEVE_FUNC_OVER;
|
||||
}
|
||||
SFuncExtraInfo extraInfo = {0};
|
||||
extraInfo.funcVersion = pFunc->funcVersion;
|
||||
extraInfo.funcCreatedTime = pFunc->createdTime;
|
||||
if (taosArrayPush(retrieveRsp.pFuncExtraInfos, &extraInfo) == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
terrno = terrno;
|
||||
goto RETRIEVE_FUNC_OVER;
|
||||
}
|
||||
|
||||
|
@ -594,7 +594,7 @@ static int32_t mndProcessRetrieveFuncReq(SRpcMsg *pReq) {
|
|||
int32_t contLen = tSerializeSRetrieveFuncRsp(NULL, 0, &retrieveRsp);
|
||||
void *pRsp = rpcMallocCont(contLen);
|
||||
if (pRsp == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto RETRIEVE_FUNC_OVER;
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ static int32_t mndInsInitMeta(SHashObj *hash) {
|
|||
TAOS_CHECK_RETURN(mndInitInfosTableSchema(pInfosTableMeta[i].schema, pInfosTableMeta[i].colNum, &meta.pSchemas));
|
||||
|
||||
if (taosHashPut(hash, meta.tbName, strlen(meta.tbName), &meta, sizeof(meta))) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -559,7 +559,7 @@ static int32_t mndAllocStep(SMnode *pMnode, char *name, MndInitFp initFp, MndCle
|
|||
step.initFp = initFp;
|
||||
step.cleanupFp = cleanupFp;
|
||||
if (taosArrayPush(pMnode->pSteps, &step) == NULL) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
|
||||
TAOS_RETURN(0);
|
||||
|
|
|
@ -58,7 +58,7 @@ int32_t mndPerfsInitMeta(SHashObj *hash) {
|
|||
TAOS_CHECK_RETURN(mndInitPerfsTableSchema(pSysDbTableMeta[i].schema, pSysDbTableMeta[i].colNum, &meta.pSchemas));
|
||||
|
||||
if (taosHashPut(hash, meta.tbName, strlen(meta.tbName), &meta, sizeof(meta))) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ int32_t mndInitPerfs(SMnode *pMnode) {
|
|||
int32_t code = 0;
|
||||
pMnode->perfsMeta = taosHashInit(20, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK);
|
||||
if (pMnode->perfsMeta == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ int32_t mndSetUserWhiteListRsp(SMnode *pMnode, SUserObj *pUser, SGetUserWhiteLis
|
|||
pWhiteListRsp->numWhiteLists = 1;
|
||||
pWhiteListRsp->pWhiteLists = taosMemoryMalloc(pWhiteListRsp->numWhiteLists * sizeof(SIpV4Range));
|
||||
if (pWhiteListRsp->pWhiteLists == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
memset(pWhiteListRsp->pWhiteLists, 0, pWhiteListRsp->numWhiteLists * sizeof(SIpV4Range));
|
||||
|
||||
|
|
|
@ -65,6 +65,8 @@ typedef struct {
|
|||
int64_t ipWhiteListVer;
|
||||
} SConnPreparedObj;
|
||||
|
||||
#define CACHE_OBJ_KEEP_TIME 3 // s
|
||||
|
||||
static SConnObj *mndCreateConn(SMnode *pMnode, const char *user, int8_t connType, uint32_t ip, uint16_t port,
|
||||
int32_t pid, const char *app, int64_t startTime);
|
||||
static void mndFreeConn(SConnObj *pConn);
|
||||
|
@ -161,9 +163,8 @@ static SConnObj *mndCreateConn(SMnode *pMnode, const char *user, int8_t connType
|
|||
tstrncpy(connObj.user, user, TSDB_USER_LEN);
|
||||
tstrncpy(connObj.app, app, TSDB_APP_NAME_LEN);
|
||||
|
||||
int32_t keepTime = tsShellActivityTimer * 3;
|
||||
SConnObj *pConn =
|
||||
taosCachePut(pMgmt->connCache, &connId, sizeof(uint32_t), &connObj, sizeof(connObj), keepTime * 1000);
|
||||
taosCachePut(pMgmt->connCache, &connId, sizeof(uint32_t), &connObj, sizeof(connObj), CACHE_OBJ_KEEP_TIME * 1000);
|
||||
if (pConn == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
mError("conn:%d, failed to put into cache since %s, user:%s", connId, user, terrstr());
|
||||
|
@ -318,7 +319,7 @@ static int32_t mndProcessConnectReq(SRpcMsg *pReq) {
|
|||
}
|
||||
void *pRsp = rpcMallocCont(contLen);
|
||||
if (pRsp == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _OVER);
|
||||
TAOS_CHECK_GOTO(terrno, NULL, _OVER);
|
||||
}
|
||||
|
||||
contLen = tSerializeSConnectRsp(pRsp, contLen, &connectRsp);
|
||||
|
@ -376,8 +377,7 @@ static SAppObj *mndCreateApp(SMnode *pMnode, uint32_t clientIp, SAppHbReq *pReq)
|
|||
(void)memcpy(&app.summary, &pReq->summary, sizeof(pReq->summary));
|
||||
app.lastAccessTimeMs = taosGetTimestampMs();
|
||||
|
||||
const int32_t keepTime = tsShellActivityTimer * 3;
|
||||
SAppObj *pApp = taosCachePut(pMgmt->appCache, &pReq->appId, sizeof(pReq->appId), &app, sizeof(app), keepTime * 1000);
|
||||
SAppObj *pApp = taosCachePut(pMgmt->appCache, &pReq->appId, sizeof(pReq->appId), &app, sizeof(app), CACHE_OBJ_KEEP_TIME * 1000);
|
||||
if (pApp == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
mError("failed to app %" PRIx64 " into cache since %s", pReq->appId, terrstr());
|
||||
|
@ -555,7 +555,7 @@ static int32_t mndProcessQueryHeartBeat(SMnode *pMnode, SRpcMsg *pMsg, SClientHb
|
|||
hbRsp.info = taosArrayInit(kvNum, sizeof(SKv));
|
||||
if (NULL == hbRsp.info) {
|
||||
mError("taosArrayInit %d rsp kv failed", kvNum);
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
tFreeClientHbRsp(&hbRsp);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
@ -699,7 +699,7 @@ static int32_t mndProcessHeartBeatReq(SRpcMsg *pReq) {
|
|||
batchRsp.svrTimestamp = taosGetTimestampSec();
|
||||
batchRsp.rsps = taosArrayInit(0, sizeof(SClientHbRsp));
|
||||
if (batchRsp.rsps == NULL) {
|
||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_CHECK_EXIT(terrno);
|
||||
}
|
||||
batchRsp.monitorParas.tsEnableMonitor = tsEnableMonitor;
|
||||
batchRsp.monitorParas.tsMonitorInterval = tsMonitorInterval;
|
||||
|
@ -732,7 +732,7 @@ static int32_t mndProcessHeartBeatReq(SRpcMsg *pReq) {
|
|||
}
|
||||
void *buf = rpcMallocCont(tlen);
|
||||
if (!buf) {
|
||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_CHECK_EXIT(terrno);
|
||||
}
|
||||
tlen = tSerializeSClientHbBatchRsp(buf, tlen, &batchRsp);
|
||||
if (tlen < 0) {
|
||||
|
@ -820,7 +820,7 @@ static int32_t mndProcessSvrVerReq(SRpcMsg *pReq) {
|
|||
}
|
||||
void *pRsp = rpcMallocCont(contLen);
|
||||
if (pRsp == NULL) {
|
||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_CHECK_EXIT(terrno);
|
||||
}
|
||||
contLen = tSerializeSServerVerRsp(pRsp, contLen, &rsp);
|
||||
if (contLen < 0) {
|
||||
|
@ -842,7 +842,6 @@ static int32_t mndRetrieveConns(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl
|
|||
int32_t numOfRows = 0;
|
||||
int32_t cols = 0;
|
||||
SConnObj *pConn = NULL;
|
||||
int32_t keepTime = tsShellActivityTimer * 3;
|
||||
|
||||
if (pShow->pIter == NULL) {
|
||||
SProfileMgmt *pMgmt = &pMnode->profileMgmt;
|
||||
|
@ -856,7 +855,7 @@ static int32_t mndRetrieveConns(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl
|
|||
break;
|
||||
}
|
||||
|
||||
if ((taosGetTimestampMs() - pConn->lastAccessTimeMs) > ((int64_t)keepTime * 1000)) {
|
||||
if ((taosGetTimestampMs() - pConn->lastAccessTimeMs) > ((int64_t)CACHE_OBJ_KEEP_TIME * 1000)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -249,7 +249,7 @@ static int32_t mndSetCreateQnodeUndoActions(STrans *pTrans, SDnodeObj *pDnode, S
|
|||
int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &dropReq);
|
||||
void *pReq = taosMemoryMalloc(contLen);
|
||||
if (pReq == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
(void)tSerializeSCreateDropMQSNodeReq(pReq, contLen, &dropReq);
|
||||
|
@ -380,7 +380,7 @@ static int32_t mndSetDropQnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SQn
|
|||
int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &dropReq);
|
||||
void *pReq = taosMemoryMalloc(contLen);
|
||||
if (pReq == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
(void)tSerializeSCreateDropMQSNodeReq(pReq, contLen, &dropReq);
|
||||
|
@ -483,7 +483,7 @@ int32_t mndCreateQnodeList(SMnode *pMnode, SArray **pList, int32_t limit) {
|
|||
SArray *qnodeList = taosArrayInit(5, sizeof(SQueryNodeLoad));
|
||||
if (NULL == qnodeList) {
|
||||
mError("failed to alloc epSet while process qnode list req");
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
|
@ -532,7 +532,7 @@ static int32_t mndProcessQnodeListReq(SRpcMsg *pReq) {
|
|||
int32_t rspLen = tSerializeSQnodeListRsp(NULL, 0, &qlistRsp);
|
||||
void *pRsp = rpcMallocCont(rspLen);
|
||||
if (pRsp == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ int32_t mndProcessBatchMetaMsg(SRpcMsg *pMsg) {
|
|||
|
||||
batchRsp.pRsps = taosArrayInit(msgNum, sizeof(SBatchRspMsg));
|
||||
if (NULL == batchRsp.pRsps) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
|
@ -147,7 +147,7 @@ int32_t mndProcessBatchMetaMsg(SRpcMsg *pMsg) {
|
|||
}
|
||||
pRsp = rpcMallocCont(rspSize);
|
||||
if (pRsp == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
if (tSerializeSBatchRsp(pRsp, rspSize, &batchRsp) < 0) {
|
||||
|
|
|
@ -846,13 +846,13 @@ int32_t mndSchedInitSubEp(SMnode* pMnode, const SMqTopicObj* pTopic, SMqSubscrib
|
|||
|
||||
SMqVgEp* pVgEp = taosMemoryMalloc(sizeof(SMqVgEp));
|
||||
if (pVgEp == NULL){
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto END;
|
||||
}
|
||||
pVgEp->epSet = mndGetVgroupEpset(pMnode, pVgroup);
|
||||
pVgEp->vgId = pVgroup->vgId;
|
||||
if (taosArrayPush(pSub->unassignedVgs, &pVgEp) == NULL){
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
taosMemoryFree(pVgEp);
|
||||
goto END;
|
||||
}
|
||||
|
|
|
@ -243,7 +243,7 @@ static int32_t mndProcessRetrieveSysTableReq(SRpcMsg *pReq) {
|
|||
|
||||
pShow = mndCreateShowObj(pMnode, &retrieveReq);
|
||||
if (pShow == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
mError("failed to process show-meta req since %s", tstrerror(code));
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
|
|
@ -368,7 +368,11 @@ static void *mndBuildVDropSmaReq(SMnode *pMnode, SVgObj *pVgroup, SSmaObj *pSma,
|
|||
SEncoder encoder = {0};
|
||||
int32_t contLen;
|
||||
SName name = {0};
|
||||
(void)tNameFromString(&name, pSma->name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||
int32_t code = tNameFromString(&name, pSma->name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
terrno = code;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SVDropTSmaReq req = {0};
|
||||
req.indexUid = pSma->uid;
|
||||
|
@ -1279,7 +1283,7 @@ int32_t mndGetTableSma(SMnode *pMnode, char *tbFName, STableIndexRsp *rsp, bool
|
|||
|
||||
info.expr = taosMemoryMalloc(pSma->exprLen + 1);
|
||||
if (info.expr == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
sdbRelease(pSdb, pSma);
|
||||
sdbCancelFetch(pSdb, pIter);
|
||||
return code;
|
||||
|
@ -1289,7 +1293,7 @@ int32_t mndGetTableSma(SMnode *pMnode, char *tbFName, STableIndexRsp *rsp, bool
|
|||
info.expr[pSma->exprLen] = 0;
|
||||
|
||||
if (NULL == taosArrayPush(rsp->pIndex, &info)) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
taosMemoryFree(info.expr);
|
||||
sdbRelease(pSdb, pSma);
|
||||
sdbCancelFetch(pSdb, pIter);
|
||||
|
@ -1326,7 +1330,7 @@ static int32_t mndProcessGetSmaReq(SRpcMsg *pReq) {
|
|||
int32_t contLen = tSerializeSUserIndexRsp(NULL, 0, &rsp);
|
||||
void *pRsp = rpcMallocCont(contLen);
|
||||
if (pRsp == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
|
@ -1361,7 +1365,7 @@ static int32_t mndProcessGetTbSmaReq(SRpcMsg *pReq) {
|
|||
|
||||
rsp.pIndex = taosArrayInit(10, sizeof(STableIndexInfo));
|
||||
if (NULL == rsp.pIndex) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
|
@ -1376,7 +1380,7 @@ static int32_t mndProcessGetTbSmaReq(SRpcMsg *pReq) {
|
|||
int32_t contLen = tSerializeSTableIndexRsp(NULL, 0, &rsp);
|
||||
void *pRsp = rpcMallocCont(contLen);
|
||||
if (pRsp == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
|
@ -1669,8 +1673,7 @@ static int32_t mndSetUpdateDbTsmaVersionPrepareLogs(SMnode *pMnode, STrans *pTra
|
|||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
(void)sdbSetRawStatus(pRedoRaw, SDB_STATUS_READY);
|
||||
TAOS_RETURN(code);
|
||||
TAOS_RETURN(sdbSetRawStatus(pRedoRaw, SDB_STATUS_READY));
|
||||
}
|
||||
|
||||
static int32_t mndSetUpdateDbTsmaVersionCommitLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pOld, SDbObj *pNew) {
|
||||
|
@ -1686,8 +1689,7 @@ static int32_t mndSetUpdateDbTsmaVersionCommitLogs(SMnode *pMnode, STrans *pTran
|
|||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
(void)sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY);
|
||||
TAOS_RETURN(code);
|
||||
TAOS_RETURN(sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY));
|
||||
}
|
||||
|
||||
static int32_t mndCreateTSMATxnPrepare(SCreateTSMACxt* pCxt) {
|
||||
|
@ -1699,7 +1701,7 @@ static int32_t mndCreateTSMATxnPrepare(SCreateTSMACxt* pCxt) {
|
|||
STrans *pTrans =
|
||||
mndTransCreate(pCxt->pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pCxt->pRpcReq, "create-tsma");
|
||||
if (!pTrans) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _OVER;
|
||||
}
|
||||
mndTransSetDbName(pTrans, pCxt->pDb->name, NULL);
|
||||
|
@ -1797,14 +1799,14 @@ static int32_t mndCreateTSMA(SCreateTSMACxt *pCxt) {
|
|||
if (pCxt->pCreateSmaReq->pVgroupVerList) {
|
||||
pCxt->pCreateStreamReq->pVgroupVerList = taosArrayDup(pCxt->pCreateSmaReq->pVgroupVerList, NULL);
|
||||
if (!pCxt->pCreateStreamReq->pVgroupVerList) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _OVER;
|
||||
}
|
||||
}
|
||||
if (LIST_LENGTH(pProjects) > 0) {
|
||||
createStreamReq.pCols = taosArrayInit(LIST_LENGTH(pProjects), sizeof(SField));
|
||||
if (!createStreamReq.pCols) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _OVER;
|
||||
}
|
||||
}
|
||||
|
@ -1978,7 +1980,7 @@ static int32_t mndDropTSMA(SCreateTSMACxt* pCxt) {
|
|||
STransAction dropStreamRedoAction = {0};
|
||||
STrans *pTrans = mndTransCreate(pCxt->pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pCxt->pRpcReq, "drop-tsma");
|
||||
if (!pTrans) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _OVER;
|
||||
}
|
||||
SMDropStreamReq dropStreamReq = {0};
|
||||
|
@ -2337,7 +2339,7 @@ int32_t dumpTSMAInfoFromSmaObj(const SSmaObj* pSma, const SStbObj* pDestStb, STa
|
|||
funcInfo.funcId = pFuncNode->funcId;
|
||||
funcInfo.colId = ((SColumnNode *)pFuncNode->pParameterList->pHead->pNode)->colId;
|
||||
if (!taosArrayPush(pInfo->pFuncs, &funcInfo)) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
taosArrayDestroy(pInfo->pFuncs);
|
||||
nodesDestroyNode(pNode);
|
||||
return code;
|
||||
|
@ -2351,7 +2353,7 @@ int32_t dumpTSMAInfoFromSmaObj(const SSmaObj* pSma, const SStbObj* pDestStb, STa
|
|||
if (code == TSDB_CODE_SUCCESS && pDestStb->numOfTags > 0) {
|
||||
pInfo->pTags = taosArrayInit(pDestStb->numOfTags, sizeof(SSchema));
|
||||
if (!pInfo->pTags) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
} else {
|
||||
for (int32_t i = 0; i < pDestStb->numOfTags; ++i) {
|
||||
if (NULL == taosArrayPush(pInfo->pTags, &pDestStb->pTags[i])) {
|
||||
|
@ -2364,7 +2366,7 @@ int32_t dumpTSMAInfoFromSmaObj(const SSmaObj* pSma, const SStbObj* pDestStb, STa
|
|||
if (code == TSDB_CODE_SUCCESS) {
|
||||
pInfo->pUsedCols = taosArrayInit(pDestStb->numOfColumns - 3, sizeof(SSchema));
|
||||
if (!pInfo->pUsedCols)
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
else {
|
||||
// skip _wstart, _wend, _duration
|
||||
for (int32_t i = 1; i < pDestStb->numOfColumns - 2; ++i) {
|
||||
|
@ -2438,7 +2440,7 @@ static int32_t mndGetTSMA(SMnode *pMnode, char *tsmaFName, STableTSMAInfoRsp *rs
|
|||
TAOS_RETURN(code);
|
||||
}
|
||||
if (NULL == taosArrayPush(rsp->pTsmas, &pTsma)) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
tFreeAndClearTableTSMAInfo(pTsma);
|
||||
}
|
||||
*exist = true;
|
||||
|
@ -2524,7 +2526,7 @@ static int32_t mndGetSomeTsmas(SMnode* pMnode, STableTSMAInfoRsp* pRsp, tsmaFilt
|
|||
TAOS_RETURN(code);
|
||||
}
|
||||
if (NULL == taosArrayPush(pRsp->pTsmas, &pTsma)) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
tFreeAndClearTableTSMAInfo(pTsma);
|
||||
sdbCancelFetch(pSdb, pIter);
|
||||
TAOS_RETURN(code);
|
||||
|
@ -2566,7 +2568,7 @@ static int32_t mndProcessGetTbTSMAReq(SRpcMsg *pReq) {
|
|||
|
||||
rsp.pTsmas = taosArrayInit(4, POINTER_BYTES);
|
||||
if (NULL == rsp.pTsmas) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
|
@ -2588,7 +2590,7 @@ static int32_t mndProcessGetTbTSMAReq(SRpcMsg *pReq) {
|
|||
int32_t contLen = tSerializeTableTSMAInfoRsp(NULL, 0, &rsp);
|
||||
void *pRsp = rpcMallocCont(contLen);
|
||||
if (pRsp == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
|
|
|
@ -220,7 +220,7 @@ static int32_t mndSetCreateSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S
|
|||
int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &createReq);
|
||||
void *pReq = taosMemoryMalloc(contLen);
|
||||
if (pReq == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
(void)tSerializeSCreateDropMQSNodeReq(pReq, contLen, &createReq);
|
||||
|
@ -248,7 +248,7 @@ static int32_t mndSetCreateSnodeUndoActions(STrans *pTrans, SDnodeObj *pDnode, S
|
|||
int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &dropReq);
|
||||
void *pReq = taosMemoryMalloc(contLen);
|
||||
if (pReq == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
(void)tSerializeSCreateDropMQSNodeReq(pReq, contLen, &dropReq);
|
||||
|
@ -380,7 +380,7 @@ static int32_t mndSetDropSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SSn
|
|||
int32_t contLen = tSerializeSCreateDropMQSNodeReq(NULL, 0, &dropReq);
|
||||
void *pReq = taosMemoryMalloc(contLen);
|
||||
if (pReq == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
(void)tSerializeSCreateDropMQSNodeReq(pReq, contLen, &dropReq);
|
||||
|
|
|
@ -2964,7 +2964,7 @@ static int32_t mndProcessTableMetaReq(SRpcMsg *pReq) {
|
|||
|
||||
void *pRsp = rpcMallocCont(rspLen);
|
||||
if (pRsp == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
|
@ -3015,7 +3015,7 @@ static int32_t mndProcessTableCfgReq(SRpcMsg *pReq) {
|
|||
|
||||
void *pRsp = rpcMallocCont(rspLen);
|
||||
if (pRsp == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
|
@ -3041,14 +3041,14 @@ int32_t mndValidateStbInfo(SMnode *pMnode, SSTableVersion *pStbVersions, int32_t
|
|||
SSTbHbRsp hbRsp = {0};
|
||||
hbRsp.pMetaRsp = taosArrayInit(numOfStbs, sizeof(STableMetaRsp));
|
||||
if (hbRsp.pMetaRsp == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
hbRsp.pIndexRsp = taosArrayInit(numOfStbs, sizeof(STableIndexRsp));
|
||||
if (NULL == hbRsp.pIndexRsp) {
|
||||
taosArrayDestroy(hbRsp.pMetaRsp);
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
|
@ -3104,7 +3104,7 @@ int32_t mndValidateStbInfo(SMnode *pMnode, SSTableVersion *pStbVersions, int32_t
|
|||
STableIndexRsp indexRsp = {0};
|
||||
indexRsp.pIndex = taosArrayInit(10, sizeof(STableIndexInfo));
|
||||
if (NULL == indexRsp.pIndex) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
|
@ -3136,7 +3136,7 @@ int32_t mndValidateStbInfo(SMnode *pMnode, SSTableVersion *pStbVersions, int32_t
|
|||
void *pRsp = taosMemoryMalloc(rspLen);
|
||||
if (pRsp == NULL) {
|
||||
tFreeSSTbHbRsp(&hbRsp);
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
|
@ -4066,20 +4066,20 @@ static int32_t mndInitDropTbsWithTsmaCtx(SMndDropTbsWithTsmaCtx **ppCtx) {
|
|||
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;
|
||||
code = terrno;
|
||||
goto _end;
|
||||
}
|
||||
|
||||
pCtx->pDbMap = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK);
|
||||
if (!pCtx->pDbMap) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _end;
|
||||
}
|
||||
pCtx->pResTbNames = taosArrayInit(TARRAY_MIN_SIZE, POINTER_BYTES);
|
||||
|
||||
pCtx->pVgMap = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK);
|
||||
if (!pCtx->pVgMap) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _end;
|
||||
}
|
||||
*ppCtx = pCtx;
|
||||
|
@ -4203,17 +4203,17 @@ static int32_t mndDropTbAdd(SMnode *pMnode, SHashObj *pVgHashMap, const SVgroupI
|
|||
reqs.info = *pVgInfo;
|
||||
reqs.req.pArray = taosArrayInit(TARRAY_MIN_SIZE, sizeof(SVDropTbReq));
|
||||
if (reqs.req.pArray == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
if (taosArrayPush(reqs.req.pArray, &req) == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
if (taosHashPut(pVgHashMap, &pVgInfo->vgId, sizeof(pVgInfo->vgId), &reqs, sizeof(reqs)) != 0) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
} else {
|
||||
if (taosArrayPush(pReqs->req.pArray, &req) == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@ -4229,7 +4229,7 @@ static int32_t mndGetDbVgInfoForTsma(SMnode *pMnode, const char *dbname, SMDropT
|
|||
|
||||
pInfo->dbInfo.dbVgInfos = taosArrayInit(pDb->cfg.numOfVgroups, sizeof(SVgroupInfo));
|
||||
if (!pInfo->dbInfo.dbVgInfos) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _end;
|
||||
}
|
||||
mndBuildDBVgroupInfo(pDb, pMnode, pInfo->dbInfo.dbVgInfos);
|
||||
|
@ -4284,11 +4284,11 @@ static int32_t mndDropTbAddTsmaResTbsForSingleVg(SMnode *pMnode, SMndDropTbsWith
|
|||
SMDropTbTsmaInfos infos = {0};
|
||||
infos.pTsmaInfos = taosArrayInit(2, sizeof(SMDropTbTsmaInfo));
|
||||
if (!infos.pTsmaInfos) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _end;
|
||||
}
|
||||
if (taosHashPut(pCtx->pTsmaMap, &pTb->suid, sizeof(pTb->suid), &infos, sizeof(infos)) != 0) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _end;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1993,7 +1993,7 @@ static int32_t mndFindChangedNodeInfo(SMnode *pMnode, const SArray *pPrevNodeLis
|
|||
|
||||
if (pInfo->pUpdateNodeList == NULL || pInfo->pDBMap == NULL) {
|
||||
mndDestroyVgroupChangeInfo(pInfo);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t numOfNodes = taosArrayGetSize(pPrevNodeList);
|
||||
|
@ -2164,7 +2164,7 @@ static int32_t refreshNodeListFromExistedStreams(SMnode *pMnode, SArray *pNodeLi
|
|||
|
||||
SHashObj *pHash = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK);
|
||||
if (pHash == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
|
@ -2215,7 +2215,7 @@ static int32_t refreshNodeListFromExistedStreams(SMnode *pMnode, SArray *pNodeLi
|
|||
if (p == NULL) {
|
||||
mError("failed to put entry into node list, nodeId:%d, code: out of memory", pEntry->nodeId);
|
||||
if (code == 0) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -349,7 +349,7 @@ int32_t mndProcessStreamHb(SRpcMsg *pReq) {
|
|||
if (pFailedChkpt == NULL || pOrphanTasks == NULL) {
|
||||
taosArrayDestroy(pFailedChkpt);
|
||||
taosArrayDestroy(pOrphanTasks);
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
|
||||
streamMutexLock(&execInfo.lock);
|
||||
|
|
|
@ -201,7 +201,7 @@ static int32_t mndGetOrCreateRebSub(SHashObj *pHash, const char *key, SMqRebInfo
|
|||
if (pRebInfo == NULL) {
|
||||
pRebInfo = tNewSMqRebSubscribe(key);
|
||||
if (pRebInfo == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto END;
|
||||
}
|
||||
code = taosHashPut(pHash, key, strlen(key) + 1, pRebInfo, sizeof(SMqRebInfo));
|
||||
|
@ -412,7 +412,7 @@ static int32_t processSubOffsetRows(SMnode *pMnode, const SMqRebInputObj *pInput
|
|||
pOutput->pSub->offsetRows = taosArrayInit(4, sizeof(OffsetRows));
|
||||
if(pOutput->pSub->offsetRows == NULL) {
|
||||
taosRUnLockLatch(&pSub->lock);
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto END;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -546,10 +546,10 @@ int32_t mndSyncPropose(SMnode *pMnode, SSdbRaw *pRaw, int32_t transId) {
|
|||
SSyncMgmt *pMgmt = &pMnode->syncMgmt;
|
||||
|
||||
SRpcMsg req = {.msgType = TDMT_MND_APPLY_MSG, .contLen = sdbGetRawTotalSize(pRaw)};
|
||||
if (req.contLen <= 0) return TSDB_CODE_OUT_OF_MEMORY;
|
||||
if (req.contLen <= 0) return terrno;
|
||||
|
||||
req.pCont = rpcMallocCont(req.contLen);
|
||||
if (req.pCont == NULL) return TSDB_CODE_OUT_OF_MEMORY;
|
||||
if (req.pCont == NULL) return terrno;
|
||||
memcpy(req.pCont, pRaw, req.contLen);
|
||||
|
||||
(void)taosThreadMutexLock(&pMgmt->lock);
|
||||
|
|
|
@ -64,6 +64,8 @@ static int32_t mndProcessKillTransReq(SRpcMsg *pReq);
|
|||
static int32_t mndRetrieveTrans(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows);
|
||||
static void mndCancelGetNextTrans(SMnode *pMnode, void *pIter);
|
||||
|
||||
static int32_t tsMaxTransId = 0;
|
||||
|
||||
int32_t mndInitTrans(SMnode *pMnode) {
|
||||
SSdbTable table = {
|
||||
.sdbType = SDB_TRANS,
|
||||
|
@ -602,7 +604,10 @@ STrans *mndTransCreate(SMnode *pMnode, ETrnPolicy policy, ETrnConflct conflict,
|
|||
tstrncpy(pTrans->opername, opername, TSDB_TRANS_OPER_LEN);
|
||||
}
|
||||
|
||||
pTrans->id = sdbGetMaxId(pMnode->pSdb, SDB_TRANS);
|
||||
int32_t sdbMaxId = sdbGetMaxId(pMnode->pSdb, SDB_TRANS);
|
||||
sdbReadLock(pMnode->pSdb, SDB_TRANS);
|
||||
pTrans->id = TMAX(sdbMaxId, tsMaxTransId + 1);
|
||||
sdbUnLock(pMnode->pSdb, SDB_TRANS);
|
||||
pTrans->stage = TRN_STAGE_PREPARE;
|
||||
pTrans->policy = policy;
|
||||
pTrans->conflict = conflict;
|
||||
|
@ -669,7 +674,7 @@ static int32_t mndTransAppendAction(SArray *pArray, STransAction *pAction) {
|
|||
|
||||
void *ptr = taosArrayPush(pArray, pAction);
|
||||
if (ptr == NULL) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -1027,6 +1032,9 @@ int32_t mndTransPrepare(SMnode *pMnode, STrans *pTrans) {
|
|||
mInfo("trans:%d, prepare transaction", pTrans->id);
|
||||
if ((code = mndTransSync(pMnode, pTrans)) != 0) {
|
||||
mError("trans:%d, failed to prepare since %s", pTrans->id, tstrerror(code));
|
||||
sdbWriteLock(pMnode->pSdb, SDB_TRANS);
|
||||
tsMaxTransId = TMAX(pTrans->id, tsMaxTransId);
|
||||
sdbUnLock(pMnode->pSdb, SDB_TRANS);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
mInfo("trans:%d, prepare finished", pTrans->id);
|
||||
|
|
|
@ -139,7 +139,7 @@ const static SIpV4Range defaultIpRange = {.ip = 16777343, .mask = 32};
|
|||
static int32_t ipWhiteMgtInit() {
|
||||
ipWhiteMgt.pIpWhiteTab = taosHashInit(8, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), 1, HASH_ENTRY_LOCK);
|
||||
if (ipWhiteMgt.pIpWhiteTab == NULL) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
ipWhiteMgt.ver = 0;
|
||||
(void)taosThreadRwlockInit(&ipWhiteMgt.rw, NULL);
|
||||
|
@ -558,11 +558,11 @@ int32_t mndFetchAllIpWhite(SMnode *pMnode, SHashObj **ppIpWhiteTab) {
|
|||
|
||||
pIpWhiteTab = taosHashInit(8, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), 1, HASH_ENTRY_LOCK);
|
||||
if (pIpWhiteTab == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _OVER);
|
||||
}
|
||||
pUserNames = taosArrayInit(8, sizeof(void *));
|
||||
if (pUserNames == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _OVER);
|
||||
}
|
||||
|
||||
while (1) {
|
||||
|
@ -593,7 +593,7 @@ int32_t mndFetchAllIpWhite(SMnode *pMnode, SHashObj **ppIpWhiteTab) {
|
|||
taosMemoryFree(name);
|
||||
sdbRelease(pSdb, pUser);
|
||||
sdbCancelFetch(pSdb, pIter);
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _OVER);
|
||||
}
|
||||
|
||||
sdbRelease(pSdb, pUser);
|
||||
|
@ -614,7 +614,7 @@ int32_t mndFetchAllIpWhite(SMnode *pMnode, SHashObj **ppIpWhiteTab) {
|
|||
}
|
||||
if (taosArrayPush(pUserNames, &name) == NULL) {
|
||||
taosMemoryFree(name);
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _OVER);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1011,7 +1011,7 @@ SSdbRaw *mndUserActionEncode(SUserObj *pUser) {
|
|||
|
||||
pRaw = sdbAllocRaw(SDB_USER, USER_VER_NUMBER, size);
|
||||
if (pRaw == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _OVER);
|
||||
}
|
||||
|
||||
int32_t dataPos = 0;
|
||||
|
@ -1155,7 +1155,7 @@ SSdbRaw *mndUserActionEncode(SUserObj *pUser) {
|
|||
int32_t num = pUser->pIpWhiteList->num;
|
||||
int32_t tlen = sizeof(SIpWhiteList) + num * sizeof(SIpV4Range) + 4;
|
||||
if ((buf = taosMemoryCalloc(1, tlen)) == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _OVER);
|
||||
TAOS_CHECK_GOTO(terrno, NULL, _OVER);
|
||||
}
|
||||
int32_t len = 0;
|
||||
TAOS_CHECK_GOTO(tSerializeIpWhiteList(buf, tlen, pUser->pIpWhiteList, &len), &lino, _OVER);
|
||||
|
@ -1201,12 +1201,12 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) {
|
|||
|
||||
pRow = sdbAllocRow(sizeof(SUserObj));
|
||||
if (pRow == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _OVER);
|
||||
}
|
||||
|
||||
pUser = sdbGetRowObj(pRow);
|
||||
if (pUser == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _OVER);
|
||||
}
|
||||
|
||||
int32_t dataPos = 0;
|
||||
|
@ -1239,7 +1239,7 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) {
|
|||
taosHashInit(numOfWriteDbs, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
|
||||
pUser->topics = taosHashInit(numOfTopics, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
|
||||
if (pUser->readDbs == NULL || pUser->writeDbs == NULL || pUser->topics == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _OVER);
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
|
@ -1302,7 +1302,7 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) {
|
|||
|
||||
if (pUser->readTbs == NULL || pUser->writeTbs == NULL || pUser->alterTbs == NULL || pUser->readViews == NULL ||
|
||||
pUser->writeViews == NULL || pUser->alterViews == NULL || pUser->useDbs == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _OVER);
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
|
@ -1312,7 +1312,7 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) {
|
|||
|
||||
TAOS_MEMORY_REALLOC(key, keyLen * sizeof(char));
|
||||
if (key == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _OVER);
|
||||
}
|
||||
(void)memset(key, 0, keyLen);
|
||||
SDB_GET_BINARY(pRaw, dataPos, key, keyLen, _OVER);
|
||||
|
@ -1321,7 +1321,7 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) {
|
|||
SDB_GET_INT32(pRaw, dataPos, &valuelen, _OVER);
|
||||
TAOS_MEMORY_REALLOC(value, valuelen * sizeof(char));
|
||||
if (value == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _OVER);
|
||||
}
|
||||
(void)memset(value, 0, valuelen);
|
||||
SDB_GET_BINARY(pRaw, dataPos, value, valuelen, _OVER)
|
||||
|
@ -1335,7 +1335,7 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) {
|
|||
|
||||
TAOS_MEMORY_REALLOC(key, keyLen * sizeof(char));
|
||||
if (key == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _OVER);
|
||||
}
|
||||
(void)memset(key, 0, keyLen);
|
||||
SDB_GET_BINARY(pRaw, dataPos, key, keyLen, _OVER);
|
||||
|
@ -1344,7 +1344,7 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) {
|
|||
SDB_GET_INT32(pRaw, dataPos, &valuelen, _OVER);
|
||||
TAOS_MEMORY_REALLOC(value, valuelen * sizeof(char));
|
||||
if (value == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _OVER);
|
||||
}
|
||||
(void)memset(value, 0, valuelen);
|
||||
SDB_GET_BINARY(pRaw, dataPos, value, valuelen, _OVER)
|
||||
|
@ -1359,7 +1359,7 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) {
|
|||
|
||||
TAOS_MEMORY_REALLOC(key, keyLen * sizeof(char));
|
||||
if (key == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _OVER);
|
||||
}
|
||||
(void)memset(key, 0, keyLen);
|
||||
SDB_GET_BINARY(pRaw, dataPos, key, keyLen, _OVER);
|
||||
|
@ -1368,7 +1368,7 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) {
|
|||
SDB_GET_INT32(pRaw, dataPos, &valuelen, _OVER);
|
||||
TAOS_MEMORY_REALLOC(value, valuelen * sizeof(char));
|
||||
if (value == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _OVER);
|
||||
}
|
||||
(void)memset(value, 0, valuelen);
|
||||
SDB_GET_BINARY(pRaw, dataPos, value, valuelen, _OVER)
|
||||
|
@ -1382,7 +1382,7 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) {
|
|||
|
||||
TAOS_MEMORY_REALLOC(key, keyLen * sizeof(char));
|
||||
if (key == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _OVER);
|
||||
}
|
||||
(void)memset(key, 0, keyLen);
|
||||
SDB_GET_BINARY(pRaw, dataPos, key, keyLen, _OVER);
|
||||
|
@ -1391,7 +1391,7 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) {
|
|||
SDB_GET_INT32(pRaw, dataPos, &valuelen, _OVER);
|
||||
TAOS_MEMORY_REALLOC(value, valuelen * sizeof(char));
|
||||
if (value == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _OVER);
|
||||
}
|
||||
(void)memset(value, 0, valuelen);
|
||||
SDB_GET_BINARY(pRaw, dataPos, value, valuelen, _OVER)
|
||||
|
@ -1405,7 +1405,7 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) {
|
|||
|
||||
TAOS_MEMORY_REALLOC(key, keyLen * sizeof(char));
|
||||
if (key == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _OVER);
|
||||
}
|
||||
(void)memset(key, 0, keyLen);
|
||||
SDB_GET_BINARY(pRaw, dataPos, key, keyLen, _OVER);
|
||||
|
@ -1414,7 +1414,7 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) {
|
|||
SDB_GET_INT32(pRaw, dataPos, &valuelen, _OVER);
|
||||
TAOS_MEMORY_REALLOC(value, valuelen * sizeof(char));
|
||||
if (value == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _OVER);
|
||||
}
|
||||
(void)memset(value, 0, valuelen);
|
||||
SDB_GET_BINARY(pRaw, dataPos, value, valuelen, _OVER)
|
||||
|
@ -1428,7 +1428,7 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) {
|
|||
|
||||
TAOS_MEMORY_REALLOC(key, keyLen * sizeof(char));
|
||||
if (key == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _OVER);
|
||||
}
|
||||
(void)memset(key, 0, keyLen);
|
||||
SDB_GET_BINARY(pRaw, dataPos, key, keyLen, _OVER);
|
||||
|
@ -1437,7 +1437,7 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) {
|
|||
SDB_GET_INT32(pRaw, dataPos, &valuelen, _OVER);
|
||||
TAOS_MEMORY_REALLOC(value, valuelen * sizeof(char));
|
||||
if (value == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _OVER);
|
||||
}
|
||||
(void)memset(value, 0, valuelen);
|
||||
SDB_GET_BINARY(pRaw, dataPos, value, valuelen, _OVER)
|
||||
|
@ -1452,7 +1452,7 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) {
|
|||
|
||||
TAOS_MEMORY_REALLOC(key, keyLen * sizeof(char));
|
||||
if (key == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _OVER);
|
||||
}
|
||||
(void)memset(key, 0, keyLen);
|
||||
SDB_GET_BINARY(pRaw, dataPos, key, keyLen, _OVER);
|
||||
|
@ -1470,7 +1470,7 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) {
|
|||
|
||||
TAOS_MEMORY_REALLOC(key, len);
|
||||
if (key == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _OVER);
|
||||
}
|
||||
SDB_GET_BINARY(pRaw, dataPos, key, len, _OVER);
|
||||
|
||||
|
@ -1535,7 +1535,7 @@ int32_t mndDupTableHash(SHashObj *pOld, SHashObj **ppNew) {
|
|||
*ppNew =
|
||||
taosHashInit(taosHashGetSize(pOld), taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
|
||||
if (*ppNew == NULL) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
|
||||
char *tb = taosHashIterate(pOld, NULL);
|
||||
|
@ -1560,7 +1560,7 @@ int32_t mndDupUseDbHash(SHashObj *pOld, SHashObj **ppNew) {
|
|||
*ppNew =
|
||||
taosHashInit(taosHashGetSize(pOld), taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
|
||||
if (*ppNew == NULL) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
|
||||
int32_t *db = taosHashIterate(pOld, NULL);
|
||||
|
@ -1661,7 +1661,7 @@ static int32_t mndUserActionUpdate(SSdb *pSdb, SUserObj *pOld, SUserObj *pNew) {
|
|||
TAOS_MEMORY_REALLOC(pOld->pIpWhiteList, sz);
|
||||
if (pOld->pIpWhiteList == NULL) {
|
||||
taosWUnLockLatch(&pOld->lock);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
(void)memcpy(pOld->pIpWhiteList, pNew->pIpWhiteList, sz);
|
||||
pOld->ipWhiteListVer = pNew->ipWhiteListVer;
|
||||
|
@ -1715,7 +1715,7 @@ static int32_t mndCreateUser(SMnode *pMnode, char *acct, SCreateUserReq *pCreate
|
|||
} else {
|
||||
SHashObj *pUniqueTab = taosHashInit(64, MurmurHash3_32, true, HASH_NO_LOCK);
|
||||
if (pUniqueTab == NULL) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
int32_t dummpy = 0;
|
||||
for (int i = 0; i < pCreate->numIpRanges; i++) {
|
||||
|
@ -1764,7 +1764,7 @@ static int32_t mndCreateUser(SMnode *pMnode, char *acct, SCreateUserReq *pCreate
|
|||
if (pTrans == NULL) {
|
||||
mError("user:%s, failed to create since %s", pCreate->user, terrstr());
|
||||
taosMemoryFree(userObj.pIpWhiteList);
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _OVER);
|
||||
}
|
||||
mInfo("trans:%d, used to create user:%s", pTrans->id, pCreate->user);
|
||||
|
||||
|
@ -1905,7 +1905,7 @@ int32_t mndProcessGetUserWhiteListReq(SRpcMsg *pReq) {
|
|||
}
|
||||
pRsp = rpcMallocCont(contLen);
|
||||
if (pRsp == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _OVER);
|
||||
}
|
||||
|
||||
contLen = tSerializeSGetUserWhiteListRsp(pRsp, contLen, &wlRsp);
|
||||
|
@ -1952,7 +1952,7 @@ int32_t mndProcesSRetrieveIpWhiteReq(SRpcMsg *pReq) {
|
|||
|
||||
pRsp = rpcMallocCont(len);
|
||||
if (!pRsp) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _OVER);
|
||||
}
|
||||
len = tSerializeSUpdateIpWhite(pRsp, len, &ipWhite);
|
||||
if (len < 0) {
|
||||
|
@ -2579,7 +2579,7 @@ static int32_t mndProcessGetUserAuthReq(SRpcMsg *pReq) {
|
|||
}
|
||||
pRsp = rpcMallocCont(contLen);
|
||||
if (pRsp == NULL) {
|
||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_CHECK_EXIT(terrno);
|
||||
}
|
||||
|
||||
contLen = tSerializeSGetUserAuthRsp(pRsp, contLen, &authRsp);
|
||||
|
@ -2655,7 +2655,7 @@ static int32_t mndRetrieveUsers(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl
|
|||
TAOS_MEMORY_REALLOC(varstr, VARSTR_HEADER_SIZE + tlen);
|
||||
if (varstr == NULL) {
|
||||
sdbRelease(pSdb, pUser);
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||
}
|
||||
varDataSetLen(varstr, tlen);
|
||||
(void)memcpy(varDataVal(varstr), buf, tlen);
|
||||
|
@ -2820,12 +2820,12 @@ static int32_t mndLoopHash(SHashObj *hash, char *priType, SSDataBlock *pBlock, i
|
|||
if (bufSz < 5) bufSz = 5;
|
||||
TAOS_MEMORY_REALLOC(*sql, bufSz + 1);
|
||||
if (*sql == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
TAOS_MEMORY_REALLOC(*condition, TSDB_PRIVILEDGE_CONDITION_LEN + VARSTR_HEADER_SIZE);
|
||||
if ((*condition) == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
|
@ -2852,7 +2852,7 @@ static int32_t mndLoopHash(SHashObj *hash, char *priType, SSDataBlock *pBlock, i
|
|||
} else {
|
||||
TAOS_MEMORY_REALLOC(*condition, TSDB_PRIVILEDGE_CONDITION_LEN + VARSTR_HEADER_SIZE);
|
||||
if ((*condition) == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
STR_WITH_MAXSIZE_TO_VARSTR((*condition), "", pShow->pMeta->pSchemas[cols].bytes);
|
||||
|
@ -2952,7 +2952,7 @@ static int32_t mndRetrievePrivileges(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock
|
|||
TAOS_MEMORY_REALLOC(condition, TSDB_PRIVILEDGE_CONDITION_LEN + VARSTR_HEADER_SIZE);
|
||||
if (condition == NULL) {
|
||||
sdbRelease(pSdb, pUser);
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||
}
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(condition, "", pShow->pMeta->pSchemas[cols].bytes);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
|
@ -2995,7 +2995,7 @@ static int32_t mndRetrievePrivileges(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock
|
|||
TAOS_MEMORY_REALLOC(condition, TSDB_PRIVILEDGE_CONDITION_LEN + VARSTR_HEADER_SIZE);
|
||||
if (condition == NULL) {
|
||||
sdbRelease(pSdb, pUser);
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||
}
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(condition, "", pShow->pMeta->pSchemas[cols].bytes);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
|
@ -3039,7 +3039,7 @@ static int32_t mndRetrievePrivileges(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock
|
|||
TAOS_MEMORY_REALLOC(condition, TSDB_PRIVILEDGE_CONDITION_LEN + VARSTR_HEADER_SIZE);
|
||||
if (condition == NULL) {
|
||||
sdbRelease(pSdb, pUser);
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||
}
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(condition, "", pShow->pMeta->pSchemas[cols].bytes);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
|
@ -3093,7 +3093,7 @@ static int32_t mndRetrievePrivileges(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock
|
|||
TAOS_MEMORY_REALLOC(condition, TSDB_PRIVILEDGE_CONDITION_LEN + VARSTR_HEADER_SIZE);
|
||||
if (condition == NULL) {
|
||||
sdbRelease(pSdb, pUser);
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||
}
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(condition, "", pShow->pMeta->pSchemas[cols].bytes);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
|
@ -3137,7 +3137,7 @@ int32_t mndValidateUserAuthInfo(SMnode *pMnode, SUserAuthVersion *pUsers, int32_
|
|||
|
||||
batchRsp.pArray = taosArrayInit(numOfUses, sizeof(SGetUserAuthRsp));
|
||||
if (batchRsp.pArray == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _OVER);
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < numOfUses; ++i) {
|
||||
|
@ -3169,7 +3169,7 @@ int32_t mndValidateUserAuthInfo(SMnode *pMnode, SUserAuthVersion *pUsers, int32_
|
|||
}
|
||||
|
||||
if (!(taosArrayPush(batchRsp.pArray, &rsp))) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
mndReleaseUser(pMnode, pUser);
|
||||
tFreeSGetUserAuthRsp(&rsp);
|
||||
TAOS_CHECK_GOTO(code, &lino, _OVER);
|
||||
|
@ -3191,7 +3191,7 @@ int32_t mndValidateUserAuthInfo(SMnode *pMnode, SUserAuthVersion *pUsers, int32_
|
|||
}
|
||||
pRsp = taosMemoryMalloc(rspLen);
|
||||
if (pRsp == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER);
|
||||
TAOS_CHECK_GOTO(terrno, &lino, _OVER);
|
||||
}
|
||||
rspLen = tSerializeSUserAuthBatchRsp(pRsp, rspLen, &batchRsp);
|
||||
if (rspLen < 0) {
|
||||
|
|
|
@ -1445,7 +1445,7 @@ int32_t mndAddAlterVnodeConfirmAction(SMnode *pMnode, STrans *pTrans, SDbObj *pD
|
|||
int32_t contLen = sizeof(SMsgHead);
|
||||
SMsgHead *pHead = taosMemoryMalloc(contLen);
|
||||
if (pHead == NULL) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
|
||||
pHead->contLen = htonl(contLen);
|
||||
|
@ -1484,7 +1484,7 @@ int32_t mndAddChangeConfigAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SV
|
|||
SMsgHead *pHead = taosMemoryMalloc(totallen);
|
||||
if (pHead == NULL) {
|
||||
taosMemoryFree(pReq);
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
|
||||
pHead->contLen = htonl(totallen);
|
||||
|
@ -2847,8 +2847,8 @@ int32_t mndBuildRaftAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pO
|
|||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
int32_t mndBuildRestoreAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *db, SVgObj *pVgroup,
|
||||
SDnodeObj *pDnode) {
|
||||
int32_t mndBuildRestoreAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *db, SVgObj *pVgroup, SDnodeObj *pDnode,
|
||||
SDnodeObj *pAnotherDnode) {
|
||||
int32_t code = 0;
|
||||
SVgObj newVgroup = {0};
|
||||
memcpy(&newVgroup, pVgroup, sizeof(SVgObj));
|
||||
|
@ -2864,7 +2864,33 @@ int32_t mndBuildRestoreAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj
|
|||
}
|
||||
}
|
||||
TAOS_CHECK_RETURN(mndAddCreateVnodeAction(pMnode, pTrans, db, &newVgroup, &newVgroup.vnodeGid[selected]));
|
||||
} else if (newVgroup.replica == 2 || newVgroup.replica == 3) {
|
||||
} else if (newVgroup.replica == 2) {
|
||||
for (int i = 0; i < newVgroup.replica; i++) {
|
||||
if (newVgroup.vnodeGid[i].dnodeId == pDnode->id) {
|
||||
newVgroup.vnodeGid[i].nodeRole = TAOS_SYNC_ROLE_LEARNER;
|
||||
} else {
|
||||
newVgroup.vnodeGid[i].nodeRole = TAOS_SYNC_ROLE_VOTER;
|
||||
}
|
||||
}
|
||||
TAOS_CHECK_RETURN(mndRestoreAddAlterVnodeTypeAction(pMnode, pTrans, db, &newVgroup, pAnotherDnode));
|
||||
|
||||
for (int i = 0; i < newVgroup.replica; i++) {
|
||||
if (newVgroup.vnodeGid[i].dnodeId == pDnode->id) {
|
||||
newVgroup.vnodeGid[i].nodeRole = TAOS_SYNC_ROLE_LEARNER;
|
||||
} else {
|
||||
newVgroup.vnodeGid[i].nodeRole = TAOS_SYNC_ROLE_VOTER;
|
||||
}
|
||||
}
|
||||
TAOS_CHECK_RETURN(mndRestoreAddCreateVnodeAction(pMnode, pTrans, db, &newVgroup, pDnode));
|
||||
|
||||
for (int i = 0; i < newVgroup.replica; i++) {
|
||||
newVgroup.vnodeGid[i].nodeRole = TAOS_SYNC_ROLE_VOTER;
|
||||
if (newVgroup.vnodeGid[i].dnodeId == pDnode->id) {
|
||||
}
|
||||
}
|
||||
TAOS_CHECK_RETURN(mndRestoreAddAlterVnodeTypeAction(pMnode, pTrans, db, &newVgroup, pDnode));
|
||||
TAOS_CHECK_RETURN(mndRestoreAddAlterVnodeTypeAction(pMnode, pTrans, db, &newVgroup, pAnotherDnode));
|
||||
} else if (newVgroup.replica == 3) {
|
||||
for (int i = 0; i < newVgroup.replica; i++) {
|
||||
if (newVgroup.vnodeGid[i].dnodeId == pDnode->id) {
|
||||
newVgroup.vnodeGid[i].nodeRole = TAOS_SYNC_ROLE_LEARNER;
|
||||
|
@ -2881,7 +2907,6 @@ int32_t mndBuildRestoreAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj
|
|||
}
|
||||
TAOS_CHECK_RETURN(mndRestoreAddAlterVnodeTypeAction(pMnode, pTrans, db, &newVgroup, pDnode));
|
||||
}
|
||||
|
||||
SSdbRaw *pVgRaw = mndVgroupActionEncode(&newVgroup);
|
||||
if (pVgRaw == NULL) {
|
||||
code = TSDB_CODE_MND_RETURN_VALUE_NULL;
|
||||
|
@ -3067,7 +3092,7 @@ int32_t mndSplitVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SVgObj *pVgro
|
|||
if (dbObj.cfg.pRetensions != NULL) {
|
||||
dbObj.cfg.pRetensions = taosArrayDup(pDb->cfg.pRetensions, NULL);
|
||||
if (dbObj.cfg.pRetensions == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _OVER;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -140,7 +140,7 @@ int32_t sdbSetTable(SSdb *pSdb, SSdbTable table) {
|
|||
|
||||
SHashObj *hash = taosHashInit(64, taosGetDefaultHashFunction(hashType), true, HASH_ENTRY_LOCK);
|
||||
if (hash == NULL) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
|
||||
pSdb->maxId[sdbType] = 0;
|
||||
|
|
|
@ -226,7 +226,7 @@ static int32_t sdbReadFileImp(SSdb *pSdb) {
|
|||
|
||||
SSdbRaw *pRaw = taosMemoryMalloc(bufLen + 100);
|
||||
if (pRaw == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
mError("failed read sdb file since %s", tstrerror(code));
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
@ -278,7 +278,7 @@ static int32_t sdbReadFileImp(SSdb *pSdb) {
|
|||
bufLen = pRaw->dataLen * 2;
|
||||
SSdbRaw *pNewRaw = taosMemoryMalloc(bufLen + 100);
|
||||
if (pNewRaw == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
mError("failed read sdb file since malloc new sdbRaw size:%d failed", bufLen);
|
||||
goto _OVER;
|
||||
}
|
||||
|
@ -306,7 +306,7 @@ static int32_t sdbReadFileImp(SSdb *pSdb) {
|
|||
|
||||
char *plantContent = taosMemoryMalloc(ENCRYPTED_LEN(pRaw->dataLen));
|
||||
if (plantContent == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
|
@ -444,7 +444,7 @@ static int32_t sdbWriteFileImp(SSdb *pSdb, int32_t skip_type) {
|
|||
newDataLen = ENCRYPTED_LEN(pRaw->dataLen);
|
||||
newData = taosMemoryMalloc(newDataLen);
|
||||
if (newData == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
taosHashCancelIterate(hash, ppRow);
|
||||
sdbFreeRaw(pRaw);
|
||||
break;
|
||||
|
|
|
@ -165,7 +165,6 @@ static int32_t sdbInsertRow(SSdb *pSdb, SHashObj *hash, SSdbRaw *pRaw, SSdbRow *
|
|||
if (taosHashPut(hash, pRow->pObj, keySize, &pRow, sizeof(void *)) != 0) {
|
||||
sdbUnLock(pSdb, type);
|
||||
sdbFreeRow(pSdb, pRow, false);
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
|
|
|
@ -342,7 +342,6 @@ typedef struct {
|
|||
rocksdb_writeoptions_t *writeoptions;
|
||||
rocksdb_readoptions_t *readoptions;
|
||||
rocksdb_writebatch_t *writebatch;
|
||||
rocksdb_writebatch_t *rwritebatch;
|
||||
STSchema *pTSchema;
|
||||
} SRocksCache;
|
||||
|
||||
|
@ -363,7 +362,6 @@ struct STsdb {
|
|||
SMemTable *imem;
|
||||
STsdbFS fs; // old
|
||||
SLRUCache *lruCache;
|
||||
SCacheFlushState flushState;
|
||||
TdThreadMutex lruMutex;
|
||||
SLRUCache *biCache;
|
||||
TdThreadMutex biMutex;
|
||||
|
|
|
@ -232,7 +232,7 @@ int metaDelJsonVarFromIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const SSche
|
|||
}
|
||||
int32_t len = taosUcs4ToMbs((TdUcs4 *)pTagVal->pData, pTagVal->nData, val + VARSTR_HEADER_SIZE);
|
||||
if (len < 0) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _exception);
|
||||
TAOS_CHECK_GOTO(len, NULL, _exception);
|
||||
}
|
||||
memcpy(val, (uint16_t *)&len, VARSTR_HEADER_SIZE);
|
||||
type = TSDB_DATA_TYPE_VARCHAR;
|
||||
|
|
|
@ -586,6 +586,10 @@ int32_t tqStreamTaskProcessDeployReq(SStreamMeta* pMeta, SMsgCb* cb, int64_t sve
|
|||
bool isLeader, bool restored) {
|
||||
int32_t code = 0;
|
||||
int32_t vgId = pMeta->vgId;
|
||||
int32_t numOfTasks = 0;
|
||||
int32_t taskId = -1;
|
||||
int64_t streamId = -1;
|
||||
bool added = false;
|
||||
|
||||
if (tsDisableStream) {
|
||||
tqInfo("vgId:%d stream disabled, not deploy stream tasks", vgId);
|
||||
|
@ -613,13 +617,12 @@ int32_t tqStreamTaskProcessDeployReq(SStreamMeta* pMeta, SMsgCb* cb, int64_t sve
|
|||
}
|
||||
|
||||
// 2.save task, use the latest commit version as the initial start version of stream task.
|
||||
int32_t taskId = pTask->id.taskId;
|
||||
int64_t streamId = pTask->id.streamId;
|
||||
bool added = false;
|
||||
taskId = pTask->id.taskId;
|
||||
streamId = pTask->id.streamId;
|
||||
|
||||
streamMetaWLock(pMeta);
|
||||
code = streamMetaRegisterTask(pMeta, sversion, pTask, &added);
|
||||
int32_t numOfTasks = streamMetaGetNumOfTasks(pMeta);
|
||||
numOfTasks = streamMetaGetNumOfTasks(pMeta);
|
||||
streamMetaWUnLock(pMeta);
|
||||
|
||||
if (code < 0) {
|
||||
|
@ -654,7 +657,7 @@ int32_t tqStreamTaskProcessDeployReq(SStreamMeta* pMeta, SMsgCb* cb, int64_t sve
|
|||
tqDebug("vgId:%d not leader, not launch stream task s-task:0x%x", vgId, taskId);
|
||||
}
|
||||
} else {
|
||||
tqWarn("vgId:%d failed to add s-task:0x%x, since already exists in meta store", vgId, taskId);
|
||||
tqWarn("vgId:%d failed to add s-task:0x%x, since already exists in meta store, total:%d", vgId, taskId, numOfTasks);
|
||||
tFreeStreamTask(pTask);
|
||||
}
|
||||
|
||||
|
@ -1235,6 +1238,10 @@ int32_t tqStreamTaskProcessConsenChkptIdReq(SStreamMeta* pMeta, SRpcMsg* pMsg) {
|
|||
pMeta->vgId, req.taskId);
|
||||
// ignore this code to avoid error code over write
|
||||
int32_t ret = streamMetaAddFailedTask(pMeta, req.streamId, req.taskId);
|
||||
if (ret) {
|
||||
tqError("s-task:0x%x failed add check downstream failed, core:%s", req.taskId, tstrerror(ret));
|
||||
}
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
|
|
|
@ -214,10 +214,8 @@ static int32_t tsdbOpenRocksCache(STsdb *pTsdb) {
|
|||
}
|
||||
|
||||
rocksdb_writebatch_t *writebatch = rocksdb_writebatch_create();
|
||||
rocksdb_writebatch_t *rwritebatch = rocksdb_writebatch_create();
|
||||
|
||||
pTsdb->rCache.writebatch = writebatch;
|
||||
pTsdb->rCache.rwritebatch = rwritebatch;
|
||||
pTsdb->rCache.my_comparator = cmp;
|
||||
pTsdb->rCache.options = options;
|
||||
pTsdb->rCache.writeoptions = writeoptions;
|
||||
|
@ -248,7 +246,6 @@ static void tsdbCloseRocksCache(STsdb *pTsdb) {
|
|||
rocksdb_close(pTsdb->rCache.db);
|
||||
rocksdb_flushoptions_destroy(pTsdb->rCache.flushoptions);
|
||||
rocksdb_writebatch_destroy(pTsdb->rCache.writebatch);
|
||||
rocksdb_writebatch_destroy(pTsdb->rCache.rwritebatch);
|
||||
rocksdb_readoptions_destroy(pTsdb->rCache.readoptions);
|
||||
rocksdb_writeoptions_destroy(pTsdb->rCache.writeoptions);
|
||||
rocksdb_options_destroy(pTsdb->rCache.options);
|
||||
|
@ -258,8 +255,8 @@ static void tsdbCloseRocksCache(STsdb *pTsdb) {
|
|||
taosMemoryFree(pTsdb->rCache.pTSchema);
|
||||
}
|
||||
|
||||
static void rocksMayWrite(STsdb *pTsdb, bool force, bool read) {
|
||||
rocksdb_writebatch_t *wb = read ? pTsdb->rCache.rwritebatch : pTsdb->rCache.writebatch;
|
||||
static void rocksMayWrite(STsdb *pTsdb, bool force) {
|
||||
rocksdb_writebatch_t *wb = pTsdb->rCache.writebatch;
|
||||
|
||||
int count = rocksdb_writebatch_count(wb);
|
||||
if ((force && count > 0) || count >= ROCKS_BATCH_SIZE) {
|
||||
|
@ -270,7 +267,6 @@ static void rocksMayWrite(STsdb *pTsdb, bool force, bool read) {
|
|||
tsdbError("vgId:%d, %s failed at line %d, count: %d since %s", TD_VID(pTsdb->pVnode), __func__, __LINE__, count,
|
||||
err);
|
||||
rocksdb_free(err);
|
||||
// pTsdb->flushState.flush_count = 0;
|
||||
}
|
||||
|
||||
rocksdb_writebatch_clear(wb);
|
||||
|
@ -459,47 +455,23 @@ static int32_t tsdbCacheSerialize(SLastCol *pLastCol, char **value, size_t *size
|
|||
TAOS_RETURN(TSDB_CODE_SUCCESS);
|
||||
}
|
||||
|
||||
static void tsdbCachePutBatch(SLastCol *pLastCol, const void *key, size_t klen, SCacheFlushState *state) {
|
||||
int32_t code = 0;
|
||||
STsdb *pTsdb = state->pTsdb;
|
||||
SRocksCache *rCache = &pTsdb->rCache;
|
||||
rocksdb_writebatch_t *wb = rCache->writebatch;
|
||||
char *rocks_value = NULL;
|
||||
size_t vlen = 0;
|
||||
|
||||
code = tsdbCacheSerialize(pLastCol, &rocks_value, &vlen);
|
||||
if (code) {
|
||||
tsdbError("tsdb/cache: vgId:%d, serialize failed since %s.", TD_VID(pTsdb->pVnode), tstrerror(code));
|
||||
return;
|
||||
}
|
||||
|
||||
rocksdb_writebatch_put(wb, (char *)key, klen, rocks_value, vlen);
|
||||
|
||||
taosMemoryFree(rocks_value);
|
||||
|
||||
if (++state->flush_count >= ROCKS_BATCH_SIZE) {
|
||||
char *err = NULL;
|
||||
|
||||
rocksdb_write(rCache->db, rCache->writeoptions, wb, &err);
|
||||
if (NULL != err) {
|
||||
tsdbError("vgId:%d, %s failed at line %d, count: %d since %s", TD_VID(pTsdb->pVnode), __func__, __LINE__,
|
||||
state->flush_count, err);
|
||||
rocksdb_free(err);
|
||||
}
|
||||
|
||||
rocksdb_writebatch_clear(wb);
|
||||
|
||||
state->flush_count = 0;
|
||||
}
|
||||
}
|
||||
static int32_t tsdbCachePutToRocksdb(STsdb *pTsdb, SLastKey *pLastKey, SLastCol *pLastCol);
|
||||
|
||||
int tsdbCacheFlushDirty(const void *key, size_t klen, void *value, void *ud) {
|
||||
SLastCol *pLastCol = (SLastCol *)value;
|
||||
|
||||
if (pLastCol->dirty) {
|
||||
tsdbCachePutBatch(pLastCol, key, klen, (SCacheFlushState *)ud);
|
||||
STsdb *pTsdb = (STsdb *)ud;
|
||||
|
||||
int32_t code = tsdbCachePutToRocksdb(pTsdb, (SLastKey *)key, pLastCol);
|
||||
if (code) {
|
||||
tsdbError("tsdb/cache: vgId:%d, flush dirty lru failed since %s.", TD_VID(pTsdb->pVnode), tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
||||
pLastCol->dirty = 0;
|
||||
|
||||
rocksMayWrite(pTsdb, false);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -514,10 +486,9 @@ int32_t tsdbCacheCommit(STsdb *pTsdb) {
|
|||
|
||||
(void)taosThreadMutexLock(&pTsdb->lruMutex);
|
||||
|
||||
taosLRUCacheApply(pCache, tsdbCacheFlushDirty, &pTsdb->flushState);
|
||||
taosLRUCacheApply(pCache, tsdbCacheFlushDirty, pTsdb);
|
||||
|
||||
rocksMayWrite(pTsdb, true, false);
|
||||
rocksMayWrite(pTsdb, true, true);
|
||||
rocksMayWrite(pTsdb, true);
|
||||
rocksdb_flush(pTsdb->rCache.db, pTsdb->rCache.flushoptions, &err);
|
||||
|
||||
(void)taosThreadMutexUnlock(&pTsdb->lruMutex);
|
||||
|
@ -606,7 +577,7 @@ static void tsdbCacheDeleter(const void *key, size_t klen, void *value, void *ud
|
|||
SLastCol *pLastCol = (SLastCol *)value;
|
||||
|
||||
if (pLastCol->dirty) {
|
||||
tsdbCachePutBatch(pLastCol, key, klen, (SCacheFlushState *)ud);
|
||||
(void)tsdbCacheFlushDirty(key, klen, pLastCol, ud);
|
||||
}
|
||||
|
||||
for (uint8_t i = 0; i < pLastCol->rowKey.numOfPKs; ++i) {
|
||||
|
@ -643,11 +614,11 @@ static int32_t tsdbCacheNewTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid, i
|
|||
|
||||
SLastKey *pLastKey = &(SLastKey){.lflag = lflag, .uid = uid, .cid = cid};
|
||||
LRUStatus status = taosLRUCacheInsert(pCache, pLastKey, ROCKS_KEY_LEN, pLastCol, charge, tsdbCacheDeleter, NULL,
|
||||
TAOS_LRU_PRIORITY_LOW, &pTsdb->flushState);
|
||||
TAOS_LRU_PRIORITY_LOW, pTsdb);
|
||||
if (status != TAOS_LRU_STATUS_OK) {
|
||||
tsdbError("vgId:%d, %s failed at line %d status %d.", TD_VID(pTsdb->pVnode), __func__, __LINE__, status);
|
||||
tsdbCacheFreeSLastColItem(pLastCol);
|
||||
code = TSDB_CODE_FAILED;
|
||||
pLastCol = NULL;
|
||||
}
|
||||
|
||||
_exit:
|
||||
|
@ -665,10 +636,9 @@ int32_t tsdbCacheCommitNoLock(STsdb *pTsdb) {
|
|||
SLRUCache *pCache = pTsdb->lruCache;
|
||||
rocksdb_writebatch_t *wb = pTsdb->rCache.writebatch;
|
||||
|
||||
taosLRUCacheApply(pCache, tsdbCacheFlushDirty, &pTsdb->flushState);
|
||||
taosLRUCacheApply(pCache, tsdbCacheFlushDirty, pTsdb);
|
||||
|
||||
rocksMayWrite(pTsdb, true, false);
|
||||
rocksMayWrite(pTsdb, true, true);
|
||||
rocksMayWrite(pTsdb, true);
|
||||
rocksdb_flush(pTsdb->rCache.db, pTsdb->rCache.flushoptions, &err);
|
||||
|
||||
if (NULL != err) {
|
||||
|
@ -738,6 +708,10 @@ static int32_t tsdbCacheDropTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid,
|
|||
|
||||
char **values_list = NULL;
|
||||
size_t *values_list_sizes = NULL;
|
||||
|
||||
// was written by caller
|
||||
// rocksMayWrite(pTsdb, true); // flush writebatch cache
|
||||
|
||||
TAOS_CHECK_GOTO(tsdbCacheGetValuesFromRocks(pTsdb, 2, (const char *const *)keys_list, keys_list_sizes, &values_list,
|
||||
&values_list_sizes),
|
||||
NULL, _exit);
|
||||
|
@ -862,7 +836,7 @@ int32_t tsdbCacheDropTable(STsdb *pTsdb, tb_uid_t uid, tb_uid_t suid, SSchemaWra
|
|||
taosMemoryFree(pTSchema);
|
||||
}
|
||||
|
||||
rocksMayWrite(pTsdb, true, false);
|
||||
rocksMayWrite(pTsdb, false);
|
||||
|
||||
(void)taosThreadMutexUnlock(&pTsdb->lruMutex);
|
||||
|
||||
|
@ -903,7 +877,7 @@ int32_t tsdbCacheDropSubTables(STsdb *pTsdb, SArray *uids, tb_uid_t suid) {
|
|||
|
||||
taosMemoryFree(pTSchema);
|
||||
|
||||
rocksMayWrite(pTsdb, true, false);
|
||||
rocksMayWrite(pTsdb, false);
|
||||
|
||||
(void)taosThreadMutexUnlock(&pTsdb->lruMutex);
|
||||
|
||||
|
@ -934,7 +908,7 @@ int32_t tsdbCacheDropNTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid, bool h
|
|||
|
||||
(void)tsdbCacheDropTableColumn(pTsdb, uid, cid, hasPrimayKey);
|
||||
|
||||
rocksMayWrite(pTsdb, true, false);
|
||||
rocksMayWrite(pTsdb, false);
|
||||
|
||||
(void)taosThreadMutexUnlock(&pTsdb->lruMutex);
|
||||
|
||||
|
@ -973,7 +947,7 @@ int32_t tsdbCacheDropSTableColumn(STsdb *pTsdb, SArray *uids, int16_t cid, bool
|
|||
(void)tsdbCacheDropTableColumn(pTsdb, uid, cid, hasPrimayKey);
|
||||
}
|
||||
|
||||
rocksMayWrite(pTsdb, true, false);
|
||||
rocksMayWrite(pTsdb, false);
|
||||
|
||||
(void)taosThreadMutexUnlock(&pTsdb->lruMutex);
|
||||
|
||||
|
@ -1083,11 +1057,11 @@ static int32_t tsdbCachePutToLRU(STsdb *pTsdb, SLastKey *pLastKey, SLastCol *pLa
|
|||
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);
|
||||
NULL, TAOS_LRU_PRIORITY_LOW, pTsdb);
|
||||
if (TAOS_LRU_STATUS_OK != status && TAOS_LRU_STATUS_OK_OVERWRITTEN != status) {
|
||||
tsdbError("vgId:%d, %s failed at line %d status %d.", TD_VID(pTsdb->pVnode), __func__, __LINE__, status);
|
||||
tsdbCacheFreeSLastColItem(pLRULastCol);
|
||||
code = TSDB_CODE_FAILED;
|
||||
pLRULastCol = NULL;
|
||||
}
|
||||
|
||||
_exit:
|
||||
|
@ -1177,6 +1151,8 @@ static int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, SArray
|
|||
keys_list_sizes[i] = ROCKS_KEY_LEN;
|
||||
}
|
||||
|
||||
rocksMayWrite(pTsdb, true); // flush writebatch cache
|
||||
|
||||
code = tsdbCacheGetValuesFromRocks(pTsdb, num_keys, (const char *const *)keys_list, keys_list_sizes, &values_list,
|
||||
&values_list_sizes);
|
||||
if (code) {
|
||||
|
@ -1243,7 +1219,7 @@ static int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, SArray
|
|||
taosMemoryFreeClear(pToFree);
|
||||
}
|
||||
|
||||
rocksMayWrite(pTsdb, true, false);
|
||||
rocksMayWrite(pTsdb, false);
|
||||
|
||||
taosMemoryFree(keys_list);
|
||||
taosMemoryFree(keys_list_sizes);
|
||||
|
@ -1573,32 +1549,22 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr
|
|||
}
|
||||
|
||||
LRUStatus status = taosLRUCacheInsert(pCache, &idxKey->key, ROCKS_KEY_LEN, pLastCol, charge, tsdbCacheDeleter, NULL,
|
||||
TAOS_LRU_PRIORITY_LOW, &pTsdb->flushState);
|
||||
TAOS_LRU_PRIORITY_LOW, pTsdb);
|
||||
if (TAOS_LRU_STATUS_OK != status && TAOS_LRU_STATUS_OK_OVERWRITTEN != status) {
|
||||
tsdbError("vgId:%d, %s failed at line %d status %d.", TD_VID(pTsdb->pVnode), __func__, __LINE__, status);
|
||||
tsdbCacheFreeSLastColItem(pLastCol);
|
||||
taosMemoryFree(pLastCol);
|
||||
pLastCol = NULL;
|
||||
TAOS_CHECK_EXIT(TSDB_CODE_FAILED);
|
||||
}
|
||||
|
||||
// store result back to rocks cache
|
||||
wb = pTsdb->rCache.rwritebatch;
|
||||
char *value = NULL;
|
||||
size_t vlen = 0;
|
||||
code = tsdbCacheSerialize(pLastCol, &value, &vlen);
|
||||
code = tsdbCachePutToRocksdb(pTsdb, &idxKey->key, pLastCol);
|
||||
if (code) {
|
||||
tsdbError("tsdb/cache: vgId:%d, serialize failed since %s.", TD_VID(pTsdb->pVnode), tstrerror(code));
|
||||
} else {
|
||||
SLastKey *key = &idxKey->key;
|
||||
size_t klen = ROCKS_KEY_LEN;
|
||||
rocksdb_writebatch_put(wb, (char *)key, klen, value, vlen);
|
||||
taosMemoryFree(value);
|
||||
tsdbError("vgId:%d, %s failed at line %d since %s.", TD_VID(pTsdb->pVnode), __func__, __LINE__, tstrerror(code));
|
||||
TAOS_CHECK_EXIT(code);
|
||||
}
|
||||
}
|
||||
|
||||
if (wb) {
|
||||
rocksMayWrite(pTsdb, false, true);
|
||||
}
|
||||
rocksMayWrite(pTsdb, false);
|
||||
|
||||
_exit:
|
||||
taosArrayDestroy(lastrowTmpIndexArray);
|
||||
|
@ -1638,6 +1604,8 @@ static int32_t tsdbCacheLoadFromRocks(STsdb *pTsdb, tb_uid_t uid, SArray *pLastA
|
|||
keys_list_sizes[i] = ROCKS_KEY_LEN;
|
||||
}
|
||||
|
||||
rocksMayWrite(pTsdb, true); // flush writebatch cache
|
||||
|
||||
code = tsdbCacheGetValuesFromRocks(pTsdb, num_keys, (const char *const *)keys_list, keys_list_sizes, &values_list,
|
||||
&values_list_sizes);
|
||||
if (code) {
|
||||
|
@ -1686,11 +1654,9 @@ static int32_t tsdbCacheLoadFromRocks(STsdb *pTsdb, tb_uid_t uid, SArray *pLastA
|
|||
}
|
||||
|
||||
LRUStatus status = taosLRUCacheInsert(pCache, &idxKey->key, ROCKS_KEY_LEN, pLastCol, charge, tsdbCacheDeleter,
|
||||
NULL, TAOS_LRU_PRIORITY_LOW, &pTsdb->flushState);
|
||||
NULL, TAOS_LRU_PRIORITY_LOW, pTsdb);
|
||||
if (TAOS_LRU_STATUS_OK != status && TAOS_LRU_STATUS_OK_OVERWRITTEN != status) {
|
||||
tsdbError("vgId:%d, %s failed at line %d status %d.", TD_VID(pTsdb->pVnode), __func__, __LINE__, status);
|
||||
tsdbCacheFreeSLastColItem(pLastCol);
|
||||
taosMemoryFreeClear(pLastCol);
|
||||
taosMemoryFreeClear(pToFree);
|
||||
TAOS_CHECK_EXIT(TSDB_CODE_FAILED);
|
||||
}
|
||||
|
@ -1797,6 +1763,7 @@ int32_t tsdbCacheGetBatch(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArray, SCache
|
|||
|
||||
if (remainCols && TARRAY_SIZE(remainCols) > 0) {
|
||||
(void)taosThreadMutexLock(&pTsdb->lruMutex);
|
||||
|
||||
for (int i = 0; i < TARRAY_SIZE(remainCols);) {
|
||||
SIdxKey *idxKey = &((SIdxKey *)TARRAY_DATA(remainCols))[i];
|
||||
LRUHandle *h = taosLRUCacheLookup(pCache, &idxKey->key, ROCKS_KEY_LEN);
|
||||
|
@ -1874,9 +1841,9 @@ int32_t tsdbCacheDel(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKE
|
|||
TAOS_CHECK_EXIT(code);
|
||||
} else {
|
||||
if (!remainCols) {
|
||||
remainCols = taosArrayInit(numCols * 2, sizeof(SLastKey));
|
||||
remainCols = taosArrayInit(numCols * 2, sizeof(SIdxKey));
|
||||
}
|
||||
if (!taosArrayPush(remainCols, &lastKey)) {
|
||||
if (!taosArrayPush(remainCols, &(SIdxKey){i, lastKey})) {
|
||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
||||
}
|
||||
}
|
||||
|
@ -1904,12 +1871,16 @@ int32_t tsdbCacheDel(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKE
|
|||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
((SLastKey *)key)[0] = *(SLastKey *)taosArrayGet(remainCols, i);
|
||||
SIdxKey* idxKey = taosArrayGet(remainCols, i);
|
||||
|
||||
((SLastKey *)key)[0] = idxKey->key;
|
||||
|
||||
keys_list[i] = key;
|
||||
keys_list_sizes[i] = klen;
|
||||
}
|
||||
|
||||
rocksMayWrite(pTsdb, true); // flush writebatch cache
|
||||
|
||||
TAOS_CHECK_GOTO(tsdbCacheGetValuesFromRocks(pTsdb, numKeys, (const char *const *)keys_list, keys_list_sizes,
|
||||
&values_list, &values_list_sizes),
|
||||
NULL, _exit);
|
||||
|
@ -1918,10 +1889,11 @@ int32_t tsdbCacheDel(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKE
|
|||
for (int i = 0; i < numKeys; ++i) {
|
||||
SLastCol *pLastCol = NULL;
|
||||
(void)tsdbCacheDeserialize(values_list[i], values_list_sizes[i], &pLastCol);
|
||||
SLastKey *pLastKey = (SLastKey *)keys_list[i];
|
||||
SIdxKey* idxKey = taosArrayGet(remainCols, i);
|
||||
SLastKey *pLastKey = &idxKey->key;
|
||||
if (NULL != pLastCol && (pLastCol->rowKey.ts <= eKey && pLastCol->rowKey.ts >= sKey)) {
|
||||
SLastCol noCacheCol = {.rowKey.ts = TSKEY_MIN,
|
||||
.colVal = COL_VAL_NONE(pLastKey->cid, pTSchema->columns[i].type),
|
||||
.colVal = COL_VAL_NONE(pLastKey->cid, pTSchema->columns[idxKey->idx].type),
|
||||
.cacheStatus = TSDB_LAST_CACHE_NO_CACHE};
|
||||
|
||||
if ((code = tsdbCachePutToRocksdb(pTsdb, pLastKey, &noCacheCol)) != TSDB_CODE_SUCCESS) {
|
||||
|
@ -1944,7 +1916,7 @@ int32_t tsdbCacheDel(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKE
|
|||
taosMemoryFreeClear(pLastCol);
|
||||
}
|
||||
|
||||
rocksMayWrite(pTsdb, true, false);
|
||||
rocksMayWrite(pTsdb, false);
|
||||
|
||||
_exit:
|
||||
(void)taosThreadMutexUnlock(&pTsdb->lruMutex);
|
||||
|
@ -1969,7 +1941,7 @@ _exit:
|
|||
|
||||
int32_t tsdbOpenCache(STsdb *pTsdb) {
|
||||
int32_t code = 0, lino = 0;
|
||||
size_t cfgCapacity = pTsdb->pVnode->config.cacheLastSize * 1024 * 1024;
|
||||
size_t cfgCapacity = (size_t)pTsdb->pVnode->config.cacheLastSize * 1024 * 1024;
|
||||
|
||||
SLRUCache *pCache = taosLRUCacheInit(cfgCapacity, 0, .5);
|
||||
if (pCache == NULL) {
|
||||
|
@ -1986,9 +1958,6 @@ int32_t tsdbOpenCache(STsdb *pTsdb) {
|
|||
|
||||
(void)taosThreadMutexInit(&pTsdb->lruMutex, NULL);
|
||||
|
||||
pTsdb->flushState.pTsdb = pTsdb;
|
||||
pTsdb->flushState.flush_count = 0;
|
||||
|
||||
_err:
|
||||
if (code) {
|
||||
tsdbError("tsdb/cache: vgId:%d, open failed at line %d since %s.", TD_VID(pTsdb->pVnode), lino, tstrerror(code));
|
||||
|
|
|
@ -4035,26 +4035,30 @@ int32_t doMergeRowsInBuf(SIterInfo* pIter, uint64_t uid, SRowKey* pCurKey, SArra
|
|||
return code;
|
||||
}
|
||||
|
||||
static int32_t doMergeRowsInFileBlockImpl(SBlockData* pBlockData, int32_t rowIndex, SRowKey* pKey, SRowMerger* pMerger,
|
||||
static int32_t doMergeRowsInFileBlockImpl(SBlockData* pBlockData, int32_t* rowIndex, SRowKey* pKey, SRowMerger* pMerger,
|
||||
SVersionRange* pVerRange, int32_t step) {
|
||||
while (rowIndex < pBlockData->nRow && rowIndex >= 0) {
|
||||
int32_t code = 0;
|
||||
while ((*rowIndex) < pBlockData->nRow && (*rowIndex) >= 0) {
|
||||
SRowKey cur;
|
||||
tColRowGetKey(pBlockData, rowIndex, &cur);
|
||||
tColRowGetKey(pBlockData, (*rowIndex), &cur);
|
||||
if (pkCompEx(&cur, pKey) != 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (pBlockData->aVersion[rowIndex] > pVerRange->maxVer || pBlockData->aVersion[rowIndex] < pVerRange->minVer) {
|
||||
rowIndex += step;
|
||||
if (pBlockData->aVersion[(*rowIndex)] > pVerRange->maxVer ||
|
||||
pBlockData->aVersion[(*rowIndex)] < pVerRange->minVer) {
|
||||
(*rowIndex) += step;
|
||||
continue;
|
||||
}
|
||||
|
||||
TSDBROW fRow = tsdbRowFromBlockData(pBlockData, rowIndex);
|
||||
int32_t code = tsdbRowMergerAdd(pMerger, &fRow, NULL);
|
||||
rowIndex += step;
|
||||
TSDBROW fRow = tsdbRowFromBlockData(pBlockData, (*rowIndex));
|
||||
code = tsdbRowMergerAdd(pMerger, &fRow, NULL);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
(*rowIndex) += step;
|
||||
}
|
||||
|
||||
return rowIndex;
|
||||
return code;
|
||||
}
|
||||
|
||||
typedef enum {
|
||||
|
@ -4076,7 +4080,10 @@ static int32_t checkForNeighborFileBlock(STsdbReader* pReader, STableBlockScanIn
|
|||
*state = CHECK_FILEBLOCK_QUIT;
|
||||
|
||||
if (loadNeighbor && (code == TSDB_CODE_SUCCESS)) {
|
||||
pDumpInfo->rowIndex = doMergeRowsInFileBlockImpl(pBlockData, pDumpInfo->rowIndex, pKey, pMerger, pVerRange, step);
|
||||
code = doMergeRowsInFileBlockImpl(pBlockData, &pDumpInfo->rowIndex, pKey, pMerger, pVerRange, step);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
if ((pDumpInfo->rowIndex >= pDumpInfo->totalRows && asc) || (pDumpInfo->rowIndex < 0 && !asc)) {
|
||||
*state = CHECK_FILEBLOCK_CONT;
|
||||
}
|
||||
|
@ -4096,7 +4103,10 @@ int32_t doMergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pSc
|
|||
|
||||
pDumpInfo->rowIndex += step;
|
||||
if ((pDumpInfo->rowIndex <= pBlockData->nRow - 1 && asc) || (pDumpInfo->rowIndex >= 0 && !asc)) {
|
||||
pDumpInfo->rowIndex = doMergeRowsInFileBlockImpl(pBlockData, pDumpInfo->rowIndex, pKey, pMerger, pRange, step);
|
||||
code = doMergeRowsInFileBlockImpl(pBlockData, &pDumpInfo->rowIndex, pKey, pMerger, pRange, step);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
// all rows are consumed, let's try next file block
|
||||
|
|
|
@ -706,7 +706,9 @@ void ctgProcessTimerEvent(void *param, void *tmrId) {
|
|||
int32_t code = ctgClearCacheEnqueue(NULL, true, false, false, false);
|
||||
if (code) {
|
||||
qError("clear cache enqueue failed, error:%s", tstrerror(code));
|
||||
(void)taosTmrReset(ctgProcessTimerEvent, CTG_DEFAULT_CACHE_MON_MSEC, NULL, gCtgMgmt.timer, &gCtgMgmt.cacheTimer);
|
||||
if (taosTmrReset(ctgProcessTimerEvent, CTG_DEFAULT_CACHE_MON_MSEC, NULL, gCtgMgmt.timer, &gCtgMgmt.cacheTimer)) {
|
||||
qError("reset catalog cache monitor timer error, timer stoppped");
|
||||
}
|
||||
}
|
||||
|
||||
goto _return;
|
||||
|
@ -714,7 +716,9 @@ void ctgProcessTimerEvent(void *param, void *tmrId) {
|
|||
}
|
||||
|
||||
qTrace("reset catalog timer");
|
||||
(void)taosTmrReset(ctgProcessTimerEvent, CTG_DEFAULT_CACHE_MON_MSEC, NULL, gCtgMgmt.timer, &gCtgMgmt.cacheTimer);
|
||||
if (taosTmrReset(ctgProcessTimerEvent, CTG_DEFAULT_CACHE_MON_MSEC, NULL, gCtgMgmt.timer, &gCtgMgmt.cacheTimer)) {
|
||||
qError("reset catalog cache monitor timer error, timer stoppped");
|
||||
}
|
||||
|
||||
_return:
|
||||
|
||||
|
@ -849,7 +853,7 @@ int32_t catalogInit(SCatalogCfg* cfg) {
|
|||
}
|
||||
|
||||
if (tsem_init(&gCtgMgmt.queue.reqSem, 0, 0)) {
|
||||
qError("tsem_init failed, error:%s", tstrerror(TAOS_SYSTEM_ERROR(errno)));
|
||||
qError("tsem_init failed, terror:%s", tstrerror(terrno));
|
||||
CTG_ERR_RET(TSDB_CODE_CTG_SYS_ERROR);
|
||||
}
|
||||
|
||||
|
@ -1517,10 +1521,16 @@ int32_t catalogAsyncGetAllMeta(SCatalog* pCtg, SRequestConnInfo* pConn, const SC
|
|||
_return:
|
||||
|
||||
if (pJob) {
|
||||
(void)taosReleaseRef(gCtgMgmt.jobPool, pJob->refId);
|
||||
int32_t code2 = taosReleaseRef(gCtgMgmt.jobPool, pJob->refId);
|
||||
if (TSDB_CODE_SUCCESS) {
|
||||
qError("release catalog job refId %" PRId64 "falied, error:%s", pJob->refId, tstrerror(code2));
|
||||
}
|
||||
|
||||
if (code) {
|
||||
(void)taosRemoveRef(gCtgMgmt.jobPool, pJob->refId);
|
||||
code2 = taosRemoveRef(gCtgMgmt.jobPool, pJob->refId);
|
||||
if (TSDB_CODE_SUCCESS) {
|
||||
qError("remove catalog job refId %" PRId64 "falied, error:%s", pJob->refId, tstrerror(code2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1967,7 +1977,9 @@ void catalogDestroy(void) {
|
|||
}
|
||||
|
||||
if (gCtgMgmt.cacheTimer) {
|
||||
(void)taosTmrStop(gCtgMgmt.cacheTimer);
|
||||
if (taosTmrStop(gCtgMgmt.cacheTimer)) {
|
||||
qTrace("stop catalog cache timer may failed");
|
||||
}
|
||||
gCtgMgmt.cacheTimer = NULL;
|
||||
taosTmrCleanUp(gCtgMgmt.timer);
|
||||
gCtgMgmt.timer = NULL;
|
||||
|
|
|
@ -1007,7 +1007,11 @@ int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo* pConn, SCtgJob** job, const
|
|||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
(void)taosAcquireRef(gCtgMgmt.jobPool, pJob->refId);
|
||||
void* p = taosAcquireRef(gCtgMgmt.jobPool, pJob->refId);
|
||||
if (NULL == p) {
|
||||
ctgError("acquire job from ref failed, refId:%" PRId64 ", error: %s", pJob->refId, tstrerror(terrno));
|
||||
CTG_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
double el = (taosGetTimestampUs() - st) / 1000.0;
|
||||
qDebug("qid:0x%" PRIx64 ", jobId: 0x%" PRIx64 " initialized, task num %d, forceUpdate %d, elapsed time:%.2f ms",
|
||||
|
@ -1406,7 +1410,11 @@ int32_t ctgCallUserCb(void* param) {
|
|||
|
||||
qDebug("qid:0x%" PRIx64 " ctg end to call user cb", pJob->queryId);
|
||||
|
||||
(void)taosRemoveRef(gCtgMgmt.jobPool, pJob->refId);
|
||||
int64_t refId = pJob->refId;
|
||||
int32_t code = taosRemoveRef(gCtgMgmt.jobPool, refId);
|
||||
if (code) {
|
||||
qError("qid:0x%" PRIx64 " remove ctg job %" PRId64 " from jobPool failed, error:%s", pJob->queryId, refId, tstrerror(code));
|
||||
}
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -2915,21 +2915,27 @@ void ctgClearMetaCache(SCtgCacheOperation *operation) {
|
|||
|
||||
if (CTG_CACHE_LOW(remainSize, cacheMaxSize)) {
|
||||
qDebug("catalog finish meta clear, remainSize:%" PRId64 ", cacheMaxSize:%dMB", remainSize, cacheMaxSize);
|
||||
(void)taosTmrReset(ctgProcessTimerEvent, CTG_DEFAULT_CACHE_MON_MSEC, NULL, gCtgMgmt.timer, &gCtgMgmt.cacheTimer);
|
||||
if (taosTmrReset(ctgProcessTimerEvent, CTG_DEFAULT_CACHE_MON_MSEC, NULL, gCtgMgmt.timer, &gCtgMgmt.cacheTimer)) {
|
||||
qError("reset catalog cache monitor timer error, timer stoppped");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (!roundDone) {
|
||||
qDebug("catalog all meta cleared, remainSize:%" PRId64 ", cacheMaxSize:%dMB, to clear handle", remainSize, cacheMaxSize);
|
||||
ctgClearFreeCache(operation);
|
||||
(void)taosTmrReset(ctgProcessTimerEvent, CTG_DEFAULT_CACHE_MON_MSEC, NULL, gCtgMgmt.timer, &gCtgMgmt.cacheTimer);
|
||||
if (taosTmrReset(ctgProcessTimerEvent, CTG_DEFAULT_CACHE_MON_MSEC, NULL, gCtgMgmt.timer, &gCtgMgmt.cacheTimer)) {
|
||||
qError("reset catalog cache monitor timer error, timer stoppped");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
int32_t code = ctgClearCacheEnqueue(NULL, true, false, false, false);
|
||||
if (code) {
|
||||
qError("clear cache enqueue failed, error:%s", tstrerror(code));
|
||||
(void)taosTmrReset(ctgProcessTimerEvent, CTG_DEFAULT_CACHE_MON_MSEC, NULL, gCtgMgmt.timer, &gCtgMgmt.cacheTimer);
|
||||
if (taosTmrReset(ctgProcessTimerEvent, CTG_DEFAULT_CACHE_MON_MSEC, NULL, gCtgMgmt.timer, &gCtgMgmt.cacheTimer)) {
|
||||
qError("reset catalog cache monitor timer error, timer stoppped");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2993,7 +2999,10 @@ int32_t ctgOpDropTbTSMA(SCtgCacheOperation *operation) {
|
|||
pCtgCache->pTsmas = NULL;
|
||||
|
||||
ctgDebug("all tsmas for table dropped: %s.%s", msg->dbFName, msg->tbName);
|
||||
(void)taosHashRemove(dbCache->tsmaCache, msg->tbName, TSDB_TABLE_NAME_LEN);
|
||||
code = taosHashRemove(dbCache->tsmaCache, msg->tbName, TSDB_TABLE_NAME_LEN);
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
ctgError("remove table %s.%s from tsmaCache failed, error:%s", msg->dbFName, msg->tbName, tstrerror(code));
|
||||
}
|
||||
|
||||
CTG_UNLOCK(CTG_WRITE, &pCtgCache->tsmaLock);
|
||||
} else {
|
||||
|
@ -3191,6 +3200,7 @@ void ctgCleanupCacheQueue(void) {
|
|||
SCtgQNode *nodeNext = NULL;
|
||||
SCtgCacheOperation *op = NULL;
|
||||
bool stopQueue = false;
|
||||
int32_t code = 0;
|
||||
|
||||
while (true) {
|
||||
node = gCtgMgmt.queue.head->next;
|
||||
|
@ -3209,7 +3219,10 @@ void ctgCleanupCacheQueue(void) {
|
|||
}
|
||||
|
||||
if (op->syncOp) {
|
||||
(void)tsem_post(&op->rspSem);
|
||||
code = tsem_post(&op->rspSem);
|
||||
if (code) {
|
||||
qError("tsem_post failed when cleanup cache queue, error:%s", tstrerror(code));
|
||||
}
|
||||
} else {
|
||||
taosMemoryFree(op);
|
||||
}
|
||||
|
@ -3234,12 +3247,13 @@ void ctgCleanupCacheQueue(void) {
|
|||
|
||||
void *ctgUpdateThreadFunc(void *param) {
|
||||
setThreadName("catalog");
|
||||
int32_t code = 0;
|
||||
|
||||
qInfo("catalog update thread started");
|
||||
|
||||
while (true) {
|
||||
if (tsem_wait(&gCtgMgmt.queue.reqSem)) {
|
||||
qError("ctg tsem_wait failed, error:%s", tstrerror(TAOS_SYSTEM_ERROR(errno)));
|
||||
qError("ctg tsem_wait failed, error:%s", tstrerror(terrno));
|
||||
}
|
||||
|
||||
if (atomic_load_8((int8_t *)&gCtgMgmt.queue.stopQueue)) {
|
||||
|
@ -3256,7 +3270,10 @@ void *ctgUpdateThreadFunc(void *param) {
|
|||
(void)(*gCtgCacheOperation[operation->opId].func)(operation); // ignore any error
|
||||
|
||||
if (operation->syncOp) {
|
||||
(void)tsem_post(&operation->rspSem);
|
||||
code = tsem_post(&operation->rspSem);
|
||||
if (code) {
|
||||
ctgError("tsem_post failed for syncOp update, error:%s", tstrerror(code));
|
||||
}
|
||||
} else {
|
||||
taosMemoryFreeClear(operation);
|
||||
}
|
||||
|
|
|
@ -470,7 +470,10 @@ _return:
|
|||
taosMemoryFree(pMsg->pEpSet);
|
||||
|
||||
if (pJob) {
|
||||
(void)taosReleaseRef(gCtgMgmt.jobPool, cbParam->refId);
|
||||
int32_t code2 = taosReleaseRef(gCtgMgmt.jobPool, cbParam->refId);
|
||||
if (code2) {
|
||||
qError("release ctg job refId:%" PRId64 " failed, error:%s", cbParam->refId, tstrerror(code2));
|
||||
}
|
||||
}
|
||||
|
||||
CTG_API_LEAVE(code);
|
||||
|
@ -1087,11 +1090,16 @@ int32_t ctgGetTbIndexFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, SName* n
|
|||
int32_t reqType = TDMT_MND_GET_TABLE_INDEX;
|
||||
void* (*mallocFp)(int64_t) = pTask ? (MallocType)taosMemoryMalloc : (MallocType)rpcMallocCont;
|
||||
char tbFName[TSDB_TABLE_FNAME_LEN];
|
||||
(void)tNameExtractFullName(name, tbFName);
|
||||
|
||||
ctgDebug("try to get tb index from mnode, tbFName:%s", tbFName);
|
||||
|
||||
int32_t code = queryBuildMsg[TMSG_INDEX(reqType)]((void*)tbFName, &msg, 0, &msgLen, mallocFp);
|
||||
int32_t code = tNameExtractFullName(name, tbFName);
|
||||
if (code) {
|
||||
ctgError("tNameExtractFullName failed, code:%s, type:%d, dbName:%s, tname:%s", tstrerror(code), name->type, name->dbname, name->tname);
|
||||
CTG_ERR_RET(code);
|
||||
}
|
||||
|
||||
code = queryBuildMsg[TMSG_INDEX(reqType)]((void*)tbFName, &msg, 0, &msgLen, mallocFp);
|
||||
if (code) {
|
||||
ctgError("Build get index msg failed, code:%s, tbFName:%s", tstrerror(code), tbFName);
|
||||
CTG_ERR_RET(code);
|
||||
|
@ -1403,17 +1411,23 @@ int32_t ctgGetTableCfgFromVnode(SCatalog* pCtg, SRequestConnInfo* pConn, const S
|
|||
int32_t msgLen = 0;
|
||||
int32_t reqType = TDMT_VND_TABLE_CFG;
|
||||
char tbFName[TSDB_TABLE_FNAME_LEN];
|
||||
(void)tNameExtractFullName(pTableName, tbFName);
|
||||
|
||||
void* (*mallocFp)(int64_t) = pTask ? (MallocType)taosMemoryMalloc : (MallocType)rpcMallocCont;
|
||||
char dbFName[TSDB_DB_FNAME_LEN];
|
||||
(void)tNameGetFullDbName(pTableName, dbFName);
|
||||
SBuildTableInput bInput = {.vgId = vgroupInfo->vgId, .dbFName = dbFName, .tbName = (char*)pTableName->tname};
|
||||
|
||||
int32_t code = tNameExtractFullName(pTableName, tbFName);
|
||||
if (code) {
|
||||
ctgError("tNameExtractFullName failed, code:%s, type:%d, dbName:%s, tname:%s", tstrerror(code), pTableName->type, pTableName->dbname, pTableName->tname);
|
||||
CTG_ERR_RET(code);
|
||||
}
|
||||
|
||||
SEp* pEp = &vgroupInfo->epSet.eps[vgroupInfo->epSet.inUse];
|
||||
ctgDebug("try to get table cfg from vnode, vgId:%d, ep num:%d, ep %s:%d, tbFName:%s", vgroupInfo->vgId,
|
||||
vgroupInfo->epSet.numOfEps, pEp->fqdn, pEp->port, tbFName);
|
||||
|
||||
int32_t code = queryBuildMsg[TMSG_INDEX(reqType)](&bInput, &msg, 0, &msgLen, mallocFp);
|
||||
code = queryBuildMsg[TMSG_INDEX(reqType)](&bInput, &msg, 0, &msgLen, mallocFp);
|
||||
if (code) {
|
||||
ctgError("Build get tb cfg msg failed, code:%s, tbFName:%s", tstrerror(code), tbFName);
|
||||
CTG_ERR_RET(code);
|
||||
|
@ -1471,15 +1485,20 @@ int32_t ctgGetTableCfgFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, const S
|
|||
int32_t msgLen = 0;
|
||||
int32_t reqType = TDMT_MND_TABLE_CFG;
|
||||
char tbFName[TSDB_TABLE_FNAME_LEN];
|
||||
(void)tNameExtractFullName(pTableName, tbFName);
|
||||
void* (*mallocFp)(int64_t) = pTask ? (MallocType)taosMemoryMalloc : (MallocType)rpcMallocCont;
|
||||
char dbFName[TSDB_DB_FNAME_LEN];
|
||||
(void)tNameGetFullDbName(pTableName, dbFName);
|
||||
SBuildTableInput bInput = {.vgId = 0, .dbFName = dbFName, .tbName = (char*)pTableName->tname};
|
||||
|
||||
int32_t code = tNameExtractFullName(pTableName, tbFName);
|
||||
if (code) {
|
||||
ctgError("tNameExtractFullName failed, code:%s, type:%d, dbName:%s, tname:%s", tstrerror(code), pTableName->type, pTableName->dbname, pTableName->tname);
|
||||
CTG_ERR_RET(code);
|
||||
}
|
||||
|
||||
ctgDebug("try to get table cfg from mnode, tbFName:%s", tbFName);
|
||||
|
||||
int32_t code = queryBuildMsg[TMSG_INDEX(reqType)](&bInput, &msg, 0, &msgLen, mallocFp);
|
||||
code = queryBuildMsg[TMSG_INDEX(reqType)](&bInput, &msg, 0, &msgLen, mallocFp);
|
||||
if (code) {
|
||||
ctgError("Build get tb cfg msg failed, code:%s, tbFName:%s", tstrerror(code), tbFName);
|
||||
CTG_ERR_RET(code);
|
||||
|
@ -1583,11 +1602,15 @@ int32_t ctgGetViewInfoFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, SName*
|
|||
SCtgTask* pTask = tReq ? tReq->pTask : NULL;
|
||||
void* (*mallocFp)(int64_t) = pTask ? (MallocType)taosMemoryMalloc : (MallocType)rpcMallocCont;
|
||||
char fullName[TSDB_TABLE_FNAME_LEN];
|
||||
(void)tNameExtractFullName(pName, fullName);
|
||||
int32_t code = tNameExtractFullName(pName, fullName);
|
||||
if (code) {
|
||||
ctgError("tNameExtractFullName failed, code:%s, type:%d, dbName:%s, tname:%s", tstrerror(code), pName->type, pName->dbname, pName->tname);
|
||||
CTG_ERR_RET(code);
|
||||
}
|
||||
|
||||
ctgDebug("try to get view info from mnode, viewFName:%s", fullName);
|
||||
|
||||
int32_t code = queryBuildMsg[TMSG_INDEX(reqType)](fullName, &msg, 0, &msgLen, mallocFp);
|
||||
code = queryBuildMsg[TMSG_INDEX(reqType)](fullName, &msg, 0, &msgLen, mallocFp);
|
||||
if (code) {
|
||||
ctgError("Build view-meta msg failed, code:%x, viewFName:%s", code, fullName);
|
||||
CTG_ERR_RET(code);
|
||||
|
@ -1640,11 +1663,15 @@ int32_t ctgGetTbTSMAFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, const SNa
|
|||
SCtgTask* pTask = tReq ? tReq->pTask : NULL;
|
||||
void* (*mallocFp)(int64_t) = pTask ? (MallocType)taosMemoryMalloc : (MallocType)rpcMallocCont;
|
||||
char tbFName[TSDB_TABLE_FNAME_LEN];
|
||||
(void)tNameExtractFullName(name, tbFName);
|
||||
int32_t code = tNameExtractFullName(name, tbFName);
|
||||
if (code) {
|
||||
ctgError("tNameExtractFullName failed, code:%s, type:%d, dbName:%s, tname:%s", tstrerror(code), name->type, name->dbname, name->tname);
|
||||
CTG_ERR_RET(code);
|
||||
}
|
||||
|
||||
ctgDebug("try to get tb index from mnode, tbFName:%s", tbFName);
|
||||
|
||||
int32_t code = queryBuildMsg[TMSG_INDEX(reqType)]((void*)tbFName, &msg, 0, &msgLen, mallocFp);
|
||||
code = queryBuildMsg[TMSG_INDEX(reqType)]((void*)tbFName, &msg, 0, &msgLen, mallocFp);
|
||||
if (code) {
|
||||
ctgError("Build get index msg failed, code:%s, tbFName:%s", tstrerror(code), tbFName);
|
||||
CTG_ERR_RET(code);
|
||||
|
@ -1697,7 +1724,12 @@ int32_t ctgGetStreamProgressFromVnode(SCatalog* pCtg, SRequestConnInfo* pConn, c
|
|||
int32_t msgLen = 0;
|
||||
int32_t reqType = TDMT_VND_GET_STREAM_PROGRESS;
|
||||
char tbFName[TSDB_TABLE_FNAME_LEN];
|
||||
(void)tNameExtractFullName(pTbName, tbFName);
|
||||
int32_t code = tNameExtractFullName(pTbName, tbFName);
|
||||
if (code) {
|
||||
ctgError("tNameExtractFullName failed, code:%s, type:%d, dbName:%s, tname:%s", tstrerror(code), pTbName->type, pTbName->dbname, pTbName->tname);
|
||||
CTG_ERR_RET(code);
|
||||
}
|
||||
|
||||
SCtgTask* pTask = tReq ? tReq->pTask : NULL;
|
||||
void* (*mallocFp)(int64_t) = pTask ? (MallocType)taosMemoryMalloc : (MallocType)rpcMallocCont;
|
||||
|
||||
|
@ -1705,7 +1737,7 @@ int32_t ctgGetStreamProgressFromVnode(SCatalog* pCtg, SRequestConnInfo* pConn, c
|
|||
ctgDebug("try to get stream progress from vnode, vgId:%d, ep num:%d, ep %s:%d, target:%s", vgroupInfo->vgId,
|
||||
vgroupInfo->epSet.numOfEps, pEp->fqdn, pEp->port, tbFName);
|
||||
|
||||
int32_t code = queryBuildMsg[TMSG_INDEX(reqType)](bInput, &msg, 0, &msgLen, mallocFp);
|
||||
code = queryBuildMsg[TMSG_INDEX(reqType)](bInput, &msg, 0, &msgLen, mallocFp);
|
||||
if (code) {
|
||||
ctgError("Build get stream progress failed, code:%s, tbFName:%s", tstrerror(code), tbFName);
|
||||
CTG_ERR_RET(code);
|
||||
|
|
|
@ -433,6 +433,7 @@ void ctgFreeHandle(SCatalog* pCtg) {
|
|||
|
||||
void ctgClearHandleMeta(SCatalog* pCtg, int64_t* pClearedSize, int64_t* pCleardNum, bool* roundDone) {
|
||||
int64_t cacheSize = 0;
|
||||
int32_t code = 0;
|
||||
void* pIter = taosHashIterate(pCtg->dbCache, NULL);
|
||||
while (pIter) {
|
||||
SCtgDBCache* dbCache = pIter;
|
||||
|
@ -447,7 +448,10 @@ void ctgClearHandleMeta(SCatalog* pCtg, int64_t* pClearedSize, int64_t* pCleardN
|
|||
continue;
|
||||
}
|
||||
|
||||
(void)taosHashRemove(dbCache->tbCache, key, len);
|
||||
code = taosHashRemove(dbCache->tbCache, key, len);
|
||||
if (code) {
|
||||
qError("taosHashRemove table cache failed, key:%s, len:%d, error:%s", (char*)key, (int32_t)len, tstrerror(code));
|
||||
}
|
||||
|
||||
cacheSize =
|
||||
len + sizeof(SCtgTbCache) + ctgGetTbMetaCacheSize(pCache->pMeta) + ctgGetTbIndexCacheSize(pCache->pIndex);
|
||||
|
@ -1201,8 +1205,12 @@ int32_t ctgGetVgInfoFromHashValue(SCatalog* pCtg, SEpSet* pMgmtEps, SDBVgInfo* d
|
|||
|
||||
SVgroupInfo* vgInfo = NULL;
|
||||
char tbFullName[TSDB_TABLE_FNAME_LEN];
|
||||
(void)tNameExtractFullName(pTableName, tbFullName);
|
||||
|
||||
code = tNameExtractFullName(pTableName, tbFullName);
|
||||
if (code) {
|
||||
ctgError("tNameExtractFullName failed, error:%s, type:%d, dbName:%s, tname:%s", tstrerror(code), pTableName->type, pTableName->dbname, pTableName->tname);
|
||||
CTG_ERR_RET(code);
|
||||
}
|
||||
|
||||
uint32_t hashValue = taosGetTbHashVal(tbFullName, (uint32_t)strlen(tbFullName), dbInfo->hashMethod,
|
||||
dbInfo->hashPrefix, dbInfo->hashSuffix);
|
||||
|
||||
|
@ -1965,7 +1973,12 @@ int32_t ctgChkSetTbAuthRes(SCatalog* pCtg, SCtgAuthReq* req, SCtgAuthRsp* res) {
|
|||
|
||||
char tbFName[TSDB_TABLE_FNAME_LEN];
|
||||
char dbFName[TSDB_DB_FNAME_LEN];
|
||||
(void)tNameExtractFullName(&req->pRawReq->tbName, tbFName);
|
||||
code = tNameExtractFullName(&req->pRawReq->tbName, tbFName);
|
||||
if (code) {
|
||||
ctgError("tNameExtractFullName failed, error:%s, type:%d, dbName:%s, tname:%s", tstrerror(code), req->pRawReq->tbName.type, req->pRawReq->tbName.dbname, req->pRawReq->tbName.tname);
|
||||
CTG_ERR_RET(code);
|
||||
}
|
||||
|
||||
(void)tNameGetFullDbName(&req->pRawReq->tbName, dbFName);
|
||||
|
||||
while (true) {
|
||||
|
@ -2151,7 +2164,11 @@ int32_t ctgChkSetViewAuthRes(SCatalog* pCtg, SCtgAuthReq* req, SCtgAuthRsp* res)
|
|||
if (IS_SYS_DBNAME(req->pRawReq->tbName.dbname)) {
|
||||
(void)snprintf(viewFName, sizeof(viewFName), "%s.%s", req->pRawReq->tbName.dbname, req->pRawReq->tbName.tname);
|
||||
} else {
|
||||
(void)tNameExtractFullName(&req->pRawReq->tbName, viewFName);
|
||||
code = tNameExtractFullName(&req->pRawReq->tbName, viewFName);
|
||||
if (code) {
|
||||
ctgError("tNameExtractFullName failed, error:%s, type:%d, dbName:%s, tname:%s", tstrerror(code), req->pRawReq->tbName.type, req->pRawReq->tbName.dbname, req->pRawReq->tbName.tname);
|
||||
CTG_ERR_RET(code);
|
||||
}
|
||||
}
|
||||
int32_t len = strlen(viewFName) + 1;
|
||||
|
||||
|
|
|
@ -344,27 +344,18 @@ static const char* encryptAlgorithmStr(int8_t encryptAlgorithm) {
|
|||
return TSDB_CACHE_MODEL_NONE_STR;
|
||||
}
|
||||
|
||||
static int32_t formatDurationOrKeep(char** buffer, int32_t timeInMinutes) {
|
||||
int len = 0;
|
||||
int32_t formatDurationOrKeep(char* buffer, int32_t timeInMinutes) {
|
||||
int32_t len = 0;
|
||||
if (timeInMinutes % 1440 == 0) {
|
||||
int days = timeInMinutes / 1440;
|
||||
len = snprintf(NULL, 0, "%dd", days);
|
||||
*buffer = (char*)taosMemoryCalloc(len + 1, sizeof(char));
|
||||
if(*buffer == NULL) return terrno;
|
||||
sprintf(*buffer, "%dd", days);
|
||||
int32_t days = timeInMinutes / 1440;
|
||||
len = sprintf(buffer, "%dd", days);
|
||||
} else if (timeInMinutes % 60 == 0) {
|
||||
int hours = timeInMinutes / 60;
|
||||
len = snprintf(NULL, 0, "%dh", hours);
|
||||
*buffer = (char*)taosMemoryCalloc(len + 1, sizeof(char));
|
||||
if(*buffer == NULL) return terrno;
|
||||
sprintf(*buffer, "%dh", hours);
|
||||
int32_t hours = timeInMinutes / 60;
|
||||
len = sprintf(buffer, "%dh", hours);
|
||||
} else {
|
||||
len = snprintf(NULL, 0, "%dm", timeInMinutes);
|
||||
*buffer = (char*)taosMemoryCalloc(len + 1, sizeof(char));
|
||||
if(*buffer == NULL) return terrno;
|
||||
sprintf(*buffer, "%dm", timeInMinutes);
|
||||
len = sprintf(buffer, "%dm", timeInMinutes);
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
return len;
|
||||
}
|
||||
|
||||
static int32_t setCreateDBResultIntoDataBlock(SSDataBlock* pBlock, char* dbName, char* dbFName, SDbCfgInfo* pCfg) {
|
||||
|
@ -404,25 +395,16 @@ static int32_t setCreateDBResultIntoDataBlock(SSDataBlock* pBlock, char* dbName,
|
|||
} else if (pCfg->hashPrefix < 0) {
|
||||
hashPrefix = pCfg->hashPrefix + dbFNameLen + 1;
|
||||
}
|
||||
char* durationStr = NULL;
|
||||
char* keep0Str = NULL;
|
||||
char* keep1Str = NULL;
|
||||
char* keep2Str = NULL;
|
||||
int32_t codeDuration = formatDurationOrKeep(&durationStr, pCfg->daysPerFile);
|
||||
int32_t codeKeep0 = formatDurationOrKeep(&keep0Str, pCfg->daysToKeep0);
|
||||
int32_t codeKeep1 = formatDurationOrKeep(&keep1Str, pCfg->daysToKeep1);
|
||||
int32_t codeKeep2 = formatDurationOrKeep(&keep2Str, pCfg->daysToKeep2);
|
||||
if(codeDuration != TSDB_CODE_SUCCESS || codeKeep0 != TSDB_CODE_SUCCESS || codeKeep1 != TSDB_CODE_SUCCESS || codeKeep2 != TSDB_CODE_SUCCESS) {
|
||||
int32_t firstErrorCode = codeDuration != TSDB_CODE_SUCCESS ? codeDuration :
|
||||
codeKeep0 != TSDB_CODE_SUCCESS ? codeKeep0 :
|
||||
codeKeep1 != TSDB_CODE_SUCCESS ? codeKeep1 : codeKeep2;
|
||||
taosMemoryFree(pRetentions);
|
||||
taosMemoryFree(durationStr);
|
||||
taosMemoryFree(keep0Str);
|
||||
taosMemoryFree(keep1Str);
|
||||
taosMemoryFree(keep2Str);
|
||||
return firstErrorCode;
|
||||
}
|
||||
char durationStr[128] = {0};
|
||||
char keep0Str[128] = {0};
|
||||
char keep1Str[128] = {0};
|
||||
char keep2Str[128] = {0};
|
||||
|
||||
int32_t lenDuration = formatDurationOrKeep(durationStr, pCfg->daysPerFile);
|
||||
int32_t lenKeep0 = formatDurationOrKeep(keep0Str, pCfg->daysToKeep0);
|
||||
int32_t lenKeep1 = formatDurationOrKeep(keep1Str, pCfg->daysToKeep1);
|
||||
int32_t lenKeep2 = formatDurationOrKeep(keep2Str, pCfg->daysToKeep2);
|
||||
|
||||
if (IS_SYS_DBNAME(dbName)) {
|
||||
len += sprintf(buf2 + VARSTR_HEADER_SIZE, "CREATE DATABASE `%s`", dbName);
|
||||
} else {
|
||||
|
@ -449,10 +431,6 @@ static int32_t setCreateDBResultIntoDataBlock(SSDataBlock* pBlock, char* dbName,
|
|||
}
|
||||
|
||||
taosMemoryFree(pRetentions);
|
||||
taosMemoryFree(durationStr);
|
||||
taosMemoryFree(keep0Str);
|
||||
taosMemoryFree(keep1Str);
|
||||
taosMemoryFree(keep2Str);
|
||||
|
||||
(varDataLen(buf2)) = len;
|
||||
|
||||
|
|
|
@ -190,7 +190,7 @@ static void getDataLength(SDataSinkHandle* pHandle, int64_t* pLen, int64_t* pRaw
|
|||
}
|
||||
|
||||
SDataDeleterBuf* pBuf = NULL;
|
||||
(void)taosReadQitem(pDeleter->pDataBlocks, (void**)&pBuf);
|
||||
taosReadQitem(pDeleter->pDataBlocks, (void**)&pBuf);
|
||||
if (pBuf != NULL) {
|
||||
TAOS_MEMCPY(&pDeleter->nextOutput, pBuf, sizeof(SDataDeleterBuf));
|
||||
taosFreeQitem(pBuf);
|
||||
|
@ -248,7 +248,7 @@ static int32_t destroyDataSinker(SDataSinkHandle* pHandle) {
|
|||
taosMemoryFree(pDeleter->pParam);
|
||||
while (!taosQueueEmpty(pDeleter->pDataBlocks)) {
|
||||
SDataDeleterBuf* pBuf = NULL;
|
||||
(void)taosReadQitem(pDeleter->pDataBlocks, (void**)&pBuf);
|
||||
taosReadQitem(pDeleter->pDataBlocks, (void**)&pBuf);
|
||||
|
||||
if (pBuf != NULL) {
|
||||
taosMemoryFreeClear(pBuf->pData);
|
||||
|
|
|
@ -233,7 +233,7 @@ static void getDataLength(SDataSinkHandle* pHandle, int64_t* pLen, int64_t* pRow
|
|||
}
|
||||
|
||||
SDataDispatchBuf* pBuf = NULL;
|
||||
(void)taosReadQitem(pDispatcher->pDataBlocks, (void**)&pBuf);
|
||||
taosReadQitem(pDispatcher->pDataBlocks, (void**)&pBuf);
|
||||
if (pBuf != NULL) {
|
||||
TAOS_MEMCPY(&pDispatcher->nextOutput, pBuf, sizeof(SDataDispatchBuf));
|
||||
taosFreeQitem(pBuf);
|
||||
|
@ -291,7 +291,7 @@ static int32_t destroyDataSinker(SDataSinkHandle* pHandle) {
|
|||
|
||||
while (!taosQueueEmpty(pDispatcher->pDataBlocks)) {
|
||||
SDataDispatchBuf* pBuf = NULL;
|
||||
(void)taosReadQitem(pDispatcher->pDataBlocks, (void**)&pBuf);
|
||||
taosReadQitem(pDispatcher->pDataBlocks, (void**)&pBuf);
|
||||
if (pBuf != NULL) {
|
||||
taosMemoryFreeClear(pBuf->pData);
|
||||
taosFreeQitem(pBuf);
|
||||
|
|
|
@ -57,6 +57,7 @@ typedef struct SSubmitRspParam {
|
|||
int32_t inserterCallback(void* param, SDataBuf* pMsg, int32_t code) {
|
||||
SSubmitRspParam* pParam = (SSubmitRspParam*)param;
|
||||
SDataInserterHandle* pInserter = pParam->pInserter;
|
||||
int32_t code2 = 0;
|
||||
|
||||
if (code) {
|
||||
pInserter->submitRes.code = code;
|
||||
|
@ -106,7 +107,14 @@ int32_t inserterCallback(void* param, SDataBuf* pMsg, int32_t code) {
|
|||
|
||||
_return:
|
||||
|
||||
(void)tsem_post(&pInserter->ready);
|
||||
code2 = tsem_post(&pInserter->ready);
|
||||
if (code2 < 0) {
|
||||
qError("tsem_post inserter ready failed, error:%s", tstrerror(code2));
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
pInserter->submitRes.code = code2;
|
||||
}
|
||||
}
|
||||
|
||||
taosMemoryFree(pMsg->pData);
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
|
|
@ -562,7 +562,8 @@ static int32_t notifySeqJoinTableCacheEnd(SOperatorInfo* pOperator, SStbJoinPost
|
|||
|
||||
static int32_t handleSeqJoinCurrRetrieveEnd(SOperatorInfo* pOperator, SStbJoinDynCtrlInfo* pStbJoin) {
|
||||
SStbJoinPostJoinCtx* pPost = &pStbJoin->ctx.post;
|
||||
|
||||
int32_t code = 0;
|
||||
|
||||
pPost->isStarted = false;
|
||||
|
||||
if (pStbJoin->basic.batchFetch) {
|
||||
|
@ -572,7 +573,11 @@ static int32_t handleSeqJoinCurrRetrieveEnd(SOperatorInfo* pOperator, SStbJoinDy
|
|||
if (pPost->leftNeedCache) {
|
||||
uint32_t* num = tSimpleHashGet(pStbJoin->ctx.prev.leftCache, &pPost->leftCurrUid, sizeof(pPost->leftCurrUid));
|
||||
if (num && --(*num) <= 0) {
|
||||
(void)tSimpleHashRemove(pStbJoin->ctx.prev.leftCache, &pPost->leftCurrUid, sizeof(pPost->leftCurrUid));
|
||||
code = tSimpleHashRemove(pStbJoin->ctx.prev.leftCache, &pPost->leftCurrUid, sizeof(pPost->leftCurrUid));
|
||||
if (code) {
|
||||
qError("tSimpleHashRemove leftCurrUid %" PRId64 " from leftCache failed, error:%s", pPost->leftCurrUid, tstrerror(code));
|
||||
QRY_ERR_RET(code);
|
||||
}
|
||||
QRY_ERR_RET(notifySeqJoinTableCacheEnd(pOperator, pPost, true));
|
||||
}
|
||||
}
|
||||
|
@ -580,7 +585,11 @@ static int32_t handleSeqJoinCurrRetrieveEnd(SOperatorInfo* pOperator, SStbJoinDy
|
|||
if (!pPost->rightNeedCache) {
|
||||
void* v = tSimpleHashGet(pStbJoin->ctx.prev.rightCache, &pPost->rightCurrUid, sizeof(pPost->rightCurrUid));
|
||||
if (NULL != v) {
|
||||
(void)tSimpleHashRemove(pStbJoin->ctx.prev.rightCache, &pPost->rightCurrUid, sizeof(pPost->rightCurrUid));
|
||||
code = tSimpleHashRemove(pStbJoin->ctx.prev.rightCache, &pPost->rightCurrUid, sizeof(pPost->rightCurrUid));
|
||||
if (code) {
|
||||
qError("tSimpleHashRemove rightCurrUid %" PRId64 " from rightCache failed, error:%s", pPost->rightCurrUid, tstrerror(code));
|
||||
QRY_ERR_RET(code);
|
||||
}
|
||||
QRY_ERR_RET(notifySeqJoinTableCacheEnd(pOperator, pPost, false));
|
||||
}
|
||||
}
|
||||
|
@ -661,7 +670,11 @@ static FORCE_INLINE int32_t addToJoinTableHash(SSHashObj* pHash, SSHashObj* pOnc
|
|||
break;
|
||||
default:
|
||||
if (1 == (*pNum)) {
|
||||
(void)tSimpleHashRemove(pOnceHash, pKey, keySize);
|
||||
code = tSimpleHashRemove(pOnceHash, pKey, keySize);
|
||||
if (code) {
|
||||
qError("tSimpleHashRemove failed in addToJoinTableHash, error:%s", tstrerror(code));
|
||||
QRY_ERR_RET(code);
|
||||
}
|
||||
}
|
||||
(*pNum)++;
|
||||
break;
|
||||
|
@ -812,8 +825,12 @@ static void postProcessStbJoinTableHash(SOperatorInfo* pOperator) {
|
|||
|
||||
uint64_t* pUid = NULL;
|
||||
int32_t iter = 0;
|
||||
int32_t code = 0;
|
||||
while (NULL != (pUid = tSimpleHashIterate(pStbJoin->ctx.prev.onceTable, pUid, &iter))) {
|
||||
(void)tSimpleHashRemove(pStbJoin->ctx.prev.leftCache, pUid, sizeof(*pUid));
|
||||
code = tSimpleHashRemove(pStbJoin->ctx.prev.leftCache, pUid, sizeof(*pUid));
|
||||
if (code) {
|
||||
qError("tSimpleHashRemove failed in postProcessStbJoinTableHash, error:%s", tstrerror(code));
|
||||
}
|
||||
}
|
||||
|
||||
pStbJoin->execInfo.leftCacheNum = tSimpleHashGetSize(pStbJoin->ctx.prev.leftCache);
|
||||
|
|
|
@ -565,7 +565,6 @@ int32_t loadRemoteDataCallback(void* param, SDataBuf* pMsg, int32_t code) {
|
|||
pSourceDataInfo->status = EX_SOURCE_DATA_READY;
|
||||
code = tsem_post(&pExchangeInfo->ready);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
code = TAOS_SYSTEM_ERROR(code);
|
||||
qError("failed to invoke post when fetch rsp is ready, code:%s, %p", tstrerror(code), pExchangeInfo);
|
||||
return code;
|
||||
}
|
||||
|
|
|
@ -234,8 +234,7 @@ int32_t qSetStreamOpOpen(qTaskInfo_t tinfo) {
|
|||
}
|
||||
|
||||
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
|
||||
|
||||
int32_t code = doSetStreamOpOpen(pTaskInfo->pRoot, GET_TASKID(pTaskInfo));
|
||||
int32_t code = doSetStreamOpOpen(pTaskInfo->pRoot, GET_TASKID(pTaskInfo));
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
qError("%s failed to set the stream block data", GET_TASKID(pTaskInfo));
|
||||
} else {
|
||||
|
|
|
@ -30,7 +30,9 @@
|
|||
|
||||
static void removeGroupCacheFile(SGroupCacheFileInfo* pFileInfo) {
|
||||
if (pFileInfo->fd.fd) {
|
||||
(void)taosCloseFile(&pFileInfo->fd.fd);
|
||||
if (taosCloseFile(&pFileInfo->fd.fd) < 0) {
|
||||
qError("close group cache file failed, fd:%p, error:%s", pFileInfo->fd.fd, tstrerror(terrno));
|
||||
}
|
||||
pFileInfo->fd.fd = NULL;
|
||||
(void)taosThreadMutexDestroy(&pFileInfo->fd.mutex);
|
||||
}
|
||||
|
@ -92,7 +94,9 @@ static void logGroupCacheExecInfo(SGroupCacheOperatorInfo* pGrpCacheOperator) {
|
|||
static void freeSGcSessionCtx(void* p) {
|
||||
SGcSessionCtx* pSession = p;
|
||||
if (pSession->semInit) {
|
||||
(void)tsem_destroy(&pSession->waitSem);
|
||||
if (tsem_destroy(&pSession->waitSem) < 0) {
|
||||
qError("tsem_destroy session waitSem failed, error:%s", tstrerror(terrno));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -262,6 +266,9 @@ static int32_t acquireFdFromFileCtx(SGcFileCacheCtx* pFileCtx, int32_t fileId, S
|
|||
}
|
||||
|
||||
static FORCE_INLINE void releaseFdToFileCtx(SGroupCacheFileFd* pFd) {
|
||||
if (NULL == pFd) {
|
||||
return;
|
||||
}
|
||||
(void)taosThreadMutexUnlock(&pFd->mutex);
|
||||
}
|
||||
|
||||
|
@ -274,6 +281,8 @@ static int32_t saveBlocksToDisk(SGroupCacheOperatorInfo* pGCache, SGcDownstreamC
|
|||
SGroupCacheData* pGroup = NULL;
|
||||
|
||||
while (NULL != pHead) {
|
||||
pFd = NULL;
|
||||
|
||||
if (pGCache->batchFetch) {
|
||||
pFileCtx = &pHead->pCtx->fileCtx;
|
||||
} else {
|
||||
|
@ -290,7 +299,11 @@ static int32_t saveBlocksToDisk(SGroupCacheOperatorInfo* pGCache, SGcDownstreamC
|
|||
|
||||
int64_t blkId = pHead->basic.blkId;
|
||||
pHead = pHead->next;
|
||||
(void)taosHashRemove(pGCache->blkCache.pDirtyBlk, &blkId, sizeof(blkId));
|
||||
code = taosHashRemove(pGCache->blkCache.pDirtyBlk, &blkId, sizeof(blkId));
|
||||
if (code) {
|
||||
qError("taosHashRemove blk %" PRId64 " from diryBlk failed, error:%s", blkId, tstrerror(code));
|
||||
goto _return;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -304,13 +317,19 @@ static int32_t saveBlocksToDisk(SGroupCacheOperatorInfo* pGCache, SGcDownstreamC
|
|||
}
|
||||
|
||||
if (deleted) {
|
||||
releaseFdToFileCtx(pFd);
|
||||
|
||||
qTrace("FileId:%d-%d-%d already be deleted, skip write",
|
||||
pCtx->id, pGroup ? pGroup->vgId : GROUP_CACHE_DEFAULT_VGID, pHead->basic.fileId);
|
||||
|
||||
int64_t blkId = pHead->basic.blkId;
|
||||
pHead = pHead->next;
|
||||
|
||||
(void)taosHashRemove(pGCache->blkCache.pDirtyBlk, &blkId, sizeof(blkId));
|
||||
code = taosHashRemove(pGCache->blkCache.pDirtyBlk, &blkId, sizeof(blkId));
|
||||
if (code) {
|
||||
qError("taosHashRemove blk %" PRId64 " from diryBlk failed, error:%s", blkId, tstrerror(code));
|
||||
goto _return;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -336,7 +355,11 @@ static int32_t saveBlocksToDisk(SGroupCacheOperatorInfo* pGCache, SGcDownstreamC
|
|||
int64_t blkId = pHead->basic.blkId;
|
||||
pHead = pHead->next;
|
||||
|
||||
(void)taosHashRemove(pGCache->blkCache.pDirtyBlk, &blkId, sizeof(blkId));
|
||||
code = taosHashRemove(pGCache->blkCache.pDirtyBlk, &blkId, sizeof(blkId));
|
||||
if (code) {
|
||||
qError("taosHashRemove blk %" PRId64 " from diryBlk failed, error:%s", blkId, tstrerror(code));
|
||||
goto _return;
|
||||
}
|
||||
}
|
||||
|
||||
_return:
|
||||
|
@ -1038,7 +1061,11 @@ static int32_t getCacheBlkFromDownstreamOperator(struct SOperatorInfo* pOperator
|
|||
}
|
||||
SGcSessionCtx* pWaitCtx = *ppWaitCtx;
|
||||
pWaitCtx->newFetch = true;
|
||||
(void)taosHashRemove(pCtx->pWaitSessions, pSessionId, sizeof(*pSessionId));
|
||||
code = taosHashRemove(pCtx->pWaitSessions, pSessionId, sizeof(*pSessionId));
|
||||
if (code) {
|
||||
qError("taosHashRemove session %" PRId64 " from waitSession failed, error: %s", *pSessionId, tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
QRY_ERR_RET(tsem_post(&pWaitCtx->waitSem));
|
||||
|
||||
return code;
|
||||
|
@ -1127,14 +1154,22 @@ static int32_t groupCacheSessionWait(struct SOperatorInfo* pOperator, SGcDownstr
|
|||
|
||||
QRY_ERR_JRET(taosHashPut(pCtx->pWaitSessions, &sessionId, sizeof(sessionId), &pSession, POINTER_BYTES));
|
||||
|
||||
(void)tsem_wait(&pSession->waitSem);
|
||||
code = tsem_wait(&pSession->waitSem);
|
||||
if (code) {
|
||||
qError("tsem_wait failed, error:%s", tstrerror(code));
|
||||
QRY_ERR_JRET(code);
|
||||
}
|
||||
|
||||
if (pSession->newFetch) {
|
||||
pSession->newFetch = false;
|
||||
return getCacheBlkFromDownstreamOperator(pOperator, pCtx, sessionId, pSession, ppRes);
|
||||
}
|
||||
|
||||
(void)taosHashRemove(pCtx->pWaitSessions, &sessionId, sizeof(sessionId));
|
||||
code = taosHashRemove(pCtx->pWaitSessions, &sessionId, sizeof(sessionId));
|
||||
if (code) {
|
||||
qError("taosHashRemove session %" PRId64 " from waitSession failed, error: %s", sessionId, tstrerror(code));
|
||||
QRY_ERR_JRET(code);
|
||||
}
|
||||
|
||||
bool got = false;
|
||||
return getBlkFromSessionCacheImpl(pOperator, sessionId, pSession, ppRes, &got);
|
||||
|
@ -1280,14 +1315,22 @@ static int32_t getBlkFromGroupCache(struct SOperatorInfo* pOperator, SSDataBlock
|
|||
SSDataBlock** ppBlock = taosHashGet(pGCache->blkCache.pReadBlk, &pGcParam->sessionId, sizeof(pGcParam->sessionId));
|
||||
if (ppBlock) {
|
||||
QRY_ERR_RET(releaseBaseBlockToList(pCtx, *ppBlock));
|
||||
(void)taosHashRemove(pGCache->blkCache.pReadBlk, &pGcParam->sessionId, sizeof(pGcParam->sessionId));
|
||||
code = taosHashRemove(pGCache->blkCache.pReadBlk, &pGcParam->sessionId, sizeof(pGcParam->sessionId));
|
||||
if (code) {
|
||||
qError("taosHashRemove session %" PRId64 " from pReadBlk failed, error: %s", pGcParam->sessionId, tstrerror(code));
|
||||
QRY_ERR_RET(code);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
code = getBlkFromSessionCache(pOperator, pGcParam->sessionId, pSession, ppRes);
|
||||
if (NULL == *ppRes) {
|
||||
qDebug("session %" PRId64 " in downstream %d total got %" PRId64 " rows", pGcParam->sessionId, pCtx->id, pSession->resRows);
|
||||
(void)taosHashRemove(pCtx->pSessions, &pGcParam->sessionId, sizeof(pGcParam->sessionId));
|
||||
code = taosHashRemove(pCtx->pSessions, &pGcParam->sessionId, sizeof(pGcParam->sessionId));
|
||||
if (code) {
|
||||
qError("taosHashRemove session %" PRId64 " from pSessions failed, error: %s", pGcParam->sessionId, tstrerror(code));
|
||||
QRY_ERR_RET(code);
|
||||
}
|
||||
} else {
|
||||
pSession->resRows += (*ppRes)->info.rows;
|
||||
qDebug("session %" PRId64 " in downstream %d got %" PRId64 " rows in one block", pGcParam->sessionId, pCtx->id, (*ppRes)->info.rows);
|
||||
|
|
|
@ -2413,7 +2413,10 @@ int32_t mAsofForwardChkFillGrpCache(SMJoinWindowCtx* pCtx) {
|
|||
pGrp->readIdx = 0;
|
||||
//pGrp->endIdx = pGrp->blk->info.rows - 1;
|
||||
} else {
|
||||
(void)taosArrayPop(pCache->grps);
|
||||
if (NULL == taosArrayPop(pCache->grps)) {
|
||||
MJ_ERR_RET(TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR);
|
||||
}
|
||||
|
||||
pGrp = taosArrayGet(pCache->grps, 0);
|
||||
if (NULL == pGrp) {
|
||||
MJ_ERR_RET(TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR);
|
||||
|
|
|
@ -1378,7 +1378,9 @@ int32_t mJoinBuildEqGroups(SMJoinTableCtx* pTable, int64_t timestamp, bool* whol
|
|||
_return:
|
||||
|
||||
if (pTable->noKeepEqGrpRows || !keepGrp || (!pTable->multiEqGrpRows && !restart)) {
|
||||
(void)taosArrayPop(pTable->eqGrps);
|
||||
if (NULL == taosArrayPop(pTable->eqGrps)) {
|
||||
code = terrno;
|
||||
}
|
||||
} else {
|
||||
pTable->grpTotalRows += pGrp->endIdx - pGrp->beginIdx + 1;
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ static void switchCtxOrder(SqlFunctionCtx* pCtx, int32_t numOfOutput) {
|
|||
}
|
||||
|
||||
static int32_t overlapWithTimeWindow(SInterval* pInterval, SDataBlockInfo* pBlockInfo, int32_t order, bool* overlap) {
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
STimeWindow w = {0};
|
||||
|
||||
// 0 by default, which means it is not a interval operator of the upstream operator.
|
||||
|
@ -101,7 +101,7 @@ static int32_t overlapWithTimeWindow(SInterval* pInterval, SDataBlockInfo* pBloc
|
|||
|
||||
if (order == TSDB_ORDER_ASC) {
|
||||
w = getAlignQueryTimeWindow(pInterval, pBlockInfo->window.skey);
|
||||
if(w.ekey < pBlockInfo->window.skey) {
|
||||
if (w.ekey < pBlockInfo->window.skey) {
|
||||
qError("w.ekey:%" PRId64 " < pBlockInfo->window.skey:%" PRId64, w.ekey, pBlockInfo->window.skey);
|
||||
return TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ static int32_t overlapWithTimeWindow(SInterval* pInterval, SDataBlockInfo* pBloc
|
|||
break;
|
||||
}
|
||||
|
||||
if(w.ekey <= pBlockInfo->window.ekey) {
|
||||
if (w.ekey <= pBlockInfo->window.ekey) {
|
||||
qError("w.ekey:%" PRId64 " <= pBlockInfo->window.ekey:%" PRId64, w.ekey, pBlockInfo->window.ekey);
|
||||
return TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ static int32_t overlapWithTimeWindow(SInterval* pInterval, SDataBlockInfo* pBloc
|
|||
}
|
||||
} else {
|
||||
w = getAlignQueryTimeWindow(pInterval, pBlockInfo->window.ekey);
|
||||
if(w.skey > pBlockInfo->window.ekey) {
|
||||
if (w.skey > pBlockInfo->window.ekey) {
|
||||
qError("w.skey:%" PRId64 " > pBlockInfo->window.skey:%" PRId64, w.skey, pBlockInfo->window.ekey);
|
||||
return TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ static int32_t overlapWithTimeWindow(SInterval* pInterval, SDataBlockInfo* pBloc
|
|||
break;
|
||||
}
|
||||
|
||||
if(w.skey >= pBlockInfo->window.skey){
|
||||
if (w.skey >= pBlockInfo->window.skey) {
|
||||
qError("w.skey:%" PRId64 " >= pBlockInfo->window.skey:%" PRId64, w.skey, pBlockInfo->window.skey);
|
||||
return TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
|
||||
}
|
||||
|
@ -227,7 +227,7 @@ static int32_t doDynamicPruneDataBlock(SOperatorInfo* pOperator, SDataBlockInfo*
|
|||
|
||||
SResultRowEntryInfo* pEntry = getResultEntryInfo(pRow, i, pTableScanInfo->base.pdInfo.pExprSup->rowEntryInfoOffset);
|
||||
|
||||
EFuncDataRequired reqStatus = fmFuncDynDataRequired(functionId, pEntry, pBlockInfo);
|
||||
EFuncDataRequired reqStatus = fmFuncDynDataRequired(functionId, pEntry, pBlockInfo);
|
||||
if (reqStatus != FUNC_DATA_REQUIRED_NOT_LOAD) {
|
||||
notLoadBlock = false;
|
||||
break;
|
||||
|
@ -399,7 +399,7 @@ static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanBase* pTableSca
|
|||
}
|
||||
}
|
||||
|
||||
if(*status != FUNC_DATA_REQUIRED_DATA_LOAD) {
|
||||
if (*status != FUNC_DATA_REQUIRED_DATA_LOAD) {
|
||||
pAPI->tsdReader.tsdReaderReleaseDataBlock(pTableScanInfo->dataReader);
|
||||
qError("%s loadDataBlock invalid status:%d", GET_TASKID(pTaskInfo), *status);
|
||||
return TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
|
||||
|
@ -588,14 +588,14 @@ static void freeTableCachedValObj(STableCachedVal* pVal) {
|
|||
|
||||
int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int32_t numOfExpr, SSDataBlock* pBlock,
|
||||
int32_t rows, SExecTaskInfo* pTask, STableMetaCacheInfo* pCache) {
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
int32_t lino = 0;
|
||||
bool freeReader = false;
|
||||
LRUHandle* h = NULL;
|
||||
STableCachedVal val = {0};
|
||||
SMetaReader mr = {0};
|
||||
const char* idStr = pTask->id.str;
|
||||
int32_t insertRet = TAOS_LRU_STATUS_OK;
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
int32_t lino = 0;
|
||||
bool freeReader = false;
|
||||
LRUHandle* h = NULL;
|
||||
STableCachedVal val = {0};
|
||||
SMetaReader mr = {0};
|
||||
const char* idStr = pTask->id.str;
|
||||
int32_t insertRet = TAOS_LRU_STATUS_OK;
|
||||
STableCachedVal* pVal = NULL;
|
||||
|
||||
// currently only the tbname pseudo column
|
||||
|
@ -625,8 +625,7 @@ int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int
|
|||
// append null value before return to caller, since the caller will ignore this error code and proceed
|
||||
doSetNullValue(pBlock, pExpr, numOfExpr);
|
||||
} else {
|
||||
qError("failed to get table meta, uid:0x%" PRIx64 ", code:%s, %s", pBlock->info.id.uid, tstrerror(code),
|
||||
idStr);
|
||||
qError("failed to get table meta, uid:0x%" PRIx64 ", code:%s, %s", pBlock->info.id.uid, tstrerror(code), idStr);
|
||||
}
|
||||
pHandle->api.metaReaderFn.clearReader(&mr);
|
||||
return code;
|
||||
|
@ -743,7 +742,7 @@ _end:
|
|||
|
||||
if (NULL != pVal) {
|
||||
insertRet = taosLRUCacheInsert(pCache->pTableMetaEntryCache, &pBlock->info.id.uid, sizeof(uint64_t), pVal,
|
||||
sizeof(STableCachedVal), freeCachedMetaItem, NULL, TAOS_LRU_PRIORITY_LOW, NULL);
|
||||
sizeof(STableCachedVal), freeCachedMetaItem, NULL, TAOS_LRU_PRIORITY_LOW, NULL);
|
||||
if (insertRet != TAOS_LRU_STATUS_OK) {
|
||||
qWarn("failed to put meta into lru cache, code:%d, %s", insertRet, idStr);
|
||||
}
|
||||
|
@ -1432,7 +1431,7 @@ static int32_t getTableScannerExecInfo(struct SOperatorInfo* pOptr, void** pOptr
|
|||
if (!pRecorder) {
|
||||
return terrno;
|
||||
}
|
||||
STableScanInfo* pTableScanInfo = pOptr->info;
|
||||
STableScanInfo* pTableScanInfo = pOptr->info;
|
||||
*pRecorder = pTableScanInfo->base.readRecorder;
|
||||
*pOptrExplain = pRecorder;
|
||||
*len = sizeof(SFileBlockLoadRecorder);
|
||||
|
@ -1515,7 +1514,7 @@ int32_t createTableScanOperatorInfo(STableScanPhysiNode* pTableScanNode, SReadHa
|
|||
initResultSizeInfo(&pOperator->resultInfo, 4096);
|
||||
pInfo->pResBlock = createDataBlockFromDescNode(pDescNode);
|
||||
QUERY_CHECK_NULL(pInfo->pResBlock, code, lino, _error, terrno);
|
||||
|
||||
|
||||
code = prepareDataBlockBuf(pInfo->pResBlock, &pInfo->base.matchInfo);
|
||||
QUERY_CHECK_CODE(code, lino, _error);
|
||||
|
||||
|
@ -1554,7 +1553,7 @@ int32_t createTableScanOperatorInfo(STableScanPhysiNode* pTableScanNode, SReadHa
|
|||
|
||||
_error:
|
||||
if (pInfo != NULL) {
|
||||
pInfo->base.pTableListInfo = NULL; // this attribute will be destroy outside of this function
|
||||
pInfo->base.pTableListInfo = NULL; // this attribute will be destroy outside of this function
|
||||
destroyTableScanOperatorInfo(pInfo);
|
||||
}
|
||||
|
||||
|
@ -1684,7 +1683,7 @@ static SSDataBlock* readPreVersionData(SOperatorInfo* pTableScanOp, uint64_t tbU
|
|||
SSDataBlock* pBlock = pTableScanInfo->pResBlock;
|
||||
STsdbReader* pReader = NULL;
|
||||
code = pAPI->tsdReader.tsdReaderOpen(pTableScanInfo->base.readHandle.vnode, &cond, &tblInfo, 1, pBlock,
|
||||
(void**)&pReader, GET_TASKID(pTaskInfo), NULL);
|
||||
(void**)&pReader, GET_TASKID(pTaskInfo), NULL);
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
|
||||
bool hasNext = false;
|
||||
|
@ -1837,7 +1836,7 @@ static void prepareRangeScan(SStreamScanInfo* pInfo, SSDataBlock* pBlock, int32_
|
|||
QUERY_CHECK_NULL(pInfo->pUpdateInfo, code, lino, _end, TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR);
|
||||
|
||||
qDebug("prepare range scan start:%" PRId64 ",end:%" PRId64 ",maxVer:%" PRIu64, win.skey, win.ekey,
|
||||
pInfo->pUpdateInfo->maxDataVersion);
|
||||
pInfo->pUpdateInfo->maxDataVersion);
|
||||
resetTableScanInfo(pInfo->pTableScanOp->info, &win, pInfo->pUpdateInfo->maxDataVersion);
|
||||
pInfo->pTableScanOp->status = OP_OPENED;
|
||||
if (pRes) {
|
||||
|
@ -2428,9 +2427,9 @@ static int32_t generateIntervalScanRange(SStreamScanInfo* pInfo, SSDataBlock* pS
|
|||
}
|
||||
|
||||
uint64_t* srcUidData = (uint64_t*)pSrcUidCol->pData;
|
||||
TSKEY* srcStartTsCol = (TSKEY*)pSrcStartTsCol->pData;
|
||||
TSKEY* srcEndTsCol = (TSKEY*)pSrcEndTsCol->pData;
|
||||
int64_t ver = pSrcBlock->info.version - 1;
|
||||
TSKEY* srcStartTsCol = (TSKEY*)pSrcStartTsCol->pData;
|
||||
TSKEY* srcEndTsCol = (TSKEY*)pSrcEndTsCol->pData;
|
||||
int64_t ver = pSrcBlock->info.version - 1;
|
||||
|
||||
if (pInfo->partitionSup.needCalc &&
|
||||
(srcStartTsCol[0] != srcEndTsCol[0] || (hasPrimaryKeyCol(pInfo) && mode == STREAM_DELETE_DATA))) {
|
||||
|
@ -2999,8 +2998,8 @@ static int32_t setBlockIntoRes(SStreamScanInfo* pInfo, const SSDataBlock* pBlock
|
|||
|
||||
// currently only the tbname pseudo column
|
||||
if (pInfo->numOfPseudoExpr > 0) {
|
||||
code = addTagPseudoColumnData(&pInfo->readHandle, pInfo->pPseudoExpr, pInfo->numOfPseudoExpr,
|
||||
pInfo->pRes, pBlockInfo->rows, pTaskInfo, &pTableScanInfo->base.metaCache);
|
||||
code = addTagPseudoColumnData(&pInfo->readHandle, pInfo->pPseudoExpr, pInfo->numOfPseudoExpr, pInfo->pRes,
|
||||
pBlockInfo->rows, pTaskInfo, &pTableScanInfo->base.metaCache);
|
||||
// ignore the table not exists error, since this table may have been dropped during the scan procedure.
|
||||
if (code == TSDB_CODE_PAR_TABLE_NOT_EXIST) {
|
||||
code = 0;
|
||||
|
@ -3377,7 +3376,7 @@ void streamScanOperatorDecode(void* pBuff, int32_t len, SStreamScanInfo* pInfo)
|
|||
return;
|
||||
}
|
||||
|
||||
void* pUpInfo = taosMemoryCalloc(1, sizeof(SUpdateInfo));
|
||||
void* pUpInfo = taosMemoryCalloc(1, sizeof(SUpdateInfo));
|
||||
if (!pUpInfo) {
|
||||
return;
|
||||
}
|
||||
|
@ -3682,7 +3681,8 @@ FETCH_NEXT_BLOCK:
|
|||
(*ppRes) = pInfo->pDeleteDataRes;
|
||||
return code;
|
||||
}
|
||||
qError("%s===stream=== %s failed at line %d since pInfo->pUpdateRes is empty", GET_TASKID(pTaskInfo), __func__, lino);
|
||||
qError("%s===stream=== %s failed at line %d since pInfo->pUpdateRes is empty", GET_TASKID(pTaskInfo), __func__,
|
||||
lino);
|
||||
blockDataCleanup(pInfo->pUpdateDataRes);
|
||||
pInfo->scanMode = STREAM_SCAN_FROM_READERHANDLE;
|
||||
} break;
|
||||
|
@ -3695,7 +3695,8 @@ FETCH_NEXT_BLOCK:
|
|||
(*ppRes) = pInfo->pUpdateRes;
|
||||
return code;
|
||||
}
|
||||
qError("%s===stream=== %s failed at line %d since pInfo->pUpdateRes is empty", GET_TASKID(pTaskInfo), __func__, lino);
|
||||
qError("%s===stream=== %s failed at line %d since pInfo->pUpdateRes is empty", GET_TASKID(pTaskInfo), __func__,
|
||||
lino);
|
||||
blockDataCleanup(pInfo->pUpdateDataRes);
|
||||
pInfo->scanMode = STREAM_SCAN_FROM_READERHANDLE;
|
||||
} break;
|
||||
|
@ -3882,7 +3883,7 @@ static int32_t extractTableIdList(const STableListInfo* pTableListInfo, SArray**
|
|||
for (int32_t i = 0; i < size; ++i) {
|
||||
STableKeyInfo* pkeyInfo = tableListGetInfo(pTableListInfo, i);
|
||||
QUERY_CHECK_NULL(pkeyInfo, code, lino, _end, terrno);
|
||||
void* tmp = taosArrayPush(tableIdList, &pkeyInfo->uid);
|
||||
void* tmp = taosArrayPush(tableIdList, &pkeyInfo->uid);
|
||||
QUERY_CHECK_NULL(tmp, code, lino, _end, terrno);
|
||||
}
|
||||
|
||||
|
@ -4277,7 +4278,7 @@ int32_t createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhysiNode*
|
|||
int32_t numOfOutput = taosArrayGetSize(pInfo->matchInfo.pList);
|
||||
pColIds = taosArrayInit(numOfOutput, sizeof(int16_t));
|
||||
QUERY_CHECK_NULL(pColIds, code, lino, _error, terrno);
|
||||
|
||||
|
||||
for (int32_t i = 0; i < numOfOutput; ++i) {
|
||||
SColMatchItem* id = taosArrayGet(pInfo->matchInfo.pList, i);
|
||||
QUERY_CHECK_NULL(id, code, lino, _error, terrno);
|
||||
|
@ -4481,7 +4482,7 @@ _error:
|
|||
}
|
||||
|
||||
static int32_t doTagScanOneTable(SOperatorInfo* pOperator, const SSDataBlock* pRes, int32_t count, SMetaReader* mr,
|
||||
SStorageAPI* pAPI) {
|
||||
SStorageAPI* pAPI) {
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
int32_t lino = 0;
|
||||
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
|
||||
|
@ -4493,7 +4494,6 @@ static int32_t doTagScanOneTable(SOperatorInfo* pOperator, const SSDataBlock* pR
|
|||
qError("failed to get table meta, uid:0x%" PRIx64 ", code:%s, %s", item->uid, tstrerror(terrno),
|
||||
GET_TASKID(pTaskInfo));
|
||||
tDecoderClear(&(*mr).coder);
|
||||
pAPI->metaReaderFn.clearReader(mr);
|
||||
goto _end;
|
||||
}
|
||||
|
||||
|
@ -4502,7 +4502,6 @@ static int32_t doTagScanOneTable(SOperatorInfo* pOperator, const SSDataBlock* pR
|
|||
if (code != TSDB_CODE_SUCCESS) {
|
||||
qError("failed to get table meta, uid:0x%" PRIx64 ", code:%s, %s", item->uid, tstrerror(terrno),
|
||||
GET_TASKID(pTaskInfo));
|
||||
pAPI->metaReaderFn.clearReader(mr);
|
||||
goto _end;
|
||||
}
|
||||
|
||||
|
@ -4910,6 +4909,12 @@ static int32_t doTagScanFromMetaEntryNext(SOperatorInfo* pOperator, SSDataBlock*
|
|||
|
||||
while (pInfo->curPos < size && count < pOperator->resultInfo.capacity) {
|
||||
code = doTagScanOneTable(pOperator, pRes, count, &mr, &pTaskInfo->storageAPI);
|
||||
if (code == TSDB_CODE_OUT_OF_MEMORY) {
|
||||
break;
|
||||
} else {
|
||||
// ignore other error
|
||||
}
|
||||
|
||||
++count;
|
||||
if (++pInfo->curPos >= size) {
|
||||
setOperatorCompleted(pOperator);
|
||||
|
@ -5138,7 +5143,7 @@ static int32_t fetchNextSubTableBlockFromReader(SOperatorInfo* pOperator, STmsSu
|
|||
pInfo->base.dataReader = pInput->pReader;
|
||||
|
||||
while (true) {
|
||||
bool hasNext = false;
|
||||
bool hasNext = false;
|
||||
code = pAPI->tsdReader.tsdNextDataBlock(pInfo->base.dataReader, &hasNext);
|
||||
if (code != 0) {
|
||||
pAPI->tsdReader.tsdReaderReleaseDataBlock(pInfo->base.dataReader);
|
||||
|
@ -5249,7 +5254,7 @@ static int32_t openSubTablesMergeSort(STmsSubTablesMergeInfo* pSubTblsInfo) {
|
|||
static int32_t initSubTablesMergeInfo(STableMergeScanInfo* pInfo) {
|
||||
int32_t code = setGroupStartEndIndex(pInfo);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(code));
|
||||
qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
STmsSubTablesMergeInfo* pSubTblsInfo = taosMemoryCalloc(1, sizeof(STmsSubTablesMergeInfo));
|
||||
|
@ -5278,8 +5283,7 @@ static int32_t initSubTablesMergeInfo(STableMergeScanInfo* pInfo) {
|
|||
}
|
||||
int32_t bufPageSize = pInfo->bufPageSize;
|
||||
int32_t inMemSize = (pSubTblsInfo->numSubTables - pSubTblsInfo->numTableBlocksInMem) * bufPageSize;
|
||||
code =
|
||||
createDiskbasedBuf(&pSubTblsInfo->pBlocksBuf, pInfo->bufPageSize, inMemSize, "blocksExternalBuf", tsTempDir);
|
||||
code = createDiskbasedBuf(&pSubTblsInfo->pBlocksBuf, pInfo->bufPageSize, inMemSize, "blocksExternalBuf", tsTempDir);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
taosMemoryFree(pSubTblsInfo->aInputs);
|
||||
taosMemoryFree(pSubTblsInfo);
|
||||
|
@ -5412,7 +5416,7 @@ static int32_t appendChosenRowToDataBlock(STmsSubTablesMergeInfo* pSubTblsInfo,
|
|||
|
||||
SColumnInfoData* pSrcColInfo = taosArrayGet(pInputBlock->pDataBlock, i);
|
||||
QUERY_CHECK_NULL(pSrcColInfo, code, lino, _end, terrno);
|
||||
bool isNull = colDataIsNull(pSrcColInfo, pInputBlock->info.rows, pInput->rowIdx, NULL);
|
||||
bool isNull = colDataIsNull(pSrcColInfo, pInputBlock->info.rows, pInput->rowIdx, NULL);
|
||||
|
||||
if (isNull) {
|
||||
code = colDataSetVal(pColInfo, pBlock->info.rows, NULL, true);
|
||||
|
@ -5436,7 +5440,8 @@ _end:
|
|||
return code;
|
||||
}
|
||||
|
||||
static int32_t getSubTablesSortedBlock(SOperatorInfo* pOperator, SSDataBlock* pBlock, int32_t capacity, SSDataBlock** pResBlock) {
|
||||
static int32_t getSubTablesSortedBlock(SOperatorInfo* pOperator, SSDataBlock* pBlock, int32_t capacity,
|
||||
SSDataBlock** pResBlock) {
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
int32_t lino = 0;
|
||||
STableMergeScanInfo* pInfo = pOperator->info;
|
||||
|
@ -5793,9 +5798,9 @@ static int32_t getBlockForTableMergeScan(void* param, SSDataBlock** ppBlock) {
|
|||
}
|
||||
|
||||
int32_t generateSortByTsPkInfo(SArray* colMatchInfo, int32_t order, SArray** ppSortArray) {
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
int32_t lino = 0;
|
||||
SArray* pSortInfo = taosArrayInit(1, sizeof(SBlockOrderInfo));
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
int32_t lino = 0;
|
||||
SArray* pSortInfo = taosArrayInit(1, sizeof(SBlockOrderInfo));
|
||||
QUERY_CHECK_NULL(pSortInfo, code, lino, _end, terrno);
|
||||
SBlockOrderInfo biTs = {0};
|
||||
SBlockOrderInfo biPk = {0};
|
||||
|
@ -6196,7 +6201,7 @@ int32_t getTableMergeScanExplainExecInfo(SOperatorInfo* pOptr, void** pOptrExpla
|
|||
if (!execInfo) {
|
||||
return terrno;
|
||||
}
|
||||
STableMergeScanInfo* pInfo = pOptr->info;
|
||||
STableMergeScanInfo* pInfo = pOptr->info;
|
||||
execInfo->blockRecorder = pInfo->base.readRecorder;
|
||||
execInfo->sortExecInfo = pInfo->sortExecInfo;
|
||||
|
||||
|
@ -6339,24 +6344,24 @@ _error:
|
|||
|
||||
// ====================================================================================================================
|
||||
// TableCountScanOperator
|
||||
static void destoryTableCountScanOperator(void* param);
|
||||
static int32_t buildVnodeGroupedStbTableCount(STableCountScanOperatorInfo* pInfo, STableCountScanSupp* pSupp,
|
||||
SSDataBlock* pRes, char* dbName, tb_uid_t stbUid, SStorageAPI* pAPI);
|
||||
static int32_t buildVnodeGroupedNtbTableCount(STableCountScanOperatorInfo* pInfo, STableCountScanSupp* pSupp,
|
||||
SSDataBlock* pRes, char* dbName, SStorageAPI* pAPI);
|
||||
static int32_t buildVnodeFilteredTbCount(SOperatorInfo* pOperator, STableCountScanOperatorInfo* pInfo,
|
||||
STableCountScanSupp* pSupp, SSDataBlock* pRes, char* dbName);
|
||||
static int32_t buildVnodeGroupedTableCount(SOperatorInfo* pOperator, STableCountScanOperatorInfo* pInfo,
|
||||
STableCountScanSupp* pSupp, SSDataBlock* pRes, int32_t vgId, char* dbName);
|
||||
static int32_t buildVnodeDbTableCount(SOperatorInfo* pOperator, STableCountScanOperatorInfo* pInfo,
|
||||
STableCountScanSupp* pSupp, SSDataBlock* pRes);
|
||||
static void buildSysDbGroupedTableCount(SOperatorInfo* pOperator, STableCountScanOperatorInfo* pInfo,
|
||||
STableCountScanSupp* pSupp, SSDataBlock* pRes, size_t infodbTableNum,
|
||||
size_t perfdbTableNum);
|
||||
static void buildSysDbFilterTableCount(SOperatorInfo* pOperator, STableCountScanSupp* pSupp, SSDataBlock* pRes,
|
||||
size_t infodbTableNum, size_t perfdbTableNum);
|
||||
static const char* GROUP_TAG_DB_NAME = "db_name";
|
||||
static const char* GROUP_TAG_STABLE_NAME = "stable_name";
|
||||
static void destoryTableCountScanOperator(void* param);
|
||||
static int32_t buildVnodeGroupedStbTableCount(STableCountScanOperatorInfo* pInfo, STableCountScanSupp* pSupp,
|
||||
SSDataBlock* pRes, char* dbName, tb_uid_t stbUid, SStorageAPI* pAPI);
|
||||
static int32_t buildVnodeGroupedNtbTableCount(STableCountScanOperatorInfo* pInfo, STableCountScanSupp* pSupp,
|
||||
SSDataBlock* pRes, char* dbName, SStorageAPI* pAPI);
|
||||
static int32_t buildVnodeFilteredTbCount(SOperatorInfo* pOperator, STableCountScanOperatorInfo* pInfo,
|
||||
STableCountScanSupp* pSupp, SSDataBlock* pRes, char* dbName);
|
||||
static int32_t buildVnodeGroupedTableCount(SOperatorInfo* pOperator, STableCountScanOperatorInfo* pInfo,
|
||||
STableCountScanSupp* pSupp, SSDataBlock* pRes, int32_t vgId, char* dbName);
|
||||
static int32_t buildVnodeDbTableCount(SOperatorInfo* pOperator, STableCountScanOperatorInfo* pInfo,
|
||||
STableCountScanSupp* pSupp, SSDataBlock* pRes);
|
||||
static void buildSysDbGroupedTableCount(SOperatorInfo* pOperator, STableCountScanOperatorInfo* pInfo,
|
||||
STableCountScanSupp* pSupp, SSDataBlock* pRes, size_t infodbTableNum,
|
||||
size_t perfdbTableNum);
|
||||
static void buildSysDbFilterTableCount(SOperatorInfo* pOperator, STableCountScanSupp* pSupp, SSDataBlock* pRes,
|
||||
size_t infodbTableNum, size_t perfdbTableNum);
|
||||
static const char* GROUP_TAG_DB_NAME = "db_name";
|
||||
static const char* GROUP_TAG_STABLE_NAME = "stable_name";
|
||||
|
||||
int32_t tblCountScanGetGroupTagsSlotId(const SNodeList* scanCols, STableCountScanSupp* supp) {
|
||||
if (scanCols != NULL) {
|
||||
|
@ -6691,7 +6696,7 @@ _end:
|
|||
}
|
||||
|
||||
static int32_t buildVnodeGroupedTableCount(SOperatorInfo* pOperator, STableCountScanOperatorInfo* pInfo,
|
||||
STableCountScanSupp* pSupp, SSDataBlock* pRes, int32_t vgId, char* dbName) {
|
||||
STableCountScanSupp* pSupp, SSDataBlock* pRes, int32_t vgId, char* dbName) {
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
int32_t lino = 0;
|
||||
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
|
||||
|
@ -6739,7 +6744,7 @@ _end:
|
|||
}
|
||||
|
||||
static int32_t buildVnodeFilteredTbCount(SOperatorInfo* pOperator, STableCountScanOperatorInfo* pInfo,
|
||||
STableCountScanSupp* pSupp, SSDataBlock* pRes, char* dbName) {
|
||||
STableCountScanSupp* pSupp, SSDataBlock* pRes, char* dbName) {
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
int32_t lino = 0;
|
||||
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
|
||||
|
|
|
@ -293,7 +293,9 @@ void doTimeWindowInterpolation(SArray* pPrevValues, SArray* pDataBlock, TSKEY pr
|
|||
SPoint point2 = (SPoint){.key = curTs, .val = &v2};
|
||||
SPoint point = (SPoint){.key = windowKey, .val = &v};
|
||||
|
||||
taosGetLinearInterpolationVal(&point, TSDB_DATA_TYPE_DOUBLE, &point1, &point2, TSDB_DATA_TYPE_DOUBLE);
|
||||
if (!fmIsElapsedFunc(pCtx[k].functionId)) {
|
||||
taosGetLinearInterpolationVal(&point, TSDB_DATA_TYPE_DOUBLE, &point1, &point2, TSDB_DATA_TYPE_DOUBLE);
|
||||
}
|
||||
|
||||
if (type == RESULT_ROW_START_INTERP) {
|
||||
pCtx[k].start.key = point.key;
|
||||
|
@ -639,7 +641,11 @@ static void doInterpUnclosedTimeWindow(SOperatorInfo* pOperatorInfo, int32_t num
|
|||
|
||||
int64_t prevTs = *(int64_t*)pTsKey->pData;
|
||||
if (groupId == pBlock->info.id.groupId) {
|
||||
doTimeWindowInterpolation(pInfo->pPrevValues, pBlock->pDataBlock, prevTs, -1, tsCols[startPos], startPos, w.ekey,
|
||||
TSKEY curTs = pBlock->info.window.skey;
|
||||
if (tsCols != NULL) {
|
||||
curTs = tsCols[startPos];
|
||||
}
|
||||
doTimeWindowInterpolation(pInfo->pPrevValues, pBlock->pDataBlock, prevTs, -1, curTs, startPos, w.ekey,
|
||||
RESULT_ROW_END_INTERP, pSup);
|
||||
}
|
||||
|
||||
|
|
|
@ -152,6 +152,7 @@ int32_t getIrateInfoSize(int32_t pkBytes);
|
|||
int32_t cachedLastRowFunction(SqlFunctionCtx* pCtx);
|
||||
|
||||
bool getFirstLastFuncEnv(struct SFunctionNode* pFunc, SFuncExecEnv* pEnv);
|
||||
int32_t firstLastFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResultInfo);
|
||||
int32_t firstFunction(SqlFunctionCtx* pCtx);
|
||||
int32_t firstFunctionMerge(SqlFunctionCtx* pCtx);
|
||||
int32_t lastFunction(SqlFunctionCtx* pCtx);
|
||||
|
|
|
@ -3469,7 +3469,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
|
|||
.translateFunc = translateFirstLast,
|
||||
.dynDataRequiredFunc = lastDynDataReq,
|
||||
.getEnvFunc = getFirstLastFuncEnv,
|
||||
.initFunc = functionSetup,
|
||||
.initFunc = firstLastFunctionSetup,
|
||||
.processFunc = lastFunction,
|
||||
.sprocessFunc = firstLastScalarFunction,
|
||||
.finalizeFunc = firstLastFinalize,
|
||||
|
|
|
@ -2617,6 +2617,22 @@ static FORCE_INLINE TSKEY getRowPTs(SColumnInfoData* pTsColInfo, int32_t rowInde
|
|||
return *(TSKEY*)colDataGetData(pTsColInfo, rowIndex);
|
||||
}
|
||||
|
||||
int32_t firstLastFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResInfo) {
|
||||
if (pResInfo->initialized) {
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS != functionSetup(pCtx, pResInfo)) {
|
||||
return TSDB_CODE_FUNC_SETUP_ERROR;
|
||||
}
|
||||
|
||||
SFirstLastRes * pRes = GET_ROWCELL_INTERBUF(pResInfo);
|
||||
SInputColumnInfoData* pInput = &pCtx->input;
|
||||
|
||||
pRes->nullTupleSaved = false;
|
||||
pRes->nullTuplePos.pageId = -1;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t prepareBuf(SqlFunctionCtx* pCtx) {
|
||||
if (pCtx->subsidiaries.rowLen == 0) {
|
||||
int32_t rowLen = 0;
|
||||
|
@ -2635,7 +2651,7 @@ static int32_t prepareBuf(SqlFunctionCtx* pCtx) {
|
|||
}
|
||||
|
||||
static int32_t firstlastSaveTupleData(const SSDataBlock* pSrcBlock, int32_t rowIndex, SqlFunctionCtx* pCtx,
|
||||
SFirstLastRes* pInfo) {
|
||||
SFirstLastRes* pInfo, bool noElements) {
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
|
||||
if (pCtx->subsidiaries.num <= 0) {
|
||||
|
@ -2643,7 +2659,7 @@ static int32_t firstlastSaveTupleData(const SSDataBlock* pSrcBlock, int32_t rowI
|
|||
}
|
||||
|
||||
if (!pInfo->hasResult) {
|
||||
code = saveTupleData(pCtx, rowIndex, pSrcBlock, &pInfo->pos);
|
||||
code = saveTupleData(pCtx, rowIndex, pSrcBlock, noElements ? &pInfo->nullTuplePos : &pInfo->pos);
|
||||
} else {
|
||||
code = updateTupleData(pCtx, rowIndex, pSrcBlock, &pInfo->pos);
|
||||
}
|
||||
|
@ -2669,7 +2685,7 @@ static int32_t doSaveCurrentVal(SqlFunctionCtx* pCtx, int32_t rowIndex, int64_t
|
|||
}
|
||||
|
||||
pInfo->ts = currentTs;
|
||||
int32_t code = firstlastSaveTupleData(pCtx->pSrcBlock, rowIndex, pCtx, pInfo);
|
||||
int32_t code = firstlastSaveTupleData(pCtx->pSrcBlock, rowIndex, pCtx, pInfo, false);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
|
@ -2708,10 +2724,11 @@ int32_t firstFunction(SqlFunctionCtx* pCtx) {
|
|||
if (pInput->colDataSMAIsSet && (pInput->pColumnDataAgg[0]->numOfNull == pInput->totalRows) &&
|
||||
pInputCol->hasNull == true) {
|
||||
// save selectivity value for column consisted of all null values
|
||||
int32_t code = firstlastSaveTupleData(pCtx->pSrcBlock, pInput->startRowIndex, pCtx, pInfo);
|
||||
int32_t code = firstlastSaveTupleData(pCtx->pSrcBlock, pInput->startRowIndex, pCtx, pInfo, !pInfo->nullTupleSaved);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
pInfo->nullTupleSaved = true;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -2802,10 +2819,11 @@ int32_t firstFunction(SqlFunctionCtx* pCtx) {
|
|||
|
||||
if (numOfElems == 0) {
|
||||
// save selectivity value for column consisted of all null values
|
||||
int32_t code = firstlastSaveTupleData(pCtx->pSrcBlock, pInput->startRowIndex, pCtx, pInfo);
|
||||
int32_t code = firstlastSaveTupleData(pCtx->pSrcBlock, pInput->startRowIndex, pCtx, pInfo, !pInfo->nullTupleSaved);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
pInfo->nullTupleSaved = true;
|
||||
}
|
||||
SET_VAL(pResInfo, numOfElems, 1);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -2841,10 +2859,11 @@ int32_t lastFunction(SqlFunctionCtx* pCtx) {
|
|||
if (pInput->colDataSMAIsSet && (pInput->pColumnDataAgg[0]->numOfNull == pInput->totalRows) &&
|
||||
pInputCol->hasNull == true) {
|
||||
// save selectivity value for column consisted of all null values
|
||||
int32_t code = firstlastSaveTupleData(pCtx->pSrcBlock, pInput->startRowIndex, pCtx, pInfo);
|
||||
int32_t code = firstlastSaveTupleData(pCtx->pSrcBlock, pInput->startRowIndex, pCtx, pInfo, !pInfo->nullTupleSaved);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
pInfo->nullTupleSaved = true;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -2983,10 +3002,11 @@ int32_t lastFunction(SqlFunctionCtx* pCtx) {
|
|||
|
||||
// save selectivity value for column consisted of all null values
|
||||
if (numOfElems == 0) {
|
||||
int32_t code = firstlastSaveTupleData(pCtx->pSrcBlock, pInput->startRowIndex, pCtx, pInfo);
|
||||
int32_t code = firstlastSaveTupleData(pCtx->pSrcBlock, pInput->startRowIndex, pCtx, pInfo, !pInfo->nullTupleSaved);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
pInfo->nullTupleSaved = true;
|
||||
}
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -3031,7 +3051,7 @@ static bool firstLastTransferInfoImpl(SFirstLastRes* pInput, SFirstLastRes* pOut
|
|||
static int32_t firstLastTransferInfo(SqlFunctionCtx* pCtx, SFirstLastRes* pInput, SFirstLastRes* pOutput, bool isFirst,
|
||||
int32_t rowIndex) {
|
||||
if (firstLastTransferInfoImpl(pInput, pOutput, isFirst)) {
|
||||
int32_t code = firstlastSaveTupleData(pCtx->pSrcBlock, rowIndex, pCtx, pOutput);
|
||||
int32_t code = firstlastSaveTupleData(pCtx->pSrcBlock, rowIndex, pCtx, pOutput, pOutput->nullTupleSaved);
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
return code;
|
||||
}
|
||||
|
@ -3079,6 +3099,14 @@ static int32_t firstLastFunctionMergeImpl(SqlFunctionCtx* pCtx, bool isFirstQuer
|
|||
}
|
||||
}
|
||||
|
||||
if (numOfElems == 0) {
|
||||
int32_t code = firstlastSaveTupleData(pCtx->pSrcBlock, pInput->startRowIndex, pCtx, pInfo, !pInfo->nullTupleSaved);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
pInfo->nullTupleSaved = true;
|
||||
}
|
||||
|
||||
SET_VAL(GET_RES_INFO(pCtx), numOfElems, 1);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
@ -3099,6 +3127,11 @@ int32_t firstLastFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
|
|||
pResInfo->isNullRes = (pResInfo->numOfRes == 0) ? 1 : 0;
|
||||
|
||||
SFirstLastRes* pRes = GET_ROWCELL_INTERBUF(pResInfo);
|
||||
|
||||
if (pResInfo->isNullRes) {
|
||||
colDataSetNULL(pCol, pBlock->info.rows);
|
||||
return setSelectivityValue(pCtx, pBlock, &pRes->nullTuplePos, pBlock->info.rows);
|
||||
}
|
||||
code = colDataSetVal(pCol, pBlock->info.rows, pRes->buf, pRes->isNull || pResInfo->isNullRes);
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
return code;
|
||||
|
@ -3134,12 +3167,16 @@ int32_t firstLastPartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
|
|||
return TSDB_CODE_OUT_OF_RANGE;
|
||||
}
|
||||
|
||||
code = colDataSetVal(pCol, pBlock->info.rows, res, false);
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
if (pEntryInfo->numOfRes == 0) {
|
||||
colDataSetNULL(pCol, pBlock->info.rows);
|
||||
code = setSelectivityValue(pCtx, pBlock, &pRes->nullTuplePos, pBlock->info.rows);
|
||||
} else {
|
||||
code = colDataSetVal(pCol, pBlock->info.rows, res, false);
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
code = setSelectivityValue(pCtx, pBlock, &pRes->pos, pBlock->info.rows);
|
||||
}
|
||||
code = setSelectivityValue(pCtx, pBlock, &pRes->pos, pBlock->info.rows);
|
||||
|
||||
taosMemoryFree(res);
|
||||
return code;
|
||||
}
|
||||
|
@ -3185,7 +3222,7 @@ static int32_t doSaveLastrow(SqlFunctionCtx* pCtx, char* pData, int32_t rowIndex
|
|||
pInfo->pkData = pInfo->buf + pInfo->bytes;
|
||||
}
|
||||
pInfo->ts = cts;
|
||||
int32_t code = firstlastSaveTupleData(pCtx->pSrcBlock, rowIndex, pCtx, pInfo);
|
||||
int32_t code = firstlastSaveTupleData(pCtx->pSrcBlock, rowIndex, pCtx, pInfo, false);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
|
|
|
@ -276,6 +276,13 @@ bool fmisSelectGroupConstValueFunc(int32_t funcId) {
|
|||
return FUNCTION_TYPE_GROUP_CONST_VALUE == funcMgtBuiltins[funcId].type;
|
||||
}
|
||||
|
||||
bool fmIsElapsedFunc(int32_t funcId) {
|
||||
if (funcId < 0 || funcId >= funcMgtBuiltinsNum) {
|
||||
return false;
|
||||
}
|
||||
return FUNCTION_TYPE_ELAPSED == funcMgtBuiltins[funcId].type;
|
||||
}
|
||||
|
||||
bool fmIsBlockDistFunc(int32_t funcId) {
|
||||
if (funcId < 0 || funcId >= funcMgtBuiltinsNum) {
|
||||
return false;
|
||||
|
|
|
@ -30,7 +30,7 @@ char* idxPackJsonData(SIndexTerm* itm);
|
|||
char* idxPackJsonDataPrefix(SIndexTerm* itm, int32_t* skip);
|
||||
char* idxPackJsonDataPrefixNoType(SIndexTerm* itm, int32_t* skip);
|
||||
|
||||
typedef enum { MATCH, CONTINUE, BREAK } TExeCond;
|
||||
typedef enum { MATCH, CONTINUE, BREAK, FAILED } TExeCond;
|
||||
|
||||
typedef TExeCond (*_cache_range_compare)(void* a, void* b, int8_t type);
|
||||
|
||||
|
|
|
@ -153,9 +153,8 @@ static int32_t cacheSearchCompareFunc(void* cache, SIndexTerm* term, SIdxTRslt*
|
|||
break;
|
||||
}
|
||||
CacheTerm* c = (CacheTerm*)SL_GET_NODE_DATA(node);
|
||||
terrno = TSDB_CODE_SUCCESS;
|
||||
TExeCond cond = cmpFn(c->colVal, pCt->colVal, pCt->colType);
|
||||
if (terrno != TSDB_CODE_SUCCESS) {
|
||||
if (cond == FAILED) {
|
||||
code = terrno;
|
||||
goto _return;
|
||||
}
|
||||
|
@ -335,10 +334,9 @@ static int32_t cacheSearchCompareFunc_JSON(void* cache, SIndexTerm* term, SIdxTR
|
|||
goto _return;
|
||||
}
|
||||
memcpy(p, c->colVal, strlen(c->colVal));
|
||||
terrno = TSDB_CODE_SUCCESS;
|
||||
cond = cmpFn(p + skip, term->colVal, dType);
|
||||
taosMemoryFree(p);
|
||||
if (terrno != TSDB_CODE_SUCCESS) {
|
||||
if (cond == FAILED) {
|
||||
code = terrno;
|
||||
goto _return;
|
||||
}
|
||||
|
|
|
@ -118,6 +118,14 @@ static FORCE_INLINE TExeCond tCompareContains(void* a, void* b, int8_t type) {
|
|||
}
|
||||
return tCompare(func, QUERY_TERM, a, b, type);
|
||||
}
|
||||
|
||||
#define CHECKCOMERROR(expr) \
|
||||
do { \
|
||||
if ((expr) != 0) { \
|
||||
return FAILED; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
static FORCE_INLINE TExeCond tCompareEqual(void* a, void* b, int8_t type) {
|
||||
__compar_fn_t func = idxGetCompar(type);
|
||||
if (func == NULL) {
|
||||
|
@ -132,36 +140,52 @@ TExeCond tCompare(__compar_fn_t func, int8_t cmptype, void* a, void* b, int8_t d
|
|||
}
|
||||
#if 1
|
||||
if (dtype == TSDB_DATA_TYPE_TIMESTAMP) {
|
||||
int64_t va = taosStr2int64(a);
|
||||
int64_t vb = taosStr2int64(b);
|
||||
int64_t va;
|
||||
CHECKCOMERROR(taosStr2int64(a, &va));
|
||||
int64_t vb;
|
||||
CHECKCOMERROR(taosStr2int64(b, &vb));
|
||||
return tDoCompare(func, cmptype, &va, &vb);
|
||||
} else if (dtype == TSDB_DATA_TYPE_BOOL || dtype == TSDB_DATA_TYPE_UTINYINT) {
|
||||
uint8_t va = taosStr2int64(a);
|
||||
uint8_t vb = taosStr2int64(b);
|
||||
uint8_t va;
|
||||
CHECKCOMERROR(taosStr2int8(a, &va));
|
||||
uint8_t vb;
|
||||
CHECKCOMERROR(taosStr2int8(b, &vb));
|
||||
return tDoCompare(func, cmptype, &va, &vb);
|
||||
} else if (dtype == TSDB_DATA_TYPE_TINYINT) {
|
||||
int8_t va = taosStr2int64(a);
|
||||
int8_t vb = taosStr2int64(b);
|
||||
int8_t va;
|
||||
CHECKCOMERROR(taosStr2int8(a, &va));
|
||||
int8_t vb;
|
||||
CHECKCOMERROR(taosStr2int8(b, &vb));
|
||||
return tDoCompare(func, cmptype, &va, &vb);
|
||||
} else if (dtype == TSDB_DATA_TYPE_SMALLINT) {
|
||||
int16_t va = taosStr2int64(a);
|
||||
int16_t vb = taosStr2int64(b);
|
||||
int16_t va;
|
||||
CHECKCOMERROR(taosStr2int16(a, &va));
|
||||
int16_t vb;
|
||||
CHECKCOMERROR(taosStr2int16(b, &vb));
|
||||
return tDoCompare(func, cmptype, &va, &vb);
|
||||
} else if (dtype == TSDB_DATA_TYPE_USMALLINT) {
|
||||
uint16_t va = taosStr2int64(a);
|
||||
uint16_t vb = taosStr2int64(b);
|
||||
uint16_t va;
|
||||
CHECKCOMERROR(taosStr2int16(a, &va));
|
||||
uint16_t vb;
|
||||
CHECKCOMERROR(taosStr2int16(b, &vb));
|
||||
return tDoCompare(func, cmptype, &va, &vb);
|
||||
} else if (dtype == TSDB_DATA_TYPE_INT) {
|
||||
int32_t va = taosStr2int64(a);
|
||||
int32_t vb = taosStr2int64(b);
|
||||
int32_t va;
|
||||
CHECKCOMERROR(taosStr2int32(a, &va));
|
||||
int32_t vb;
|
||||
CHECKCOMERROR(taosStr2int32(b, &vb));
|
||||
return tDoCompare(func, cmptype, &va, &vb);
|
||||
} else if (dtype == TSDB_DATA_TYPE_UINT) {
|
||||
uint32_t va = taosStr2int64(a);
|
||||
uint32_t vb = taosStr2int64(b);
|
||||
uint32_t va;
|
||||
CHECKCOMERROR(taosStr2int32(a, &va));
|
||||
uint32_t vb;
|
||||
CHECKCOMERROR(taosStr2int32(b, &vb));
|
||||
return tDoCompare(func, cmptype, &va, &vb);
|
||||
} else if (dtype == TSDB_DATA_TYPE_BIGINT) {
|
||||
int64_t va = taosStr2int64(a);
|
||||
int64_t vb = taosStr2int64(b);
|
||||
int64_t va;
|
||||
CHECKCOMERROR(taosStr2int64(a, &va));
|
||||
int64_t vb;
|
||||
CHECKCOMERROR(taosStr2int64(b, &vb));
|
||||
return tDoCompare(func, cmptype, &va, &vb);
|
||||
} else if (dtype == TSDB_DATA_TYPE_UBIGINT) {
|
||||
uint64_t va, vb;
|
||||
|
|
|
@ -367,9 +367,8 @@ static int32_t tfSearchCompareFunc(void* reader, SIndexTerm* tem, SIdxTRslt* tr,
|
|||
FstSlice* s = &rt->data;
|
||||
char* ch = (char*)fstSliceData(s, NULL);
|
||||
|
||||
terrno = TSDB_CODE_SUCCESS;
|
||||
TExeCond cond = cmpFn(ch, p, tem->colType);
|
||||
if (TSDB_CODE_SUCCESS != terrno) {
|
||||
if (FAILED == cond) {
|
||||
swsResultDestroy(rt);
|
||||
code = terrno;
|
||||
goto _return;
|
||||
|
@ -520,10 +519,9 @@ static int32_t tfSearchCompareFunc_JSON(void* reader, SIndexTerm* tem, SIdxTRslt
|
|||
goto _return;
|
||||
}
|
||||
memcpy(tBuf, ch, sz);
|
||||
terrno = TSDB_CODE_SUCCESS;
|
||||
cond = cmpFn(tBuf + skip, tem->colVal, IDX_TYPE_GET_TYPE(tem->colType));
|
||||
taosMemoryFree(tBuf);
|
||||
if (TSDB_CODE_SUCCESS != terrno) {
|
||||
if (FAILED == cond) {
|
||||
swsResultDestroy(rt);
|
||||
code = terrno;
|
||||
goto _return;
|
||||
|
|
|
@ -328,13 +328,17 @@ TEST_F(UtilEnv, testFill) {
|
|||
int64_t val = i;
|
||||
char buf[65] = {0};
|
||||
idxInt2str(val, buf, 1);
|
||||
EXPECT_EQ(val, taosStr2int64(buf));
|
||||
int64_t ret = 0;
|
||||
taosStr2int64(buf, &ret);
|
||||
EXPECT_EQ(val, ret);
|
||||
}
|
||||
for (int i = 0; i < 1000000; i++) {
|
||||
int64_t val = 0 - i;
|
||||
char buf[65] = {0};
|
||||
idxInt2str(val, buf, -1);
|
||||
EXPECT_EQ(val, taosStr2int64(buf));
|
||||
int64_t ret = 0;
|
||||
taosStr2int64(buf, &ret);
|
||||
EXPECT_EQ(val, ret);
|
||||
}
|
||||
}
|
||||
TEST_F(UtilEnv, TempResult) {
|
||||
|
|
|
@ -235,7 +235,10 @@ void nodesDestroyAllocatorSet() {
|
|||
int64_t refId = 0;
|
||||
while (NULL != pAllocator) {
|
||||
refId = pAllocator->self;
|
||||
(void)taosRemoveRef(g_allocatorReqRefPool, refId);
|
||||
int32_t code = taosRemoveRef(g_allocatorReqRefPool, refId);
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
nodesError("failed to remove ref at: %s:%d, rsetId:%d, refId:%"PRId64, __func__, __LINE__, g_allocatorReqRefPool, refId);
|
||||
}
|
||||
pAllocator = taosIterateRef(g_allocatorReqRefPool, refId);
|
||||
}
|
||||
taosCloseRef(g_allocatorReqRefPool);
|
||||
|
@ -328,7 +331,10 @@ void nodesDestroyAllocator(int64_t allocatorId) {
|
|||
return;
|
||||
}
|
||||
|
||||
(void)taosRemoveRef(g_allocatorReqRefPool, allocatorId);
|
||||
int32_t code = taosRemoveRef(g_allocatorReqRefPool, allocatorId);
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
nodesError("failed to remove ref at: %s:%d, rsetId:%d, refId:%"PRId64, __func__, __LINE__, g_allocatorReqRefPool, allocatorId);
|
||||
}
|
||||
}
|
||||
|
||||
static int32_t makeNode(ENodeType type, int32_t size, SNode** ppNode) {
|
||||
|
@ -1092,7 +1098,10 @@ void nodesDestroyNode(SNode* pNode) {
|
|||
pStmt->destroyParseFileCxt(&pStmt->pParFileCxt);
|
||||
}
|
||||
|
||||
(void)taosCloseFile(&pStmt->fp);
|
||||
int32_t code = taosCloseFile(&pStmt->fp);
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
nodesError("failed to close file: %s:%d", __func__, __LINE__);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case QUERY_NODE_CREATE_DATABASE_STMT:
|
||||
|
|
|
@ -46,7 +46,7 @@ static int32_t setUserAuthInfo(SParseContext* pCxt, const char* pDbName, const c
|
|||
int32_t code = tNameSetDbName(&pAuth->tbName, pCxt->acctId, pDbName, strlen(pDbName));
|
||||
if (TSDB_CODE_SUCCESS != code) return code;
|
||||
} else {
|
||||
(void)toName(pCxt->acctId, pDbName, pTabName, &pAuth->tbName);
|
||||
toName(pCxt->acctId, pDbName, pTabName, &pAuth->tbName);
|
||||
}
|
||||
pAuth->type = type;
|
||||
pAuth->isView = isView;
|
||||
|
@ -171,8 +171,9 @@ static EDealRes authSelectImpl(SNode* pNode, void* pContext) {
|
|||
#ifdef TD_ENTERPRISE
|
||||
SName name;
|
||||
STableMeta* pTableMeta = NULL;
|
||||
toName(pAuthCxt->pParseCxt->acctId, pTable->dbName, pTable->tableName, &name);
|
||||
int32_t code = getTargetMetaImpl(
|
||||
pAuthCxt->pParseCxt, pAuthCxt->pMetaCache, toName(pAuthCxt->pParseCxt->acctId, pTable->dbName, pTable->tableName, &name), &pTableMeta, true);
|
||||
pAuthCxt->pParseCxt, pAuthCxt->pMetaCache, &name, &pTableMeta, true);
|
||||
if (TSDB_CODE_SUCCESS == code && TSDB_VIEW_TABLE == pTableMeta->tableType) {
|
||||
isView = true;
|
||||
}
|
||||
|
|
|
@ -143,13 +143,13 @@ static int32_t smlBuildTagRow(SArray* cols, SBoundColInfo* tags, SSchema* pSchem
|
|||
goto end;
|
||||
}
|
||||
if (!taosMbsToUcs4(kv->value, kv->length, (TdUcs4*)(p), kv->length * TSDB_NCHAR_SIZE, &output)) {
|
||||
if (errno == E2BIG) {
|
||||
if (terrno == TAOS_SYSTEM_ERROR(E2BIG)) {
|
||||
taosMemoryFree(p);
|
||||
code = generateSyntaxErrMsg(msg, TSDB_CODE_PAR_VALUE_TOO_LONG, pTagSchema->name);
|
||||
goto end;
|
||||
}
|
||||
char buf[512] = {0};
|
||||
(void)snprintf(buf, tListLen(buf), " taosMbsToUcs4 error:%s", strerror(errno));
|
||||
(void)snprintf(buf, tListLen(buf), " taosMbsToUcs4 error:%s", strerror(terrno));
|
||||
taosMemoryFree(p);
|
||||
code = buildSyntaxErrMsg(msg, buf, kv->value);
|
||||
goto end;
|
||||
|
@ -257,7 +257,7 @@ int32_t smlBuildCol(STableDataCxt* pTableCxt, SSchema* schema, void* data, int32
|
|||
goto end;
|
||||
}
|
||||
if (!taosMbsToUcs4(kv->value, kv->length, (TdUcs4*)pUcs4, size, &len)) {
|
||||
if (errno == E2BIG) {
|
||||
if (terrno == TAOS_SYSTEM_ERROR(E2BIG)) {
|
||||
taosMemoryFree(pUcs4);
|
||||
ret = TSDB_CODE_PAR_VALUE_TOO_LONG;
|
||||
goto end;
|
||||
|
@ -404,14 +404,14 @@ int32_t smlBindData(SQuery* query, bool dataFormat, SArray* tags, SArray* colsSc
|
|||
goto end;
|
||||
}
|
||||
if (!taosMbsToUcs4(kv->value, kv->length, (TdUcs4*)pUcs4, pColSchema->bytes - VARSTR_HEADER_SIZE, &len)) {
|
||||
if (errno == E2BIG) {
|
||||
if (terrno == TAOS_SYSTEM_ERROR(E2BIG)) {
|
||||
uError("sml bind taosMbsToUcs4 error, kv length:%d, bytes:%d, kv->value:%s", (int)kv->length,
|
||||
pColSchema->bytes, kv->value);
|
||||
(void)buildInvalidOperationMsg(&pBuf, "value too long");
|
||||
ret = TSDB_CODE_PAR_VALUE_TOO_LONG;
|
||||
goto end;
|
||||
}
|
||||
ret = buildInvalidOperationMsg(&pBuf, strerror(errno));
|
||||
ret = buildInvalidOperationMsg(&pBuf, strerror(terrno));
|
||||
goto end;
|
||||
}
|
||||
pVal->value.pData = pUcs4;
|
||||
|
|
|
@ -682,12 +682,12 @@ static int32_t parseTagToken(const char** end, SToken* pToken, SSchema* pSchema,
|
|||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
if (!taosMbsToUcs4(pToken->z, pToken->n, (TdUcs4*)(p), realLen, &output)) {
|
||||
if (errno == E2BIG) {
|
||||
if (terrno == TAOS_SYSTEM_ERROR(E2BIG)) {
|
||||
taosMemoryFree(p);
|
||||
return generateSyntaxErrMsg(pMsgBuf, TSDB_CODE_PAR_VALUE_TOO_LONG, pSchema->name);
|
||||
}
|
||||
char buf[512] = {0};
|
||||
snprintf(buf, tListLen(buf), " taosMbsToUcs4 error:%s", strerror(errno));
|
||||
snprintf(buf, tListLen(buf), " taosMbsToUcs4 error:%s", strerror(terrno));
|
||||
taosMemoryFree(p);
|
||||
return buildSyntaxErrMsg(pMsgBuf, buf, pToken->z);
|
||||
}
|
||||
|
@ -1616,11 +1616,11 @@ static int32_t parseValueTokenImpl(SInsertParseContext* pCxt, const char** pSql,
|
|||
}
|
||||
if (!taosMbsToUcs4(pToken->z, pToken->n, (TdUcs4*)pUcs4, realLen, &len)) {
|
||||
taosMemoryFree(pUcs4);
|
||||
if (errno == E2BIG) {
|
||||
if (terrno == TAOS_SYSTEM_ERROR(E2BIG)) {
|
||||
return generateSyntaxErrMsg(&pCxt->msg, TSDB_CODE_PAR_VALUE_TOO_LONG, pSchema->name);
|
||||
}
|
||||
char buf[512] = {0};
|
||||
snprintf(buf, tListLen(buf), "%s", strerror(errno));
|
||||
snprintf(buf, tListLen(buf), "%s", strerror(terrno));
|
||||
return buildSyntaxErrMsg(&pCxt->msg, buf, pToken->z);
|
||||
}
|
||||
pVal->value.pData = pUcs4;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue