other:merge 3.0

This commit is contained in:
Haojun Liao 2022-09-26 14:50:51 +08:00
commit 54712ae302
208 changed files with 6985 additions and 4580 deletions

2
Jenkinsfile vendored
View File

@ -79,7 +79,7 @@ def pre_test(){
rm -rf debug rm -rf debug
mkdir debug mkdir debug
cd debug cd debug
cmake .. > /dev/null cmake .. -DBUILD_TEST=true > /dev/null
make -j4> /dev/null make -j4> /dev/null
''' '''

View File

@ -173,7 +173,7 @@ def pre_test_build_mac() {
''' '''
sh ''' sh '''
cd ${WK}/debug cd ${WK}/debug
cmake .. cmake .. -DBUILD_TEST=true
make -j8 make -j8
''' '''
sh ''' sh '''
@ -218,12 +218,12 @@ def pre_test_win(){
if (env.CHANGE_URL =~ /\/TDengine\//) { if (env.CHANGE_URL =~ /\/TDengine\//) {
bat ''' bat '''
cd %WIN_INTERNAL_ROOT% cd %WIN_INTERNAL_ROOT%
git pull git pull origin ''' + env.CHANGE_TARGET + '''
''' '''
bat ''' bat '''
cd %WIN_COMMUNITY_ROOT% cd %WIN_COMMUNITY_ROOT%
git remote prune origin git remote prune origin
git pull git pull origin ''' + env.CHANGE_TARGET + '''
''' '''
bat ''' bat '''
cd %WIN_COMMUNITY_ROOT% cd %WIN_COMMUNITY_ROOT%
@ -236,7 +236,7 @@ def pre_test_win(){
} else if (env.CHANGE_URL =~ /\/TDinternal\//) { } else if (env.CHANGE_URL =~ /\/TDinternal\//) {
bat ''' bat '''
cd %WIN_INTERNAL_ROOT% cd %WIN_INTERNAL_ROOT%
git pull git pull origin ''' + env.CHANGE_TARGET + '''
''' '''
bat ''' bat '''
cd %WIN_INTERNAL_ROOT% cd %WIN_INTERNAL_ROOT%
@ -302,7 +302,7 @@ def pre_test_build_win() {
set CL=/MP8 set CL=/MP8
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> cmake" echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> cmake"
time /t time /t
cmake .. -G "NMake Makefiles JOM" || exit 7 cmake .. -G "NMake Makefiles JOM" -DBUILD_TEST=true || exit 7
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> jom -j 6" echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> jom -j 6"
time /t time /t
jom -j 6 || exit 8 jom -j 6 || exit 8

View File

@ -321,7 +321,11 @@ TDengine provides abundant developing tools for users to develop on TDengine. Fo
Please follow the [contribution guidelines](CONTRIBUTING.md) to contribute to the project. Please follow the [contribution guidelines](CONTRIBUTING.md) to contribute to the project.
# Join TDengine User Community # Join the TDengine Community
- Join [TDengine Discord Channel](https://discord.com/invite/VZdSuUg4pS?utm_id=discord) For more information about TDengine, you can follow us on social media and join our Discord server:
- Join wechat group by adding WeChat “tdengine”
- [Discord](https://discord.com/invite/VZdSuUg4pS)
- [Twitter](https://twitter.com/TaosData)
- [LinkedIn](https://www.linkedin.com/company/tdengine/)
- [YouTube](https://www.youtube.com/channel/UCmp-1U6GS_3V3hjir6Uq5DQ)

View File

@ -2,6 +2,12 @@
# Deps options # Deps options
# ========================================================= # =========================================================
option(
BUILD_TEST
"If build unit tests using googletest"
OFF
)
IF(${TD_WINDOWS}) IF(${TD_WINDOWS})
MESSAGE("build pthread Win32") MESSAGE("build pthread Win32")
@ -45,12 +51,6 @@ IF(${TD_WINDOWS})
"If build wingetopt on Windows" "If build wingetopt on Windows"
ON ON
) )
option(
BUILD_TEST
"If build unit tests using googletest"
ON
)
option( option(
TDENGINE_3 TDENGINE_3
@ -65,28 +65,8 @@ IF(${TD_WINDOWS})
) )
ELSEIF (TD_DARWIN_64) ELSEIF (TD_DARWIN_64)
add_definitions(-DCOMPILER_SUPPORTS_CXX13) IF(${BUILD_TEST})
option(
BUILD_TEST
"If build unit tests using googletest"
ON
)
ELSE ()
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++13" COMPILER_SUPPORTS_CXX13)
IF(${COMPILER_SUPPORTS_CXX13})
add_definitions(-DCOMPILER_SUPPORTS_CXX13) add_definitions(-DCOMPILER_SUPPORTS_CXX13)
option(
BUILD_TEST
"If build unit tests using googletest"
ON
)
ELSE ()
option(
BUILD_TEST
"If build unit tests using googletest"
OFF
)
ENDIF () ENDIF ()
ENDIF () ENDIF ()

View File

@ -2,7 +2,7 @@
# taosadapter # taosadapter
ExternalProject_Add(taosadapter ExternalProject_Add(taosadapter
GIT_REPOSITORY https://github.com/taosdata/taosadapter.git GIT_REPOSITORY https://github.com/taosdata/taosadapter.git
GIT_TAG 05fb2ff GIT_TAG be729ab
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter" SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter"
BINARY_DIR "" BINARY_DIR ""
#BUILD_IN_SOURCE TRUE #BUILD_IN_SOURCE TRUE

View File

@ -2,7 +2,7 @@
# taos-tools # taos-tools
ExternalProject_Add(taos-tools ExternalProject_Add(taos-tools
GIT_REPOSITORY https://github.com/taosdata/taos-tools.git GIT_REPOSITORY https://github.com/taosdata/taos-tools.git
GIT_TAG 8207c74 GIT_TAG cf1df1c
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools" SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools"
BINARY_DIR "" BINARY_DIR ""
#BUILD_IN_SOURCE TRUE #BUILD_IN_SOURCE TRUE

View File

@ -5,8 +5,8 @@ title: Quick Install on Docker
This document describes how to install TDengine in a Docker container and perform queries and inserts. This document describes how to install TDengine in a Docker container and perform queries and inserts.
- The easiest way to explore TDengine is through [TDengine Cloud](http://cloud.tdengine.com).
- To get started with TDengine in a non-containerized environment, see [Quick Install from Package](../../get-started/package). - To get started with TDengine in a non-containerized environment, see [Quick Install from Package](../../get-started/package).
- For a fully managed solution, see the [TDengine Cloud documentation](/cloud/).
- If you want to view the source code, build TDengine yourself, or contribute to the project, see the [TDengine GitHub repository](https://github.com/taosdata/TDengine). - If you want to view the source code, build TDengine yourself, or contribute to the project, see the [TDengine GitHub repository](https://github.com/taosdata/TDengine).
## Run TDengine ## Run TDengine

View File

@ -9,8 +9,8 @@ import PkgListV3 from "/components/PkgListV3";
This document describes how to install TDengine on Linux and Windows and perform queries and inserts. This document describes how to install TDengine on Linux and Windows and perform queries and inserts.
- The easiest way to explore TDengine is through [TDengine Cloud](http://cloud.tdengine.com).
- To get started with TDengine on Docker, see [Quick Install on Docker](../../get-started/docker). - To get started with TDengine on Docker, see [Quick Install on Docker](../../get-started/docker).
- For a fully managed solution, see the [TDengine Cloud documentation](/cloud/).
- If you want to view the source code, build TDengine yourself, or contribute to the project, see the [TDengine GitHub repository](https://github.com/taosdata/TDengine). - If you want to view the source code, build TDengine yourself, or contribute to the project, see the [TDengine GitHub repository](https://github.com/taosdata/TDengine).
The full package of TDengine includes the TDengine Server (`taosd`), TDengine Client (`taosc`), taosAdapter for connecting with third-party systems and providing a RESTful interface, a command-line interface (CLI, taos), and some tools. Note that taosAdapter supports Linux only. In addition to connectors for multiple languages, TDengine also provides a [REST API](../../reference/rest-api) through [taosAdapter](../../reference/taosadapter). The full package of TDengine includes the TDengine Server (`taosd`), TDengine Client (`taosc`), taosAdapter for connecting with third-party systems and providing a RESTful interface, a command-line interface (CLI, taos), and some tools. Note that taosAdapter supports Linux only. In addition to connectors for multiple languages, TDengine also provides a [REST API](../../reference/rest-api) through [taosAdapter](../../reference/taosadapter).

View File

@ -1,8 +1,7 @@
```csharp title="Native Connection" ```csharp title="Native Connection"
{{#include docs/examples/csharp/ConnectExample.cs}} {{#include docs/examples/csharp/connect/Program.cs}}
``` ```
:::info ```csharp title="WebSocket Connection"
C# connector supports only native connection for now. {{#include docs/examples/csharp/wsConnect/Program.cs}}
```
:::

View File

@ -1,3 +1,3 @@
```csharp ```csharp
{{#include docs/examples/csharp/InfluxDBLineExample.cs}} {{#include docs/examples/csharp/influxdbLine/Program.cs}}
``` ```

View File

@ -1,3 +1,3 @@
```csharp ```csharp
{{#include docs/examples/csharp/OptsJsonExample.cs}} {{#include docs/examples/csharp/optsJSON/Program.cs}}
``` ```

View File

@ -1,3 +1,3 @@
```csharp ```csharp
{{#include docs/examples/csharp/OptsTelnetExample.cs}} {{#include docs/examples/csharp/optsTelnet/Program.cs}}
``` ```

View File

@ -1,3 +1,3 @@
```csharp ```csharp
{{#include docs/examples/csharp/SQLInsertExample.cs}} {{#include docs/examples/csharp/sqlInsert/Program.cs}}
``` ```

View File

@ -1,3 +1,3 @@
```csharp ```csharp
{{#include docs/examples/csharp/StmtInsertExample.cs}} {{#include docs/examples/csharp/stmtInsert/Program.cs}}
``` ```

View File

@ -1,3 +1,3 @@
```csharp ```csharp
{{#include docs/examples/csharp/QueryExample.cs}} {{#include docs/examples/csharp/query/Program.cs}}
``` ```

View File

@ -1,3 +1,3 @@
```csharp ```csharp
{{#include docs/examples/csharp/AsyncQueryExample.cs}} {{#include docs/examples/csharp/asyncQuery/Program.cs}}
``` ```

View File

@ -1,3 +1,3 @@
```csharp ```csharp
{{#include docs/examples/csharp/SubscribeDemo.cs}} {{#include docs/examples/csharp/subscribe/Program.cs}}
``` ```

View File

@ -123,7 +123,7 @@ where `TOKEN` is the string after Base64 encoding of `{username}:{password}`, e.
### HTTP body structure ### HTTP body structure
#### Successful Operation #### Successful Insert Operation
Example: Example:
@ -143,7 +143,7 @@ Description:
- rows: (`int`) Only returns `1`. - rows: (`int`) Only returns `1`.
- data: (`[][]any`) Returns the number of rows affected. - data: (`[][]any`) Returns the number of rows affected.
#### Successful Query #### Successful Query Operation
Example: Example:

View File

@ -116,7 +116,7 @@ The parameters are described as follows:
- **protocol**: Specify which connection method to use. For example, `taos+ws://localhost:6041` uses Websocket to establish connections. - **protocol**: Specify which connection method to use. For example, `taos+ws://localhost:6041` uses Websocket to establish connections.
- **username/password**: Username and password used to create connections. - **username/password**: Username and password used to create connections.
- **host/port**: Specifies the server and port to establish a connection. If you do not specify a hostname or port, native connections default to `localhost:6030` and Websocket connections default to `localhost:6041`. - **host/port**: Specifies the server and port to establish a connection. If you do not specify a hostname or port, native connections default to `localhost:6030` and Websocket connections default to `localhost:6041`.
- **database**: Specify the default database to connect to. - **database**: Specify the default database to connect to. It's optional.
- **params**Optional parameters. - **params**Optional parameters.
A sample DSN description string is as follows: A sample DSN description string is as follows:

View File

@ -17,7 +17,7 @@ import CSAsyncQuery from "../../07-develop/04-query-data/_cs_async.mdx"
`TDengine.Connector` is a C# language connector provided by TDengine that allows C# developers to develop C# applications that access TDengine cluster data. `TDengine.Connector` is a C# language connector provided by TDengine that allows C# developers to develop C# applications that access TDengine cluster data.
The `TDengine.Connector` connector supports connect to TDengine instances via the TDengine client driver (taosc), providing data writing, querying, subscription, schemaless writing, bind interface, etc. The `TDengine.Connector` currently does not provide a REST connection interface. Developers can write their RESTful application by referring to the [REST API](/reference/rest-api/) documentation. The `TDengine.Connector` connector supports connect to TDengine instances via the TDengine client driver (taosc), providing data writing, querying, subscription, schemaless writing, bind interface, etc.The `TDengine.Connector` also supports WebSocket and developers can build connection through DSN, which supports data writing, querying, and parameter binding, etc.
This article describes how to install `TDengine.Connector` in a Linux or Windows environment and connect to TDengine clusters via `TDengine.Connector` to perform basic operations such as data writing and querying. This article describes how to install `TDengine.Connector` in a Linux or Windows environment and connect to TDengine clusters via `TDengine.Connector` to perform basic operations such as data writing and querying.
@ -35,6 +35,10 @@ Please refer to [version support list](/reference/connector#version-support)
## Supported features ## Supported features
<Tabs defaultValue="native">
<TabItem value="native" label="Native Connection">
1. Connection Management 1. Connection Management
2. General Query 2. General Query
3. Continuous Query 3. Continuous Query
@ -42,6 +46,18 @@ Please refer to [version support list](/reference/connector#version-support)
5. Subscription 5. Subscription
6. Schemaless 6. Schemaless
</TabItem>
<TabItem value="rest" label="WebSocket Connection">
1. Connection Management
2. General Query
3. Continuous Query
4. Parameter Binding
</TabItem>
</Tabs>
## Installation Steps ## Installation Steps
### Pre-installation preparation ### Pre-installation preparation
@ -74,12 +90,18 @@ cp -r src/ myProject
cd myProject cd myProject
dotnet add exmaple.csproj reference src/TDengine.csproj dotnet add exmaple.csproj reference src/TDengine.csproj
``` ```
</TabItem> </TabItem>
</Tabs> </Tabs>
## Establish a Connection ## Establish a Connection
``` C#
<Tabs defaultValue="native">
<TabItem value="native" label="Native Connection">
``` csharp
using TDengineDriver; using TDengineDriver;
namespace TDengineExample namespace TDengineExample
@ -112,14 +134,62 @@ namespace TDengineExample
``` ```
</TabItem>
<TabItem value="rest" label="WebSocket Connection">
The structure of the DSN description string is as follows:
```text
[<protocol>]://[[<username>:<password>@]<host>:<port>][/<database>][?<p1>=<v1>[&<p2>=<v2>]]
|------------|---|-----------|-----------|------|------|------------|-----------------------|
| protocol | | username | password | host | port | database | params |
```
The parameters are described as follows:
* **protocol**: Specify which connection method to use (support http/ws). For example, `ws://localhost:6041` uses Websocket to establish connections.
* **username/password**: Username and password used to create connections.
* **host/port**: Specifies the server and port to establish a connection. Websocket connections default to `localhost:6041`.
* **database**: Specify the default database to connect to. It's optional.
* **params**Optional parameters.
A sample DSN description string is as follows:
```text
ws://localhost:6041/test
```
``` csharp
{{#include docs/examples/csharp/wsConnect/Program.cs}}
```
</TabItem>
</Tabs>
## Usage examples ## Usage examples
### Write data ### Write data
#### SQL Write #### SQL Write
<Tabs defaultValue="native">
<TabItem value="native" label="Native Connection">
<CSInsert /> <CSInsert />
</TabItem>
<TabItem value="rest" label="WebSocket Connection">
```csharp
{{#include docs/examples/csharp/wsInsert/Program.cs}}
```
</TabItem>
</Tabs>
#### InfluxDB line protocol write #### InfluxDB line protocol write
<CSInfluxLine /> <CSInfluxLine />
@ -132,12 +202,48 @@ namespace TDengineExample
<CSOpenTSDBJson /> <CSOpenTSDBJson />
#### Parameter Binding
<Tabs defaultValue="native">
<TabItem value="native" label="Native Connection">
``` csharp
{{#include docs/examples/csharp/stmtInsert/Program.cs}}
```
</TabItem>
<TabItem value="rest" label="WebSocket Connection">
```csharp
{{#include docs/examples/csharp/wsStmt/Program.cs}}
```
</TabItem>
</Tabs>
### Query data ### Query data
#### Synchronous Query #### Synchronous Query
<Tabs defaultValue="native">
<TabItem value="native" label="Native Connection">
<CSQuery /> <CSQuery />
</TabItem>
<TabItem value="rest" label="WebSocket Connection">
```csharp
{{#include docs/examples/csharp/wsQuery/Program.cs}}
```
</TabItem>
</Tabs>
#### Asynchronous query #### Asynchronous query
<CSAsyncQuery /> <CSAsyncQuery />
@ -145,18 +251,21 @@ namespace TDengineExample
### More sample programs ### More sample programs
|Sample program |Sample program description | |Sample program |Sample program description |
|--------------------------------------------------------------------------------------------------------------------|------------ --------------------------------| |--------------------------------------------------------------------------------------------------------------------|--------------------------------------------|
| [CURD](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/Query/Query.cs) | Table creation, data insertion, and query examples with TDengine.Connector | | [CURD](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/Query/Query.cs) | Table creation, data insertion, and query examples with TDengine.Connector |
| [JSON Tag](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/JSONTag) | Writing and querying JSON tag data with TDengine Connector | | [JSON Tag](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/JSONTag) | Writing and querying JSON tag data with TDengine Connector |
| [stmt](https://github.com/taosdata/taos-connector-dotnet/tree/3.0/examples/Stmt) | Parameter binding with TDengine Connector | | [stmt](https://github.com/taosdata/taos-connector-dotnet/tree/3.0/examples/Stmt) | Parameter binding with TDengine Connector |
| [schemaless](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/schemaless) | Schemaless writes with TDengine Connector | | [schemaless](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/schemaless) | Schemaless writes with TDengine Connector |
| [async query](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/AsyncQuery/QueryAsync.cs) | Asynchronous queries with TDengine Connector | | [async query](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/AsyncQuery/QueryAsync.cs) | Asynchronous queries with TDengine Connector |
| [TMQ](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/TMQ/TMQ.cs) | Data subscription with TDengine Connector | | [Subscription](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/TMQ/TMQ.cs) | Subscription example with TDengine Connector |
| [Basic WebSocket Usage](https://github.com/taosdata/taos-connector-dotnet/blob/5a4a7cd0dbcda114447cdc6d0c6dedd8e84a52da/examples/WS/WebSocketSample.cs) | WebSocket basic data in and out with TDengine connector |
| [WebSocket Parameter Binding](https://github.com/taosdata/taos-connector-dotnet/blob/5a4a7cd0dbcda114447cdc6d0c6dedd8e84a52da/examples/WS/WebSocketSTMT.cs) | WebSocket parameter binding example |
## Important update records ## Important update records
| TDengine.Connector | Description | | TDengine.Connector | Description |
|--------------------|--------------------------------| |--------------------|--------------------------------|
| 3.0.1 | Support WebSocket and CloudWith function query, insert, and parameter binding|
| 3.0.0 | Supports TDengine 3.0.0.0. TDengine 2.x is not supported. Added `TDengine.Impl.GetData()` interface to deserialize query results. | | 3.0.0 | Supports TDengine 3.0.0.0. TDengine 2.x is not supported. Added `TDengine.Impl.GetData()` interface to deserialize query results. |
| 1.0.7 | Fixed TDengine.Query() memory leak. | | 1.0.7 | Fixed TDengine.Query() memory leak. |
| 1.0.6 | Fix schemaless bug in 1.0.4 and 1.0.5. | | 1.0.6 | Fix schemaless bug in 1.0.4 and 1.0.5. |

View File

@ -164,7 +164,7 @@ The parameters described in this document by the effect that they have on the sy
| Attribute | Description | | Attribute | Description |
| -------- | -------------------- | | -------- | -------------------- |
| Applicable | Client only | | Applicable | Client only |
| 含义 | SMA index optimization policy | | Meaning | SMA index optimization policy |
| Unit | None | | Unit | None |
| Default Value | 0 | | Default Value | 0 |
| Notes | | Notes |
@ -325,7 +325,7 @@ The charset that takes effect is UTF-8.
| Applicable | Server Only | | Applicable | Server Only |
| Meaning | Maximum number of vnodes per dnode | | Meaning | Maximum number of vnodes per dnode |
| Value Range | 0-4096 | | Value Range | 0-4096 |
| Default Value | 256 | | Default Value | 2x the CPU cores |
## Time Parameters ## Time Parameters
@ -697,152 +697,154 @@ To prevent system resource from being exhausted by multiple concurrent streams,
| 15 | telemetryPort | No | Yes | | 15 | telemetryPort | No | Yes |
| 16 | queryPolicy | No | Yes | | 16 | queryPolicy | No | Yes |
| 17 | querySmaOptimize | No | Yes | | 17 | querySmaOptimize | No | Yes |
| 18 | queryBufferSize | Yes | Yes | | 18 | queryRsmaTolerance | No | Yes |
| 19 | maxNumOfDistinctRes | Yes | Yes | | 19 | queryBufferSize | Yes | Yes |
| 20 | minSlidingTime | Yes | Yes | | 20 | maxNumOfDistinctRes | Yes | Yes |
| 21 | minIntervalTime | Yes | Yes | | 21 | minSlidingTime | Yes | Yes |
| 22 | countAlwaysReturnValue | Yes | Yes | | 22 | minIntervalTime | Yes | Yes |
| 23 | dataDir | Yes | Yes | | 23 | countAlwaysReturnValue | Yes | Yes |
| 24 | minimalDataDirGB | Yes | Yes | | 24 | dataDir | Yes | Yes |
| 25 | supportVnodes | No | Yes | | 25 | minimalDataDirGB | Yes | Yes |
| 26 | tempDir | Yes | Yes | | 26 | supportVnodes | No | Yes |
| 27 | minimalTmpDirGB | Yes | Yes | | 27 | tempDir | Yes | Yes |
| 28 | compressMsgSize | Yes | Yes | | 28 | minimalTmpDirGB | Yes | Yes |
| 29 | compressColData | Yes | Yes | | 29 | compressMsgSize | Yes | Yes |
| 30 | smlChildTableName | Yes | Yes | | 30 | compressColData | Yes | Yes |
| 31 | smlTagName | Yes | Yes | | 31 | smlChildTableName | Yes | Yes |
| 32 | smlDataFormat | No | Yes | | 32 | smlTagName | Yes | Yes |
| 33 | statusInterval | Yes | Yes | | 33 | smlDataFormat | No | Yes |
| 34 | shellActivityTimer | Yes | Yes | | 34 | statusInterval | Yes | Yes |
| 35 | transPullupInterval | No | Yes | | 35 | shellActivityTimer | Yes | Yes |
| 36 | mqRebalanceInterval | No | Yes | | 36 | transPullupInterval | No | Yes |
| 37 | ttlUnit | No | Yes | | 37 | mqRebalanceInterval | No | Yes |
| 38 | ttlPushInterval | No | Yes | | 38 | ttlUnit | No | Yes |
| 39 | numOfTaskQueueThreads | No | Yes | | 39 | ttlPushInterval | No | Yes |
| 40 | numOfRpcThreads | No | Yes | | 40 | numOfTaskQueueThreads | No | Yes |
| 41 | numOfCommitThreads | Yes | Yes | | 41 | numOfRpcThreads | No | Yes |
| 42 | numOfMnodeReadThreads | No | Yes | | 42 | numOfCommitThreads | Yes | Yes |
| 43 | numOfVnodeQueryThreads | No | Yes | | 43 | numOfMnodeReadThreads | No | Yes |
| 44 | numOfVnodeStreamThreads | No | Yes | | 44 | numOfVnodeQueryThreads | No | Yes |
| 45 | numOfVnodeFetchThreads | No | Yes | | 45 | numOfVnodeStreamThreads | No | Yes |
| 46 | numOfVnodeWriteThreads | No | Yes | | 46 | numOfVnodeFetchThreads | No | Yes |
| 47 | numOfVnodeSyncThreads | No | Yes | | 47 | numOfVnodeWriteThreads | No | Yes |
| 48 | numOfQnodeQueryThreads | No | Yes | | 48 | numOfVnodeSyncThreads | No | Yes |
| 49 | numOfQnodeFetchThreads | No | Yes | | 49 | numOfVnodeRsmaThreads | No | Yes |
| 50 | numOfSnodeSharedThreads | No | Yes | | 50 | numOfQnodeQueryThreads | No | Yes |
| 51 | numOfSnodeUniqueThreads | No | Yes | | 51 | numOfQnodeFetchThreads | No | Yes |
| 52 | rpcQueueMemoryAllowed | No | Yes | | 52 | numOfSnodeSharedThreads | No | Yes |
| 53 | logDir | Yes | Yes | | 53 | numOfSnodeUniqueThreads | No | Yes |
| 54 | minimalLogDirGB | Yes | Yes | | 54 | rpcQueueMemoryAllowed | No | Yes |
| 55 | numOfLogLines | Yes | Yes | | 55 | logDir | Yes | Yes |
| 56 | asyncLog | Yes | Yes | | 56 | minimalLogDirGB | Yes | Yes |
| 57 | logKeepDays | Yes | Yes | | 57 | numOfLogLines | Yes | Yes |
| 58 | debugFlag | Yes | Yes | | 58 | asyncLog | Yes | Yes |
| 59 | tmrDebugFlag | Yes | Yes | | 59 | logKeepDays | Yes | Yes |
| 60 | uDebugFlag | Yes | Yes | | 60 | debugFlag | Yes | Yes |
| 61 | rpcDebugFlag | Yes | Yes | | 61 | tmrDebugFlag | Yes | Yes |
| 62 | jniDebugFlag | Yes | Yes | | 62 | uDebugFlag | Yes | Yes |
| 63 | qDebugFlag | Yes | Yes | | 63 | rpcDebugFlag | Yes | Yes |
| 64 | cDebugFlag | Yes | Yes | | 64 | jniDebugFlag | Yes | Yes |
| 65 | dDebugFlag | Yes | Yes | | 65 | qDebugFlag | Yes | Yes |
| 66 | vDebugFlag | Yes | Yes | | 66 | cDebugFlag | Yes | Yes |
| 67 | mDebugFlag | Yes | Yes | | 67 | dDebugFlag | Yes | Yes |
| 68 | wDebugFlag | Yes | Yes | | 68 | vDebugFlag | Yes | Yes |
| 69 | sDebugFlag | Yes | Yes | | 69 | mDebugFlag | Yes | Yes |
| 70 | tsdbDebugFlag | Yes | Yes | | 70 | wDebugFlag | Yes | Yes |
| 71 | tqDebugFlag | No | Yes | | 71 | sDebugFlag | Yes | Yes |
| 72 | fsDebugFlag | Yes | Yes | | 72 | tsdbDebugFlag | Yes | Yes |
| 73 | udfDebugFlag | No | Yes | | 73 | tqDebugFlag | No | Yes |
| 74 | smaDebugFlag | No | Yes | | 74 | fsDebugFlag | Yes | Yes |
| 75 | idxDebugFlag | No | Yes | | 75 | udfDebugFlag | No | Yes |
| 76 | tdbDebugFlag | No | Yes | | 76 | smaDebugFlag | No | Yes |
| 77 | metaDebugFlag | No | Yes | | 77 | idxDebugFlag | No | Yes |
| 78 | timezone | Yes | Yes | | 78 | tdbDebugFlag | No | Yes |
| 79 | locale | Yes | Yes | | 79 | metaDebugFlag | No | Yes |
| 80 | charset | Yes | Yes | | 80 | timezone | Yes | Yes |
| 81 | udf | Yes | Yes | | 81 | locale | Yes | Yes |
| 82 | enableCoreFile | Yes | Yes | | 82 | charset | Yes | Yes |
| 83 | arbitrator | Yes | No | | 83 | udf | Yes | Yes |
| 84 | numOfThreadsPerCore | Yes | No | | 84 | enableCoreFile | Yes | Yes |
| 85 | numOfMnodes | Yes | No | | 85 | arbitrator | Yes | No |
| 86 | vnodeBak | Yes | No | | 86 | numOfThreadsPerCore | Yes | No |
| 87 | balance | Yes | No | | 87 | numOfMnodes | Yes | No |
| 88 | balanceInterval | Yes | No | | 88 | vnodeBak | Yes | No |
| 89 | offlineThreshold | Yes | No | | 89 | balance | Yes | No |
| 90 | role | Yes | No | | 90 | balanceInterval | Yes | No |
| 91 | dnodeNopLoop | Yes | No | | 91 | offlineThreshold | Yes | No |
| 92 | keepTimeOffset | Yes | No | | 92 | role | Yes | No |
| 93 | rpcTimer | Yes | No | | 93 | dnodeNopLoop | Yes | No |
| 94 | rpcMaxTime | Yes | No | | 94 | keepTimeOffset | Yes | No |
| 95 | rpcForceTcp | Yes | No | | 95 | rpcTimer | Yes | No |
| 96 | tcpConnTimeout | Yes | No | | 96 | rpcMaxTime | Yes | No |
| 97 | syncCheckInterval | Yes | No | | 97 | rpcForceTcp | Yes | No |
| 98 | maxTmrCtrl | Yes | No | | 98 | tcpConnTimeout | Yes | No |
| 99 | monitorReplica | Yes | No | | 99 | syncCheckInterval | Yes | No |
| 100 | smlTagNullName | Yes | No | | 100 | maxTmrCtrl | Yes | No |
| 101 | keepColumnName | Yes | No | | 101 | monitorReplica | Yes | No |
| 102 | ratioOfQueryCores | Yes | No | | 102 | smlTagNullName | Yes | No |
| 103 | maxStreamCompDelay | Yes | No | | 103 | keepColumnName | Yes | No |
| 104 | maxFirstStreamCompDelay | Yes | No | | 104 | ratioOfQueryCores | Yes | No |
| 105 | retryStreamCompDelay | Yes | No | | 105 | maxStreamCompDelay | Yes | No |
| 106 | streamCompDelayRatio | Yes | No | | 106 | maxFirstStreamCompDelay | Yes | No |
| 107 | maxVgroupsPerDb | Yes | No | | 107 | retryStreamCompDelay | Yes | No |
| 108 | maxTablesPerVnode | Yes | No | | 108 | streamCompDelayRatio | Yes | No |
| 109 | minTablesPerVnode | Yes | No | | 109 | maxVgroupsPerDb | Yes | No |
| 110 | tableIncStepPerVnode | Yes | No | | 110 | maxTablesPerVnode | Yes | No |
| 111 | cache | Yes | No | | 111 | minTablesPerVnode | Yes | No |
| 112 | blocks | Yes | No | | 112 | tableIncStepPerVnode | Yes | No |
| 113 | days | Yes | No | | 113 | cache | Yes | No |
| 114 | keep | Yes | No | | 114 | blocks | Yes | No |
| 115 | minRows | Yes | No | | 115 | days | Yes | No |
| 116 | maxRows | Yes | No | | 116 | keep | Yes | No |
| 117 | quorum | Yes | No | | 117 | minRows | Yes | No |
| 118 | comp | Yes | No | | 118 | maxRows | Yes | No |
| 119 | walLevel | Yes | No | | 119 | quorum | Yes | No |
| 120 | fsync | Yes | No | | 120 | comp | Yes | No |
| 121 | replica | Yes | No | | 121 | walLevel | Yes | No |
| 122 | partitions | Yes | No | | 122 | fsync | Yes | No |
| 123 | quorum | Yes | No | | 123 | replica | Yes | No |
| 124 | update | Yes | No | | 124 | partitions | Yes | No |
| 125 | cachelast | Yes | No | | 125 | quorum | Yes | No |
| 126 | maxSQLLength | Yes | No | | 126 | update | Yes | No |
| 127 | maxWildCardsLength | Yes | No | | 127 | cachelast | Yes | No |
| 128 | maxRegexStringLen | Yes | No | | 128 | maxSQLLength | Yes | No |
| 129 | maxNumOfOrderedRes | Yes | No | | 129 | maxWildCardsLength | Yes | No |
| 130 | maxConnections | Yes | No | | 130 | maxRegexStringLen | Yes | No |
| 131 | mnodeEqualVnodeNum | Yes | No | | 131 | maxNumOfOrderedRes | Yes | No |
| 132 | http | Yes | No | | 132 | maxConnections | Yes | No |
| 133 | httpEnableRecordSql | Yes | No | | 133 | mnodeEqualVnodeNum | Yes | No |
| 134 | httpMaxThreads | Yes | No | | 134 | http | Yes | No |
| 135 | restfulRowLimit | Yes | No | | 135 | httpEnableRecordSql | Yes | No |
| 136 | httpDbNameMandatory | Yes | No | | 136 | httpMaxThreads | Yes | No |
| 137 | httpKeepAlive | Yes | No | | 137 | restfulRowLimit | Yes | No |
| 138 | enableRecordSql | Yes | No | | 138 | httpDbNameMandatory | Yes | No |
| 139 | maxBinaryDisplayWidth | Yes | No | | 139 | httpKeepAlive | Yes | No |
| 140 | stream | Yes | No | | 140 | enableRecordSql | Yes | No |
| 141 | retrieveBlockingModel | Yes | No | | 141 | maxBinaryDisplayWidth | Yes | No |
| 142 | tsdbMetaCompactRatio | Yes | No | | 142 | stream | Yes | No |
| 143 | defaultJSONStrType | Yes | No | | 143 | retrieveBlockingModel | Yes | No |
| 144 | walFlushSize | Yes | No | | 144 | tsdbMetaCompactRatio | Yes | No |
| 145 | keepTimeOffset | Yes | No | | 145 | defaultJSONStrType | Yes | No |
| 146 | flowctrl | Yes | No | | 146 | walFlushSize | Yes | No |
| 147 | slaveQuery | Yes | No | | 147 | keepTimeOffset | Yes | No |
| 148 | adjustMaster | Yes | No | | 148 | flowctrl | Yes | No |
| 149 | topicBinaryLen | Yes | No | | 149 | slaveQuery | Yes | No |
| 150 | telegrafUseFieldNum | Yes | No | | 150 | adjustMaster | Yes | No |
| 151 | deadLockKillQuery | Yes | No | | 151 | topicBinaryLen | Yes | No |
| 152 | clientMerge | Yes | No | | 152 | telegrafUseFieldNum | Yes | No |
| 153 | sdbDebugFlag | Yes | No | | 153 | deadLockKillQuery | Yes | No |
| 154 | odbcDebugFlag | Yes | No | | 154 | clientMerge | Yes | No |
| 155 | httpDebugFlag | Yes | No | | 155 | sdbDebugFlag | Yes | No |
| 156 | monDebugFlag | Yes | No | | 156 | odbcDebugFlag | Yes | No |
| 157 | cqDebugFlag | Yes | No | | 157 | httpDebugFlag | Yes | No |
| 158 | shortcutFlag | Yes | No | | 158 | monDebugFlag | Yes | No |
| 159 | probeSeconds | Yes | No | | 159 | cqDebugFlag | Yes | No |
| 160 | probeKillSeconds | Yes | No | | 160 | shortcutFlag | Yes | No |
| 161 | probeInterval | Yes | No | | 161 | probeSeconds | Yes | No |
| 162 | lossyColumns | Yes | No | | 162 | probeKillSeconds | Yes | No |
| 163 | fPrecision | Yes | No | | 163 | probeInterval | Yes | No |
| 164 | dPrecision | Yes | No | | 164 | lossyColumns | Yes | No |
| 165 | maxRange | Yes | No | | 165 | fPrecision | Yes | No |
| 166 | range | Yes | No | | 166 | dPrecision | Yes | No |
| 167 | maxRange | Yes | No |
| 168 | range | Yes | No |

View File

@ -6,6 +6,9 @@ description: TDengine release history, Release Notes and download links.
import Release from "/components/ReleaseV3"; import Release from "/components/ReleaseV3";
## 3.0.1.2
<Release type="tdengine" version="3.0.1.2" />
## 3.0.1.1 ## 3.0.1.1

View File

@ -6,6 +6,10 @@ description: taosTools release history, Release Notes, download links.
import Release from "/components/ReleaseV3"; import Release from "/components/ReleaseV3";
## 2.2.2
<Release type="tools" version="2.2.2" />
## 2.2.0 ## 2.2.0
<Release type="tools" version="2.2.0" /> <Release type="tools" version="2.2.0" />

View File

@ -1,12 +1,27 @@
bin
obj
.vs .vs
*.sln asyncQuery/bin
wsConnect/obj connect/bin
wsInsert/obj influxdbLine/bin
wsQuery/obj optsJSON/bin
wsStmt/obj optsTelnet/bin
query/bin
sqlInsert/bin
stmtInsert/bin
subscribe/bin
wsConnect/bin wsConnect/bin
wsInsert/bin wsInsert/bin
wsQuery/bin wsQuery/bin
wsStmt/bin wsStmt/bin
asyncQuery/obj
connect/obj
influxdbLine/obj
optsJSON/obj
optsTelnet/obj
query/obj
sqlInsert/obj
stmtInsert/obj
subscribe/obj
wsConnect/obj
wsInsert/obj
wsQuery/obj
wsStmt/obj

View File

@ -1,82 +0,0 @@
using TDengineDriver;
using TDengineDriver.Impl;
using System.Runtime.InteropServices;
namespace TDengineExample
{
internal class QueryExample
{
static void Main()
{
IntPtr conn = GetConnection();
// run query
IntPtr res = TDengine.Query(conn, "SELECT * FROM meters LIMIT 2");
if (TDengine.ErrorNo(res) != 0)
{
Console.WriteLine("Failed to query since: " + TDengine.Error(res));
TDengine.Close(conn);
TDengine.Cleanup();
return;
}
// get filed count
int fieldCount = TDengine.FieldCount(res);
Console.WriteLine("fieldCount=" + fieldCount);
// print column names
List<TDengineMeta> metas = LibTaos.GetMeta(res);
for (int i = 0; i < metas.Count; i++)
{
Console.Write(metas[i].name + "\t");
}
Console.WriteLine();
// print values
List<Object> resData = LibTaos.GetData(res);
for (int i = 0; i < resData.Count; i++)
{
Console.Write($"|{resData[i].ToString()} \t");
if (((i + 1) % metas.Count == 0))
{
Console.WriteLine("");
}
}
Console.WriteLine();
if (TDengine.ErrorNo(res) != 0)
{
Console.WriteLine($"Query is not complete, Error {TDengine.ErrorNo(res)} {TDengine.Error(res)}");
}
// exit
TDengine.FreeResult(res);
TDengine.Close(conn);
TDengine.Cleanup();
}
static IntPtr GetConnection()
{
string host = "localhost";
short port = 6030;
string username = "root";
string password = "taosdata";
string dbname = "power";
var conn = TDengine.Connect(host, username, password, dbname, port);
if (conn == IntPtr.Zero)
{
Console.WriteLine("Connect to TDengine failed");
System.Environment.Exit(0);
}
else
{
Console.WriteLine("Connect to TDengine success");
}
return conn;
}
}
}
// output:
// Connect to TDengine success
// fieldCount=6
// ts current voltage phase location groupid
// 1648432611249 10.3 219 0.31 California.SanFrancisco 2
// 1648432611749 12.6 218 0.33 California.SanFrancisco 2

View File

@ -1,70 +0,0 @@
using TDengineDriver;
namespace TDengineExample
{
internal class SQLInsertExample
{
static void Main()
{
IntPtr conn = GetConnection();
IntPtr res = TDengine.Query(conn, "CREATE DATABASE power");
CheckRes(conn, res, "failed to create database");
res = TDengine.Query(conn, "USE power");
CheckRes(conn, res, "failed to change database");
res = TDengine.Query(conn, "CREATE STABLE power.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (location BINARY(64), groupId INT)");
CheckRes(conn, res, "failed to create stable");
var sql = "INSERT INTO d1001 USING meters TAGS('California.SanFrancisco', 2) VALUES ('2018-10-03 14:38:05.000', 10.30000, 219, 0.31000) ('2018-10-03 14:38:15.000', 12.60000, 218, 0.33000) ('2018-10-03 14:38:16.800', 12.30000, 221, 0.31000) " +
"d1002 USING power.meters TAGS('California.SanFrancisco', 3) VALUES('2018-10-03 14:38:16.650', 10.30000, 218, 0.25000) " +
"d1003 USING power.meters TAGS('California.LosAngeles', 2) VALUES('2018-10-03 14:38:05.500', 11.80000, 221, 0.28000)('2018-10-03 14:38:16.600', 13.40000, 223, 0.29000) " +
"d1004 USING power.meters TAGS('California.LosAngeles', 3) VALUES('2018-10-03 14:38:05.000', 10.80000, 223, 0.29000)('2018-10-03 14:38:06.500', 11.50000, 221, 0.35000)";
res = TDengine.Query(conn, sql);
CheckRes(conn, res, "failed to insert data");
int affectedRows = TDengine.AffectRows(res);
Console.WriteLine("affectedRows " + affectedRows);
TDengine.FreeResult(res);
ExitProgram(conn, 0);
}
static IntPtr GetConnection()
{
string host = "localhost";
short port = 6030;
string username = "root";
string password = "taosdata";
string dbname = "";
var conn = TDengine.Connect(host, username, password, dbname, port);
if (conn == IntPtr.Zero)
{
Console.WriteLine("Connect to TDengine failed");
Environment.Exit(0);
}
else
{
Console.WriteLine("Connect to TDengine success");
}
return conn;
}
static void CheckRes(IntPtr conn, IntPtr res, String errorMsg)
{
if (TDengine.ErrorNo(res) != 0)
{
Console.Write(errorMsg + " since: " + TDengine.Error(res));
ExitProgram(conn, 1);
}
}
static void ExitProgram(IntPtr conn, int exitCode)
{
TDengine.Close(conn);
TDengine.Cleanup();
Environment.Exit(exitCode);
}
}
}
// output:
// Connect to TDengine success
// affectedRows 8

View File

@ -11,11 +11,17 @@ namespace TDengineExample
static void Main() static void Main()
{ {
IntPtr conn = GetConnection(); IntPtr conn = GetConnection();
QueryAsyncCallback queryAsyncCallback = new QueryAsyncCallback(QueryCallback); try
TDengine.QueryAsync(conn, "select * from meters", queryAsyncCallback, IntPtr.Zero); {
Thread.Sleep(2000); QueryAsyncCallback queryAsyncCallback = new QueryAsyncCallback(QueryCallback);
TDengine.Close(conn); TDengine.QueryAsync(conn, "select * from meters", queryAsyncCallback, IntPtr.Zero);
TDengine.Cleanup(); Thread.Sleep(2000);
}
finally
{
TDengine.Close(conn);
}
} }
static void QueryCallback(IntPtr param, IntPtr taosRes, int code) static void QueryCallback(IntPtr param, IntPtr taosRes, int code)
@ -27,11 +33,11 @@ namespace TDengineExample
} }
else else
{ {
Console.WriteLine($"async query data failed, failed code {code}"); throw new Exception($"async query data failed,code:{code},reason:{TDengine.Error(taosRes)}");
} }
} }
// Iteratively call this interface until "numOfRows" is no greater than 0. // Iteratively call this interface until "numOfRows" is no greater than 0.
static void FetchRawBlockCallback(IntPtr param, IntPtr taosRes, int numOfRows) static void FetchRawBlockCallback(IntPtr param, IntPtr taosRes, int numOfRows)
{ {
if (numOfRows > 0) if (numOfRows > 0)
@ -43,7 +49,7 @@ namespace TDengineExample
for (int i = 0; i < dataList.Count; i++) for (int i = 0; i < dataList.Count; i++)
{ {
if (i != 0 && (i+1) % metaList.Count == 0) if (i != 0 && (i + 1) % metaList.Count == 0)
{ {
Console.WriteLine("{0}\t|", dataList[i]); Console.WriteLine("{0}\t|", dataList[i]);
} }
@ -63,7 +69,7 @@ namespace TDengineExample
} }
else else
{ {
Console.WriteLine($"FetchRawBlockCallback callback error, error code {numOfRows}"); throw new Exception($"FetchRawBlockCallback callback error, error code {numOfRows}");
} }
TDengine.FreeResult(taosRes); TDengine.FreeResult(taosRes);
} }
@ -79,8 +85,7 @@ namespace TDengineExample
var conn = TDengine.Connect(host, username, password, dbname, port); var conn = TDengine.Connect(host, username, password, dbname, port);
if (conn == IntPtr.Zero) if (conn == IntPtr.Zero)
{ {
Console.WriteLine("Connect to TDengine failed"); throw new Exception("Connect to TDengine failed");
Environment.Exit(0);
} }
else else
{ {

View File

@ -9,7 +9,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="TDengine.Connector" Version="3.0.0" /> <PackageReference Include="TDengine.Connector" Version="3.0.1" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -16,7 +16,7 @@ namespace TDengineExample
var conn = TDengine.Connect(host, username, password, dbname, port); var conn = TDengine.Connect(host, username, password, dbname, port);
if (conn == IntPtr.Zero) if (conn == IntPtr.Zero)
{ {
Console.WriteLine("Connect to TDengine failed"); throw new Exception("Connect to TDengine failed");
} }
else else
{ {

View File

@ -0,0 +1,94 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30114.105
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "asyncquery", "asyncQuery\asyncquery.csproj", "{E2A5F00C-14E7-40E1-A2DE-6AB2975616D3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "connect", "connect\connect.csproj", "{CCC5042D-93FC-4AE0-B2F6-7E692FD476B7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "influxdbline", "influxdbLine\influxdbline.csproj", "{6A24FB80-1E3C-4E2D-A5AB-914FA583874D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "optsJSON", "optsJSON\optsJSON.csproj", "{6725A961-0C66-4196-AC98-8D3F3D757D6C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "optstelnet", "optsTelnet\optstelnet.csproj", "{B3B50D25-688B-44D4-8683-482ABC52FFCA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "query", "query\query.csproj", "{F2B7D13B-FE04-4C5C-BB6D-C12E0A9D9970}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "stmtinsert", "stmtInsert\stmtinsert.csproj", "{B40D6BED-BE3C-4B44-9B12-28BE441311BA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "subscribe", "subscribe\subscribe.csproj", "{C3D45A8E-AFC0-4547-9F3C-467B0B583DED}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "wsConnect", "wsConnect\wsConnect.csproj", "{51E19494-845E-49ED-97C7-749AE63111BD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "wsInsert", "wsInsert\wsInsert.csproj", "{13E2233B-4AFF-40D9-AF42-AB3F01617540}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "wsQuery", "wsQuery\wsQuery.csproj", "{0F394169-C456-442C-929D-C2D43A0EEC7B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "wsStmt", "wsStmt\wsStmt.csproj", "{27B9C9AB-9055-4BF2-8A14-4E59F09D5985}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sqlinsert", "sqlInsert\sqlinsert.csproj", "{CD24BD12-8550-4627-A11D-707B446F48C3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E2A5F00C-14E7-40E1-A2DE-6AB2975616D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E2A5F00C-14E7-40E1-A2DE-6AB2975616D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E2A5F00C-14E7-40E1-A2DE-6AB2975616D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E2A5F00C-14E7-40E1-A2DE-6AB2975616D3}.Release|Any CPU.Build.0 = Release|Any CPU
{CCC5042D-93FC-4AE0-B2F6-7E692FD476B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CCC5042D-93FC-4AE0-B2F6-7E692FD476B7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CCC5042D-93FC-4AE0-B2F6-7E692FD476B7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CCC5042D-93FC-4AE0-B2F6-7E692FD476B7}.Release|Any CPU.Build.0 = Release|Any CPU
{6A24FB80-1E3C-4E2D-A5AB-914FA583874D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6A24FB80-1E3C-4E2D-A5AB-914FA583874D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6A24FB80-1E3C-4E2D-A5AB-914FA583874D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6A24FB80-1E3C-4E2D-A5AB-914FA583874D}.Release|Any CPU.Build.0 = Release|Any CPU
{6725A961-0C66-4196-AC98-8D3F3D757D6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6725A961-0C66-4196-AC98-8D3F3D757D6C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6725A961-0C66-4196-AC98-8D3F3D757D6C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6725A961-0C66-4196-AC98-8D3F3D757D6C}.Release|Any CPU.Build.0 = Release|Any CPU
{B3B50D25-688B-44D4-8683-482ABC52FFCA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B3B50D25-688B-44D4-8683-482ABC52FFCA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B3B50D25-688B-44D4-8683-482ABC52FFCA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B3B50D25-688B-44D4-8683-482ABC52FFCA}.Release|Any CPU.Build.0 = Release|Any CPU
{F2B7D13B-FE04-4C5C-BB6D-C12E0A9D9970}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F2B7D13B-FE04-4C5C-BB6D-C12E0A9D9970}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F2B7D13B-FE04-4C5C-BB6D-C12E0A9D9970}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F2B7D13B-FE04-4C5C-BB6D-C12E0A9D9970}.Release|Any CPU.Build.0 = Release|Any CPU
{B40D6BED-BE3C-4B44-9B12-28BE441311BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B40D6BED-BE3C-4B44-9B12-28BE441311BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B40D6BED-BE3C-4B44-9B12-28BE441311BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B40D6BED-BE3C-4B44-9B12-28BE441311BA}.Release|Any CPU.Build.0 = Release|Any CPU
{C3D45A8E-AFC0-4547-9F3C-467B0B583DED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C3D45A8E-AFC0-4547-9F3C-467B0B583DED}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C3D45A8E-AFC0-4547-9F3C-467B0B583DED}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C3D45A8E-AFC0-4547-9F3C-467B0B583DED}.Release|Any CPU.Build.0 = Release|Any CPU
{51E19494-845E-49ED-97C7-749AE63111BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{51E19494-845E-49ED-97C7-749AE63111BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{51E19494-845E-49ED-97C7-749AE63111BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{51E19494-845E-49ED-97C7-749AE63111BD}.Release|Any CPU.Build.0 = Release|Any CPU
{13E2233B-4AFF-40D9-AF42-AB3F01617540}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{13E2233B-4AFF-40D9-AF42-AB3F01617540}.Debug|Any CPU.Build.0 = Debug|Any CPU
{13E2233B-4AFF-40D9-AF42-AB3F01617540}.Release|Any CPU.ActiveCfg = Release|Any CPU
{13E2233B-4AFF-40D9-AF42-AB3F01617540}.Release|Any CPU.Build.0 = Release|Any CPU
{0F394169-C456-442C-929D-C2D43A0EEC7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0F394169-C456-442C-929D-C2D43A0EEC7B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0F394169-C456-442C-929D-C2D43A0EEC7B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0F394169-C456-442C-929D-C2D43A0EEC7B}.Release|Any CPU.Build.0 = Release|Any CPU
{27B9C9AB-9055-4BF2-8A14-4E59F09D5985}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{27B9C9AB-9055-4BF2-8A14-4E59F09D5985}.Debug|Any CPU.Build.0 = Debug|Any CPU
{27B9C9AB-9055-4BF2-8A14-4E59F09D5985}.Release|Any CPU.ActiveCfg = Release|Any CPU
{27B9C9AB-9055-4BF2-8A14-4E59F09D5985}.Release|Any CPU.Build.0 = Release|Any CPU
{CD24BD12-8550-4627-A11D-707B446F48C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CD24BD12-8550-4627-A11D-707B446F48C3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CD24BD12-8550-4627-A11D-707B446F48C3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CD24BD12-8550-4627-A11D-707B446F48C3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

View File

@ -17,8 +17,7 @@ namespace TDengineExample
IntPtr res = TDengine.SchemalessInsert(conn, lines, lines.Length, (int)TDengineSchemalessProtocol.TSDB_SML_LINE_PROTOCOL, (int)TDengineSchemalessPrecision.TSDB_SML_TIMESTAMP_MILLI_SECONDS); IntPtr res = TDengine.SchemalessInsert(conn, lines, lines.Length, (int)TDengineSchemalessProtocol.TSDB_SML_LINE_PROTOCOL, (int)TDengineSchemalessPrecision.TSDB_SML_TIMESTAMP_MILLI_SECONDS);
if (TDengine.ErrorNo(res) != 0) if (TDengine.ErrorNo(res) != 0)
{ {
Console.WriteLine("SchemalessInsert failed since " + TDengine.Error(res)); throw new Exception("SchemalessInsert failed since " + TDengine.Error(res));
ExitProgram(conn, 1);
} }
else else
{ {
@ -26,7 +25,6 @@ namespace TDengineExample
Console.WriteLine($"SchemalessInsert success, affected {affectedRows} rows"); Console.WriteLine($"SchemalessInsert success, affected {affectedRows} rows");
} }
TDengine.FreeResult(res); TDengine.FreeResult(res);
ExitProgram(conn, 0);
} }
static IntPtr GetConnection() static IntPtr GetConnection()
@ -39,9 +37,7 @@ namespace TDengineExample
var conn = TDengine.Connect(host, username, password, dbname, port); var conn = TDengine.Connect(host, username, password, dbname, port);
if (conn == IntPtr.Zero) if (conn == IntPtr.Zero)
{ {
Console.WriteLine("Connect to TDengine failed"); throw new Exception("Connect to TDengine failed");
TDengine.Cleanup();
Environment.Exit(1);
} }
else else
{ {
@ -55,23 +51,15 @@ namespace TDengineExample
IntPtr res = TDengine.Query(conn, "CREATE DATABASE test"); IntPtr res = TDengine.Query(conn, "CREATE DATABASE test");
if (TDengine.ErrorNo(res) != 0) if (TDengine.ErrorNo(res) != 0)
{ {
Console.WriteLine("failed to create database, reason: " + TDengine.Error(res)); throw new Exception("failed to create database, reason: " + TDengine.Error(res));
ExitProgram(conn, 1);
} }
res = TDengine.Query(conn, "USE test"); res = TDengine.Query(conn, "USE test");
if (TDengine.ErrorNo(res) != 0) if (TDengine.ErrorNo(res) != 0)
{ {
Console.WriteLine("failed to change database, reason: " + TDengine.Error(res)); throw new Exception("failed to change database, reason: " + TDengine.Error(res));
ExitProgram(conn, 1);
} }
} }
static void ExitProgram(IntPtr conn, int exitCode)
{
TDengine.Close(conn);
TDengine.Cleanup();
Environment.Exit(exitCode);
}
} }
} }

View File

@ -7,27 +7,31 @@ namespace TDengineExample
static void Main() static void Main()
{ {
IntPtr conn = GetConnection(); IntPtr conn = GetConnection();
PrepareDatabase(conn); try
string[] lines = { "[{\"metric\": \"meters.current\", \"timestamp\": 1648432611249, \"value\": 10.3, \"tags\": {\"location\": \"California.SanFrancisco\", \"groupid\": 2}}," + {
PrepareDatabase(conn);
string[] lines = { "[{\"metric\": \"meters.current\", \"timestamp\": 1648432611249, \"value\": 10.3, \"tags\": {\"location\": \"California.SanFrancisco\", \"groupid\": 2}}," +
" {\"metric\": \"meters.voltage\", \"timestamp\": 1648432611249, \"value\": 219, \"tags\": {\"location\": \"California.LosAngeles\", \"groupid\": 1}}, " + " {\"metric\": \"meters.voltage\", \"timestamp\": 1648432611249, \"value\": 219, \"tags\": {\"location\": \"California.LosAngeles\", \"groupid\": 1}}, " +
"{\"metric\": \"meters.current\", \"timestamp\": 1648432611250, \"value\": 12.6, \"tags\": {\"location\": \"California.SanFrancisco\", \"groupid\": 2}}," + "{\"metric\": \"meters.current\", \"timestamp\": 1648432611250, \"value\": 12.6, \"tags\": {\"location\": \"California.SanFrancisco\", \"groupid\": 2}}," +
" {\"metric\": \"meters.voltage\", \"timestamp\": 1648432611250, \"value\": 221, \"tags\": {\"location\": \"California.LosAngeles\", \"groupid\": 1}}]" " {\"metric\": \"meters.voltage\", \"timestamp\": 1648432611250, \"value\": 221, \"tags\": {\"location\": \"California.LosAngeles\", \"groupid\": 1}}]"
}; };
IntPtr res = TDengine.SchemalessInsert(conn, lines, 1, (int)TDengineSchemalessProtocol.TSDB_SML_JSON_PROTOCOL, (int)TDengineSchemalessPrecision.TSDB_SML_TIMESTAMP_NOT_CONFIGURED); IntPtr res = TDengine.SchemalessInsert(conn, lines, 1, (int)TDengineSchemalessProtocol.TSDB_SML_JSON_PROTOCOL, (int)TDengineSchemalessPrecision.TSDB_SML_TIMESTAMP_NOT_CONFIGURED);
if (TDengine.ErrorNo(res) != 0) if (TDengine.ErrorNo(res) != 0)
{ {
Console.WriteLine("SchemalessInsert failed since " + TDengine.Error(res)); throw new Exception("SchemalessInsert failed since " + TDengine.Error(res));
ExitProgram(conn, 1); }
else
{
int affectedRows = TDengine.AffectRows(res);
Console.WriteLine($"SchemalessInsert success, affected {affectedRows} rows");
}
TDengine.FreeResult(res);
} }
else finally
{ {
int affectedRows = TDengine.AffectRows(res); TDengine.Close(conn);
Console.WriteLine($"SchemalessInsert success, affected {affectedRows} rows");
} }
TDengine.FreeResult(res);
ExitProgram(conn, 0);
} }
static IntPtr GetConnection() static IntPtr GetConnection()
{ {
@ -39,9 +43,7 @@ namespace TDengineExample
var conn = TDengine.Connect(host, username, password, dbname, port); var conn = TDengine.Connect(host, username, password, dbname, port);
if (conn == IntPtr.Zero) if (conn == IntPtr.Zero)
{ {
Console.WriteLine("Connect to TDengine failed"); throw new Exception("Connect to TDengine failed");
TDengine.Cleanup();
Environment.Exit(1);
} }
else else
{ {
@ -55,22 +57,13 @@ namespace TDengineExample
IntPtr res = TDengine.Query(conn, "CREATE DATABASE test"); IntPtr res = TDengine.Query(conn, "CREATE DATABASE test");
if (TDengine.ErrorNo(res) != 0) if (TDengine.ErrorNo(res) != 0)
{ {
Console.WriteLine("failed to create database, reason: " + TDengine.Error(res)); throw new Exception("failed to create database, reason: " + TDengine.Error(res));
ExitProgram(conn, 1);
} }
res = TDengine.Query(conn, "USE test"); res = TDengine.Query(conn, "USE test");
if (TDengine.ErrorNo(res) != 0) if (TDengine.ErrorNo(res) != 0)
{ {
Console.WriteLine("failed to change database, reason: " + TDengine.Error(res)); throw new Exception("failed to change database, reason: " + TDengine.Error(res));
ExitProgram(conn, 1);
} }
} }
static void ExitProgram(IntPtr conn, int exitCode)
{
TDengine.Close(conn);
TDengine.Cleanup();
Environment.Exit(exitCode);
}
} }
} }

View File

@ -7,8 +7,10 @@ namespace TDengineExample
static void Main() static void Main()
{ {
IntPtr conn = GetConnection(); IntPtr conn = GetConnection();
PrepareDatabase(conn); try
string[] lines = { {
PrepareDatabase(conn);
string[] lines = {
"meters.current 1648432611249 10.3 location=California.SanFrancisco groupid=2", "meters.current 1648432611249 10.3 location=California.SanFrancisco groupid=2",
"meters.current 1648432611250 12.6 location=California.SanFrancisco groupid=2", "meters.current 1648432611250 12.6 location=California.SanFrancisco groupid=2",
"meters.current 1648432611249 10.8 location=California.LosAngeles groupid=3", "meters.current 1648432611249 10.8 location=California.LosAngeles groupid=3",
@ -18,20 +20,22 @@ namespace TDengineExample
"meters.voltage 1648432611249 221 location=California.LosAngeles groupid=3", "meters.voltage 1648432611249 221 location=California.LosAngeles groupid=3",
"meters.voltage 1648432611250 217 location=California.LosAngeles groupid=3", "meters.voltage 1648432611250 217 location=California.LosAngeles groupid=3",
}; };
IntPtr res = TDengine.SchemalessInsert(conn, lines, lines.Length, (int)TDengineSchemalessProtocol.TSDB_SML_TELNET_PROTOCOL, (int)TDengineSchemalessPrecision.TSDB_SML_TIMESTAMP_NOT_CONFIGURED); IntPtr res = TDengine.SchemalessInsert(conn, lines, lines.Length, (int)TDengineSchemalessProtocol.TSDB_SML_TELNET_PROTOCOL, (int)TDengineSchemalessPrecision.TSDB_SML_TIMESTAMP_NOT_CONFIGURED);
if (TDengine.ErrorNo(res) != 0) if (TDengine.ErrorNo(res) != 0)
{ {
Console.WriteLine("SchemalessInsert failed since " + TDengine.Error(res)); throw new Exception("SchemalessInsert failed since " + TDengine.Error(res));
ExitProgram(conn, 1); }
else
{
int affectedRows = TDengine.AffectRows(res);
Console.WriteLine($"SchemalessInsert success, affected {affectedRows} rows");
}
TDengine.FreeResult(res);
} }
else catch
{ {
int affectedRows = TDengine.AffectRows(res); TDengine.Close(conn);
Console.WriteLine($"SchemalessInsert success, affected {affectedRows} rows");
} }
TDengine.FreeResult(res);
ExitProgram(conn, 0);
} }
static IntPtr GetConnection() static IntPtr GetConnection()
{ {
@ -43,9 +47,7 @@ namespace TDengineExample
var conn = TDengine.Connect(host, username, password, dbname, port); var conn = TDengine.Connect(host, username, password, dbname, port);
if (conn == IntPtr.Zero) if (conn == IntPtr.Zero)
{ {
Console.WriteLine("Connect to TDengine failed"); throw new Exception("Connect to TDengine failed");
TDengine.Cleanup();
Environment.Exit(1);
} }
else else
{ {
@ -59,22 +61,13 @@ namespace TDengineExample
IntPtr res = TDengine.Query(conn, "CREATE DATABASE test"); IntPtr res = TDengine.Query(conn, "CREATE DATABASE test");
if (TDengine.ErrorNo(res) != 0) if (TDengine.ErrorNo(res) != 0)
{ {
Console.WriteLine("failed to create database, reason: " + TDengine.Error(res)); throw new Exception("failed to create database, reason: " + TDengine.Error(res));
ExitProgram(conn, 1);
} }
res = TDengine.Query(conn, "USE test"); res = TDengine.Query(conn, "USE test");
if (TDengine.ErrorNo(res) != 0) if (TDengine.ErrorNo(res) != 0)
{ {
Console.WriteLine("failed to change database, reason: " + TDengine.Error(res)); throw new Exception("failed to change database, reason: " + TDengine.Error(res));
ExitProgram(conn, 1);
} }
} }
static void ExitProgram(IntPtr conn, int exitCode)
{
TDengine.Close(conn);
TDengine.Cleanup();
Environment.Exit(exitCode);
}
} }
} }

View File

@ -0,0 +1,80 @@
using TDengineDriver;
using TDengineDriver.Impl;
using System.Runtime.InteropServices;
namespace TDengineExample
{
internal class QueryExample
{
static void Main()
{
IntPtr conn = GetConnection();
try
{
// run query
IntPtr res = TDengine.Query(conn, "SELECT * FROM meters LIMIT 2");
if (TDengine.ErrorNo(res) != 0)
{
throw new Exception("Failed to query since: " + TDengine.Error(res));
}
// get filed count
int fieldCount = TDengine.FieldCount(res);
Console.WriteLine("fieldCount=" + fieldCount);
// print column names
List<TDengineMeta> metas = LibTaos.GetMeta(res);
for (int i = 0; i < metas.Count; i++)
{
Console.Write(metas[i].name + "\t");
}
Console.WriteLine();
// print values
List<Object> resData = LibTaos.GetData(res);
for (int i = 0; i < resData.Count; i++)
{
Console.Write($"|{resData[i].ToString()} \t");
if (((i + 1) % metas.Count == 0))
{
Console.WriteLine("");
}
}
Console.WriteLine();
// Free result after use
TDengine.FreeResult(res);
}
finally
{
TDengine.Close(conn);
}
}
static IntPtr GetConnection()
{
string host = "localhost";
short port = 6030;
string username = "root";
string password = "taosdata";
string dbname = "power";
var conn = TDengine.Connect(host, username, password, dbname, port);
if (conn == IntPtr.Zero)
{
throw new Exception("Connect to TDengine failed");
}
else
{
Console.WriteLine("Connect to TDengine success");
}
return conn;
}
}
}
// output:
// Connect to TDengine success
// fieldCount=6
// ts current voltage phase location groupid
// 1648432611249 10.3 219 0.31 California.SanFrancisco 2
// 1648432611749 12.6 218 0.33 California.SanFrancisco 2

View File

@ -9,7 +9,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="TDengine.Connector" Version="3.0.0" /> <PackageReference Include="TDengine.Connector" Version="3.0.1" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -0,0 +1,69 @@
using TDengineDriver;
namespace TDengineExample
{
internal class SQLInsertExample
{
static void Main()
{
IntPtr conn = GetConnection();
try
{
IntPtr res = TDengine.Query(conn, "CREATE DATABASE power");
CheckRes(conn, res, "failed to create database");
res = TDengine.Query(conn, "USE power");
CheckRes(conn, res, "failed to change database");
res = TDengine.Query(conn, "CREATE STABLE power.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (location BINARY(64), groupId INT)");
CheckRes(conn, res, "failed to create stable");
var sql = "INSERT INTO d1001 USING meters TAGS('California.SanFrancisco', 2) VALUES ('2018-10-03 14:38:05.000', 10.30000, 219, 0.31000) ('2018-10-03 14:38:15.000', 12.60000, 218, 0.33000) ('2018-10-03 14:38:16.800', 12.30000, 221, 0.31000) " +
"d1002 USING power.meters TAGS('California.SanFrancisco', 3) VALUES('2018-10-03 14:38:16.650', 10.30000, 218, 0.25000) " +
"d1003 USING power.meters TAGS('California.LosAngeles', 2) VALUES('2018-10-03 14:38:05.500', 11.80000, 221, 0.28000)('2018-10-03 14:38:16.600', 13.40000, 223, 0.29000) " +
"d1004 USING power.meters TAGS('California.LosAngeles', 3) VALUES('2018-10-03 14:38:05.000', 10.80000, 223, 0.29000)('2018-10-03 14:38:06.500', 11.50000, 221, 0.35000)";
res = TDengine.Query(conn, sql);
CheckRes(conn, res, "failed to insert data");
int affectedRows = TDengine.AffectRows(res);
Console.WriteLine("affectedRows " + affectedRows);
TDengine.FreeResult(res);
}
finally
{
TDengine.Close(conn);
}
}
static IntPtr GetConnection()
{
string host = "localhost";
short port = 6030;
string username = "root";
string password = "taosdata";
string dbname = "";
var conn = TDengine.Connect(host, username, password, dbname, port);
if (conn == IntPtr.Zero)
{
throw new Exception("Connect to TDengine failed");
}
else
{
Console.WriteLine("Connect to TDengine success");
}
return conn;
}
static void CheckRes(IntPtr conn, IntPtr res, String errorMsg)
{
if (TDengine.ErrorNo(res) != 0)
{
throw new Exception($"{errorMsg} since: {TDengine.Error(res)}");
}
}
}
}
// output:
// Connect to TDengine success
// affectedRows 8

View File

@ -9,45 +9,50 @@ namespace TDengineExample
static void Main() static void Main()
{ {
conn = GetConnection(); conn = GetConnection();
PrepareSTable(); try
// 1. init and prepare
stmt = TDengine.StmtInit(conn);
if (stmt == IntPtr.Zero)
{ {
Console.WriteLine("failed to init stmt, " + TDengine.Error(stmt)); PrepareSTable();
ExitProgram(); // 1. init and prepare
} stmt = TDengine.StmtInit(conn);
int res = TDengine.StmtPrepare(stmt, "INSERT INTO ? USING meters TAGS(?, ?) VALUES(?, ?, ?, ?)"); if (stmt == IntPtr.Zero)
CheckStmtRes(res, "failed to prepare stmt"); {
throw new Exception("failed to init stmt.");
}
int res = TDengine.StmtPrepare(stmt, "INSERT INTO ? USING meters TAGS(?, ?) VALUES(?, ?, ?, ?)");
CheckStmtRes(res, "failed to prepare stmt");
// 2. bind table name and tags // 2. bind table name and tags
TAOS_MULTI_BIND[] tags = new TAOS_MULTI_BIND[2] { TaosMultiBind.MultiBindBinary(new string[]{"California.SanFrancisco"}), TaosMultiBind.MultiBindInt(new int?[] {2}) }; TAOS_MULTI_BIND[] tags = new TAOS_MULTI_BIND[2] { TaosMultiBind.MultiBindBinary(new string[] { "California.SanFrancisco" }), TaosMultiBind.MultiBindInt(new int?[] { 2 }) };
res = TDengine.StmtSetTbnameTags(stmt, "d1001", tags); res = TDengine.StmtSetTbnameTags(stmt, "d1001", tags);
CheckStmtRes(res, "failed to bind table name and tags"); CheckStmtRes(res, "failed to bind table name and tags");
// 3. bind values // 3. bind values
TAOS_MULTI_BIND[] values = new TAOS_MULTI_BIND[4] { TAOS_MULTI_BIND[] values = new TAOS_MULTI_BIND[4] {
TaosMultiBind.MultiBindTimestamp(new long[2] { 1648432611249, 1648432611749}), TaosMultiBind.MultiBindTimestamp(new long[2] { 1648432611249, 1648432611749}),
TaosMultiBind.MultiBindFloat(new float?[2] { 10.3f, 12.6f}), TaosMultiBind.MultiBindFloat(new float?[2] { 10.3f, 12.6f}),
TaosMultiBind.MultiBindInt(new int?[2] { 219, 218}), TaosMultiBind.MultiBindInt(new int?[2] { 219, 218}),
TaosMultiBind.MultiBindFloat(new float?[2]{ 0.31f, 0.33f}) TaosMultiBind.MultiBindFloat(new float?[2]{ 0.31f, 0.33f})
}; };
res = TDengine.StmtBindParamBatch(stmt, values); res = TDengine.StmtBindParamBatch(stmt, values);
CheckStmtRes(res, "failed to bind params"); CheckStmtRes(res, "failed to bind params");
// 4. add batch // 4. add batch
res = TDengine.StmtAddBatch(stmt); res = TDengine.StmtAddBatch(stmt);
CheckStmtRes(res, "failed to add batch"); CheckStmtRes(res, "failed to add batch");
// 5. execute // 5. execute
res = TDengine.StmtExecute(stmt); res = TDengine.StmtExecute(stmt);
CheckStmtRes(res, "faild to execute"); CheckStmtRes(res, "faild to execute");
// 6. free
TaosMultiBind.FreeTaosBind(tags);
TaosMultiBind.FreeTaosBind(values);
}
finally
{
TDengine.Close(conn);
}
// 6. free
TaosMultiBind.FreeTaosBind(tags);
TaosMultiBind.FreeTaosBind(values);
TDengine.Close(conn);
TDengine.Cleanup();
} }
static IntPtr GetConnection() static IntPtr GetConnection()
@ -60,8 +65,7 @@ namespace TDengineExample
var conn = TDengine.Connect(host, username, password, dbname, port); var conn = TDengine.Connect(host, username, password, dbname, port);
if (conn == IntPtr.Zero) if (conn == IntPtr.Zero)
{ {
Console.WriteLine("Connect to TDengine failed"); throw new Exception("Connect to TDengine failed");
Environment.Exit(0);
} }
else else
{ {
@ -70,8 +74,6 @@ namespace TDengineExample
return conn; return conn;
} }
static void PrepareSTable() static void PrepareSTable()
{ {
IntPtr res = TDengine.Query(conn, "CREATE DATABASE power"); IntPtr res = TDengine.Query(conn, "CREATE DATABASE power");
@ -90,9 +92,8 @@ namespace TDengineExample
int code = TDengine.StmtClose(stmt); int code = TDengine.StmtClose(stmt);
if (code != 0) if (code != 0)
{ {
Console.WriteLine($"falied to close stmt, {code} reason: {TDengine.StmtErrorStr(stmt)} "); throw new Exception($"falied to close stmt, {code} reason: {TDengine.StmtErrorStr(stmt)} ");
} }
ExitProgram();
} }
} }
@ -100,16 +101,9 @@ namespace TDengineExample
{ {
if (TDengine.ErrorNo(res) != 0) if (TDengine.ErrorNo(res) != 0)
{ {
Console.WriteLine(errorMsg + " since:" + TDengine.Error(res)); throw new Exception(errorMsg + " since:" + TDengine.Error(res));
ExitProgram();
} }
} }
static void ExitProgram()
{
TDengine.Close(conn);
TDengine.Cleanup();
Environment.Exit(1);
}
} }
} }

View File

@ -11,11 +11,10 @@ namespace TMQExample
{ {
IntPtr conn = GetConnection(); IntPtr conn = GetConnection();
string topic = "topic_example"; string topic = "topic_example";
Console.WriteLine($"create topic if not exist {topic} as select * from meters");
//create topic //create topic
IntPtr res = TDengine.Query(conn, $"create topic if not exists {topic} as select * from meters"); IntPtr res = TDengine.Query(conn, $"create topic if not exists {topic} as select * from meters");
if (res == IntPtr.Zero) if (TDengine.ErrorNo(res) != 0 )
{ {
throw new Exception($"create topic failed, reason:{TDengine.Error(res)}"); throw new Exception($"create topic failed, reason:{TDengine.Error(res)}");
} }
@ -26,7 +25,7 @@ namespace TMQExample
TDConnectUser = "root", TDConnectUser = "root",
TDConnectPasswd = "taosdata", TDConnectPasswd = "taosdata",
MsgWithTableName = "true", MsgWithTableName = "true",
TDConnectIp = "127.0.0.1", TDConnectIp = "127.0.0.1",
}; };
// create consumer // create consumer
@ -65,7 +64,6 @@ namespace TMQExample
List<string> topics = consumer.Subscription(); List<string> topics = consumer.Subscription();
topics.ForEach(t => Console.WriteLine("topic name:{0}", t)); topics.ForEach(t => Console.WriteLine("topic name:{0}", t));
// unsubscribe // unsubscribe
consumer.Unsubscribe(); consumer.Unsubscribe();
@ -73,7 +71,6 @@ namespace TMQExample
consumer.Close(); consumer.Close();
TDengine.Close(conn); TDengine.Close(conn);
} }
static IntPtr GetConnection() static IntPtr GetConnection()
@ -86,8 +83,7 @@ namespace TMQExample
var conn = TDengine.Connect(host, username, password, dbname, port); var conn = TDengine.Connect(host, username, password, dbname, port);
if (conn == IntPtr.Zero) if (conn == IntPtr.Zero)
{ {
Console.WriteLine("Connect to TDengine failed"); throw new Exception("Connect to TDengine failed");
System.Environment.Exit(0);
} }
else else
{ {

View File

@ -9,7 +9,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="TDengine.Connector" Version="3.0.0" /> <PackageReference Include="TDengine.Connector" Version="3.0.1" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -47,7 +47,7 @@ namespace Examples
} }
else else
{ {
Console.WriteLine("{0} success affect {2} rows, cost {1} nanoseconds", desc, LibTaosWS.WSTakeTiming(wsRes),LibTaosWS.WSAffectRows(wsRes)); Console.WriteLine("{0} success affect {2} rows, cost {1} nanoseconds", desc, LibTaosWS.WSTakeTiming(wsRes), LibTaosWS.WSAffectRows(wsRes));
} }
} }
} }

View File

@ -55,7 +55,7 @@ namespace Examples
// Free result after use. // Free result after use.
LibTaosWS.WSFreeResult(wsRes); LibTaosWS.WSFreeResult(wsRes);
// close connection. // close connection.
LibTaosWS.WSClose(wsConn); LibTaosWS.WSClose(wsConn);
} }

View File

@ -1,5 +1,5 @@
```csharp title="原生连接" ```csharp title="原生连接"
{{#include docs/examples/csharp/ConnectExample.cs}} {{#include docs/examples/csharp/connect/Program.cs}}
``` ```
```csharp title="WebSocket 连接" ```csharp title="WebSocket 连接"

View File

@ -1,3 +1,3 @@
```csharp ```csharp
{{#include docs/examples/csharp/InfluxDBLineExample.cs}} {{#include docs/examples/csharp/influxdbLine/Program.cs}}
``` ```

View File

@ -1,3 +1,3 @@
```csharp ```csharp
{{#include docs/examples/csharp/OptsJsonExample.cs}} {{#include docs/examples/csharp/optsJSON/Program.cs}}
``` ```

View File

@ -1,3 +1,3 @@
```csharp ```csharp
{{#include docs/examples/csharp/OptsTelnetExample.cs}} {{#include docs/examples/csharp/optsTelnet/Program.cs}}
``` ```

View File

@ -1,3 +1,3 @@
```csharp ```csharp
{{#include docs/examples/csharp/SQLInsertExample.cs}} {{#include docs/examples/csharp/sqlInsert/Program.cs}}
``` ```

View File

@ -1,3 +1,3 @@
```csharp ```csharp
{{#include docs/examples/csharp/StmtInsertExample.cs}} {{#include docs/examples/csharp/stmtInsert/Program.cs}}
``` ```

View File

@ -1,3 +1,3 @@
```csharp ```csharp
{{#include docs/examples/csharp/QueryExample.cs}} {{#include docs/examples/csharp/query/Program.cs}}
``` ```

View File

@ -1,3 +1,3 @@
```csharp ```csharp
{{#include docs/examples/csharp/AsyncQueryExample.cs}} {{#include docs/examples/csharp/asyncQuery/Program.cs}}
``` ```

View File

@ -52,7 +52,7 @@ CREATE TABLE d1004 USING meters TAGS ("California.LosAngeles", 3);
### 创建流 ### 创建流
```sql ```sql
create stream current_stream into current_stream_output_stb as select _wstart as start, _wend as end, max(current) as max_current from meters where voltage <= 220 interval (5s); create stream current_stream into current_stream_output_stb as select _wstart as start, _wend as wend, max(current) as max_current from meters where voltage <= 220 interval (5s);
``` ```
### 写入数据 ### 写入数据
@ -71,7 +71,7 @@ insert into d1004 values("2018-10-03 14:38:06.500", 11.50000, 221, 0.35000);
```sql ```sql
taos> select start, end, max_current from current_stream_output_stb; taos> select start, end, max_current from current_stream_output_stb;
start | end | max_current | start | wend | max_current |
=========================================================================== ===========================================================================
2018-10-03 14:38:05.000 | 2018-10-03 14:38:10.000 | 10.30000 | 2018-10-03 14:38:05.000 | 2018-10-03 14:38:10.000 | 10.30000 |
2018-10-03 14:38:15.000 | 2018-10-03 14:38:20.000 | 12.60000 | 2018-10-03 14:38:15.000 | 2018-10-03 14:38:20.000 | 12.60000 |

View File

@ -1,3 +1,3 @@
```csharp ```csharp
{{#include docs/examples/csharp/SubscribeDemo.cs}} {{#include docs/examples/csharp/subscribe/Program.cs}}
``` ```

View File

@ -125,7 +125,7 @@ curl -L -u username:password -d "<SQL>" <ip>:<PORT>/rest/sql/[db_name]
### HTTP body 结构 ### HTTP body 结构
#### 正确执行 #### 正确执行插入
样例: 样例:
@ -145,7 +145,7 @@ curl -L -u username:password -d "<SQL>" <ip>:<PORT>/rest/sql/[db_name]
- rows`int`)只返回 `1`。 - rows`int`)只返回 `1`。
- data`[][]any`)返回受影响行数。 - data`[][]any`)返回受影响行数。
#### 正确查询 #### 正确执行查询
样例: 样例:

View File

@ -116,7 +116,7 @@ DSN 描述字符串基本结构如下:
- **protocol**: 显示指定以何种方式建立连接,例如:`taos+ws://localhost:6041` 指定以 Websocket 方式建立连接。 - **protocol**: 显示指定以何种方式建立连接,例如:`taos+ws://localhost:6041` 指定以 Websocket 方式建立连接。
- **username/password**: 用于创建连接的用户名及密码。 - **username/password**: 用于创建连接的用户名及密码。
- **host/port**: 指定创建连接的服务器及端口,当不指定服务器地址及端口时(`taos://`),原生连接默认为 `localhost:6030`Websocket 连接默认为 `localhost:6041` 。 - **host/port**: 指定创建连接的服务器及端口,当不指定服务器地址及端口时(`taos://`),原生连接默认为 `localhost:6030`Websocket 连接默认为 `localhost:6041` 。
- **database**: 指定默认连接的数据库名。 - **database**: 指定默认连接的数据库名,可选参数
- **params**:其他可选参数。 - **params**:其他可选参数。
一个完整的 DSN 描述字符串示例如下: 一个完整的 DSN 描述字符串示例如下:

View File

@ -154,7 +154,7 @@ namespace TDengineExample
* **host/port**: 指定创建连接的服务器及端口WebSocket 连接默认为 `localhost:6041` 。 * **host/port**: 指定创建连接的服务器及端口WebSocket 连接默认为 `localhost:6041` 。
* **database**: 指定默认连接的数据库名。 * **database**: 指定默认连接的数据库名,可选参数
* **params**:其他可选参数。 * **params**:其他可选参数。
@ -208,7 +208,7 @@ namespace TDengineExample
<TabItem value="native" label="原生连接"> <TabItem value="native" label="原生连接">
``` csharp ``` csharp
{{#include docs/examples/csharp/StmtInsertExample.cs}} {{#include docs/examples/csharp/stmtInsert/Program.cs}}
``` ```
</TabItem> </TabItem>

View File

@ -325,7 +325,7 @@ charset 的有效值是 UTF-8。
| 适用范围 | 仅服务端适用 | | 适用范围 | 仅服务端适用 |
| 含义 | dnode 支持的最大 vnode 数目 | | 含义 | dnode 支持的最大 vnode 数目 |
| 取值范围 | 0-4096 | | 取值范围 | 0-4096 |
| 缺省值 | 256 | | 缺省值 | CPU 核数的 2 倍 |
## 时间相关 ## 时间相关
@ -668,153 +668,154 @@ charset 的有效值是 UTF-8。
| 15 | telemetryPort | 否 | 是 | | 15 | telemetryPort | 否 | 是 |
| 16 | queryPolicy | 否 | 是 | | 16 | queryPolicy | 否 | 是 |
| 17 | querySmaOptimize | 否 | 是 | | 17 | querySmaOptimize | 否 | 是 |
| 18 | queryBufferSize | 是 | 是 | | 18 | queryRsmaTolerance | 否 | 是 |
| 19 | maxNumOfDistinctRes | 是 | 是 | | 19 | queryBufferSize | 是 | 是 |
| 20 | minSlidingTime | 是 | 是 | | 20 | maxNumOfDistinctRes | 是 | 是 |
| 21 | minIntervalTime | 是 | 是 | | 21 | minSlidingTime | 是 | 是 |
| 22 | countAlwaysReturnValue | 是 | 是 | | 22 | minIntervalTime | 是 | 是 |
| 23 | dataDir | 是 | 是 | | 23 | countAlwaysReturnValue | 是 | 是 |
| 24 | minimalDataDirGB | 是 | 是 | | 24 | dataDir | 是 | 是 |
| 25 | supportVnodes | 否 | 是 | | 25 | minimalDataDirGB | 是 | 是 |
| 26 | tempDir | 是 | 是 | | 26 | supportVnodes | 否 | 是 |
| 27 | minimalTmpDirGB | 是 | 是 | | 27 | tempDir | 是 | 是 |
| 28 | compressMsgSize | 是 | 是 | | 28 | minimalTmpDirGB | 是 | 是 |
| 29 | compressColData | 是 | 是 | | 29 | compressMsgSize | 是 | 是 |
| 30 | smlChildTableName | 是 | 是 | | 30 | compressColData | 是 | 是 |
| 31 | smlTagName | 是 | 是 | | 31 | smlChildTableName | 是 | 是 |
| 32 | smlDataFormat | 否 | 是 | | 32 | smlTagName | 是 | 是 |
| 33 | statusInterval | 是 | 是 | | 33 | smlDataFormat | 否 | 是 |
| 34 | shellActivityTimer | 是 | 是 | | 34 | statusInterval | 是 | 是 |
| 35 | transPullupInterval | 否 | 是 | | 35 | shellActivityTimer | 是 | 是 |
| 36 | mqRebalanceInterval | 否 | 是 | | 36 | transPullupInterval | 否 | 是 |
| 37 | ttlUnit | 否 | 是 | | 37 | mqRebalanceInterval | 否 | 是 |
| 38 | ttlPushInterval | 否 | 是 | | 38 | ttlUnit | 否 | 是 |
| 39 | numOfTaskQueueThreads | 否 | 是 | | 39 | ttlPushInterval | 否 | 是 |
| 40 | numOfRpcThreads | 否 | 是 | | 40 | numOfTaskQueueThreads | 否 | 是 |
| 41 | numOfCommitThreads | 是 | 是 | | 41 | numOfRpcThreads | 否 | 是 |
| 42 | numOfMnodeReadThreads | 否 | 是 | | 42 | numOfCommitThreads | 是 | 是 |
| 43 | numOfVnodeQueryThreads | 否 | 是 | | 43 | numOfMnodeReadThreads | 否 | 是 |
| 44 | numOfVnodeStreamThreads | 否 | 是 | | 44 | numOfVnodeQueryThreads | 否 | 是 |
| 45 | numOfVnodeFetchThreads | 否 | 是 | | 45 | numOfVnodeStreamThreads | 否 | 是 |
| 46 | numOfVnodeWriteThreads | 否 | 是 | | 46 | numOfVnodeFetchThreads | 否 | 是 |
| 47 | numOfVnodeSyncThreads | 否 | 是 | | 47 | numOfVnodeWriteThreads | 否 | 是 |
| 48 | numOfVnodeRsmaThreads | 否 | 是 | | 48 | numOfVnodeSyncThreads | 否 | 是 |
| 49 | numOfQnodeQueryThreads | 否 | 是 | | 49 | numOfVnodeRsmaThreads | 否 | 是 |
| 50 | numOfQnodeFetchThreads | 否 | 是 | | 50 | numOfQnodeQueryThreads | 否 | 是 |
| 51 | numOfSnodeSharedThreads | 否 | 是 | | 51 | numOfQnodeFetchThreads | 否 | 是 |
| 52 | numOfSnodeUniqueThreads | 否 | 是 | | 52 | numOfSnodeSharedThreads | 否 | 是 |
| 53 | rpcQueueMemoryAllowed | 否 | 是 | | 53 | numOfSnodeUniqueThreads | 否 | 是 |
| 54 | logDir | 是 | 是 | | 54 | rpcQueueMemoryAllowed | 否 | 是 |
| 55 | minimalLogDirGB | 是 | 是 | | 55 | logDir | 是 | 是 |
| 56 | numOfLogLines | 是 | 是 | | 56 | minimalLogDirGB | 是 | 是 |
| 57 | asyncLog | 是 | 是 | | 57 | numOfLogLines | 是 | 是 |
| 58 | logKeepDays | 是 | 是 | | 58 | asyncLog | 是 | 是 |
| 59 | debugFlag | 是 | 是 | | 59 | logKeepDays | 是 | 是 |
| 60 | tmrDebugFlag | 是 | 是 | | 60 | debugFlag | 是 | 是 |
| 61 | uDebugFlag | 是 | 是 | | 61 | tmrDebugFlag | 是 | 是 |
| 62 | rpcDebugFlag | 是 | 是 | | 62 | uDebugFlag | 是 | 是 |
| 63 | jniDebugFlag | 是 | 是 | | 63 | rpcDebugFlag | 是 | 是 |
| 64 | qDebugFlag | 是 | 是 | | 64 | jniDebugFlag | 是 | 是 |
| 65 | cDebugFlag | 是 | 是 | | 65 | qDebugFlag | 是 | 是 |
| 66 | dDebugFlag | 是 | 是 | | 66 | cDebugFlag | 是 | 是 |
| 67 | vDebugFlag | 是 | 是 | | 67 | dDebugFlag | 是 | 是 |
| 68 | mDebugFlag | 是 | 是 | | 68 | vDebugFlag | 是 | 是 |
| 69 | wDebugFlag | 是 | 是 | | 69 | mDebugFlag | 是 | 是 |
| 70 | sDebugFlag | 是 | 是 | | 70 | wDebugFlag | 是 | 是 |
| 71 | tsdbDebugFlag | 是 | 是 | | 71 | sDebugFlag | 是 | 是 |
| 72 | tqDebugFlag | 否 | 是 | | 72 | tsdbDebugFlag | 是 | 是 |
| 73 | fsDebugFlag | 是 | 是 | | 73 | tqDebugFlag | 否 | 是 |
| 74 | udfDebugFlag | 否 | 是 | | 74 | fsDebugFlag | 是 | 是 |
| 75 | smaDebugFlag | 否 | 是 | | 75 | udfDebugFlag | 否 | 是 |
| 76 | idxDebugFlag | 否 | 是 | | 76 | smaDebugFlag | 否 | 是 |
| 77 | tdbDebugFlag | 否 | 是 | | 77 | idxDebugFlag | 否 | 是 |
| 78 | metaDebugFlag | 否 | 是 | | 78 | tdbDebugFlag | 否 | 是 |
| 79 | timezone | 是 | 是 | | 79 | metaDebugFlag | 否 | 是 |
| 80 | locale | 是 | 是 | | 80 | timezone | 是 | 是 |
| 81 | charset | 是 | 是 | | 81 | locale | 是 | 是 |
| 82 | udf | 是 | 是 | | 82 | charset | 是 | 是 |
| 83 | enableCoreFile | 是 | 是 | | 83 | udf | 是 | 是 |
| 84 | arbitrator | 是 | 否 | | 84 | enableCoreFile | 是 | 是 |
| 85 | numOfThreadsPerCore | 是 | 否 | | 85 | arbitrator | 是 | 否 |
| 86 | numOfMnodes | 是 | 否 | | 86 | numOfThreadsPerCore | 是 | 否 |
| 87 | vnodeBak | 是 | 否 | | 87 | numOfMnodes | 是 | 否 |
| 88 | balance | 是 | 否 | | 88 | vnodeBak | 是 | 否 |
| 89 | balanceInterval | 是 | 否 | | 89 | balance | 是 | 否 |
| 90 | offlineThreshold | 是 | 否 | | 90 | balanceInterval | 是 | 否 |
| 91 | role | 是 | 否 | | 91 | offlineThreshold | 是 | 否 |
| 92 | dnodeNopLoop | 是 | 否 | | 92 | role | 是 | 否 |
| 93 | keepTimeOffset | 是 | 否 | | 93 | dnodeNopLoop | 是 | 否 |
| 94 | rpcTimer | 是 | 否 | | 94 | keepTimeOffset | 是 | 否 |
| 95 | rpcMaxTime | 是 | 否 | | 95 | rpcTimer | 是 | 否 |
| 96 | rpcForceTcp | 是 | 否 | | 96 | rpcMaxTime | 是 | 否 |
| 97 | tcpConnTimeout | 是 | 否 | | 97 | rpcForceTcp | 是 | 否 |
| 98 | syncCheckInterval | 是 | 否 | | 98 | tcpConnTimeout | 是 | 否 |
| 99 | maxTmrCtrl | 是 | 否 | | 99 | syncCheckInterval | 是 | 否 |
| 100 | monitorReplica | 是 | 否 | | 100 | maxTmrCtrl | 是 | 否 |
| 101 | smlTagNullName | 是 | 否 | | 101 | monitorReplica | 是 | 否 |
| 102 | keepColumnName | 是 | 否 | | 102 | smlTagNullName | 是 | 否 |
| 103 | ratioOfQueryCores | 是 | 否 | | 103 | keepColumnName | 是 | 否 |
| 104 | maxStreamCompDelay | 是 | 否 | | 104 | ratioOfQueryCores | 是 | 否 |
| 105 | maxFirstStreamCompDelay | 是 | 否 | | 105 | maxStreamCompDelay | 是 | 否 |
| 106 | retryStreamCompDelay | 是 | 否 | | 106 | maxFirstStreamCompDelay | 是 | 否 |
| 107 | streamCompDelayRatio | 是 | 否 | | 107 | retryStreamCompDelay | 是 | 否 |
| 108 | maxVgroupsPerDb | 是 | 否 | | 108 | streamCompDelayRatio | 是 | 否 |
| 109 | maxTablesPerVnode | 是 | 否 | | 109 | maxVgroupsPerDb | 是 | 否 |
| 110 | minTablesPerVnode | 是 | 否 | | 110 | maxTablesPerVnode | 是 | 否 |
| 111 | tableIncStepPerVnode | 是 | 否 | | 111 | minTablesPerVnode | 是 | 否 |
| 112 | cache | 是 | 否 | | 112 | tableIncStepPerVnode | 是 | 否 |
| 113 | blocks | 是 | 否 | | 113 | cache | 是 | 否 |
| 114 | days | 是 | 否 | | 114 | blocks | 是 | 否 |
| 115 | keep | 是 | 否 | | 115 | days | 是 | 否 |
| 116 | minRows | 是 | 否 | | 116 | keep | 是 | 否 |
| 117 | maxRows | 是 | 否 | | 117 | minRows | 是 | 否 |
| 118 | quorum | 是 | 否 | | 118 | maxRows | 是 | 否 |
| 119 | comp | 是 | 否 | | 119 | quorum | 是 | 否 |
| 120 | walLevel | 是 | 否 | | 120 | comp | 是 | 否 |
| 121 | fsync | 是 | 否 | | 121 | walLevel | 是 | 否 |
| 122 | replica | 是 | 否 | | 122 | fsync | 是 | 否 |
| 123 | partitions | 是 | 否 | | 123 | replica | 是 | 否 |
| 124 | quorum | 是 | 否 | | 124 | partitions | 是 | 否 |
| 125 | update | 是 | 否 | | 125 | quorum | 是 | 否 |
| 126 | cachelast | 是 | 否 | | 126 | update | 是 | 否 |
| 127 | maxSQLLength | 是 | 否 | | 127 | cachelast | 是 | 否 |
| 128 | maxWildCardsLength | 是 | 否 | | 128 | maxSQLLength | 是 | 否 |
| 129 | maxRegexStringLen | 是 | 否 | | 129 | maxWildCardsLength | 是 | 否 |
| 130 | maxNumOfOrderedRes | 是 | 否 | | 130 | maxRegexStringLen | 是 | 否 |
| 131 | maxConnections | 是 | 否 | | 131 | maxNumOfOrderedRes | 是 | 否 |
| 132 | mnodeEqualVnodeNum | 是 | 否 | | 132 | maxConnections | 是 | 否 |
| 133 | http | 是 | 否 | | 133 | mnodeEqualVnodeNum | 是 | 否 |
| 134 | httpEnableRecordSql | 是 | 否 | | 134 | http | 是 | 否 |
| 135 | httpMaxThreads | 是 | 否 | | 135 | httpEnableRecordSql | 是 | 否 |
| 136 | restfulRowLimit | 是 | 否 | | 136 | httpMaxThreads | 是 | 否 |
| 137 | httpDbNameMandatory | 是 | 否 | | 137 | restfulRowLimit | 是 | 否 |
| 138 | httpKeepAlive | 是 | 否 | | 138 | httpDbNameMandatory | 是 | 否 |
| 139 | enableRecordSql | 是 | 否 | | 139 | httpKeepAlive | 是 | 否 |
| 140 | maxBinaryDisplayWidth | 是 | 否 | | 140 | enableRecordSql | 是 | 否 |
| 141 | stream | 是 | 否 | | 141 | maxBinaryDisplayWidth | 是 | 否 |
| 142 | retrieveBlockingModel | 是 | 否 | | 142 | stream | 是 | 否 |
| 143 | tsdbMetaCompactRatio | 是 | 否 | | 143 | retrieveBlockingModel | 是 | 否 |
| 144 | defaultJSONStrType | 是 | 否 | | 144 | tsdbMetaCompactRatio | 是 | 否 |
| 145 | walFlushSize | 是 | 否 | | 145 | defaultJSONStrType | 是 | 否 |
| 146 | keepTimeOffset | 是 | 否 | | 146 | walFlushSize | 是 | 否 |
| 147 | flowctrl | 是 | 否 | | 147 | keepTimeOffset | 是 | 否 |
| 148 | slaveQuery | 是 | 否 | | 148 | flowctrl | 是 | 否 |
| 149 | adjustMaster | 是 | 否 | | 149 | slaveQuery | 是 | 否 |
| 150 | topicBinaryLen | 是 | 否 | | 150 | adjustMaster | 是 | 否 |
| 151 | telegrafUseFieldNum | 是 | 否 | | 151 | topicBinaryLen | 是 | 否 |
| 152 | deadLockKillQuery | 是 | 否 | | 152 | telegrafUseFieldNum | 是 | 否 |
| 153 | clientMerge | 是 | 否 | | 153 | deadLockKillQuery | 是 | 否 |
| 154 | sdbDebugFlag | 是 | 否 | | 154 | clientMerge | 是 | 否 |
| 155 | odbcDebugFlag | 是 | 否 | | 155 | sdbDebugFlag | 是 | 否 |
| 156 | httpDebugFlag | 是 | 否 | | 156 | odbcDebugFlag | 是 | 否 |
| 157 | monDebugFlag | 是 | 否 | | 157 | httpDebugFlag | 是 | 否 |
| 158 | cqDebugFlag | 是 | 否 | | 158 | monDebugFlag | 是 | 否 |
| 159 | shortcutFlag | 是 | 否 | | 159 | cqDebugFlag | 是 | 否 |
| 160 | probeSeconds | 是 | 否 | | 160 | shortcutFlag | 是 | 否 |
| 161 | probeKillSeconds | 是 | 否 | | 161 | probeSeconds | 是 | 否 |
| 162 | probeInterval | 是 | 否 | | 162 | probeKillSeconds | 是 | 否 |
| 163 | lossyColumns | 是 | 否 | | 163 | probeInterval | 是 | 否 |
| 164 | fPrecision | 是 | 否 | | 164 | lossyColumns | 是 | 否 |
| 165 | dPrecision | 是 | 否 | | 165 | fPrecision | 是 | 否 |
| 166 | maxRange | 是 | 否 | | 166 | dPrecision | 是 | 否 |
| 167 | range | 是 | 否 | | 167 | maxRange | 是 | 否 |
| 168 | range | 是 | 否 |

View File

@ -6,6 +6,9 @@ description: TDengine 发布历史、Release Notes 及下载链接
import Release from "/components/ReleaseV3"; import Release from "/components/ReleaseV3";
## 3.0.1.2
<Release type="tdengine" version="3.0.1.2" />
## 3.0.1.1 ## 3.0.1.1

View File

@ -6,6 +6,10 @@ description: taosTools 的发布历史、Release Notes 和下载链接
import Release from "/components/ReleaseV3"; import Release from "/components/ReleaseV3";
## 2.2.2
<Release type="tools" version="2.2.2" />
## 2.2.0 ## 2.2.0
<Release type="tools" version="2.2.0" /> <Release type="tools" version="2.2.0" />

View File

@ -2,7 +2,7 @@
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "../../../../include/client/taos.h" #include "taos.h"
#include "lauxlib.h" #include "lauxlib.h"
#include "lua.h" #include "lua.h"
#include "lualib.h" #include "lualib.h"
@ -35,7 +35,7 @@ static int l_connect(lua_State *L){
} }
lua_getfield(L, 1, "port"); lua_getfield(L, 1, "port");
if (lua_isnumber(L,-1)){ if (lua_isnumber(L, -1)){
port = lua_tonumber(L, -1); port = lua_tonumber(L, -1);
//printf("port = %d\n", port); //printf("port = %d\n", port);
} }
@ -60,7 +60,6 @@ static int l_connect(lua_State *L){
lua_settop(L,0); lua_settop(L,0);
taos_init();
lua_newtable(L); lua_newtable(L);
int table_index = lua_gettop(L); int table_index = lua_gettop(L);
@ -102,7 +101,7 @@ static int l_query(lua_State *L){
printf("failed, reason:%s\n", taos_errstr(result)); printf("failed, reason:%s\n", taos_errstr(result));
lua_pushinteger(L, -1); lua_pushinteger(L, -1);
lua_setfield(L, table_index, "code"); lua_setfield(L, table_index, "code");
lua_pushstring(L, taos_errstr(taos)); lua_pushstring(L, taos_errstr(result));
lua_setfield(L, table_index, "error"); lua_setfield(L, table_index, "error");
return 1; return 1;
@ -113,7 +112,6 @@ static int l_query(lua_State *L){
int rows = 0; int rows = 0;
int num_fields = taos_field_count(result); int num_fields = taos_field_count(result);
const TAOS_FIELD *fields = taos_fetch_fields(result); const TAOS_FIELD *fields = taos_fetch_fields(result);
//char temp[256];
const int affectRows = taos_affected_rows(result); const int affectRows = taos_affected_rows(result);
// printf(" affect rows:%d\r\n", affectRows); // printf(" affect rows:%d\r\n", affectRows);
@ -122,7 +120,7 @@ static int l_query(lua_State *L){
lua_pushinteger(L, affectRows); lua_pushinteger(L, affectRows);
lua_setfield(L, table_index, "affected"); lua_setfield(L, table_index, "affected");
lua_newtable(L); lua_newtable(L);
while ((row = taos_fetch_row(result))) { while ((row = taos_fetch_row(result))) {
//printf("row index:%d\n",rows); //printf("row index:%d\n",rows);
rows++; rows++;
@ -136,7 +134,7 @@ static int l_query(lua_State *L){
} }
lua_pushstring(L,fields[i].name); lua_pushstring(L,fields[i].name);
int32_t* length = taos_fetch_lengths(result);
switch (fields[i].type) { switch (fields[i].type) {
case TSDB_DATA_TYPE_TINYINT: case TSDB_DATA_TYPE_TINYINT:
lua_pushinteger(L,*((char *)row[i])); lua_pushinteger(L,*((char *)row[i]));
@ -158,7 +156,8 @@ static int l_query(lua_State *L){
break; break;
case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_BINARY:
case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_NCHAR:
lua_pushstring(L,(char *)row[i]); //printf("type:%d, max len:%d, current len:%d\n",fields[i].type, fields[i].bytes, length[i]);
lua_pushlstring(L,(char *)row[i], length[i]);
break; break;
case TSDB_DATA_TYPE_TIMESTAMP: case TSDB_DATA_TYPE_TIMESTAMP:
lua_pushinteger(L,*((int64_t *)row[i])); lua_pushinteger(L,*((int64_t *)row[i]));
@ -166,6 +165,7 @@ static int l_query(lua_State *L){
case TSDB_DATA_TYPE_BOOL: case TSDB_DATA_TYPE_BOOL:
lua_pushinteger(L,*((char *)row[i])); lua_pushinteger(L,*((char *)row[i]));
break; break;
case TSDB_DATA_TYPE_NULL:
default: default:
lua_pushnil(L); lua_pushnil(L);
break; break;
@ -235,112 +235,6 @@ static int l_async_query(lua_State *L){
return 1; return 1;
} }
void stream_cb(void *param, TAOS_RES *result, TAOS_ROW row){
struct cb_param* p = (struct cb_param*) param;
TAOS_FIELD *fields = taos_fetch_fields(result);
int numFields = taos_num_fields(result);
// printf("\nnumfields:%d\n", numFields);
//printf("\n\r-----------------------------------------------------------------------------------\n");
lua_State *L = p->state;
lua_rawgeti(L, LUA_REGISTRYINDEX, p->callback);
lua_newtable(L);
for (int i = 0; i < numFields; ++i) {
if (row[i] == NULL) {
continue;
}
lua_pushstring(L,fields[i].name);
switch (fields[i].type) {
case TSDB_DATA_TYPE_TINYINT:
lua_pushinteger(L,*((char *)row[i]));
break;
case TSDB_DATA_TYPE_SMALLINT:
lua_pushinteger(L,*((short *)row[i]));
break;
case TSDB_DATA_TYPE_INT:
lua_pushinteger(L,*((int *)row[i]));
break;
case TSDB_DATA_TYPE_BIGINT:
lua_pushinteger(L,*((int64_t *)row[i]));
break;
case TSDB_DATA_TYPE_FLOAT:
lua_pushnumber(L,*((float *)row[i]));
break;
case TSDB_DATA_TYPE_DOUBLE:
lua_pushnumber(L,*((double *)row[i]));
break;
case TSDB_DATA_TYPE_BINARY:
case TSDB_DATA_TYPE_NCHAR:
lua_pushstring(L,(char *)row[i]);
break;
case TSDB_DATA_TYPE_TIMESTAMP:
lua_pushinteger(L,*((int64_t *)row[i]));
break;
case TSDB_DATA_TYPE_BOOL:
lua_pushinteger(L,*((char *)row[i]));
break;
default:
lua_pushnil(L);
break;
}
lua_settable(L, -3);
}
lua_call(L, 1, 0);
// printf("-----------------------------------------------------------------------------------\n\r");
}
static int l_open_stream(lua_State *L){
int r = luaL_ref(L, LUA_REGISTRYINDEX);
TAOS * taos = (TAOS*)lua_topointer(L,1);
const char * sqlstr = lua_tostring(L,2);
int stime = luaL_checknumber(L,3);
lua_newtable(L);
int table_index = lua_gettop(L);
struct cb_param *p = malloc(sizeof(struct cb_param));
p->state = L;
p->callback=r;
// printf("r:%d, L:%d\n",r,L);
void * s = taos_open_stream(taos,sqlstr,stream_cb,stime,p,NULL);
if (s == NULL) {
printf("failed to open stream, reason:%s\n", taos_errstr(taos));
free(p);
lua_pushnumber(L, -1);
lua_setfield(L, table_index, "code");
lua_pushstring(L, taos_errstr(taos));
lua_setfield(L, table_index, "error");
lua_pushlightuserdata(L,NULL);
lua_setfield(L, table_index, "stream");
}else{
// printf("success to open stream\n");
lua_pushnumber(L, 0);
lua_setfield(L, table_index, "code");
lua_pushstring(L, taos_errstr(taos));
lua_setfield(L, table_index, "error");
p->stream = s;
lua_pushlightuserdata(L,p);
lua_setfield(L, table_index, "stream");//stream has different content in lua and c.
}
return 1;
}
static int l_close_stream(lua_State *L){
//TODO:get stream and free cb_param
struct cb_param *p = lua_touserdata(L,1);
taos_close_stream(p->stream);
free(p);
return 0;
}
static int l_close(lua_State *L){ static int l_close(lua_State *L){
TAOS *taos= (TAOS*)lua_topointer(L,1); TAOS *taos= (TAOS*)lua_topointer(L,1);
@ -367,8 +261,6 @@ static const struct luaL_Reg lib[] = {
{"query", l_query}, {"query", l_query},
{"query_a",l_async_query}, {"query_a",l_async_query},
{"close", l_close}, {"close", l_close},
{"open_stream", l_open_stream},
{"close_stream", l_close_stream},
{NULL, NULL} {NULL, NULL}
}; };

View File

@ -5,7 +5,7 @@
#include <lua.h> #include <lua.h>
#include <lauxlib.h> #include <lauxlib.h>
#include <lualib.h> #include <lualib.h>
#include "taos.h" #include <taos.h>
struct cb_param{ struct cb_param{
lua_State* state; lua_State* state;
@ -60,6 +60,8 @@ static int l_connect(lua_State *L){
lua_settop(L,0); lua_settop(L,0);
taos_init();
lua_newtable(L); lua_newtable(L);
int table_index = lua_gettop(L); int table_index = lua_gettop(L);

View File

@ -9,6 +9,50 @@ local config = {
max_packet_size = 1024 * 1024 max_packet_size = 1024 * 1024
} }
function dump(obj)
local getIndent, quoteStr, wrapKey, wrapVal, dumpObj
getIndent = function(level)
return string.rep("\t", level)
end
quoteStr = function(str)
return '"' .. string.gsub(str, '"', '\\"') .. '"'
end
wrapKey = function(val)
if type(val) == "number" then
return "[" .. val .. "]"
elseif type(val) == "string" then
return "[" .. quoteStr(val) .. "]"
else
return "[" .. tostring(val) .. "]"
end
end
wrapVal = function(val, level)
if type(val) == "table" then
return dumpObj(val, level)
elseif type(val) == "number" then
return val
elseif type(val) == "string" then
return quoteStr(val)
else
return tostring(val)
end
end
dumpObj = function(obj, level)
if type(obj) ~= "table" then
return wrapVal(obj)
end
level = level + 1
local tokens = {}
tokens[#tokens + 1] = "{"
for k, v in pairs(obj) do
tokens[#tokens + 1] = getIndent(level) .. wrapKey(k) .. " = " .. wrapVal(v, level) .. ","
end
tokens[#tokens + 1] = getIndent(level - 1) .. "}"
return table.concat(tokens, "\n")
end
return dumpObj(obj, 0)
end
local conn local conn
local res = driver.connect(config) local res = driver.connect(config)
if res.code ~=0 then if res.code ~=0 then
@ -37,7 +81,7 @@ else
print("select db--- pass.") print("select db--- pass.")
end end
res = driver.query(conn,"create table m1 (ts timestamp, speed int,owner binary(20))") res = driver.query(conn,"create table m1 (ts timestamp, speed int, owner binary(20), mark nchar(30))")
if res.code ~=0 then if res.code ~=0 then
print("create table---failed: "..res.error) print("create table---failed: "..res.error)
return return
@ -45,7 +89,7 @@ else
print("create table--- pass.") print("create table--- pass.")
end end
res = driver.query(conn,"insert into m1 values ('2019-09-01 00:00:00.001',0,'robotspace'), ('2019-09-01 00:00:00.002',1,'Hilink'),('2019-09-01 00:00:00.003',2,'Harmony')") res = driver.query(conn,"insert into m1 values ('2019-09-01 00:00:00.001', 0, 'robotspace', '世界人民大团结万岁'), ('2019-09-01 00:00:00.002', 1, 'Hilink', '⾾⾿⿀⿁⿂⿃⿄⿅⿆⿇⿈⿉⿊⿋⿌⿍⿎⿏⿐⿑⿒⿓⿔⿕'),('2019-09-01 00:00:00.003', 2, 'Harmony', '₠₡₢₣₤₥₦₧₨₩₪₫€₭₮₯₰₱₲₳₴₵')")
if res.code ~=0 then if res.code ~=0 then
print("insert records failed: "..res.error) print("insert records failed: "..res.error)
return return
@ -64,21 +108,25 @@ if res.code ~=0 then
return return
else else
if (#(res.item) == 3) then if (#(res.item) == 3) then
print("select--- pass") print("select--- pass")
print(res.item[1].mark)
print(res.item[2].mark)
print(res.item[3].mark)
else else
print("select--- failed: expect 3 affected records, actually received "..#(res.item)) print("select--- failed: expect 3 affected records, actually received "..#(res.item))
end end
end end
res = driver.query(conn,"CREATE TABLE thermometer (ts timestamp, degree double) TAGS(location binary(20), type int)") res = driver.query(conn,"create table thermometer (ts timestamp, degree double) tags(location binary(20), type int)")
if res.code ~=0 then if res.code ~=0 then
print(res.error) print(res.error)
return return
else else
print("create super table--- pass") print("create super table--- pass")
end end
res = driver.query(conn,"CREATE TABLE therm1 USING thermometer TAGS ('beijing', 1)") res = driver.query(conn,"create table therm1 using thermometer tags ('beijing', 1)")
if res.code ~=0 then if res.code ~=0 then
print(res.error) print(res.error)
return return
@ -86,7 +134,7 @@ else
print("create table--- pass") print("create table--- pass")
end end
res = driver.query(conn,"INSERT INTO therm1 VALUES ('2019-09-01 00:00:00.001', 20),('2019-09-01 00:00:00.002', 21)") res = driver.query(conn,"insert into therm1 values ('2019-09-01 00:00:00.001', 20),('2019-09-01 00:00:00.002', 21)")
if res.code ~=0 then if res.code ~=0 then
print(res.error) print(res.error)
@ -99,14 +147,14 @@ else
end end
end end
res = driver.query(conn,"SELECT COUNT(*) count, AVG(degree) AS av, MAX(degree), MIN(degree) FROM thermometer WHERE location='beijing' or location='tianjin' GROUP BY location, type") res = driver.query(conn,"select count(*) as cnt, avg(degree) as av, max(degree), min(degree) from thermometer where location='beijing' or location='tianjin' group by location, type")
if res.code ~=0 then if res.code ~=0 then
print("select from super table--- failed:"..res.error) print("select from super table--- failed:"..res.error)
return return
else else
print("select from super table--- pass") print("select from super table--- pass")
for i = 1, #(res.item) do for i = 1, #(res.item) do
print("res:"..res.item[i].count) print("res:"..res.item[i].cnt)
end end
end end
@ -127,30 +175,13 @@ end
driver.query_a(conn,"INSERT INTO therm1 VALUES ('2019-09-01 00:00:00.005', 100),('2019-09-01 00:00:00.006', 101),('2019-09-01 00:00:00.007', 102)", async_query_callback) driver.query_a(conn,"INSERT INTO therm1 VALUES ('2019-09-01 00:00:00.005', 100),('2019-09-01 00:00:00.006', 101),('2019-09-01 00:00:00.007', 102)", async_query_callback)
res = driver.query(conn, "create stream stream_avg_degree into avg_degree as select avg(degree) from thermometer interval(5s) sliding(1s)")
function stream_callback(t) print("From now on we start continous insert in an definite loop, pls wait for about 10 seconds and check stream table for result.")
print("------------------------")
print("continuous query result:")
for key, value in pairs(t) do
print("key:"..key..", value:"..value)
end
end
local stream
res = driver.open_stream(conn,"SELECT COUNT(*) as count, AVG(degree) as avg, MAX(degree) as max, MIN(degree) as min FROM thermometer interval(2s) sliding(2s);)",0, stream_callback)
if res.code ~=0 then
print("open stream--- failed:"..res.error)
return
else
print("open stream--- pass")
stream = res.stream
end
print("From now on we start continous insert in an definite (infinite if you want) loop.")
local loop_index = 0 local loop_index = 0
while loop_index < 30 do while loop_index < 10 do
local t = os.time()*1000 local t = os.time()*1000
local v = loop_index local v = math.random(20)
res = driver.query(conn,string.format("INSERT INTO therm1 VALUES (%d, %d)",t,v)) res = driver.query(conn,string.format("INSERT INTO therm1 VALUES (%d, %d)",t,v))
if res.code ~=0 then if res.code ~=0 then
@ -162,7 +193,5 @@ while loop_index < 30 do
os.execute("sleep " .. 1) os.execute("sleep " .. 1)
loop_index = loop_index + 1 loop_index = loop_index + 1
end end
driver.query(conn,"DROP STREAM IF EXISTS avg_therm_s")
driver.close_stream(stream)
driver.close(conn) driver.close(conn)

View File

@ -66,10 +66,18 @@ int32_t tGetValue(uint8_t *p, SValue *pValue, int8_t type);
int tValueCmprFn(const SValue *pValue1, const SValue *pValue2, int8_t type); int tValueCmprFn(const SValue *pValue1, const SValue *pValue2, int8_t type);
// SColVal ================================ // SColVal ================================
#define COL_VAL_NONE(CID, TYPE) ((SColVal){.cid = (CID), .type = (TYPE), .isNone = 1}) #define CV_FLAG_VALUE ((int8_t)0x0)
#define COL_VAL_NULL(CID, TYPE) ((SColVal){.cid = (CID), .type = (TYPE), .isNull = 1}) #define CV_FLAG_NONE ((int8_t)0x1)
#define CV_FLAG_NULL ((int8_t)0x2)
#define COL_VAL_NONE(CID, TYPE) ((SColVal){.cid = (CID), .type = (TYPE), .flag = CV_FLAG_NONE})
#define COL_VAL_NULL(CID, TYPE) ((SColVal){.cid = (CID), .type = (TYPE), .flag = CV_FLAG_NULL})
#define COL_VAL_VALUE(CID, TYPE, V) ((SColVal){.cid = (CID), .type = (TYPE), .value = (V)}) #define COL_VAL_VALUE(CID, TYPE, V) ((SColVal){.cid = (CID), .type = (TYPE), .value = (V)})
#define COL_VAL_IS_NONE(CV) ((CV)->flag == CV_FLAG_NONE)
#define COL_VAL_IS_NULL(CV) ((CV)->flag == CV_FLAG_NULL)
#define COL_VAL_IS_VALUE(CV) ((CV)->flag == CV_FLAG_VALUE)
// STSRow2 ================================ // STSRow2 ================================
#define TSROW_LEN(PROW, V) tGetI32v((uint8_t *)(PROW)->data, (V) ? &(V) : NULL) #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) #define TSROW_SVER(PROW, V) tGetI32v((PROW)->data + TSROW_LEN(PROW, NULL), (V) ? &(V) : NULL)
@ -175,8 +183,7 @@ struct SValue {
struct SColVal { struct SColVal {
int16_t cid; int16_t cid;
int8_t type; int8_t type;
int8_t isNone; int8_t flag;
int8_t isNull;
SValue value; SValue value;
}; };

View File

@ -94,6 +94,7 @@ extern int64_t tsQueryBufferSizeBytes; // maximum allowed usage buffer size in
// query client // query client
extern int32_t tsQueryPolicy; extern int32_t tsQueryPolicy;
extern int32_t tsQuerySmaOptimize; extern int32_t tsQuerySmaOptimize;
extern int32_t tsQueryRsmaTolerance;
extern bool tsQueryPlannerTrace; extern bool tsQueryPlannerTrace;
extern int32_t tsQueryNodeChunkSize; extern int32_t tsQueryNodeChunkSize;
extern bool tsQueryUseNodeAllocator; extern bool tsQueryUseNodeAllocator;

View File

@ -1424,6 +1424,14 @@ typedef struct {
SExplainExecInfo* subplanInfo; SExplainExecInfo* subplanInfo;
} SExplainRsp; } SExplainRsp;
typedef struct {
SExplainRsp rsp;
uint64_t qId;
uint64_t tId;
int64_t rId;
int32_t eId;
} SExplainLocalRsp;
typedef struct STableScanAnalyzeInfo { typedef struct STableScanAnalyzeInfo {
uint64_t totalRows; uint64_t totalRows;
uint64_t totalCheckedRows; uint64_t totalCheckedRows;
@ -1438,6 +1446,7 @@ typedef struct STableScanAnalyzeInfo {
int32_t tSerializeSExplainRsp(void* buf, int32_t bufLen, SExplainRsp* pRsp); int32_t tSerializeSExplainRsp(void* buf, int32_t bufLen, SExplainRsp* pRsp);
int32_t tDeserializeSExplainRsp(void* buf, int32_t bufLen, SExplainRsp* pRsp); int32_t tDeserializeSExplainRsp(void* buf, int32_t bufLen, SExplainRsp* pRsp);
void tFreeSExplainRsp(SExplainRsp *pRsp);
typedef struct { typedef struct {
char fqdn[TSDB_FQDN_LEN]; // end point, hostname:port char fqdn[TSDB_FQDN_LEN]; // end point, hostname:port
@ -2337,6 +2346,7 @@ int32_t tSerializeSClientHbBatchReq(void* buf, int32_t bufLen, const SClientHbBa
int32_t tDeserializeSClientHbBatchReq(void* buf, int32_t bufLen, SClientHbBatchReq* pReq); int32_t tDeserializeSClientHbBatchReq(void* buf, int32_t bufLen, SClientHbBatchReq* pReq);
static FORCE_INLINE void tFreeClientHbBatchReq(void* pReq) { static FORCE_INLINE void tFreeClientHbBatchReq(void* pReq) {
if (pReq == NULL) return;
SClientHbBatchReq* req = (SClientHbBatchReq*)pReq; SClientHbBatchReq* req = (SClientHbBatchReq*)pReq;
taosArrayDestroyEx(req->reqs, tFreeClientHbReq); taosArrayDestroyEx(req->reqs, tFreeClientHbReq);
taosMemoryFree(pReq); taosMemoryFree(pReq);

View File

@ -234,96 +234,100 @@
#define TK_CURRENT_USER 216 #define TK_CURRENT_USER 216
#define TK_COUNT 217 #define TK_COUNT 217
#define TK_LAST_ROW 218 #define TK_LAST_ROW 218
#define TK_BETWEEN 219 #define TK_CASE 219
#define TK_IS 220 #define TK_END 220
#define TK_NK_LT 221 #define TK_WHEN 221
#define TK_NK_GT 222 #define TK_THEN 222
#define TK_NK_LE 223 #define TK_ELSE 223
#define TK_NK_GE 224 #define TK_BETWEEN 224
#define TK_NK_NE 225 #define TK_IS 225
#define TK_MATCH 226 #define TK_NK_LT 226
#define TK_NMATCH 227 #define TK_NK_GT 227
#define TK_CONTAINS 228 #define TK_NK_LE 228
#define TK_IN 229 #define TK_NK_GE 229
#define TK_JOIN 230 #define TK_NK_NE 230
#define TK_INNER 231 #define TK_MATCH 231
#define TK_SELECT 232 #define TK_NMATCH 232
#define TK_DISTINCT 233 #define TK_CONTAINS 233
#define TK_WHERE 234 #define TK_IN 234
#define TK_PARTITION 235 #define TK_JOIN 235
#define TK_BY 236 #define TK_INNER 236
#define TK_SESSION 237 #define TK_SELECT 237
#define TK_STATE_WINDOW 238 #define TK_DISTINCT 238
#define TK_SLIDING 239 #define TK_WHERE 239
#define TK_FILL 240 #define TK_PARTITION 240
#define TK_VALUE 241 #define TK_BY 241
#define TK_NONE 242 #define TK_SESSION 242
#define TK_PREV 243 #define TK_STATE_WINDOW 243
#define TK_LINEAR 244 #define TK_SLIDING 244
#define TK_NEXT 245 #define TK_FILL 245
#define TK_HAVING 246 #define TK_VALUE 246
#define TK_RANGE 247 #define TK_NONE 247
#define TK_EVERY 248 #define TK_PREV 248
#define TK_ORDER 249 #define TK_LINEAR 249
#define TK_SLIMIT 250 #define TK_NEXT 250
#define TK_SOFFSET 251 #define TK_HAVING 251
#define TK_LIMIT 252 #define TK_RANGE 252
#define TK_OFFSET 253 #define TK_EVERY 253
#define TK_ASC 254 #define TK_ORDER 254
#define TK_NULLS 255 #define TK_SLIMIT 255
#define TK_ABORT 256 #define TK_SOFFSET 256
#define TK_AFTER 257 #define TK_LIMIT 257
#define TK_ATTACH 258 #define TK_OFFSET 258
#define TK_BEFORE 259 #define TK_ASC 259
#define TK_BEGIN 260 #define TK_NULLS 260
#define TK_BITAND 261 #define TK_ABORT 261
#define TK_BITNOT 262 #define TK_AFTER 262
#define TK_BITOR 263 #define TK_ATTACH 263
#define TK_BLOCKS 264 #define TK_BEFORE 264
#define TK_CHANGE 265 #define TK_BEGIN 265
#define TK_COMMA 266 #define TK_BITAND 266
#define TK_COMPACT 267 #define TK_BITNOT 267
#define TK_CONCAT 268 #define TK_BITOR 268
#define TK_CONFLICT 269 #define TK_BLOCKS 269
#define TK_COPY 270 #define TK_CHANGE 270
#define TK_DEFERRED 271 #define TK_COMMA 271
#define TK_DELIMITERS 272 #define TK_COMPACT 272
#define TK_DETACH 273 #define TK_CONCAT 273
#define TK_DIVIDE 274 #define TK_CONFLICT 274
#define TK_DOT 275 #define TK_COPY 275
#define TK_EACH 276 #define TK_DEFERRED 276
#define TK_END 277 #define TK_DELIMITERS 277
#define TK_FAIL 278 #define TK_DETACH 278
#define TK_FILE 279 #define TK_DIVIDE 279
#define TK_FOR 280 #define TK_DOT 280
#define TK_GLOB 281 #define TK_EACH 281
#define TK_ID 282 #define TK_FAIL 282
#define TK_IMMEDIATE 283 #define TK_FILE 283
#define TK_IMPORT 284 #define TK_FOR 284
#define TK_INITIALLY 285 #define TK_GLOB 285
#define TK_INSTEAD 286 #define TK_ID 286
#define TK_ISNULL 287 #define TK_IMMEDIATE 287
#define TK_KEY 288 #define TK_IMPORT 288
#define TK_NK_BITNOT 289 #define TK_INITIALLY 289
#define TK_NK_SEMI 290 #define TK_INSTEAD 290
#define TK_NOTNULL 291 #define TK_ISNULL 291
#define TK_OF 292 #define TK_KEY 292
#define TK_PLUS 293 #define TK_NK_BITNOT 293
#define TK_PRIVILEGE 294 #define TK_NK_SEMI 294
#define TK_RAISE 295 #define TK_NOTNULL 295
#define TK_REPLACE 296 #define TK_OF 296
#define TK_RESTRICT 297 #define TK_PLUS 297
#define TK_ROW 298 #define TK_PRIVILEGE 298
#define TK_SEMI 299 #define TK_RAISE 299
#define TK_STAR 300 #define TK_REPLACE 300
#define TK_STATEMENT 301 #define TK_RESTRICT 301
#define TK_STRING 302 #define TK_ROW 302
#define TK_TIMES 303 #define TK_SEMI 303
#define TK_UPDATE 304 #define TK_STAR 304
#define TK_VALUES 305 #define TK_STATEMENT 305
#define TK_VARIABLE 306 #define TK_STRING 306
#define TK_VIEW 307 #define TK_TIMES 307
#define TK_WAL 308 #define TK_UPDATE 308
#define TK_VALUES 309
#define TK_VARIABLE 310
#define TK_VIEW 311
#define TK_WAL 312
#define TK_NK_SPACE 300 #define TK_NK_SPACE 300
#define TK_NK_COMMENT 301 #define TK_NK_COMMENT 301

View File

@ -29,6 +29,15 @@ typedef void* DataSinkHandle;
struct SRpcMsg; struct SRpcMsg;
struct SSubplan; struct SSubplan;
typedef int32_t (*localFetchFp)(void *, uint64_t, uint64_t, uint64_t, int64_t, int32_t, void**, SArray*);
typedef struct {
void *handle;
bool localExec;
localFetchFp fp;
SArray *explainRes;
} SLocalFetch;
typedef struct { typedef struct {
void* tqReader; void* tqReader;
void* meta; void* meta;
@ -127,7 +136,7 @@ int32_t qGetQueryTableSchemaVersion(qTaskInfo_t tinfo, char* dbName, char* table
* @param handle * @param handle
* @return * @return
*/ */
int32_t qExecTaskOpt(qTaskInfo_t tinfo, SArray* pResList, uint64_t* useconds); int32_t qExecTaskOpt(qTaskInfo_t tinfo, SArray* pResList, uint64_t* useconds, SLocalFetch *pLocal);
int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pBlock, uint64_t* useconds); int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pBlock, uint64_t* useconds);
/** /**

View File

@ -78,7 +78,6 @@ enum {
MAIN_SCAN = 0x0u, MAIN_SCAN = 0x0u,
REVERSE_SCAN = 0x1u, // todo remove it REVERSE_SCAN = 0x1u, // todo remove it
REPEAT_SCAN = 0x2u, // repeat scan belongs to the master scan REPEAT_SCAN = 0x2u, // repeat scan belongs to the master scan
MERGE_STAGE = 0x20u,
}; };
typedef struct SPoint1 { typedef struct SPoint1 {
@ -156,11 +155,6 @@ typedef struct SqlFunctionCtx {
char udfName[TSDB_FUNC_NAME_LEN]; char udfName[TSDB_FUNC_NAME_LEN];
} SqlFunctionCtx; } SqlFunctionCtx;
enum {
TEXPR_BINARYEXPR_NODE = 0x1,
TEXPR_UNARYEXPR_NODE = 0x2,
};
typedef struct tExprNode { typedef struct tExprNode {
int32_t nodeType; int32_t nodeType;
union { union {
@ -182,8 +176,9 @@ struct SScalarParam {
SColumnInfoData *columnData; SColumnInfoData *columnData;
SHashObj *pHashFilter; SHashObj *pHashFilter;
int32_t hashValueType; int32_t hashValueType;
void *param; // other parameter, such as meta handle from vnode, to extract table name/tag value void *param; // other parameter, such as meta handle from vnode, to extract table name/tag value
int32_t numOfRows; int32_t numOfRows;
int32_t numOfQualified; // number of qualified elements in the final results
}; };
void cleanupResultRowEntry(struct SResultRowEntryInfo *pCell); void cleanupResultRowEntry(struct SResultRowEntryInfo *pCell);
@ -201,8 +196,6 @@ int32_t taosGetLinearInterpolationVal(SPoint *point, int32_t outputType, SPoint
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// udf api // udf api
struct SUdfInfo;
/** /**
* create udfd proxy, called once in process that call doSetupUdf/callUdfxxx/doTeardownUdf * create udfd proxy, called once in process that call doSetupUdf/callUdfxxx/doTeardownUdf
* @return error code * @return error code
@ -226,6 +219,7 @@ int32_t udfStartUdfd(int32_t startDnodeId);
* @return * @return
*/ */
int32_t udfStopUdfd(); int32_t udfStopUdfd();
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -103,6 +103,8 @@ typedef enum ENodeType {
QUERY_NODE_STREAM_OPTIONS, QUERY_NODE_STREAM_OPTIONS,
QUERY_NODE_LEFT_VALUE, QUERY_NODE_LEFT_VALUE,
QUERY_NODE_COLUMN_REF, QUERY_NODE_COLUMN_REF,
QUERY_NODE_WHEN_THEN,
QUERY_NODE_CASE_WHEN,
// Statement nodes are used in parser and planner module. // Statement nodes are used in parser and planner module.
QUERY_NODE_SET_OPERATOR = 100, QUERY_NODE_SET_OPERATOR = 100,

View File

@ -165,7 +165,8 @@ typedef struct SVnodeModifyLogicNode {
typedef struct SExchangeLogicNode { typedef struct SExchangeLogicNode {
SLogicNode node; SLogicNode node;
int32_t srcGroupId; int32_t srcStartGroupId;
int32_t srcEndGroupId;
} SExchangeLogicNode; } SExchangeLogicNode;
typedef struct SMergeLogicNode { typedef struct SMergeLogicNode {
@ -395,11 +396,15 @@ typedef struct SDownstreamSourceNode {
uint64_t schedId; uint64_t schedId;
int32_t execId; int32_t execId;
int32_t fetchMsgType; int32_t fetchMsgType;
bool localExec;
} SDownstreamSourceNode; } SDownstreamSourceNode;
typedef struct SExchangePhysiNode { typedef struct SExchangePhysiNode {
SPhysiNode node; SPhysiNode node;
int32_t srcGroupId; // group id of datasource suplans // for set operators, there will be multiple execution groups under one exchange, and the ids of these execution
// groups are consecutive
int32_t srcStartGroupId;
int32_t srcEndGroupId;
bool singleChannel; bool singleChannel;
SNodeList* pSrcEndPoints; // element is SDownstreamSource, scheduler fill by calling qSetSuplanExecutionNode SNodeList* pSrcEndPoints; // element is SDownstreamSource, scheduler fill by calling qSetSuplanExecutionNode
} SExchangePhysiNode; } SExchangePhysiNode;

View File

@ -241,6 +241,19 @@ typedef struct SFillNode {
STimeWindow timeRange; STimeWindow timeRange;
} SFillNode; } SFillNode;
typedef struct SWhenThenNode {
SExprNode node; // QUERY_NODE_WHEN_THEN
SNode* pWhen;
SNode* pThen;
} SWhenThenNode;
typedef struct SCaseWhenNode {
SExprNode node; // QUERY_NODE_CASE_WHEN
SNode* pCase;
SNode* pElse;
SNodeList* pWhenThenList;
} SCaseWhenNode;
typedef struct SSelectStmt { typedef struct SSelectStmt {
ENodeType type; // QUERY_NODE_SELECT_STMT ENodeType type; // QUERY_NODE_SELECT_STMT
bool isDistinct; bool isDistinct;

View File

@ -52,6 +52,7 @@ typedef enum {
#define QUERY_POLICY_VNODE 1 #define QUERY_POLICY_VNODE 1
#define QUERY_POLICY_HYBRID 2 #define QUERY_POLICY_HYBRID 2
#define QUERY_POLICY_QNODE 3 #define QUERY_POLICY_QNODE 3
#define QUERY_POLICY_CLIENT 4
typedef struct STableComInfo { typedef struct STableComInfo {
uint8_t numOfTags; // the number of tags in schema uint8_t numOfTags; // the number of tags in schema
@ -269,43 +270,43 @@ extern int32_t (*queryProcessMsgRsp[TDMT_MAX])(void* output, char* msg, int32_t
#define qFatal(...) \ #define qFatal(...) \
do { \ do { \
if (qDebugFlag & DEBUG_FATAL) { \ if (qDebugFlag & DEBUG_FATAL) { \
taosPrintLog("QRY FATAL ", DEBUG_FATAL, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); \ taosPrintLog("QRY FATAL ", DEBUG_FATAL, qDebugFlag, __VA_ARGS__); \
} \ } \
} while (0) } while (0)
#define qError(...) \ #define qError(...) \
do { \ do { \
if (qDebugFlag & DEBUG_ERROR) { \ if (qDebugFlag & DEBUG_ERROR) { \
taosPrintLog("QRY ERROR ", DEBUG_ERROR, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); \ taosPrintLog("QRY ERROR ", DEBUG_ERROR, qDebugFlag, __VA_ARGS__); \
} \ } \
} while (0) } while (0)
#define qWarn(...) \ #define qWarn(...) \
do { \ do { \
if (qDebugFlag & DEBUG_WARN) { \ if (qDebugFlag & DEBUG_WARN) { \
taosPrintLog("QRY WARN ", DEBUG_WARN, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); \ taosPrintLog("QRY WARN ", DEBUG_WARN, qDebugFlag, __VA_ARGS__); \
} \ } \
} while (0) } while (0)
#define qInfo(...) \ #define qInfo(...) \
do { \ do { \
if (qDebugFlag & DEBUG_INFO) { \ if (qDebugFlag & DEBUG_INFO) { \
taosPrintLog("QRY ", DEBUG_INFO, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); \ taosPrintLog("QRY ", DEBUG_INFO, qDebugFlag, __VA_ARGS__); \
} \ } \
} while (0) } while (0)
#define qDebug(...) \ #define qDebug(...) \
do { \ do { \
if (qDebugFlag & DEBUG_DEBUG) { \ if (qDebugFlag & DEBUG_DEBUG) { \
taosPrintLog("QRY ", DEBUG_DEBUG, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); \ taosPrintLog("QRY ", DEBUG_DEBUG, qDebugFlag, __VA_ARGS__); \
} \ } \
} while (0) } while (0)
#define qTrace(...) \ #define qTrace(...) \
do { \ do { \
if (qDebugFlag & DEBUG_TRACE) { \ if (qDebugFlag & DEBUG_TRACE) { \
taosPrintLog("QRY ", DEBUG_TRACE, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); \ taosPrintLog("QRY ", DEBUG_TRACE, qDebugFlag, __VA_ARGS__); \
} \ } \
} while (0) } while (0)
#define qDebugL(...) \ #define qDebugL(...) \
do { \ do { \
if (qDebugFlag & DEBUG_DEBUG) { \ if (qDebugFlag & DEBUG_DEBUG) { \
taosPrintLongString("QRY ", DEBUG_DEBUG, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); \ taosPrintLongString("QRY ", DEBUG_DEBUG, qDebugFlag, __VA_ARGS__); \
} \ } \
} while (0) } while (0)

View File

@ -29,6 +29,7 @@ enum {
NODE_TYPE_QNODE, NODE_TYPE_QNODE,
NODE_TYPE_SNODE, NODE_TYPE_SNODE,
NODE_TYPE_MNODE, NODE_TYPE_MNODE,
NODE_TYPE_CLIENT,
}; };
typedef struct SQWorkerCfg { typedef struct SQWorkerCfg {
@ -55,7 +56,24 @@ typedef struct {
uint64_t numOfErrors; uint64_t numOfErrors;
} SQWorkerStat; } SQWorkerStat;
int32_t qWorkerInit(int8_t nodeType, int32_t nodeId, SQWorkerCfg *cfg, void **qWorkerMgmt, const SMsgCb *pMsgCb); typedef struct SQWMsgInfo {
int8_t taskType;
int8_t explain;
int8_t needFetch;
} SQWMsgInfo;
typedef struct SQWMsg {
void *node;
int32_t code;
int32_t msgType;
void *msg;
int32_t msgLen;
SQWMsgInfo msgInfo;
SRpcHandleInfo connInfo;
} SQWMsg;
int32_t qWorkerInit(int8_t nodeType, int32_t nodeId, void **qWorkerMgmt, const SMsgCb *pMsgCb);
int32_t qWorkerAbortPreprocessQueryMsg(void *qWorkerMgmt, SRpcMsg *pMsg); int32_t qWorkerAbortPreprocessQueryMsg(void *qWorkerMgmt, SRpcMsg *pMsg);
@ -77,10 +95,14 @@ int32_t qWorkerProcessHbMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int64_
int32_t qWorkerProcessDeleteMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, SDeleteRes *pRes); int32_t qWorkerProcessDeleteMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, SDeleteRes *pRes);
void qWorkerDestroy(void **qWorkerMgmt); void qWorkerDestroy(void **qWorkerMgmt);
int32_t qWorkerGetStat(SReadHandle *handle, void *qWorkerMgmt, SQWorkerStat *pStat); int32_t qWorkerGetStat(SReadHandle *handle, void *qWorkerMgmt, SQWorkerStat *pStat);
int32_t qWorkerProcessLocalQuery(void *pMgmt, uint64_t sId, uint64_t qId, uint64_t tId, int64_t rId, int32_t eId, SQWMsg *qwMsg, SArray *explainRes);
int32_t qWorkerProcessLocalFetch(void *pMgmt, uint64_t sId, uint64_t qId, uint64_t tId, int64_t rId, int32_t eId, void** pRsp, SArray* explainRes);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -41,7 +41,7 @@ typedef struct SFilterColumnParam {
} SFilterColumnParam; } SFilterColumnParam;
extern int32_t filterInitFromNode(SNode *pNode, SFilterInfo **pinfo, uint32_t options); extern int32_t filterInitFromNode(SNode *pNode, SFilterInfo **pinfo, uint32_t options);
extern bool filterExecute(SFilterInfo *info, SSDataBlock *pSrc, int8_t **p, SColumnDataAgg *statis, int16_t numOfCols, int32_t* pResultStatus); extern bool filterExecute(SFilterInfo *info, SSDataBlock *pSrc, SColumnInfoData** p, SColumnDataAgg *statis, int16_t numOfCols, int32_t* pFilterResStatus);
extern int32_t filterSetDataFromSlotId(SFilterInfo *info, void *param); extern int32_t filterSetDataFromSlotId(SFilterInfo *info, void *param);
extern int32_t filterSetDataFromColId(SFilterInfo *info, void *param); extern int32_t filterSetDataFromColId(SFilterInfo *info, void *param);
extern int32_t filterGetTimeRange(SNode *pNode, STimeWindow *win, bool *isStrict); extern int32_t filterGetTimeRange(SNode *pNode, STimeWindow *win, bool *isStrict);

View File

@ -64,6 +64,7 @@ typedef bool (*schedulerChkKillFp)(void* param);
typedef struct SSchedulerReq { typedef struct SSchedulerReq {
bool syncReq; bool syncReq;
bool localReq;
SRequestConnInfo *pConn; SRequestConnInfo *pConn;
SArray *pNodeList; SArray *pNodeList;
SQueryPlan *pDag; SQueryPlan *pDag;

View File

@ -552,7 +552,6 @@ int32_t* taosGetErrno();
#define TSDB_CODE_PAR_VALUE_TOO_LONG TAOS_DEF_ERROR_CODE(0, 0x2653) #define TSDB_CODE_PAR_VALUE_TOO_LONG TAOS_DEF_ERROR_CODE(0, 0x2653)
#define TSDB_CODE_PAR_INVALID_DELETE_WHERE TAOS_DEF_ERROR_CODE(0, 0x2655) #define TSDB_CODE_PAR_INVALID_DELETE_WHERE TAOS_DEF_ERROR_CODE(0, 0x2655)
#define TSDB_CODE_PAR_INVALID_REDISTRIBUTE_VG TAOS_DEF_ERROR_CODE(0, 0x2656) #define TSDB_CODE_PAR_INVALID_REDISTRIBUTE_VG TAOS_DEF_ERROR_CODE(0, 0x2656)
#define TSDB_CODE_PAR_FILL_NOT_ALLOWED_FUNC TAOS_DEF_ERROR_CODE(0, 0x2657) #define TSDB_CODE_PAR_FILL_NOT_ALLOWED_FUNC TAOS_DEF_ERROR_CODE(0, 0x2657)
#define TSDB_CODE_PAR_INVALID_WINDOW_PC TAOS_DEF_ERROR_CODE(0, 0x2658) #define TSDB_CODE_PAR_INVALID_WINDOW_PC TAOS_DEF_ERROR_CODE(0, 0x2658)
#define TSDB_CODE_PAR_WINDOW_NOT_ALLOWED_FUNC TAOS_DEF_ERROR_CODE(0, 0x2659) #define TSDB_CODE_PAR_WINDOW_NOT_ALLOWED_FUNC TAOS_DEF_ERROR_CODE(0, 0x2659)
@ -565,6 +564,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_PAR_INVALID_SELECTED_EXPR TAOS_DEF_ERROR_CODE(0, 0x2661) #define TSDB_CODE_PAR_INVALID_SELECTED_EXPR TAOS_DEF_ERROR_CODE(0, 0x2661)
#define TSDB_CODE_PAR_GET_META_ERROR TAOS_DEF_ERROR_CODE(0, 0x2662) #define TSDB_CODE_PAR_GET_META_ERROR TAOS_DEF_ERROR_CODE(0, 0x2662)
#define TSDB_CODE_PAR_NOT_UNIQUE_TABLE_ALIAS TAOS_DEF_ERROR_CODE(0, 0x2663) #define TSDB_CODE_PAR_NOT_UNIQUE_TABLE_ALIAS TAOS_DEF_ERROR_CODE(0, 0x2663)
#define TSDB_CODE_PAR_NOT_SUPPORT_JOIN TAOS_DEF_ERROR_CODE(0, 0x2664)
#define TSDB_CODE_PAR_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x26FF) #define TSDB_CODE_PAR_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x26FF)
//planner //planner

View File

@ -225,7 +225,8 @@ typedef enum ELogicConditionType {
#define TSDB_APP_NAME_LEN TSDB_UNI_LEN #define TSDB_APP_NAME_LEN TSDB_UNI_LEN
#define TSDB_TB_COMMENT_LEN 1025 #define TSDB_TB_COMMENT_LEN 1025
#define TSDB_QUERY_ID_LEN 26 #define TSDB_QUERY_ID_LEN 26
#define TSDB_TRANS_OPER_LEN 16
/** /**
* In some scenarios uint16_t (0~65535) is used to store the row len. * In some scenarios uint16_t (0~65535) is used to store the row len.
@ -482,6 +483,7 @@ enum {
#define SNODE_HANDLE -2 #define SNODE_HANDLE -2
#define VNODE_HANDLE -3 #define VNODE_HANDLE -3
#define BNODE_HANDLE -4 #define BNODE_HANDLE -4
#define CLIENT_HANDLE -5
#define TSDB_CONFIG_OPTION_LEN 32 #define TSDB_CONFIG_OPTION_LEN 32
#define TSDB_CONFIG_VALUE_LEN 64 #define TSDB_CONFIG_VALUE_LEN 64

View File

@ -62,6 +62,7 @@ static FORCE_INLINE void taosEncryptPass_c(uint8_t *inBuf, size_t len, char *tar
tMD5Final(&context); tMD5Final(&context);
char buf[TSDB_PASSWORD_LEN + 1]; char buf[TSDB_PASSWORD_LEN + 1];
buf[TSDB_PASSWORD_LEN] = 0;
sprintf(buf, "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", context.digest[0], context.digest[1], sprintf(buf, "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", context.digest[0], context.digest[1],
context.digest[2], context.digest[3], context.digest[4], context.digest[5], context.digest[6], context.digest[2], context.digest[3], context.digest[4], context.digest[5], context.digest[6],
context.digest[7], context.digest[8], context.digest[9], context.digest[10], context.digest[11], context.digest[7], context.digest[8], context.digest[9], context.digest[10], context.digest[11],

View File

@ -1,6 +1,7 @@
#!/bin/bash #!/bin/bash
set -e set -e
#set -x #set -x
set -v
# dockerbuild.sh # dockerbuild.sh
# -n [version number] # -n [version number]
@ -11,8 +12,9 @@ set -e
version="" version=""
passWord="" passWord=""
verType="" verType=""
dockerLatest="n"
while getopts "hn:p:V:" arg while getopts "hn:p:V:a:" arg
do do
case $arg in case $arg in
n) n)
@ -29,9 +31,15 @@ do
;; ;;
h) h)
echo "Usage: `basename $0` -n [version number] " echo "Usage: `basename $0` -n [version number] "
echo " -p [password for docker hub] " echo " -p [password for docker hub] "
echo " -V [stable |beta] "
echo " -a [y | n ] "
exit 0 exit 0
;; ;;
a)
#echo "dockerLatest=$OPTARG"
dockerLatest=$(echo $OPTARG)
;;
?) #unknow option ?) #unknow option
echo "unkonw argument" echo "unkonw argument"
exit 1 exit 1
@ -41,42 +49,55 @@ done
echo "version=${version}" echo "version=${version}"
#docker manifest rm tdengine/tdengine if [ "$verType" == "stable" ]; then
#docker manifest rm tdengine/tdengine:${version} verType=stable
if [ "$verType" == "beta" ]; then dockerinput=TDengine-server-${version}-Linux-$cpuType.tar.gz
docker manifest create -a tdengine/tdengine-beta:${version} tdengine/tdengine-amd64-beta:${version} tdengine/tdengine-aarch64-beta:${version} tdengine/tdengine-aarch32-beta:${version} dockerinput_x64=TDengine-server-${version}-Linux-amd64.tar.gz
docker manifest create -a tdengine/tdengine-beta:latest tdengine/tdengine-amd64-beta:latest tdengine/tdengine-aarch64-beta:latest tdengine/tdengine-aarch32-beta:latest dockerim=tdengine/tdengine
docker manifest rm tdengine/tdengine-beta:${version} dockeramd64=tdengine/tdengine-amd64
docker manifest rm tdengine/tdengine-beta:latest dockeraarch64=tdengine/tdengine-aarch64
docker manifest create -a tdengine/tdengine-beta:${version} tdengine/tdengine-amd64-beta:${version} tdengine/tdengine-aarch64-beta:${version} tdengine/tdengine-aarch32-beta:${version} dockeraarch32=tdengine/tdengine-aarch32
docker manifest create -a tdengine/tdengine-beta:latest tdengine/tdengine-amd64-beta:latest tdengine/tdengine-aarch64-beta:latest tdengine/tdengine-aarch32-beta:latest elif [ "$verType" == "beta" ];then
docker manifest inspect tdengine/tdengine:latest verType=beta
docker manifest inspect tdengine/tdengine:${version} tagVal=ver-${version}-beta
docker login -u tdengine -p ${passWord} #replace the docker registry username and password dockerinput=TDengine-server-${version}-${verType}-Linux-$cpuType.tar.gz
docker manifest push tdengine/tdengine-beta:${version} dockerinput_x64=TDengine-server-${version}-${verType}-Linux-amd64.tar.gz
docker manifest push tdengine/tdengine-beta:latest dockerim=tdengine/tdengine-beta
elif [ "$verType" == "stable" ]; then dockeramd64=tdengine/tdengine-amd64-beta
docker manifest create -a tdengine/tdengine:${version} tdengine/tdengine-amd64:${version} tdengine/tdengine-aarch64:${version} tdengine/tdengine-aarch32:${version} dockeraarch64=tdengine/tdengine-aarch64-beta
docker manifest create -a tdengine/tdengine:latest tdengine/tdengine-amd64:latest tdengine/tdengine-aarch64:latest tdengine/tdengine-aarch32:latest dockeraarch32=tdengine/tdengine-aarch32-beta
docker manifest rm tdengine/tdengine:latest else
docker manifest rm tdengine/tdengine:${version}
docker manifest create -a tdengine/tdengine:${version} tdengine/tdengine-amd64:${version} tdengine/tdengine-aarch64:${version} tdengine/tdengine-aarch32:${version}
docker manifest create -a tdengine/tdengine:latest tdengine/tdengine-amd64:latest tdengine/tdengine-aarch64:latest tdengine/tdengine-aarch32:latest
docker manifest inspect tdengine/tdengine:latest
docker manifest inspect tdengine/tdengine:${version}
docker login -u tdengine -p ${passWord} #replace the docker registry username and password
docker manifest push tdengine/tdengine:${version}
docker manifest push tdengine/tdengine:latest
else
echo "unknow verType, nor stabel or beta" echo "unknow verType, nor stabel or beta"
exit 1 exit 1
fi fi
# docker manifest create -a tdengine/${dockername}:${version} tdengine/tdengine-amd64:${version} tdengine/tdengine-aarch64:${version} tdengine/tdengine-aarch32:${version} username="tdengine"
# docker manifest create -a tdengine/${dockername}:latest tdengine/tdengine-amd64:latest tdengine/tdengine-aarch64:latest tdengine/tdengine-aarch32:latest
# docker login -u tdengine -p ${passWord} #replace the docker registry username and password # generate docker verison
echo "generate ${dockerim}:${version}"
docker manifest create -a ${dockerim}:${version} ${dockeramd64}:${version} ${dockeraarch64}:${version}
docker manifest inspect ${dockerim}:${version}
docker manifest rm ${dockerim}:${version}
docker manifest create -a ${dockerim}:${version} ${dockeramd64}:${version} ${dockeraarch64}:${version}
docker manifest inspect ${dockerim}:${version}
docker login -u ${username} -p ${passWord}
docker manifest push ${dockerim}:${version}
# generate docker latest
echo "generate ${dockerim}:latest "
if [ ${dockerLatest} == 'y' ] ;then
echo "docker manifest create -a ${dockerim}:latest ${dockeramd64}:latest ${dockeraarch64}:latest"
docker manifest create -a ${dockerim}:latest ${dockeramd64}:latest ${dockeraarch64}:latest
docker manifest inspect ${dockerim}:latest
docker manifest rm ${dockerim}:latest
docker manifest create -a ${dockerim}:latest ${dockeramd64}:latest ${dockeraarch64}:latest
docker manifest inspect ${dockerim}:latest
docker login -u tdengine -p ${passWord} #replace the docker registry username and password
docker manifest push ${dockerim}:latest
docker pull tdengine/tdengine:latest
fi
# docker manifest push tdengine/tdengine:latest
# # how set latest version ???

View File

@ -149,26 +149,4 @@ rm -rf temp1.data
if [ ${dockerLatest} == 'y' ] ;then if [ ${dockerLatest} == 'y' ] ;then
docker tag tdengine/tdengine-${dockername}:${version} tdengine/tdengine-${dockername}:latest docker tag tdengine/tdengine-${dockername}:${version} tdengine/tdengine-${dockername}:latest
docker push tdengine/tdengine-${dockername}:latest docker push tdengine/tdengine-${dockername}:latest
echo ">>>>>>>>>>>>> check whether tdengine/tdengine-${dockername}:latest has been published correctly"
docker run -d --name doctestla -p 7030-7049:6030-6049 -p 7030-7049:6030-6049/udp tdengine/tdengine-${dockername}:latest
sleep 2
curl -u root:taosdata -d 'show variables;' 127.0.0.1:7041/rest/sql > temp2.data
version_latest=` cat temp2.data |jq .data| jq '.[]' |grep "version" -A 2 -B 1 | jq ".[1]" `
echo "${version_latest}"
if [ "${version_latest}" == "\"${version}\"" ] ; then
echo "docker version is right "
else
echo "docker version is wrong "
exit 1
fi
fi fi
rm -rf temp2.data
if [ -n "$(docker ps -aq)" ] ;then
echo "delte docker process"
docker stop $(docker ps -aq)
docker rm $(docker ps -aq)
fi
cd ${scriptDir}
rm -f ${pkgFile}

View File

@ -44,8 +44,6 @@ cmake ../../ -G "NMake Makefiles JOM" -DCMAKE_MAKE_PROGRAM=jom -DBUILD_TOOLS=tru
cmake --build . cmake --build .
rd /s /Q C:\TDengine rd /s /Q C:\TDengine
cmake --install . cmake --install .
for /r c:\TDengine %%i in (*.dll) do signtool sign /f D:\\123.pfx /p taosdata %%i
for /r c:\TDengine %%i in (*.exe) do signtool sign /f D:\\123.pfx /p taosdata %%i
if not %errorlevel% == 0 ( call :RUNFAILED build x64 failed & exit /b 1) if not %errorlevel% == 0 ( call :RUNFAILED build x64 failed & exit /b 1)
cd %package_dir% cd %package_dir%
iscc /DMyAppInstallName="%packagServerName_x64%" /DMyAppVersion="%2" /DMyAppExcludeSource="" tools\tdengine.iss /O..\release iscc /DMyAppInstallName="%packagServerName_x64%" /DMyAppVersion="%2" /DMyAppExcludeSource="" tools\tdengine.iss /O..\release
@ -53,7 +51,6 @@ if not %errorlevel% == 0 ( call :RUNFAILED package %packagServerName_x64% faile
iscc /DMyAppInstallName="%packagClientName_x64%" /DMyAppVersion="%2" /DMyAppExcludeSource="taosd.exe" tools\tdengine.iss /O..\release iscc /DMyAppInstallName="%packagClientName_x64%" /DMyAppVersion="%2" /DMyAppExcludeSource="taosd.exe" tools\tdengine.iss /O..\release
if not %errorlevel% == 0 ( call :RUNFAILED package %packagClientName_x64% failed & exit /b 1) if not %errorlevel% == 0 ( call :RUNFAILED package %packagClientName_x64% failed & exit /b 1)
for /r ..\release %%i in (*.exe) do signtool sign /f d:\\123.pfx /p taosdata %%i
goto EXIT0 goto EXIT0
:USAGE :USAGE

View File

@ -202,8 +202,8 @@ elif [[ ${packgeName} =~ "tar" ]];then
cd ${oriInstallPath}/${originTdpPath} && tar xf ${subFile} cd ${oriInstallPath}/${originTdpPath} && tar xf ${subFile}
fi fi
cd ${oriInstallPath}/${originTdpPath} && tree > ${installPath}/base_${originversion}_checkfile cd ${oriInstallPath}/${originTdpPath} && tree -I "driver" > ${installPath}/base_${originversion}_checkfile
cd ${installPath}/${tdPath} && tree > ${installPath}/now_${version}_checkfile cd ${installPath}/${tdPath} && tree -I "driver" > ${installPath}/now_${version}_checkfile
cd ${installPath} cd ${installPath}
diff ${installPath}/base_${originversion}_checkfile ${installPath}/now_${version}_checkfile > ${installPath}/diffFile.log diff ${installPath}/base_${originversion}_checkfile ${installPath}/now_${version}_checkfile > ${installPath}/diffFile.log
@ -215,6 +215,7 @@ elif [[ ${packgeName} =~ "tar" ]];then
exit -1 exit -1
else else
echoColor G "The number and names of files are the same as previous installation packages" echoColor G "The number and names of files are the same as previous installation packages"
rm -rf ${installPath}/diffFile.log
fi fi
echoColor YD "===== install Package of tar =====" echoColor YD "===== install Package of tar ====="
cd ${installPath}/${tdPath} cd ${installPath}/${tdPath}
@ -251,6 +252,9 @@ if [[ ${packgeName} =~ "server" ]] ;then
systemctl restart taosd systemctl restart taosd
fi fi
rm -rf ${installPath}/${packgeName}
rm -rf ${installPath}/${tdPath}/
# if ([[ ${packgeName} =~ "Lite" ]] && [[ ${packgeName} =~ "tar" ]]) || [[ ${packgeName} =~ "client" ]] ;then # if ([[ ${packgeName} =~ "Lite" ]] && [[ ${packgeName} =~ "tar" ]]) || [[ ${packgeName} =~ "client" ]] ;then
# echoColor G "===== install taos-tools when package is lite or client =====" # echoColor G "===== install taos-tools when package is lite or client ====="
# cd ${installPath} # cd ${installPath}

View File

@ -59,9 +59,9 @@ enum {
#define SHOW_VARIABLES_RESULT_FIELD1_LEN (TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE) #define SHOW_VARIABLES_RESULT_FIELD1_LEN (TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE)
#define SHOW_VARIABLES_RESULT_FIELD2_LEN (TSDB_CONFIG_VALUE_LEN + VARSTR_HEADER_SIZE) #define SHOW_VARIABLES_RESULT_FIELD2_LEN (TSDB_CONFIG_VALUE_LEN + VARSTR_HEADER_SIZE)
#define TD_RES_QUERY(res) (*(int8_t*)res == RES_TYPE__QUERY) #define TD_RES_QUERY(res) (*(int8_t*)res == RES_TYPE__QUERY)
#define TD_RES_TMQ(res) (*(int8_t*)res == RES_TYPE__TMQ) #define TD_RES_TMQ(res) (*(int8_t*)res == RES_TYPE__TMQ)
#define TD_RES_TMQ_META(res) (*(int8_t*)res == RES_TYPE__TMQ_META) #define TD_RES_TMQ_META(res) (*(int8_t*)res == RES_TYPE__TMQ_META)
#define TD_RES_TMQ_METADATA(res) (*(int8_t*)res == RES_TYPE__TMQ_METADATA) #define TD_RES_TMQ_METADATA(res) (*(int8_t*)res == RES_TYPE__TMQ_METADATA)
typedef struct SAppInstInfo SAppInstInfo; typedef struct SAppInstInfo SAppInstInfo;
@ -251,6 +251,7 @@ typedef struct SRequestObj {
uint32_t prevCode; // previous error code: todo refactor, add update flag for catalog uint32_t prevCode; // previous error code: todo refactor, add update flag for catalog
uint32_t retry; uint32_t retry;
int64_t allocatorRefId; int64_t allocatorRefId;
SQuery* pQuery;
} SRequestObj; } SRequestObj;
typedef struct SSyncQueryParam { typedef struct SSyncQueryParam {

View File

@ -27,6 +27,7 @@
#include "trpc.h" #include "trpc.h"
#include "tsched.h" #include "tsched.h"
#include "ttime.h" #include "ttime.h"
#include "qworker.h"
#define TSC_VAR_NOT_RELEASE 1 #define TSC_VAR_NOT_RELEASE 1
#define TSC_VAR_RELEASED 0 #define TSC_VAR_RELEASED 0
@ -350,6 +351,7 @@ void doDestroyRequest(void *p) {
taosArrayDestroy(pRequest->tableList); taosArrayDestroy(pRequest->tableList);
taosArrayDestroy(pRequest->dbList); taosArrayDestroy(pRequest->dbList);
taosArrayDestroy(pRequest->targetTableList); taosArrayDestroy(pRequest->targetTableList);
qDestroyQuery(pRequest->pQuery);
nodesDestroyAllocator(pRequest->allocatorRefId); nodesDestroyAllocator(pRequest->allocatorRefId);
destroyQueryExecRes(&pRequest->body.resInfo.execRes); destroyQueryExecRes(&pRequest->body.resInfo.execRes);

View File

@ -274,13 +274,13 @@ static int32_t hbAsyncCallBack(void *param, SDataBuf *pMsg, int32_t code) {
SClientHbBatchRsp pRsp = {0}; SClientHbBatchRsp pRsp = {0};
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
tDeserializeSClientHbBatchRsp(pMsg->pData, pMsg->len, &pRsp); tDeserializeSClientHbBatchRsp(pMsg->pData, pMsg->len, &pRsp);
}
int32_t now = taosGetTimestampSec(); int32_t now = taosGetTimestampSec();
int32_t delta = abs(now - pRsp.svrTimestamp); int32_t delta = abs(now - pRsp.svrTimestamp);
if (delta > timestampDeltaLimit) { if (delta > timestampDeltaLimit) {
code = TSDB_CODE_TIME_UNSYNCED; code = TSDB_CODE_TIME_UNSYNCED;
tscError("time diff: %ds is too big", delta); tscError("time diff: %ds is too big", delta);
}
} }
int32_t rspNum = taosArrayGetSize(pRsp.rsps); int32_t rspNum = taosArrayGetSize(pRsp.rsps);
@ -606,28 +606,34 @@ SClientHbBatchReq *hbGatherAllInfo(SAppHbMgr *pAppHbMgr) {
int32_t connKeyCnt = atomic_load_32(&pAppHbMgr->connKeyCnt); int32_t connKeyCnt = atomic_load_32(&pAppHbMgr->connKeyCnt);
pBatchReq->reqs = taosArrayInit(connKeyCnt, sizeof(SClientHbReq)); pBatchReq->reqs = taosArrayInit(connKeyCnt, sizeof(SClientHbReq));
int64_t rid = -1;
int32_t code = 0; int32_t code = 0;
void *pIter = taosHashIterate(pAppHbMgr->activeInfo, NULL);
void *pIter = taosHashIterate(pAppHbMgr->activeInfo, NULL);
SClientHbReq *pOneReq = pIter;
SClientHbKey *connKey = pOneReq ? &pOneReq->connKey : NULL;
if (connKey != NULL) rid = connKey->tscRid;
STscObj *pTscObj = (STscObj *)acquireTscObj(rid);
if (pTscObj == NULL) {
tFreeClientHbBatchReq(pBatchReq);
return NULL;
}
while (pIter != NULL) { while (pIter != NULL) {
SClientHbReq *pOneReq = pIter;
pOneReq = taosArrayPush(pBatchReq->reqs, pOneReq); pOneReq = taosArrayPush(pBatchReq->reqs, pOneReq);
code = (*clientHbMgr.reqHandle[pOneReq->connKey.connType])(&pOneReq->connKey, &pOneReq->clusterId, pOneReq); code = (*clientHbMgr.reqHandle[pOneReq->connKey.connType])(&pOneReq->connKey, &pOneReq->clusterId, pOneReq);
if (code) { if (code) {
pIter = taosHashIterate(pAppHbMgr->activeInfo, pIter); pIter = taosHashIterate(pAppHbMgr->activeInfo, pIter);
pOneReq = pIter;
continue; continue;
} }
// hbClearClientHbReq(pOneReq);
pIter = taosHashIterate(pAppHbMgr->activeInfo, pIter); pIter = taosHashIterate(pAppHbMgr->activeInfo, pIter);
pOneReq = pIter;
} }
releaseTscObj(rid);
// if (code) {
// taosArrayDestroyEx(pBatchReq->reqs, hbFreeReq);
// taosMemoryFreeClear(pBatchReq);
// }
return pBatchReq; return pBatchReq;
} }

View File

@ -379,7 +379,7 @@ int32_t updateQnodeList(SAppInstInfo* pInfo, SArray* pNodeList) {
} }
bool qnodeRequired(SRequestObj* pRequest) { bool qnodeRequired(SRequestObj* pRequest) {
if (QUERY_POLICY_VNODE == tsQueryPolicy) { if (QUERY_POLICY_VNODE == tsQueryPolicy || QUERY_POLICY_CLIENT == tsQueryPolicy) {
return false; return false;
} }
@ -483,7 +483,8 @@ void setResPrecision(SReqResultInfo* pResInfo, int32_t precision) {
int32_t buildVnodePolicyNodeList(SRequestObj* pRequest, SArray** pNodeList, SArray* pMnodeList, SArray* pDbVgList) { int32_t buildVnodePolicyNodeList(SRequestObj* pRequest, SArray** pNodeList, SArray* pMnodeList, SArray* pDbVgList) {
SArray* nodeList = taosArrayInit(4, sizeof(SQueryNodeLoad)); SArray* nodeList = taosArrayInit(4, sizeof(SQueryNodeLoad));
char *policy = (tsQueryPolicy == QUERY_POLICY_VNODE) ? "vnode" : "client";
int32_t dbNum = taosArrayGetSize(pDbVgList); int32_t dbNum = taosArrayGetSize(pDbVgList);
for (int32_t i = 0; i < dbNum; ++i) { for (int32_t i = 0; i < dbNum; ++i) {
SArray* pVg = taosArrayGetP(pDbVgList, i); SArray* pVg = taosArrayGetP(pDbVgList, i);
@ -504,20 +505,20 @@ int32_t buildVnodePolicyNodeList(SRequestObj* pRequest, SArray** pNodeList, SArr
int32_t vnodeNum = taosArrayGetSize(nodeList); int32_t vnodeNum = taosArrayGetSize(nodeList);
if (vnodeNum > 0) { if (vnodeNum > 0) {
tscDebug("0x%" PRIx64 " vnode policy, use vnode list, num:%d", pRequest->requestId, vnodeNum); tscDebug("0x%" PRIx64 " %s policy, use vnode list, num:%d", pRequest->requestId, policy, vnodeNum);
goto _return; goto _return;
} }
int32_t mnodeNum = taosArrayGetSize(pMnodeList); int32_t mnodeNum = taosArrayGetSize(pMnodeList);
if (mnodeNum <= 0) { if (mnodeNum <= 0) {
tscDebug("0x%" PRIx64 " vnode policy, empty node list", pRequest->requestId); tscDebug("0x%" PRIx64 " %s policy, empty node list", pRequest->requestId, policy);
goto _return; goto _return;
} }
void* pData = taosArrayGet(pMnodeList, 0); void* pData = taosArrayGet(pMnodeList, 0);
taosArrayAddBatch(nodeList, pData, mnodeNum); taosArrayAddBatch(nodeList, pData, mnodeNum);
tscDebug("0x%" PRIx64 " vnode policy, use mnode list, num:%d", pRequest->requestId, mnodeNum); tscDebug("0x%" PRIx64 " %s policy, use mnode list, num:%d", pRequest->requestId, policy, mnodeNum);
_return: _return:
@ -561,7 +562,8 @@ int32_t buildAsyncExecNodeList(SRequestObj* pRequest, SArray** pNodeList, SArray
int32_t code = 0; int32_t code = 0;
switch (tsQueryPolicy) { switch (tsQueryPolicy) {
case QUERY_POLICY_VNODE: { case QUERY_POLICY_VNODE:
case QUERY_POLICY_CLIENT: {
if (pResultMeta) { if (pResultMeta) {
pDbVgList = taosArrayInit(4, POINTER_BYTES); pDbVgList = taosArrayInit(4, POINTER_BYTES);
@ -622,7 +624,8 @@ int32_t buildSyncExecNodeList(SRequestObj* pRequest, SArray** pNodeList, SArray*
int32_t code = 0; int32_t code = 0;
switch (tsQueryPolicy) { switch (tsQueryPolicy) {
case QUERY_POLICY_VNODE: { case QUERY_POLICY_VNODE:
case QUERY_POLICY_CLIENT: {
int32_t dbNum = taosArrayGetSize(pRequest->dbList); int32_t dbNum = taosArrayGetSize(pRequest->dbList);
if (dbNum > 0) { if (dbNum > 0) {
SCatalog* pCtg = NULL; SCatalog* pCtg = NULL;
@ -682,6 +685,7 @@ int32_t scheduleQuery(SRequestObj* pRequest, SQueryPlan* pDag, SArray* pNodeList
.requestObjRefId = pRequest->self}; .requestObjRefId = pRequest->self};
SSchedulerReq req = { SSchedulerReq req = {
.syncReq = true, .syncReq = true,
.localReq = (tsQueryPolicy == QUERY_POLICY_CLIENT),
.pConn = &conn, .pConn = &conn,
.pNodeList = pNodeList, .pNodeList = pNodeList,
.pDag = pDag, .pDag = pDag,
@ -695,6 +699,8 @@ int32_t scheduleQuery(SRequestObj* pRequest, SQueryPlan* pDag, SArray* pNodeList
}; };
int32_t code = schedulerExecJob(&req, &pRequest->body.queryJob); int32_t code = schedulerExecJob(&req, &pRequest->body.queryJob);
destroyQueryExecRes(&pRequest->body.resInfo.execRes);
memcpy(&pRequest->body.resInfo.execRes, &res, sizeof(res)); memcpy(&pRequest->body.resInfo.execRes, &res, sizeof(res));
if (code != TSDB_CODE_SUCCESS) { if (code != TSDB_CODE_SUCCESS) {
@ -1065,6 +1071,7 @@ void launchAsyncQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaData* pResultM
.pTrans = pAppInfo->pTransporter, .requestId = pRequest->requestId, .requestObjRefId = pRequest->self}; .pTrans = pAppInfo->pTransporter, .requestId = pRequest->requestId, .requestObjRefId = pRequest->self};
SSchedulerReq req = { SSchedulerReq req = {
.syncReq = false, .syncReq = false,
.localReq = (tsQueryPolicy == QUERY_POLICY_CLIENT),
.pConn = &conn, .pConn = &conn,
.pNodeList = pNodeList, .pNodeList = pNodeList,
.pDag = pDag, .pDag = pDag,

View File

@ -26,6 +26,7 @@
#include "tref.h" #include "tref.h"
#include "trpc.h" #include "trpc.h"
#include "version.h" #include "version.h"
#include "qworker.h"
#define TSC_VAR_NOT_RELEASE 1 #define TSC_VAR_NOT_RELEASE 1
#define TSC_VAR_RELEASED 0 #define TSC_VAR_RELEASED 0
@ -670,7 +671,6 @@ typedef struct SqlParseWrapper {
SParseContext *pCtx; SParseContext *pCtx;
SCatalogReq catalogReq; SCatalogReq catalogReq;
SRequestObj *pRequest; SRequestObj *pRequest;
SQuery *pQuery;
} SqlParseWrapper; } SqlParseWrapper;
static void destoryTablesReq(void *p) { static void destoryTablesReq(void *p) {
@ -696,8 +696,8 @@ static void destorySqlParseWrapper(SqlParseWrapper *pWrapper) {
void retrieveMetaCallback(SMetaData *pResultMeta, void *param, int32_t code) { void retrieveMetaCallback(SMetaData *pResultMeta, void *param, int32_t code) {
SqlParseWrapper *pWrapper = (SqlParseWrapper *)param; SqlParseWrapper *pWrapper = (SqlParseWrapper *)param;
SQuery *pQuery = pWrapper->pQuery;
SRequestObj *pRequest = pWrapper->pRequest; SRequestObj *pRequest = pWrapper->pRequest;
SQuery *pQuery = pRequest->pQuery;
pRequest->metric.ctgEnd = taosGetTimestampUs(); pRequest->metric.ctgEnd = taosGetTimestampUs();
@ -726,10 +726,10 @@ void retrieveMetaCallback(SMetaData *pResultMeta, void *param, int32_t code) {
tscDebug("0x%" PRIx64 " analysis semantics completed, start async query, reqId:0x%" PRIx64, pRequest->self, tscDebug("0x%" PRIx64 " analysis semantics completed, start async query, reqId:0x%" PRIx64, pRequest->self,
pRequest->requestId); pRequest->requestId);
launchAsyncQuery(pRequest, pQuery, pResultMeta); launchAsyncQuery(pRequest, pQuery, pResultMeta);
qDestroyQuery(pQuery);
} else { } else {
destorySqlParseWrapper(pWrapper); destorySqlParseWrapper(pWrapper);
qDestroyQuery(pQuery); qDestroyQuery(pRequest->pQuery);
pRequest->pQuery = NULL;
if (NEED_CLIENT_HANDLE_ERROR(code)) { if (NEED_CLIENT_HANDLE_ERROR(code)) {
tscDebug("0x%" PRIx64 " client retry to handle the error, code:%d - %s, tryCount:%d, reqId:0x%" PRIx64, tscDebug("0x%" PRIx64 " client retry to handle the error, code:%d - %s, tryCount:%d, reqId:0x%" PRIx64,
pRequest->self, code, tstrerror(code), pRequest->retry, pRequest->requestId); pRequest->self, code, tstrerror(code), pRequest->retry, pRequest->requestId);
@ -802,12 +802,10 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) {
goto _error; goto _error;
} }
SQuery *pQuery = NULL;
pRequest->metric.syntaxStart = taosGetTimestampUs(); pRequest->metric.syntaxStart = taosGetTimestampUs();
SCatalogReq catalogReq = {.forceUpdate = updateMetaForce, .qNodeRequired = qnodeRequired(pRequest)}; SCatalogReq catalogReq = {.forceUpdate = updateMetaForce, .qNodeRequired = qnodeRequired(pRequest)};
code = qParseSqlSyntax(pCxt, &pQuery, &catalogReq); code = qParseSqlSyntax(pCxt, &pRequest->pQuery, &catalogReq);
if (code != TSDB_CODE_SUCCESS) { if (code != TSDB_CODE_SUCCESS) {
goto _error; goto _error;
} }
@ -817,9 +815,9 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) {
if (!updateMetaForce) { if (!updateMetaForce) {
STscObj *pTscObj = pRequest->pTscObj; STscObj *pTscObj = pRequest->pTscObj;
SAppClusterSummary *pActivity = &pTscObj->pAppInfo->summary; SAppClusterSummary *pActivity = &pTscObj->pAppInfo->summary;
if (NULL == pQuery->pRoot) { if (NULL == pRequest->pQuery->pRoot) {
atomic_add_fetch_64((int64_t *)&pActivity->numOfInsertsReq, 1); atomic_add_fetch_64((int64_t *)&pActivity->numOfInsertsReq, 1);
} else if (QUERY_NODE_SELECT_STMT == pQuery->pRoot->type) { } else if (QUERY_NODE_SELECT_STMT == pRequest->pQuery->pRoot->type) {
atomic_add_fetch_64((int64_t *)&pActivity->numOfQueryReq, 1); atomic_add_fetch_64((int64_t *)&pActivity->numOfQueryReq, 1);
} }
} }
@ -831,7 +829,6 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) {
} }
pWrapper->pCtx = pCxt; pWrapper->pCtx = pCxt;
pWrapper->pQuery = pQuery;
pWrapper->pRequest = pRequest; pWrapper->pRequest = pRequest;
pWrapper->catalogReq = catalogReq; pWrapper->catalogReq = catalogReq;

View File

@ -227,6 +227,7 @@ static const SSysDbTableSchema transSchema[] = {
{.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = false}, {.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = false},
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = false}, {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = false},
{.name = "stage", .bytes = TSDB_TRANS_STAGE_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, {.name = "stage", .bytes = TSDB_TRANS_STAGE_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
{.name = "oper", .bytes = TSDB_TRANS_OPER_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
{.name = "db", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, {.name = "db", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
{.name = "stable", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, {.name = "stable", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
{.name = "failed_times", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = false}, {.name = "failed_times", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = false},

View File

@ -1278,7 +1278,9 @@ int32_t assignOneDataBlock(SSDataBlock* dst, const SSDataBlock* src) {
colDataAssign(pDst, pSrc, src->info.rows, &src->info); colDataAssign(pDst, pSrc, src->info.rows, &src->info);
} }
uint32_t cap = dst->info.capacity;
dst->info = src->info; dst->info = src->info;
dst->info.capacity = cap;
return 0; return 0;
} }
@ -1302,8 +1304,9 @@ int32_t copyDataBlock(SSDataBlock* dst, const SSDataBlock* src) {
colDataAssign(pDst, pSrc, src->info.rows, &src->info); colDataAssign(pDst, pSrc, src->info.rows, &src->info);
} }
uint32_t cap = dst->info.capacity;
dst->info = src->info; dst->info = src->info;
dst->info.capacity = cap;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
@ -1333,6 +1336,8 @@ SSDataBlock* createSpecialDataBlock(EStreamType type) {
// group id // group id
taosArrayPush(pBlock->pDataBlock, &infoData); taosArrayPush(pBlock->pDataBlock, &infoData);
infoData.info.type = TSDB_DATA_TYPE_TIMESTAMP;
infoData.info.bytes = sizeof(TSKEY);
// calculate start ts // calculate start ts
taosArrayPush(pBlock->pDataBlock, &infoData); taosArrayPush(pBlock->pDataBlock, &infoData);
// calculate end ts // calculate end ts
@ -2280,4 +2285,3 @@ const char* blockDecode(SSDataBlock* pBlock, const char* pData) {
ASSERT(pStart - pData == dataLen); ASSERT(pStart - pData == dataLen);
return pStart; return pStart;
} }

View File

@ -214,9 +214,9 @@ int32_t tTSRowNew(STSRowBuilder *pBuilder, SArray *pArray, STSchema *pTSchema, S
if (pColVal->cid == pTColumn->colId) { if (pColVal->cid == pTColumn->colId) {
iColVal++; iColVal++;
if (pColVal->isNone) { if (COL_VAL_IS_NONE(pColVal)) {
flags |= TSROW_HAS_NONE; flags |= TSROW_HAS_NONE;
} else if (pColVal->isNull) { } else if (COL_VAL_IS_NULL(pColVal)) {
flags |= TSROW_HAS_NULL; flags |= TSROW_HAS_NULL;
maxIdx = nkv; maxIdx = nkv;
nTag++; nTag++;
@ -400,9 +400,9 @@ int32_t tTSRowNew(STSRowBuilder *pBuilder, SArray *pArray, STSchema *pTSchema, S
if (pColVal->cid == pTColumn->colId) { if (pColVal->cid == pTColumn->colId) {
iColVal++; iColVal++;
if (pColVal->isNone) { if (COL_VAL_IS_NONE(pColVal)) {
goto _set_none; goto _set_none;
} else if (pColVal->isNull) { } else if (COL_VAL_IS_NULL(pColVal)) {
goto _set_null; goto _set_null;
} else { } else {
goto _set_value; goto _set_value;
@ -1224,9 +1224,9 @@ _exit:
static FORCE_INLINE int32_t tColDataAppendValue0(SColData *pColData, SColVal *pColVal) { // 0 static FORCE_INLINE int32_t tColDataAppendValue0(SColData *pColData, SColVal *pColVal) { // 0
int32_t code = 0; int32_t code = 0;
if (pColVal->isNone) { if (COL_VAL_IS_NONE(pColVal)) {
pColData->flag = HAS_NONE; pColData->flag = HAS_NONE;
} else if (pColVal->isNull) { } else if (COL_VAL_IS_NULL(pColVal)) {
pColData->flag = HAS_NULL; pColData->flag = HAS_NULL;
} else { } else {
pColData->flag = HAS_VALUE; pColData->flag = HAS_VALUE;
@ -1241,7 +1241,7 @@ _exit:
static FORCE_INLINE int32_t tColDataAppendValue1(SColData *pColData, SColVal *pColVal) { // HAS_NONE static FORCE_INLINE int32_t tColDataAppendValue1(SColData *pColData, SColVal *pColVal) { // HAS_NONE
int32_t code = 0; int32_t code = 0;
if (!pColVal->isNone) { if (!COL_VAL_IS_NONE(pColVal)) {
int32_t nBit = BIT1_SIZE(pColData->nVal + 1); int32_t nBit = BIT1_SIZE(pColData->nVal + 1);
code = tRealloc(&pColData->pBitMap, nBit); code = tRealloc(&pColData->pBitMap, nBit);
@ -1250,7 +1250,7 @@ static FORCE_INLINE int32_t tColDataAppendValue1(SColData *pColData, SColVal *pC
memset(pColData->pBitMap, 0, nBit); memset(pColData->pBitMap, 0, nBit);
SET_BIT1(pColData->pBitMap, pColData->nVal, 1); SET_BIT1(pColData->pBitMap, pColData->nVal, 1);
if (pColVal->isNull) { if (COL_VAL_IS_NULL(pColVal)) {
pColData->flag |= HAS_NULL; pColData->flag |= HAS_NULL;
} else { } else {
pColData->flag |= HAS_VALUE; pColData->flag |= HAS_VALUE;
@ -1281,12 +1281,12 @@ _exit:
static FORCE_INLINE int32_t tColDataAppendValue2(SColData *pColData, SColVal *pColVal) { // HAS_NULL static FORCE_INLINE int32_t tColDataAppendValue2(SColData *pColData, SColVal *pColVal) { // HAS_NULL
int32_t code = 0; int32_t code = 0;
if (!pColVal->isNull) { if (!COL_VAL_IS_NULL(pColVal)) {
int32_t nBit = BIT1_SIZE(pColData->nVal + 1); int32_t nBit = BIT1_SIZE(pColData->nVal + 1);
code = tRealloc(&pColData->pBitMap, nBit); code = tRealloc(&pColData->pBitMap, nBit);
if (code) goto _exit; if (code) goto _exit;
if (pColVal->isNone) { if (COL_VAL_IS_NONE(pColVal)) {
pColData->flag |= HAS_NONE; pColData->flag |= HAS_NONE;
memset(pColData->pBitMap, 255, nBit); memset(pColData->pBitMap, 255, nBit);
@ -1323,12 +1323,12 @@ _exit:
static FORCE_INLINE int32_t tColDataAppendValue3(SColData *pColData, SColVal *pColVal) { // HAS_NULL|HAS_NONE static FORCE_INLINE int32_t tColDataAppendValue3(SColData *pColData, SColVal *pColVal) { // HAS_NULL|HAS_NONE
int32_t code = 0; int32_t code = 0;
if (pColVal->isNone) { if (COL_VAL_IS_NONE(pColVal)) {
code = tRealloc(&pColData->pBitMap, BIT1_SIZE(pColData->nVal + 1)); code = tRealloc(&pColData->pBitMap, BIT1_SIZE(pColData->nVal + 1));
if (code) goto _exit; if (code) goto _exit;
SET_BIT1(pColData->pBitMap, pColData->nVal, 0); SET_BIT1(pColData->pBitMap, pColData->nVal, 0);
} else if (pColVal->isNull) { } else if (COL_VAL_IS_NULL(pColVal)) {
code = tRealloc(&pColData->pBitMap, BIT1_SIZE(pColData->nVal + 1)); code = tRealloc(&pColData->pBitMap, BIT1_SIZE(pColData->nVal + 1));
if (code) goto _exit; if (code) goto _exit;
@ -1373,8 +1373,8 @@ _exit:
static FORCE_INLINE int32_t tColDataAppendValue4(SColData *pColData, SColVal *pColVal) { // HAS_VALUE static FORCE_INLINE int32_t tColDataAppendValue4(SColData *pColData, SColVal *pColVal) { // HAS_VALUE
int32_t code = 0; int32_t code = 0;
if (pColVal->isNone || pColVal->isNull) { if (!COL_VAL_IS_VALUE(pColVal)) {
if (pColVal->isNone) { if (COL_VAL_IS_NONE(pColVal)) {
pColData->flag |= HAS_NONE; pColData->flag |= HAS_NONE;
} else { } else {
pColData->flag |= HAS_NULL; pColData->flag |= HAS_NULL;
@ -1401,7 +1401,7 @@ _exit:
static FORCE_INLINE int32_t tColDataAppendValue5(SColData *pColData, SColVal *pColVal) { // HAS_VALUE|HAS_NONE static FORCE_INLINE int32_t tColDataAppendValue5(SColData *pColData, SColVal *pColVal) { // HAS_VALUE|HAS_NONE
int32_t code = 0; int32_t code = 0;
if (pColVal->isNull) { if (COL_VAL_IS_NULL(pColVal)) {
pColData->flag |= HAS_NULL; pColData->flag |= HAS_NULL;
uint8_t *pBitMap = NULL; uint8_t *pBitMap = NULL;
@ -1419,7 +1419,7 @@ static FORCE_INLINE int32_t tColDataAppendValue5(SColData *pColData, SColVal *pC
code = tRealloc(&pColData->pBitMap, BIT1_SIZE(pColData->nVal + 1)); code = tRealloc(&pColData->pBitMap, BIT1_SIZE(pColData->nVal + 1));
if (code) goto _exit; if (code) goto _exit;
if (pColVal->isNone) { if (COL_VAL_IS_NONE(pColVal)) {
SET_BIT1(pColData->pBitMap, pColData->nVal, 0); SET_BIT1(pColData->pBitMap, pColData->nVal, 0);
} else { } else {
SET_BIT1(pColData->pBitMap, pColData->nVal, 1); SET_BIT1(pColData->pBitMap, pColData->nVal, 1);
@ -1436,7 +1436,7 @@ _exit:
static FORCE_INLINE int32_t tColDataAppendValue6(SColData *pColData, SColVal *pColVal) { // HAS_VALUE|HAS_NULL static FORCE_INLINE int32_t tColDataAppendValue6(SColData *pColData, SColVal *pColVal) { // HAS_VALUE|HAS_NULL
int32_t code = 0; int32_t code = 0;
if (pColVal->isNone) { if (COL_VAL_IS_NONE(pColVal)) {
pColData->flag |= HAS_NONE; pColData->flag |= HAS_NONE;
uint8_t *pBitMap = NULL; uint8_t *pBitMap = NULL;
@ -1454,7 +1454,7 @@ static FORCE_INLINE int32_t tColDataAppendValue6(SColData *pColData, SColVal *pC
code = tRealloc(&pColData->pBitMap, BIT1_SIZE(pColData->nVal + 1)); code = tRealloc(&pColData->pBitMap, BIT1_SIZE(pColData->nVal + 1));
if (code) goto _exit; if (code) goto _exit;
if (pColVal->isNull) { if (COL_VAL_IS_NULL(pColVal)) {
SET_BIT1(pColData->pBitMap, pColData->nVal, 0); SET_BIT1(pColData->pBitMap, pColData->nVal, 0);
} else { } else {
SET_BIT1(pColData->pBitMap, pColData->nVal, 1); SET_BIT1(pColData->pBitMap, pColData->nVal, 1);
@ -1475,9 +1475,9 @@ static FORCE_INLINE int32_t tColDataAppendValue7(SColData *pColData,
code = tRealloc(&pColData->pBitMap, BIT2_SIZE(pColData->nVal + 1)); code = tRealloc(&pColData->pBitMap, BIT2_SIZE(pColData->nVal + 1));
if (code) goto _exit; if (code) goto _exit;
if (pColVal->isNone) { if (COL_VAL_IS_NONE(pColVal)) {
SET_BIT2(pColData->pBitMap, pColData->nVal, 0); SET_BIT2(pColData->pBitMap, pColData->nVal, 0);
} else if (pColVal->isNull) { } else if (COL_VAL_IS_NULL(pColVal)) {
SET_BIT2(pColData->pBitMap, pColData->nVal, 1); SET_BIT2(pColData->pBitMap, pColData->nVal, 1);
} else { } else {
SET_BIT2(pColData->pBitMap, pColData->nVal, 2); SET_BIT2(pColData->pBitMap, pColData->nVal, 2);

View File

@ -58,7 +58,7 @@ int32_t tsNumOfMnodeFetchThreads = 1;
int32_t tsNumOfMnodeReadThreads = 1; int32_t tsNumOfMnodeReadThreads = 1;
int32_t tsNumOfVnodeQueryThreads = 4; int32_t tsNumOfVnodeQueryThreads = 4;
int32_t tsNumOfVnodeStreamThreads = 2; int32_t tsNumOfVnodeStreamThreads = 2;
int32_t tsNumOfVnodeFetchThreads = 4; int32_t tsNumOfVnodeFetchThreads = 1;
int32_t tsNumOfVnodeWriteThreads = 2; int32_t tsNumOfVnodeWriteThreads = 2;
int32_t tsNumOfVnodeSyncThreads = 2; int32_t tsNumOfVnodeSyncThreads = 2;
int32_t tsNumOfVnodeRsmaThreads = 2; int32_t tsNumOfVnodeRsmaThreads = 2;
@ -91,6 +91,7 @@ bool tsSmlDataFormat =
// query // query
int32_t tsQueryPolicy = 1; int32_t tsQueryPolicy = 1;
int32_t tsQuerySmaOptimize = 0; int32_t tsQuerySmaOptimize = 0;
int32_t tsQueryRsmaTolerance = 1000; // the tolerance time (ms) to judge from which level to query rsma data.
bool tsQueryPlannerTrace = false; bool tsQueryPlannerTrace = false;
int32_t tsQueryNodeChunkSize = 32 * 1024; int32_t tsQueryNodeChunkSize = 32 * 1024;
bool tsQueryUseNodeAllocator = true; bool tsQueryUseNodeAllocator = true;
@ -164,8 +165,8 @@ int32_t tsMqRebalanceInterval = 2;
int32_t tsTtlUnit = 86400; int32_t tsTtlUnit = 86400;
int32_t tsTtlPushInterval = 86400; int32_t tsTtlPushInterval = 86400;
int32_t tsGrantHBInterval = 60; int32_t tsGrantHBInterval = 60;
int32_t tsUptimeInterval = 300; // seconds int32_t tsUptimeInterval = 300; // seconds
char tsUdfdResFuncs[1024] = ""; // udfd resident funcs that teardown when udfd exits char tsUdfdResFuncs[1024] = ""; // udfd resident funcs that teardown when udfd exits
#ifndef _STORAGE #ifndef _STORAGE
int32_t taosSetTfsCfg(SConfig *pCfg) { int32_t taosSetTfsCfg(SConfig *pCfg) {
@ -284,7 +285,7 @@ static int32_t taosAddClientCfg(SConfig *pCfg) {
if (cfgAddInt32(pCfg, "shellActivityTimer", tsShellActivityTimer, 1, 120, 1) != 0) return -1; if (cfgAddInt32(pCfg, "shellActivityTimer", tsShellActivityTimer, 1, 120, 1) != 0) return -1;
if (cfgAddInt32(pCfg, "compressMsgSize", tsCompressMsgSize, -1, 100000000, 1) != 0) return -1; if (cfgAddInt32(pCfg, "compressMsgSize", tsCompressMsgSize, -1, 100000000, 1) != 0) return -1;
if (cfgAddInt32(pCfg, "compressColData", tsCompressColData, -1, 100000000, 1) != 0) return -1; if (cfgAddInt32(pCfg, "compressColData", tsCompressColData, -1, 100000000, 1) != 0) return -1;
if (cfgAddInt32(pCfg, "queryPolicy", tsQueryPolicy, 1, 3, 1) != 0) return -1; if (cfgAddInt32(pCfg, "queryPolicy", tsQueryPolicy, 1, 4, 1) != 0) return -1;
if (cfgAddInt32(pCfg, "querySmaOptimize", tsQuerySmaOptimize, 0, 1, 1) != 0) return -1; if (cfgAddInt32(pCfg, "querySmaOptimize", tsQuerySmaOptimize, 0, 1, 1) != 0) return -1;
if (cfgAddBool(pCfg, "queryPlannerTrace", tsQueryPlannerTrace, true) != 0) return -1; if (cfgAddBool(pCfg, "queryPlannerTrace", tsQueryPlannerTrace, true) != 0) return -1;
if (cfgAddInt32(pCfg, "queryNodeChunkSize", tsQueryNodeChunkSize, 1024, 128 * 1024, true) != 0) return -1; if (cfgAddInt32(pCfg, "queryNodeChunkSize", tsQueryNodeChunkSize, 1024, 128 * 1024, true) != 0) return -1;
@ -370,9 +371,8 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
tsNumOfVnodeStreamThreads = TMAX(tsNumOfVnodeStreamThreads, 4); tsNumOfVnodeStreamThreads = TMAX(tsNumOfVnodeStreamThreads, 4);
if (cfgAddInt32(pCfg, "numOfVnodeStreamThreads", tsNumOfVnodeStreamThreads, 4, 1024, 0) != 0) return -1; if (cfgAddInt32(pCfg, "numOfVnodeStreamThreads", tsNumOfVnodeStreamThreads, 4, 1024, 0) != 0) return -1;
tsNumOfVnodeFetchThreads = tsNumOfCores / 4; tsNumOfVnodeFetchThreads = 1;
tsNumOfVnodeFetchThreads = TMAX(tsNumOfVnodeFetchThreads, 4); if (cfgAddInt32(pCfg, "numOfVnodeFetchThreads", tsNumOfVnodeFetchThreads, 1, 1024, 0) != 0) return -1;
if (cfgAddInt32(pCfg, "numOfVnodeFetchThreads", tsNumOfVnodeFetchThreads, 4, 1024, 0) != 0) return -1;
tsNumOfVnodeWriteThreads = tsNumOfCores; tsNumOfVnodeWriteThreads = tsNumOfCores;
tsNumOfVnodeWriteThreads = TMAX(tsNumOfVnodeWriteThreads, 1); tsNumOfVnodeWriteThreads = TMAX(tsNumOfVnodeWriteThreads, 1);
@ -424,6 +424,7 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
if (cfgAddInt32(pCfg, "ttlUnit", tsTtlUnit, 1, 86400 * 365, 1) != 0) return -1; if (cfgAddInt32(pCfg, "ttlUnit", tsTtlUnit, 1, 86400 * 365, 1) != 0) return -1;
if (cfgAddInt32(pCfg, "ttlPushInterval", tsTtlPushInterval, 1, 100000, 1) != 0) return -1; if (cfgAddInt32(pCfg, "ttlPushInterval", tsTtlPushInterval, 1, 100000, 1) != 0) return -1;
if (cfgAddInt32(pCfg, "uptimeInterval", tsUptimeInterval, 1, 100000, 1) != 0) return -1; if (cfgAddInt32(pCfg, "uptimeInterval", tsUptimeInterval, 1, 100000, 1) != 0) return -1;
if (cfgAddInt32(pCfg, "queryRsmaTolerance", tsQueryRsmaTolerance, 0, 900000, 0) != 0) return -1;
if (cfgAddBool(pCfg, "udf", tsStartUdfd, 0) != 0) return -1; if (cfgAddBool(pCfg, "udf", tsStartUdfd, 0) != 0) return -1;
if (cfgAddString(pCfg, "udfdResFuncs", tsUdfdResFuncs, 0) != 0) return -1; if (cfgAddString(pCfg, "udfdResFuncs", tsUdfdResFuncs, 0) != 0) return -1;
@ -723,6 +724,7 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
tsTtlUnit = cfgGetItem(pCfg, "ttlUnit")->i32; tsTtlUnit = cfgGetItem(pCfg, "ttlUnit")->i32;
tsTtlPushInterval = cfgGetItem(pCfg, "ttlPushInterval")->i32; tsTtlPushInterval = cfgGetItem(pCfg, "ttlPushInterval")->i32;
tsUptimeInterval = cfgGetItem(pCfg, "uptimeInterval")->i32; tsUptimeInterval = cfgGetItem(pCfg, "uptimeInterval")->i32;
tsQueryRsmaTolerance = cfgGetItem(pCfg, "queryRsmaTolerance")->i32;
tsStartUdfd = cfgGetItem(pCfg, "udf")->bval; tsStartUdfd = cfgGetItem(pCfg, "udf")->bval;
tstrncpy(tsUdfdResFuncs, cfgGetItem(pCfg, "udfdResFuncs")->str, sizeof(tsUdfdResFuncs)); tstrncpy(tsUdfdResFuncs, cfgGetItem(pCfg, "udfdResFuncs")->str, sizeof(tsUdfdResFuncs));
@ -989,6 +991,8 @@ int32_t taosSetCfg(SConfig *pCfg, char *name) {
tsQueryNodeChunkSize = cfgGetItem(pCfg, "queryNodeChunkSize")->i32; tsQueryNodeChunkSize = cfgGetItem(pCfg, "queryNodeChunkSize")->i32;
} else if (strcasecmp("queryUseNodeAllocator", name) == 0) { } else if (strcasecmp("queryUseNodeAllocator", name) == 0) {
tsQueryUseNodeAllocator = cfgGetItem(pCfg, "queryUseNodeAllocator")->bval; tsQueryUseNodeAllocator = cfgGetItem(pCfg, "queryUseNodeAllocator")->bval;
} else if (strcasecmp("queryRsmaTolerance", name) == 0) {
tsQueryRsmaTolerance = cfgGetItem(pCfg, "queryRsmaTolerance")->i32;
} }
break; break;
} }

View File

@ -4365,7 +4365,7 @@ int32_t tDeserializeSExplainRsp(void *buf, int32_t bufLen, SExplainRsp *pRsp) {
if (tStartDecode(&decoder) < 0) return -1; if (tStartDecode(&decoder) < 0) return -1;
if (tDecodeI32(&decoder, &pRsp->numOfPlans) < 0) return -1; if (tDecodeI32(&decoder, &pRsp->numOfPlans) < 0) return -1;
if (pRsp->numOfPlans > 0) { if (pRsp->numOfPlans > 0) {
pRsp->subplanInfo = taosMemoryMalloc(pRsp->numOfPlans * sizeof(SExplainExecInfo)); pRsp->subplanInfo = taosMemoryCalloc(pRsp->numOfPlans, sizeof(SExplainExecInfo));
if (pRsp->subplanInfo == NULL) return -1; if (pRsp->subplanInfo == NULL) return -1;
} }
for (int32_t i = 0; i < pRsp->numOfPlans; ++i) { for (int32_t i = 0; i < pRsp->numOfPlans; ++i) {
@ -4373,7 +4373,7 @@ int32_t tDeserializeSExplainRsp(void *buf, int32_t bufLen, SExplainRsp *pRsp) {
if (tDecodeDouble(&decoder, &pRsp->subplanInfo[i].totalCost) < 0) return -1; if (tDecodeDouble(&decoder, &pRsp->subplanInfo[i].totalCost) < 0) return -1;
if (tDecodeU64(&decoder, &pRsp->subplanInfo[i].numOfRows) < 0) return -1; if (tDecodeU64(&decoder, &pRsp->subplanInfo[i].numOfRows) < 0) return -1;
if (tDecodeU32(&decoder, &pRsp->subplanInfo[i].verboseLen) < 0) return -1; if (tDecodeU32(&decoder, &pRsp->subplanInfo[i].verboseLen) < 0) return -1;
if (tDecodeBinary(&decoder, (uint8_t **)&pRsp->subplanInfo[i].verboseInfo, &pRsp->subplanInfo[i].verboseLen) < 0) if (tDecodeBinaryAlloc(&decoder, &pRsp->subplanInfo[i].verboseInfo, NULL) < 0)
return -1; return -1;
} }
@ -4383,6 +4383,19 @@ int32_t tDeserializeSExplainRsp(void *buf, int32_t bufLen, SExplainRsp *pRsp) {
return 0; return 0;
} }
void tFreeSExplainRsp(SExplainRsp *pRsp) {
if (NULL == pRsp) {
return;
}
for (int32_t i = 0; i < pRsp->numOfPlans; ++i) {
SExplainExecInfo *pExec = pRsp->subplanInfo + i;
taosMemoryFree(pExec->verboseInfo);
}
taosMemoryFreeClear(pRsp->subplanInfo);
}
int32_t tSerializeSSchedulerHbReq(void *buf, int32_t bufLen, SSchedulerHbReq *pReq) { int32_t tSerializeSSchedulerHbReq(void *buf, int32_t bufLen, SSchedulerHbReq *pReq) {
int32_t headLen = sizeof(SMsgHead); int32_t headLen = sizeof(SMsgHead);
if (buf != NULL) { if (buf != NULL) {

View File

@ -620,7 +620,7 @@ int32_t tdSTSRowNew(SArray *pArray, STSchema *pTSchema, STSRow **ppRow) {
ASSERT(pTColumn->colId == PRIMARYKEY_TIMESTAMP_COL_ID); ASSERT(pTColumn->colId == PRIMARYKEY_TIMESTAMP_COL_ID);
} else { } else {
if (IS_VAR_DATA_TYPE(pTColumn->type)) { if (IS_VAR_DATA_TYPE(pTColumn->type)) {
if (pColVal && !pColVal->isNone && !pColVal->isNull) { if (pColVal && COL_VAL_IS_VALUE(pColVal)) {
varDataLen += (pColVal->value.nData + sizeof(VarDataLenT)); varDataLen += (pColVal->value.nData + sizeof(VarDataLenT));
if (maxVarDataLen < (pColVal->value.nData + sizeof(VarDataLenT))) { if (maxVarDataLen < (pColVal->value.nData + sizeof(VarDataLenT))) {
maxVarDataLen = pColVal->value.nData + sizeof(VarDataLenT); maxVarDataLen = pColVal->value.nData + sizeof(VarDataLenT);
@ -680,9 +680,9 @@ int32_t tdSTSRowNew(SArray *pArray, STSchema *pTSchema, STSRow **ppRow) {
const void *val = NULL; const void *val = NULL;
if (iColVal < nColVal) { if (iColVal < nColVal) {
pColVal = (SColVal *)taosArrayGet(pArray, iColVal); pColVal = (SColVal *)taosArrayGet(pArray, iColVal);
if (pColVal->isNone) { if (COL_VAL_IS_NONE(pColVal)) {
valType = TD_VTYPE_NONE; valType = TD_VTYPE_NONE;
} else if (pColVal->isNull) { } else if (COL_VAL_IS_NULL(pColVal)) {
valType = TD_VTYPE_NULL; valType = TD_VTYPE_NULL;
} else if (IS_VAR_DATA_TYPE(pTColumn->type)) { } else if (IS_VAR_DATA_TYPE(pTColumn->type)) {
varDataSetLen(varBuf, pColVal->value.nData); varDataSetLen(varBuf, pColVal->value.nData);

View File

@ -133,11 +133,11 @@ static int32_t genTestData(const char **data, int16_t nCols, SArray **pArray) {
SColVal colVal = {0}; SColVal colVal = {0};
colVal.cid = PRIMARYKEY_TIMESTAMP_COL_ID + i; colVal.cid = PRIMARYKEY_TIMESTAMP_COL_ID + i;
if (strncasecmp(data[i], NONE_CSTR, NONE_LEN) == 0) { if (strncasecmp(data[i], NONE_CSTR, NONE_LEN) == 0) {
colVal.isNone = 1; colVal.flag = CV_FLAG_NONE;
taosArrayPush(*pArray, &colVal); taosArrayPush(*pArray, &colVal);
continue; continue;
} else if (strncasecmp(data[i], NULL_CSTR, NULL_LEN) == 0) { } else if (strncasecmp(data[i], NULL_CSTR, NULL_LEN) == 0) {
colVal.isNull = 1; colVal.flag = CV_FLAG_NULL;
taosArrayPush(*pArray, &colVal); taosArrayPush(*pArray, &colVal);
continue; continue;
} }
@ -204,11 +204,11 @@ static int32_t genTestData(const char **data, int16_t nCols, SArray **pArray) {
} }
int32_t debugPrintSColVal(SColVal *cv, int8_t type) { int32_t debugPrintSColVal(SColVal *cv, int8_t type) {
if (cv->isNone) { if (COL_VAL_IS_NONE(cv)) {
printf("None "); printf("None ");
return 0; return 0;
} }
if (cv->isNull) { if (COL_VAL_IS_NULL(cv)) {
printf("Null "); printf("Null ");
return 0; return 0;
} }
@ -298,11 +298,11 @@ void debugPrintTSRow(STSRow2 *row, STSchema *pTSchema, const char *tags, int32_t
static int32_t checkSColVal(const char *rawVal, SColVal *cv, int8_t type) { static int32_t checkSColVal(const char *rawVal, SColVal *cv, int8_t type) {
ASSERT(rawVal); ASSERT(rawVal);
if (cv->isNone) { if (COL_VAL_IS_NONE(cv)) {
EXPECT_STRCASEEQ(rawVal, NONE_CSTR); EXPECT_STRCASEEQ(rawVal, NONE_CSTR);
return 0; return 0;
} }
if (cv->isNull) { if (COL_VAL_IS_NULL(cv)) {
EXPECT_STRCASEEQ(rawVal, NULL_CSTR); EXPECT_STRCASEEQ(rawVal, NULL_CSTR);
return 0; return 0;
} }

View File

@ -74,6 +74,7 @@ typedef struct {
TdThread thread; TdThread thread;
SVnodeMgmt *pMgmt; SVnodeMgmt *pMgmt;
SWrapperCfg *pCfgs; SWrapperCfg *pCfgs;
SVnodeObj **ppVnodes;
} SVnodeThread; } SVnodeThread;
// vmInt.c // vmInt.c

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