Merge branch 'release/ver-3.0.2.0' into fix/liao_cov
This commit is contained in:
commit
73cb5d162e
|
@ -101,6 +101,7 @@ tests/examples/JDBC/JDBCDemo/.settings/
|
|||
source/libs/parser/inc/sql.*
|
||||
tests/script/tmqResult.txt
|
||||
tests/tmqResult.txt
|
||||
tests/script/jenkins/basic.txt
|
||||
|
||||
# Emacs
|
||||
# -*- mode: gitignore; -*-
|
||||
|
|
|
@ -201,6 +201,7 @@ def pre_test_win(){
|
|||
'''
|
||||
bat '''
|
||||
cd %WIN_COMMUNITY_ROOT%
|
||||
git clean -fxd
|
||||
git reset --hard
|
||||
git remote prune origin
|
||||
git fetch
|
||||
|
@ -361,7 +362,7 @@ pipeline {
|
|||
}
|
||||
parallel {
|
||||
stage('check docs') {
|
||||
agent{label " worker03 || slave215 || slave217 || slave219 || Mac_catalina "}
|
||||
agent{label " slave1_47 || slave1_48 || slave1_49 || slave1_52 || worker03 || slave215 || slave217 || slave219 || Mac_catalina "}
|
||||
steps {
|
||||
check_docs()
|
||||
}
|
||||
|
@ -407,7 +408,7 @@ pipeline {
|
|||
}
|
||||
}
|
||||
stage('linux test') {
|
||||
agent{label " worker03 || slave215 || slave217 || slave219 "}
|
||||
agent{label " slave1_47 || slave1_48 || slave1_49 || slave1_52 || worker03 || slave215 || slave217 || slave219 "}
|
||||
options { skipDefaultCheckout() }
|
||||
when {
|
||||
changeRequest()
|
||||
|
|
|
@ -60,7 +60,7 @@ sudo apt-get install -y gcc cmake build-essential git libssl-dev
|
|||
为了在 Ubuntu/Debian 系统上编译 [taos-tools](https://github.com/taosdata/taos-tools) 需要安装如下软件:
|
||||
|
||||
```bash
|
||||
sudo apt install build-essential libjansson-dev libsnappy-dev liblzma-dev libz-dev pkg-config
|
||||
sudo apt install build-essential libjansson-dev libsnappy-dev liblzma-dev libz-dev zlib1g pkg-config
|
||||
```
|
||||
|
||||
### CentOS 7.9
|
||||
|
@ -85,7 +85,7 @@ sudo dnf install -y gcc gcc-c++ make cmake epel-release git openssl-devel
|
|||
|
||||
|
||||
```
|
||||
sudo yum install -y zlib-devel xz-devel snappy-devel jansson jansson-devel pkgconfig libatomic libstdc++-static openssl-devel
|
||||
sudo yum install -y zlib-devel zlib-static xz-devel snappy-devel jansson jansson-devel pkgconfig libatomic libatomic-static libstdc++-static openssl-devel
|
||||
```
|
||||
|
||||
#### CentOS 8/Rocky Linux
|
||||
|
@ -94,7 +94,7 @@ sudo yum install -y zlib-devel xz-devel snappy-devel jansson jansson-devel pkgco
|
|||
sudo yum install -y epel-release
|
||||
sudo yum install -y dnf-plugins-core
|
||||
sudo yum config-manager --set-enabled powertools
|
||||
sudo yum install -y zlib-devel xz-devel snappy-devel jansson jansson-devel pkgconfig libatomic libstdc++-static openssl-devel
|
||||
sudo yum install -y zlib-devel zlib-static xz-devel snappy-devel jansson jansson-devel pkgconfig libatomic libatomic-static libstdc++-static openssl-devel
|
||||
```
|
||||
|
||||
注意:由于 snappy 缺乏 pkg-config 支持(参考 [链接](https://github.com/google/snappy/pull/86)),会导致 cmake 提示无法发现 libsnappy,实际上工作正常。
|
||||
|
|
|
@ -31,7 +31,7 @@ TDengine is an open source, high-performance, cloud native [time-series database
|
|||
|
||||
- **[Easy Data Analytics](https://tdengine.com/tdengine/time-series-data-analytics-made-easy/)**: Through super tables, storage and compute separation, data partitioning by time interval, pre-computation and other means, TDengine makes it easy to explore, format, and get access to data in a highly efficient way.
|
||||
|
||||
- **[Open Source](https://tdengine.com/tdengine/open-source-time-series-database/)**: TDengine’s core modules, including cluster feature, are all available under open source licenses. It has gathered 18.8k stars on GitHub. There is an active developer community, and over 139k running instances worldwide.
|
||||
- **[Open Source](https://tdengine.com/tdengine/open-source-time-series-database/)**: TDengine’s core modules, including cluster feature, are all available under open source licenses. It has gathered 19.9k stars on GitHub. There is an active developer community, and over 139k running instances worldwide.
|
||||
|
||||
For a full list of TDengine competitive advantages, please [check here](https://tdengine.com/tdengine/). The easiest way to experience TDengine is through [TDengine Cloud](https://cloud.tdengine.com).
|
||||
|
||||
|
@ -62,7 +62,7 @@ sudo apt-get install -y gcc cmake build-essential git libssl-dev
|
|||
To build the [taosTools](https://github.com/taosdata/taos-tools) on Ubuntu/Debian, the following packages need to be installed.
|
||||
|
||||
```bash
|
||||
sudo apt install build-essential libjansson-dev libsnappy-dev liblzma-dev libz-dev pkg-config
|
||||
sudo apt install build-essential libjansson-dev libsnappy-dev liblzma-dev libz-dev zlib1g pkg-config
|
||||
```
|
||||
|
||||
### CentOS 7.9
|
||||
|
@ -85,7 +85,7 @@ sudo dnf install -y gcc gcc-c++ make cmake epel-release git openssl-devel
|
|||
#### CentOS 7.9
|
||||
|
||||
```
|
||||
sudo yum install -y zlib-devel xz-devel snappy-devel jansson jansson-devel pkgconfig libatomic libstdc++-static openssl-devel
|
||||
sudo yum install -y zlib-devel zlib-static xz-devel snappy-devel jansson jansson-devel pkgconfig libatomic libatomic-static libstdc++-static openssl-devel
|
||||
```
|
||||
|
||||
#### CentOS 8/Rocky Linux
|
||||
|
@ -94,7 +94,7 @@ sudo yum install -y zlib-devel xz-devel snappy-devel jansson jansson-devel pkgco
|
|||
sudo yum install -y epel-release
|
||||
sudo yum install -y dnf-plugins-core
|
||||
sudo yum config-manager --set-enabled powertools
|
||||
sudo yum install -y zlib-devel xz-devel snappy-devel jansson jansson-devel pkgconfig libatomic libstdc++-static openssl-devel
|
||||
sudo yum install -y zlib-devel zlib-static xz-devel snappy-devel jansson jansson-devel pkgconfig libatomic libatomic-static libstdc++-static openssl-devel
|
||||
```
|
||||
|
||||
Note: Since snappy lacks pkg-config support (refer to [link](https://github.com/google/snappy/pull/86)), it leads a cmake prompt libsnappy not found. But snappy still works well.
|
||||
|
|
|
@ -123,14 +123,20 @@ ELSE ()
|
|||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-literal-suffix -Werror=return-type -fPIC -gdwarf-2 -g3 -Wformat=2 -Wno-format-nonliteral -Wno-format-truncation -Wno-format-y2k")
|
||||
ENDIF ()
|
||||
|
||||
MESSAGE("System processor ID: ${CMAKE_SYSTEM_PROCESSOR}")
|
||||
IF (TD_INTEL_64 OR TD_INTEL_32)
|
||||
ADD_DEFINITIONS("-msse4.2")
|
||||
IF("${FMA_SUPPORT}" MATCHES "true")
|
||||
MESSAGE(STATUS "turn fma function support on")
|
||||
MESSAGE(STATUS "fma function supported")
|
||||
ADD_DEFINITIONS("-mfma")
|
||||
ELSE ()
|
||||
MESSAGE(STATUS "turn fma function support off")
|
||||
MESSAGE(STATUS "fma function NOT supported")
|
||||
ENDIF()
|
||||
|
||||
IF("${SIMD_SUPPORT}" MATCHES "true")
|
||||
ADD_DEFINITIONS("-mavx -mavx2")
|
||||
MESSAGE(STATUS "SIMD instructions (AVX/AVX2) is ACTIVATED")
|
||||
ELSE()
|
||||
MESSAGE(STATUS "SIMD instruction (AVX/AVX2)is NOT ACTIVATED")
|
||||
ENDIF()
|
||||
ENDIF ()
|
||||
|
||||
|
|
|
@ -1,20 +1,17 @@
|
|||
cmake_minimum_required(VERSION 3.0)
|
||||
|
||||
MESSAGE("Current system is ${CMAKE_SYSTEM_NAME}")
|
||||
|
||||
# init
|
||||
SET(TD_LINUX FALSE)
|
||||
SET(TD_WINDOWS FALSE)
|
||||
SET(TD_DARWIN FALSE)
|
||||
|
||||
MESSAGE("Compiler ID: ${CMAKE_CXX_COMPILER_ID}")
|
||||
if(CMAKE_COMPILER_IS_GNUCXX MATCHES 1)
|
||||
set(CXX_COMPILER_IS_GNU TRUE)
|
||||
else()
|
||||
set(CXX_COMPILER_IS_GNU FALSE)
|
||||
endif()
|
||||
|
||||
MESSAGE("Current system name is ${CMAKE_SYSTEM_NAME}.")
|
||||
MESSAGE("Current system: ${CMAKE_SYSTEM_NAME}")
|
||||
|
||||
IF (${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
|
||||
|
@ -26,6 +23,8 @@ IF (${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin
|
|||
set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS} -undefined dynamic_lookup")
|
||||
ENDIF ()
|
||||
|
||||
MESSAGE("Current system processor: ${CMAKE_SYSTEM_PROCESSOR}")
|
||||
|
||||
IF (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
|
||||
SET(TD_LINUX TRUE)
|
||||
|
@ -44,7 +43,6 @@ IF (${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin
|
|||
SET(OSTYPE "macOS")
|
||||
ADD_DEFINITIONS("-DDARWIN -Wno-tautological-pointer-compare")
|
||||
|
||||
MESSAGE("Current system processor is ${CMAKE_SYSTEM_PROCESSOR}.")
|
||||
IF (${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm64")
|
||||
MESSAGE("Current system arch is arm64")
|
||||
SET(TD_DARWIN_64 TRUE)
|
||||
|
@ -80,24 +78,24 @@ ELSEIF (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
|||
ENDIF()
|
||||
|
||||
IF ("${CPUTYPE}" STREQUAL "")
|
||||
MESSAGE(STATUS "The current platform " ${CMAKE_SYSTEM_PROCESSOR} " is detected")
|
||||
|
||||
IF (CMAKE_SYSTEM_PROCESSOR MATCHES "(amd64)|(AMD64)")
|
||||
MESSAGE(STATUS "The current platform is amd64")
|
||||
MESSAGE(STATUS "Current platform is amd64")
|
||||
SET(PLATFORM_ARCH_STR "amd64")
|
||||
SET(TD_INTEL_64 TRUE)
|
||||
ADD_DEFINITIONS("-D_TD_X86_")
|
||||
ELSEIF (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)")
|
||||
MESSAGE(STATUS "The current platform is x86")
|
||||
MESSAGE(STATUS "Current platform is x86")
|
||||
SET(PLATFORM_ARCH_STR "i386")
|
||||
SET(TD_INTEL_32 TRUE)
|
||||
ADD_DEFINITIONS("-D_TD_X86_")
|
||||
ELSEIF (CMAKE_SYSTEM_PROCESSOR MATCHES "armv7l")
|
||||
MESSAGE(STATUS "The current platform is aarch32")
|
||||
MESSAGE(STATUS "Current platform is aarch32")
|
||||
SET(PLATFORM_ARCH_STR "arm")
|
||||
SET(TD_ARM_32 TRUE)
|
||||
ADD_DEFINITIONS("-D_TD_ARM_")
|
||||
ADD_DEFINITIONS("-D_TD_ARM_32")
|
||||
ELSEIF (CMAKE_SYSTEM_PROCESSOR MATCHES "(aarch64)|(arm64)")
|
||||
MESSAGE(STATUS "The current platform is aarch64")
|
||||
MESSAGE(STATUS "Current platform is aarch64")
|
||||
SET(PLATFORM_ARCH_STR "arm64")
|
||||
SET(TD_ARM_64 TRUE)
|
||||
ADD_DEFINITIONS("-D_TD_ARM_")
|
||||
|
@ -151,5 +149,5 @@ ENDIF ()
|
|||
|
||||
MESSAGE(STATUS "platform arch:" ${PLATFORM_ARCH_STR})
|
||||
|
||||
MESSAGE("C Compiler ID: ${CMAKE_C_COMPILER_ID}")
|
||||
MESSAGE("CXX Compiler ID: ${CMAKE_CXX_COMPILER_ID}")
|
||||
MESSAGE("C Compiler: ${CMAKE_C_COMPILER} (${CMAKE_C_COMPILER_ID}, ${CMAKE_C_COMPILER_VERSION})")
|
||||
MESSAGE("CXX Compiler: ${CMAKE_CXX_COMPILER} (${CMAKE_C_COMPILER_ID}, ${CMAKE_CXX_COMPILER_VERSION})")
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
IF (DEFINED VERNUMBER)
|
||||
SET(TD_VER_NUMBER ${VERNUMBER})
|
||||
ELSE ()
|
||||
SET(TD_VER_NUMBER "3.0.1.7")
|
||||
SET(TD_VER_NUMBER "3.0.2.0")
|
||||
ENDIF ()
|
||||
|
||||
IF (DEFINED VERCOMPATIBLE)
|
||||
|
@ -26,7 +26,7 @@ ELSEIF (HAVE_GIT)
|
|||
SET(TD_VER_GIT "no git commit id")
|
||||
ENDIF ()
|
||||
ELSE ()
|
||||
message(STATUS "no git cmd")
|
||||
message(STATUS "no git found")
|
||||
SET(TD_VER_GIT "no git commit id")
|
||||
ENDIF ()
|
||||
|
||||
|
@ -70,9 +70,9 @@ MESSAGE(STATUS "compatible: " ${TD_VER_COMPATIBLE})
|
|||
MESSAGE(STATUS "commit id: " ${TD_VER_GIT})
|
||||
MESSAGE(STATUS "build date: " ${TD_VER_DATE})
|
||||
MESSAGE(STATUS "build type: " ${CMAKE_BUILD_TYPE})
|
||||
MESSAGE(STATUS "type: " ${TD_VER_VERTYPE})
|
||||
MESSAGE(STATUS "cpu: " ${TD_VER_CPUTYPE})
|
||||
MESSAGE(STATUS "os: " ${TD_VER_OSTYPE})
|
||||
MESSAGE(STATUS "type: " ${TD_VER_VERTYPE})
|
||||
MESSAGE(STATUS "cpu: " ${TD_VER_CPUTYPE})
|
||||
MESSAGE(STATUS "os: " ${TD_VER_OSTYPE})
|
||||
MESSAGE(STATUS "============= compile version parameter information end ============= ")
|
||||
|
||||
STRING(REPLACE "." "_" TD_LIB_VER_NUMBER ${TD_VER_NUMBER})
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# taosadapter
|
||||
ExternalProject_Add(taosadapter
|
||||
GIT_REPOSITORY https://github.com/taosdata/taosadapter.git
|
||||
GIT_TAG ff7de07
|
||||
GIT_TAG 566540d
|
||||
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter"
|
||||
BINARY_DIR ""
|
||||
#BUILD_IN_SOURCE TRUE
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# taos-tools
|
||||
ExternalProject_Add(taos-tools
|
||||
GIT_REPOSITORY https://github.com/taosdata/taos-tools.git
|
||||
GIT_TAG efa2a5f
|
||||
GIT_TAG 4a4027c
|
||||
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools"
|
||||
BINARY_DIR ""
|
||||
#BUILD_IN_SOURCE TRUE
|
||||
|
|
|
@ -8,6 +8,7 @@ import DiscordSVG from './discord.svg'
|
|||
import TwitterSVG from './twitter.svg'
|
||||
import YouTubeSVG from './youtube.svg'
|
||||
import LinkedInSVG from './linkedin.svg'
|
||||
import StackOverflowSVG from './stackoverflow.svg'
|
||||
|
||||
You can install and run TDengine on Linux/Windows/macOS machines as well as Docker containers. You can also deploy TDengine as a managed service with TDengine Cloud.
|
||||
|
||||
|
@ -35,10 +36,19 @@ The TDengine Knowledge Map covers the various knowledge points of TDengine, reve
|
|||
|
||||
<table width="100%">
|
||||
<tr align="center" style={{border:0}}>
|
||||
<td width="20%" style={{border:0}}><a href="https://github.com/taosdata/TDengine" target="_blank"><GitHubSVG /><p>Star GitHub</p></a></td>
|
||||
<td width="20%" style={{border:0}}><a href="https://discord.com/invite/VZdSuUg4pS" target="_blank"><DiscordSVG /><p>Join Discord</p></a></td>
|
||||
<td width="20%" style={{border:0}}><a href="https://twitter.com/TDengineDB" target="_blank"><TwitterSVG /><p>Follow Twitter</p></a></td>
|
||||
<td width="20%" style={{border:0}}><a href="https://www.youtube.com/@tdengine" target="_blank"><YouTubeSVG /><p>Subscribe YouTube</p></a></td>
|
||||
<td width="20%" style={{border:0}}><a href="https://www.linkedin.com/company/tdengine" target="_blank"><LinkedInSVG /><p>Follow LinkedIn</p></a></td>
|
||||
<td width="16%" style={{border:0}}><a href="https://github.com/taosdata/TDengine" target="_blank"><GitHubSVG /></a></td>
|
||||
<td width="16%" style={{border:0}}><a href="https://discord.com/invite/VZdSuUg4pS" target="_blank"><DiscordSVG /></a></td>
|
||||
<td width="16%" style={{border:0}}><a href="https://twitter.com/TDengineDB" target="_blank"><TwitterSVG /></a></td>
|
||||
<td width="16%" style={{border:0}}><a href="https://www.youtube.com/@tdengine" target="_blank"><YouTubeSVG /></a></td>
|
||||
<td width="16%" style={{border:0}}><a href="https://www.linkedin.com/company/tdengine" target="_blank"><LinkedInSVG /></a></td>
|
||||
<td width="16%" style={{border:0}}><a href="https://stackoverflow.com/questions/tagged/tdengine" target="_blank"><StackOverflowSVG /></a></td>
|
||||
</tr>
|
||||
<tr align="center" style={{border:0,backgroundColor:'transparent'}}>
|
||||
<td width="16%" style={{border:0,padding:0}}><a href="https://github.com/taosdata/TDengine" target="_blank">Star GitHub</a></td>
|
||||
<td width="16%" style={{border:0,padding:0}}><a href="https://discord.com/invite/VZdSuUg4pS" target="_blank">Join Discord</a></td>
|
||||
<td width="16%" style={{border:0,padding:0}}><a href="https://twitter.com/TDengineDB" target="_blank">Follow Twitter</a></td>
|
||||
<td width="16%" style={{border:0,padding:0}}><a href="https://www.youtube.com/@tdengine" target="_blank">Subscribe YouTube</a></td>
|
||||
<td width="16%" style={{border:0,padding:0}}><a href="https://www.linkedin.com/company/tdengine" target="_blank">Follow LinkedIn</a></td>
|
||||
<td width="16%" style={{border:0,padding:0}}><a href="https://stackoverflow.com/questions/tagged/tdengine" target="_blank">Ask StackOverflow</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-8 0 48 48" width="50" height="50">
|
||||
<path d="M26 41v-9h4v13H0V32h4v9h22z" fill="#BCBBBB" />
|
||||
<path
|
||||
d="M23 34l.8-3-16.1-3.3L7 31l16 3zM9.2 23.2l15 7 1.4-3-15-7-1.4 3zm4.2-7.4L26 26.4l2.1-2.5-12.7-10.6-2.1 2.5zM21.5 8l-2.7 2 9.9 13.3 2.7-2L21.5 8zM7 38h16v-3H7v3z"
|
||||
fill="#F48024"
|
||||
/>
|
||||
</svg>
|
After Width: | Height: | Size: 350 B |
|
@ -0,0 +1,46 @@
|
|||
---
|
||||
title: Write from Kafka
|
||||
---
|
||||
|
||||
import Tabs from "@theme/Tabs";
|
||||
import TabItem from "@theme/TabItem";
|
||||
import PyKafka from "./_py_kafka.mdx";
|
||||
|
||||
## About Kafka
|
||||
|
||||
Apache Kafka is an open-source distributed event streaming platform, used by thousands of companies for high-performance data pipelines, streaming analytics, data integration, and mission-critical applications. For the key concepts of kafka, please refer to [kafka documentation](https://kafka.apache.org/documentation/#gettingStarted).
|
||||
|
||||
### kafka topic
|
||||
|
||||
Messages in Kafka are organized by topics. A topic may have one or more partitions. We can manage kafka topics through `kafka-topics`.
|
||||
|
||||
create a topic named `kafka-events`:
|
||||
|
||||
```
|
||||
bin/kafka-topics.sh --create --topic kafka-events --bootstrap-server localhost:9092
|
||||
```
|
||||
|
||||
Alter `kafka-events` topic to set partitions to 3:
|
||||
|
||||
```
|
||||
bin/kafka-topics.sh --alter --topic kafka-events --partitions 3 --bootstrap-server=localhost:9092
|
||||
```
|
||||
|
||||
Show all topics and partitions in Kafka:
|
||||
|
||||
```
|
||||
bin/kafka-topics.sh --bootstrap-server=localhost:9092 --describe
|
||||
```
|
||||
|
||||
## Insert into TDengine
|
||||
|
||||
We can write data into TDengine via SQL or Schemaless. For more information, please refer to [Insert Using SQL](/develop/insert-data/sql-writing/) or [High Performance Writing](/develop/insert-data/high-volume/) or [Schemaless Writing](/reference/schemaless/).
|
||||
|
||||
## Examples
|
||||
|
||||
<Tabs defaultValue="Python" groupId="lang">
|
||||
<TabItem label="Python" value="Python">
|
||||
<PyKafka />
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
### python Kafka 客户端
|
||||
|
||||
For python kafka client, please refer to [kafka client](https://cwiki.apache.org/confluence/display/KAFKA/Clients#Clients-Python). In this document, we use [kafka-python](http://github.com/dpkp/kafka-python).
|
||||
|
||||
### consume from Kafka
|
||||
|
||||
The simple way to consume messages from Kafka is to read messages one by one. The demo is as follows:
|
||||
|
||||
```
|
||||
from kafka import KafkaConsumer
|
||||
consumer = KafkaConsumer('my_favorite_topic')
|
||||
for msg in consumer:
|
||||
print (msg)
|
||||
```
|
||||
|
||||
For higher performance, we can consume message from kafka in batch. The demo is as follows:
|
||||
|
||||
```
|
||||
from kafka import KafkaConsumer
|
||||
consumer = KafkaConsumer('my_favorite_topic')
|
||||
while True:
|
||||
msgs = consumer.poll(timeout_ms=500, max_records=1000)
|
||||
if msgs:
|
||||
print (msgs)
|
||||
```
|
||||
|
||||
### multi-threading
|
||||
|
||||
For more higher performance we can process data from kafka in multi-thread. We can use python's ThreadPoolExecutor to achieve multithreading. The demo is as follows:
|
||||
|
||||
```
|
||||
from concurrent.futures import ThreadPoolExecutor, Future
|
||||
pool = ThreadPoolExecutor(max_workers=10)
|
||||
pool.submit(...)
|
||||
```
|
||||
|
||||
### multi-process
|
||||
|
||||
For more higher performance, sometimes we use multiprocessing. In this case, the number of Kafka Consumers should not be greater than the number of Kafka Topic Partitions. The demo is as follows:
|
||||
|
||||
```
|
||||
from multiprocessing import Process
|
||||
|
||||
ps = []
|
||||
for i in range(5):
|
||||
p = Process(target=Consumer().consume())
|
||||
p.start()
|
||||
ps.append(p)
|
||||
|
||||
for p in ps:
|
||||
p.join()
|
||||
```
|
||||
|
||||
In addition to python's built-in multithreading and multiprocessing library, we can also use the third-party library gunicorn.
|
||||
|
||||
### Examples
|
||||
|
||||
```py
|
||||
{{#include docs/examples/python/kafka_example.py}}
|
||||
```
|
|
@ -532,7 +532,12 @@ TIMEDIFF(expr1, expr2 [, time_unit])
|
|||
#### TIMETRUNCATE
|
||||
|
||||
```sql
|
||||
TIMETRUNCATE(expr, time_unit)
|
||||
TIMETRUNCATE(expr, time_unit [, ignore_timezone])
|
||||
|
||||
ignore_timezone: {
|
||||
0
|
||||
| 1
|
||||
}
|
||||
```
|
||||
|
||||
**Description**: Truncate the input timestamp with unit specified by `time_unit`
|
||||
|
@ -548,7 +553,10 @@ TIMETRUNCATE(expr, time_unit)
|
|||
1b (nanoseconds), 1u (microseconds), 1a (milliseconds), 1s (seconds), 1m (minutes), 1h (hours), 1d (days), or 1w (weeks)
|
||||
- The precision of the returned timestamp is same as the precision set for the current data base in use
|
||||
- If the input data is not formatted as a timestamp, the returned value is null.
|
||||
|
||||
- If `1d` is used as `time_unit` to truncate the timestamp, `ignore_timezone` option can be set to indicate if the returned result is affected by client timezone or not.
|
||||
For example, if client timezone is set to UTC+0800, TIMETRUNCATE('2020-01-01 23:00:00', 1d, 0) will return '2020-01-01 08:00:00'.
|
||||
Otherwise, TIMETRUNCATE('2020-01-01 23:00:00', 1d, 1) will return '2020-01-01 00:00:00'.
|
||||
If `ignore_timezone` option is omitted, the default value is set to 1.
|
||||
|
||||
#### TIMEZONE
|
||||
|
||||
|
|
|
@ -59,10 +59,10 @@ The different database framework specifications for various programming language
|
|||
| -------------------------------------- | ------------- | --------------- | ------------- | ------------- | ------------- | ------------- |
|
||||
| **Connection Management** | Support | Support | Support | Support | Support | Support |
|
||||
| **Regular Query** | Support | Support | Support | Support | Support | Support |
|
||||
| **Parameter Binding** | Not supported | Not supported | Not supported | Support | Not supported | Support |
|
||||
| **Subscription (TMQ) ** | Not supported | Not supported | Not supported | Not supported | Not supported | Support |
|
||||
| **Parameter Binding** | Not supported | Not supported | support | Support | Not supported | Support |
|
||||
| **Subscription (TMQ) ** | Not supported | Not supported | support | Not supported | Not supported | Support |
|
||||
| **Schemaless** | Not supported | Not supported | Not supported | Not supported | Not supported | Not supported |
|
||||
| **Bulk Pulling (based on WebSocket) ** | Support | Support | Not Supported | support | Not Supported | Supported |
|
||||
| **Bulk Pulling (based on WebSocket) ** | Support | Support | Support | support | Support | Support |
|
||||
| **DataFrame** | Not supported | Support | Not supported | Not supported | Not supported | Not supported |
|
||||
|
||||
:::warning
|
||||
|
|
|
@ -76,7 +76,7 @@ sudo -u grafana grafana-cli plugins install tdengine-datasource
|
|||
You can also download zip files from [GitHub](https://github.com/taosdata/grafanaplugin/releases/tag/latest) or [Grafana](https://grafana.com/grafana/plugins/tdengine-datasource/?tab=installation) and install manually. The commands are as follows:
|
||||
|
||||
```bash
|
||||
GF_VERSION=3.2.2
|
||||
GF_VERSION=3.2.7
|
||||
# from GitHub
|
||||
wget https://github.com/taosdata/grafanaplugin/releases/download/v$GF_VERSION/tdengine-datasource-$GF_VERSION.zip
|
||||
# from Grafana
|
||||
|
|
|
@ -38,15 +38,9 @@ Download the latest TDengine-server from the [Downloads](http://tdengine.com/en/
|
|||
|
||||
## Data Connection Setup
|
||||
|
||||
### Download TDengine plug-in to grafana plug-in directory
|
||||
### Install Grafana Plugin and Configure Data Source
|
||||
|
||||
```bash
|
||||
1. wget -c https://github.com/taosdata/grafanaplugin/releases/download/v3.1.3/tdengine-datasource-3.1.3.zip
|
||||
2. sudo unzip tdengine-datasource-3.1.3.zip -d /var/lib/grafana/plugins/
|
||||
3. sudo chown grafana:grafana -R /var/lib/grafana/plugins/tdengine
|
||||
4. echo -e "[plugins]\nallow_loading_unsigned_plugins = tdengine-datasource\n" | sudo tee -a /etc/grafana/grafana.ini
|
||||
5. sudo systemctl restart grafana-server.service
|
||||
```
|
||||
Please refer to [Install Grafana Plugin and Configure Data Source](/third-party/grafana/#install-grafana-plugin-and-configure-data-source)
|
||||
|
||||
### Modify /etc/telegraf/telegraf.conf
|
||||
|
||||
|
|
|
@ -41,15 +41,9 @@ Download the latest TDengine-server from the [Downloads](http://tdengine.com/en/
|
|||
|
||||
## Data Connection Setup
|
||||
|
||||
### Copy the TDengine plugin to the grafana plugin directory
|
||||
### Install Grafana Plugin and Configure Data Source
|
||||
|
||||
```bash
|
||||
1. wget -c https://github.com/taosdata/grafanaplugin/releases/download/v3.1.3/tdengine-datasource-3.1.3.zip
|
||||
2. sudo unzip tdengine-datasource-3.1.3.zip -d /var/lib/grafana/plugins/
|
||||
3. sudo chown grafana:grafana -R /var/lib/grafana/plugins/tdengine
|
||||
4. echo -e "[plugins]\nallow_loading_unsigned_plugins = tdengine-datasource\n" | sudo tee -a /etc/grafana/grafana.ini
|
||||
5. sudo systemctl restart grafana-server.service
|
||||
```
|
||||
Please refer to [Install Grafana Plugin and Configure Data Source](/third-party/grafana/#install-grafana-plugin-and-configure-data-source)
|
||||
|
||||
### Configure collectd
|
||||
|
||||
|
|
|
@ -10,6 +10,10 @@ For TDengine 2.x installation packages by version, please visit [here](https://w
|
|||
|
||||
import Release from "/components/ReleaseV3";
|
||||
|
||||
## 3.0.1.8
|
||||
|
||||
<Release type="tdengine" version="3.0.1.8" />
|
||||
|
||||
## 3.0.1.7
|
||||
|
||||
<Release type="tdengine" version="3.0.1.7" />
|
||||
|
|
|
@ -10,6 +10,10 @@ For other historical version installers, please visit [here](https://www.taosdat
|
|||
|
||||
import Release from "/components/ReleaseV3";
|
||||
|
||||
## 2.3.0
|
||||
|
||||
<Release type="tools" version="2.3.0" />
|
||||
|
||||
## 2.2.9
|
||||
|
||||
<Release type="tools" version="2.2.9" />
|
||||
|
|
|
@ -5,22 +5,24 @@ namespace Examples
|
|||
{
|
||||
public class WSConnExample
|
||||
{
|
||||
static void Main(string[] args)
|
||||
static int Main(string[] args)
|
||||
{
|
||||
string DSN = "ws://root:taosdata@127.0.0.1:6041/test";
|
||||
IntPtr wsConn = LibTaosWS.WSConnectWithDSN(DSN);
|
||||
|
||||
if (wsConn == IntPtr.Zero)
|
||||
{
|
||||
throw new Exception("get WS connection failed");
|
||||
Console.WriteLine("get WS connection failed");
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Establish connect success.");
|
||||
// close connection.
|
||||
LibTaosWS.WSClose(wsConn);
|
||||
}
|
||||
|
||||
// close connection.
|
||||
LibTaosWS.WSClose(wsConn);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ namespace Examples
|
|||
{
|
||||
public class WSInsertExample
|
||||
{
|
||||
static void Main(string[] args)
|
||||
static int Main(string[] args)
|
||||
{
|
||||
string DSN = "ws://root:taosdata@127.0.0.1:6041/test";
|
||||
IntPtr wsConn = LibTaosWS.WSConnectWithDSN(DSN);
|
||||
|
@ -13,7 +13,8 @@ namespace Examples
|
|||
// Assert if connection is validate
|
||||
if (wsConn == IntPtr.Zero)
|
||||
{
|
||||
throw new Exception("get WS connection failed");
|
||||
Console.WriteLine("get WS connection failed");
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -36,6 +37,8 @@ namespace Examples
|
|||
|
||||
// close connection.
|
||||
LibTaosWS.WSClose(wsConn);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void ValidInsert(string desc, IntPtr wsRes)
|
||||
|
@ -43,7 +46,7 @@ namespace Examples
|
|||
int code = LibTaosWS.WSErrorNo(wsRes);
|
||||
if (code != 0)
|
||||
{
|
||||
throw new Exception($"execute SQL failed: reason: {LibTaosWS.WSErrorStr(wsRes)}, code:{code}");
|
||||
Console.WriteLine($"execute SQL failed: reason: {LibTaosWS.WSErrorStr(wsRes)}, code:{code}");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -55,4 +58,4 @@ namespace Examples
|
|||
}
|
||||
// Establish connect success.
|
||||
// create table success affect 0 rows, cost 3717542 nanoseconds
|
||||
// insert data success affect 8 rows, cost 2613637 nanoseconds
|
||||
// insert data success affect 8 rows, cost 2613637 nanoseconds
|
||||
|
|
|
@ -7,13 +7,14 @@ namespace Examples
|
|||
{
|
||||
public class WSQueryExample
|
||||
{
|
||||
static void Main(string[] args)
|
||||
static int Main(string[] args)
|
||||
{
|
||||
string DSN = "ws://root:taosdata@127.0.0.1:6041/test";
|
||||
IntPtr wsConn = LibTaosWS.WSConnectWithDSN(DSN);
|
||||
if (wsConn == IntPtr.Zero)
|
||||
{
|
||||
throw new Exception("get WS connection failed");
|
||||
Console.WriteLine("get WS connection failed");
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -28,7 +29,9 @@ namespace Examples
|
|||
int code = LibTaosWS.WSErrorNo(wsRes);
|
||||
if (code != 0)
|
||||
{
|
||||
throw new Exception($"execute SQL failed: reason: {LibTaosWS.WSErrorStr(wsRes)}, code:{code}");
|
||||
Console.WriteLine($"execute SQL failed: reason: {LibTaosWS.WSErrorStr(wsRes)}, code:{code}");
|
||||
LibTaosWS.WSFreeResult(wsRes);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// get meta data
|
||||
|
@ -58,6 +61,8 @@ namespace Examples
|
|||
|
||||
// close connection.
|
||||
LibTaosWS.WSClose(wsConn);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -71,4 +76,4 @@ namespace Examples
|
|||
// 1538548685000 | 10.3 | 219 | 0.31 | California.SanFrancisco | 2 |
|
||||
// 1538548695000 | 12.6 | 218 | 0.33 | California.SanFrancisco | 2 |
|
||||
// 1538548696800 | 12.3 | 221 | 0.31 | California.SanFrancisco | 2 |
|
||||
// 1538548696650 | 10.3 | 218 | 0.25 | California.SanFrancisco | 3 |
|
||||
// 1538548696650 | 10.3 | 218 | 0.25 | California.SanFrancisco | 3 |
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace Examples
|
|||
{
|
||||
public class WSStmtExample
|
||||
{
|
||||
static void Main(string[] args)
|
||||
static int Main(string[] args)
|
||||
{
|
||||
const string DSN = "ws://root:taosdata@127.0.0.1:6041/test";
|
||||
const string table = "meters";
|
||||
|
@ -21,7 +21,8 @@ namespace Examples
|
|||
IntPtr wsConn = LibTaosWS.WSConnectWithDSN(DSN);
|
||||
if (wsConn == IntPtr.Zero)
|
||||
{
|
||||
throw new Exception($"get WS connection failed");
|
||||
Console.WriteLine($"get WS connection failed");
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -66,18 +67,20 @@ namespace Examples
|
|||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("Init STMT failed...");
|
||||
Console.WriteLine("Init STMT failed...");
|
||||
}
|
||||
|
||||
// close connection.
|
||||
LibTaosWS.WSClose(wsConn);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void ValidStmtStep(int code, IntPtr wsStmt, string desc)
|
||||
{
|
||||
if (code != 0)
|
||||
{
|
||||
throw new Exception($"{desc} failed,reason: {LibTaosWS.WSErrorStr(wsStmt)}, code: {code}");
|
||||
Console.WriteLine($"{desc} failed,reason: {LibTaosWS.WSErrorStr(wsStmt)}, code: {code}");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -92,4 +95,4 @@ namespace Examples
|
|||
// WSStmtBindParamBatch success...
|
||||
// WSStmtAddBatch success...
|
||||
// WSStmtExecute success...
|
||||
// WS STMT insert 5 rows...
|
||||
// WS STMT insert 5 rows...
|
||||
|
|
|
@ -0,0 +1,192 @@
|
|||
#! encoding = utf-8
|
||||
import json
|
||||
import time
|
||||
from json import JSONDecodeError
|
||||
from typing import Callable
|
||||
import logging
|
||||
from concurrent.futures import ThreadPoolExecutor, Future
|
||||
|
||||
import taos
|
||||
from kafka import KafkaConsumer
|
||||
from kafka.consumer.fetcher import ConsumerRecord
|
||||
|
||||
|
||||
class Consumer(object):
|
||||
DEFAULT_CONFIGS = {
|
||||
'kafka_brokers': 'localhost:9092',
|
||||
'kafka_topic': 'python_kafka',
|
||||
'kafka_group_id': 'taos',
|
||||
'taos_host': 'localhost',
|
||||
'taos_user': 'root',
|
||||
'taos_password': 'taosdata',
|
||||
'taos_database': 'power',
|
||||
'taos_port': 6030,
|
||||
'timezone': None,
|
||||
'clean_after_testing': False,
|
||||
'bath_consume': True,
|
||||
'batch_size': 1000,
|
||||
'async_model': True,
|
||||
'workers': 10
|
||||
}
|
||||
|
||||
LOCATIONS = ['California.SanFrancisco', 'California.LosAngles', 'California.SanDiego', 'California.SanJose',
|
||||
'California.PaloAlto', 'California.Campbell', 'California.MountainView', 'California.Sunnyvale',
|
||||
'California.SantaClara', 'California.Cupertino']
|
||||
|
||||
CREATE_DATABASE_SQL = 'create database if not exists {} keep 365 duration 10 buffer 16 wal_level 1'
|
||||
USE_DATABASE_SQL = 'use {}'
|
||||
DROP_TABLE_SQL = 'drop table if exists meters'
|
||||
DROP_DATABASE_SQL = 'drop database if exists {}'
|
||||
CREATE_STABLE_SQL = 'create stable meters (ts timestamp, current float, voltage int, phase float) ' \
|
||||
'tags (location binary(64), groupId int)'
|
||||
CREATE_TABLE_SQL = 'create table if not exists {} using meters tags (\'{}\', {})'
|
||||
INSERT_SQL_HEADER = "insert into "
|
||||
INSERT_PART_SQL = 'power.{} values (\'{}\', {}, {}, {})'
|
||||
|
||||
def __init__(self, **configs):
|
||||
self.config: dict = self.DEFAULT_CONFIGS
|
||||
self.config.update(configs)
|
||||
self.consumer = KafkaConsumer(
|
||||
self.config.get('kafka_topic'), # topic
|
||||
bootstrap_servers=self.config.get('kafka_brokers'),
|
||||
group_id=self.config.get('kafka_group_id'),
|
||||
)
|
||||
self.taos = taos.connect(
|
||||
host=self.config.get('taos_host'),
|
||||
user=self.config.get('taos_user'),
|
||||
password=self.config.get('taos_password'),
|
||||
port=self.config.get('taos_port'),
|
||||
timezone=self.config.get('timezone'),
|
||||
)
|
||||
if self.config.get('async_model'):
|
||||
self.pool = ThreadPoolExecutor(max_workers=self.config.get('workers'))
|
||||
self.tasks: list[Future] = []
|
||||
# tags and table mapping # key: {location}_{groupId} value:
|
||||
self.tag_table_mapping = {}
|
||||
i = 0
|
||||
for location in self.LOCATIONS:
|
||||
for j in range(1, 11):
|
||||
table_name = 'd{}'.format(i)
|
||||
self._cache_table(location=location, group_id=j, table_name=table_name)
|
||||
i += 1
|
||||
|
||||
def init_env(self):
|
||||
# create database and table
|
||||
self.taos.execute(self.DROP_DATABASE_SQL.format(self.config.get('taos_database')))
|
||||
self.taos.execute(self.CREATE_DATABASE_SQL.format(self.config.get('taos_database')))
|
||||
self.taos.execute(self.USE_DATABASE_SQL.format(self.config.get('taos_database')))
|
||||
self.taos.execute(self.DROP_TABLE_SQL)
|
||||
self.taos.execute(self.CREATE_STABLE_SQL)
|
||||
for tags, table_name in self.tag_table_mapping.items():
|
||||
location, group_id = _get_location_and_group(tags)
|
||||
self.taos.execute(self.CREATE_TABLE_SQL.format(table_name, location, group_id))
|
||||
|
||||
def consume(self):
|
||||
logging.warning('## start consumer topic-[%s]', self.config.get('kafka_topic'))
|
||||
try:
|
||||
if self.config.get('bath_consume'):
|
||||
self._run_batch(self._to_taos_batch)
|
||||
else:
|
||||
self._run(self._to_taos)
|
||||
except KeyboardInterrupt:
|
||||
logging.warning("## caught keyboard interrupt, stopping")
|
||||
finally:
|
||||
self.stop()
|
||||
|
||||
def stop(self):
|
||||
# close consumer
|
||||
if self.consumer is not None:
|
||||
self.consumer.commit()
|
||||
self.consumer.close()
|
||||
|
||||
# multi thread
|
||||
if self.config.get('async_model'):
|
||||
for task in self.tasks:
|
||||
while not task.done():
|
||||
pass
|
||||
if self.pool is not None:
|
||||
self.pool.shutdown()
|
||||
|
||||
# clean data
|
||||
if self.config.get('clean_after_testing'):
|
||||
self.taos.execute(self.DROP_TABLE_SQL)
|
||||
self.taos.execute(self.DROP_DATABASE_SQL.format(self.config.get('taos_database')))
|
||||
# close taos
|
||||
if self.taos is not None:
|
||||
self.taos.close()
|
||||
|
||||
def _run(self, f: Callable[[ConsumerRecord], bool]):
|
||||
for message in self.consumer:
|
||||
if self.config.get('async_model'):
|
||||
self.pool.submit(f(message))
|
||||
else:
|
||||
f(message)
|
||||
|
||||
def _run_batch(self, f: Callable[[list[list[ConsumerRecord]]], None]):
|
||||
while True:
|
||||
messages = self.consumer.poll(timeout_ms=500, max_records=self.config.get('batch_size'))
|
||||
if messages:
|
||||
if self.config.get('async_model'):
|
||||
self.pool.submit(f, messages.values())
|
||||
else:
|
||||
f(list(messages.values()))
|
||||
if not messages:
|
||||
time.sleep(0.1)
|
||||
|
||||
def _to_taos(self, message: ConsumerRecord) -> bool:
|
||||
sql = self.INSERT_SQL_HEADER + self._build_sql(message.value)
|
||||
if len(sql) == 0: # decode error, skip
|
||||
return True
|
||||
logging.info('## insert sql %s', sql)
|
||||
return self.taos.execute(sql=sql) == 1
|
||||
|
||||
def _to_taos_batch(self, messages: list[list[ConsumerRecord]]):
|
||||
sql = self._build_sql_batch(messages=messages)
|
||||
if len(sql) == 0: # decode error, skip
|
||||
return
|
||||
self.taos.execute(sql=sql)
|
||||
|
||||
def _build_sql(self, msg_value: str) -> str:
|
||||
try:
|
||||
data = json.loads(msg_value)
|
||||
except JSONDecodeError as e:
|
||||
logging.error('## decode message [%s] error ', msg_value, e)
|
||||
return ''
|
||||
location = data.get('location')
|
||||
group_id = data.get('groupId')
|
||||
ts = data.get('ts')
|
||||
current = data.get('current')
|
||||
voltage = data.get('voltage')
|
||||
phase = data.get('phase')
|
||||
|
||||
table_name = self._get_table_name(location=location, group_id=group_id)
|
||||
return self.INSERT_PART_SQL.format(table_name, ts, current, voltage, phase)
|
||||
|
||||
def _build_sql_batch(self, messages: list[list[ConsumerRecord]]) -> str:
|
||||
sql_list = []
|
||||
for partition_messages in messages:
|
||||
for message in partition_messages:
|
||||
sql_list.append(self._build_sql(message.value))
|
||||
|
||||
return self.INSERT_SQL_HEADER + ' '.join(sql_list)
|
||||
|
||||
def _cache_table(self, location: str, group_id: int, table_name: str):
|
||||
self.tag_table_mapping[_tag_table_mapping_key(location=location, group_id=group_id)] = table_name
|
||||
|
||||
def _get_table_name(self, location: str, group_id: int) -> str:
|
||||
return self.tag_table_mapping.get(_tag_table_mapping_key(location=location, group_id=group_id))
|
||||
|
||||
|
||||
def _tag_table_mapping_key(location: str, group_id: int):
|
||||
return '{}_{}'.format(location, group_id)
|
||||
|
||||
|
||||
def _get_location_and_group(key: str) -> (str, int):
|
||||
fields = key.split('_')
|
||||
return fields[0], fields[1]
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
consumer = Consumer(async_model=True)
|
||||
consumer.init_env()
|
||||
consumer.consume()
|
|
@ -4,6 +4,7 @@ from taos.tmq import *
|
|||
conn = taos.connect()
|
||||
|
||||
print("init")
|
||||
conn.execute("drop topic if exists topic_ctb_column")
|
||||
conn.execute("drop database if exists py_tmq")
|
||||
conn.execute("create database if not exists py_tmq vgroups 2")
|
||||
conn.select_db("py_tmq")
|
||||
|
@ -15,7 +16,6 @@ conn.execute("create table if not exists tb2 using stb1 tags(2)")
|
|||
conn.execute("create table if not exists tb3 using stb1 tags(3)")
|
||||
|
||||
print("create topic")
|
||||
conn.execute("drop topic if exists topic_ctb_column")
|
||||
conn.execute(
|
||||
"create topic if not exists topic_ctb_column as select ts, c1, c2, c3 from stb1"
|
||||
)
|
||||
|
|
|
@ -69,7 +69,7 @@ TDengine 的主要功能如下:
|
|||
|
||||
- **[分析能力](https://www.taosdata.com/tdengine/easy_data_analytics)**:通过超级表、存储计算分离、分区分片、预计算和其它技术,TDengine 能够高效地浏览、格式化和访问数据。
|
||||
|
||||
- **[核心开源](https://www.taosdata.com/tdengine/open_source_time-series_database)**:TDengine 的核心代码包括集群功能全部在开源协议下公开。全球超过 140k 个运行实例,GitHub Star 19k,且拥有一个活跃的开发者社区。
|
||||
- **[核心开源](https://www.taosdata.com/tdengine/open_source_time-series_database)**:TDengine 的核心代码包括集群功能全部在开源协议下公开。全球超过 140k 个运行实例,GitHub Star 20k,且拥有一个活跃的开发者社区。
|
||||
|
||||
采用 TDengine,可将典型的物联网、车联网、工业互联网大数据平台的总拥有成本大幅降低。表现在几个方面:
|
||||
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
---
|
||||
title: 从 Kafka 写入
|
||||
---
|
||||
|
||||
import Tabs from "@theme/Tabs";
|
||||
import TabItem from "@theme/TabItem";
|
||||
import PyKafka from "./_py_kafka.mdx";
|
||||
|
||||
## Kafka 介绍
|
||||
|
||||
Apache Kafka 是开源的分布式消息分发平台,被广泛应用于高性能数据管道、流式数据分析、数据集成和事件驱动类型的应用程序。Kafka 包含 Producer、Consumer 和 Topic,其中 Producer 是向 Kafka 发送消息的进程,Consumer 是从 Kafka 消费消息的进程。Kafka 相关概念可以参考[官方文档](https://kafka.apache.org/documentation/#gettingStarted)。
|
||||
|
||||
|
||||
### kafka topic
|
||||
|
||||
Kafka 的消息按 topic 组织,每个 topic 会有一到多个 partition。可以通过 kafka 的 `kafka-topics` 管理 topic。
|
||||
|
||||
创建名为 `kafka-events` 的topic:
|
||||
|
||||
```
|
||||
bin/kafka-topics.sh --create --topic kafka-events --bootstrap-server localhost:9092
|
||||
```
|
||||
|
||||
修改 `kafka-events` 的 partition 数量为 3:
|
||||
|
||||
```
|
||||
bin/kafka-topics.sh --alter --topic kafka-events --partitions 3 --bootstrap-server=localhost:9092
|
||||
```
|
||||
|
||||
展示所有的 topic 和 partition:
|
||||
|
||||
```
|
||||
bin/kafka-topics.sh --bootstrap-server=localhost:9092 --describe
|
||||
```
|
||||
|
||||
## 写入 TDengine
|
||||
|
||||
TDengine 支持 Sql 方式和 Schemaless 方式的数据写入,Sql 方式数据写入可以参考 [TDengine SQL 写入](/develop/insert-data/sql-writing/) 和 [TDengine 高效写入](/develop/insert-data/high-volume/)。Schemaless 方式数据写入可以参考 [TDengine Schemaless 写入](/reference/schemaless/) 文档。
|
||||
|
||||
## 示例代码
|
||||
|
||||
<Tabs defaultValue="Python" groupId="lang">
|
||||
<TabItem label="Python" value="Python">
|
||||
<PyKafka />
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
### python Kafka 客户端
|
||||
|
||||
Kafka 的 python 客户端可以参考文档 [kafka client](https://cwiki.apache.org/confluence/display/KAFKA/Clients#Clients-Python)。推荐使用 [confluent-kafka-python](https://github.com/confluentinc/confluent-kafka-python) 和 [kafka-python](http://github.com/dpkp/kafka-python)。以下示例以 [kafka-python](http://github.com/dpkp/kafka-python) 为例。
|
||||
|
||||
### 从 Kafka 消费数据
|
||||
|
||||
Kafka 客户端采用 pull 的方式从 Kafka 消费数据,可以采用单条消费的方式或批量消费的方式读取数据。使用 [kafka-python](http://github.com/dpkp/kafka-python) 客户端单条消费数据的示例如下:
|
||||
|
||||
```
|
||||
from kafka import KafkaConsumer
|
||||
consumer = KafkaConsumer('my_favorite_topic')
|
||||
for msg in consumer:
|
||||
print (msg)
|
||||
```
|
||||
|
||||
单条消费的方式在数据流量大的情况下往往存在性能瓶颈,导致 Kafka 消息积压,更推荐使用批量消费的方式消费数据。使用 [kafka-python](http://github.com/dpkp/kafka-python) 客户端批量消费数据的示例如下:
|
||||
|
||||
```
|
||||
from kafka import KafkaConsumer
|
||||
consumer = KafkaConsumer('my_favorite_topic')
|
||||
while True:
|
||||
msgs = consumer.poll(timeout_ms=500, max_records=1000)
|
||||
if msgs:
|
||||
print (msgs)
|
||||
```
|
||||
|
||||
### Python 多线程
|
||||
|
||||
为了提高数据写入效率,通常采用多线程的方式写入数据,可以使用 python 线程池 ThreadPoolExecutor 实现多线程。示例代码如下:
|
||||
|
||||
```
|
||||
from concurrent.futures import ThreadPoolExecutor, Future
|
||||
pool = ThreadPoolExecutor(max_workers=10)
|
||||
pool.submit(...)
|
||||
```
|
||||
|
||||
### Python 多进程
|
||||
|
||||
单个python进程不能充分发挥多核 CPU 的性能,有时候我们会选择多进程的方式。在多进程的情况下,需要注意,Kafka Consumer 的数量应该小于等于 Kafka Topic Partition 数量。Python 多进程示例代码如下:
|
||||
|
||||
```
|
||||
from multiprocessing import Process
|
||||
|
||||
ps = []
|
||||
for i in range(5):
|
||||
p = Process(target=Consumer().consume())
|
||||
p.start()
|
||||
ps.append(p)
|
||||
|
||||
for p in ps:
|
||||
p.join()
|
||||
```
|
||||
|
||||
除了 Python 内置的多线程和多进程方式,还可以通过第三方库 gunicorn 实现并发。
|
||||
|
||||
### 完整示例
|
||||
|
||||
```py
|
||||
{{#include docs/examples/python/kafka_example.py}}
|
||||
```
|
|
@ -73,7 +73,95 @@ TDengine 客户端驱动的安装请参考 [安装指南](../#安装步骤)
|
|||
```c
|
||||
{{#include examples/c/demo.c}}
|
||||
```
|
||||
格式化输出不同类型字段函数 taos_print_row
|
||||
```c
|
||||
int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int num_fields) {
|
||||
int32_t len = 0;
|
||||
for (int i = 0; i < num_fields; ++i) {
|
||||
if (i > 0) {
|
||||
str[len++] = ' ';
|
||||
}
|
||||
|
||||
if (row[i] == NULL) {
|
||||
len += sprintf(str + len, "%s", TSDB_DATA_NULL_STR);
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (fields[i].type) {
|
||||
case TSDB_DATA_TYPE_TINYINT:
|
||||
len += sprintf(str + len, "%d", *((int8_t *)row[i]));
|
||||
break;
|
||||
|
||||
case TSDB_DATA_TYPE_UTINYINT:
|
||||
len += sprintf(str + len, "%u", *((uint8_t *)row[i]));
|
||||
break;
|
||||
|
||||
case TSDB_DATA_TYPE_SMALLINT:
|
||||
len += sprintf(str + len, "%d", *((int16_t *)row[i]));
|
||||
break;
|
||||
|
||||
case TSDB_DATA_TYPE_USMALLINT:
|
||||
len += sprintf(str + len, "%u", *((uint16_t *)row[i]));
|
||||
break;
|
||||
|
||||
case TSDB_DATA_TYPE_INT:
|
||||
len += sprintf(str + len, "%d", *((int32_t *)row[i]));
|
||||
break;
|
||||
|
||||
case TSDB_DATA_TYPE_UINT:
|
||||
len += sprintf(str + len, "%u", *((uint32_t *)row[i]));
|
||||
break;
|
||||
|
||||
case TSDB_DATA_TYPE_BIGINT:
|
||||
len += sprintf(str + len, "%" PRId64, *((int64_t *)row[i]));
|
||||
break;
|
||||
|
||||
case TSDB_DATA_TYPE_UBIGINT:
|
||||
len += sprintf(str + len, "%" PRIu64, *((uint64_t *)row[i]));
|
||||
break;
|
||||
|
||||
case TSDB_DATA_TYPE_FLOAT: {
|
||||
float fv = 0;
|
||||
fv = GET_FLOAT_VAL(row[i]);
|
||||
len += sprintf(str + len, "%f", fv);
|
||||
} break;
|
||||
|
||||
case TSDB_DATA_TYPE_DOUBLE: {
|
||||
double dv = 0;
|
||||
dv = GET_DOUBLE_VAL(row[i]);
|
||||
len += sprintf(str + len, "%lf", dv);
|
||||
} break;
|
||||
|
||||
case TSDB_DATA_TYPE_BINARY:
|
||||
case TSDB_DATA_TYPE_NCHAR: {
|
||||
int32_t charLen = varDataLen((char *)row[i] - VARSTR_HEADER_SIZE);
|
||||
if (fields[i].type == TSDB_DATA_TYPE_BINARY) {
|
||||
assert(charLen <= fields[i].bytes && charLen >= 0);
|
||||
} else {
|
||||
assert(charLen <= fields[i].bytes * TSDB_NCHAR_SIZE && charLen >= 0);
|
||||
}
|
||||
|
||||
memcpy(str + len, row[i], charLen);
|
||||
len += charLen;
|
||||
} break;
|
||||
|
||||
case TSDB_DATA_TYPE_TIMESTAMP:
|
||||
len += sprintf(str + len, "%" PRId64, *((int64_t *)row[i]));
|
||||
break;
|
||||
|
||||
case TSDB_DATA_TYPE_BOOL:
|
||||
len += sprintf(str + len, "%d", *((int8_t *)row[i]));
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
str[len] = 0;
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
### 异步查询示例
|
||||
|
|
|
@ -59,10 +59,10 @@ TDengine 版本更新往往会增加新的功能特性,列表中的连接器
|
|||
| ------------------------------ | -------- | ---------- | -------- | -------- | ----------- | -------- |
|
||||
| **连接管理** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 |
|
||||
| **普通查询** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 |
|
||||
| **参数绑定** | 暂不支持 | 暂不支持 | 暂不支持 | 支持 | 暂不支持 | 支持 |
|
||||
| **数据订阅(TMQ)** | 暂不支持 | 暂不支持 | 暂不支持 | 暂不支持 | 暂不支持 | 支持 |
|
||||
| **参数绑定** | 暂不支持 | 暂不支持 | 支持 | 支持 | 暂不支持 | 支持 |
|
||||
| **数据订阅(TMQ)** | 暂不支持 | 暂不支持 | 支持 | 暂不支持 | 暂不支持 | 支持 |
|
||||
| **Schemaless** | 暂不支持 | 暂不支持 | 暂不支持 | 暂不支持 | 暂不支持 | 暂不支持 |
|
||||
| **批量拉取(基于 WebSocket)** | 支持 | 支持 | 暂不支持 | 支持 | 暂不支持 | 支持 |
|
||||
| **批量拉取(基于 WebSocket)** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 |
|
||||
| **DataFrame** | 不支持 | 支持 | 不支持 | 不支持 | 不支持 | 不支持 |
|
||||
|
||||
:::warning
|
||||
|
|
|
@ -533,7 +533,12 @@ TIMEDIFF(expr1, expr2 [, time_unit])
|
|||
#### TIMETRUNCATE
|
||||
|
||||
```sql
|
||||
TIMETRUNCATE(expr, time_unit)
|
||||
TIMETRUNCATE(expr, time_unit [, ignore_timezone])
|
||||
|
||||
ignore_timezone: {
|
||||
0
|
||||
| 1
|
||||
}
|
||||
```
|
||||
|
||||
**功能说明**:将时间戳按照指定时间单位 time_unit 进行截断。
|
||||
|
@ -549,6 +554,11 @@ TIMETRUNCATE(expr, time_unit)
|
|||
1b(纳秒), 1u(微秒),1a(毫秒),1s(秒),1m(分),1h(小时),1d(天), 1w(周)。
|
||||
- 返回的时间戳精度与当前 DATABASE 设置的时间精度一致。
|
||||
- 输入包含不符合时间日期格式的字符串则返回 NULL。
|
||||
- 当使用 1d 作为时间单位对时间戳进行截断时, 可通过设置 ignore_timezone 参数指定返回结果的显示是否忽略客户端时区的影响。
|
||||
例如客户端所配置时区为 UTC+0800, 则 TIMETRUNCATE('2020-01-01 23:00:00', 1d, 0) 返回结果为 '2020-01-01 08:00:00'。
|
||||
而使用 TIMETRUNCATE('2020-01-01 23:00:00', 1d, 1) 设置忽略时区时,返回结果为 '2020-01-01 00:00:00'
|
||||
ignore_timezone 如果忽略的话,则默认值为 1 。
|
||||
|
||||
|
||||
|
||||
#### TIMEZONE
|
||||
|
@ -1085,7 +1095,7 @@ ignore_negative: {
|
|||
|
||||
```sql
|
||||
DIFF(expr [, ignore_negative])
|
||||
|
||||
|
||||
ignore_negative: {
|
||||
0
|
||||
| 1
|
||||
|
@ -1249,4 +1259,4 @@ SELECT SERVER_VERSION();
|
|||
SELECT SERVER_STATUS();
|
||||
```
|
||||
|
||||
**说明**:返回服务端当前的状态。
|
||||
**说明**:检测服务端是否所有 dnode 都在线,如果是则返回成功,否则返回无法建立连接的错误。
|
||||
|
|
|
@ -72,7 +72,7 @@ SHOW STREAMS;
|
|||
若要展示更详细的信息,可以使用:
|
||||
|
||||
```sql
|
||||
SELECT * from performance_schema.`perf_streams`;
|
||||
SELECT * from information_schema.`ins_streams`;
|
||||
```
|
||||
|
||||
## 流式计算的触发模式
|
||||
|
|
|
@ -77,7 +77,7 @@ sudo -u grafana grafana-cli plugins install tdengine-datasource
|
|||
或者从 [GitHub](https://github.com/taosdata/grafanaplugin/releases/tag/latest) 或 [Grafana](https://grafana.com/grafana/plugins/tdengine-datasource/?tab=installation) 下载 .zip 文件到本地并解压到 Grafana 插件目录。命令行下载示例如下:
|
||||
|
||||
```bash
|
||||
GF_VERSION=3.2.2
|
||||
GF_VERSION=3.2.7
|
||||
# from GitHub
|
||||
wget https://github.com/taosdata/grafanaplugin/releases/download/v$GF_VERSION/tdengine-datasource-$GF_VERSION.zip
|
||||
# from Grafana
|
||||
|
|
|
@ -39,15 +39,9 @@ IT 运维监测数据通常都是对时间特性比较敏感的数据,例如
|
|||
|
||||
## 数据链路设置
|
||||
|
||||
### 下载 TDengine 插件到 Grafana 插件目录
|
||||
### 安装 Grafana Plugin 并配置数据源
|
||||
|
||||
```bash
|
||||
1. wget -c https://github.com/taosdata/grafanaplugin/releases/download/v3.1.3/tdengine-datasource-3.1.3.zip
|
||||
2. sudo unzip tdengine-datasource-3.1.3.zip -d /var/lib/grafana/plugins/
|
||||
3. sudo chown grafana:grafana -R /var/lib/grafana/plugins/tdengine
|
||||
4. echo -e "[plugins]\nallow_loading_unsigned_plugins = tdengine-datasource\n" | sudo tee -a /etc/grafana/grafana.ini
|
||||
5. sudo systemctl restart grafana-server.service
|
||||
```
|
||||
请参考[安装 Grafana Plugin 并配置数据源](/third-party/grafana/#%E5%AE%89%E8%A3%85-grafana-plugin-%E5%B9%B6%E9%85%8D%E7%BD%AE%E6%95%B0%E6%8D%AE%E6%BA%90)。
|
||||
|
||||
### 修改 /etc/telegraf/telegraf.conf
|
||||
|
||||
|
|
|
@ -41,15 +41,9 @@ IT 运维监测数据通常都是对时间特性比较敏感的数据,例如
|
|||
|
||||
## 数据链路设置
|
||||
|
||||
### 复制 TDengine 插件到 grafana 插件目录
|
||||
### 安装 Grafana Plugin 并配置数据源
|
||||
|
||||
```bash
|
||||
1. wget -c https://github.com/taosdata/grafanaplugin/releases/download/v3.1.3/tdengine-datasource-3.1.3.zip
|
||||
2. sudo unzip tdengine-datasource-3.1.3.zip -d /var/lib/grafana/plugins/
|
||||
3. sudo chown grafana:grafana -R /var/lib/grafana/plugins/tdengine
|
||||
4. echo -e "[plugins]\nallow_loading_unsigned_plugins = tdengine-datasource\n" | sudo tee -a /etc/grafana/grafana.ini
|
||||
5. sudo systemctl restart grafana-server.service
|
||||
```
|
||||
请参考[安装 Grafana Plugin 并配置数据源](/third-party/grafana/#%E5%AE%89%E8%A3%85-grafana-plugin-%E5%B9%B6%E9%85%8D%E7%BD%AE%E6%95%B0%E6%8D%AE%E6%BA%90)。
|
||||
|
||||
### 配置 collectd
|
||||
|
||||
|
|
|
@ -201,3 +201,45 @@ TDengine 中时间戳的时区总是由客户端进行处理,而与服务端
|
|||
OOM 是操作系统的保护机制,当操作系统内存(包括 SWAP )不足时,会杀掉某些进程,从而保证操作系统的稳定运行。通常内存不足主要是如下两个原因导致,一是剩余内存小于 vm.min_free_kbytes ;二是程序请求的内存大于剩余内存。还有一种情况是内存充足但程序占用了特殊的内存地址,也会触发 OOM 。
|
||||
|
||||
TDengine 会预先为每个 VNode 分配好内存,每个 Database 的 VNode 个数受 建库时的vgroups参数影响,每个 VNode 占用的内存大小受 buffer参数 影响。要防止 OOM,需要在项目建设之初合理规划内存,并合理设置 SWAP ,除此之外查询过量的数据也有可能导致内存暴涨,这取决于具体的查询语句。TDengine 企业版对内存管理做了优化,采用了新的内存分配器,对稳定性有更高要求的用户可以考虑选择企业版。
|
||||
|
||||
### 19. 在macOS上遇到Too many open files怎么办?
|
||||
|
||||
taosd日志文件报错Too many open file,是由于taosd打开文件数超过系统设置的上限所致。
|
||||
解决方案如下:
|
||||
1. 新建文件 /Library/LaunchDaemons/limit.maxfiles.plist,写入以下内容(以下示例将limit和maxfiles改为10万,可按需修改):
|
||||
```
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
|
||||
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Label</key>
|
||||
<string>limit.maxfiles</string>
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>launchctl</string>
|
||||
<string>limit</string>
|
||||
<string>maxfiles</string>
|
||||
<string>100000</string>
|
||||
<string>100000</string>
|
||||
</array>
|
||||
<key>RunAtLoad</key>
|
||||
<true/>
|
||||
<key>ServiceIPC</key>
|
||||
<false/>
|
||||
</dict>
|
||||
</plist>
|
||||
```
|
||||
2. 修改文件权限
|
||||
```
|
||||
sudo chown root:wheel /Library/LaunchDaemons/limit.maxfiles.plist
|
||||
sudo chmod 644 /Library/LaunchDaemons/limit.maxfiles.plist
|
||||
```
|
||||
3. 加载 plist 文件 (或重启系统后生效。launchd在启动时会自动加载该目录的 plist)
|
||||
```
|
||||
sudo launchctl load -w /Library/LaunchDaemons/limit.maxfiles.plist
|
||||
```
|
||||
4.确认更改后的限制
|
||||
```
|
||||
launchctl limit maxfiles
|
||||
```
|
||||
|
|
|
@ -10,6 +10,11 @@ TDengine 2.x 各版本安装包请访问[这里](https://www.taosdata.com/all-do
|
|||
|
||||
import Release from "/components/ReleaseV3";
|
||||
|
||||
## 3.0.1.8
|
||||
|
||||
<Release type="tdengine" version="3.0.1.8" />
|
||||
|
||||
|
||||
## 3.0.1.7
|
||||
|
||||
<Release type="tdengine" version="3.0.1.7" />
|
||||
|
|
|
@ -10,6 +10,10 @@ taosTools 各版本安装包下载链接如下:
|
|||
|
||||
import Release from "/components/ReleaseV3";
|
||||
|
||||
## 2.3.0
|
||||
|
||||
<Release type="tools" version="2.3.0" />
|
||||
|
||||
## 2.2.9
|
||||
|
||||
<Release type="tools" version="2.2.9" />
|
||||
|
|
|
@ -88,7 +88,7 @@
|
|||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<version>2.17.1</version>
|
||||
<version>2.17.2</version>
|
||||
</dependency>
|
||||
<!-- junit -->
|
||||
<dependency>
|
||||
|
|
|
@ -2,12 +2,10 @@
|
|||
cd tests/examples/JDBC/taosdemo
|
||||
mvn clean package -Dmaven.test.skip=true
|
||||
# 先建表,再插入的
|
||||
java -jar target/taosdemo-2.0.1-jar-with-dependencies.jar -host [hostname] -database [database] -doCreateTable true -superTableSQL "create table weather(ts timestamp, f1 int) tags(t1 nchar(4))" -numOfTables 1000 -numOfRowsPerTable 100000000 -numOfThreadsForInsert 10 -numOfTablesPerSQL 10 -numOfValuesPerSQL 100
|
||||
java -jar target/taosdemo-2.0.1-jar-with-dependencies.jar -host <hostname> -database <db name> -doCreateTable true -superTableSQL "create table weather(ts timestamp, f1 int) tags(t1 nchar(4))" -numOfTables 1000 -numOfRowsPerTable 100000000 -numOfThreadsForInsert 10 -numOfTablesPerSQL 10 -numOfValuesPerSQL 100
|
||||
# 不建表,直接插入的
|
||||
java -jar target/taosdemo-2.0.1-jar-with-dependencies.jar -host [hostname] -database [database] -doCreateTable false -superTableSQL "create table weather(ts timestamp, f1 int) tags(t1 nchar(4))" -numOfTables 1000 -numOfRowsPerTable 100000000 -numOfThreadsForInsert 10 -numOfTablesPerSQL 10 -numOfValuesPerSQL 100
|
||||
java -jar target/taosdemo-2.0.1-jar-with-dependencies.jar -host <hostname> -database <db name> -doCreateTable false -superTableSQL "create table weather(ts timestamp, f1 int) tags(t1 nchar(4))" -numOfTables 1000 -numOfRowsPerTable 100000000 -numOfThreadsForInsert 10 -numOfTablesPerSQL 10 -numOfValuesPerSQL 100
|
||||
```
|
||||
|
||||
需求:
|
||||
1. 可以读lowa的配置文件
|
||||
2. 支持JDBC-JNI和JDBC-restful
|
||||
3. 读取配置文件,持续执行查询
|
||||
如果发生错误 Exception in thread "main" java.lang.UnsatisfiedLinkError: no taos in java.library.path
|
||||
请检查是否安装 TDengine 客户端安装包或编译 TDengine 安装。如果确定已经安装过还出现这个错误,可以在命令行 java 后加 -Djava.library.path=/usr/local/lib 来指定寻找共享库的路径。
|
||||
|
|
|
@ -149,7 +149,7 @@ DLL_EXPORT TAOS *taos_connect(const char *ip, const char *user, const char
|
|||
DLL_EXPORT TAOS *taos_connect_auth(const char *ip, const char *user, const char *auth, const char *db, uint16_t port);
|
||||
DLL_EXPORT void taos_close(TAOS *taos);
|
||||
|
||||
const char *taos_data_type(int type);
|
||||
DLL_EXPORT const char *taos_data_type(int type);
|
||||
|
||||
DLL_EXPORT TAOS_STMT *taos_stmt_init(TAOS *taos);
|
||||
DLL_EXPORT TAOS_STMT *taos_stmt_init_with_reqid(TAOS *taos, int64_t reqid);
|
||||
|
@ -185,6 +185,7 @@ DLL_EXPORT void taos_kill_query(TAOS *taos);
|
|||
DLL_EXPORT int taos_field_count(TAOS_RES *res);
|
||||
DLL_EXPORT int taos_num_fields(TAOS_RES *res);
|
||||
DLL_EXPORT int taos_affected_rows(TAOS_RES *res);
|
||||
DLL_EXPORT int64_t taos_affected_rows64(TAOS_RES *res);
|
||||
|
||||
DLL_EXPORT TAOS_FIELD *taos_fetch_fields(TAOS_RES *res);
|
||||
DLL_EXPORT int taos_select_db(TAOS *taos, const char *db);
|
||||
|
@ -218,6 +219,9 @@ DLL_EXPORT int taos_get_db_route_info(TAOS *taos, const char *db, TAOS_DB_ROUTE_
|
|||
DLL_EXPORT int taos_get_table_vgId(TAOS *taos, const char *db, const char *table, int *vgId);
|
||||
|
||||
DLL_EXPORT int taos_load_table_info(TAOS *taos, const char *tableNameList);
|
||||
|
||||
/* --------------------------schemaless INTERFACE------------------------------- */
|
||||
|
||||
DLL_EXPORT TAOS_RES *taos_schemaless_insert(TAOS *taos, char *lines[], int numLines, int protocol, int precision);
|
||||
DLL_EXPORT TAOS_RES *taos_schemaless_insert_with_reqid(TAOS *taos, char *lines[], int numLines, int protocol,
|
||||
int precision, int64_t reqid);
|
||||
|
@ -225,6 +229,13 @@ DLL_EXPORT TAOS_RES *taos_schemaless_insert_raw(TAOS *taos, char *lines, int len
|
|||
int precision);
|
||||
DLL_EXPORT TAOS_RES *taos_schemaless_insert_raw_with_reqid(TAOS *taos, char *lines, int len, int32_t *totalRows,
|
||||
int protocol, int precision, int64_t reqid);
|
||||
DLL_EXPORT TAOS_RES *taos_schemaless_insert_ttl(TAOS *taos, char *lines[], int numLines, int protocol, int precision, int32_t ttl);
|
||||
DLL_EXPORT TAOS_RES *taos_schemaless_insert_ttl_with_reqid(TAOS *taos, char *lines[], int numLines, int protocol,
|
||||
int precision, int32_t ttl, int64_t reqid);
|
||||
DLL_EXPORT TAOS_RES *taos_schemaless_insert_raw_ttl(TAOS *taos, char *lines, int len, int32_t *totalRows, int protocol,
|
||||
int precision, int32_t ttl);
|
||||
DLL_EXPORT TAOS_RES *taos_schemaless_insert_raw_ttl_with_reqid(TAOS *taos, char *lines, int len, int32_t *totalRows,
|
||||
int protocol, int precision, int32_t ttl, int64_t reqid);
|
||||
|
||||
/* --------------------------TMQ INTERFACE------------------------------- */
|
||||
|
||||
|
@ -297,6 +308,7 @@ DLL_EXPORT tmq_res_t tmq_get_res_type(TAOS_RES *res);
|
|||
DLL_EXPORT int32_t tmq_get_raw(TAOS_RES *res, tmq_raw_data *raw);
|
||||
DLL_EXPORT int32_t tmq_write_raw(TAOS *taos, tmq_raw_data raw);
|
||||
DLL_EXPORT int taos_write_raw_block(TAOS *taos, int numOfRows, char *pData, const char *tbname);
|
||||
DLL_EXPORT int taos_write_raw_block_with_fields(TAOS* taos, int rows, char* pData, const char* tbname, TAOS_FIELD *fields, int numFields);
|
||||
DLL_EXPORT void tmq_free_raw(tmq_raw_data raw);
|
||||
// Returning null means error. Returned result need to be freed by tmq_free_json_meta
|
||||
DLL_EXPORT char *tmq_get_json_meta(TAOS_RES *res);
|
||||
|
|
|
@ -47,6 +47,7 @@ extern "C" {
|
|||
#define TSDB_INS_TABLE_TOPICS "ins_topics"
|
||||
#define TSDB_INS_TABLE_STREAMS "ins_streams"
|
||||
#define TSDB_INS_TABLE_STREAM_TASKS "ins_stream_tasks"
|
||||
#define TSDB_INS_TABLE_USER_PRIVILEGES "ins_user_privileges"
|
||||
|
||||
#define TSDB_PERFORMANCE_SCHEMA_DB "performance_schema"
|
||||
#define TSDB_PERFS_TABLE_SMAS "perf_smas"
|
||||
|
|
|
@ -174,15 +174,28 @@ typedef struct SColumnDataAgg {
|
|||
} SColumnDataAgg;
|
||||
#pragma pack(pop)
|
||||
|
||||
typedef struct SBlockID {
|
||||
// The uid of table, from which current data block comes. And it is always 0, if current block is the
|
||||
// result of calculation.
|
||||
uint64_t uid;
|
||||
|
||||
// Block id, acquired and assigned from executor, which created according to the hysical planner. Block id is used
|
||||
// to mark the stage of exec task.
|
||||
uint64_t blockId;
|
||||
|
||||
// Generated by group/partition by [value|tags]. Created and assigned by table-scan operator, group-by operator,
|
||||
// and partition by operator.
|
||||
uint64_t groupId;
|
||||
} SBlockID;
|
||||
|
||||
typedef struct SDataBlockInfo {
|
||||
STimeWindow window;
|
||||
int32_t rows; // todo hide this attribute
|
||||
int32_t rowSize;
|
||||
uint64_t uid; // the uid of table, from which current data block comes
|
||||
uint16_t blockId; // block id, generated by physical planner
|
||||
uint64_t groupId;
|
||||
int16_t hasVarCol;
|
||||
int32_t rows; // todo hide this attribute
|
||||
uint32_t capacity;
|
||||
SBlockID id;
|
||||
int16_t hasVarCol;
|
||||
|
||||
// TODO: optimize and remove following
|
||||
int64_t version; // used for stream, and need serialization
|
||||
int32_t childId; // used for stream, do not serialize
|
||||
|
@ -190,8 +203,8 @@ typedef struct SDataBlockInfo {
|
|||
STimeWindow calWin; // used for stream, do not serialize
|
||||
TSKEY watermark; // used for stream
|
||||
|
||||
char parTbName[TSDB_TABLE_NAME_LEN]; // used for stream partition
|
||||
STag* pTag; // used for stream partition
|
||||
char parTbName[TSDB_TABLE_NAME_LEN]; // used for stream partition
|
||||
STag* pTag; // used for stream partition
|
||||
} SDataBlockInfo;
|
||||
|
||||
typedef struct SSDataBlock {
|
||||
|
@ -225,21 +238,22 @@ typedef struct SVarColAttr {
|
|||
// pBlockAgg->numOfNull == info.rows, all data are null
|
||||
// pBlockAgg->numOfNull == 0, no data are null.
|
||||
typedef struct SColumnInfoData {
|
||||
char* pData; // the corresponding block data in memory
|
||||
char* pData; // the corresponding block data in memory
|
||||
union {
|
||||
char* nullbitmap; // bitmap, one bit for each item in the list
|
||||
SVarColAttr varmeta;
|
||||
};
|
||||
SColumnInfo info; // column info
|
||||
bool hasNull; // if current column data has null value.
|
||||
SColumnInfo info; // column info
|
||||
bool hasNull; // if current column data has null value.
|
||||
} SColumnInfoData;
|
||||
|
||||
typedef struct SQueryTableDataCond {
|
||||
uint64_t suid;
|
||||
int32_t order; // desc|asc order to iterate the data block
|
||||
int32_t order; // desc|asc order to iterate the data block
|
||||
int32_t numOfCols;
|
||||
SColumnInfo* colList;
|
||||
int32_t type; // data block load type:
|
||||
int32_t* pSlotList; // the column output destation slot, and it may be null
|
||||
int32_t type; // data block load type:
|
||||
STimeWindow twindows;
|
||||
int64_t startVersion;
|
||||
int64_t endVersion;
|
||||
|
|
|
@ -24,11 +24,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct SCorEpSet {
|
||||
int32_t version;
|
||||
SEpSet epSet;
|
||||
} SCorEpSet;
|
||||
|
||||
typedef struct SBlockOrderInfo {
|
||||
bool nullFirst;
|
||||
int32_t order;
|
||||
|
@ -36,14 +31,6 @@ typedef struct SBlockOrderInfo {
|
|||
SColumnInfoData* pColData;
|
||||
} SBlockOrderInfo;
|
||||
|
||||
int32_t taosGetFqdnPortFromEp(const char* ep, SEp* pEp);
|
||||
void addEpIntoEpSet(SEpSet* pEpSet, const char* fqdn, uint16_t port);
|
||||
|
||||
bool isEpsetEqual(const SEpSet* s1, const SEpSet* s2);
|
||||
|
||||
void updateEpSet_s(SCorEpSet* pEpSet, SEpSet* pNewEpSet);
|
||||
SEpSet getEpSet_s(SCorEpSet* pEpSet);
|
||||
|
||||
#define NBIT (3u)
|
||||
#define BitPos(_n) ((_n) & ((1 << NBIT) - 1))
|
||||
#define BMCharPos(bm_, r_) ((bm_)[(r_) >> NBIT])
|
||||
|
@ -54,9 +41,9 @@ SEpSet getEpSet_s(SCorEpSet* pEpSet);
|
|||
BMCharPos(bm_, r_) |= (1u << (7u - BitPos(r_))); \
|
||||
} while (0)
|
||||
|
||||
#define colDataSetNotNull_f(bm_, r_) \
|
||||
do { \
|
||||
BMCharPos(bm_, r_) &= ~(1u << (7u - BitPos(r_))); \
|
||||
#define colDataClearNull_f(bm_, r_) \
|
||||
do { \
|
||||
BMCharPos(bm_, r_) &= ((char)(~(1u << (7u - BitPos(r_))))); \
|
||||
} while (0)
|
||||
|
||||
#define colDataIsNull_var(pColumnInfoData, row) (pColumnInfoData->varmeta.offset[row] == -1)
|
||||
|
@ -90,6 +77,33 @@ static FORCE_INLINE bool colDataIsNull_s(const SColumnInfoData* pColumnInfoData,
|
|||
}
|
||||
}
|
||||
|
||||
static FORCE_INLINE bool colDataIsNNull_s(const SColumnInfoData* pColumnInfoData, int32_t startIndex,
|
||||
uint32_t nRows) {
|
||||
if (!pColumnInfoData->hasNull) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) {
|
||||
for (int32_t i = startIndex; i < nRows; ++i) {
|
||||
if (!colDataIsNull_var(pColumnInfoData, i)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (pColumnInfoData->nullbitmap == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int32_t i = startIndex; i < nRows; ++i) {
|
||||
if (!colDataIsNull_f(pColumnInfoData->nullbitmap, i)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static FORCE_INLINE bool colDataIsNull(const SColumnInfoData* pColumnInfoData, uint32_t totalRows, uint32_t row,
|
||||
SColumnDataAgg* pColAgg) {
|
||||
if (!pColumnInfoData->hasNull) {
|
||||
|
@ -137,9 +151,6 @@ static FORCE_INLINE void colDataAppendNNULL(SColumnInfoData* pColumnInfoData, ui
|
|||
for (int32_t i = start; i < start + nRows; ++i) {
|
||||
colDataSetNull_f(pColumnInfoData->nullbitmap, i);
|
||||
}
|
||||
|
||||
int32_t bytes = pColumnInfoData->info.bytes;
|
||||
memset(pColumnInfoData->pData + start * bytes, 0, nRows * bytes);
|
||||
}
|
||||
|
||||
pColumnInfoData->hasNull = true;
|
||||
|
@ -220,9 +231,11 @@ int32_t blockDataSort_rv(SSDataBlock* pDataBlock, SArray* pOrderInfo, bool nullF
|
|||
|
||||
int32_t colInfoDataEnsureCapacity(SColumnInfoData* pColumn, uint32_t numOfRows, bool clearPayload);
|
||||
int32_t blockDataEnsureCapacity(SSDataBlock* pDataBlock, uint32_t numOfRows);
|
||||
int32_t blockDataEnsureCapacityNoClear(SSDataBlock* pDataBlock, uint32_t numOfRows);
|
||||
|
||||
void colInfoDataCleanup(SColumnInfoData* pColumn, uint32_t numOfRows);
|
||||
void blockDataCleanup(SSDataBlock* pDataBlock);
|
||||
void blockDataEmpty(SSDataBlock* pDataBlock);
|
||||
|
||||
size_t blockDataGetCapacityInRow(const SSDataBlock* pBlock, size_t pageSize);
|
||||
|
||||
|
|
|
@ -27,17 +27,17 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct SBuffer SBuffer;
|
||||
typedef struct SSchema SSchema;
|
||||
typedef struct STColumn STColumn;
|
||||
typedef struct STSchema STSchema;
|
||||
typedef struct SValue SValue;
|
||||
typedef struct SColVal SColVal;
|
||||
typedef struct STSRow2 STSRow2;
|
||||
typedef struct STSRowBuilder STSRowBuilder;
|
||||
typedef struct STagVal STagVal;
|
||||
typedef struct STag STag;
|
||||
typedef struct SColData SColData;
|
||||
typedef struct SBuffer SBuffer;
|
||||
typedef struct SSchema SSchema;
|
||||
typedef struct STColumn STColumn;
|
||||
typedef struct STSchema STSchema;
|
||||
typedef struct SValue SValue;
|
||||
typedef struct SColVal SColVal;
|
||||
typedef struct SRow SRow;
|
||||
typedef struct SRowIter SRowIter;
|
||||
typedef struct STagVal STagVal;
|
||||
typedef struct STag STag;
|
||||
typedef struct SColData SColData;
|
||||
|
||||
#define HAS_NONE ((uint8_t)0x1)
|
||||
#define HAS_NULL ((uint8_t)0x2)
|
||||
|
@ -68,13 +68,10 @@ struct SBuffer {
|
|||
void tBufferDestroy(SBuffer *pBuffer);
|
||||
int32_t tBufferInit(SBuffer *pBuffer, int64_t size);
|
||||
int32_t tBufferPut(SBuffer *pBuffer, const void *pData, int64_t nData);
|
||||
int32_t tBufferReserve(SBuffer *pBuffer, int64_t nData, void **ppData);
|
||||
|
||||
// STSchema ================================
|
||||
int32_t tTSchemaCreate(int32_t sver, SSchema *pSchema, int32_t nCols, STSchema **ppTSchema);
|
||||
void tTSchemaDestroy(STSchema *pTSchema);
|
||||
|
||||
// SValue ================================
|
||||
static FORCE_INLINE int32_t tGetValue(uint8_t *p, SValue *pValue, int8_t type);
|
||||
void tDestroyTSchema(STSchema *pTSchema);
|
||||
|
||||
// SColVal ================================
|
||||
#define CV_FLAG_VALUE ((int8_t)0x0)
|
||||
|
@ -89,26 +86,14 @@ static FORCE_INLINE int32_t tGetValue(uint8_t *p, SValue *pValue, int8_t type);
|
|||
#define COL_VAL_IS_NULL(CV) ((CV)->flag == CV_FLAG_NULL)
|
||||
#define COL_VAL_IS_VALUE(CV) ((CV)->flag == CV_FLAG_VALUE)
|
||||
|
||||
// STSRow2 ================================
|
||||
#define TSROW_LEN(PROW, V) tGetI32v((uint8_t *)(PROW)->data, (V) ? &(V) : NULL)
|
||||
#define TSROW_SVER(PROW, V) tGetI32v((PROW)->data + TSROW_LEN(PROW, NULL), (V) ? &(V) : NULL)
|
||||
// SRow ================================
|
||||
int32_t tRowBuild(SArray *aColVal, STSchema *pTSchema, SBuffer *pBuffer);
|
||||
void tRowGet(SRow *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal);
|
||||
|
||||
int32_t tTSRowNew(STSRowBuilder *pBuilder, SArray *pArray, STSchema *pTSchema, STSRow2 **ppRow);
|
||||
int32_t tTSRowClone(const STSRow2 *pRow, STSRow2 **ppRow);
|
||||
void tTSRowFree(STSRow2 *pRow);
|
||||
void tTSRowGet(STSRow2 *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal);
|
||||
int32_t tTSRowToArray(STSRow2 *pRow, STSchema *pTSchema, SArray **ppArray);
|
||||
int32_t tPutTSRow(uint8_t *p, STSRow2 *pRow);
|
||||
int32_t tGetTSRow(uint8_t *p, STSRow2 **ppRow);
|
||||
|
||||
// STSRowBuilder ================================
|
||||
#define tsRowBuilderInit() ((STSRowBuilder){0})
|
||||
#define tsRowBuilderClear(B) \
|
||||
do { \
|
||||
if ((B)->pBuf) { \
|
||||
taosMemoryFree((B)->pBuf); \
|
||||
} \
|
||||
} while (0)
|
||||
// SRowIter ================================
|
||||
int32_t tRowIterOpen(SRow *pRow, STSchema *pTSchema, SRowIter **ppIter);
|
||||
void tRowIterClose(SRowIter **ppIter);
|
||||
SColVal *tRowIterNext(SRowIter *pIter);
|
||||
|
||||
// STag ================================
|
||||
int32_t tTagNew(SArray *pArray, int32_t version, int8_t isJson, STag **ppTag);
|
||||
|
@ -147,29 +132,17 @@ struct STSchema {
|
|||
int32_t numOfCols;
|
||||
int32_t version;
|
||||
int32_t flen;
|
||||
int32_t vlen;
|
||||
int32_t tlen;
|
||||
STColumn columns[];
|
||||
};
|
||||
|
||||
#define TSROW_HAS_NONE ((uint8_t)0x1)
|
||||
#define TSROW_HAS_NULL ((uint8_t)0x2U)
|
||||
#define TSROW_HAS_VAL ((uint8_t)0x4U)
|
||||
#define TSROW_KV_SMALL ((uint8_t)0x10U)
|
||||
#define TSROW_KV_MID ((uint8_t)0x20U)
|
||||
#define TSROW_KV_BIG ((uint8_t)0x40U)
|
||||
#pragma pack(push, 1)
|
||||
struct STSRow2 {
|
||||
TSKEY ts;
|
||||
uint8_t flags;
|
||||
uint8_t data[];
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
struct STSRowBuilder {
|
||||
// STSRow2 tsRow;
|
||||
int32_t szBuf;
|
||||
uint8_t *pBuf;
|
||||
struct SRow {
|
||||
uint8_t flag;
|
||||
uint8_t rsv;
|
||||
uint16_t sver;
|
||||
uint32_t len;
|
||||
TSKEY ts;
|
||||
uint8_t data[];
|
||||
};
|
||||
|
||||
struct SValue {
|
||||
|
@ -258,37 +231,17 @@ typedef struct {
|
|||
int32_t nCols;
|
||||
schema_ver_t version;
|
||||
uint16_t flen;
|
||||
int32_t vlen;
|
||||
int32_t tlen;
|
||||
STColumn *columns;
|
||||
} STSchemaBuilder;
|
||||
|
||||
// use 2 bits for bitmap(default: STSRow/sub block)
|
||||
#define TD_VTYPE_BITS 2
|
||||
#define TD_VTYPE_PARTS 4 // PARTITIONS: 1 byte / 2 bits
|
||||
#define TD_VTYPE_OPTR 3 // OPERATOR: 4 - 1, utilize to get remainder
|
||||
#define TD_BITMAP_BYTES(cnt) (((cnt) + TD_VTYPE_OPTR) >> 2)
|
||||
|
||||
// use 1 bit for bitmap(super block)
|
||||
#define TD_VTYPE_BITS_I 1
|
||||
#define TD_VTYPE_PARTS_I 8 // PARTITIONS: 1 byte / 1 bit
|
||||
#define TD_VTYPE_OPTR_I 7 // OPERATOR: 8 - 1, utilize to get remainder
|
||||
#define TD_BITMAP_BYTES_I(cnt) (((cnt) + TD_VTYPE_OPTR_I) >> 3)
|
||||
|
||||
int32_t tdInitTSchemaBuilder(STSchemaBuilder *pBuilder, schema_ver_t version);
|
||||
void tdDestroyTSchemaBuilder(STSchemaBuilder *pBuilder);
|
||||
void tdResetTSchemaBuilder(STSchemaBuilder *pBuilder, schema_ver_t version);
|
||||
int32_t tdAddColToSchema(STSchemaBuilder *pBuilder, int8_t type, int8_t flags, col_id_t colId, col_bytes_t bytes);
|
||||
STSchema *tdGetSchemaFromBuilder(STSchemaBuilder *pBuilder);
|
||||
|
||||
static FORCE_INLINE int32_t tGetValue(uint8_t *p, SValue *pValue, int8_t type) {
|
||||
if (IS_VAR_DATA_TYPE(type)) {
|
||||
return tGetBinary(p, &pValue->pData, pValue ? &pValue->nData : NULL);
|
||||
} else {
|
||||
memcpy(&pValue->val, p, tDataTypes[type].bytes);
|
||||
return tDataTypes[type].bytes;
|
||||
}
|
||||
}
|
||||
STSchema *tBuildTSchema(SSchema *aSchema, int32_t numOfCols, int32_t version);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -44,6 +44,8 @@ extern int32_t tsCompatibleModel;
|
|||
extern bool tsPrintAuth;
|
||||
extern int64_t tsTickPerMin[3];
|
||||
extern int32_t tsCountAlwaysReturnValue;
|
||||
extern float tsSelectivityRatio;
|
||||
extern int32_t tsTagFilterResCacheSize;
|
||||
|
||||
// queue & threads
|
||||
extern int32_t tsNumOfRpcThreads;
|
||||
|
@ -62,6 +64,11 @@ extern int32_t tsNumOfSnodeStreamThreads;
|
|||
extern int32_t tsNumOfSnodeWriteThreads;
|
||||
extern int64_t tsRpcQueueMemoryAllowed;
|
||||
|
||||
// sync raft
|
||||
extern int32_t tsElectInterval;
|
||||
extern int32_t tsHeartbeatInterval;
|
||||
extern int32_t tsHeartbeatTimeout;
|
||||
|
||||
// monitor
|
||||
extern bool tsEnableMonitor;
|
||||
extern int32_t tsMonitorInterval;
|
||||
|
@ -90,6 +97,10 @@ extern int32_t tsQueryNodeChunkSize;
|
|||
extern bool tsQueryUseNodeAllocator;
|
||||
extern bool tsKeepColumnName;
|
||||
extern bool tsEnableQueryHb;
|
||||
extern int32_t tsRedirectPeriod;
|
||||
extern int32_t tsRedirectFactor;
|
||||
extern int32_t tsRedirectMaxPeriod;
|
||||
extern int32_t tsMaxRetryWaitTime;
|
||||
|
||||
// client
|
||||
extern int32_t tsMinSlidingTime;
|
||||
|
@ -120,9 +131,10 @@ extern char tsUdfdResFuncs[];
|
|||
extern char tsUdfdLdLibPath[];
|
||||
|
||||
// schemaless
|
||||
extern char tsSmlChildTableName[];
|
||||
extern char tsSmlTagName[];
|
||||
extern bool tsSmlDataFormat;
|
||||
extern char tsSmlChildTableName[];
|
||||
extern char tsSmlTagName[];
|
||||
extern bool tsSmlDataFormat;
|
||||
extern int32_t tsSmlBatchSize;
|
||||
|
||||
// wal
|
||||
extern int64_t tsWalFsyncDataSizeLimit;
|
||||
|
@ -130,6 +142,7 @@ extern int64_t tsWalFsyncDataSizeLimit;
|
|||
// internal
|
||||
extern int32_t tsTransPullupInterval;
|
||||
extern int32_t tsMqRebalanceInterval;
|
||||
extern int32_t tsStreamCheckpointTickInterval;
|
||||
extern int32_t tsTtlUnit;
|
||||
extern int32_t tsTtlPushInterval;
|
||||
extern int32_t tsGrantHBInterval;
|
||||
|
@ -138,7 +151,7 @@ extern int32_t tsUptimeInterval;
|
|||
extern int32_t tsRpcRetryLimit;
|
||||
extern int32_t tsRpcRetryInterval;
|
||||
|
||||
//#define NEEDTO_COMPRESSS_MSG(size) (tsCompressMsgSize != -1 && (size) > tsCompressMsgSize)
|
||||
// #define NEEDTO_COMPRESSS_MSG(size) (tsCompressMsgSize != -1 && (size) > tsCompressMsgSize)
|
||||
|
||||
int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDir, const char **envCmd,
|
||||
const char *envFile, char *apolloUrl, SArray *pArgs, bool tsc);
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
||||
*
|
||||
* This program is free software: you can use, redistribute, and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3
|
||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_TMISCE_H
|
||||
#define TDENGINE_TMISCE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "tmsg.h"
|
||||
|
||||
typedef struct SCorEpSet {
|
||||
int32_t version;
|
||||
SEpSet epSet;
|
||||
} SCorEpSet;
|
||||
|
||||
int32_t taosGetFqdnPortFromEp(const char* ep, SEp* pEp);
|
||||
void addEpIntoEpSet(SEpSet* pEpSet, const char* fqdn, uint16_t port);
|
||||
|
||||
bool isEpsetEqual(const SEpSet* s1, const SEpSet* s2);
|
||||
|
||||
void updateEpSet_s(SCorEpSet* pEpSet, SEpSet* pNewEpSet);
|
||||
SEpSet getEpSet_s(SCorEpSet* pEpSet);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // TDENGINE_TMISCE_H
|
|
@ -66,6 +66,15 @@ extern int32_t tMsgDict[];
|
|||
|
||||
typedef uint16_t tmsg_t;
|
||||
|
||||
static inline bool vnodeIsMsgBlock(tmsg_t type) {
|
||||
return (type == TDMT_VND_CREATE_TABLE) || (type == TDMT_VND_ALTER_TABLE) || (type == TDMT_VND_DROP_TABLE) ||
|
||||
(type == TDMT_VND_UPDATE_TAG_VAL);
|
||||
}
|
||||
|
||||
static inline bool syncUtilUserCommit(tmsg_t msgType) {
|
||||
return msgType != TDMT_SYNC_NOOP && msgType != TDMT_SYNC_LEADER_TRANSFER;
|
||||
}
|
||||
|
||||
/* ------------------------ OTHER DEFINITIONS ------------------------ */
|
||||
// IE type
|
||||
#define TSDB_IE_TYPE_SEC 1
|
||||
|
@ -120,6 +129,7 @@ typedef enum _mgmt_table {
|
|||
TSDB_MGMT_TABLE_VNODES,
|
||||
TSDB_MGMT_TABLE_APPS,
|
||||
TSDB_MGMT_TABLE_STREAM_TASKS,
|
||||
TSDB_MGMT_TABLE_PRIVILEGES,
|
||||
TSDB_MGMT_TABLE_MAX,
|
||||
} EShowType;
|
||||
|
||||
|
@ -141,16 +151,18 @@ typedef enum _mgmt_table {
|
|||
#define TSDB_FILL_PREV 4
|
||||
#define TSDB_FILL_NEXT 5
|
||||
|
||||
#define TSDB_ALTER_USER_PASSWD 0x1
|
||||
#define TSDB_ALTER_USER_SUPERUSER 0x2
|
||||
#define TSDB_ALTER_USER_ADD_READ_DB 0x3
|
||||
#define TSDB_ALTER_USER_REMOVE_READ_DB 0x4
|
||||
#define TSDB_ALTER_USER_ADD_WRITE_DB 0x5
|
||||
#define TSDB_ALTER_USER_REMOVE_WRITE_DB 0x6
|
||||
#define TSDB_ALTER_USER_ADD_ALL_DB 0x7
|
||||
#define TSDB_ALTER_USER_REMOVE_ALL_DB 0x8
|
||||
#define TSDB_ALTER_USER_ENABLE 0x9
|
||||
#define TSDB_ALTER_USER_SYSINFO 0xA
|
||||
#define TSDB_ALTER_USER_PASSWD 0x1
|
||||
#define TSDB_ALTER_USER_SUPERUSER 0x2
|
||||
#define TSDB_ALTER_USER_ADD_READ_DB 0x3
|
||||
#define TSDB_ALTER_USER_REMOVE_READ_DB 0x4
|
||||
#define TSDB_ALTER_USER_ADD_WRITE_DB 0x5
|
||||
#define TSDB_ALTER_USER_REMOVE_WRITE_DB 0x6
|
||||
#define TSDB_ALTER_USER_ADD_ALL_DB 0x7
|
||||
#define TSDB_ALTER_USER_REMOVE_ALL_DB 0x8
|
||||
#define TSDB_ALTER_USER_ENABLE 0x9
|
||||
#define TSDB_ALTER_USER_SYSINFO 0xA
|
||||
#define TSDB_ALTER_USER_ADD_SUBSCRIBE_TOPIC 0xB
|
||||
#define TSDB_ALTER_USER_REMOVE_SUBSCRIBE_TOPIC 0xC
|
||||
|
||||
#define TSDB_ALTER_USER_PRIVILEGES 0x2
|
||||
|
||||
|
@ -497,6 +509,8 @@ typedef struct {
|
|||
char* pComment;
|
||||
char* pAst1;
|
||||
char* pAst2;
|
||||
int64_t deleteMark1;
|
||||
int64_t deleteMark2;
|
||||
} SMCreateStbReq;
|
||||
|
||||
int32_t tSerializeSMCreateStbReq(void* buf, int32_t bufLen, SMCreateStbReq* pReq);
|
||||
|
@ -620,7 +634,7 @@ typedef struct {
|
|||
int8_t enable;
|
||||
char user[TSDB_USER_LEN];
|
||||
char pass[TSDB_USET_PASSWORD_LEN];
|
||||
char dbname[TSDB_DB_FNAME_LEN];
|
||||
char objname[TSDB_DB_FNAME_LEN]; // db or topic
|
||||
} SAlterUserReq;
|
||||
|
||||
int32_t tSerializeSAlterUserReq(void* buf, int32_t bufLen, SAlterUserReq* pReq);
|
||||
|
@ -649,34 +663,6 @@ int32_t tSerializeSGetUserAuthRsp(void* buf, int32_t bufLen, SGetUserAuthRsp* pR
|
|||
int32_t tDeserializeSGetUserAuthRsp(void* buf, int32_t bufLen, SGetUserAuthRsp* pRsp);
|
||||
void tFreeSGetUserAuthRsp(SGetUserAuthRsp* pRsp);
|
||||
|
||||
typedef struct {
|
||||
int16_t lowerRelOptr;
|
||||
int16_t upperRelOptr;
|
||||
int16_t filterstr; // denote if current column is char(binary/nchar)
|
||||
|
||||
union {
|
||||
struct {
|
||||
int64_t lowerBndi;
|
||||
int64_t upperBndi;
|
||||
};
|
||||
struct {
|
||||
double lowerBndd;
|
||||
double upperBndd;
|
||||
};
|
||||
struct {
|
||||
int64_t pz;
|
||||
int64_t len;
|
||||
};
|
||||
};
|
||||
} SColumnFilterInfo;
|
||||
|
||||
typedef struct {
|
||||
int16_t numOfFilters;
|
||||
union {
|
||||
int64_t placeholder;
|
||||
SColumnFilterInfo* filterInfo;
|
||||
};
|
||||
} SColumnFilterList;
|
||||
/*
|
||||
* for client side struct, only column id, type, bytes are necessary
|
||||
* But for data in vnode side, we need all the following information.
|
||||
|
@ -687,10 +673,10 @@ typedef struct {
|
|||
int16_t slotId;
|
||||
};
|
||||
|
||||
int8_t type;
|
||||
int32_t bytes;
|
||||
uint8_t precision;
|
||||
uint8_t scale;
|
||||
int32_t bytes;
|
||||
int8_t type;
|
||||
} SColumnInfo;
|
||||
|
||||
typedef struct STimeWindow {
|
||||
|
@ -1087,6 +1073,7 @@ typedef struct {
|
|||
int32_t vgId;
|
||||
int8_t syncState;
|
||||
int8_t syncRestore;
|
||||
int8_t syncCanRead;
|
||||
int64_t cacheUsage;
|
||||
int64_t numOfTables;
|
||||
int64_t numOfTimeSeries;
|
||||
|
@ -1172,6 +1159,13 @@ typedef struct {
|
|||
int32_t tSerializeSMTimerMsg(void* buf, int32_t bufLen, SMTimerReq* pReq);
|
||||
int32_t tDeserializeSMTimerMsg(void* buf, int32_t bufLen, SMTimerReq* pReq);
|
||||
|
||||
typedef struct {
|
||||
int64_t tick;
|
||||
} SMStreamTickReq;
|
||||
|
||||
int32_t tSerializeSMStreamTickMsg(void* buf, int32_t bufLen, SMStreamTickReq* pReq);
|
||||
int32_t tDeserializeSMStreamTickMsg(void* buf, int32_t bufLen, SMStreamTickReq* pReq);
|
||||
|
||||
typedef struct {
|
||||
int32_t id;
|
||||
uint16_t port; // node sync Port
|
||||
|
@ -1420,8 +1414,8 @@ typedef struct {
|
|||
int8_t streamBlockType;
|
||||
int32_t compLen;
|
||||
int32_t numOfBlocks;
|
||||
int32_t numOfRows;
|
||||
int32_t numOfCols;
|
||||
int64_t numOfRows; // from int32_t change to int64_t
|
||||
int64_t numOfCols;
|
||||
int64_t skey;
|
||||
int64_t ekey;
|
||||
int64_t version; // for stream
|
||||
|
@ -1620,15 +1614,14 @@ typedef struct SSubQueryMsg {
|
|||
int8_t explain;
|
||||
int8_t needFetch;
|
||||
uint32_t sqlLen;
|
||||
char *sql;
|
||||
char* sql;
|
||||
uint32_t msgLen;
|
||||
char *msg;
|
||||
char* msg;
|
||||
} SSubQueryMsg;
|
||||
|
||||
int32_t tSerializeSSubQueryMsg(void *buf, int32_t bufLen, SSubQueryMsg *pReq);
|
||||
int32_t tDeserializeSSubQueryMsg(void *buf, int32_t bufLen, SSubQueryMsg *pReq);
|
||||
void tFreeSSubQueryMsg(SSubQueryMsg *pReq);
|
||||
|
||||
int32_t tSerializeSSubQueryMsg(void* buf, int32_t bufLen, SSubQueryMsg* pReq);
|
||||
int32_t tDeserializeSSubQueryMsg(void* buf, int32_t bufLen, SSubQueryMsg* pReq);
|
||||
void tFreeSSubQueryMsg(SSubQueryMsg* pReq);
|
||||
|
||||
typedef struct {
|
||||
SMsgHead header;
|
||||
|
@ -1667,6 +1660,9 @@ typedef struct {
|
|||
int32_t execId;
|
||||
} SResFetchReq;
|
||||
|
||||
int32_t tSerializeSResFetchReq(void* buf, int32_t bufLen, SResFetchReq* pReq);
|
||||
int32_t tDeserializeSResFetchReq(void* buf, int32_t bufLen, SResFetchReq* pReq);
|
||||
|
||||
typedef struct {
|
||||
SMsgHead header;
|
||||
uint64_t sId;
|
||||
|
@ -1738,12 +1734,11 @@ typedef struct {
|
|||
int32_t execId;
|
||||
} STaskDropReq;
|
||||
|
||||
int32_t tSerializeSTaskDropReq(void *buf, int32_t bufLen, STaskDropReq *pReq);
|
||||
int32_t tDeserializeSTaskDropReq(void *buf, int32_t bufLen, STaskDropReq *pReq);
|
||||
|
||||
int32_t tSerializeSQueryTableRsp(void *buf, int32_t bufLen, SQueryTableRsp *pRsp);
|
||||
int32_t tDeserializeSQueryTableRsp(void *buf, int32_t bufLen, SQueryTableRsp *pRsp);
|
||||
int32_t tSerializeSTaskDropReq(void* buf, int32_t bufLen, STaskDropReq* pReq);
|
||||
int32_t tDeserializeSTaskDropReq(void* buf, int32_t bufLen, STaskDropReq* pReq);
|
||||
|
||||
int32_t tSerializeSQueryTableRsp(void* buf, int32_t bufLen, SQueryTableRsp* pRsp);
|
||||
int32_t tDeserializeSQueryTableRsp(void* buf, int32_t bufLen, SQueryTableRsp* pRsp);
|
||||
|
||||
typedef struct {
|
||||
int32_t code;
|
||||
|
@ -1771,6 +1766,8 @@ typedef struct {
|
|||
int64_t watermark;
|
||||
int32_t numOfTags;
|
||||
SArray* pTags; // array of SField
|
||||
// 3.0.20
|
||||
int64_t checkpointFreq; // ms
|
||||
} SCMCreateStreamReq;
|
||||
|
||||
typedef struct {
|
||||
|
@ -1970,6 +1967,12 @@ typedef struct {
|
|||
SHashObj* rebSubHash; // SHashObj<key, SMqRebSubscribe>
|
||||
} SMqDoRebalanceMsg;
|
||||
|
||||
typedef struct {
|
||||
int64_t streamId;
|
||||
int64_t checkpointId;
|
||||
char streamName[TSDB_STREAM_FNAME_LEN];
|
||||
} SMStreamDoCheckpointMsg;
|
||||
|
||||
typedef struct {
|
||||
int64_t status;
|
||||
} SMVSubscribeRsp;
|
||||
|
@ -2021,6 +2024,7 @@ typedef struct {
|
|||
typedef struct {
|
||||
int64_t maxdelay[2];
|
||||
int64_t watermark[2];
|
||||
int64_t deleteMark[2];
|
||||
int32_t qmsgLen[2];
|
||||
char* qmsg[2]; // pAst:qmsg:SRetention => trigger aggr task1/2
|
||||
} SRSmaParam;
|
||||
|
@ -2742,6 +2746,7 @@ typedef struct {
|
|||
char* tagsFilter;
|
||||
char* sql;
|
||||
char* ast;
|
||||
int64_t deleteMark;
|
||||
} SMCreateSmaReq;
|
||||
|
||||
int32_t tSerializeSMCreateSmaReq(void* buf, int32_t bufLen, SMCreateSmaReq* pReq);
|
||||
|
@ -2948,6 +2953,9 @@ typedef struct {
|
|||
STqOffsetVal reqOffset;
|
||||
} SMqPollReq;
|
||||
|
||||
int32_t tSerializeSMqPollReq(void* buf, int32_t bufLen, SMqPollReq* pReq);
|
||||
int32_t tDeserializeSMqPollReq(void* buf, int32_t bufLen, SMqPollReq* pReq);
|
||||
|
||||
typedef struct {
|
||||
int32_t vgId;
|
||||
int64_t offset;
|
||||
|
@ -3159,7 +3167,8 @@ int32_t tDecodeDeleteRes(SDecoder* pCoder, SDeleteRes* pRes);
|
|||
typedef struct {
|
||||
// int64_t uid;
|
||||
char tbname[TSDB_TABLE_NAME_LEN];
|
||||
int64_t ts;
|
||||
int64_t startTs;
|
||||
int64_t endTs;
|
||||
} SSingleDeleteReq;
|
||||
|
||||
int32_t tEncodeSSingleDeleteReq(SEncoder* pCoder, const SSingleDeleteReq* pReq);
|
||||
|
@ -3181,8 +3190,8 @@ typedef struct {
|
|||
} SBatchMsg;
|
||||
|
||||
typedef struct {
|
||||
SMsgHead header;
|
||||
SArray* pMsgs; //SArray<SBatchMsg>
|
||||
SMsgHead header;
|
||||
SArray* pMsgs; // SArray<SBatchMsg>
|
||||
} SBatchReq;
|
||||
|
||||
typedef struct {
|
||||
|
@ -3194,11 +3203,11 @@ typedef struct {
|
|||
} SBatchRspMsg;
|
||||
|
||||
typedef struct {
|
||||
SArray* pRsps; //SArray<SBatchRspMsg>
|
||||
SArray* pRsps; // SArray<SBatchRspMsg>
|
||||
} SBatchRsp;
|
||||
|
||||
int32_t tSerializeSBatchReq(void *buf, int32_t bufLen, SBatchReq *pReq);
|
||||
int32_t tDeserializeSBatchReq(void *buf, int32_t bufLen, SBatchReq *pReq);
|
||||
int32_t tSerializeSBatchReq(void* buf, int32_t bufLen, SBatchReq* pReq);
|
||||
int32_t tDeserializeSBatchReq(void* buf, int32_t bufLen, SBatchReq* pReq);
|
||||
static FORCE_INLINE void tFreeSBatchReqMsg(void* msg) {
|
||||
if (NULL == msg) {
|
||||
return;
|
||||
|
@ -3207,8 +3216,8 @@ static FORCE_INLINE void tFreeSBatchReqMsg(void* msg) {
|
|||
taosMemoryFree(pMsg->msg);
|
||||
}
|
||||
|
||||
int32_t tSerializeSBatchRsp(void *buf, int32_t bufLen, SBatchRsp *pRsp);
|
||||
int32_t tDeserializeSBatchRsp(void *buf, int32_t bufLen, SBatchRsp *pRsp);
|
||||
int32_t tSerializeSBatchRsp(void* buf, int32_t bufLen, SBatchRsp* pRsp);
|
||||
int32_t tDeserializeSBatchRsp(void* buf, int32_t bufLen, SBatchRsp* pRsp);
|
||||
|
||||
static FORCE_INLINE void tFreeSBatchRspMsg(void* p) {
|
||||
if (NULL == p) {
|
||||
|
@ -3219,11 +3228,10 @@ static FORCE_INLINE void tFreeSBatchRspMsg(void* p) {
|
|||
taosMemoryFree(pRsp->msg);
|
||||
}
|
||||
|
||||
int32_t tSerializeSMqAskEpReq(void *buf, int32_t bufLen, SMqAskEpReq *pReq);
|
||||
int32_t tDeserializeSMqAskEpReq(void *buf, int32_t bufLen, SMqAskEpReq *pReq);
|
||||
int32_t tSerializeSMqHbReq(void *buf, int32_t bufLen, SMqHbReq *pReq);
|
||||
int32_t tDeserializeSMqHbReq(void *buf, int32_t bufLen, SMqHbReq *pReq);
|
||||
|
||||
int32_t tSerializeSMqAskEpReq(void* buf, int32_t bufLen, SMqAskEpReq* pReq);
|
||||
int32_t tDeserializeSMqAskEpReq(void* buf, int32_t bufLen, SMqAskEpReq* pReq);
|
||||
int32_t tSerializeSMqHbReq(void* buf, int32_t bufLen, SMqHbReq* pReq);
|
||||
int32_t tDeserializeSMqHbReq(void* buf, int32_t bufLen, SMqHbReq* pReq);
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
|
|
|
@ -43,7 +43,6 @@ typedef int32_t (*PutToQueueFp)(void* pMgmt, EQueueType qtype, SRpcMsg* pMsg);
|
|||
typedef int32_t (*GetQueueSizeFp)(void* pMgmt, int32_t vgId, EQueueType qtype);
|
||||
typedef int32_t (*SendReqFp)(const SEpSet* pEpSet, SRpcMsg* pMsg);
|
||||
typedef void (*SendRspFp)(SRpcMsg* pMsg);
|
||||
typedef void (*SendRedirectRspFp)(SRpcMsg* pMsg, const SEpSet* pNewEpSet);
|
||||
typedef void (*RegisterBrokenLinkArgFp)(SRpcMsg* pMsg);
|
||||
typedef void (*ReleaseHandleFp)(SRpcHandleInfo* pHandle, int8_t type);
|
||||
typedef void (*ReportStartup)(const char* name, const char* desc);
|
||||
|
@ -55,7 +54,6 @@ typedef struct {
|
|||
GetQueueSizeFp qsizeFp;
|
||||
SendReqFp sendReqFp;
|
||||
SendRspFp sendRspFp;
|
||||
SendRedirectRspFp sendRedirectRspFp;
|
||||
RegisterBrokenLinkArgFp registerBrokenLinkArgFp;
|
||||
ReleaseHandleFp releaseHandleFp;
|
||||
ReportStartup reportStartupFp;
|
||||
|
@ -66,7 +64,6 @@ int32_t tmsgPutToQueue(const SMsgCb* msgcb, EQueueType qtype, SRpcMsg* pMsg);
|
|||
int32_t tmsgGetQueueSize(const SMsgCb* msgcb, int32_t vgId, EQueueType qtype);
|
||||
int32_t tmsgSendReq(const SEpSet* epSet, SRpcMsg* pMsg);
|
||||
void tmsgSendRsp(SRpcMsg* pMsg);
|
||||
void tmsgSendRedirectRsp(SRpcMsg* pMsg, const SEpSet* pNewEpSet);
|
||||
void tmsgRegisterBrokenLinkArg(SRpcMsg* pMsg);
|
||||
void tmsgReleaseHandle(SRpcHandleInfo* pHandle, int8_t type);
|
||||
void tmsgReportStartup(const char* name, const char* desc);
|
||||
|
|
|
@ -172,6 +172,8 @@ enum {
|
|||
TD_DEF_MSG_TYPE(TDMT_MND_SERVER_VERSION, "server-version", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_MND_UPTIME_TIMER, "uptime-timer", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_MND_TMQ_LOST_CONSUMER_CLEAR, "lost-consumer-clear", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_MND_STREAM_CHECKPOINT_TIMER, "stream-checkpoint-tmr", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_MND_STREAM_BEGIN_CHECKPOINT, "stream-begin-checkpoint", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_MND_MAX_MSG, "mnd-max", NULL, NULL)
|
||||
|
||||
TD_NEW_MSG_SEG(TDMT_VND_MSG)
|
||||
|
@ -241,8 +243,11 @@ enum {
|
|||
TD_DEF_MSG_TYPE(TDMT_STREAM_TASK_DISPATCH, "stream-task-dispatch", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_STREAM_UNUSED1, "stream-unused1", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_STREAM_RETRIEVE, "stream-retrieve", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_STREAM_RECOVER_FINISH, "vnode-stream-finish", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_STREAM_TASK_CHECK, "vnode-stream-task-check", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_STREAM_RECOVER_FINISH, "stream-recover-finish", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_STREAM_TASK_CHECK, "stream-task-check", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_STREAM_TASK_CHECKPOINT, "stream-checkpoint", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_STREAM_TASK_REPORT_CHECKPOINT, "stream-report-checkpoint", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_STREAM_TASK_RESTORE_CHECKPOINT, "stream-restore-checkpoint", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_STREAM_MAX_MSG, "stream-max", NULL, NULL)
|
||||
|
||||
TD_NEW_MSG_SEG(TDMT_MON_MSG)
|
||||
|
@ -280,8 +285,9 @@ enum {
|
|||
|
||||
TD_NEW_MSG_SEG(TDMT_VND_STREAM_MSG)
|
||||
TD_DEF_MSG_TYPE(TDMT_VND_STREAM_TRIGGER, "vnode-stream-trigger", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_VND_STREAM_RECOVER_STEP1, "vnode-stream-recover1", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_VND_STREAM_RECOVER_STEP2, "vnode-stream-recover2", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_VND_STREAM_RECOVER_NONBLOCKING_STAGE, "vnode-stream-recover1", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_VND_STREAM_RECOVER_BLOCKING_STAGE, "vnode-stream-recover2", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_VND_STREAM_CHECK_POINT_SOURCE, "vnode-stream-checkpoint-source", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_VND_STREAM_MAX_MSG, "vnd-stream-max", NULL, NULL)
|
||||
|
||||
TD_NEW_MSG_SEG(TDMT_VND_TMQ_MSG)
|
||||
|
|
|
@ -55,6 +55,14 @@ typedef struct STSRow {
|
|||
#define TD_ROW_TP 0x0U // default
|
||||
#define TD_ROW_KV 0x01U
|
||||
|
||||
#define TD_VTYPE_PARTS 4 // PARTITIONS: 1 byte / 2 bits
|
||||
#define TD_VTYPE_OPTR 3 // OPERATOR: 4 - 1, utilize to get remainder
|
||||
#define TD_BITMAP_BYTES(cnt) (((cnt) + TD_VTYPE_OPTR) >> 2)
|
||||
|
||||
#define TD_VTYPE_PARTS_I 8 // PARTITIONS: 1 byte / 1 bit
|
||||
#define TD_VTYPE_OPTR_I 7 // OPERATOR: 8 - 1, utilize to get remainder
|
||||
#define TD_BITMAP_BYTES_I(cnt) (((cnt) + TD_VTYPE_OPTR_I) >> 3)
|
||||
|
||||
/**
|
||||
* @brief value type
|
||||
* - for data from client input and STSRow in memory, 3 types of value none/null/norm available
|
||||
|
@ -244,7 +252,7 @@ int32_t tdGetBitmapValTypeI(const void *pBitmap, int16_t colIdx, TDRowValT *pVal
|
|||
*/
|
||||
static FORCE_INLINE void *tdGetBitmapAddrTp(STSRow *pRow, uint32_t flen) {
|
||||
// The primary TS key is stored separatedly.
|
||||
return POINTER_SHIFT(TD_ROW_DATA(pRow), flen - sizeof(TSKEY));
|
||||
return POINTER_SHIFT(TD_ROW_DATA(pRow), flen);
|
||||
// return POINTER_SHIFT(pRow->ts, flen);
|
||||
}
|
||||
|
||||
|
|
|
@ -58,282 +58,285 @@
|
|||
#define TK_TO 40
|
||||
#define TK_REVOKE 41
|
||||
#define TK_FROM 42
|
||||
#define TK_NK_COMMA 43
|
||||
#define TK_READ 44
|
||||
#define TK_WRITE 45
|
||||
#define TK_NK_DOT 46
|
||||
#define TK_DNODE 47
|
||||
#define TK_PORT 48
|
||||
#define TK_DNODES 49
|
||||
#define TK_NK_IPTOKEN 50
|
||||
#define TK_FORCE 51
|
||||
#define TK_LOCAL 52
|
||||
#define TK_QNODE 53
|
||||
#define TK_BNODE 54
|
||||
#define TK_SNODE 55
|
||||
#define TK_MNODE 56
|
||||
#define TK_DATABASE 57
|
||||
#define TK_USE 58
|
||||
#define TK_FLUSH 59
|
||||
#define TK_TRIM 60
|
||||
#define TK_IF 61
|
||||
#define TK_NOT 62
|
||||
#define TK_EXISTS 63
|
||||
#define TK_BUFFER 64
|
||||
#define TK_CACHEMODEL 65
|
||||
#define TK_CACHESIZE 66
|
||||
#define TK_COMP 67
|
||||
#define TK_DURATION 68
|
||||
#define TK_NK_VARIABLE 69
|
||||
#define TK_MAXROWS 70
|
||||
#define TK_MINROWS 71
|
||||
#define TK_KEEP 72
|
||||
#define TK_PAGES 73
|
||||
#define TK_PAGESIZE 74
|
||||
#define TK_TSDB_PAGESIZE 75
|
||||
#define TK_PRECISION 76
|
||||
#define TK_REPLICA 77
|
||||
#define TK_STRICT 78
|
||||
#define TK_VGROUPS 79
|
||||
#define TK_SINGLE_STABLE 80
|
||||
#define TK_RETENTIONS 81
|
||||
#define TK_SCHEMALESS 82
|
||||
#define TK_WAL_LEVEL 83
|
||||
#define TK_WAL_FSYNC_PERIOD 84
|
||||
#define TK_WAL_RETENTION_PERIOD 85
|
||||
#define TK_WAL_RETENTION_SIZE 86
|
||||
#define TK_WAL_ROLL_PERIOD 87
|
||||
#define TK_WAL_SEGMENT_SIZE 88
|
||||
#define TK_STT_TRIGGER 89
|
||||
#define TK_TABLE_PREFIX 90
|
||||
#define TK_TABLE_SUFFIX 91
|
||||
#define TK_NK_COLON 92
|
||||
#define TK_MAX_SPEED 93
|
||||
#define TK_TABLE 94
|
||||
#define TK_NK_LP 95
|
||||
#define TK_NK_RP 96
|
||||
#define TK_STABLE 97
|
||||
#define TK_ADD 98
|
||||
#define TK_COLUMN 99
|
||||
#define TK_MODIFY 100
|
||||
#define TK_RENAME 101
|
||||
#define TK_TAG 102
|
||||
#define TK_SET 103
|
||||
#define TK_NK_EQ 104
|
||||
#define TK_USING 105
|
||||
#define TK_TAGS 106
|
||||
#define TK_COMMENT 107
|
||||
#define TK_BOOL 108
|
||||
#define TK_TINYINT 109
|
||||
#define TK_SMALLINT 110
|
||||
#define TK_INT 111
|
||||
#define TK_INTEGER 112
|
||||
#define TK_BIGINT 113
|
||||
#define TK_FLOAT 114
|
||||
#define TK_DOUBLE 115
|
||||
#define TK_BINARY 116
|
||||
#define TK_TIMESTAMP 117
|
||||
#define TK_NCHAR 118
|
||||
#define TK_UNSIGNED 119
|
||||
#define TK_JSON 120
|
||||
#define TK_VARCHAR 121
|
||||
#define TK_MEDIUMBLOB 122
|
||||
#define TK_BLOB 123
|
||||
#define TK_VARBINARY 124
|
||||
#define TK_DECIMAL 125
|
||||
#define TK_MAX_DELAY 126
|
||||
#define TK_WATERMARK 127
|
||||
#define TK_ROLLUP 128
|
||||
#define TK_TTL 129
|
||||
#define TK_SMA 130
|
||||
#define TK_FIRST 131
|
||||
#define TK_LAST 132
|
||||
#define TK_SHOW 133
|
||||
#define TK_DATABASES 134
|
||||
#define TK_TABLES 135
|
||||
#define TK_STABLES 136
|
||||
#define TK_MNODES 137
|
||||
#define TK_QNODES 138
|
||||
#define TK_FUNCTIONS 139
|
||||
#define TK_INDEXES 140
|
||||
#define TK_ACCOUNTS 141
|
||||
#define TK_APPS 142
|
||||
#define TK_CONNECTIONS 143
|
||||
#define TK_LICENCES 144
|
||||
#define TK_GRANTS 145
|
||||
#define TK_QUERIES 146
|
||||
#define TK_SCORES 147
|
||||
#define TK_TOPICS 148
|
||||
#define TK_VARIABLES 149
|
||||
#define TK_CLUSTER 150
|
||||
#define TK_BNODES 151
|
||||
#define TK_SNODES 152
|
||||
#define TK_TRANSACTIONS 153
|
||||
#define TK_DISTRIBUTED 154
|
||||
#define TK_CONSUMERS 155
|
||||
#define TK_SUBSCRIPTIONS 156
|
||||
#define TK_VNODES 157
|
||||
#define TK_LIKE 158
|
||||
#define TK_TBNAME 159
|
||||
#define TK_QTAGS 160
|
||||
#define TK_AS 161
|
||||
#define TK_INDEX 162
|
||||
#define TK_FUNCTION 163
|
||||
#define TK_INTERVAL 164
|
||||
#define TK_TOPIC 165
|
||||
#define TK_WITH 166
|
||||
#define TK_META 167
|
||||
#define TK_CONSUMER 168
|
||||
#define TK_GROUP 169
|
||||
#define TK_DESC 170
|
||||
#define TK_DESCRIBE 171
|
||||
#define TK_RESET 172
|
||||
#define TK_QUERY 173
|
||||
#define TK_CACHE 174
|
||||
#define TK_EXPLAIN 175
|
||||
#define TK_ANALYZE 176
|
||||
#define TK_VERBOSE 177
|
||||
#define TK_NK_BOOL 178
|
||||
#define TK_RATIO 179
|
||||
#define TK_NK_FLOAT 180
|
||||
#define TK_OUTPUTTYPE 181
|
||||
#define TK_AGGREGATE 182
|
||||
#define TK_BUFSIZE 183
|
||||
#define TK_STREAM 184
|
||||
#define TK_INTO 185
|
||||
#define TK_TRIGGER 186
|
||||
#define TK_AT_ONCE 187
|
||||
#define TK_WINDOW_CLOSE 188
|
||||
#define TK_IGNORE 189
|
||||
#define TK_EXPIRED 190
|
||||
#define TK_FILL_HISTORY 191
|
||||
#define TK_SUBTABLE 192
|
||||
#define TK_KILL 193
|
||||
#define TK_CONNECTION 194
|
||||
#define TK_TRANSACTION 195
|
||||
#define TK_BALANCE 196
|
||||
#define TK_VGROUP 197
|
||||
#define TK_MERGE 198
|
||||
#define TK_REDISTRIBUTE 199
|
||||
#define TK_SPLIT 200
|
||||
#define TK_DELETE 201
|
||||
#define TK_INSERT 202
|
||||
#define TK_NULL 203
|
||||
#define TK_NK_QUESTION 204
|
||||
#define TK_NK_ARROW 205
|
||||
#define TK_ROWTS 206
|
||||
#define TK_QSTART 207
|
||||
#define TK_QEND 208
|
||||
#define TK_QDURATION 209
|
||||
#define TK_WSTART 210
|
||||
#define TK_WEND 211
|
||||
#define TK_WDURATION 212
|
||||
#define TK_IROWTS 213
|
||||
#define TK_CAST 214
|
||||
#define TK_NOW 215
|
||||
#define TK_TODAY 216
|
||||
#define TK_TIMEZONE 217
|
||||
#define TK_CLIENT_VERSION 218
|
||||
#define TK_SERVER_VERSION 219
|
||||
#define TK_SERVER_STATUS 220
|
||||
#define TK_CURRENT_USER 221
|
||||
#define TK_COUNT 222
|
||||
#define TK_LAST_ROW 223
|
||||
#define TK_CASE 224
|
||||
#define TK_END 225
|
||||
#define TK_WHEN 226
|
||||
#define TK_THEN 227
|
||||
#define TK_ELSE 228
|
||||
#define TK_BETWEEN 229
|
||||
#define TK_IS 230
|
||||
#define TK_NK_LT 231
|
||||
#define TK_NK_GT 232
|
||||
#define TK_NK_LE 233
|
||||
#define TK_NK_GE 234
|
||||
#define TK_NK_NE 235
|
||||
#define TK_MATCH 236
|
||||
#define TK_NMATCH 237
|
||||
#define TK_CONTAINS 238
|
||||
#define TK_IN 239
|
||||
#define TK_JOIN 240
|
||||
#define TK_INNER 241
|
||||
#define TK_SELECT 242
|
||||
#define TK_DISTINCT 243
|
||||
#define TK_WHERE 244
|
||||
#define TK_PARTITION 245
|
||||
#define TK_BY 246
|
||||
#define TK_SESSION 247
|
||||
#define TK_STATE_WINDOW 248
|
||||
#define TK_SLIDING 249
|
||||
#define TK_FILL 250
|
||||
#define TK_VALUE 251
|
||||
#define TK_NONE 252
|
||||
#define TK_PREV 253
|
||||
#define TK_LINEAR 254
|
||||
#define TK_NEXT 255
|
||||
#define TK_HAVING 256
|
||||
#define TK_RANGE 257
|
||||
#define TK_EVERY 258
|
||||
#define TK_ORDER 259
|
||||
#define TK_SLIMIT 260
|
||||
#define TK_SOFFSET 261
|
||||
#define TK_LIMIT 262
|
||||
#define TK_OFFSET 263
|
||||
#define TK_ASC 264
|
||||
#define TK_NULLS 265
|
||||
#define TK_ABORT 266
|
||||
#define TK_AFTER 267
|
||||
#define TK_ATTACH 268
|
||||
#define TK_BEFORE 269
|
||||
#define TK_BEGIN 270
|
||||
#define TK_BITAND 271
|
||||
#define TK_BITNOT 272
|
||||
#define TK_BITOR 273
|
||||
#define TK_BLOCKS 274
|
||||
#define TK_CHANGE 275
|
||||
#define TK_COMMA 276
|
||||
#define TK_COMPACT 277
|
||||
#define TK_CONCAT 278
|
||||
#define TK_CONFLICT 279
|
||||
#define TK_COPY 280
|
||||
#define TK_DEFERRED 281
|
||||
#define TK_DELIMITERS 282
|
||||
#define TK_DETACH 283
|
||||
#define TK_DIVIDE 284
|
||||
#define TK_DOT 285
|
||||
#define TK_EACH 286
|
||||
#define TK_FAIL 287
|
||||
#define TK_FILE 288
|
||||
#define TK_FOR 289
|
||||
#define TK_GLOB 290
|
||||
#define TK_ID 291
|
||||
#define TK_IMMEDIATE 292
|
||||
#define TK_IMPORT 293
|
||||
#define TK_INITIALLY 294
|
||||
#define TK_INSTEAD 295
|
||||
#define TK_ISNULL 296
|
||||
#define TK_KEY 297
|
||||
#define TK_MODULES 298
|
||||
#define TK_NK_BITNOT 299
|
||||
#define TK_NK_SEMI 300
|
||||
#define TK_NOTNULL 301
|
||||
#define TK_OF 302
|
||||
#define TK_PLUS 303
|
||||
#define TK_PRIVILEGE 304
|
||||
#define TK_RAISE 305
|
||||
#define TK_REPLACE 306
|
||||
#define TK_RESTRICT 307
|
||||
#define TK_ROW 308
|
||||
#define TK_SEMI 309
|
||||
#define TK_STAR 310
|
||||
#define TK_STATEMENT 311
|
||||
#define TK_STRING 312
|
||||
#define TK_TIMES 313
|
||||
#define TK_UPDATE 314
|
||||
#define TK_VALUES 315
|
||||
#define TK_VARIABLE 316
|
||||
#define TK_VIEW 317
|
||||
#define TK_WAL 318
|
||||
#define TK_SUBSCRIBE 43
|
||||
#define TK_NK_COMMA 44
|
||||
#define TK_READ 45
|
||||
#define TK_WRITE 46
|
||||
#define TK_NK_DOT 47
|
||||
#define TK_DNODE 48
|
||||
#define TK_PORT 49
|
||||
#define TK_DNODES 50
|
||||
#define TK_NK_IPTOKEN 51
|
||||
#define TK_FORCE 52
|
||||
#define TK_LOCAL 53
|
||||
#define TK_QNODE 54
|
||||
#define TK_BNODE 55
|
||||
#define TK_SNODE 56
|
||||
#define TK_MNODE 57
|
||||
#define TK_DATABASE 58
|
||||
#define TK_USE 59
|
||||
#define TK_FLUSH 60
|
||||
#define TK_TRIM 61
|
||||
#define TK_IF 62
|
||||
#define TK_NOT 63
|
||||
#define TK_EXISTS 64
|
||||
#define TK_BUFFER 65
|
||||
#define TK_CACHEMODEL 66
|
||||
#define TK_CACHESIZE 67
|
||||
#define TK_COMP 68
|
||||
#define TK_DURATION 69
|
||||
#define TK_NK_VARIABLE 70
|
||||
#define TK_MAXROWS 71
|
||||
#define TK_MINROWS 72
|
||||
#define TK_KEEP 73
|
||||
#define TK_PAGES 74
|
||||
#define TK_PAGESIZE 75
|
||||
#define TK_TSDB_PAGESIZE 76
|
||||
#define TK_PRECISION 77
|
||||
#define TK_REPLICA 78
|
||||
#define TK_STRICT 79
|
||||
#define TK_VGROUPS 80
|
||||
#define TK_SINGLE_STABLE 81
|
||||
#define TK_RETENTIONS 82
|
||||
#define TK_SCHEMALESS 83
|
||||
#define TK_WAL_LEVEL 84
|
||||
#define TK_WAL_FSYNC_PERIOD 85
|
||||
#define TK_WAL_RETENTION_PERIOD 86
|
||||
#define TK_WAL_RETENTION_SIZE 87
|
||||
#define TK_WAL_ROLL_PERIOD 88
|
||||
#define TK_WAL_SEGMENT_SIZE 89
|
||||
#define TK_STT_TRIGGER 90
|
||||
#define TK_TABLE_PREFIX 91
|
||||
#define TK_TABLE_SUFFIX 92
|
||||
#define TK_NK_COLON 93
|
||||
#define TK_MAX_SPEED 94
|
||||
#define TK_TABLE 95
|
||||
#define TK_NK_LP 96
|
||||
#define TK_NK_RP 97
|
||||
#define TK_STABLE 98
|
||||
#define TK_ADD 99
|
||||
#define TK_COLUMN 100
|
||||
#define TK_MODIFY 101
|
||||
#define TK_RENAME 102
|
||||
#define TK_TAG 103
|
||||
#define TK_SET 104
|
||||
#define TK_NK_EQ 105
|
||||
#define TK_USING 106
|
||||
#define TK_TAGS 107
|
||||
#define TK_COMMENT 108
|
||||
#define TK_BOOL 109
|
||||
#define TK_TINYINT 110
|
||||
#define TK_SMALLINT 111
|
||||
#define TK_INT 112
|
||||
#define TK_INTEGER 113
|
||||
#define TK_BIGINT 114
|
||||
#define TK_FLOAT 115
|
||||
#define TK_DOUBLE 116
|
||||
#define TK_BINARY 117
|
||||
#define TK_TIMESTAMP 118
|
||||
#define TK_NCHAR 119
|
||||
#define TK_UNSIGNED 120
|
||||
#define TK_JSON 121
|
||||
#define TK_VARCHAR 122
|
||||
#define TK_MEDIUMBLOB 123
|
||||
#define TK_BLOB 124
|
||||
#define TK_VARBINARY 125
|
||||
#define TK_DECIMAL 126
|
||||
#define TK_MAX_DELAY 127
|
||||
#define TK_WATERMARK 128
|
||||
#define TK_ROLLUP 129
|
||||
#define TK_TTL 130
|
||||
#define TK_SMA 131
|
||||
#define TK_DELETE_MARK 132
|
||||
#define TK_FIRST 133
|
||||
#define TK_LAST 134
|
||||
#define TK_SHOW 135
|
||||
#define TK_PRIVILEGES 136
|
||||
#define TK_DATABASES 137
|
||||
#define TK_TABLES 138
|
||||
#define TK_STABLES 139
|
||||
#define TK_MNODES 140
|
||||
#define TK_QNODES 141
|
||||
#define TK_FUNCTIONS 142
|
||||
#define TK_INDEXES 143
|
||||
#define TK_ACCOUNTS 144
|
||||
#define TK_APPS 145
|
||||
#define TK_CONNECTIONS 146
|
||||
#define TK_LICENCES 147
|
||||
#define TK_GRANTS 148
|
||||
#define TK_QUERIES 149
|
||||
#define TK_SCORES 150
|
||||
#define TK_TOPICS 151
|
||||
#define TK_VARIABLES 152
|
||||
#define TK_CLUSTER 153
|
||||
#define TK_BNODES 154
|
||||
#define TK_SNODES 155
|
||||
#define TK_TRANSACTIONS 156
|
||||
#define TK_DISTRIBUTED 157
|
||||
#define TK_CONSUMERS 158
|
||||
#define TK_SUBSCRIPTIONS 159
|
||||
#define TK_VNODES 160
|
||||
#define TK_LIKE 161
|
||||
#define TK_TBNAME 162
|
||||
#define TK_QTAGS 163
|
||||
#define TK_AS 164
|
||||
#define TK_INDEX 165
|
||||
#define TK_FUNCTION 166
|
||||
#define TK_INTERVAL 167
|
||||
#define TK_TOPIC 168
|
||||
#define TK_WITH 169
|
||||
#define TK_META 170
|
||||
#define TK_CONSUMER 171
|
||||
#define TK_GROUP 172
|
||||
#define TK_DESC 173
|
||||
#define TK_DESCRIBE 174
|
||||
#define TK_RESET 175
|
||||
#define TK_QUERY 176
|
||||
#define TK_CACHE 177
|
||||
#define TK_EXPLAIN 178
|
||||
#define TK_ANALYZE 179
|
||||
#define TK_VERBOSE 180
|
||||
#define TK_NK_BOOL 181
|
||||
#define TK_RATIO 182
|
||||
#define TK_NK_FLOAT 183
|
||||
#define TK_OUTPUTTYPE 184
|
||||
#define TK_AGGREGATE 185
|
||||
#define TK_BUFSIZE 186
|
||||
#define TK_STREAM 187
|
||||
#define TK_INTO 188
|
||||
#define TK_TRIGGER 189
|
||||
#define TK_AT_ONCE 190
|
||||
#define TK_WINDOW_CLOSE 191
|
||||
#define TK_IGNORE 192
|
||||
#define TK_EXPIRED 193
|
||||
#define TK_FILL_HISTORY 194
|
||||
#define TK_SUBTABLE 195
|
||||
#define TK_KILL 196
|
||||
#define TK_CONNECTION 197
|
||||
#define TK_TRANSACTION 198
|
||||
#define TK_BALANCE 199
|
||||
#define TK_VGROUP 200
|
||||
#define TK_MERGE 201
|
||||
#define TK_REDISTRIBUTE 202
|
||||
#define TK_SPLIT 203
|
||||
#define TK_DELETE 204
|
||||
#define TK_INSERT 205
|
||||
#define TK_NULL 206
|
||||
#define TK_NK_QUESTION 207
|
||||
#define TK_NK_ARROW 208
|
||||
#define TK_ROWTS 209
|
||||
#define TK_QSTART 210
|
||||
#define TK_QEND 211
|
||||
#define TK_QDURATION 212
|
||||
#define TK_WSTART 213
|
||||
#define TK_WEND 214
|
||||
#define TK_WDURATION 215
|
||||
#define TK_IROWTS 216
|
||||
#define TK_CAST 217
|
||||
#define TK_NOW 218
|
||||
#define TK_TODAY 219
|
||||
#define TK_TIMEZONE 220
|
||||
#define TK_CLIENT_VERSION 221
|
||||
#define TK_SERVER_VERSION 222
|
||||
#define TK_SERVER_STATUS 223
|
||||
#define TK_CURRENT_USER 224
|
||||
#define TK_COUNT 225
|
||||
#define TK_LAST_ROW 226
|
||||
#define TK_CASE 227
|
||||
#define TK_END 228
|
||||
#define TK_WHEN 229
|
||||
#define TK_THEN 230
|
||||
#define TK_ELSE 231
|
||||
#define TK_BETWEEN 232
|
||||
#define TK_IS 233
|
||||
#define TK_NK_LT 234
|
||||
#define TK_NK_GT 235
|
||||
#define TK_NK_LE 236
|
||||
#define TK_NK_GE 237
|
||||
#define TK_NK_NE 238
|
||||
#define TK_MATCH 239
|
||||
#define TK_NMATCH 240
|
||||
#define TK_CONTAINS 241
|
||||
#define TK_IN 242
|
||||
#define TK_JOIN 243
|
||||
#define TK_INNER 244
|
||||
#define TK_SELECT 245
|
||||
#define TK_DISTINCT 246
|
||||
#define TK_WHERE 247
|
||||
#define TK_PARTITION 248
|
||||
#define TK_BY 249
|
||||
#define TK_SESSION 250
|
||||
#define TK_STATE_WINDOW 251
|
||||
#define TK_SLIDING 252
|
||||
#define TK_FILL 253
|
||||
#define TK_VALUE 254
|
||||
#define TK_NONE 255
|
||||
#define TK_PREV 256
|
||||
#define TK_LINEAR 257
|
||||
#define TK_NEXT 258
|
||||
#define TK_HAVING 259
|
||||
#define TK_RANGE 260
|
||||
#define TK_EVERY 261
|
||||
#define TK_ORDER 262
|
||||
#define TK_SLIMIT 263
|
||||
#define TK_SOFFSET 264
|
||||
#define TK_LIMIT 265
|
||||
#define TK_OFFSET 266
|
||||
#define TK_ASC 267
|
||||
#define TK_NULLS 268
|
||||
#define TK_ABORT 269
|
||||
#define TK_AFTER 270
|
||||
#define TK_ATTACH 271
|
||||
#define TK_BEFORE 272
|
||||
#define TK_BEGIN 273
|
||||
#define TK_BITAND 274
|
||||
#define TK_BITNOT 275
|
||||
#define TK_BITOR 276
|
||||
#define TK_BLOCKS 277
|
||||
#define TK_CHANGE 278
|
||||
#define TK_COMMA 279
|
||||
#define TK_COMPACT 280
|
||||
#define TK_CONCAT 281
|
||||
#define TK_CONFLICT 282
|
||||
#define TK_COPY 283
|
||||
#define TK_DEFERRED 284
|
||||
#define TK_DELIMITERS 285
|
||||
#define TK_DETACH 286
|
||||
#define TK_DIVIDE 287
|
||||
#define TK_DOT 288
|
||||
#define TK_EACH 289
|
||||
#define TK_FAIL 290
|
||||
#define TK_FILE 291
|
||||
#define TK_FOR 292
|
||||
#define TK_GLOB 293
|
||||
#define TK_ID 294
|
||||
#define TK_IMMEDIATE 295
|
||||
#define TK_IMPORT 296
|
||||
#define TK_INITIALLY 297
|
||||
#define TK_INSTEAD 298
|
||||
#define TK_ISNULL 299
|
||||
#define TK_KEY 300
|
||||
#define TK_MODULES 301
|
||||
#define TK_NK_BITNOT 302
|
||||
#define TK_NK_SEMI 303
|
||||
#define TK_NOTNULL 304
|
||||
#define TK_OF 305
|
||||
#define TK_PLUS 306
|
||||
#define TK_PRIVILEGE 307
|
||||
#define TK_RAISE 308
|
||||
#define TK_REPLACE 309
|
||||
#define TK_RESTRICT 310
|
||||
#define TK_ROW 311
|
||||
#define TK_SEMI 312
|
||||
#define TK_STAR 313
|
||||
#define TK_STATEMENT 314
|
||||
#define TK_STRING 315
|
||||
#define TK_TIMES 316
|
||||
#define TK_UPDATE 317
|
||||
#define TK_VALUES 318
|
||||
#define TK_VARIABLE 319
|
||||
#define TK_VIEW 320
|
||||
#define TK_WAL 321
|
||||
|
||||
#define TK_NK_SPACE 600
|
||||
#define TK_NK_COMMENT 601
|
||||
|
|
|
@ -278,11 +278,9 @@ typedef struct {
|
|||
#define IS_VALID_TINYINT(_t) ((_t) >= INT8_MIN && (_t) <= INT8_MAX)
|
||||
#define IS_VALID_SMALLINT(_t) ((_t) >= INT16_MIN && (_t) <= INT16_MAX)
|
||||
#define IS_VALID_INT(_t) ((_t) >= INT32_MIN && (_t) <= INT32_MAX)
|
||||
#define IS_VALID_BIGINT(_t) ((_t) >= INT64_MIN && (_t) <= INT64_MAX)
|
||||
#define IS_VALID_UTINYINT(_t) ((_t) >= 0 && (_t) <= UINT8_MAX)
|
||||
#define IS_VALID_USMALLINT(_t) ((_t) >= 0 && (_t) <= UINT16_MAX)
|
||||
#define IS_VALID_UINT(_t) ((_t) >= 0 && (_t) <= UINT32_MAX)
|
||||
#define IS_VALID_UBIGINT(_t) ((_t) >= 0 && (_t) <= UINT64_MAX)
|
||||
#define IS_VALID_FLOAT(_t) ((_t) >= -FLT_MAX && (_t) <= FLT_MAX)
|
||||
#define IS_VALID_DOUBLE(_t) ((_t) >= -DBL_MAX && (_t) <= DBL_MAX)
|
||||
|
||||
|
|
|
@ -211,6 +211,8 @@ int32_t catalogGetCachedSTableMeta(SCatalog* pCtg, const SName* pTableName, STab
|
|||
|
||||
int32_t catalogGetCachedTableHashVgroup(SCatalog* pCtg, const SName* pTableName, SVgroupInfo* pVgroup, bool* exists);
|
||||
|
||||
int32_t catalogGetCachedTableVgMeta(SCatalog* pCtg, const SName* pTableName, SVgroupInfo* pVgroup, STableMeta** pTableMeta);
|
||||
|
||||
/**
|
||||
* Force refresh DB's local cached vgroup info.
|
||||
* @param pCtg (input, got with catalogGetHandle)
|
||||
|
|
|
@ -68,7 +68,7 @@ typedef struct SInputData {
|
|||
|
||||
typedef struct SOutputData {
|
||||
int32_t numOfBlocks;
|
||||
int32_t numOfRows;
|
||||
int64_t numOfRows; // int32_t changed to int64_t
|
||||
int32_t numOfCols;
|
||||
int8_t compressed;
|
||||
char* pData;
|
||||
|
|
|
@ -142,14 +142,17 @@ int32_t qGetQueryTableSchemaVersion(qTaskInfo_t tinfo, char* dbName, char* table
|
|||
*/
|
||||
|
||||
int32_t qExecTaskOpt(qTaskInfo_t tinfo, SArray* pResList, uint64_t* useconds, bool* hasMore, SLocalFetch* pLocal);
|
||||
|
||||
int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pBlock, uint64_t* useconds);
|
||||
|
||||
void qCleanExecTaskBlockBuf(qTaskInfo_t tinfo);
|
||||
|
||||
/**
|
||||
* kill the ongoing query asynchronously
|
||||
* @param tinfo qhandle
|
||||
* @return
|
||||
*/
|
||||
int32_t qAsyncKillTask(qTaskInfo_t tinfo);
|
||||
int32_t qAsyncKillTask(qTaskInfo_t tinfo, int32_t rspCode);
|
||||
|
||||
/**
|
||||
* destroy query info structure
|
||||
|
@ -157,13 +160,6 @@ int32_t qAsyncKillTask(qTaskInfo_t tinfo);
|
|||
*/
|
||||
void qDestroyTask(qTaskInfo_t tinfo);
|
||||
|
||||
/**
|
||||
* Get the queried table uid
|
||||
* @param qHandle
|
||||
* @return
|
||||
*/
|
||||
int64_t qGetQueriedTableUid(qTaskInfo_t tinfo);
|
||||
|
||||
/**
|
||||
* Extract the qualified table id list, and than pass them to the TSDB driver to load the required table data blocks.
|
||||
*
|
||||
|
|
|
@ -57,7 +57,7 @@ typedef struct SFuncExecFuncs {
|
|||
#define MAX_INTERVAL_TIME_WINDOW 10000000 // maximum allowed time windows in final results
|
||||
|
||||
#define TOP_BOTTOM_QUERY_LIMIT 100
|
||||
#define FUNCTIONS_NAME_MAX_LENGTH 16
|
||||
#define FUNCTIONS_NAME_MAX_LENGTH 32
|
||||
|
||||
typedef struct SResultRowEntryInfo {
|
||||
bool initialized : 1; // output buffer has been initialized
|
||||
|
@ -115,7 +115,7 @@ typedef struct SInputColumnInfoData {
|
|||
int32_t startRowIndex; // handle started row index
|
||||
int32_t numOfRows; // the number of rows needs to be handled
|
||||
int32_t numOfInputCols; // PTS is not included
|
||||
bool colDataAggIsSet; // if agg is set or not
|
||||
bool colDataSMAIsSet; // if agg is set or not
|
||||
SColumnInfoData *pPTS; // primary timestamp column
|
||||
SColumnInfoData **pData;
|
||||
SColumnDataAgg **pColumnDataAgg;
|
||||
|
@ -137,22 +137,22 @@ typedef struct SqlFunctionCtx {
|
|||
int16_t functionId; // function id
|
||||
char *pOutput; // final result output buffer, point to sdata->data
|
||||
int32_t numOfParams;
|
||||
SFunctParam *param; // input parameter, e.g., top(k, 20), the number of results for top query is kept in param
|
||||
SColumnInfoData *pTsOutput; // corresponding output buffer for timestamp of each result, e.g., top/bottom*/
|
||||
int32_t offset;
|
||||
struct SResultRowEntryInfo *resultInfo;
|
||||
SSubsidiaryResInfo subsidiaries;
|
||||
SPoint1 start;
|
||||
SPoint1 end;
|
||||
SFuncExecFuncs fpSet;
|
||||
SScalarFuncExecFuncs sfp;
|
||||
struct SExprInfo *pExpr;
|
||||
struct SSDataBlock *pSrcBlock;
|
||||
struct SSDataBlock *pDstBlock; // used by indefinite rows function to set selectivity
|
||||
SSerializeDataHandle saveHandle;
|
||||
bool isStream;
|
||||
|
||||
char udfName[TSDB_FUNC_NAME_LEN];
|
||||
// input parameter, e.g., top(k, 20), the number of results of top query is kept in param
|
||||
SFunctParam *param;
|
||||
// corresponding output buffer for timestamp of each result, e.g., diff/csum
|
||||
SColumnInfoData *pTsOutput;
|
||||
int32_t offset;
|
||||
SResultRowEntryInfo *resultInfo;
|
||||
SSubsidiaryResInfo subsidiaries;
|
||||
SPoint1 start;
|
||||
SPoint1 end;
|
||||
SFuncExecFuncs fpSet;
|
||||
SScalarFuncExecFuncs sfp;
|
||||
struct SExprInfo *pExpr;
|
||||
struct SSDataBlock *pSrcBlock;
|
||||
struct SSDataBlock *pDstBlock; // used by indefinite rows function to set selectivity
|
||||
SSerializeDataHandle saveHandle;
|
||||
char udfName[TSDB_FUNC_NAME_LEN];
|
||||
} SqlFunctionCtx;
|
||||
|
||||
typedef struct tExprNode {
|
||||
|
@ -163,6 +163,7 @@ typedef struct tExprNode {
|
|||
int32_t functionId;
|
||||
int32_t num;
|
||||
struct SFunctionNode *pFunctNode;
|
||||
int32_t functionType;
|
||||
} _function;
|
||||
|
||||
struct {
|
||||
|
@ -182,7 +183,6 @@ struct SScalarParam {
|
|||
};
|
||||
|
||||
void cleanupResultRowEntry(struct SResultRowEntryInfo *pCell);
|
||||
//int32_t getNumOfResult(SqlFunctionCtx *pCtx, int32_t num, SSDataBlock *pResBlock);
|
||||
bool isRowEntryCompleted(struct SResultRowEntryInfo *pEntry);
|
||||
bool isRowEntryInitialized(struct SResultRowEntryInfo *pEntry);
|
||||
|
||||
|
@ -194,32 +194,6 @@ typedef struct SPoint {
|
|||
int32_t taosGetLinearInterpolationVal(SPoint *point, int32_t outputType, SPoint *point1, SPoint *point2,
|
||||
int32_t inputType);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// udf api
|
||||
/**
|
||||
* create udfd proxy, called once in process that call doSetupUdf/callUdfxxx/doTeardownUdf
|
||||
* @return error code
|
||||
*/
|
||||
int32_t udfcOpen();
|
||||
|
||||
/**
|
||||
* destroy udfd proxy
|
||||
* @return error code
|
||||
*/
|
||||
int32_t udfcClose();
|
||||
|
||||
/**
|
||||
* start udfd that serves udf function invocation under dnode startDnodeId
|
||||
* @param startDnodeId
|
||||
* @return
|
||||
*/
|
||||
int32_t udfStartUdfd(int32_t startDnodeId);
|
||||
/**
|
||||
* stop udfd
|
||||
* @return
|
||||
*/
|
||||
int32_t udfStopUdfd();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -130,6 +130,7 @@ typedef enum EFunctionType {
|
|||
FUNCTION_TYPE_GROUP_KEY,
|
||||
FUNCTION_TYPE_CACHE_LAST_ROW,
|
||||
FUNCTION_TYPE_CACHE_LAST,
|
||||
FUNCTION_TYPE_TABLE_COUNT,
|
||||
|
||||
// distributed splitting functions
|
||||
FUNCTION_TYPE_APERCENTILE_PARTIAL = 4000,
|
||||
|
|
|
@ -228,7 +228,7 @@ static FORCE_INLINE int32_t udfColDataSet(SUdfColumn *pColumn, uint32_t currentR
|
|||
newSize = 8;
|
||||
}
|
||||
|
||||
while (newSize < data->varLenCol.payloadLen + dataLen) {
|
||||
while (newSize < (uint32_t)(data->varLenCol.payloadLen + dataLen)) {
|
||||
newSize = newSize * UDF_MEMORY_EXP_GROWTH;
|
||||
}
|
||||
|
||||
|
@ -248,7 +248,7 @@ static FORCE_INLINE int32_t udfColDataSet(SUdfColumn *pColumn, uint32_t currentR
|
|||
data->varLenCol.payloadLen += dataLen;
|
||||
}
|
||||
}
|
||||
data->numOfRows = (currentRow + 1 > data->numOfRows) ? (currentRow + 1) : data->numOfRows;
|
||||
data->numOfRows = ((int32_t)(currentRow + 1) > data->numOfRows) ? (int32_t)(currentRow + 1) : data->numOfRows;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -85,6 +85,32 @@ int32_t callUdfScalarFunc(char *udfName, SScalarParam *input, int32_t numOfCols,
|
|||
|
||||
int32_t cleanUpUdfs();
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// udf api
|
||||
/**
|
||||
* create udfd proxy, called once in process that call doSetupUdf/callUdfxxx/doTeardownUdf
|
||||
* @return error code
|
||||
*/
|
||||
int32_t udfcOpen();
|
||||
|
||||
/**
|
||||
* destroy udfd proxy
|
||||
* @return error code
|
||||
*/
|
||||
int32_t udfcClose();
|
||||
|
||||
/**
|
||||
* start udfd that serves udf function invocation under dnode startDnodeId
|
||||
* @param startDnodeId
|
||||
* @return
|
||||
*/
|
||||
int32_t udfStartUdfd(int32_t startDnodeId);
|
||||
/**
|
||||
* stop udfd
|
||||
* @return
|
||||
*/
|
||||
int32_t udfStopUdfd();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -42,9 +42,10 @@ extern "C" {
|
|||
|
||||
#define PRIVILEGE_TYPE_MASK(n) (1 << n)
|
||||
|
||||
#define PRIVILEGE_TYPE_ALL PRIVILEGE_TYPE_MASK(0)
|
||||
#define PRIVILEGE_TYPE_READ PRIVILEGE_TYPE_MASK(1)
|
||||
#define PRIVILEGE_TYPE_WRITE PRIVILEGE_TYPE_MASK(2)
|
||||
#define PRIVILEGE_TYPE_ALL PRIVILEGE_TYPE_MASK(0)
|
||||
#define PRIVILEGE_TYPE_READ PRIVILEGE_TYPE_MASK(1)
|
||||
#define PRIVILEGE_TYPE_WRITE PRIVILEGE_TYPE_MASK(2)
|
||||
#define PRIVILEGE_TYPE_SUBSCRIBE PRIVILEGE_TYPE_MASK(3)
|
||||
|
||||
#define PRIVILEGE_TYPE_TEST_MASK(val, mask) (((val) & (mask)) != 0)
|
||||
|
||||
|
@ -132,6 +133,9 @@ typedef struct STableOptions {
|
|||
SNodeList* pWatermark;
|
||||
int64_t watermark1;
|
||||
int64_t watermark2;
|
||||
SNodeList* pDeleteMark;
|
||||
int64_t deleteMark1;
|
||||
int64_t deleteMark2;
|
||||
SNodeList* pRollupFuncs;
|
||||
int32_t ttl;
|
||||
SNodeList* pSma;
|
||||
|
@ -382,6 +386,7 @@ typedef struct SStreamOptions {
|
|||
int8_t triggerType;
|
||||
SNode* pDelay;
|
||||
SNode* pWatermark;
|
||||
SNode* pDeleteMark;
|
||||
int8_t fillHistory;
|
||||
int8_t ignoreExpired;
|
||||
} SStreamOptions;
|
||||
|
@ -423,7 +428,7 @@ typedef struct SDropFunctionStmt {
|
|||
typedef struct SGrantStmt {
|
||||
ENodeType type;
|
||||
char userName[TSDB_USER_LEN];
|
||||
char dbName[TSDB_DB_NAME_LEN];
|
||||
char objName[TSDB_DB_NAME_LEN]; // db or topic
|
||||
int64_t privileges;
|
||||
} SGrantStmt;
|
||||
|
||||
|
|
|
@ -60,6 +60,12 @@ extern "C" {
|
|||
for (SListCell* cell = (NULL != (list) ? (list)->pHead : NULL); \
|
||||
(NULL != cell ? (node = &(cell->pNode), true) : (node = NULL, false)); cell = cell->pNext)
|
||||
|
||||
#define NODES_DESTORY_NODE(node) \
|
||||
do { \
|
||||
nodesDestroyNode((node)); \
|
||||
(node) = NULL; \
|
||||
} while (0)
|
||||
|
||||
#define NODES_DESTORY_LIST(list) \
|
||||
do { \
|
||||
nodesDestroyList((list)); \
|
||||
|
@ -187,6 +193,7 @@ typedef enum ENodeType {
|
|||
QUERY_NODE_SHOW_TRANSACTIONS_STMT,
|
||||
QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT,
|
||||
QUERY_NODE_SHOW_VNODES_STMT,
|
||||
QUERY_NODE_SHOW_USER_PRIVILEGES_STMT,
|
||||
QUERY_NODE_SHOW_CREATE_DATABASE_STMT,
|
||||
QUERY_NODE_SHOW_CREATE_TABLE_STMT,
|
||||
QUERY_NODE_SHOW_CREATE_STABLE_STMT,
|
||||
|
@ -257,7 +264,8 @@ typedef enum ENodeType {
|
|||
QUERY_NODE_PHYSICAL_PLAN_QUERY_INSERT,
|
||||
QUERY_NODE_PHYSICAL_PLAN_DELETE,
|
||||
QUERY_NODE_PHYSICAL_SUBPLAN,
|
||||
QUERY_NODE_PHYSICAL_PLAN
|
||||
QUERY_NODE_PHYSICAL_PLAN,
|
||||
QUERY_NODE_PHYSICAL_PLAN_TABLE_COUNT_SCAN
|
||||
} ENodeType;
|
||||
|
||||
/**
|
||||
|
|
|
@ -62,7 +62,8 @@ typedef enum EScanType {
|
|||
SCAN_TYPE_STREAM,
|
||||
SCAN_TYPE_TABLE_MERGE,
|
||||
SCAN_TYPE_BLOCK_INFO,
|
||||
SCAN_TYPE_LAST_ROW
|
||||
SCAN_TYPE_LAST_ROW,
|
||||
SCAN_TYPE_TABLE_COUNT
|
||||
} EScanType;
|
||||
|
||||
typedef struct SScanLogicNode {
|
||||
|
@ -90,6 +91,7 @@ typedef struct SScanLogicNode {
|
|||
SNode* pTagIndexCond;
|
||||
int8_t triggerType;
|
||||
int64_t watermark;
|
||||
int64_t deleteMark;
|
||||
int8_t igExpired;
|
||||
SArray* pSmaIndexes;
|
||||
SNodeList* pGroupTags;
|
||||
|
@ -171,6 +173,7 @@ typedef struct SExchangeLogicNode {
|
|||
SLogicNode node;
|
||||
int32_t srcStartGroupId;
|
||||
int32_t srcEndGroupId;
|
||||
bool seqRecvData;
|
||||
} SExchangeLogicNode;
|
||||
|
||||
typedef struct SMergeLogicNode {
|
||||
|
@ -211,6 +214,7 @@ typedef struct SWindowLogicNode {
|
|||
SNode* pStateExpr;
|
||||
int8_t triggerType;
|
||||
int64_t watermark;
|
||||
int64_t deleteMark;
|
||||
int8_t igExpired;
|
||||
EWindowAlgorithm windowAlgo;
|
||||
EOrder inputTsOrder;
|
||||
|
@ -322,6 +326,8 @@ typedef struct SLastRowScanPhysiNode {
|
|||
bool ignoreNull;
|
||||
} SLastRowScanPhysiNode;
|
||||
|
||||
typedef SLastRowScanPhysiNode STableCountScanPhysiNode;
|
||||
|
||||
typedef struct SSystemTableScanPhysiNode {
|
||||
SScanPhysiNode scan;
|
||||
SEpSet mgmtEpSet;
|
||||
|
@ -416,6 +422,7 @@ typedef struct SExchangePhysiNode {
|
|||
int32_t srcEndGroupId;
|
||||
bool singleChannel;
|
||||
SNodeList* pSrcEndPoints; // element is SDownstreamSource, scheduler fill by calling qSetSuplanExecutionNode
|
||||
bool seqRecvData;
|
||||
} SExchangePhysiNode;
|
||||
|
||||
typedef struct SMergePhysiNode {
|
||||
|
@ -435,6 +442,7 @@ typedef struct SWinodwPhysiNode {
|
|||
SNode* pTsEnd; // window end timestamp
|
||||
int8_t triggerType;
|
||||
int64_t watermark;
|
||||
int64_t deleteMark;
|
||||
int8_t igExpired;
|
||||
EOrder inputTsOrder;
|
||||
EOrder outputTsOrder;
|
||||
|
|
|
@ -106,7 +106,7 @@ typedef struct SValueNode {
|
|||
char* p;
|
||||
} datum;
|
||||
int64_t typeData;
|
||||
char unit;
|
||||
int8_t unit;
|
||||
} SValueNode;
|
||||
|
||||
typedef struct SLeftValueNode {
|
||||
|
|
|
@ -29,7 +29,7 @@ struct SMetaData;
|
|||
typedef struct SStmtCallback {
|
||||
TAOS_STMT* pStmt;
|
||||
int32_t (*getTbNameFn)(TAOS_STMT*, char**);
|
||||
int32_t (*setInfoFn)(TAOS_STMT*, STableMeta*, void*, char*, bool, SHashObj*, SHashObj*, const char*);
|
||||
int32_t (*setInfoFn)(TAOS_STMT*, STableMeta*, void*, SName*, bool, SHashObj*, SHashObj*, const char*);
|
||||
int32_t (*getExecInfoFn)(TAOS_STMT*, SHashObj**, SHashObj**);
|
||||
} SStmtCallback;
|
||||
|
||||
|
@ -108,7 +108,7 @@ int32_t qCreateSName(SName* pName, const char* pTableName, int32_t acctId, char*
|
|||
void* smlInitHandle(SQuery* pQuery);
|
||||
void smlDestroyHandle(void* pHandle);
|
||||
int32_t smlBindData(void* handle, SArray* tags, SArray* colsSchema, SArray* cols, bool format, STableMeta* pTableMeta,
|
||||
char* tableName, const char* sTableName, int32_t sTableNameLen, char* msgBuf, int16_t msgBufLen);
|
||||
char* tableName, const char* sTableName, int32_t sTableNameLen, int32_t ttl, char* msgBuf, int16_t msgBufLen);
|
||||
int32_t smlBuildOutput(void* handle, SHashObj* pVgHash);
|
||||
|
||||
int32_t rewriteToVnodeModifyOpStmt(SQuery* pQuery, SArray* pBufArray);
|
||||
|
|
|
@ -34,6 +34,7 @@ typedef struct SPlanContext {
|
|||
bool showRewrite;
|
||||
int8_t triggerType;
|
||||
int64_t watermark;
|
||||
int64_t deleteMark;
|
||||
int8_t igExpired;
|
||||
char* pMsg;
|
||||
int32_t msgLen;
|
||||
|
|
|
@ -129,6 +129,7 @@ typedef struct SDBVgInfo {
|
|||
int32_t numOfTable; // DB's table num, unit is TSDB_TABLE_NUM_UNIT
|
||||
int64_t stateTs;
|
||||
SHashObj* vgHash; // key:vgId, value:SVgroupInfo
|
||||
SArray* vgArray;
|
||||
} SDBVgInfo;
|
||||
|
||||
typedef struct SUseDbOutput {
|
||||
|
@ -238,6 +239,7 @@ int32_t dataConverToStr(char* str, int type, void* buf, int32_t bufSize, int32_t
|
|||
char* parseTagDatatoJson(void* p);
|
||||
int32_t cloneTableMeta(STableMeta* pSrc, STableMeta** pDst);
|
||||
int32_t cloneDbVgInfo(SDBVgInfo* pSrc, SDBVgInfo** pDst);
|
||||
void freeVgInfo(SDBVgInfo* vgInfo);
|
||||
|
||||
extern int32_t (*queryBuildMsg[TDMT_MAX])(void* input, char** msg, int32_t msgSize, int32_t* msgLen,
|
||||
void* (*mallocFp)(int64_t));
|
||||
|
@ -259,18 +261,24 @@ extern int32_t (*queryProcessMsgRsp[TDMT_MAX])(void* output, char* msg, int32_t
|
|||
#define NEED_CLIENT_HANDLE_ERROR(_code) \
|
||||
(NEED_CLIENT_RM_TBLMETA_ERROR(_code) || NEED_CLIENT_REFRESH_VG_ERROR(_code) || \
|
||||
NEED_CLIENT_REFRESH_TBLMETA_ERROR(_code))
|
||||
#define NEED_REDIRECT_ERROR(_code) \
|
||||
((_code) == TSDB_CODE_RPC_REDIRECT || (_code) == TSDB_CODE_RPC_NETWORK_UNAVAIL || \
|
||||
(_code) == TSDB_CODE_NODE_NOT_DEPLOYED || (_code) == TSDB_CODE_SYN_NOT_LEADER || \
|
||||
(_code) == TSDB_CODE_APP_NOT_READY || (_code) == TSDB_CODE_RPC_BROKEN_LINK)
|
||||
|
||||
#define SYNC_UNKNOWN_LEADER_REDIRECT_ERROR(_code) ((_code) == TSDB_CODE_SYN_NOT_LEADER || (_code) == TSDB_CODE_SYN_INTERNAL_ERROR || (_code) == TSDB_CODE_VND_STOPPED || (_code) == TSDB_CODE_APP_IS_STARTING || (_code) == TSDB_CODE_APP_IS_STOPPING)
|
||||
#define SYNC_SELF_LEADER_REDIRECT_ERROR(_code) ((_code) == TSDB_CODE_SYN_NOT_LEADER || (_code) == TSDB_CODE_SYN_RESTORING || (_code) == TSDB_CODE_SYN_INTERNAL_ERROR)
|
||||
#define SYNC_OTHER_LEADER_REDIRECT_ERROR(_code) ((_code) == TSDB_CODE_MNODE_NOT_FOUND)
|
||||
|
||||
#define NO_RET_REDIRECT_ERROR(_code) ((_code) == TSDB_CODE_RPC_BROKEN_LINK || (_code) == TSDB_CODE_RPC_NETWORK_UNAVAIL)
|
||||
|
||||
#define NEED_REDIRECT_ERROR(_code) \
|
||||
(NO_RET_REDIRECT_ERROR(_code) || SYNC_UNKNOWN_LEADER_REDIRECT_ERROR(_code) || \
|
||||
SYNC_SELF_LEADER_REDIRECT_ERROR(_code) || SYNC_OTHER_LEADER_REDIRECT_ERROR(_code))
|
||||
|
||||
|
||||
#define NEED_CLIENT_RM_TBLMETA_REQ(_type) \
|
||||
((_type) == TDMT_VND_CREATE_TABLE || (_type) == TDMT_MND_CREATE_STB || (_type) == TDMT_VND_DROP_TABLE || \
|
||||
(_type) == TDMT_MND_DROP_STB)
|
||||
|
||||
#define NEED_SCHEDULER_REDIRECT_ERROR(_code) \
|
||||
((_code) == TSDB_CODE_RPC_REDIRECT || (_code) == TSDB_CODE_NODE_NOT_DEPLOYED || \
|
||||
(_code) == TSDB_CODE_SYN_NOT_LEADER || (_code) == TSDB_CODE_APP_NOT_READY)
|
||||
#define NEED_SCHEDULER_REDIRECT_ERROR(_code) \
|
||||
(SYNC_UNKNOWN_LEADER_REDIRECT_ERROR(_code) || SYNC_SELF_LEADER_REDIRECT_ERROR(_code) || SYNC_OTHER_LEADER_REDIRECT_ERROR(_code))
|
||||
|
||||
#define REQUEST_TOTAL_EXEC_TIMES 2
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ typedef struct STdbState {
|
|||
TTB* pFillStateDb; // todo refactor
|
||||
TTB* pSessionStateDb;
|
||||
TTB* pParNameDb;
|
||||
TXN txn;
|
||||
TXN* txn;
|
||||
} STdbState;
|
||||
|
||||
// incremental state storage
|
||||
|
|
|
@ -140,15 +140,40 @@ typedef struct {
|
|||
int8_t type;
|
||||
} SStreamCheckpoint;
|
||||
|
||||
typedef struct {
|
||||
int8_t type;
|
||||
} SStreamTaskDestroy;
|
||||
|
||||
typedef struct {
|
||||
int8_t type;
|
||||
SSDataBlock* pBlock;
|
||||
} SStreamTrigger;
|
||||
|
||||
typedef struct SStreamQueueNode SStreamQueueNode;
|
||||
|
||||
struct SStreamQueueNode {
|
||||
SStreamQueueItem* item;
|
||||
SStreamQueueNode* next;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
SStreamQueueNode* head;
|
||||
int64_t size;
|
||||
} SStreamQueueRes;
|
||||
|
||||
void streamFreeQitem(SStreamQueueItem* data);
|
||||
|
||||
bool streamQueueResEmpty(const SStreamQueueRes* pRes);
|
||||
int64_t streamQueueResSize(const SStreamQueueRes* pRes);
|
||||
SStreamQueueNode* streamQueueResFront(SStreamQueueRes* pRes);
|
||||
SStreamQueueNode* streamQueueResPop(SStreamQueueRes* pRes);
|
||||
void streamQueueResClear(SStreamQueueRes* pRes);
|
||||
SStreamQueueRes streamQueueBuildRes(SStreamQueueNode* pNode);
|
||||
|
||||
typedef struct {
|
||||
SStreamQueueNode* pHead;
|
||||
} SStreamQueue1;
|
||||
|
||||
bool streamQueueHasTask(const SStreamQueue1* pQueue);
|
||||
int32_t streamQueuePush(SStreamQueue1* pQueue, SStreamQueueItem* pItem);
|
||||
SStreamQueueRes streamQueueGetRes(SStreamQueue1* pQueue);
|
||||
|
||||
typedef struct {
|
||||
STaosQueue* queue;
|
||||
STaosQall* qall;
|
||||
|
@ -250,31 +275,6 @@ typedef struct {
|
|||
SEpSet epSet;
|
||||
} SStreamChildEpInfo;
|
||||
|
||||
typedef struct {
|
||||
int32_t srcNodeId;
|
||||
int32_t srcChildId;
|
||||
int64_t stateSaveVer;
|
||||
int64_t stateProcessedVer;
|
||||
} SStreamCheckpointInfo;
|
||||
|
||||
typedef struct {
|
||||
int64_t streamId;
|
||||
int64_t checkTs;
|
||||
int32_t checkpointId; // incremental
|
||||
int32_t taskId;
|
||||
SArray* checkpointVer; // SArray<SStreamCheckpointInfo>
|
||||
} SStreamMultiVgCheckpointInfo;
|
||||
|
||||
typedef struct {
|
||||
int32_t taskId;
|
||||
int32_t checkpointId; // incremental
|
||||
} SStreamCheckpointKey;
|
||||
|
||||
typedef struct {
|
||||
int32_t taskId;
|
||||
SArray* checkpointVer;
|
||||
} SStreamRecoveringState;
|
||||
|
||||
typedef struct SStreamTask {
|
||||
int64_t streamId;
|
||||
int32_t taskId;
|
||||
|
@ -339,6 +339,10 @@ typedef struct SStreamTask {
|
|||
int64_t checkReqId;
|
||||
SArray* checkReqIds; // shuffle
|
||||
int32_t refCnt;
|
||||
|
||||
int64_t checkpointingId;
|
||||
int32_t checkpointAlignCnt;
|
||||
|
||||
} SStreamTask;
|
||||
|
||||
int32_t tEncodeStreamEpInfo(SEncoder* pEncoder, const SStreamChildEpInfo* pInfo);
|
||||
|
@ -484,6 +488,60 @@ typedef struct {
|
|||
int32_t tEncodeSStreamRecoverFinishReq(SEncoder* pEncoder, const SStreamRecoverFinishReq* pReq);
|
||||
int32_t tDecodeSStreamRecoverFinishReq(SDecoder* pDecoder, SStreamRecoverFinishReq* pReq);
|
||||
|
||||
typedef struct {
|
||||
int64_t streamId;
|
||||
int64_t checkpointId;
|
||||
int32_t taskId;
|
||||
int32_t nodeId;
|
||||
int64_t expireTime;
|
||||
} SStreamCheckpointSourceReq;
|
||||
|
||||
typedef struct {
|
||||
int64_t streamId;
|
||||
int64_t checkpointId;
|
||||
int32_t taskId;
|
||||
int32_t nodeId;
|
||||
int64_t expireTime;
|
||||
} SStreamCheckpointSourceRsp;
|
||||
|
||||
int32_t tEncodeSStreamCheckpointSourceReq(SEncoder* pEncoder, const SStreamCheckpointSourceReq* pReq);
|
||||
int32_t tDecodeSStreamCheckpointSourceReq(SDecoder* pDecoder, SStreamCheckpointSourceReq* pReq);
|
||||
|
||||
int32_t tEncodeSStreamCheckpointSourceRsp(SEncoder* pEncoder, const SStreamCheckpointSourceRsp* pRsp);
|
||||
int32_t tDecodeSStreamCheckpointSourceRsp(SDecoder* pDecoder, SStreamCheckpointSourceRsp* pRsp);
|
||||
|
||||
typedef struct {
|
||||
SMsgHead msgHead;
|
||||
int64_t streamId;
|
||||
int64_t checkpointId;
|
||||
int32_t downstreamTaskId;
|
||||
int32_t downstreamNodeId;
|
||||
int32_t upstreamTaskId;
|
||||
int32_t upstreamNodeId;
|
||||
int32_t childId;
|
||||
int64_t expireTime;
|
||||
int8_t taskLevel;
|
||||
} SStreamCheckpointReq;
|
||||
|
||||
typedef struct {
|
||||
SMsgHead msgHead;
|
||||
int64_t streamId;
|
||||
int64_t checkpointId;
|
||||
int32_t downstreamTaskId;
|
||||
int32_t downstreamNodeId;
|
||||
int32_t upstreamTaskId;
|
||||
int32_t upstreamNodeId;
|
||||
int32_t childId;
|
||||
int64_t expireTime;
|
||||
int8_t taskLevel;
|
||||
} SStreamCheckpointRsp;
|
||||
|
||||
int32_t tEncodeSStreamCheckpointReq(SEncoder* pEncoder, const SStreamCheckpointReq* pReq);
|
||||
int32_t tDecodeSStreamCheckpointReq(SDecoder* pDecoder, SStreamCheckpointReq* pReq);
|
||||
|
||||
int32_t tEncodeSStreamCheckpointRsp(SEncoder* pEncoder, const SStreamCheckpointRsp* pRsp);
|
||||
int32_t tDecodeSStreamCheckpointRsp(SDecoder* pDecoder, SStreamCheckpointRsp* pRsp);
|
||||
|
||||
typedef struct {
|
||||
int64_t streamId;
|
||||
int32_t downstreamTaskId;
|
||||
|
@ -562,7 +620,7 @@ typedef struct SStreamMeta {
|
|||
SHashObj* pTasks;
|
||||
SHashObj* pRecoverStatus;
|
||||
void* ahandle;
|
||||
TXN txn;
|
||||
TXN* txn;
|
||||
FTaskExpand* expandFunc;
|
||||
int32_t vgId;
|
||||
SRWLatch lock;
|
||||
|
@ -573,18 +631,22 @@ void streamMetaClose(SStreamMeta* streamMeta);
|
|||
|
||||
int32_t streamMetaAddTask(SStreamMeta* pMeta, int64_t ver, SStreamTask* pTask);
|
||||
int32_t streamMetaAddSerializedTask(SStreamMeta* pMeta, int64_t startVer, char* msg, int32_t msgLen);
|
||||
int32_t streamMetaRemoveTask(SStreamMeta* pMeta, int32_t taskId);
|
||||
SStreamTask* streamMetaGetTask(SStreamMeta* pMeta, int32_t taskId);
|
||||
|
||||
SStreamTask* streamMetaAcquireTask(SStreamMeta* pMeta, int32_t taskId);
|
||||
void streamMetaReleaseTask(SStreamMeta* pMeta, SStreamTask* pTask);
|
||||
void streamMetaRemoveTask1(SStreamMeta* pMeta, int32_t taskId);
|
||||
void streamMetaRemoveTask(SStreamMeta* pMeta, int32_t taskId);
|
||||
|
||||
int32_t streamMetaBegin(SStreamMeta* pMeta);
|
||||
int32_t streamMetaCommit(SStreamMeta* pMeta);
|
||||
int32_t streamMetaRollBack(SStreamMeta* pMeta);
|
||||
int32_t streamLoadTasks(SStreamMeta* pMeta);
|
||||
|
||||
// checkpoint
|
||||
int32_t streamProcessCheckpointSourceReq(SStreamMeta* pMeta, SStreamTask* pTask, SStreamCheckpointSourceReq* pReq);
|
||||
int32_t streamProcessCheckpointReq(SStreamMeta* pMeta, SStreamTask* pTask, SStreamCheckpointReq* pReq);
|
||||
int32_t streamProcessCheckpointRsp(SStreamMeta* pMeta, SStreamTask* pTask, SStreamCheckpointRsp* pRsp);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -25,7 +25,7 @@ extern "C" {
|
|||
#include "tlrucache.h"
|
||||
#include "tmsgcb.h"
|
||||
|
||||
#define SYNC_RESP_TTL_MS 10000000
|
||||
#define SYNC_RESP_TTL_MS 30000
|
||||
#define SYNC_SPEED_UP_HB_TIMER 400
|
||||
#define SYNC_SPEED_UP_AFTER_MS (1000 * 20)
|
||||
#define SYNC_SLOW_DOWN_RANGE 100
|
||||
|
@ -40,12 +40,19 @@ extern "C" {
|
|||
#define SNAPSHOT_MAX_CLOCK_SKEW_MS 1000 * 10
|
||||
#define SNAPSHOT_WAIT_MS 1000 * 30
|
||||
|
||||
#define SYNC_MAX_RETRY_BACKOFF 5
|
||||
#define SYNC_LOG_REPL_RETRY_WAIT_MS 100
|
||||
#define SYNC_APPEND_ENTRIES_TIMEOUT_MS 10000
|
||||
#define SYNC_HEART_TIMEOUT_MS 1000 * 15
|
||||
|
||||
#define SYNC_HEARTBEAT_SLOW_MS 1500
|
||||
#define SYNC_HEARTBEAT_REPLY_SLOW_MS 1500
|
||||
#define SYNC_SNAP_RESEND_MS 1000 * 60
|
||||
|
||||
#define SYNC_MAX_BATCH_SIZE 1
|
||||
#define SYNC_INDEX_BEGIN 0
|
||||
#define SYNC_INDEX_INVALID -1
|
||||
#define SYNC_TERM_INVALID 0xFFFFFFFFFFFFFFFF
|
||||
#define SYNC_TERM_INVALID -1 // 0xFFFFFFFFFFFFFFFF
|
||||
|
||||
typedef enum {
|
||||
SYNC_STRATEGY_NO_SNAPSHOT = 0,
|
||||
|
@ -56,13 +63,14 @@ typedef enum {
|
|||
typedef uint64_t SyncNodeId;
|
||||
typedef int32_t SyncGroupId;
|
||||
typedef int64_t SyncIndex;
|
||||
typedef uint64_t SyncTerm;
|
||||
typedef int64_t SyncTerm;
|
||||
|
||||
typedef struct SSyncNode SSyncNode;
|
||||
typedef struct SWal SWal;
|
||||
typedef struct SSyncRaftEntry SSyncRaftEntry;
|
||||
|
||||
typedef enum {
|
||||
TAOS_SYNC_STATE_OFFLINE = 0,
|
||||
TAOS_SYNC_STATE_FOLLOWER = 100,
|
||||
TAOS_SYNC_STATE_CANDIDATE = 101,
|
||||
TAOS_SYNC_STATE_LEADER = 102,
|
||||
|
@ -131,13 +139,13 @@ typedef struct SSnapshotMeta {
|
|||
typedef struct SSyncFSM {
|
||||
void* data;
|
||||
|
||||
void (*FpCommitCb)(const struct SSyncFSM* pFsm, const SRpcMsg* pMsg, const SFsmCbMeta* pMeta);
|
||||
void (*FpPreCommitCb)(const struct SSyncFSM* pFsm, const SRpcMsg* pMsg, const SFsmCbMeta* pMeta);
|
||||
void (*FpRollBackCb)(const struct SSyncFSM* pFsm, const SRpcMsg* pMsg, const SFsmCbMeta* pMeta);
|
||||
int32_t (*FpCommitCb)(const struct SSyncFSM* pFsm, SRpcMsg* pMsg, const SFsmCbMeta* pMeta);
|
||||
int32_t (*FpPreCommitCb)(const struct SSyncFSM* pFsm, SRpcMsg* pMsg, const SFsmCbMeta* pMeta);
|
||||
void (*FpRollBackCb)(const struct SSyncFSM* pFsm, SRpcMsg* pMsg, const SFsmCbMeta* pMeta);
|
||||
|
||||
void (*FpRestoreFinishCb)(const struct SSyncFSM* pFsm);
|
||||
void (*FpReConfigCb)(const struct SSyncFSM* pFsm, const SRpcMsg* pMsg, const SReConfigCbMeta* pMeta);
|
||||
void (*FpLeaderTransferCb)(const struct SSyncFSM* pFsm, const SRpcMsg* pMsg, const SFsmCbMeta* pMeta);
|
||||
void (*FpReConfigCb)(const struct SSyncFSM* pFsm, SRpcMsg* pMsg, const SReConfigCbMeta* pMeta);
|
||||
void (*FpLeaderTransferCb)(const struct SSyncFSM* pFsm, SRpcMsg* pMsg, const SFsmCbMeta* pMeta);
|
||||
bool (*FpApplyQueueEmptyCb)(const struct SSyncFSM* pFsm);
|
||||
int32_t (*FpApplyQueueItems)(const struct SSyncFSM* pFsm);
|
||||
|
||||
|
@ -161,7 +169,10 @@ typedef struct SSyncFSM {
|
|||
// SWal implements it
|
||||
typedef struct SSyncLogStore {
|
||||
SLRUCache* pCache;
|
||||
void* data;
|
||||
int32_t cacheHit;
|
||||
int32_t cacheMiss;
|
||||
|
||||
void* data;
|
||||
|
||||
int32_t (*syncLogUpdateCommitIndex)(struct SSyncLogStore* pLogStore, SyncIndex index);
|
||||
SyncIndex (*syncLogCommitIndex)(struct SSyncLogStore* pLogStore);
|
||||
|
@ -203,15 +214,20 @@ typedef struct SSyncInfo {
|
|||
int32_t (*syncEqCtrlMsg)(const SMsgCb* msgcb, SRpcMsg* pMsg);
|
||||
} SSyncInfo;
|
||||
|
||||
// if state == leader
|
||||
// if restored, display "leader"
|
||||
// if !restored && canRead, display "leader*"
|
||||
// if !restored && !canRead, display "leader**"
|
||||
typedef struct SSyncState {
|
||||
ESyncState state;
|
||||
bool restored;
|
||||
bool canRead;
|
||||
} SSyncState;
|
||||
|
||||
int32_t syncInit();
|
||||
void syncCleanUp();
|
||||
int64_t syncOpen(SSyncInfo* pSyncInfo);
|
||||
void syncStart(int64_t rid);
|
||||
int32_t syncStart(int64_t rid);
|
||||
void syncStop(int64_t rid);
|
||||
void syncPreStop(int64_t rid);
|
||||
int32_t syncPropose(int64_t rid, SRpcMsg* pMsg, bool isWeak);
|
||||
|
@ -222,6 +238,8 @@ int32_t syncEndSnapshot(int64_t rid);
|
|||
int32_t syncLeaderTransfer(int64_t rid);
|
||||
int32_t syncStepDown(int64_t rid, SyncTerm newTerm);
|
||||
bool syncIsReadyForRead(int64_t rid);
|
||||
bool syncSnapshotSending(int64_t rid);
|
||||
bool syncSnapshotRecving(int64_t rid);
|
||||
|
||||
SSyncState syncGetState(int64_t rid);
|
||||
void syncGetRetryEpSet(int64_t rid, SEpSet* pEpSet);
|
||||
|
|
|
@ -72,6 +72,7 @@ typedef struct SRpcMsg {
|
|||
typedef void (*RpcCfp)(void *parent, SRpcMsg *, SEpSet *epset);
|
||||
typedef bool (*RpcRfp)(int32_t code, tmsg_t msgType);
|
||||
typedef bool (*RpcTfp)(int32_t code, tmsg_t msgType);
|
||||
typedef bool (*RpcFFfp)(tmsg_t msgType);
|
||||
typedef void (*RpcDfp)(void *ahandle);
|
||||
|
||||
typedef struct SRpcInit {
|
||||
|
@ -85,6 +86,14 @@ typedef struct SRpcInit {
|
|||
int32_t retryLimit; // retry limit
|
||||
int32_t retryInterval; // retry interval ms
|
||||
|
||||
int32_t retryMinInterval; // retry init interval
|
||||
int32_t retryStepFactor; // retry interval factor
|
||||
int32_t retryMaxInterval; // retry max interval
|
||||
int64_t retryMaxTimouet;
|
||||
|
||||
int32_t failFastThreshold;
|
||||
int32_t failFastInterval;
|
||||
|
||||
int32_t compressSize; // -1: no compress, 0 : all data compressed, size: compress data if larger than size
|
||||
int8_t encryption; // encrypt or not
|
||||
|
||||
|
@ -102,6 +111,8 @@ typedef struct SRpcInit {
|
|||
|
||||
// destroy client ahandle;
|
||||
RpcDfp dfp;
|
||||
// fail fast fp
|
||||
RpcFFfp ffp;
|
||||
|
||||
void *parent;
|
||||
} SRpcInit;
|
||||
|
|
|
@ -33,16 +33,16 @@ extern "C" {
|
|||
#define wTrace(...) { if (wDebugFlag & DEBUG_TRACE) { taosPrintLog("WAL ", DEBUG_TRACE, wDebugFlag, __VA_ARGS__); }}
|
||||
// clang-format on
|
||||
|
||||
#define WAL_PROTO_VER 0
|
||||
#define WAL_NOSUFFIX_LEN 20
|
||||
#define WAL_SUFFIX_AT (WAL_NOSUFFIX_LEN + 1)
|
||||
#define WAL_LOG_SUFFIX "log"
|
||||
#define WAL_INDEX_SUFFIX "idx"
|
||||
#define WAL_REFRESH_MS 1000
|
||||
#define WAL_PATH_LEN (TSDB_FILENAME_LEN + 12)
|
||||
#define WAL_FILE_LEN (WAL_PATH_LEN + 32)
|
||||
#define WAL_MAGIC 0xFAFBFCFDF4F3F2F1ULL
|
||||
#define WAL_SCAN_BUF_SIZE (1024 * 1024 * 3)
|
||||
#define WAL_PROTO_VER 0
|
||||
#define WAL_NOSUFFIX_LEN 20
|
||||
#define WAL_SUFFIX_AT (WAL_NOSUFFIX_LEN + 1)
|
||||
#define WAL_LOG_SUFFIX "log"
|
||||
#define WAL_INDEX_SUFFIX "idx"
|
||||
#define WAL_REFRESH_MS 1000
|
||||
#define WAL_PATH_LEN (TSDB_FILENAME_LEN + 12)
|
||||
#define WAL_FILE_LEN (WAL_PATH_LEN + 32)
|
||||
#define WAL_MAGIC 0xFAFBFCFDF4F3F2F1ULL
|
||||
#define WAL_SCAN_BUF_SIZE (1024 * 1024 * 3)
|
||||
|
||||
typedef enum {
|
||||
TAOS_WAL_WRITE = 1,
|
||||
|
@ -107,6 +107,8 @@ typedef struct SWal {
|
|||
TdFilePtr pIdxFile;
|
||||
int32_t writeCur;
|
||||
SArray *fileInfoSet; // SArray<SWalFileInfo>
|
||||
// gc
|
||||
SArray *toDeleteFiles; // SArray<SWalFileInfo>
|
||||
// status
|
||||
int64_t totSize;
|
||||
int64_t lastRollSeq;
|
||||
|
@ -170,7 +172,7 @@ int32_t walWriteWithSyncInfo(SWal *, int64_t index, tmsg_t msgType, SWalSyncInfo
|
|||
|
||||
// Assign version automatically and return to caller,
|
||||
// -1 will be returned for failed writes
|
||||
int64_t walAppendLog(SWal *, tmsg_t msgType, SWalSyncInfo syncMeta, const void *body, int32_t bodyLen);
|
||||
int64_t walAppendLog(SWal *, int64_t index, tmsg_t msgType, SWalSyncInfo syncMeta, const void *body, int32_t bodyLen);
|
||||
|
||||
void walFsync(SWal *, bool force);
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ extern "C" {
|
|||
|
||||
#if !defined(WINDOWS)
|
||||
#include <dirent.h>
|
||||
#include <execinfo.h>
|
||||
#include <libgen.h>
|
||||
#include <sched.h>
|
||||
#include <unistd.h>
|
||||
|
@ -48,6 +49,9 @@ extern "C" {
|
|||
#else
|
||||
#include <argp.h>
|
||||
#include <sys/prctl.h>
|
||||
#if defined(_TD_X86_)
|
||||
#include <cpuid.h>
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
|
||||
|
@ -82,6 +86,12 @@ extern "C" {
|
|||
#include <wchar.h>
|
||||
#include <wctype.h>
|
||||
|
||||
#if __AVX__
|
||||
#include <immintrin.h>
|
||||
#elif __SSE4_2__
|
||||
#include <nmmintrin.h>
|
||||
#endif
|
||||
|
||||
#include "osThread.h"
|
||||
|
||||
#include "osAtomic.h"
|
||||
|
|
|
@ -120,12 +120,6 @@ void syslog(int unused, const char *format, ...);
|
|||
#define POINTER_SHIFT(p, b) ((void *)((char *)(p) + (b)))
|
||||
#define POINTER_DISTANCE(p1, p2) ((char *)(p1) - (char *)(p2))
|
||||
|
||||
#ifndef NDEBUG
|
||||
#define ASSERT(x) assert(x)
|
||||
#else
|
||||
#define ASSERT(x)
|
||||
#endif
|
||||
|
||||
#ifndef UNUSED
|
||||
#define UNUSED(x) ((void)(x))
|
||||
#endif
|
||||
|
@ -168,22 +162,22 @@ void syslog(int unused, const char *format, ...);
|
|||
} \
|
||||
} while (0)
|
||||
|
||||
#define DEFAULT_DOUBLE_COMP(x, y) \
|
||||
do { \
|
||||
if (isnan(x) && isnan(y)) { \
|
||||
return 0; \
|
||||
} \
|
||||
if (isnan(x)) { \
|
||||
return -1; \
|
||||
} \
|
||||
if (isnan(y)) { \
|
||||
return 1; \
|
||||
} \
|
||||
if ((x) == (y)) { \
|
||||
return 0; \
|
||||
} else { \
|
||||
return (x) < (y) ? -1 : 1; \
|
||||
} \
|
||||
#define DEFAULT_DOUBLE_COMP(x, y) \
|
||||
do { \
|
||||
if (isnan(x) && isnan(y)) { \
|
||||
return 0; \
|
||||
} \
|
||||
if (isnan(x)) { \
|
||||
return -1; \
|
||||
} \
|
||||
if (isnan(y)) { \
|
||||
return 1; \
|
||||
} \
|
||||
if (fabs((x) - (y)) <= DBL_EPSILON) { \
|
||||
return 0; \
|
||||
} else { \
|
||||
return (x) < (y) ? -1 : 1; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define DEFAULT_FLOAT_COMP(x, y) DEFAULT_DOUBLE_COMP(x, y)
|
||||
|
|
|
@ -62,6 +62,7 @@ int32_t taosRealPath(char *dirname, char *realPath, int32_t maxlen);
|
|||
bool taosIsDir(const char *dirname);
|
||||
char *taosDirName(char *dirname);
|
||||
char *taosDirEntryBaseName(char *dirname);
|
||||
void taosGetCwd(char *buf, int32_t len);
|
||||
|
||||
TdDirPtr taosOpenDir(const char *dirname);
|
||||
TdDirEntryPtr taosReadDir(TdDirPtr pDir);
|
||||
|
|
|
@ -36,6 +36,11 @@ extern int64_t tsStreamMax;
|
|||
extern float tsNumOfCores;
|
||||
extern int64_t tsTotalMemoryKB;
|
||||
extern char *tsProcPath;
|
||||
extern char tsSIMDEnable;
|
||||
extern char tsSSE42Enable;
|
||||
extern char tsAVXEnable;
|
||||
extern char tsAVX2Enable;
|
||||
extern char tsFMAEnable;
|
||||
|
||||
extern char configDir[];
|
||||
extern char tsDataDir[];
|
||||
|
|
|
@ -88,6 +88,7 @@ int32_t taosFsyncFile(TdFilePtr pFile);
|
|||
int64_t taosReadFile(TdFilePtr pFile, void *buf, int64_t count);
|
||||
int64_t taosPReadFile(TdFilePtr pFile, void *buf, int64_t count, int64_t offset);
|
||||
int64_t taosWriteFile(TdFilePtr pFile, const void *buf, int64_t count);
|
||||
int64_t taosPWriteFile(TdFilePtr pFile, const void *buf, int64_t count, int64_t offset);
|
||||
void taosFprintfFile(TdFilePtr pFile, const char *format, ...);
|
||||
|
||||
int64_t taosGetLineFile(TdFilePtr pFile, char **__restrict ptrBuf);
|
||||
|
|
|
@ -37,6 +37,7 @@ void taosMemoryFree(void *ptr);
|
|||
int64_t taosMemorySize(void *ptr);
|
||||
void taosPrintBackTrace();
|
||||
void taosMemoryTrim(int32_t size);
|
||||
void *taosMemoryMallocAlign(uint32_t alignment, int64_t size);
|
||||
|
||||
#define taosMemoryFreeClear(ptr) \
|
||||
do { \
|
||||
|
|
|
@ -29,7 +29,7 @@ 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 nanosecs);
|
||||
int tsem_timewait(tsem_t *sim, int64_t milis);
|
||||
int tsem_post(tsem_t *sem);
|
||||
int tsem_destroy(tsem_t *sem);
|
||||
|
||||
|
@ -38,7 +38,7 @@ int tsem_destroy(tsem_t *sem);
|
|||
#define tsem_t sem_t
|
||||
#define tsem_init sem_init
|
||||
int tsem_wait(tsem_t *sem);
|
||||
int tsem_timewait(tsem_t *sim, int64_t nanosecs);
|
||||
int tsem_timewait(tsem_t *sim, int64_t milis);
|
||||
#define tsem_post sem_post
|
||||
#define tsem_destroy sem_destroy
|
||||
|
||||
|
|
|
@ -169,6 +169,9 @@ void taosSetMaskSIGPIPE();
|
|||
uint32_t taosInetAddr(const char *ipAddr);
|
||||
const char *taosInetNtoa(struct in_addr ipInt, char *dstStr, int32_t len);
|
||||
|
||||
uint64_t taosHton64(uint64_t val);
|
||||
uint64_t taosNtoh64(uint64_t val);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -62,7 +62,7 @@ typedef int32_t TdUcs4;
|
|||
int32_t taosUcs4len(TdUcs4 *ucs4);
|
||||
int64_t taosStr2int64(const char *str);
|
||||
|
||||
void taosConvInit(void);
|
||||
int32_t taosConvInit(void);
|
||||
void taosConvDestroy();
|
||||
int32_t taosUcs4ToMbs(TdUcs4 *ucs4, int32_t ucs4_max_len, char *mbs);
|
||||
bool taosMbsToUcs4(const char *mbs, size_t mbs_len, TdUcs4 *ucs4, int32_t ucs4_max_len, int32_t *len);
|
||||
|
|
|
@ -40,6 +40,7 @@ int32_t taosGetOsReleaseName(char *releaseName, int32_t maxLen);
|
|||
int32_t taosGetCpuInfo(char *cpuModel, int32_t maxLen, float *numOfCores);
|
||||
int32_t taosGetCpuCores(float *numOfCores);
|
||||
void taosGetCpuUsage(double *cpu_system, double *cpu_engine);
|
||||
int32_t taosGetCpuInstructions(char* sse42, char* avx, char* avx2, char* fma);
|
||||
int32_t taosGetTotalMemory(int64_t *totalKB);
|
||||
int32_t taosGetProcMemory(int64_t *usedKB);
|
||||
int32_t taosGetSysMemory(int64_t *usedKB);
|
||||
|
|
|
@ -46,6 +46,29 @@ void taosSetTerminalMode();
|
|||
int32_t taosGetOldTerminalMode();
|
||||
void taosResetTerminalMode();
|
||||
|
||||
#if !defined(WINDOWS)
|
||||
#define taosPrintTrace(flags, level, dflag) \
|
||||
{ \
|
||||
void* array[100]; \
|
||||
int32_t size = backtrace(array, 100); \
|
||||
char** strings = backtrace_symbols(array, size); \
|
||||
if (strings != NULL) { \
|
||||
taosPrintLog(flags, level, dflag, "obtained %d stack frames", size); \
|
||||
for (int32_t i = 0; i < size; i++) { \
|
||||
taosPrintLog(flags, level, dflag, "frame:%d, %s", i, strings[i]); \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
taosMemoryFree(strings); \
|
||||
}
|
||||
#else
|
||||
#define taosPrintTrace(flags, level, dflag) \
|
||||
{ \
|
||||
taosPrintLog(flags, level, dflag, \
|
||||
"backtrace not implemented on windows, so detailed stack information cannot be printed"); \
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -35,6 +35,7 @@ extern "C" {
|
|||
#ifdef WINDOWS
|
||||
|
||||
#define CLOCK_REALTIME 0
|
||||
#define CLOCK_MONOTONIC 0
|
||||
|
||||
#define MILLISECOND_PER_SECOND (1000i64)
|
||||
#else
|
||||
|
@ -82,6 +83,13 @@ static FORCE_INLINE int64_t taosGetTimestampNs() {
|
|||
return (int64_t)systemTime.tv_sec * 1000000000LL + (int64_t)systemTime.tv_nsec;
|
||||
}
|
||||
|
||||
//@return timestamp of monotonic clock in millisecond
|
||||
static FORCE_INLINE int64_t taosGetMonoTimestampMs() {
|
||||
struct timespec systemTime = {0};
|
||||
taosClockGetTime(CLOCK_MONOTONIC, &systemTime);
|
||||
return (int64_t)systemTime.tv_sec * 1000LL + (int64_t)systemTime.tv_nsec / 1000000;
|
||||
}
|
||||
|
||||
char *taosStrpTime(const char *buf, const char *fmt, struct tm *tm);
|
||||
struct tm *taosLocalTime(const time_t *timep, struct tm *result);
|
||||
struct tm *taosLocalTimeNolock(struct tm *result, const time_t *timep, int dst);
|
||||
|
|
|
@ -27,7 +27,8 @@ extern "C" {
|
|||
typedef int32_t (*__compar_fn_t)(const void *, const void *);
|
||||
#endif
|
||||
|
||||
typedef void *(*FCopy)(void *);
|
||||
typedef void *(*__array_item_dup_fn_t)(void *);
|
||||
|
||||
typedef void (*FDelete)(void *);
|
||||
typedef int32_t (*FEncode)(void **buf, const void *dst);
|
||||
typedef void *(*FDecode)(const void *buf, void *dst);
|
||||
|
@ -41,7 +42,6 @@ typedef void *(*FDecode)(const void *buf, void *dst);
|
|||
#define elePtrAt(base, size, idx) (void *)((char *)(base) + (size) * (idx))
|
||||
|
||||
typedef int32_t (*__ext_compar_fn_t)(const void *p1, const void *p2, const void *param);
|
||||
typedef void (*__ext_swap_fn_t)(void *p1, void *p2, const void *param);
|
||||
|
||||
/**
|
||||
* quick sort, with the compare function requiring additional parameters support
|
||||
|
|
|
@ -40,48 +40,64 @@ int32_t* taosGetErrno();
|
|||
#define TSDB_CODE_FAILED -1 // unknown or needn't tell detail error
|
||||
|
||||
// rpc
|
||||
#define TSDB_CODE_RPC_AUTH_FAILURE TAOS_DEF_ERROR_CODE(0, 0x0003)
|
||||
#define TSDB_CODE_RPC_REDIRECT TAOS_DEF_ERROR_CODE(0, 0x0004)
|
||||
// #define TSDB_CODE_RPC_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x0001) // 2.x
|
||||
// #define TSDB_CODE_RPC_AUTH_REQUIRED TAOS_DEF_ERROR_CODE(0, 0x0002) // 2.x
|
||||
// #define TSDB_CODE_RPC_AUTH_FAILURE TAOS_DEF_ERROR_CODE(0, 0x0003) // 2.x
|
||||
// #define TSDB_CODE_RPC_REDIRECT TAOS_DEF_ERROR_CODE(0, 0x0004) // 2.x
|
||||
// #define TSDB_CODE_RPC_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x0005) // 2.x
|
||||
// #define TSDB_CODE_RPC_ALREADY_PROCESSED TAOS_DEF_ERROR_CODE(0, 0x0006) // 2.x
|
||||
// #define TSDB_CODE_RPC_LAST_SESSION_NOT_FINI. TAOS_DEF_ERROR_CODE(0, 0x0007) // 2.x
|
||||
// #define TSDB_CODE_RPC_MISMATCHED_LINK_ID TAOS_DEF_ERROR_CODE(0, 0x0008) // 2.x
|
||||
// #define TSDB_CODE_RPC_TOO_SLOW TAOS_DEF_ERROR_CODE(0, 0x0009) // 2.x
|
||||
// #define TSDB_CODE_RPC_MAX_SESSIONS TAOS_DEF_ERROR_CODE(0, 0x000A) // 2.x
|
||||
#define TSDB_CODE_RPC_NETWORK_UNAVAIL TAOS_DEF_ERROR_CODE(0, 0x000B)
|
||||
// #define TSDB_CODE_RPC_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x000C) // 2.x
|
||||
// #define TSDB_CODE_RPC_UNEXPECTED_RESPONSE TAOS_DEF_ERROR_CODE(0, 0x000D) // 2.x
|
||||
// #define TSDB_CODE_RPC_INVALID_VALUE TAOS_DEF_ERROR_CODE(0, 0x000E) // 2.x
|
||||
// #define TSDB_CODE_RPC_INVALID_TRAN_ID TAOS_DEF_ERROR_CODE(0, 0x000F) // 2.x
|
||||
// #define TSDB_CODE_RPC_INVALID_SESSION_ID TAOS_DEF_ERROR_CODE(0, 0x0010) // 2.x
|
||||
// #define TSDB_CODE_RPC_INVALID_MSG_TYPE TAOS_DEF_ERROR_CODE(0, 0x0011) // 2.x
|
||||
// #define TSDB_CODE_RPC_INVALID_RESPONSE_TYPE TAOS_DEF_ERROR_CODE(0, 0x0012) // 2.x
|
||||
#define TSDB_CODE_TIME_UNSYNCED TAOS_DEF_ERROR_CODE(0, 0x0013) //
|
||||
// #define TSDB_CODE_APP_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x0014) // 2.x
|
||||
#define TSDB_CODE_RPC_FQDN_ERROR TAOS_DEF_ERROR_CODE(0, 0x0015)
|
||||
#define TSDB_CODE_RPC_PORT_EADDRINUSE TAOS_DEF_ERROR_CODE(0, 0x0017)
|
||||
#define TSDB_CODE_RPC_BROKEN_LINK TAOS_DEF_ERROR_CODE(0, 0x0018)
|
||||
#define TSDB_CODE_RPC_TIMEOUT TAOS_DEF_ERROR_CODE(0, 0x0019)
|
||||
// #define TSDB_CODE_RPC_INVALID_VERSION TAOS_DEF_ERROR_CODE(0, 0x0016) // 2.x
|
||||
#define TSDB_CODE_RPC_PORT_EADDRINUSE TAOS_DEF_ERROR_CODE(0, 0x0017) //
|
||||
#define TSDB_CODE_RPC_BROKEN_LINK TAOS_DEF_ERROR_CODE(0, 0x0018) //
|
||||
#define TSDB_CODE_RPC_TIMEOUT TAOS_DEF_ERROR_CODE(0, 0x0019) //
|
||||
|
||||
//common & util
|
||||
#define TSDB_CODE_TIME_UNSYNCED TAOS_DEF_ERROR_CODE(0, 0x0013)
|
||||
#define TSDB_CODE_APP_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x0014)
|
||||
|
||||
#define TSDB_CODE_OPS_NOT_SUPPORT TAOS_DEF_ERROR_CODE(0, 0x0100)
|
||||
#define TSDB_CODE_MEMORY_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x0101)
|
||||
#define TSDB_CODE_OPS_NOT_SUPPORT TAOS_DEF_ERROR_CODE(0, 0x0100) //
|
||||
// #define TSDB_CODE_MEMORY_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x0101) // 2.x
|
||||
#define TSDB_CODE_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0102)
|
||||
#define TSDB_CODE_FILE_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x0104)
|
||||
#define TSDB_CODE_REF_NO_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0105)
|
||||
#define TSDB_CODE_REF_FULL TAOS_DEF_ERROR_CODE(0, 0x0106)
|
||||
#define TSDB_CODE_REF_ID_REMOVED TAOS_DEF_ERROR_CODE(0, 0x0107)
|
||||
#define TSDB_CODE_REF_INVALID_ID TAOS_DEF_ERROR_CODE(0, 0x0108)
|
||||
#define TSDB_CODE_REF_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0109)
|
||||
#define TSDB_CODE_REF_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x010A)
|
||||
// #define TSDB_CODE_COM_INVALID_CFG_MSG TAOS_DEF_ERROR_CODE(0, 0x0103) // 2.x
|
||||
#define TSDB_CODE_FILE_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x0104) //
|
||||
// #define TSDB_CODE_REF_NO_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0105) // 2.x
|
||||
#define TSDB_CODE_REF_FULL TAOS_DEF_ERROR_CODE(0, 0x0106) // internal
|
||||
#define TSDB_CODE_REF_ID_REMOVED TAOS_DEF_ERROR_CODE(0, 0x0107) // internal
|
||||
#define TSDB_CODE_REF_INVALID_ID TAOS_DEF_ERROR_CODE(0, 0x0108) // internal
|
||||
#define TSDB_CODE_REF_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0109) // internal
|
||||
#define TSDB_CODE_REF_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x010A) // internal
|
||||
|
||||
#define TSDB_CODE_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x0110)
|
||||
#define TSDB_CODE_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x0111)
|
||||
#define TSDB_CODE_OUT_OF_RANGE TAOS_DEF_ERROR_CODE(0, 0x0112)
|
||||
#define TSDB_CODE_OUT_OF_SHM_MEM TAOS_DEF_ERROR_CODE(0, 0x0113)
|
||||
#define TSDB_CODE_INVALID_SHM_ID TAOS_DEF_ERROR_CODE(0, 0x0114)
|
||||
#define TSDB_CODE_INVALID_MSG TAOS_DEF_ERROR_CODE(0, 0x0115)
|
||||
#define TSDB_CODE_INVALID_MSG_LEN TAOS_DEF_ERROR_CODE(0, 0x0116)
|
||||
#define TSDB_CODE_INVALID_PTR TAOS_DEF_ERROR_CODE(0, 0x0117)
|
||||
#define TSDB_CODE_INVALID_PARA TAOS_DEF_ERROR_CODE(0, 0x0118)
|
||||
#define TSDB_CODE_INVALID_CFG TAOS_DEF_ERROR_CODE(0, 0x0119)
|
||||
#define TSDB_CODE_INVALID_OPTION TAOS_DEF_ERROR_CODE(0, 0x011A)
|
||||
#define TSDB_CODE_INVALID_JSON_FORMAT TAOS_DEF_ERROR_CODE(0, 0x011B)
|
||||
#define TSDB_CODE_INVALID_VERSION_NUMBER TAOS_DEF_ERROR_CODE(0, 0x011C)
|
||||
#define TSDB_CODE_INVALID_VERSION_STRING TAOS_DEF_ERROR_CODE(0, 0x011D)
|
||||
#define TSDB_CODE_VERSION_NOT_COMPATIBLE TAOS_DEF_ERROR_CODE(0, 0x011E)
|
||||
#define TSDB_CODE_CHECKSUM_ERROR TAOS_DEF_ERROR_CODE(0, 0x011F)
|
||||
#define TSDB_CODE_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x0110) //
|
||||
#define TSDB_CODE_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x0111) // internal
|
||||
#define TSDB_CODE_OUT_OF_RANGE TAOS_DEF_ERROR_CODE(0, 0x0112) //
|
||||
// #define TSDB_CODE_OUT_OF_SHM_MEM TAOS_DEF_ERROR_CODE(0, 0x0113)
|
||||
// #define TSDB_CODE_INVALID_SHM_ID TAOS_DEF_ERROR_CODE(0, 0x0114)
|
||||
#define TSDB_CODE_INVALID_MSG TAOS_DEF_ERROR_CODE(0, 0x0115) //
|
||||
#define TSDB_CODE_INVALID_MSG_LEN TAOS_DEF_ERROR_CODE(0, 0x0116) //
|
||||
#define TSDB_CODE_INVALID_PTR TAOS_DEF_ERROR_CODE(0, 0x0117) // internal
|
||||
#define TSDB_CODE_INVALID_PARA TAOS_DEF_ERROR_CODE(0, 0x0118) //
|
||||
#define TSDB_CODE_INVALID_CFG TAOS_DEF_ERROR_CODE(0, 0x0119) // internal
|
||||
#define TSDB_CODE_INVALID_OPTION TAOS_DEF_ERROR_CODE(0, 0x011A) // internal
|
||||
#define TSDB_CODE_INVALID_JSON_FORMAT TAOS_DEF_ERROR_CODE(0, 0x011B) // internal
|
||||
#define TSDB_CODE_INVALID_VERSION_NUMBER TAOS_DEF_ERROR_CODE(0, 0x011C) // internal
|
||||
#define TSDB_CODE_INVALID_VERSION_STRING TAOS_DEF_ERROR_CODE(0, 0x011D) // internal
|
||||
#define TSDB_CODE_VERSION_NOT_COMPATIBLE TAOS_DEF_ERROR_CODE(0, 0x011E) // internal
|
||||
#define TSDB_CODE_CHECKSUM_ERROR TAOS_DEF_ERROR_CODE(0, 0x011F) // internal
|
||||
|
||||
#define TSDB_CODE_COMPRESS_ERROR TAOS_DEF_ERROR_CODE(0, 0x0120)
|
||||
#define TSDB_CODE_MSG_NOT_PROCESSED TAOS_DEF_ERROR_CODE(0, 0x0121)
|
||||
#define TSDB_CODE_MSG_NOT_PROCESSED TAOS_DEF_ERROR_CODE(0, 0x0121) //
|
||||
#define TSDB_CODE_CFG_NOT_FOUND TAOS_DEF_ERROR_CODE(0, 0x0122)
|
||||
#define TSDB_CODE_REPEAT_INIT TAOS_DEF_ERROR_CODE(0, 0x0123)
|
||||
#define TSDB_CODE_DUP_KEY TAOS_DEF_ERROR_CODE(0, 0x0124)
|
||||
|
@ -92,6 +108,10 @@ int32_t* taosGetErrno();
|
|||
#define TSDB_CODE_NO_AVAIL_DISK TAOS_DEF_ERROR_CODE(0, 0x0129)
|
||||
#define TSDB_CODE_NOT_FOUND TAOS_DEF_ERROR_CODE(0, 0x012A)
|
||||
#define TSDB_CODE_NO_DISKSPACE TAOS_DEF_ERROR_CODE(0, 0x012B)
|
||||
#define TSDB_CODE_TIMEOUT_ERROR TAOS_DEF_ERROR_CODE(0, 0x012C)
|
||||
|
||||
#define TSDB_CODE_APP_IS_STARTING TAOS_DEF_ERROR_CODE(0, 0x0130) //
|
||||
#define TSDB_CODE_APP_IS_STOPPING TAOS_DEF_ERROR_CODE(0, 0x0131) //
|
||||
|
||||
//client
|
||||
#define TSDB_CODE_TSC_INVALID_OPERATION TAOS_DEF_ERROR_CODE(0, 0x0200)
|
||||
|
@ -106,11 +126,11 @@ int32_t* taosGetErrno();
|
|||
#define TSDB_CODE_TSC_INVALID_DB_LENGTH TAOS_DEF_ERROR_CODE(0, 0x0209)
|
||||
#define TSDB_CODE_TSC_INVALID_TABLE_ID_LENGTH TAOS_DEF_ERROR_CODE(0, 0x020A)
|
||||
#define TSDB_CODE_TSC_INVALID_CONNECTION TAOS_DEF_ERROR_CODE(0, 0x020B)
|
||||
#define TSDB_CODE_TSC_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x020C)
|
||||
// #define TSDB_CODE_TSC_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x020C) // 2.x
|
||||
#define TSDB_CODE_TSC_QUERY_CACHE_ERASED TAOS_DEF_ERROR_CODE(0, 0x020E)
|
||||
#define TSDB_CODE_TSC_QUERY_CANCELLED TAOS_DEF_ERROR_CODE(0, 0x020F)
|
||||
#define TSDB_CODE_TSC_SORTED_RES_TOO_MANY TAOS_DEF_ERROR_CODE(0, 0x0210)
|
||||
#define TSDB_CODE_TSC_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x0211)
|
||||
// #define TSDB_CODE_TSC_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x0211) // 2.x
|
||||
#define TSDB_CODE_TSC_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x0212)
|
||||
#define TSDB_CODE_TSC_DISCONNECTED TAOS_DEF_ERROR_CODE(0, 0x0213)
|
||||
#define TSDB_CODE_TSC_NO_WRITE_AUTH TAOS_DEF_ERROR_CODE(0, 0x0214)
|
||||
|
@ -138,32 +158,41 @@ int32_t* taosGetErrno();
|
|||
#define TSDB_CODE_TSC_NOT_STABLE_ERROR TAOS_DEF_ERROR_CODE(0, 0X022F)
|
||||
|
||||
// mnode-common
|
||||
// #define TSDB_CODE_MND_MSG_NOT_PROCESSED TAOS_DEF_ERROR_CODE(0, 0x0300) // 2.x
|
||||
// #define TSDB_CODE_MND_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x0301) // 2.x
|
||||
// #define TSDB_CODE_MND_ACTION_NEED_REPROCESSEDTAOS_DEF_ERROR_CODE(0, 0x0302) // 2.x
|
||||
#define TSDB_CODE_MND_NO_RIGHTS TAOS_DEF_ERROR_CODE(0, 0x0303)
|
||||
#define TSDB_CODE_MND_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x0304)
|
||||
#define TSDB_CODE_MND_INVALID_CONNECTION TAOS_DEF_ERROR_CODE(0, 0x0305)
|
||||
// #define TSDB_CODE_MND_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x0304) // 2.x
|
||||
// #define TSDB_CODE_MND_INVALID_CONNECTION TAOS_DEF_ERROR_CODE(0, 0x0305) // 2.x
|
||||
// #define TSDB_CODE_MND_INVALID_MSG_VERSION TAOS_DEF_ERROR_CODE(0, 0x0306) // 2.x
|
||||
// #define TSDB_CODE_MND_INVALID_MSG_LEN TAOS_DEF_ERROR_CODE(0, 0x0307) // 2.x
|
||||
// #define TSDB_CODE_MND_INVALID_MSG_TYPE TAOS_DEF_ERROR_CODE(0, 0x0308) // 2.x
|
||||
// #define TSDB_CODE_MND_TOO_MANY_SHELL_CONNS TAOS_DEF_ERROR_CODE(0, 0x0309) // 2.x
|
||||
// #define TSDB_CODE_MND_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x030A) // 2.x
|
||||
#define TSDB_CODE_MND_INVALID_SHOWOBJ TAOS_DEF_ERROR_CODE(0, 0x030B)
|
||||
#define TSDB_CODE_MND_INVALID_QUERY_ID TAOS_DEF_ERROR_CODE(0, 0x030C)
|
||||
#define TSDB_CODE_MND_INVALID_STREAM_ID TAOS_DEF_ERROR_CODE(0, 0x030D)
|
||||
// #define TSDB_CODE_MND_INVALID_STREAM_ID TAOS_DEF_ERROR_CODE(0, 0x030D) // 2.x
|
||||
#define TSDB_CODE_MND_INVALID_CONN_ID TAOS_DEF_ERROR_CODE(0, 0x030E)
|
||||
#define TSDB_CODE_MND_MNODE_IS_RUNNING TAOS_DEF_ERROR_CODE(0, 0x0310)
|
||||
#define TSDB_CODE_MND_FAILED_TO_CONFIG_SYNC TAOS_DEF_ERROR_CODE(0, 0x0311)
|
||||
#define TSDB_CODE_MND_FAILED_TO_START_SYNC TAOS_DEF_ERROR_CODE(0, 0x0312)
|
||||
#define TSDB_CODE_MND_FAILED_TO_CREATE_DIR TAOS_DEF_ERROR_CODE(0, 0x0313)
|
||||
#define TSDB_CODE_MND_FAILED_TO_INIT_STEP TAOS_DEF_ERROR_CODE(0, 0x0314)
|
||||
// #define TSDB_CODE_MND_MNODE_IS_RUNNING TAOS_DEF_ERROR_CODE(0, 0x0310) // 2.x
|
||||
// #define TSDB_CODE_MND_FAILED_TO_CONFIG_SYNC TAOS_DEF_ERROR_CODE(0, 0x0311) // 2.x
|
||||
// #define TSDB_CODE_MND_FAILED_TO_START_SYNC TAOS_DEF_ERROR_CODE(0, 0x0312) // 2.x
|
||||
// #define TSDB_CODE_MND_FAILED_TO_CREATE_DIR TAOS_DEF_ERROR_CODE(0, 0x0313) // 2.x
|
||||
// #define TSDB_CODE_MND_FAILED_TO_INIT_STEP TAOS_DEF_ERROR_CODE(0, 0x0314) // 2.x
|
||||
#define TSDB_CODE_MND_USER_DISABLED TAOS_DEF_ERROR_CODE(0, 0x0315)
|
||||
|
||||
// mnode-sdb
|
||||
#define TSDB_CODE_SDB_OBJ_ALREADY_THERE TAOS_DEF_ERROR_CODE(0, 0x0320)
|
||||
#define TSDB_CODE_SDB_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x0321) // internal
|
||||
#define TSDB_CODE_SDB_INVALID_TABLE_TYPE TAOS_DEF_ERROR_CODE(0, 0x0322)
|
||||
#define TSDB_CODE_SDB_OBJ_ALREADY_THERE TAOS_DEF_ERROR_CODE(0, 0x0320) // internal
|
||||
// #define TSDB_CODE_MND_SDB_ERROR TAOS_DEF_ERROR_CODE(0, 0x0321) // 2.x
|
||||
#define TSDB_CODE_SDB_INVALID_TABLE_TYPE TAOS_DEF_ERROR_CODE(0, 0x0322) // internal
|
||||
#define TSDB_CODE_SDB_OBJ_NOT_THERE TAOS_DEF_ERROR_CODE(0, 0x0323)
|
||||
#define TSDB_CODE_SDB_INVALID_KEY_TYPE TAOS_DEF_ERROR_CODE(0, 0x0325)
|
||||
#define TSDB_CODE_SDB_INVALID_ACTION_TYPE TAOS_DEF_ERROR_CODE(0, 0x0326)
|
||||
#define TSDB_CODE_SDB_INVALID_STATUS_TYPE TAOS_DEF_ERROR_CODE(0, 0x0327)
|
||||
#define TSDB_CODE_SDB_INVALID_DATA_VER TAOS_DEF_ERROR_CODE(0, 0x0328)
|
||||
#define TSDB_CODE_SDB_INVALID_DATA_LEN TAOS_DEF_ERROR_CODE(0, 0x0329)
|
||||
// #define TSDB_CODE_MND_SDB_INVAID_META_ROW TAOS_DEF_ERROR_CODE(0, 0x0324) // 2.x
|
||||
// #define TSDB_CODE_SDB_INVALID_KEY_TYPE TAOS_DEF_ERROR_CODE(0, 0x0325) // 2.x
|
||||
#define TSDB_CODE_SDB_INVALID_ACTION_TYPE TAOS_DEF_ERROR_CODE(0, 0x0326) // internal
|
||||
// #define TSDB_CODE_SDB_INVALID_STATUS_TYPE TAOS_DEF_ERROR_CODE(0, 0x0327) // unused
|
||||
#define TSDB_CODE_SDB_INVALID_DATA_VER TAOS_DEF_ERROR_CODE(0, 0x0328) // internal
|
||||
#define TSDB_CODE_SDB_INVALID_DATA_LEN TAOS_DEF_ERROR_CODE(0, 0x0329) // internal
|
||||
#define TSDB_CODE_SDB_INVALID_DATA_CONTENT TAOS_DEF_ERROR_CODE(0, 0x032A)
|
||||
#define TSDB_CODE_SDB_INVALID_WAl_VER TAOS_DEF_ERROR_CODE(0, 0x032B)
|
||||
// #define TSDB_CODE_SDB_INVALID_WAl_VER TAOS_DEF_ERROR_CODE(0, 0x032B) // unused
|
||||
#define TSDB_CODE_SDB_OBJ_CREATING TAOS_DEF_ERROR_CODE(0, 0x032C)
|
||||
#define TSDB_CODE_SDB_OBJ_DROPPING TAOS_DEF_ERROR_CODE(0, 0x032D)
|
||||
|
||||
|
@ -197,22 +226,31 @@ int32_t* taosGetErrno();
|
|||
|
||||
// mnode-stable-part1
|
||||
#define TSDB_CODE_MND_STB_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0360)
|
||||
// #define TSDB_CODE_MND_INVALID_TABLE_ID TAOS_DEF_ERROR_CODE(0, 0x0361) // 2.x
|
||||
#define TSDB_CODE_MND_STB_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0362)
|
||||
// #define TSDB_CODE_MND_INVALID_TABLE_TYPE TAOS_DEF_ERROR_CODE(0, 0x0363) // 2.x
|
||||
#define TSDB_CODE_MND_TOO_MANY_TAGS TAOS_DEF_ERROR_CODE(0, 0x0364)
|
||||
#define TSDB_CODE_MND_TOO_MANY_COLUMNS TAOS_DEF_ERROR_CODE(0, 0x0365)
|
||||
// #define TSDB_CODE_MND_TOO_MANY_TIMESERIES TAOS_DEF_ERROR_CODE(0, 0x0366) // 2.x
|
||||
// #define TSDB_CODE_MND_NOT_SUPER_TABLE TAOS_DEF_ERROR_CODE(0, 0x0367) // 2.x
|
||||
// #define TSDB_CODE_MND_COL_NAME_TOO_LONG TAOS_DEF_ERROR_CODE(0, 0x0368) // 2.x
|
||||
#define TSDB_CODE_MND_TAG_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0369)
|
||||
#define TSDB_CODE_MND_TAG_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x036A)
|
||||
#define TSDB_CODE_MND_COLUMN_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x036B)
|
||||
#define TSDB_CODE_MND_COLUMN_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x036C)
|
||||
// #define TSDB_CODE_MND_INVALID_STABLE_NAME TAOS_DEF_ERROR_CODE(0, 0x036D) // 2.x
|
||||
#define TSDB_CODE_MND_INVALID_STB_OPTION TAOS_DEF_ERROR_CODE(0, 0x036E)
|
||||
#define TSDB_CODE_MND_INVALID_ROW_BYTES TAOS_DEF_ERROR_CODE(0, 0x036F)
|
||||
|
||||
// mnode-func
|
||||
#define TSDB_CODE_MND_INVALID_FUNC_NAME TAOS_DEF_ERROR_CODE(0, 0x0370)
|
||||
// #define TSDB_CODE_MND_INVALID_FUNC_LEN TAOS_DEF_ERROR_CODE(0, 0x0371) // 2.x
|
||||
#define TSDB_CODE_MND_INVALID_FUNC_CODE TAOS_DEF_ERROR_CODE(0, 0x0372)
|
||||
#define TSDB_CODE_MND_FUNC_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0373)
|
||||
#define TSDB_CODE_MND_FUNC_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0374)
|
||||
#define TSDB_CODE_MND_INVALID_FUNC_BUFSIZE TAOS_DEF_ERROR_CODE(0, 0x0375)
|
||||
// #define TSDB_CODE_MND_INVALID_TAG_LENGTH TAOS_DEF_ERROR_CODE(0, 0x0376) // 2.x
|
||||
// #define TSDB_CODE_MND_INVALID_COLUMN_LENGTH TAOS_DEF_ERROR_CODE(0, 0x0377) // 2.x
|
||||
#define TSDB_CODE_MND_INVALID_FUNC_COMMENT TAOS_DEF_ERROR_CODE(0, 0x0378)
|
||||
#define TSDB_CODE_MND_INVALID_FUNC_RETRIEVE TAOS_DEF_ERROR_CODE(0, 0x0379)
|
||||
|
||||
|
@ -278,6 +316,7 @@ int32_t* taosGetErrno();
|
|||
#define TSDB_CODE_MND_TRANS_CONFLICT TAOS_DEF_ERROR_CODE(0, 0x03D3)
|
||||
#define TSDB_CODE_MND_TRANS_CLOG_IS_NULL TAOS_DEF_ERROR_CODE(0, 0x03D4)
|
||||
#define TSDB_CODE_MND_TRANS_NETWORK_UNAVAILL TAOS_DEF_ERROR_CODE(0, 0x03D5)
|
||||
#define TSDB_CODE_MND_LAST_TRANS_NOT_FINISHED TAOS_DEF_ERROR_CODE(0, 0x03D6) //internal
|
||||
#define TSDB_CODE_MND_TRANS_UNKNOW_ERROR TAOS_DEF_ERROR_CODE(0, 0x03DF)
|
||||
|
||||
// mnode-mq
|
||||
|
@ -310,19 +349,57 @@ int32_t* taosGetErrno();
|
|||
#define TSDB_CODE_MND_INVALID_SMA_OPTION TAOS_DEF_ERROR_CODE(0, 0x0482)
|
||||
|
||||
// dnode
|
||||
#define TSDB_CODE_NODE_OFFLINE TAOS_DEF_ERROR_CODE(0, 0x0408)
|
||||
#define TSDB_CODE_NODE_ALREADY_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x0409)
|
||||
#define TSDB_CODE_NODE_NOT_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x040A)
|
||||
// #define TSDB_CODE_DND_MSG_NOT_PROCESSED TAOS_DEF_ERROR_CODE(0, 0x0400) // 2.x
|
||||
// #define TSDB_CODE_DND_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0401) // 2.x
|
||||
// #define TSDB_CODE_DND_NO_WRITE_ACCESS TAOS_DEF_ERROR_CODE(0, 0x0402) // 2.x
|
||||
// #define TSDB_CODE_DND_INVALID_MSG_LEN TAOS_DEF_ERROR_CODE(0, 0x0403) // 2.x
|
||||
// #define TSDB_CODE_DND_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x0404) // 2.x
|
||||
// #define TSDB_CODE_DND_TOO_MANY_VNODES TAOS_DEF_ERROR_CODE(0, 0x0405) // 2.x
|
||||
// #define TSDB_CODE_DND_EXITING TAOS_DEF_ERROR_CODE(0, 0x0406) // 2.x
|
||||
// #define TSDB_CODE_DND_VNODE_OPEN_FAILED TAOS_DEF_ERROR_CODE(0, 0x0407) // 2.x
|
||||
#define TSDB_CODE_DNODE_OFFLINE TAOS_DEF_ERROR_CODE(0, 0x0408)
|
||||
#define TSDB_CODE_MNODE_ALREADY_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x0409)
|
||||
#define TSDB_CODE_MNODE_NOT_FOUND TAOS_DEF_ERROR_CODE(0, 0x040A)
|
||||
#define TSDB_CODE_MNODE_NOT_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x040B)
|
||||
#define TSDB_CODE_QNODE_ALREADY_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x040C)
|
||||
#define TSDB_CODE_QNODE_NOT_FOUND TAOS_DEF_ERROR_CODE(0, 0x040D)
|
||||
#define TSDB_CODE_QNODE_NOT_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x040E)
|
||||
#define TSDB_CODE_SNODE_ALREADY_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x040F)
|
||||
#define TSDB_CODE_SNODE_NOT_FOUND TAOS_DEF_ERROR_CODE(0, 0x0410)
|
||||
#define TSDB_CODE_SNODE_NOT_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x0411)
|
||||
|
||||
// vnode
|
||||
// #define TSDB_CODE_VND_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x0500) // 2.x
|
||||
// #define TSDB_CODE_VND_MSG_NOT_PROCESSED TAOS_DEF_ERROR_CODE(0, 0x0501) // 2.x
|
||||
// #define TSDB_CODE_VND_ACTION_NEED_REPROCESS. TAOS_DEF_ERROR_CODE(0, 0x0502) // 2.x
|
||||
#define TSDB_CODE_VND_INVALID_VGROUP_ID TAOS_DEF_ERROR_CODE(0, 0x0503)
|
||||
// #define TSDB_CODE_VND_INIT_FAILED TAOS_DEF_ERROR_CODE(0, 0x0504) // 2.x
|
||||
// #define TSDB_CODE_VND_NO_DISKSPACE TAOS_DEF_ERROR_CODE(0, 0x0505) // 2.x
|
||||
// #define TSDB_CODE_VND_NO_DISK_PERMISSIONS TAOS_DEF_ERROR_CODE(0, 0x0506) // 2.x
|
||||
// #define TSDB_CODE_VND_NO_SUCH_FILE_OR_DIR TAOS_DEF_ERROR_CODE(0, 0x0507) // 2.x
|
||||
// #define TSDB_CODE_VND_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0508) // 2.x
|
||||
// #define TSDB_CODE_VND_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x0509) // 2.x
|
||||
// #define TSDB_CODE_VND_INVALID_VRESION_FILE TAOS_DEF_ERROR_CODE(0, 0x050A) // 2.x
|
||||
// #define TSDB_CODE_VND_IS_FULL TAOS_DEF_ERROR_CODE(0, 0x050B) // 2.x
|
||||
// #define TSDB_CODE_VND_IS_FLOWCTRL TAOS_DEF_ERROR_CODE(0, 0x050C) // 2.x
|
||||
// #define TSDB_CODE_VND_IS_DROPPING TAOS_DEF_ERROR_CODE(0, 0x050D) // 2.x
|
||||
// #define TSDB_CODE_VND_IS_BALANCING TAOS_DEF_ERROR_CODE(0, 0x050E) // 2.x
|
||||
// #define TSDB_CODE_VND_IS_CLOSING TAOS_DEF_ERROR_CODE(0, 0x0510) // 2.x
|
||||
// #define TSDB_CODE_VND_NOT_SYNCED TAOS_DEF_ERROR_CODE(0, 0x0511) // 2.x
|
||||
#define TSDB_CODE_VND_NO_WRITE_AUTH TAOS_DEF_ERROR_CODE(0, 0x0512)
|
||||
// #define TSDB_CODE_VND_IS_SYNCING TAOS_DEF_ERROR_CODE(0, 0x0513) // 2.x
|
||||
// #define TSDB_CODE_VND_INVALID_TSDB_STATE TAOS_DEF_ERROR_CODE(0, 0x0514) // 2.x
|
||||
// #define TSDB_CODE_WAIT_THREAD_TOO_MANY TAOS_DEF_ERROR_CODE(0, 0x0515) // 2.x
|
||||
#define TSDB_CODE_VND_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0520) // internal
|
||||
#define TSDB_CODE_VND_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0521) // internal
|
||||
#define TSDB_CODE_VND_HASH_MISMATCH TAOS_DEF_ERROR_CODE(0, 0x0522)
|
||||
#define TSDB_CODE_VND_INVALID_TABLE_ACTION TAOS_DEF_ERROR_CODE(0, 0x0524)
|
||||
#define TSDB_CODE_VND_COL_ALREADY_EXISTS TAOS_DEF_ERROR_CODE(0, 0x0525)
|
||||
#define TSDB_CODE_VND_COL_NOT_EXISTS TAOS_DEF_ERROR_CODE(0, 0x0526)
|
||||
#define TSDB_CODE_VND_COL_SUBSCRIBED TAOS_DEF_ERROR_CODE(0, 0x0527)
|
||||
#define TSDB_CODE_VND_NO_AVAIL_BUFPOOL TAOS_DEF_ERROR_CODE(0, 0x0528)
|
||||
#define TSDB_CODE_VND_STOPPED TAOS_DEF_ERROR_CODE(0, 0x0529)
|
||||
#define TSDB_CODE_VND_DUP_REQUEST TAOS_DEF_ERROR_CODE(0, 0x0530)
|
||||
|
||||
// tsdb
|
||||
#define TSDB_CODE_TDB_INVALID_TABLE_ID TAOS_DEF_ERROR_CODE(0, 0x0600)
|
||||
|
@ -332,8 +409,8 @@ int32_t* taosGetErrno();
|
|||
#define TSDB_CODE_TDB_INVALID_CONFIG TAOS_DEF_ERROR_CODE(0, 0x0604)
|
||||
#define TSDB_CODE_TDB_INIT_FAILED TAOS_DEF_ERROR_CODE(0, 0x0605)
|
||||
#define TSDB_CODE_TDB_NO_DISK_PERMISSIONS TAOS_DEF_ERROR_CODE(0, 0x0607)
|
||||
#define TSDB_CODE_TDB_FILE_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x0608)
|
||||
#define TSDB_CODE_TDB_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0609)
|
||||
// #define TSDB_CODE_TDB_FILE_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x0608) // 2.x
|
||||
// #define TSDB_CODE_TDB_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0609) // 2.x
|
||||
#define TSDB_CODE_TDB_TAG_VER_OUT_OF_DATE TAOS_DEF_ERROR_CODE(0, 0x060A)
|
||||
#define TSDB_CODE_TDB_TIMESTAMP_OUT_OF_RANGE TAOS_DEF_ERROR_CODE(0, 0x060B)
|
||||
#define TSDB_CODE_TDB_SUBMIT_MSG_MSSED_UP TAOS_DEF_ERROR_CODE(0, 0x060C)
|
||||
|
@ -347,6 +424,7 @@ int32_t* taosGetErrno();
|
|||
#define TSDB_CODE_TDB_MESSED_MSG TAOS_DEF_ERROR_CODE(0, 0x0614)
|
||||
#define TSDB_CODE_TDB_IVLD_TAG_VAL TAOS_DEF_ERROR_CODE(0, 0x0615)
|
||||
#define TSDB_CODE_TDB_NO_CACHE_LAST_ROW TAOS_DEF_ERROR_CODE(0, 0x0616)
|
||||
// #define TSDB_CODE_TDB_INCOMPLETE_DFILESET TAOS_DEF_ERROR_CODE(0, 0x0617) // 2.x
|
||||
#define TSDB_CODE_TDB_TABLE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0618)
|
||||
#define TSDB_CODE_TDB_STB_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0619)
|
||||
#define TSDB_CODE_TDB_STB_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x061A)
|
||||
|
@ -357,8 +435,9 @@ int32_t* taosGetErrno();
|
|||
// query
|
||||
#define TSDB_CODE_QRY_INVALID_QHANDLE TAOS_DEF_ERROR_CODE(0, 0x0700)
|
||||
#define TSDB_CODE_QRY_INVALID_MSG TAOS_DEF_ERROR_CODE(0, 0x0701)
|
||||
#define TSDB_CODE_QRY_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0703)
|
||||
#define TSDB_CODE_QRY_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x0704)
|
||||
// #define TSDB_CODE_QRY_NO_DISKSPACE TAOS_DEF_ERROR_CODE(0, 0x0702) // 2.x
|
||||
// #define TSDB_CODE_QRY_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0703) // 2.x
|
||||
// #define TSDB_CODE_QRY_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x0704) // 2.x
|
||||
#define TSDB_CODE_QRY_DUP_JOIN_KEY TAOS_DEF_ERROR_CODE(0, 0x0705)
|
||||
#define TSDB_CODE_QRY_EXCEED_TAGS_LIMIT TAOS_DEF_ERROR_CODE(0, 0x0706)
|
||||
#define TSDB_CODE_QRY_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x0707)
|
||||
|
@ -370,6 +449,8 @@ int32_t* taosGetErrno();
|
|||
#define TSDB_CODE_QRY_SYS_ERROR TAOS_DEF_ERROR_CODE(0, 0x070D)
|
||||
#define TSDB_CODE_QRY_INVALID_TIME_CONDITION TAOS_DEF_ERROR_CODE(0, 0x070E)
|
||||
#define TSDB_CODE_QRY_INVALID_INPUT TAOS_DEF_ERROR_CODE(0, 0x070F)
|
||||
// #define TSDB_CODE_QRY_INVALID_SCHEMA_VERSION TAOS_DEF_ERROR_CODE(0, 0x0710) // 2.x
|
||||
// #define TSDB_CODE_QRY_RESULT_TOO_LARGE TAOS_DEF_ERROR_CODE(0, 0x0711) // 2.x
|
||||
#define TSDB_CODE_QRY_SCH_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0720)
|
||||
#define TSDB_CODE_QRY_TASK_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0721)
|
||||
#define TSDB_CODE_QRY_TASK_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0722)
|
||||
|
@ -405,7 +486,17 @@ int32_t* taosGetErrno();
|
|||
#define TSDB_CODE_GRANT_TABLE_LIMITED TAOS_DEF_ERROR_CODE(0, 0x080D)
|
||||
|
||||
// sync
|
||||
// #define TSDB_CODE_SYN_INVALID_CONFIG TAOS_DEF_ERROR_CODE(0, 0x0900) // 2.x
|
||||
// #define TSDB_CODE_SYN_NOT_ENABLED TAOS_DEF_ERROR_CODE(0, 0x0901) // 2.x
|
||||
// #define TSDB_CODE_SYN_INVALID_VERSION TAOS_DEF_ERROR_CODE(0, 0x0902) // 2.x
|
||||
#define TSDB_CODE_SYN_TIMEOUT TAOS_DEF_ERROR_CODE(0, 0x0903)
|
||||
// #define TSDB_CODE_SYN_TOO_MANY_FWDINFO TAOS_DEF_ERROR_CODE(0, 0x0904) // 2.x
|
||||
// #define TSDB_CODE_SYN_MISMATCHED_PROTOCOL TAOS_DEF_ERROR_CODE(0, 0x0905) // 2.x
|
||||
// #define TSDB_CODE_SYN_MISMATCHED_CLUSTERID TAOS_DEF_ERROR_CODE(0, 0x0906) // 2.x
|
||||
// #define TSDB_CODE_SYN_MISMATCHED_SIGNATURE TAOS_DEF_ERROR_CODE(0, 0x0907) // 2.x
|
||||
// #define TSDB_CODE_SYN_INVALID_CHECKSUM TAOS_DEF_ERROR_CODE(0, 0x0908) // 2.x
|
||||
// #define TSDB_CODE_SYN_INVALID_MSGLEN TAOS_DEF_ERROR_CODE(0, 0x0909) // 2.x
|
||||
// #define TSDB_CODE_SYN_INVALID_MSGTYPE TAOS_DEF_ERROR_CODE(0, 0x090A) // 2.x
|
||||
#define TSDB_CODE_SYN_IS_LEADER TAOS_DEF_ERROR_CODE(0, 0x090B)
|
||||
#define TSDB_CODE_SYN_NOT_LEADER TAOS_DEF_ERROR_CODE(0, 0x090C)
|
||||
#define TSDB_CODE_SYN_ONE_REPLICA TAOS_DEF_ERROR_CODE(0, 0x090D)
|
||||
|
@ -415,14 +506,15 @@ int32_t* taosGetErrno();
|
|||
#define TSDB_CODE_SYN_PROPOSE_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x0911)
|
||||
#define TSDB_CODE_SYN_STANDBY_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x0912)
|
||||
#define TSDB_CODE_SYN_BATCH_ERROR TAOS_DEF_ERROR_CODE(0, 0x0913)
|
||||
#define TSDB_CODE_SYN_RESTORING TAOS_DEF_ERROR_CODE(0, 0x0914)
|
||||
#define TSDB_CODE_SYN_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x09FF)
|
||||
|
||||
// tq
|
||||
#define TSDB_CODE_TQ_INVALID_CONFIG TAOS_DEF_ERROR_CODE(0, 0x0A00)
|
||||
#define TSDB_CODE_TQ_INIT_FAILED TAOS_DEF_ERROR_CODE(0, 0x0A01)
|
||||
#define TSDB_CODE_TQ_NO_DISK_PERMISSIONS TAOS_DEF_ERROR_CODE(0, 0x0A03)
|
||||
#define TSDB_CODE_TQ_FILE_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x0A04)
|
||||
#define TSDB_CODE_TQ_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0A05)
|
||||
// #define TSDB_CODE_TQ_FILE_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x0A04)
|
||||
// #define TSDB_CODE_TQ_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0A05)
|
||||
#define TSDB_CODE_TQ_FILE_ALREADY_EXISTS TAOS_DEF_ERROR_CODE(0, 0x0A06)
|
||||
#define TSDB_CODE_TQ_FAILED_TO_CREATE_DIR TAOS_DEF_ERROR_CODE(0, 0x0A07)
|
||||
#define TSDB_CODE_TQ_META_NO_SUCH_KEY TAOS_DEF_ERROR_CODE(0, 0x0A08)
|
||||
|
@ -433,16 +525,17 @@ int32_t* taosGetErrno();
|
|||
#define TSDB_CODE_TQ_NO_COMMITTED_OFFSET TAOS_DEF_ERROR_CODE(0, 0x0A0D)
|
||||
|
||||
// wal
|
||||
#define TSDB_CODE_WAL_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x1000)
|
||||
// #define TSDB_CODE_WAL_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x1000) // 2.x
|
||||
#define TSDB_CODE_WAL_FILE_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x1001)
|
||||
#define TSDB_CODE_WAL_SIZE_LIMIT TAOS_DEF_ERROR_CODE(0, 0x1002)
|
||||
#define TSDB_CODE_WAL_INVALID_VER TAOS_DEF_ERROR_CODE(0, 0x1003)
|
||||
#define TSDB_CODE_WAL_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x1004)
|
||||
// #define TSDB_CODE_WAL_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x1004) // 2.x
|
||||
#define TSDB_CODE_WAL_LOG_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x1005)
|
||||
#define TSDB_CODE_WAL_CHKSUM_MISMATCH TAOS_DEF_ERROR_CODE(0, 0x1006)
|
||||
#define TSDB_CODE_WAL_LOG_INCOMPLETE TAOS_DEF_ERROR_CODE(0, 0x1007)
|
||||
|
||||
// tfs
|
||||
// #define TSDB_CODE_FS_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x2200) // 2.x
|
||||
#define TSDB_CODE_FS_INVLD_CFG TAOS_DEF_ERROR_CODE(0, 0x2201)
|
||||
#define TSDB_CODE_FS_TOO_MANY_MOUNT TAOS_DEF_ERROR_CODE(0, 0x2202)
|
||||
#define TSDB_CODE_FS_DUP_PRIMARY TAOS_DEF_ERROR_CODE(0, 0x2203)
|
||||
|
@ -451,7 +544,7 @@ int32_t* taosGetErrno();
|
|||
#define TSDB_CODE_FS_FILE_ALREADY_EXISTS TAOS_DEF_ERROR_CODE(0, 0x2206)
|
||||
#define TSDB_CODE_FS_INVLD_LEVEL TAOS_DEF_ERROR_CODE(0, 0x2207)
|
||||
#define TSDB_CODE_FS_NO_VALID_DISK TAOS_DEF_ERROR_CODE(0, 0x2208)
|
||||
#define TSDB_CODE_FS_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x220F)
|
||||
// #define TSDB_CODE_FS_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x220F) // 2.x
|
||||
|
||||
// catalog
|
||||
#define TSDB_CODE_CTG_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x2400)
|
||||
|
@ -606,7 +699,7 @@ int32_t* taosGetErrno();
|
|||
#define TSDB_CODE_RSMA_INVALID_ENV TAOS_DEF_ERROR_CODE(0, 0x3150)
|
||||
#define TSDB_CODE_RSMA_INVALID_STAT TAOS_DEF_ERROR_CODE(0, 0x3151)
|
||||
#define TSDB_CODE_RSMA_QTASKINFO_CREATE TAOS_DEF_ERROR_CODE(0, 0x3152)
|
||||
#define TSDB_CODE_RSMA_FILE_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x3153)
|
||||
// #define TSDB_CODE_RSMA_FILE_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x3153)
|
||||
#define TSDB_CODE_RSMA_REMOVE_EXISTS TAOS_DEF_ERROR_CODE(0, 0x3154)
|
||||
#define TSDB_CODE_RSMA_FETCH_MSG_MSSED_UP TAOS_DEF_ERROR_CODE(0, 0x3155)
|
||||
#define TSDB_CODE_RSMA_EMPTY_INFO TAOS_DEF_ERROR_CODE(0, 0x3156)
|
||||
|
|
|
@ -104,6 +104,15 @@ static FORCE_INLINE void* taosArrayPush(SArray* pArray, const void* pData) {
|
|||
return taosArrayAddBatch(pArray, pData, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief reserve the capacity of the array
|
||||
*
|
||||
* @param pArray
|
||||
* @param num
|
||||
* @return void* the start position of the reserved memory
|
||||
*/
|
||||
void* taosArrayReserve(SArray* pArray, int32_t num);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param pArray
|
||||
|
@ -196,13 +205,7 @@ SArray* taosArrayFromList(const void* src, size_t size, size_t elemSize);
|
|||
* clone a new array
|
||||
* @param pSrc
|
||||
*/
|
||||
SArray* taosArrayDup(const SArray* pSrc);
|
||||
|
||||
/**
|
||||
* deep copy a new array
|
||||
* @param pSrc
|
||||
*/
|
||||
SArray* taosArrayDeepCopy(const SArray* pSrc, FCopy deepCopy);
|
||||
SArray* taosArrayDup(const SArray* pSrc, __array_item_dup_fn_t fn);
|
||||
|
||||
/**
|
||||
* clear the array (remove all element)
|
||||
|
@ -217,15 +220,10 @@ void taosArrayClear(SArray* pArray);
|
|||
*/
|
||||
void taosArrayClearEx(SArray* pArray, void (*fp)(void*));
|
||||
|
||||
/**
|
||||
* clear the array (remove all element)
|
||||
* @param pArray
|
||||
* @param fp
|
||||
*/
|
||||
void taosArrayClearP(SArray* pArray, FDelete fp);
|
||||
|
||||
void* taosArrayDestroy(SArray* pArray);
|
||||
|
||||
void taosArrayDestroyP(SArray* pArray, FDelete fp);
|
||||
|
||||
void taosArrayDestroyEx(SArray* pArray, FDelete fp);
|
||||
|
||||
/**
|
||||
|
@ -235,12 +233,6 @@ void taosArrayDestroyEx(SArray* pArray, FDelete fp);
|
|||
*/
|
||||
void taosArraySort(SArray* pArray, __compar_fn_t comparFn);
|
||||
|
||||
/**
|
||||
* sort string array
|
||||
* @param pArray
|
||||
*/
|
||||
void taosArraySortString(SArray* pArray, __compar_fn_t comparFn);
|
||||
|
||||
/**
|
||||
* search the array
|
||||
* @param pArray
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#define _TD_UTIL_CODING_H_
|
||||
|
||||
#include "os.h"
|
||||
#include "tlog.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
@ -280,7 +280,8 @@ typedef enum ELogicConditionType {
|
|||
#define TSDB_DNODE_ROLE_MGMT 1
|
||||
#define TSDB_DNODE_ROLE_VNODE 2
|
||||
|
||||
#define TSDB_MAX_REPLICA 5
|
||||
#define TSDB_MAX_REPLICA 5
|
||||
#define TSDB_SYNC_LOG_BUFFER_SIZE 4096
|
||||
|
||||
#define TSDB_TBNAME_COLUMN_INDEX (-1)
|
||||
#define TSDB_MULTI_TABLEMETA_MAX_NUM 100000 // maximum batch size allowed to load table meta
|
||||
|
@ -306,8 +307,9 @@ typedef enum ELogicConditionType {
|
|||
#define TSDB_MIN_DURATION_PER_FILE 60 // unit minute
|
||||
#define TSDB_MAX_DURATION_PER_FILE (3650 * 1440)
|
||||
#define TSDB_DEFAULT_DURATION_PER_FILE (10 * 1440)
|
||||
#define TSDB_MIN_KEEP (1 * 1440) // data in db to be reserved. unit minute
|
||||
#define TSDB_MAX_KEEP (365000 * 1440) // data in db to be reserved.
|
||||
#define TSDB_MIN_KEEP (1 * 1440) // data in db to be reserved. unit minute
|
||||
#define TSDB_MAX_KEEP (365000 * 1440) // data in db to be reserved.
|
||||
#define TSDB_MAX_KEEP_NS (365 * 292 * 1440) // data in db to be reserved.
|
||||
#define TSDB_DEFAULT_KEEP (3650 * 1440) // ten years
|
||||
#define TSDB_MIN_MINROWS_FBLOCK 10
|
||||
#define TSDB_MAX_MINROWS_FBLOCK 1000
|
||||
|
@ -380,13 +382,16 @@ typedef enum ELogicConditionType {
|
|||
#define TSDB_DB_MIN_WAL_SEGMENT_SIZE 0
|
||||
#define TSDB_DEFAULT_DB_WAL_SEGMENT_SIZE 0
|
||||
|
||||
#define TSDB_MIN_ROLLUP_MAX_DELAY 1 // unit millisecond
|
||||
#define TSDB_MAX_ROLLUP_MAX_DELAY (15 * 60 * 1000)
|
||||
#define TSDB_MIN_ROLLUP_WATERMARK 0 // unit millisecond
|
||||
#define TSDB_MAX_ROLLUP_WATERMARK (15 * 60 * 1000)
|
||||
#define TSDB_DEFAULT_ROLLUP_WATERMARK 5000
|
||||
#define TSDB_MIN_TABLE_TTL 0
|
||||
#define TSDB_DEFAULT_TABLE_TTL 0
|
||||
#define TSDB_MIN_ROLLUP_MAX_DELAY 1 // unit millisecond
|
||||
#define TSDB_MAX_ROLLUP_MAX_DELAY (15 * 60 * 1000)
|
||||
#define TSDB_MIN_ROLLUP_WATERMARK 0 // unit millisecond
|
||||
#define TSDB_MAX_ROLLUP_WATERMARK (15 * 60 * 1000)
|
||||
#define TSDB_DEFAULT_ROLLUP_WATERMARK 5000
|
||||
#define TSDB_MIN_ROLLUP_DELETE_MARK 0 // unit millisecond
|
||||
#define TSDB_MAX_ROLLUP_DELETE_MARK INT64_MAX
|
||||
#define TSDB_DEFAULT_ROLLUP_DELETE_MARK 900000 // 900s
|
||||
#define TSDB_MIN_TABLE_TTL 0
|
||||
#define TSDB_DEFAULT_TABLE_TTL 0
|
||||
|
||||
#define TSDB_MIN_EXPLAIN_RATIO 0
|
||||
#define TSDB_MAX_EXPLAIN_RATIO 1
|
||||
|
@ -406,7 +411,7 @@ typedef enum ELogicConditionType {
|
|||
#ifdef WINDOWS
|
||||
#define TSDB_MAX_RPC_THREADS 4 // windows pipe only support 4 connections.
|
||||
#else
|
||||
#define TSDB_MAX_RPC_THREADS 10
|
||||
#define TSDB_MAX_RPC_THREADS 20
|
||||
#endif
|
||||
|
||||
#define TSDB_QUERY_TYPE_NON_TYPE 0x00u // none type
|
||||
|
|
|
@ -225,7 +225,7 @@ void *tdListFree(SList *list);
|
|||
void tdListPrependNode(SList *list, SListNode *node);
|
||||
void tdListAppendNode(SList *list, SListNode *node);
|
||||
int32_t tdListPrepend(SList *list, void *data);
|
||||
int32_t tdListAppend(SList *list, void *data);
|
||||
int32_t tdListAppend(SList *list, const void *data);
|
||||
SListNode *tdListPopHead(SList *list);
|
||||
SListNode *tdListPopTail(SList *list);
|
||||
SListNode *tdListGetHead(SList *list);
|
||||
|
|
|
@ -38,6 +38,7 @@ typedef void (*LogFp)(int64_t ts, ELogLevel level, const char *content);
|
|||
|
||||
extern bool tsLogEmbedded;
|
||||
extern bool tsAsyncLog;
|
||||
extern bool tsAssert;
|
||||
extern int32_t tsNumOfLogLines;
|
||||
extern int32_t tsLogKeepDays;
|
||||
extern LogFp tsLogFp;
|
||||
|
@ -82,6 +83,10 @@ void taosPrintLongString(const char *flags, ELogLevel level, int32_t dflag, cons
|
|||
#endif
|
||||
;
|
||||
|
||||
bool taosAssert(bool condition, const char *file, int32_t line, const char *format, ...);
|
||||
#define ASSERTS(condition, ...) taosAssert(condition, __FILE__, __LINE__, __VA_ARGS__)
|
||||
#define ASSERT(condition) ASSERTS(condition, "assert info not provided")
|
||||
|
||||
// clang-format off
|
||||
#define uFatal(...) { if (uDebugFlag & DEBUG_FATAL) { taosPrintLog("UTL FATAL", DEBUG_FATAL, tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }}
|
||||
#define uError(...) { if (uDebugFlag & DEBUG_ERROR) { taosPrintLog("UTL ERROR ", DEBUG_ERROR, tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue