merge 3.0
This commit is contained in:
commit
7bcb5992e4
|
@ -218,12 +218,12 @@ def pre_test_win(){
|
|||
if (env.CHANGE_URL =~ /\/TDengine\//) {
|
||||
bat '''
|
||||
cd %WIN_INTERNAL_ROOT%
|
||||
git pull
|
||||
git pull origin ''' + env.CHANGE_TARGET + '''
|
||||
'''
|
||||
bat '''
|
||||
cd %WIN_COMMUNITY_ROOT%
|
||||
git remote prune origin
|
||||
git pull
|
||||
git pull origin ''' + env.CHANGE_TARGET + '''
|
||||
'''
|
||||
bat '''
|
||||
cd %WIN_COMMUNITY_ROOT%
|
||||
|
@ -236,7 +236,7 @@ def pre_test_win(){
|
|||
} else if (env.CHANGE_URL =~ /\/TDinternal\//) {
|
||||
bat '''
|
||||
cd %WIN_INTERNAL_ROOT%
|
||||
git pull
|
||||
git pull origin ''' + env.CHANGE_TARGET + '''
|
||||
'''
|
||||
bat '''
|
||||
cd %WIN_INTERNAL_ROOT%
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# taosadapter
|
||||
ExternalProject_Add(taosadapter
|
||||
GIT_REPOSITORY https://github.com/taosdata/taosadapter.git
|
||||
GIT_TAG 05fb2ff
|
||||
GIT_TAG be729ab
|
||||
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter"
|
||||
BINARY_DIR ""
|
||||
#BUILD_IN_SOURCE TRUE
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# taos-tools
|
||||
ExternalProject_Add(taos-tools
|
||||
GIT_REPOSITORY https://github.com/taosdata/taos-tools.git
|
||||
GIT_TAG 285b5e0
|
||||
GIT_TAG 8207c74
|
||||
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools"
|
||||
BINARY_DIR ""
|
||||
#BUILD_IN_SOURCE TRUE
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# taosws-rs
|
||||
ExternalProject_Add(taosws-rs
|
||||
GIT_REPOSITORY https://github.com/taosdata/taos-connector-rust.git
|
||||
GIT_TAG 76bc64d
|
||||
GIT_TAG 1bdfca3
|
||||
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosws-rs"
|
||||
BINARY_DIR ""
|
||||
#BUILD_IN_SOURCE TRUE
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
```csharp title="Native Connection"
|
||||
{{#include docs/examples/csharp/ConnectExample.cs}}
|
||||
{{#include docs/examples/csharp/connect/Program.cs}}
|
||||
```
|
||||
|
||||
:::info
|
||||
C# connector supports only native connection for now.
|
||||
|
||||
:::
|
||||
```csharp title="WebSocket Connection"
|
||||
{{#include docs/examples/csharp/wsConnect/Program.cs}}
|
||||
```
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
```csharp
|
||||
{{#include docs/examples/csharp/InfluxDBLineExample.cs}}
|
||||
{{#include docs/examples/csharp/influxdbLine/Program.cs}}
|
||||
```
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
```csharp
|
||||
{{#include docs/examples/csharp/OptsJsonExample.cs}}
|
||||
{{#include docs/examples/csharp/optsJSON/Program.cs}}
|
||||
```
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
```csharp
|
||||
{{#include docs/examples/csharp/OptsTelnetExample.cs}}
|
||||
{{#include docs/examples/csharp/optsTelnet/Program.cs}}
|
||||
```
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
```csharp
|
||||
{{#include docs/examples/csharp/SQLInsertExample.cs}}
|
||||
{{#include docs/examples/csharp/sqlInsert/Program.cs}}
|
||||
```
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
```csharp
|
||||
{{#include docs/examples/csharp/StmtInsertExample.cs}}
|
||||
{{#include docs/examples/csharp/stmtInsert/Program.cs}}
|
||||
```
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
```csharp
|
||||
{{#include docs/examples/csharp/QueryExample.cs}}
|
||||
{{#include docs/examples/csharp/query/Program.cs}}
|
||||
```
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
```csharp
|
||||
{{#include docs/examples/csharp/AsyncQueryExample.cs}}
|
||||
{{#include docs/examples/csharp/asyncQuery/Program.cs}}
|
||||
```
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
```csharp
|
||||
{{#include docs/examples/csharp/SubscribeDemo.cs}}
|
||||
{{#include docs/examples/csharp/subscribe/Program.cs}}
|
||||
```
|
|
@ -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.
|
||||
|
||||
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.
|
||||
|
||||
|
@ -35,6 +35,10 @@ Please refer to [version support list](/reference/connector#version-support)
|
|||
|
||||
## Supported features
|
||||
|
||||
<Tabs defaultValue="native">
|
||||
|
||||
<TabItem value="native" label="Native Connection">
|
||||
|
||||
1. Connection Management
|
||||
2. General Query
|
||||
3. Continuous Query
|
||||
|
@ -42,6 +46,18 @@ Please refer to [version support list](/reference/connector#version-support)
|
|||
5. Subscription
|
||||
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
|
||||
|
||||
### Pre-installation preparation
|
||||
|
@ -74,12 +90,18 @@ cp -r src/ myProject
|
|||
cd myProject
|
||||
dotnet add exmaple.csproj reference src/TDengine.csproj
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
## Establish a Connection
|
||||
|
||||
``` C#
|
||||
|
||||
<Tabs defaultValue="native">
|
||||
|
||||
<TabItem value="native" label="Native Connection">
|
||||
|
||||
``` csharp
|
||||
using TDengineDriver;
|
||||
|
||||
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.
|
||||
* **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
|
||||
|
||||
### Write data
|
||||
|
||||
#### SQL Write
|
||||
|
||||
<Tabs defaultValue="native">
|
||||
|
||||
<TabItem value="native" label="Native Connection">
|
||||
|
||||
<CSInsert />
|
||||
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="rest" label="WebSocket Connection">
|
||||
|
||||
```csharp
|
||||
{{#include docs/examples/csharp/wsInsert/Program.cs}}
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
#### InfluxDB line protocol write
|
||||
|
||||
<CSInfluxLine />
|
||||
|
@ -132,12 +202,48 @@ namespace TDengineExample
|
|||
|
||||
<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
|
||||
|
||||
#### Synchronous Query
|
||||
|
||||
<Tabs defaultValue="native">
|
||||
|
||||
<TabItem value="native" label="Native Connection">
|
||||
|
||||
<CSQuery />
|
||||
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="rest" label="WebSocket Connection">
|
||||
|
||||
```csharp
|
||||
{{#include docs/examples/csharp/wsQuery/Program.cs}}
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
#### Asynchronous query
|
||||
|
||||
<CSAsyncQuery />
|
||||
|
@ -145,18 +251,21 @@ namespace TDengineExample
|
|||
### More sample programs
|
||||
|
||||
|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 |
|
||||
| [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 |
|
||||
| [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 |
|
||||
| [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
|
||||
|
||||
| TDengine.Connector | Description |
|
||||
|--------------------|--------------------------------|
|
||||
| 3.0.1 | Support WebSocket and Cloud,With 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. |
|
||||
| 1.0.7 | Fixed TDengine.Query() memory leak. |
|
||||
| 1.0.6 | Fix schemaless bug in 1.0.4 and 1.0.5. |
|
||||
|
|
|
@ -164,7 +164,7 @@ The parameters described in this document by the effect that they have on the sy
|
|||
| Attribute | Description |
|
||||
| -------- | -------------------- |
|
||||
| Applicable | Client only |
|
||||
| 含义 | SMA index optimization policy |
|
||||
| Meaning | SMA index optimization policy |
|
||||
| Unit | None |
|
||||
| Default Value | 0 |
|
||||
| Notes |
|
||||
|
@ -325,7 +325,7 @@ The charset that takes effect is UTF-8.
|
|||
| Applicable | Server Only |
|
||||
| Meaning | Maximum number of vnodes per dnode |
|
||||
| Value Range | 0-4096 |
|
||||
| Default Value | 256 |
|
||||
| Default Value | 2x the CPU cores |
|
||||
|
||||
## Time Parameters
|
||||
|
||||
|
@ -697,152 +697,154 @@ To prevent system resource from being exhausted by multiple concurrent streams,
|
|||
| 15 | telemetryPort | No | Yes |
|
||||
| 16 | queryPolicy | No | Yes |
|
||||
| 17 | querySmaOptimize | No | Yes |
|
||||
| 18 | queryBufferSize | Yes | Yes |
|
||||
| 19 | maxNumOfDistinctRes | Yes | Yes |
|
||||
| 20 | minSlidingTime | Yes | Yes |
|
||||
| 21 | minIntervalTime | Yes | Yes |
|
||||
| 22 | countAlwaysReturnValue | Yes | Yes |
|
||||
| 23 | dataDir | Yes | Yes |
|
||||
| 24 | minimalDataDirGB | Yes | Yes |
|
||||
| 25 | supportVnodes | No | Yes |
|
||||
| 26 | tempDir | Yes | Yes |
|
||||
| 27 | minimalTmpDirGB | Yes | Yes |
|
||||
| 28 | compressMsgSize | Yes | Yes |
|
||||
| 29 | compressColData | Yes | Yes |
|
||||
| 30 | smlChildTableName | Yes | Yes |
|
||||
| 31 | smlTagName | Yes | Yes |
|
||||
| 32 | smlDataFormat | No | Yes |
|
||||
| 33 | statusInterval | Yes | Yes |
|
||||
| 34 | shellActivityTimer | Yes | Yes |
|
||||
| 35 | transPullupInterval | No | Yes |
|
||||
| 36 | mqRebalanceInterval | No | Yes |
|
||||
| 37 | ttlUnit | No | Yes |
|
||||
| 38 | ttlPushInterval | No | Yes |
|
||||
| 39 | numOfTaskQueueThreads | No | Yes |
|
||||
| 40 | numOfRpcThreads | No | Yes |
|
||||
| 41 | numOfCommitThreads | Yes | Yes |
|
||||
| 42 | numOfMnodeReadThreads | No | Yes |
|
||||
| 43 | numOfVnodeQueryThreads | No | Yes |
|
||||
| 44 | numOfVnodeStreamThreads | No | Yes |
|
||||
| 45 | numOfVnodeFetchThreads | No | Yes |
|
||||
| 46 | numOfVnodeWriteThreads | No | Yes |
|
||||
| 47 | numOfVnodeSyncThreads | No | Yes |
|
||||
| 48 | numOfQnodeQueryThreads | No | Yes |
|
||||
| 49 | numOfQnodeFetchThreads | No | Yes |
|
||||
| 50 | numOfSnodeSharedThreads | No | Yes |
|
||||
| 51 | numOfSnodeUniqueThreads | No | Yes |
|
||||
| 52 | rpcQueueMemoryAllowed | No | Yes |
|
||||
| 53 | logDir | Yes | Yes |
|
||||
| 54 | minimalLogDirGB | Yes | Yes |
|
||||
| 55 | numOfLogLines | Yes | Yes |
|
||||
| 56 | asyncLog | Yes | Yes |
|
||||
| 57 | logKeepDays | Yes | Yes |
|
||||
| 58 | debugFlag | Yes | Yes |
|
||||
| 59 | tmrDebugFlag | Yes | Yes |
|
||||
| 60 | uDebugFlag | Yes | Yes |
|
||||
| 61 | rpcDebugFlag | Yes | Yes |
|
||||
| 62 | jniDebugFlag | Yes | Yes |
|
||||
| 63 | qDebugFlag | Yes | Yes |
|
||||
| 64 | cDebugFlag | Yes | Yes |
|
||||
| 65 | dDebugFlag | Yes | Yes |
|
||||
| 66 | vDebugFlag | Yes | Yes |
|
||||
| 67 | mDebugFlag | Yes | Yes |
|
||||
| 68 | wDebugFlag | Yes | Yes |
|
||||
| 69 | sDebugFlag | Yes | Yes |
|
||||
| 70 | tsdbDebugFlag | Yes | Yes |
|
||||
| 71 | tqDebugFlag | No | Yes |
|
||||
| 72 | fsDebugFlag | Yes | Yes |
|
||||
| 73 | udfDebugFlag | No | Yes |
|
||||
| 74 | smaDebugFlag | No | Yes |
|
||||
| 75 | idxDebugFlag | No | Yes |
|
||||
| 76 | tdbDebugFlag | No | Yes |
|
||||
| 77 | metaDebugFlag | No | Yes |
|
||||
| 78 | timezone | Yes | Yes |
|
||||
| 79 | locale | Yes | Yes |
|
||||
| 80 | charset | Yes | Yes |
|
||||
| 81 | udf | Yes | Yes |
|
||||
| 82 | enableCoreFile | Yes | Yes |
|
||||
| 83 | arbitrator | Yes | No |
|
||||
| 84 | numOfThreadsPerCore | Yes | No |
|
||||
| 85 | numOfMnodes | Yes | No |
|
||||
| 86 | vnodeBak | Yes | No |
|
||||
| 87 | balance | Yes | No |
|
||||
| 88 | balanceInterval | Yes | No |
|
||||
| 89 | offlineThreshold | Yes | No |
|
||||
| 90 | role | Yes | No |
|
||||
| 91 | dnodeNopLoop | Yes | No |
|
||||
| 92 | keepTimeOffset | Yes | No |
|
||||
| 93 | rpcTimer | Yes | No |
|
||||
| 94 | rpcMaxTime | Yes | No |
|
||||
| 95 | rpcForceTcp | Yes | No |
|
||||
| 96 | tcpConnTimeout | Yes | No |
|
||||
| 97 | syncCheckInterval | Yes | No |
|
||||
| 98 | maxTmrCtrl | Yes | No |
|
||||
| 99 | monitorReplica | Yes | No |
|
||||
| 100 | smlTagNullName | Yes | No |
|
||||
| 101 | keepColumnName | Yes | No |
|
||||
| 102 | ratioOfQueryCores | Yes | No |
|
||||
| 103 | maxStreamCompDelay | Yes | No |
|
||||
| 104 | maxFirstStreamCompDelay | Yes | No |
|
||||
| 105 | retryStreamCompDelay | Yes | No |
|
||||
| 106 | streamCompDelayRatio | Yes | No |
|
||||
| 107 | maxVgroupsPerDb | Yes | No |
|
||||
| 108 | maxTablesPerVnode | Yes | No |
|
||||
| 109 | minTablesPerVnode | Yes | No |
|
||||
| 110 | tableIncStepPerVnode | Yes | No |
|
||||
| 111 | cache | Yes | No |
|
||||
| 112 | blocks | Yes | No |
|
||||
| 113 | days | Yes | No |
|
||||
| 114 | keep | Yes | No |
|
||||
| 115 | minRows | Yes | No |
|
||||
| 116 | maxRows | Yes | No |
|
||||
| 117 | quorum | Yes | No |
|
||||
| 118 | comp | Yes | No |
|
||||
| 119 | walLevel | Yes | No |
|
||||
| 120 | fsync | Yes | No |
|
||||
| 121 | replica | Yes | No |
|
||||
| 122 | partitions | Yes | No |
|
||||
| 123 | quorum | Yes | No |
|
||||
| 124 | update | Yes | No |
|
||||
| 125 | cachelast | Yes | No |
|
||||
| 126 | maxSQLLength | Yes | No |
|
||||
| 127 | maxWildCardsLength | Yes | No |
|
||||
| 128 | maxRegexStringLen | Yes | No |
|
||||
| 129 | maxNumOfOrderedRes | Yes | No |
|
||||
| 130 | maxConnections | Yes | No |
|
||||
| 131 | mnodeEqualVnodeNum | Yes | No |
|
||||
| 132 | http | Yes | No |
|
||||
| 133 | httpEnableRecordSql | Yes | No |
|
||||
| 134 | httpMaxThreads | Yes | No |
|
||||
| 135 | restfulRowLimit | Yes | No |
|
||||
| 136 | httpDbNameMandatory | Yes | No |
|
||||
| 137 | httpKeepAlive | Yes | No |
|
||||
| 138 | enableRecordSql | Yes | No |
|
||||
| 139 | maxBinaryDisplayWidth | Yes | No |
|
||||
| 140 | stream | Yes | No |
|
||||
| 141 | retrieveBlockingModel | Yes | No |
|
||||
| 142 | tsdbMetaCompactRatio | Yes | No |
|
||||
| 143 | defaultJSONStrType | Yes | No |
|
||||
| 144 | walFlushSize | Yes | No |
|
||||
| 145 | keepTimeOffset | Yes | No |
|
||||
| 146 | flowctrl | Yes | No |
|
||||
| 147 | slaveQuery | Yes | No |
|
||||
| 148 | adjustMaster | Yes | No |
|
||||
| 149 | topicBinaryLen | Yes | No |
|
||||
| 150 | telegrafUseFieldNum | Yes | No |
|
||||
| 151 | deadLockKillQuery | Yes | No |
|
||||
| 152 | clientMerge | Yes | No |
|
||||
| 153 | sdbDebugFlag | Yes | No |
|
||||
| 154 | odbcDebugFlag | Yes | No |
|
||||
| 155 | httpDebugFlag | Yes | No |
|
||||
| 156 | monDebugFlag | Yes | No |
|
||||
| 157 | cqDebugFlag | Yes | No |
|
||||
| 158 | shortcutFlag | Yes | No |
|
||||
| 159 | probeSeconds | Yes | No |
|
||||
| 160 | probeKillSeconds | Yes | No |
|
||||
| 161 | probeInterval | Yes | No |
|
||||
| 162 | lossyColumns | Yes | No |
|
||||
| 163 | fPrecision | Yes | No |
|
||||
| 164 | dPrecision | Yes | No |
|
||||
| 165 | maxRange | Yes | No |
|
||||
| 166 | range | Yes | No |
|
||||
| 18 | queryRsmaTolerance | No | Yes |
|
||||
| 19 | queryBufferSize | Yes | Yes |
|
||||
| 20 | maxNumOfDistinctRes | Yes | Yes |
|
||||
| 21 | minSlidingTime | Yes | Yes |
|
||||
| 22 | minIntervalTime | Yes | Yes |
|
||||
| 23 | countAlwaysReturnValue | Yes | Yes |
|
||||
| 24 | dataDir | Yes | Yes |
|
||||
| 25 | minimalDataDirGB | Yes | Yes |
|
||||
| 26 | supportVnodes | No | Yes |
|
||||
| 27 | tempDir | Yes | Yes |
|
||||
| 28 | minimalTmpDirGB | Yes | Yes |
|
||||
| 29 | compressMsgSize | Yes | Yes |
|
||||
| 30 | compressColData | Yes | Yes |
|
||||
| 31 | smlChildTableName | Yes | Yes |
|
||||
| 32 | smlTagName | Yes | Yes |
|
||||
| 33 | smlDataFormat | No | Yes |
|
||||
| 34 | statusInterval | Yes | Yes |
|
||||
| 35 | shellActivityTimer | Yes | Yes |
|
||||
| 36 | transPullupInterval | No | Yes |
|
||||
| 37 | mqRebalanceInterval | No | Yes |
|
||||
| 38 | ttlUnit | No | Yes |
|
||||
| 39 | ttlPushInterval | No | Yes |
|
||||
| 40 | numOfTaskQueueThreads | No | Yes |
|
||||
| 41 | numOfRpcThreads | No | Yes |
|
||||
| 42 | numOfCommitThreads | Yes | Yes |
|
||||
| 43 | numOfMnodeReadThreads | No | Yes |
|
||||
| 44 | numOfVnodeQueryThreads | No | Yes |
|
||||
| 45 | numOfVnodeStreamThreads | No | Yes |
|
||||
| 46 | numOfVnodeFetchThreads | No | Yes |
|
||||
| 47 | numOfVnodeWriteThreads | No | Yes |
|
||||
| 48 | numOfVnodeSyncThreads | No | Yes |
|
||||
| 49 | numOfVnodeRsmaThreads | No | Yes |
|
||||
| 50 | numOfQnodeQueryThreads | No | Yes |
|
||||
| 51 | numOfQnodeFetchThreads | No | Yes |
|
||||
| 52 | numOfSnodeSharedThreads | No | Yes |
|
||||
| 53 | numOfSnodeUniqueThreads | No | Yes |
|
||||
| 54 | rpcQueueMemoryAllowed | No | Yes |
|
||||
| 55 | logDir | Yes | Yes |
|
||||
| 56 | minimalLogDirGB | Yes | Yes |
|
||||
| 57 | numOfLogLines | Yes | Yes |
|
||||
| 58 | asyncLog | Yes | Yes |
|
||||
| 59 | logKeepDays | Yes | Yes |
|
||||
| 60 | debugFlag | Yes | Yes |
|
||||
| 61 | tmrDebugFlag | Yes | Yes |
|
||||
| 62 | uDebugFlag | Yes | Yes |
|
||||
| 63 | rpcDebugFlag | Yes | Yes |
|
||||
| 64 | jniDebugFlag | Yes | Yes |
|
||||
| 65 | qDebugFlag | Yes | Yes |
|
||||
| 66 | cDebugFlag | Yes | Yes |
|
||||
| 67 | dDebugFlag | Yes | Yes |
|
||||
| 68 | vDebugFlag | Yes | Yes |
|
||||
| 69 | mDebugFlag | Yes | Yes |
|
||||
| 70 | wDebugFlag | Yes | Yes |
|
||||
| 71 | sDebugFlag | Yes | Yes |
|
||||
| 72 | tsdbDebugFlag | Yes | Yes |
|
||||
| 73 | tqDebugFlag | No | Yes |
|
||||
| 74 | fsDebugFlag | Yes | Yes |
|
||||
| 75 | udfDebugFlag | No | Yes |
|
||||
| 76 | smaDebugFlag | No | Yes |
|
||||
| 77 | idxDebugFlag | No | Yes |
|
||||
| 78 | tdbDebugFlag | No | Yes |
|
||||
| 79 | metaDebugFlag | No | Yes |
|
||||
| 80 | timezone | Yes | Yes |
|
||||
| 81 | locale | Yes | Yes |
|
||||
| 82 | charset | Yes | Yes |
|
||||
| 83 | udf | Yes | Yes |
|
||||
| 84 | enableCoreFile | Yes | Yes |
|
||||
| 85 | arbitrator | Yes | No |
|
||||
| 86 | numOfThreadsPerCore | Yes | No |
|
||||
| 87 | numOfMnodes | Yes | No |
|
||||
| 88 | vnodeBak | Yes | No |
|
||||
| 89 | balance | Yes | No |
|
||||
| 90 | balanceInterval | Yes | No |
|
||||
| 91 | offlineThreshold | Yes | No |
|
||||
| 92 | role | Yes | No |
|
||||
| 93 | dnodeNopLoop | Yes | No |
|
||||
| 94 | keepTimeOffset | Yes | No |
|
||||
| 95 | rpcTimer | Yes | No |
|
||||
| 96 | rpcMaxTime | Yes | No |
|
||||
| 97 | rpcForceTcp | Yes | No |
|
||||
| 98 | tcpConnTimeout | Yes | No |
|
||||
| 99 | syncCheckInterval | Yes | No |
|
||||
| 100 | maxTmrCtrl | Yes | No |
|
||||
| 101 | monitorReplica | Yes | No |
|
||||
| 102 | smlTagNullName | Yes | No |
|
||||
| 103 | keepColumnName | Yes | No |
|
||||
| 104 | ratioOfQueryCores | Yes | No |
|
||||
| 105 | maxStreamCompDelay | Yes | No |
|
||||
| 106 | maxFirstStreamCompDelay | Yes | No |
|
||||
| 107 | retryStreamCompDelay | Yes | No |
|
||||
| 108 | streamCompDelayRatio | Yes | No |
|
||||
| 109 | maxVgroupsPerDb | Yes | No |
|
||||
| 110 | maxTablesPerVnode | Yes | No |
|
||||
| 111 | minTablesPerVnode | Yes | No |
|
||||
| 112 | tableIncStepPerVnode | Yes | No |
|
||||
| 113 | cache | Yes | No |
|
||||
| 114 | blocks | Yes | No |
|
||||
| 115 | days | Yes | No |
|
||||
| 116 | keep | Yes | No |
|
||||
| 117 | minRows | Yes | No |
|
||||
| 118 | maxRows | Yes | No |
|
||||
| 119 | quorum | Yes | No |
|
||||
| 120 | comp | Yes | No |
|
||||
| 121 | walLevel | Yes | No |
|
||||
| 122 | fsync | Yes | No |
|
||||
| 123 | replica | Yes | No |
|
||||
| 124 | partitions | Yes | No |
|
||||
| 125 | quorum | Yes | No |
|
||||
| 126 | update | Yes | No |
|
||||
| 127 | cachelast | Yes | No |
|
||||
| 128 | maxSQLLength | Yes | No |
|
||||
| 129 | maxWildCardsLength | Yes | No |
|
||||
| 130 | maxRegexStringLen | Yes | No |
|
||||
| 131 | maxNumOfOrderedRes | Yes | No |
|
||||
| 132 | maxConnections | Yes | No |
|
||||
| 133 | mnodeEqualVnodeNum | Yes | No |
|
||||
| 134 | http | Yes | No |
|
||||
| 135 | httpEnableRecordSql | Yes | No |
|
||||
| 136 | httpMaxThreads | Yes | No |
|
||||
| 137 | restfulRowLimit | Yes | No |
|
||||
| 138 | httpDbNameMandatory | Yes | No |
|
||||
| 139 | httpKeepAlive | Yes | No |
|
||||
| 140 | enableRecordSql | Yes | No |
|
||||
| 141 | maxBinaryDisplayWidth | Yes | No |
|
||||
| 142 | stream | Yes | No |
|
||||
| 143 | retrieveBlockingModel | Yes | No |
|
||||
| 144 | tsdbMetaCompactRatio | Yes | No |
|
||||
| 145 | defaultJSONStrType | Yes | No |
|
||||
| 146 | walFlushSize | Yes | No |
|
||||
| 147 | keepTimeOffset | Yes | No |
|
||||
| 148 | flowctrl | Yes | No |
|
||||
| 149 | slaveQuery | Yes | No |
|
||||
| 150 | adjustMaster | Yes | No |
|
||||
| 151 | topicBinaryLen | Yes | No |
|
||||
| 152 | telegrafUseFieldNum | Yes | No |
|
||||
| 153 | deadLockKillQuery | Yes | No |
|
||||
| 154 | clientMerge | Yes | No |
|
||||
| 155 | sdbDebugFlag | Yes | No |
|
||||
| 156 | odbcDebugFlag | Yes | No |
|
||||
| 157 | httpDebugFlag | Yes | No |
|
||||
| 158 | monDebugFlag | Yes | No |
|
||||
| 159 | cqDebugFlag | Yes | No |
|
||||
| 160 | shortcutFlag | Yes | No |
|
||||
| 161 | probeSeconds | Yes | No |
|
||||
| 162 | probeKillSeconds | Yes | No |
|
||||
| 163 | probeInterval | Yes | No |
|
||||
| 164 | lossyColumns | Yes | No |
|
||||
| 165 | fPrecision | Yes | No |
|
||||
| 166 | dPrecision | Yes | No |
|
||||
| 167 | maxRange | Yes | No |
|
||||
| 168 | range | Yes | No |
|
||||
|
|
|
@ -6,6 +6,9 @@ description: TDengine release history, Release Notes and download links.
|
|||
|
||||
import Release from "/components/ReleaseV3";
|
||||
|
||||
## 3.0.1.2
|
||||
|
||||
<Release type="tdengine" version="3.0.1.2" />
|
||||
|
||||
## 3.0.1.1
|
||||
|
||||
|
|
|
@ -6,6 +6,10 @@ description: taosTools release history, Release Notes, download links.
|
|||
|
||||
import Release from "/components/ReleaseV3";
|
||||
|
||||
## 2.2.2
|
||||
|
||||
<Release type="tools" version="2.2.2" />
|
||||
|
||||
## 2.2.0
|
||||
|
||||
<Release type="tools" version="2.2.0" />
|
||||
|
|
|
@ -1,12 +1,27 @@
|
|||
bin
|
||||
obj
|
||||
.vs
|
||||
*.sln
|
||||
wsConnect/obj
|
||||
wsInsert/obj
|
||||
wsQuery/obj
|
||||
wsStmt/obj
|
||||
asyncQuery/bin
|
||||
connect/bin
|
||||
influxdbLine/bin
|
||||
optsJSON/bin
|
||||
optsTelnet/bin
|
||||
query/bin
|
||||
sqlInsert/bin
|
||||
stmtInsert/bin
|
||||
subscribe/bin
|
||||
wsConnect/bin
|
||||
wsInsert/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
|
|
@ -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
|
|
@ -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
|
|
@ -11,11 +11,17 @@ namespace TDengineExample
|
|||
static void Main()
|
||||
{
|
||||
IntPtr conn = GetConnection();
|
||||
QueryAsyncCallback queryAsyncCallback = new QueryAsyncCallback(QueryCallback);
|
||||
TDengine.QueryAsync(conn, "select * from meters", queryAsyncCallback, IntPtr.Zero);
|
||||
Thread.Sleep(2000);
|
||||
TDengine.Close(conn);
|
||||
TDengine.Cleanup();
|
||||
try
|
||||
{
|
||||
QueryAsyncCallback queryAsyncCallback = new QueryAsyncCallback(QueryCallback);
|
||||
TDengine.QueryAsync(conn, "select * from meters", queryAsyncCallback, IntPtr.Zero);
|
||||
Thread.Sleep(2000);
|
||||
}
|
||||
finally
|
||||
{
|
||||
TDengine.Close(conn);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void QueryCallback(IntPtr param, IntPtr taosRes, int code)
|
||||
|
@ -27,11 +33,11 @@ namespace TDengineExample
|
|||
}
|
||||
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)
|
||||
{
|
||||
if (numOfRows > 0)
|
||||
|
@ -43,7 +49,7 @@ namespace TDengineExample
|
|||
|
||||
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]);
|
||||
}
|
||||
|
@ -63,7 +69,7 @@ namespace TDengineExample
|
|||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($"FetchRawBlockCallback callback error, error code {numOfRows}");
|
||||
throw new Exception($"FetchRawBlockCallback callback error, error code {numOfRows}");
|
||||
}
|
||||
TDengine.FreeResult(taosRes);
|
||||
}
|
||||
|
@ -79,8 +85,7 @@ namespace TDengineExample
|
|||
var conn = TDengine.Connect(host, username, password, dbname, port);
|
||||
if (conn == IntPtr.Zero)
|
||||
{
|
||||
Console.WriteLine("Connect to TDengine failed");
|
||||
Environment.Exit(0);
|
||||
throw new Exception("Connect to TDengine failed");
|
||||
}
|
||||
else
|
||||
{
|
|
@ -9,7 +9,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="TDengine.Connector" Version="3.0.0" />
|
||||
<PackageReference Include="TDengine.Connector" Version="3.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -16,7 +16,7 @@ namespace TDengineExample
|
|||
var conn = TDengine.Connect(host, username, password, dbname, port);
|
||||
if (conn == IntPtr.Zero)
|
||||
{
|
||||
Console.WriteLine("Connect to TDengine failed");
|
||||
throw new Exception("Connect to TDengine failed");
|
||||
}
|
||||
else
|
||||
{
|
|
@ -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
|
|
@ -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);
|
||||
if (TDengine.ErrorNo(res) != 0)
|
||||
{
|
||||
Console.WriteLine("SchemalessInsert failed since " + TDengine.Error(res));
|
||||
ExitProgram(conn, 1);
|
||||
throw new Exception("SchemalessInsert failed since " + TDengine.Error(res));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -26,7 +25,6 @@ namespace TDengineExample
|
|||
Console.WriteLine($"SchemalessInsert success, affected {affectedRows} rows");
|
||||
}
|
||||
TDengine.FreeResult(res);
|
||||
ExitProgram(conn, 0);
|
||||
|
||||
}
|
||||
static IntPtr GetConnection()
|
||||
|
@ -39,9 +37,7 @@ namespace TDengineExample
|
|||
var conn = TDengine.Connect(host, username, password, dbname, port);
|
||||
if (conn == IntPtr.Zero)
|
||||
{
|
||||
Console.WriteLine("Connect to TDengine failed");
|
||||
TDengine.Cleanup();
|
||||
Environment.Exit(1);
|
||||
throw new Exception("Connect to TDengine failed");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -55,23 +51,15 @@ namespace TDengineExample
|
|||
IntPtr res = TDengine.Query(conn, "CREATE DATABASE test");
|
||||
if (TDengine.ErrorNo(res) != 0)
|
||||
{
|
||||
Console.WriteLine("failed to create database, reason: " + TDengine.Error(res));
|
||||
ExitProgram(conn, 1);
|
||||
throw new Exception("failed to create database, reason: " + TDengine.Error(res));
|
||||
}
|
||||
res = TDengine.Query(conn, "USE test");
|
||||
if (TDengine.ErrorNo(res) != 0)
|
||||
{
|
||||
Console.WriteLine("failed to change database, reason: " + TDengine.Error(res));
|
||||
ExitProgram(conn, 1);
|
||||
throw new Exception("failed to change database, reason: " + TDengine.Error(res));
|
||||
}
|
||||
}
|
||||
|
||||
static void ExitProgram(IntPtr conn, int exitCode)
|
||||
{
|
||||
TDengine.Close(conn);
|
||||
TDengine.Cleanup();
|
||||
Environment.Exit(exitCode);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -7,27 +7,31 @@ namespace TDengineExample
|
|||
static void Main()
|
||||
{
|
||||
IntPtr conn = GetConnection();
|
||||
PrepareDatabase(conn);
|
||||
string[] lines = { "[{\"metric\": \"meters.current\", \"timestamp\": 1648432611249, \"value\": 10.3, \"tags\": {\"location\": \"California.SanFrancisco\", \"groupid\": 2}}," +
|
||||
try
|
||||
{
|
||||
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.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}}]"
|
||||
};
|
||||
|
||||
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)
|
||||
{
|
||||
Console.WriteLine("SchemalessInsert failed since " + TDengine.Error(res));
|
||||
ExitProgram(conn, 1);
|
||||
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)
|
||||
{
|
||||
throw new Exception("SchemalessInsert failed since " + TDengine.Error(res));
|
||||
}
|
||||
else
|
||||
{
|
||||
int affectedRows = TDengine.AffectRows(res);
|
||||
Console.WriteLine($"SchemalessInsert success, affected {affectedRows} rows");
|
||||
}
|
||||
TDengine.FreeResult(res);
|
||||
}
|
||||
else
|
||||
finally
|
||||
{
|
||||
int affectedRows = TDengine.AffectRows(res);
|
||||
Console.WriteLine($"SchemalessInsert success, affected {affectedRows} rows");
|
||||
TDengine.Close(conn);
|
||||
}
|
||||
TDengine.FreeResult(res);
|
||||
ExitProgram(conn, 0);
|
||||
|
||||
}
|
||||
static IntPtr GetConnection()
|
||||
{
|
||||
|
@ -39,9 +43,7 @@ namespace TDengineExample
|
|||
var conn = TDengine.Connect(host, username, password, dbname, port);
|
||||
if (conn == IntPtr.Zero)
|
||||
{
|
||||
Console.WriteLine("Connect to TDengine failed");
|
||||
TDengine.Cleanup();
|
||||
Environment.Exit(1);
|
||||
throw new Exception("Connect to TDengine failed");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -55,22 +57,13 @@ namespace TDengineExample
|
|||
IntPtr res = TDengine.Query(conn, "CREATE DATABASE test");
|
||||
if (TDengine.ErrorNo(res) != 0)
|
||||
{
|
||||
Console.WriteLine("failed to create database, reason: " + TDengine.Error(res));
|
||||
ExitProgram(conn, 1);
|
||||
throw new Exception("failed to create database, reason: " + TDengine.Error(res));
|
||||
}
|
||||
res = TDengine.Query(conn, "USE test");
|
||||
if (TDengine.ErrorNo(res) != 0)
|
||||
{
|
||||
Console.WriteLine("failed to change database, reason: " + TDengine.Error(res));
|
||||
ExitProgram(conn, 1);
|
||||
throw new Exception("failed to change database, reason: " + TDengine.Error(res));
|
||||
}
|
||||
}
|
||||
|
||||
static void ExitProgram(IntPtr conn, int exitCode)
|
||||
{
|
||||
TDengine.Close(conn);
|
||||
TDengine.Cleanup();
|
||||
Environment.Exit(exitCode);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,8 +7,10 @@ namespace TDengineExample
|
|||
static void Main()
|
||||
{
|
||||
IntPtr conn = GetConnection();
|
||||
PrepareDatabase(conn);
|
||||
string[] lines = {
|
||||
try
|
||||
{
|
||||
PrepareDatabase(conn);
|
||||
string[] lines = {
|
||||
"meters.current 1648432611249 10.3 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",
|
||||
|
@ -18,20 +20,22 @@ namespace TDengineExample
|
|||
"meters.voltage 1648432611249 221 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);
|
||||
if (TDengine.ErrorNo(res) != 0)
|
||||
{
|
||||
Console.WriteLine("SchemalessInsert failed since " + TDengine.Error(res));
|
||||
ExitProgram(conn, 1);
|
||||
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)
|
||||
{
|
||||
throw new Exception("SchemalessInsert failed since " + TDengine.Error(res));
|
||||
}
|
||||
else
|
||||
{
|
||||
int affectedRows = TDengine.AffectRows(res);
|
||||
Console.WriteLine($"SchemalessInsert success, affected {affectedRows} rows");
|
||||
}
|
||||
TDengine.FreeResult(res);
|
||||
}
|
||||
else
|
||||
catch
|
||||
{
|
||||
int affectedRows = TDengine.AffectRows(res);
|
||||
Console.WriteLine($"SchemalessInsert success, affected {affectedRows} rows");
|
||||
TDengine.Close(conn);
|
||||
}
|
||||
TDengine.FreeResult(res);
|
||||
ExitProgram(conn, 0);
|
||||
|
||||
}
|
||||
static IntPtr GetConnection()
|
||||
{
|
||||
|
@ -43,9 +47,7 @@ namespace TDengineExample
|
|||
var conn = TDengine.Connect(host, username, password, dbname, port);
|
||||
if (conn == IntPtr.Zero)
|
||||
{
|
||||
Console.WriteLine("Connect to TDengine failed");
|
||||
TDengine.Cleanup();
|
||||
Environment.Exit(1);
|
||||
throw new Exception("Connect to TDengine failed");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -59,22 +61,13 @@ namespace TDengineExample
|
|||
IntPtr res = TDengine.Query(conn, "CREATE DATABASE test");
|
||||
if (TDengine.ErrorNo(res) != 0)
|
||||
{
|
||||
Console.WriteLine("failed to create database, reason: " + TDengine.Error(res));
|
||||
ExitProgram(conn, 1);
|
||||
throw new Exception("failed to create database, reason: " + TDengine.Error(res));
|
||||
}
|
||||
res = TDengine.Query(conn, "USE test");
|
||||
if (TDengine.ErrorNo(res) != 0)
|
||||
{
|
||||
Console.WriteLine("failed to change database, reason: " + TDengine.Error(res));
|
||||
ExitProgram(conn, 1);
|
||||
throw new Exception("failed to change database, reason: " + TDengine.Error(res));
|
||||
}
|
||||
}
|
||||
|
||||
static void ExitProgram(IntPtr conn, int exitCode)
|
||||
{
|
||||
TDengine.Close(conn);
|
||||
TDengine.Cleanup();
|
||||
Environment.Exit(exitCode);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
|
@ -9,7 +9,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="TDengine.Connector" Version="3.0.0" />
|
||||
<PackageReference Include="TDengine.Connector" Version="3.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -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
|
|
@ -9,45 +9,50 @@ namespace TDengineExample
|
|||
static void Main()
|
||||
{
|
||||
conn = GetConnection();
|
||||
PrepareSTable();
|
||||
// 1. init and prepare
|
||||
stmt = TDengine.StmtInit(conn);
|
||||
if (stmt == IntPtr.Zero)
|
||||
try
|
||||
{
|
||||
Console.WriteLine("failed to init stmt, " + TDengine.Error(stmt));
|
||||
ExitProgram();
|
||||
}
|
||||
int res = TDengine.StmtPrepare(stmt, "INSERT INTO ? USING meters TAGS(?, ?) VALUES(?, ?, ?, ?)");
|
||||
CheckStmtRes(res, "failed to prepare stmt");
|
||||
PrepareSTable();
|
||||
// 1. init and prepare
|
||||
stmt = TDengine.StmtInit(conn);
|
||||
if (stmt == IntPtr.Zero)
|
||||
{
|
||||
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
|
||||
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);
|
||||
CheckStmtRes(res, "failed to 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 }) };
|
||||
res = TDengine.StmtSetTbnameTags(stmt, "d1001", tags);
|
||||
CheckStmtRes(res, "failed to bind table name and tags");
|
||||
|
||||
// 3. bind values
|
||||
TAOS_MULTI_BIND[] values = new TAOS_MULTI_BIND[4] {
|
||||
// 3. bind values
|
||||
TAOS_MULTI_BIND[] values = new TAOS_MULTI_BIND[4] {
|
||||
TaosMultiBind.MultiBindTimestamp(new long[2] { 1648432611249, 1648432611749}),
|
||||
TaosMultiBind.MultiBindFloat(new float?[2] { 10.3f, 12.6f}),
|
||||
TaosMultiBind.MultiBindInt(new int?[2] { 219, 218}),
|
||||
TaosMultiBind.MultiBindFloat(new float?[2]{ 0.31f, 0.33f})
|
||||
};
|
||||
res = TDengine.StmtBindParamBatch(stmt, values);
|
||||
CheckStmtRes(res, "failed to bind params");
|
||||
res = TDengine.StmtBindParamBatch(stmt, values);
|
||||
CheckStmtRes(res, "failed to bind params");
|
||||
|
||||
// 4. add batch
|
||||
res = TDengine.StmtAddBatch(stmt);
|
||||
CheckStmtRes(res, "failed to add batch");
|
||||
// 4. add batch
|
||||
res = TDengine.StmtAddBatch(stmt);
|
||||
CheckStmtRes(res, "failed to add batch");
|
||||
|
||||
// 5. execute
|
||||
res = TDengine.StmtExecute(stmt);
|
||||
CheckStmtRes(res, "faild to execute");
|
||||
// 5. execute
|
||||
res = TDengine.StmtExecute(stmt);
|
||||
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()
|
||||
|
@ -60,8 +65,7 @@ namespace TDengineExample
|
|||
var conn = TDengine.Connect(host, username, password, dbname, port);
|
||||
if (conn == IntPtr.Zero)
|
||||
{
|
||||
Console.WriteLine("Connect to TDengine failed");
|
||||
Environment.Exit(0);
|
||||
throw new Exception("Connect to TDengine failed");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -70,8 +74,6 @@ namespace TDengineExample
|
|||
return conn;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void PrepareSTable()
|
||||
{
|
||||
IntPtr res = TDengine.Query(conn, "CREATE DATABASE power");
|
||||
|
@ -90,9 +92,8 @@ namespace TDengineExample
|
|||
int code = TDengine.StmtClose(stmt);
|
||||
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)
|
||||
{
|
||||
Console.WriteLine(errorMsg + " since:" + TDengine.Error(res));
|
||||
ExitProgram();
|
||||
throw new Exception(errorMsg + " since:" + TDengine.Error(res));
|
||||
}
|
||||
}
|
||||
|
||||
static void ExitProgram()
|
||||
{
|
||||
TDengine.Close(conn);
|
||||
TDengine.Cleanup();
|
||||
Environment.Exit(1);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -11,11 +11,10 @@ namespace TMQExample
|
|||
{
|
||||
IntPtr conn = GetConnection();
|
||||
string topic = "topic_example";
|
||||
Console.WriteLine($"create topic if not exist {topic} as select * from meters");
|
||||
//create topic
|
||||
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)}");
|
||||
}
|
||||
|
@ -26,7 +25,7 @@ namespace TMQExample
|
|||
TDConnectUser = "root",
|
||||
TDConnectPasswd = "taosdata",
|
||||
MsgWithTableName = "true",
|
||||
TDConnectIp = "127.0.0.1",
|
||||
TDConnectIp = "127.0.0.1",
|
||||
};
|
||||
|
||||
// create consumer
|
||||
|
@ -65,7 +64,6 @@ namespace TMQExample
|
|||
List<string> topics = consumer.Subscription();
|
||||
topics.ForEach(t => Console.WriteLine("topic name:{0}", t));
|
||||
|
||||
|
||||
// unsubscribe
|
||||
consumer.Unsubscribe();
|
||||
|
||||
|
@ -73,7 +71,6 @@ namespace TMQExample
|
|||
consumer.Close();
|
||||
TDengine.Close(conn);
|
||||
|
||||
|
||||
}
|
||||
|
||||
static IntPtr GetConnection()
|
||||
|
@ -86,8 +83,7 @@ namespace TMQExample
|
|||
var conn = TDengine.Connect(host, username, password, dbname, port);
|
||||
if (conn == IntPtr.Zero)
|
||||
{
|
||||
Console.WriteLine("Connect to TDengine failed");
|
||||
System.Environment.Exit(0);
|
||||
throw new Exception("Connect to TDengine failed");
|
||||
}
|
||||
else
|
||||
{
|
|
@ -9,7 +9,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="TDengine.Connector" Version="3.0.0" />
|
||||
<PackageReference Include="TDengine.Connector" Version="3.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -47,7 +47,7 @@ namespace Examples
|
|||
}
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ namespace Examples
|
|||
|
||||
// Free result after use.
|
||||
LibTaosWS.WSFreeResult(wsRes);
|
||||
|
||||
|
||||
// close connection.
|
||||
LibTaosWS.WSClose(wsConn);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
```csharp title="原生连接"
|
||||
{{#include docs/examples/csharp/ConnectExample.cs}}
|
||||
{{#include docs/examples/csharp/connect/Program.cs}}
|
||||
```
|
||||
|
||||
```csharp title="WebSocket 连接"
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
```csharp
|
||||
{{#include docs/examples/csharp/InfluxDBLineExample.cs}}
|
||||
{{#include docs/examples/csharp/influxdbLine/Program.cs}}
|
||||
```
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
```csharp
|
||||
{{#include docs/examples/csharp/OptsJsonExample.cs}}
|
||||
{{#include docs/examples/csharp/optsJSON/Program.cs}}
|
||||
```
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
```csharp
|
||||
{{#include docs/examples/csharp/OptsTelnetExample.cs}}
|
||||
{{#include docs/examples/csharp/optsTelnet/Program.cs}}
|
||||
```
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
```csharp
|
||||
{{#include docs/examples/csharp/SQLInsertExample.cs}}
|
||||
{{#include docs/examples/csharp/sqlInsert/Program.cs}}
|
||||
```
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
```csharp
|
||||
{{#include docs/examples/csharp/StmtInsertExample.cs}}
|
||||
{{#include docs/examples/csharp/stmtInsert/Program.cs}}
|
||||
```
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
```csharp
|
||||
{{#include docs/examples/csharp/QueryExample.cs}}
|
||||
{{#include docs/examples/csharp/query/Program.cs}}
|
||||
```
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
```csharp
|
||||
{{#include docs/examples/csharp/AsyncQueryExample.cs}}
|
||||
{{#include docs/examples/csharp/asyncQuery/Program.cs}}
|
||||
```
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
```csharp
|
||||
{{#include docs/examples/csharp/SubscribeDemo.cs}}
|
||||
{{#include docs/examples/csharp/subscribe/Program.cs}}
|
||||
```
|
|
@ -208,7 +208,7 @@ namespace TDengineExample
|
|||
<TabItem value="native" label="原生连接">
|
||||
|
||||
``` csharp
|
||||
{{#include docs/examples/csharp/StmtInsertExample.cs}}
|
||||
{{#include docs/examples/csharp/stmtInsert/Program.cs}}
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
|
|
|
@ -325,7 +325,7 @@ charset 的有效值是 UTF-8。
|
|||
| 适用范围 | 仅服务端适用 |
|
||||
| 含义 | dnode 支持的最大 vnode 数目 |
|
||||
| 取值范围 | 0-4096 |
|
||||
| 缺省值 | 256 |
|
||||
| 缺省值 | CPU 核数的 2 倍 |
|
||||
|
||||
## 时间相关
|
||||
|
||||
|
@ -668,153 +668,154 @@ charset 的有效值是 UTF-8。
|
|||
| 15 | telemetryPort | 否 | 是 |
|
||||
| 16 | queryPolicy | 否 | 是 |
|
||||
| 17 | querySmaOptimize | 否 | 是 |
|
||||
| 18 | queryBufferSize | 是 | 是 |
|
||||
| 19 | maxNumOfDistinctRes | 是 | 是 |
|
||||
| 20 | minSlidingTime | 是 | 是 |
|
||||
| 21 | minIntervalTime | 是 | 是 |
|
||||
| 22 | countAlwaysReturnValue | 是 | 是 |
|
||||
| 23 | dataDir | 是 | 是 |
|
||||
| 24 | minimalDataDirGB | 是 | 是 |
|
||||
| 25 | supportVnodes | 否 | 是 |
|
||||
| 26 | tempDir | 是 | 是 |
|
||||
| 27 | minimalTmpDirGB | 是 | 是 |
|
||||
| 28 | compressMsgSize | 是 | 是 |
|
||||
| 29 | compressColData | 是 | 是 |
|
||||
| 30 | smlChildTableName | 是 | 是 |
|
||||
| 31 | smlTagName | 是 | 是 |
|
||||
| 32 | smlDataFormat | 否 | 是 |
|
||||
| 33 | statusInterval | 是 | 是 |
|
||||
| 34 | shellActivityTimer | 是 | 是 |
|
||||
| 35 | transPullupInterval | 否 | 是 |
|
||||
| 36 | mqRebalanceInterval | 否 | 是 |
|
||||
| 37 | ttlUnit | 否 | 是 |
|
||||
| 38 | ttlPushInterval | 否 | 是 |
|
||||
| 39 | numOfTaskQueueThreads | 否 | 是 |
|
||||
| 40 | numOfRpcThreads | 否 | 是 |
|
||||
| 41 | numOfCommitThreads | 是 | 是 |
|
||||
| 42 | numOfMnodeReadThreads | 否 | 是 |
|
||||
| 43 | numOfVnodeQueryThreads | 否 | 是 |
|
||||
| 44 | numOfVnodeStreamThreads | 否 | 是 |
|
||||
| 45 | numOfVnodeFetchThreads | 否 | 是 |
|
||||
| 46 | numOfVnodeWriteThreads | 否 | 是 |
|
||||
| 47 | numOfVnodeSyncThreads | 否 | 是 |
|
||||
| 48 | numOfVnodeRsmaThreads | 否 | 是 |
|
||||
| 49 | numOfQnodeQueryThreads | 否 | 是 |
|
||||
| 50 | numOfQnodeFetchThreads | 否 | 是 |
|
||||
| 51 | numOfSnodeSharedThreads | 否 | 是 |
|
||||
| 52 | numOfSnodeUniqueThreads | 否 | 是 |
|
||||
| 53 | rpcQueueMemoryAllowed | 否 | 是 |
|
||||
| 54 | logDir | 是 | 是 |
|
||||
| 55 | minimalLogDirGB | 是 | 是 |
|
||||
| 56 | numOfLogLines | 是 | 是 |
|
||||
| 57 | asyncLog | 是 | 是 |
|
||||
| 58 | logKeepDays | 是 | 是 |
|
||||
| 59 | debugFlag | 是 | 是 |
|
||||
| 60 | tmrDebugFlag | 是 | 是 |
|
||||
| 61 | uDebugFlag | 是 | 是 |
|
||||
| 62 | rpcDebugFlag | 是 | 是 |
|
||||
| 63 | jniDebugFlag | 是 | 是 |
|
||||
| 64 | qDebugFlag | 是 | 是 |
|
||||
| 65 | cDebugFlag | 是 | 是 |
|
||||
| 66 | dDebugFlag | 是 | 是 |
|
||||
| 67 | vDebugFlag | 是 | 是 |
|
||||
| 68 | mDebugFlag | 是 | 是 |
|
||||
| 69 | wDebugFlag | 是 | 是 |
|
||||
| 70 | sDebugFlag | 是 | 是 |
|
||||
| 71 | tsdbDebugFlag | 是 | 是 |
|
||||
| 72 | tqDebugFlag | 否 | 是 |
|
||||
| 73 | fsDebugFlag | 是 | 是 |
|
||||
| 74 | udfDebugFlag | 否 | 是 |
|
||||
| 75 | smaDebugFlag | 否 | 是 |
|
||||
| 76 | idxDebugFlag | 否 | 是 |
|
||||
| 77 | tdbDebugFlag | 否 | 是 |
|
||||
| 78 | metaDebugFlag | 否 | 是 |
|
||||
| 79 | timezone | 是 | 是 |
|
||||
| 80 | locale | 是 | 是 |
|
||||
| 81 | charset | 是 | 是 |
|
||||
| 82 | udf | 是 | 是 |
|
||||
| 83 | enableCoreFile | 是 | 是 |
|
||||
| 84 | arbitrator | 是 | 否 |
|
||||
| 85 | numOfThreadsPerCore | 是 | 否 |
|
||||
| 86 | numOfMnodes | 是 | 否 |
|
||||
| 87 | vnodeBak | 是 | 否 |
|
||||
| 88 | balance | 是 | 否 |
|
||||
| 89 | balanceInterval | 是 | 否 |
|
||||
| 90 | offlineThreshold | 是 | 否 |
|
||||
| 91 | role | 是 | 否 |
|
||||
| 92 | dnodeNopLoop | 是 | 否 |
|
||||
| 93 | keepTimeOffset | 是 | 否 |
|
||||
| 94 | rpcTimer | 是 | 否 |
|
||||
| 95 | rpcMaxTime | 是 | 否 |
|
||||
| 96 | rpcForceTcp | 是 | 否 |
|
||||
| 97 | tcpConnTimeout | 是 | 否 |
|
||||
| 98 | syncCheckInterval | 是 | 否 |
|
||||
| 99 | maxTmrCtrl | 是 | 否 |
|
||||
| 100 | monitorReplica | 是 | 否 |
|
||||
| 101 | smlTagNullName | 是 | 否 |
|
||||
| 102 | keepColumnName | 是 | 否 |
|
||||
| 103 | ratioOfQueryCores | 是 | 否 |
|
||||
| 104 | maxStreamCompDelay | 是 | 否 |
|
||||
| 105 | maxFirstStreamCompDelay | 是 | 否 |
|
||||
| 106 | retryStreamCompDelay | 是 | 否 |
|
||||
| 107 | streamCompDelayRatio | 是 | 否 |
|
||||
| 108 | maxVgroupsPerDb | 是 | 否 |
|
||||
| 109 | maxTablesPerVnode | 是 | 否 |
|
||||
| 110 | minTablesPerVnode | 是 | 否 |
|
||||
| 111 | tableIncStepPerVnode | 是 | 否 |
|
||||
| 112 | cache | 是 | 否 |
|
||||
| 113 | blocks | 是 | 否 |
|
||||
| 114 | days | 是 | 否 |
|
||||
| 115 | keep | 是 | 否 |
|
||||
| 116 | minRows | 是 | 否 |
|
||||
| 117 | maxRows | 是 | 否 |
|
||||
| 118 | quorum | 是 | 否 |
|
||||
| 119 | comp | 是 | 否 |
|
||||
| 120 | walLevel | 是 | 否 |
|
||||
| 121 | fsync | 是 | 否 |
|
||||
| 122 | replica | 是 | 否 |
|
||||
| 123 | partitions | 是 | 否 |
|
||||
| 124 | quorum | 是 | 否 |
|
||||
| 125 | update | 是 | 否 |
|
||||
| 126 | cachelast | 是 | 否 |
|
||||
| 127 | maxSQLLength | 是 | 否 |
|
||||
| 128 | maxWildCardsLength | 是 | 否 |
|
||||
| 129 | maxRegexStringLen | 是 | 否 |
|
||||
| 130 | maxNumOfOrderedRes | 是 | 否 |
|
||||
| 131 | maxConnections | 是 | 否 |
|
||||
| 132 | mnodeEqualVnodeNum | 是 | 否 |
|
||||
| 133 | http | 是 | 否 |
|
||||
| 134 | httpEnableRecordSql | 是 | 否 |
|
||||
| 135 | httpMaxThreads | 是 | 否 |
|
||||
| 136 | restfulRowLimit | 是 | 否 |
|
||||
| 137 | httpDbNameMandatory | 是 | 否 |
|
||||
| 138 | httpKeepAlive | 是 | 否 |
|
||||
| 139 | enableRecordSql | 是 | 否 |
|
||||
| 140 | maxBinaryDisplayWidth | 是 | 否 |
|
||||
| 141 | stream | 是 | 否 |
|
||||
| 142 | retrieveBlockingModel | 是 | 否 |
|
||||
| 143 | tsdbMetaCompactRatio | 是 | 否 |
|
||||
| 144 | defaultJSONStrType | 是 | 否 |
|
||||
| 145 | walFlushSize | 是 | 否 |
|
||||
| 146 | keepTimeOffset | 是 | 否 |
|
||||
| 147 | flowctrl | 是 | 否 |
|
||||
| 148 | slaveQuery | 是 | 否 |
|
||||
| 149 | adjustMaster | 是 | 否 |
|
||||
| 150 | topicBinaryLen | 是 | 否 |
|
||||
| 151 | telegrafUseFieldNum | 是 | 否 |
|
||||
| 152 | deadLockKillQuery | 是 | 否 |
|
||||
| 153 | clientMerge | 是 | 否 |
|
||||
| 154 | sdbDebugFlag | 是 | 否 |
|
||||
| 155 | odbcDebugFlag | 是 | 否 |
|
||||
| 156 | httpDebugFlag | 是 | 否 |
|
||||
| 157 | monDebugFlag | 是 | 否 |
|
||||
| 158 | cqDebugFlag | 是 | 否 |
|
||||
| 159 | shortcutFlag | 是 | 否 |
|
||||
| 160 | probeSeconds | 是 | 否 |
|
||||
| 161 | probeKillSeconds | 是 | 否 |
|
||||
| 162 | probeInterval | 是 | 否 |
|
||||
| 163 | lossyColumns | 是 | 否 |
|
||||
| 164 | fPrecision | 是 | 否 |
|
||||
| 165 | dPrecision | 是 | 否 |
|
||||
| 166 | maxRange | 是 | 否 |
|
||||
| 167 | range | 是 | 否 |
|
||||
| 18 | queryRsmaTolerance | 否 | 是 |
|
||||
| 19 | queryBufferSize | 是 | 是 |
|
||||
| 20 | maxNumOfDistinctRes | 是 | 是 |
|
||||
| 21 | minSlidingTime | 是 | 是 |
|
||||
| 22 | minIntervalTime | 是 | 是 |
|
||||
| 23 | countAlwaysReturnValue | 是 | 是 |
|
||||
| 24 | dataDir | 是 | 是 |
|
||||
| 25 | minimalDataDirGB | 是 | 是 |
|
||||
| 26 | supportVnodes | 否 | 是 |
|
||||
| 27 | tempDir | 是 | 是 |
|
||||
| 28 | minimalTmpDirGB | 是 | 是 |
|
||||
| 29 | compressMsgSize | 是 | 是 |
|
||||
| 30 | compressColData | 是 | 是 |
|
||||
| 31 | smlChildTableName | 是 | 是 |
|
||||
| 32 | smlTagName | 是 | 是 |
|
||||
| 33 | smlDataFormat | 否 | 是 |
|
||||
| 34 | statusInterval | 是 | 是 |
|
||||
| 35 | shellActivityTimer | 是 | 是 |
|
||||
| 36 | transPullupInterval | 否 | 是 |
|
||||
| 37 | mqRebalanceInterval | 否 | 是 |
|
||||
| 38 | ttlUnit | 否 | 是 |
|
||||
| 39 | ttlPushInterval | 否 | 是 |
|
||||
| 40 | numOfTaskQueueThreads | 否 | 是 |
|
||||
| 41 | numOfRpcThreads | 否 | 是 |
|
||||
| 42 | numOfCommitThreads | 是 | 是 |
|
||||
| 43 | numOfMnodeReadThreads | 否 | 是 |
|
||||
| 44 | numOfVnodeQueryThreads | 否 | 是 |
|
||||
| 45 | numOfVnodeStreamThreads | 否 | 是 |
|
||||
| 46 | numOfVnodeFetchThreads | 否 | 是 |
|
||||
| 47 | numOfVnodeWriteThreads | 否 | 是 |
|
||||
| 48 | numOfVnodeSyncThreads | 否 | 是 |
|
||||
| 49 | numOfVnodeRsmaThreads | 否 | 是 |
|
||||
| 50 | numOfQnodeQueryThreads | 否 | 是 |
|
||||
| 51 | numOfQnodeFetchThreads | 否 | 是 |
|
||||
| 52 | numOfSnodeSharedThreads | 否 | 是 |
|
||||
| 53 | numOfSnodeUniqueThreads | 否 | 是 |
|
||||
| 54 | rpcQueueMemoryAllowed | 否 | 是 |
|
||||
| 55 | logDir | 是 | 是 |
|
||||
| 56 | minimalLogDirGB | 是 | 是 |
|
||||
| 57 | numOfLogLines | 是 | 是 |
|
||||
| 58 | asyncLog | 是 | 是 |
|
||||
| 59 | logKeepDays | 是 | 是 |
|
||||
| 60 | debugFlag | 是 | 是 |
|
||||
| 61 | tmrDebugFlag | 是 | 是 |
|
||||
| 62 | uDebugFlag | 是 | 是 |
|
||||
| 63 | rpcDebugFlag | 是 | 是 |
|
||||
| 64 | jniDebugFlag | 是 | 是 |
|
||||
| 65 | qDebugFlag | 是 | 是 |
|
||||
| 66 | cDebugFlag | 是 | 是 |
|
||||
| 67 | dDebugFlag | 是 | 是 |
|
||||
| 68 | vDebugFlag | 是 | 是 |
|
||||
| 69 | mDebugFlag | 是 | 是 |
|
||||
| 70 | wDebugFlag | 是 | 是 |
|
||||
| 71 | sDebugFlag | 是 | 是 |
|
||||
| 72 | tsdbDebugFlag | 是 | 是 |
|
||||
| 73 | tqDebugFlag | 否 | 是 |
|
||||
| 74 | fsDebugFlag | 是 | 是 |
|
||||
| 75 | udfDebugFlag | 否 | 是 |
|
||||
| 76 | smaDebugFlag | 否 | 是 |
|
||||
| 77 | idxDebugFlag | 否 | 是 |
|
||||
| 78 | tdbDebugFlag | 否 | 是 |
|
||||
| 79 | metaDebugFlag | 否 | 是 |
|
||||
| 80 | timezone | 是 | 是 |
|
||||
| 81 | locale | 是 | 是 |
|
||||
| 82 | charset | 是 | 是 |
|
||||
| 83 | udf | 是 | 是 |
|
||||
| 84 | enableCoreFile | 是 | 是 |
|
||||
| 85 | arbitrator | 是 | 否 |
|
||||
| 86 | numOfThreadsPerCore | 是 | 否 |
|
||||
| 87 | numOfMnodes | 是 | 否 |
|
||||
| 88 | vnodeBak | 是 | 否 |
|
||||
| 89 | balance | 是 | 否 |
|
||||
| 90 | balanceInterval | 是 | 否 |
|
||||
| 91 | offlineThreshold | 是 | 否 |
|
||||
| 92 | role | 是 | 否 |
|
||||
| 93 | dnodeNopLoop | 是 | 否 |
|
||||
| 94 | keepTimeOffset | 是 | 否 |
|
||||
| 95 | rpcTimer | 是 | 否 |
|
||||
| 96 | rpcMaxTime | 是 | 否 |
|
||||
| 97 | rpcForceTcp | 是 | 否 |
|
||||
| 98 | tcpConnTimeout | 是 | 否 |
|
||||
| 99 | syncCheckInterval | 是 | 否 |
|
||||
| 100 | maxTmrCtrl | 是 | 否 |
|
||||
| 101 | monitorReplica | 是 | 否 |
|
||||
| 102 | smlTagNullName | 是 | 否 |
|
||||
| 103 | keepColumnName | 是 | 否 |
|
||||
| 104 | ratioOfQueryCores | 是 | 否 |
|
||||
| 105 | maxStreamCompDelay | 是 | 否 |
|
||||
| 106 | maxFirstStreamCompDelay | 是 | 否 |
|
||||
| 107 | retryStreamCompDelay | 是 | 否 |
|
||||
| 108 | streamCompDelayRatio | 是 | 否 |
|
||||
| 109 | maxVgroupsPerDb | 是 | 否 |
|
||||
| 110 | maxTablesPerVnode | 是 | 否 |
|
||||
| 111 | minTablesPerVnode | 是 | 否 |
|
||||
| 112 | tableIncStepPerVnode | 是 | 否 |
|
||||
| 113 | cache | 是 | 否 |
|
||||
| 114 | blocks | 是 | 否 |
|
||||
| 115 | days | 是 | 否 |
|
||||
| 116 | keep | 是 | 否 |
|
||||
| 117 | minRows | 是 | 否 |
|
||||
| 118 | maxRows | 是 | 否 |
|
||||
| 119 | quorum | 是 | 否 |
|
||||
| 120 | comp | 是 | 否 |
|
||||
| 121 | walLevel | 是 | 否 |
|
||||
| 122 | fsync | 是 | 否 |
|
||||
| 123 | replica | 是 | 否 |
|
||||
| 124 | partitions | 是 | 否 |
|
||||
| 125 | quorum | 是 | 否 |
|
||||
| 126 | update | 是 | 否 |
|
||||
| 127 | cachelast | 是 | 否 |
|
||||
| 128 | maxSQLLength | 是 | 否 |
|
||||
| 129 | maxWildCardsLength | 是 | 否 |
|
||||
| 130 | maxRegexStringLen | 是 | 否 |
|
||||
| 131 | maxNumOfOrderedRes | 是 | 否 |
|
||||
| 132 | maxConnections | 是 | 否 |
|
||||
| 133 | mnodeEqualVnodeNum | 是 | 否 |
|
||||
| 134 | http | 是 | 否 |
|
||||
| 135 | httpEnableRecordSql | 是 | 否 |
|
||||
| 136 | httpMaxThreads | 是 | 否 |
|
||||
| 137 | restfulRowLimit | 是 | 否 |
|
||||
| 138 | httpDbNameMandatory | 是 | 否 |
|
||||
| 139 | httpKeepAlive | 是 | 否 |
|
||||
| 140 | enableRecordSql | 是 | 否 |
|
||||
| 141 | maxBinaryDisplayWidth | 是 | 否 |
|
||||
| 142 | stream | 是 | 否 |
|
||||
| 143 | retrieveBlockingModel | 是 | 否 |
|
||||
| 144 | tsdbMetaCompactRatio | 是 | 否 |
|
||||
| 145 | defaultJSONStrType | 是 | 否 |
|
||||
| 146 | walFlushSize | 是 | 否 |
|
||||
| 147 | keepTimeOffset | 是 | 否 |
|
||||
| 148 | flowctrl | 是 | 否 |
|
||||
| 149 | slaveQuery | 是 | 否 |
|
||||
| 150 | adjustMaster | 是 | 否 |
|
||||
| 151 | topicBinaryLen | 是 | 否 |
|
||||
| 152 | telegrafUseFieldNum | 是 | 否 |
|
||||
| 153 | deadLockKillQuery | 是 | 否 |
|
||||
| 154 | clientMerge | 是 | 否 |
|
||||
| 155 | sdbDebugFlag | 是 | 否 |
|
||||
| 156 | odbcDebugFlag | 是 | 否 |
|
||||
| 157 | httpDebugFlag | 是 | 否 |
|
||||
| 158 | monDebugFlag | 是 | 否 |
|
||||
| 159 | cqDebugFlag | 是 | 否 |
|
||||
| 160 | shortcutFlag | 是 | 否 |
|
||||
| 161 | probeSeconds | 是 | 否 |
|
||||
| 162 | probeKillSeconds | 是 | 否 |
|
||||
| 163 | probeInterval | 是 | 否 |
|
||||
| 164 | lossyColumns | 是 | 否 |
|
||||
| 165 | fPrecision | 是 | 否 |
|
||||
| 166 | dPrecision | 是 | 否 |
|
||||
| 167 | maxRange | 是 | 否 |
|
||||
| 168 | range | 是 | 否 |
|
||||
|
|
|
@ -6,6 +6,9 @@ description: TDengine 发布历史、Release Notes 及下载链接
|
|||
|
||||
import Release from "/components/ReleaseV3";
|
||||
|
||||
## 3.0.1.2
|
||||
|
||||
<Release type="tdengine" version="3.0.1.2" />
|
||||
|
||||
## 3.0.1.1
|
||||
|
||||
|
|
|
@ -6,6 +6,10 @@ description: taosTools 的发布历史、Release Notes 和下载链接
|
|||
|
||||
import Release from "/components/ReleaseV3";
|
||||
|
||||
## 2.2.2
|
||||
|
||||
<Release type="tools" version="2.2.2" />
|
||||
|
||||
## 2.2.0
|
||||
|
||||
<Release type="tools" version="2.2.0" />
|
||||
|
|
Binary file not shown.
|
@ -2,7 +2,7 @@
|
|||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "../../../../include/client/taos.h"
|
||||
#include "taos.h"
|
||||
#include "lauxlib.h"
|
||||
#include "lua.h"
|
||||
#include "lualib.h"
|
||||
|
@ -35,7 +35,7 @@ static int l_connect(lua_State *L){
|
|||
}
|
||||
|
||||
lua_getfield(L, 1, "port");
|
||||
if (lua_isnumber(L,-1)){
|
||||
if (lua_isnumber(L, -1)){
|
||||
port = lua_tonumber(L, -1);
|
||||
//printf("port = %d\n", port);
|
||||
}
|
||||
|
@ -60,7 +60,6 @@ static int l_connect(lua_State *L){
|
|||
|
||||
lua_settop(L,0);
|
||||
|
||||
taos_init();
|
||||
|
||||
lua_newtable(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));
|
||||
lua_pushinteger(L, -1);
|
||||
lua_setfield(L, table_index, "code");
|
||||
lua_pushstring(L, taos_errstr(taos));
|
||||
lua_pushstring(L, taos_errstr(result));
|
||||
lua_setfield(L, table_index, "error");
|
||||
|
||||
return 1;
|
||||
|
@ -113,7 +112,6 @@ static int l_query(lua_State *L){
|
|||
int rows = 0;
|
||||
int num_fields = taos_field_count(result);
|
||||
const TAOS_FIELD *fields = taos_fetch_fields(result);
|
||||
//char temp[256];
|
||||
|
||||
const int affectRows = taos_affected_rows(result);
|
||||
// printf(" affect rows:%d\r\n", affectRows);
|
||||
|
@ -122,7 +120,7 @@ static int l_query(lua_State *L){
|
|||
lua_pushinteger(L, affectRows);
|
||||
lua_setfield(L, table_index, "affected");
|
||||
lua_newtable(L);
|
||||
|
||||
|
||||
while ((row = taos_fetch_row(result))) {
|
||||
//printf("row index:%d\n",rows);
|
||||
rows++;
|
||||
|
@ -136,7 +134,7 @@ static int l_query(lua_State *L){
|
|||
}
|
||||
|
||||
lua_pushstring(L,fields[i].name);
|
||||
|
||||
int32_t* length = taos_fetch_lengths(result);
|
||||
switch (fields[i].type) {
|
||||
case TSDB_DATA_TYPE_TINYINT:
|
||||
lua_pushinteger(L,*((char *)row[i]));
|
||||
|
@ -158,7 +156,8 @@ static int l_query(lua_State *L){
|
|||
break;
|
||||
case TSDB_DATA_TYPE_BINARY:
|
||||
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;
|
||||
case TSDB_DATA_TYPE_TIMESTAMP:
|
||||
lua_pushinteger(L,*((int64_t *)row[i]));
|
||||
|
@ -166,6 +165,7 @@ static int l_query(lua_State *L){
|
|||
case TSDB_DATA_TYPE_BOOL:
|
||||
lua_pushinteger(L,*((char *)row[i]));
|
||||
break;
|
||||
case TSDB_DATA_TYPE_NULL:
|
||||
default:
|
||||
lua_pushnil(L);
|
||||
break;
|
||||
|
@ -235,112 +235,6 @@ static int l_async_query(lua_State *L){
|
|||
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){
|
||||
TAOS *taos= (TAOS*)lua_topointer(L,1);
|
||||
|
@ -367,8 +261,6 @@ static const struct luaL_Reg lib[] = {
|
|||
{"query", l_query},
|
||||
{"query_a",l_async_query},
|
||||
{"close", l_close},
|
||||
{"open_stream", l_open_stream},
|
||||
{"close_stream", l_close_stream},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include <lua.h>
|
||||
#include <lauxlib.h>
|
||||
#include <lualib.h>
|
||||
#include "taos.h"
|
||||
#include <taos.h>
|
||||
|
||||
struct cb_param{
|
||||
lua_State* state;
|
||||
|
@ -60,6 +60,8 @@ static int l_connect(lua_State *L){
|
|||
|
||||
lua_settop(L,0);
|
||||
|
||||
taos_init();
|
||||
|
||||
lua_newtable(L);
|
||||
int table_index = lua_gettop(L);
|
||||
|
||||
|
|
|
@ -9,6 +9,50 @@ local config = {
|
|||
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 res = driver.connect(config)
|
||||
if res.code ~=0 then
|
||||
|
@ -37,7 +81,7 @@ else
|
|||
print("select db--- pass.")
|
||||
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
|
||||
print("create table---failed: "..res.error)
|
||||
return
|
||||
|
@ -45,7 +89,7 @@ else
|
|||
print("create table--- pass.")
|
||||
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
|
||||
print("insert records failed: "..res.error)
|
||||
return
|
||||
|
@ -64,21 +108,25 @@ if res.code ~=0 then
|
|||
return
|
||||
else
|
||||
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
|
||||
print("select--- failed: expect 3 affected records, actually received "..#(res.item))
|
||||
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
|
||||
print(res.error)
|
||||
return
|
||||
else
|
||||
print("create super table--- pass")
|
||||
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
|
||||
print(res.error)
|
||||
return
|
||||
|
@ -86,7 +134,7 @@ else
|
|||
print("create table--- pass")
|
||||
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
|
||||
print(res.error)
|
||||
|
@ -99,14 +147,14 @@ else
|
|||
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
|
||||
print("select from super table--- failed:"..res.error)
|
||||
return
|
||||
else
|
||||
print("select from super table--- pass")
|
||||
for i = 1, #(res.item) do
|
||||
print("res:"..res.item[i].count)
|
||||
print("res:"..res.item[i].cnt)
|
||||
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)
|
||||
|
||||
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("------------------------")
|
||||
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.")
|
||||
print("From now on we start continous insert in an definite loop, pls wait for about 10 seconds and check stream table for result.")
|
||||
local loop_index = 0
|
||||
while loop_index < 30 do
|
||||
while loop_index < 10 do
|
||||
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))
|
||||
|
||||
if res.code ~=0 then
|
||||
|
@ -162,7 +193,5 @@ while loop_index < 30 do
|
|||
os.execute("sleep " .. 1)
|
||||
loop_index = loop_index + 1
|
||||
end
|
||||
|
||||
driver.close_stream(stream)
|
||||
|
||||
driver.query(conn,"DROP STREAM IF EXISTS avg_therm_s")
|
||||
driver.close(conn)
|
||||
|
|
|
@ -94,7 +94,10 @@ extern int64_t tsQueryBufferSizeBytes; // maximum allowed usage buffer size in
|
|||
// query client
|
||||
extern int32_t tsQueryPolicy;
|
||||
extern int32_t tsQuerySmaOptimize;
|
||||
extern int32_t tsQueryRsmaTolerance;
|
||||
extern bool tsQueryPlannerTrace;
|
||||
extern int32_t tsQueryNodeChunkSize;
|
||||
extern bool tsQueryUseNodeAllocator;
|
||||
|
||||
// client
|
||||
extern int32_t tsMinSlidingTime;
|
||||
|
|
|
@ -78,7 +78,6 @@ enum {
|
|||
MAIN_SCAN = 0x0u,
|
||||
REVERSE_SCAN = 0x1u, // todo remove it
|
||||
REPEAT_SCAN = 0x2u, // repeat scan belongs to the master scan
|
||||
MERGE_STAGE = 0x20u,
|
||||
};
|
||||
|
||||
typedef struct SPoint1 {
|
||||
|
@ -156,11 +155,6 @@ typedef struct SqlFunctionCtx {
|
|||
char udfName[TSDB_FUNC_NAME_LEN];
|
||||
} SqlFunctionCtx;
|
||||
|
||||
enum {
|
||||
TEXPR_BINARYEXPR_NODE = 0x1,
|
||||
TEXPR_UNARYEXPR_NODE = 0x2,
|
||||
};
|
||||
|
||||
typedef struct tExprNode {
|
||||
int32_t nodeType;
|
||||
union {
|
||||
|
@ -182,8 +176,9 @@ struct SScalarParam {
|
|||
SColumnInfoData *columnData;
|
||||
SHashObj *pHashFilter;
|
||||
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 numOfQualified; // number of qualified elements in the final results
|
||||
};
|
||||
|
||||
void cleanupResultRowEntry(struct SResultRowEntryInfo *pCell);
|
||||
|
@ -201,8 +196,6 @@ int32_t taosGetLinearInterpolationVal(SPoint *point, int32_t outputType, SPoint
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// udf api
|
||||
struct SUdfInfo;
|
||||
|
||||
/**
|
||||
* create udfd proxy, called once in process that call doSetupUdf/callUdfxxx/doTeardownUdf
|
||||
* @return error code
|
||||
|
@ -226,6 +219,7 @@ int32_t udfStartUdfd(int32_t startDnodeId);
|
|||
* @return
|
||||
*/
|
||||
int32_t udfStopUdfd();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -275,6 +275,17 @@ typedef struct SNodeList {
|
|||
SListCell* pTail;
|
||||
} SNodeList;
|
||||
|
||||
typedef struct SNodeAllocator SNodeAllocator;
|
||||
|
||||
int32_t nodesInitAllocatorSet();
|
||||
void nodesDestroyAllocatorSet();
|
||||
int32_t nodesCreateAllocator(int64_t queryId, int32_t chunkSize, int64_t* pAllocatorId);
|
||||
int32_t nodesAcquireAllocator(int64_t allocatorId);
|
||||
int32_t nodesReleaseAllocator(int64_t allocatorId);
|
||||
int64_t nodesMakeAllocatorWeakRef(int64_t allocatorId);
|
||||
int64_t nodesReleaseAllocatorWeakRef(int64_t allocatorId);
|
||||
void nodesDestroyAllocator(int64_t allocatorId);
|
||||
|
||||
SNode* nodesMakeNode(ENodeType type);
|
||||
void nodesDestroyNode(SNode* pNode);
|
||||
|
||||
|
|
|
@ -56,6 +56,7 @@ typedef struct SParseContext {
|
|||
bool nodeOffline;
|
||||
SArray* pTableMetaPos; // sql table pos => catalog data pos
|
||||
SArray* pTableVgroupPos; // sql table pos => catalog data pos
|
||||
int64_t allocatorId;
|
||||
} SParseContext;
|
||||
|
||||
int32_t qParseSql(SParseContext* pCxt, SQuery** pQuery);
|
||||
|
|
|
@ -39,6 +39,7 @@ typedef struct SPlanContext {
|
|||
int32_t msgLen;
|
||||
const char* pUser;
|
||||
bool sysInfo;
|
||||
int64_t allocatorId;
|
||||
} SPlanContext;
|
||||
|
||||
// Create the physical plan for the query, according to the AST.
|
||||
|
|
|
@ -31,13 +31,17 @@ enum {
|
|||
FLT_OPTION_NEED_UNIQE = 4,
|
||||
};
|
||||
|
||||
#define FILTER_RESULT_ALL_QUALIFIED 0x1
|
||||
#define FILTER_RESULT_NONE_QUALIFIED 0x2
|
||||
#define FILTER_RESULT_PARTIAL_QUALIFIED 0x3
|
||||
|
||||
typedef struct SFilterColumnParam {
|
||||
int32_t numOfCols;
|
||||
SArray *pDataBlock;
|
||||
} SFilterColumnParam;
|
||||
|
||||
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);
|
||||
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 filterSetDataFromColId(SFilterInfo *info, void *param);
|
||||
extern int32_t filterGetTimeRange(SNode *pNode, STimeWindow *win, bool *isStrict);
|
||||
|
|
|
@ -67,6 +67,7 @@ typedef struct SSchedulerReq {
|
|||
SRequestConnInfo *pConn;
|
||||
SArray *pNodeList;
|
||||
SQueryPlan *pDag;
|
||||
int64_t allocatorRefId;
|
||||
const char *sql;
|
||||
int64_t startTs;
|
||||
schedulerExecFp execFp;
|
||||
|
|
|
@ -552,7 +552,6 @@ int32_t* taosGetErrno();
|
|||
#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_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_INVALID_WINDOW_PC TAOS_DEF_ERROR_CODE(0, 0x2658)
|
||||
#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_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_SUPPORT_JOIN TAOS_DEF_ERROR_CODE(0, 0x2664)
|
||||
#define TSDB_CODE_PAR_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x26FF)
|
||||
|
||||
//planner
|
||||
|
|
|
@ -225,7 +225,8 @@ typedef enum ELogicConditionType {
|
|||
#define TSDB_APP_NAME_LEN TSDB_UNI_LEN
|
||||
#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.
|
||||
|
|
|
@ -202,8 +202,8 @@ elif [[ ${packgeName} =~ "tar" ]];then
|
|||
cd ${oriInstallPath}/${originTdpPath} && tar xf ${subFile}
|
||||
fi
|
||||
|
||||
cd ${oriInstallPath}/${originTdpPath} && tree > ${installPath}/base_${originversion}_checkfile
|
||||
cd ${installPath}/${tdPath} && tree > ${installPath}/now_${version}_checkfile
|
||||
cd ${oriInstallPath}/${originTdpPath} && tree -I "driver" > ${installPath}/base_${originversion}_checkfile
|
||||
cd ${installPath}/${tdPath} && tree -I "driver" > ${installPath}/now_${version}_checkfile
|
||||
|
||||
cd ${installPath}
|
||||
diff ${installPath}/base_${originversion}_checkfile ${installPath}/now_${version}_checkfile > ${installPath}/diffFile.log
|
||||
|
@ -215,6 +215,7 @@ elif [[ ${packgeName} =~ "tar" ]];then
|
|||
exit -1
|
||||
else
|
||||
echoColor G "The number and names of files are the same as previous installation packages"
|
||||
rm -rf ${installPath}/diffFile.log
|
||||
fi
|
||||
echoColor YD "===== install Package of tar ====="
|
||||
cd ${installPath}/${tdPath}
|
||||
|
@ -251,6 +252,9 @@ if [[ ${packgeName} =~ "server" ]] ;then
|
|||
systemctl restart taosd
|
||||
fi
|
||||
|
||||
rm -rf ${installPath}/${packgeName}
|
||||
rm -rf ${installPath}/${tdPath}/
|
||||
|
||||
# if ([[ ${packgeName} =~ "Lite" ]] && [[ ${packgeName} =~ "tar" ]]) || [[ ${packgeName} =~ "client" ]] ;then
|
||||
# echoColor G "===== install taos-tools when package is lite or client ====="
|
||||
# cd ${installPath}
|
||||
|
|
|
@ -59,9 +59,9 @@ enum {
|
|||
#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 TD_RES_QUERY(res) (*(int8_t*)res == RES_TYPE__QUERY)
|
||||
#define TD_RES_TMQ(res) (*(int8_t*)res == RES_TYPE__TMQ)
|
||||
#define TD_RES_TMQ_META(res) (*(int8_t*)res == RES_TYPE__TMQ_META)
|
||||
#define TD_RES_QUERY(res) (*(int8_t*)res == RES_TYPE__QUERY)
|
||||
#define TD_RES_TMQ(res) (*(int8_t*)res == RES_TYPE__TMQ)
|
||||
#define TD_RES_TMQ_META(res) (*(int8_t*)res == RES_TYPE__TMQ_META)
|
||||
#define TD_RES_TMQ_METADATA(res) (*(int8_t*)res == RES_TYPE__TMQ_METADATA)
|
||||
|
||||
typedef struct SAppInstInfo SAppInstInfo;
|
||||
|
@ -250,6 +250,8 @@ typedef struct SRequestObj {
|
|||
bool inRetry;
|
||||
uint32_t prevCode; // previous error code: todo refactor, add update flag for catalog
|
||||
uint32_t retry;
|
||||
int64_t allocatorRefId;
|
||||
SQuery* pQuery;
|
||||
} SRequestObj;
|
||||
|
||||
typedef struct SSyncQueryParam {
|
||||
|
|
|
@ -288,6 +288,7 @@ void *createRequest(uint64_t connId, int32_t type) {
|
|||
|
||||
pRequest->body.resInfo.convertUcs4 = true; // convert ucs4 by default
|
||||
pRequest->type = type;
|
||||
pRequest->allocatorRefId = -1;
|
||||
|
||||
pRequest->pDb = getDbOfConnection(pTscObj);
|
||||
pRequest->pTscObj = pTscObj;
|
||||
|
@ -349,6 +350,8 @@ void doDestroyRequest(void *p) {
|
|||
taosArrayDestroy(pRequest->tableList);
|
||||
taosArrayDestroy(pRequest->dbList);
|
||||
taosArrayDestroy(pRequest->targetTableList);
|
||||
qDestroyQuery(pRequest->pQuery);
|
||||
nodesDestroyAllocator(pRequest->allocatorRefId);
|
||||
|
||||
destroyQueryExecRes(&pRequest->body.resInfo.execRes);
|
||||
|
||||
|
@ -411,6 +414,7 @@ void taos_init_imp(void) {
|
|||
|
||||
initTaskQueue();
|
||||
fmFuncMgtInit();
|
||||
nodesInitAllocatorSet();
|
||||
|
||||
clientConnRefPool = taosOpenRef(200, destroyTscObj);
|
||||
clientReqRefPool = taosOpenRef(40960, doDestroyRequest);
|
||||
|
|
|
@ -274,13 +274,13 @@ static int32_t hbAsyncCallBack(void *param, SDataBuf *pMsg, int32_t code) {
|
|||
SClientHbBatchRsp pRsp = {0};
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
tDeserializeSClientHbBatchRsp(pMsg->pData, pMsg->len, &pRsp);
|
||||
}
|
||||
|
||||
int32_t now = taosGetTimestampSec();
|
||||
int32_t delta = abs(now - pRsp.svrTimestamp);
|
||||
if (delta > timestampDeltaLimit) {
|
||||
code = TSDB_CODE_TIME_UNSYNCED;
|
||||
tscError("time diff: %ds is too big", delta);
|
||||
int32_t now = taosGetTimestampSec();
|
||||
int32_t delta = abs(now - pRsp.svrTimestamp);
|
||||
if (delta > timestampDeltaLimit) {
|
||||
code = TSDB_CODE_TIME_UNSYNCED;
|
||||
tscError("time diff: %ds is too big", delta);
|
||||
}
|
||||
}
|
||||
|
||||
int32_t rspNum = taosArrayGetSize(pRsp.rsps);
|
||||
|
|
|
@ -195,6 +195,19 @@ int32_t buildRequest(uint64_t connId, const char* sql, int sqlLen, void* param,
|
|||
return TSDB_CODE_TSC_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
(*pRequest)->allocatorRefId = -1;
|
||||
if (tsQueryUseNodeAllocator && !qIsInsertValuesSql((*pRequest)->sqlstr, (*pRequest)->sqlLen)) {
|
||||
if (TSDB_CODE_SUCCESS !=
|
||||
nodesCreateAllocator((*pRequest)->requestId, tsQueryNodeChunkSize, &((*pRequest)->allocatorRefId))) {
|
||||
tscError("%d failed to create node allocator, reqId:0x%" PRIx64 ", conn:%d, %s", (*pRequest)->self,
|
||||
(*pRequest)->requestId, pTscObj->id, sql);
|
||||
|
||||
destroyRequest(*pRequest);
|
||||
*pRequest = NULL;
|
||||
return TSDB_CODE_TSC_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
|
||||
tscDebugL("0x%" PRIx64 " SQL: %s, reqId:0x%" PRIx64, (*pRequest)->self, (*pRequest)->sqlstr, (*pRequest)->requestId);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
@ -682,6 +695,8 @@ int32_t scheduleQuery(SRequestObj* pRequest, SQueryPlan* pDag, SArray* pNodeList
|
|||
};
|
||||
|
||||
int32_t code = schedulerExecJob(&req, &pRequest->body.queryJob);
|
||||
|
||||
destroyQueryExecRes(&pRequest->body.resInfo.execRes);
|
||||
memcpy(&pRequest->body.resInfo.execRes, &res, sizeof(res));
|
||||
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
|
@ -1023,7 +1038,8 @@ void launchAsyncQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaData* pResultM
|
|||
.pMsg = pRequest->msgBuf,
|
||||
.msgLen = ERROR_MSG_BUF_DEFAULT_SIZE,
|
||||
.pUser = pRequest->pTscObj->user,
|
||||
.sysInfo = pRequest->pTscObj->sysInfo};
|
||||
.sysInfo = pRequest->pTscObj->sysInfo,
|
||||
.allocatorId = pRequest->allocatorRefId};
|
||||
|
||||
SAppInstInfo* pAppInfo = getAppInfo(pRequest);
|
||||
SQueryPlan* pDag = NULL;
|
||||
|
@ -1048,6 +1064,7 @@ void launchAsyncQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaData* pResultM
|
|||
.pConn = &conn,
|
||||
.pNodeList = pNodeList,
|
||||
.pDag = pDag,
|
||||
.allocatorRefId = pRequest->allocatorRefId,
|
||||
.sql = pRequest->sqlstr,
|
||||
.startTs = pRequest->metric.start,
|
||||
.execFp = schedulerExecCb,
|
||||
|
|
|
@ -65,6 +65,7 @@ void taos_cleanup(void) {
|
|||
|
||||
fmFuncMgtDestroy();
|
||||
qCleanupKeywordsTable();
|
||||
nodesDestroyAllocatorSet();
|
||||
|
||||
id = clientConnRefPool;
|
||||
clientConnRefPool = -1;
|
||||
|
@ -669,7 +670,6 @@ typedef struct SqlParseWrapper {
|
|||
SParseContext *pCtx;
|
||||
SCatalogReq catalogReq;
|
||||
SRequestObj *pRequest;
|
||||
SQuery *pQuery;
|
||||
} SqlParseWrapper;
|
||||
|
||||
static void destoryTablesReq(void *p) {
|
||||
|
@ -695,8 +695,8 @@ static void destorySqlParseWrapper(SqlParseWrapper *pWrapper) {
|
|||
|
||||
void retrieveMetaCallback(SMetaData *pResultMeta, void *param, int32_t code) {
|
||||
SqlParseWrapper *pWrapper = (SqlParseWrapper *)param;
|
||||
SQuery *pQuery = pWrapper->pQuery;
|
||||
SRequestObj *pRequest = pWrapper->pRequest;
|
||||
SQuery *pQuery = pRequest->pQuery;
|
||||
|
||||
pRequest->metric.ctgEnd = taosGetTimestampUs();
|
||||
|
||||
|
@ -725,10 +725,10 @@ void retrieveMetaCallback(SMetaData *pResultMeta, void *param, int32_t code) {
|
|||
tscDebug("0x%" PRIx64 " analysis semantics completed, start async query, reqId:0x%" PRIx64, pRequest->self,
|
||||
pRequest->requestId);
|
||||
launchAsyncQuery(pRequest, pQuery, pResultMeta);
|
||||
qDestroyQuery(pQuery);
|
||||
} else {
|
||||
destorySqlParseWrapper(pWrapper);
|
||||
qDestroyQuery(pQuery);
|
||||
qDestroyQuery(pRequest->pQuery);
|
||||
pRequest->pQuery = NULL;
|
||||
if (NEED_CLIENT_HANDLE_ERROR(code)) {
|
||||
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);
|
||||
|
@ -775,7 +775,8 @@ int32_t createParseContext(const SRequestObj *pRequest, SParseContext **pCxt) {
|
|||
.enableSysInfo = pTscObj->sysInfo,
|
||||
.async = true,
|
||||
.svrVer = pTscObj->sVer,
|
||||
.nodeOffline = (pTscObj->pAppInfo->onlineDnodes < pTscObj->pAppInfo->totalDnodes)};
|
||||
.nodeOffline = (pTscObj->pAppInfo->onlineDnodes < pTscObj->pAppInfo->totalDnodes),
|
||||
.allocatorId = pRequest->allocatorRefId};
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -800,12 +801,10 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) {
|
|||
goto _error;
|
||||
}
|
||||
|
||||
SQuery *pQuery = NULL;
|
||||
|
||||
pRequest->metric.syntaxStart = taosGetTimestampUs();
|
||||
|
||||
SCatalogReq catalogReq = {.forceUpdate = updateMetaForce, .qNodeRequired = qnodeRequired(pRequest)};
|
||||
code = qParseSqlSyntax(pCxt, &pQuery, &catalogReq);
|
||||
code = qParseSqlSyntax(pCxt, &pRequest->pQuery, &catalogReq);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
goto _error;
|
||||
}
|
||||
|
@ -815,9 +814,9 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) {
|
|||
if (!updateMetaForce) {
|
||||
STscObj *pTscObj = pRequest->pTscObj;
|
||||
SAppClusterSummary *pActivity = &pTscObj->pAppInfo->summary;
|
||||
if (NULL == pQuery->pRoot) {
|
||||
if (NULL == pRequest->pQuery->pRoot) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -829,7 +828,6 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) {
|
|||
}
|
||||
|
||||
pWrapper->pCtx = pCxt;
|
||||
pWrapper->pQuery = pQuery;
|
||||
pWrapper->pRequest = pRequest;
|
||||
pWrapper->catalogReq = catalogReq;
|
||||
|
||||
|
|
|
@ -227,6 +227,7 @@ static const SSysDbTableSchema transSchema[] = {
|
|||
{.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .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 = "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 = "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},
|
||||
|
|
|
@ -1278,7 +1278,9 @@ int32_t assignOneDataBlock(SSDataBlock* dst, const SSDataBlock* src) {
|
|||
colDataAssign(pDst, pSrc, src->info.rows, &src->info);
|
||||
}
|
||||
|
||||
uint32_t cap = dst->info.capacity;
|
||||
dst->info = src->info;
|
||||
dst->info.capacity = cap;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1302,8 +1304,9 @@ int32_t copyDataBlock(SSDataBlock* dst, const SSDataBlock* src) {
|
|||
|
||||
colDataAssign(pDst, pSrc, src->info.rows, &src->info);
|
||||
}
|
||||
|
||||
uint32_t cap = dst->info.capacity;
|
||||
dst->info = src->info;
|
||||
dst->info.capacity = cap;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -1333,6 +1336,8 @@ SSDataBlock* createSpecialDataBlock(EStreamType type) {
|
|||
// group id
|
||||
taosArrayPush(pBlock->pDataBlock, &infoData);
|
||||
|
||||
infoData.info.type = TSDB_DATA_TYPE_TIMESTAMP;
|
||||
infoData.info.bytes = sizeof(TSKEY);
|
||||
// calculate start ts
|
||||
taosArrayPush(pBlock->pDataBlock, &infoData);
|
||||
// calculate end ts
|
||||
|
@ -2280,4 +2285,3 @@ const char* blockDecode(SSDataBlock* pBlock, const char* pData) {
|
|||
ASSERT(pStart - pData == dataLen);
|
||||
return pStart;
|
||||
}
|
||||
|
||||
|
|
|
@ -91,7 +91,10 @@ bool tsSmlDataFormat =
|
|||
// query
|
||||
int32_t tsQueryPolicy = 1;
|
||||
int32_t tsQuerySmaOptimize = 0;
|
||||
int32_t tsQueryRsmaTolerance = 1000; // the tolerance time (ms) to judge from which level to query rsma data.
|
||||
bool tsQueryPlannerTrace = false;
|
||||
int32_t tsQueryNodeChunkSize = 32 * 1024;
|
||||
bool tsQueryUseNodeAllocator = true;
|
||||
|
||||
/*
|
||||
* denote if the server needs to compress response message at the application layer to client, including query rsp,
|
||||
|
@ -285,6 +288,8 @@ static int32_t taosAddClientCfg(SConfig *pCfg) {
|
|||
if (cfgAddInt32(pCfg, "queryPolicy", tsQueryPolicy, 1, 3, 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 (cfgAddInt32(pCfg, "queryNodeChunkSize", tsQueryNodeChunkSize, 1024, 128 * 1024, true) != 0) return -1;
|
||||
if (cfgAddBool(pCfg, "queryUseNodeAllocator", tsQueryUseNodeAllocator, true) != 0) return -1;
|
||||
if (cfgAddString(pCfg, "smlChildTableName", "", 1) != 0) return -1;
|
||||
if (cfgAddString(pCfg, "smlTagName", tsSmlTagName, 1) != 0) return -1;
|
||||
if (cfgAddBool(pCfg, "smlDataFormat", tsSmlDataFormat, 1) != 0) return -1;
|
||||
|
@ -419,6 +424,7 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
|
|||
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, "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 (cfgAddString(pCfg, "udfdResFuncs", tsUdfdResFuncs, 0) != 0) return -1;
|
||||
|
@ -644,6 +650,8 @@ static int32_t taosSetClientCfg(SConfig *pCfg) {
|
|||
tsQueryPolicy = cfgGetItem(pCfg, "queryPolicy")->i32;
|
||||
tsQuerySmaOptimize = cfgGetItem(pCfg, "querySmaOptimize")->i32;
|
||||
tsQueryPlannerTrace = cfgGetItem(pCfg, "queryPlannerTrace")->bval;
|
||||
tsQueryNodeChunkSize = cfgGetItem(pCfg, "queryNodeChunkSize")->i32;
|
||||
tsQueryUseNodeAllocator = cfgGetItem(pCfg, "queryUseNodeAllocator")->bval;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -716,6 +724,7 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
|
|||
tsTtlUnit = cfgGetItem(pCfg, "ttlUnit")->i32;
|
||||
tsTtlPushInterval = cfgGetItem(pCfg, "ttlPushInterval")->i32;
|
||||
tsUptimeInterval = cfgGetItem(pCfg, "uptimeInterval")->i32;
|
||||
tsQueryRsmaTolerance = cfgGetItem(pCfg, "queryRsmaTolerance")->i32;
|
||||
|
||||
tsStartUdfd = cfgGetItem(pCfg, "udf")->bval;
|
||||
tstrncpy(tsUdfdResFuncs, cfgGetItem(pCfg, "udfdResFuncs")->str, sizeof(tsUdfdResFuncs));
|
||||
|
@ -978,6 +987,12 @@ int32_t taosSetCfg(SConfig *pCfg, char *name) {
|
|||
qDebugFlag = cfgGetItem(pCfg, "qDebugFlag")->i32;
|
||||
} else if (strcasecmp("queryPlannerTrace", name) == 0) {
|
||||
tsQueryPlannerTrace = cfgGetItem(pCfg, "queryPlannerTrace")->bval;
|
||||
} else if (strcasecmp("queryNodeChunkSize", name) == 0) {
|
||||
tsQueryNodeChunkSize = cfgGetItem(pCfg, "queryNodeChunkSize")->i32;
|
||||
} else if (strcasecmp("queryUseNodeAllocator", name) == 0) {
|
||||
tsQueryUseNodeAllocator = cfgGetItem(pCfg, "queryUseNodeAllocator")->bval;
|
||||
} else if (strcasecmp("queryRsmaTolerance", name) == 0) {
|
||||
tsQueryRsmaTolerance = cfgGetItem(pCfg, "queryRsmaTolerance")->i32;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -74,6 +74,7 @@ typedef struct {
|
|||
TdThread thread;
|
||||
SVnodeMgmt *pMgmt;
|
||||
SWrapperCfg *pCfgs;
|
||||
SVnodeObj **ppVnodes;
|
||||
} SVnodeThread;
|
||||
|
||||
// vmInt.c
|
||||
|
|
|
@ -218,14 +218,14 @@ static void vmCloseVnodes(SVnodeMgmt *pMgmt) {
|
|||
dInfo("start to close all vnodes");
|
||||
|
||||
int32_t numOfVnodes = 0;
|
||||
SVnodeObj **pVnodes = vmGetVnodeListFromHash(pMgmt, &numOfVnodes);
|
||||
SVnodeObj **ppVnodes = vmGetVnodeListFromHash(pMgmt, &numOfVnodes);
|
||||
|
||||
for (int32_t i = 0; i < numOfVnodes; ++i) {
|
||||
vmCloseVnode(pMgmt, pVnodes[i]);
|
||||
vmCloseVnode(pMgmt, ppVnodes[i]);
|
||||
}
|
||||
|
||||
if (pVnodes != NULL) {
|
||||
taosMemoryFree(pVnodes);
|
||||
if (ppVnodes != NULL) {
|
||||
taosMemoryFree(ppVnodes);
|
||||
}
|
||||
|
||||
if (pMgmt->hash != NULL) {
|
||||
|
@ -331,22 +331,92 @@ static int32_t vmRequire(const SMgmtInputOpt *pInput, bool *required) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int32_t vmStart(SVnodeMgmt *pMgmt) {
|
||||
int32_t numOfVnodes = 0;
|
||||
SVnodeObj **pVnodes = vmGetVnodeListFromHash(pMgmt, &numOfVnodes);
|
||||
static void *vmRestoreVnodeInThread(void *param) {
|
||||
SVnodeThread *pThread = param;
|
||||
SVnodeMgmt *pMgmt = pThread->pMgmt;
|
||||
|
||||
for (int32_t i = 0; i < numOfVnodes; ++i) {
|
||||
SVnodeObj *pVnode = pVnodes[i];
|
||||
vnodeStart(pVnode->pImpl);
|
||||
dInfo("thread:%d, start to restore %d vnodes", pThread->threadIndex, pThread->vnodeNum);
|
||||
setThreadName("restore-vnodes");
|
||||
|
||||
for (int32_t v = 0; v < pThread->vnodeNum; ++v) {
|
||||
SVnodeObj *pVnode = pThread->ppVnodes[v];
|
||||
|
||||
char stepDesc[TSDB_STEP_DESC_LEN] = {0};
|
||||
snprintf(stepDesc, TSDB_STEP_DESC_LEN, "vgId:%d, start to restore, %d of %d have been restored", pVnode->vgId,
|
||||
pMgmt->state.openVnodes, pMgmt->state.totalVnodes);
|
||||
tmsgReportStartup("vnode-restore", stepDesc);
|
||||
|
||||
int32_t code = vnodeStart(pVnode->pImpl);
|
||||
if (code != 0) {
|
||||
dError("vgId:%d, failed to restore vnode by thread:%d", pVnode->vgId, pThread->threadIndex);
|
||||
pThread->failed++;
|
||||
} else {
|
||||
dDebug("vgId:%d, is restored by thread:%d", pVnode->vgId, pThread->threadIndex);
|
||||
pThread->opened++;
|
||||
atomic_add_fetch_32(&pMgmt->state.openVnodes, 1);
|
||||
}
|
||||
}
|
||||
|
||||
dInfo("thread:%d, numOfVnodes:%d, restored:%d failed:%d", pThread->threadIndex, pThread->vnodeNum, pThread->opened,
|
||||
pThread->failed);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int32_t vmStartVnodes(SVnodeMgmt *pMgmt) {
|
||||
int32_t numOfVnodes = 0;
|
||||
SVnodeObj **ppVnodes = vmGetVnodeListFromHash(pMgmt, &numOfVnodes);
|
||||
|
||||
int32_t threadNum = tsNumOfCores / 2;
|
||||
if (threadNum < 1) threadNum = 1;
|
||||
int32_t vnodesPerThread = numOfVnodes / threadNum + 1;
|
||||
|
||||
SVnodeThread *threads = taosMemoryCalloc(threadNum, sizeof(SVnodeThread));
|
||||
for (int32_t t = 0; t < threadNum; ++t) {
|
||||
threads[t].threadIndex = t;
|
||||
threads[t].pMgmt = pMgmt;
|
||||
threads[t].ppVnodes = taosMemoryCalloc(vnodesPerThread, sizeof(SVnode *));
|
||||
}
|
||||
|
||||
for (int32_t v = 0; v < numOfVnodes; ++v) {
|
||||
int32_t t = v % threadNum;
|
||||
SVnodeThread *pThread = &threads[t];
|
||||
pThread->ppVnodes[pThread->vnodeNum++] = ppVnodes[v];
|
||||
}
|
||||
|
||||
pMgmt->state.openVnodes = 0;
|
||||
dInfo("restore %d vnodes with %d threads", numOfVnodes, threadNum);
|
||||
|
||||
for (int32_t t = 0; t < threadNum; ++t) {
|
||||
SVnodeThread *pThread = &threads[t];
|
||||
if (pThread->vnodeNum == 0) continue;
|
||||
|
||||
TdThreadAttr thAttr;
|
||||
taosThreadAttrInit(&thAttr);
|
||||
taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE);
|
||||
if (taosThreadCreate(&pThread->thread, &thAttr, vmRestoreVnodeInThread, pThread) != 0) {
|
||||
dError("thread:%d, failed to create thread to restore vnode since %s", pThread->threadIndex, strerror(errno));
|
||||
}
|
||||
|
||||
taosThreadAttrDestroy(&thAttr);
|
||||
}
|
||||
|
||||
for (int32_t t = 0; t < threadNum; ++t) {
|
||||
SVnodeThread *pThread = &threads[t];
|
||||
if (pThread->vnodeNum > 0 && taosCheckPthreadValid(pThread->thread)) {
|
||||
taosThreadJoin(pThread->thread, NULL);
|
||||
taosThreadClear(&pThread->thread);
|
||||
}
|
||||
taosMemoryFree(pThread->ppVnodes);
|
||||
}
|
||||
taosMemoryFree(threads);
|
||||
|
||||
for (int32_t i = 0; i < numOfVnodes; ++i) {
|
||||
SVnodeObj *pVnode = pVnodes[i];
|
||||
SVnodeObj *pVnode = ppVnodes[i];
|
||||
vmReleaseVnode(pMgmt, pVnode);
|
||||
}
|
||||
|
||||
if (pVnodes != NULL) {
|
||||
taosMemoryFree(pVnodes);
|
||||
if (ppVnodes != NULL) {
|
||||
taosMemoryFree(ppVnodes);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -360,7 +430,7 @@ SMgmtFunc vmGetMgmtFunc() {
|
|||
SMgmtFunc mgmtFunc = {0};
|
||||
mgmtFunc.openFp = vmInit;
|
||||
mgmtFunc.closeFp = (NodeCloseFp)vmCleanup;
|
||||
mgmtFunc.startFp = (NodeStartFp)vmStart;
|
||||
mgmtFunc.startFp = (NodeStartFp)vmStartVnodes;
|
||||
mgmtFunc.stopFp = (NodeStopFp)vmStop;
|
||||
mgmtFunc.requiredFp = vmRequire;
|
||||
mgmtFunc.getHandlesFp = vmGetMsgHandles;
|
||||
|
|
|
@ -171,6 +171,7 @@ typedef struct {
|
|||
int32_t stopFunc;
|
||||
int32_t paramLen;
|
||||
void* param;
|
||||
char opername[TSDB_TRANS_OPER_LEN];
|
||||
SArray* pRpcArray;
|
||||
} STrans;
|
||||
|
||||
|
|
|
@ -61,7 +61,8 @@ void mndCleanupTrans(SMnode *pMnode);
|
|||
STrans *mndAcquireTrans(SMnode *pMnode, int32_t transId);
|
||||
void mndReleaseTrans(SMnode *pMnode, STrans *pTrans);
|
||||
|
||||
STrans *mndTransCreate(SMnode *pMnode, ETrnPolicy policy, ETrnConflct conflict, const SRpcMsg *pReq);
|
||||
STrans *mndTransCreate(SMnode *pMnode, ETrnPolicy policy, ETrnConflct conflict, const SRpcMsg *pReq,
|
||||
const char *opername);
|
||||
void mndTransDrop(STrans *pTrans);
|
||||
int32_t mndTransAppendRedolog(STrans *pTrans, SSdbRaw *pRaw);
|
||||
int32_t mndTransAppendUndolog(STrans *pTrans, SSdbRaw *pRaw);
|
||||
|
|
|
@ -81,7 +81,7 @@ static int32_t mndCreateDefaultAcct(SMnode *pMnode) {
|
|||
|
||||
mDebug("acct:%s, will be created when deploying, raw:%p", acctObj.acct, pRaw);
|
||||
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, NULL);
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, NULL, "create-acct");
|
||||
if (pTrans == NULL) {
|
||||
mError("acct:%s, failed to create since %s", acctObj.acct, terrstr());
|
||||
return -1;
|
||||
|
|
|
@ -246,7 +246,7 @@ static int32_t mndCreateBnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode,
|
|||
bnodeObj.createdTime = taosGetTimestampMs();
|
||||
bnodeObj.updateTime = bnodeObj.createdTime;
|
||||
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq);
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "create-bnode");
|
||||
if (pTrans == NULL) goto _OVER;
|
||||
|
||||
mDebug("trans:%d, used to create bnode:%d", pTrans->id, pCreate->dnodeId);
|
||||
|
@ -354,7 +354,7 @@ static int32_t mndSetDropBnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SBn
|
|||
static int32_t mndDropBnode(SMnode *pMnode, SRpcMsg *pReq, SBnodeObj *pObj) {
|
||||
int32_t code = -1;
|
||||
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pReq);
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pReq, "drop-bnode");
|
||||
if (pTrans == NULL) goto _OVER;
|
||||
|
||||
mDebug("trans:%d, used to drop bnode:%d", pTrans->id, pObj->id);
|
||||
|
|
|
@ -235,7 +235,7 @@ static int32_t mndCreateDefaultCluster(SMnode *pMnode) {
|
|||
|
||||
mDebug("cluster:%" PRId64 ", will be created when deploying, raw:%p", clusterObj.id, pRaw);
|
||||
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, NULL);
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, NULL, "create-cluster");
|
||||
if (pTrans == NULL) {
|
||||
mError("cluster:%" PRId64 ", failed to create since %s", clusterObj.id, terrstr());
|
||||
return -1;
|
||||
|
@ -316,7 +316,7 @@ static int32_t mndProcessUptimeTimer(SRpcMsg *pReq) {
|
|||
}
|
||||
|
||||
mTrace("update cluster uptime to %" PRId64, clusterObj.upTime);
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq);
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "update-uptime");
|
||||
if (pTrans == NULL) return -1;
|
||||
|
||||
SSdbRaw *pCommitRaw = mndClusterActionEncode(&clusterObj);
|
||||
|
|
|
@ -109,7 +109,7 @@ static int32_t mndProcessConsumerLostMsg(SRpcMsg *pMsg) {
|
|||
|
||||
mndReleaseConsumer(pMnode, pConsumer);
|
||||
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pMsg);
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pMsg, "lost-csm");
|
||||
if (pTrans == NULL) goto FAIL;
|
||||
if (mndSetConsumerCommitLogs(pMnode, pTrans, pConsumerNew) != 0) goto FAIL;
|
||||
if (mndTransPrepare(pMnode, pTrans) != 0) goto FAIL;
|
||||
|
@ -142,7 +142,7 @@ static int32_t mndProcessConsumerRecoverMsg(SRpcMsg *pMsg) {
|
|||
|
||||
mndReleaseConsumer(pMnode, pConsumer);
|
||||
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pMsg);
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pMsg, "recover-csm");
|
||||
if (pTrans == NULL) goto FAIL;
|
||||
if (mndSetConsumerCommitLogs(pMnode, pTrans, pConsumerNew) != 0) goto FAIL;
|
||||
if (mndTransPrepare(pMnode, pTrans) != 0) goto FAIL;
|
||||
|
@ -465,7 +465,7 @@ static int32_t mndProcessSubscribeReq(SRpcMsg *pMsg) {
|
|||
|
||||
int32_t newTopicNum = taosArrayGetSize(newSub);
|
||||
// check topic existance
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pMsg);
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pMsg, "subscribe");
|
||||
if (pTrans == NULL) goto SUBSCRIBE_OVER;
|
||||
|
||||
for (int32_t i = 0; i < newTopicNum; i++) {
|
||||
|
|
|
@ -541,7 +541,7 @@ static int32_t mndCreateDb(SMnode *pMnode, SRpcMsg *pReq, SCreateDbReq *pCreate,
|
|||
}
|
||||
|
||||
int32_t code = -1;
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB, pReq);
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB, pReq, "create-db");
|
||||
if (pTrans == NULL) goto _OVER;
|
||||
// mndTransSetSerial(pTrans);
|
||||
mDebug("trans:%d, used to create db:%s", pTrans->id, pCreate->db);
|
||||
|
@ -773,7 +773,7 @@ static int32_t mndSetAlterDbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *
|
|||
}
|
||||
|
||||
static int32_t mndAlterDb(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pOld, SDbObj *pNew) {
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB, pReq);
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB, pReq, "alter-db");
|
||||
if (pTrans == NULL) return -1;
|
||||
mDebug("trans:%d, used to alter db:%s", pTrans->id, pOld->name);
|
||||
|
||||
|
@ -1027,7 +1027,7 @@ static int32_t mndBuildDropDbRsp(SDbObj *pDb, int32_t *pRspLen, void **ppRsp, bo
|
|||
|
||||
static int32_t mndDropDb(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb) {
|
||||
int32_t code = -1;
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB, pReq);
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB, pReq, "drop-db");
|
||||
if (pTrans == NULL) goto _OVER;
|
||||
|
||||
mDebug("trans:%d, used to drop db:%s", pTrans->id, pDb->name);
|
||||
|
|
|
@ -104,7 +104,7 @@ static int32_t mndCreateDefaultDnode(SMnode *pMnode) {
|
|||
memcpy(&dnodeObj.fqdn, tsLocalFqdn, TSDB_FQDN_LEN);
|
||||
snprintf(dnodeObj.ep, TSDB_EP_LEN, "%s:%u", dnodeObj.fqdn, dnodeObj.port);
|
||||
|
||||
pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, NULL);
|
||||
pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, NULL, "create-dnode");
|
||||
if (pTrans == NULL) goto _OVER;
|
||||
mDebug("trans:%d, used to create dnode:%s on first deploy", pTrans->id, dnodeObj.ep);
|
||||
|
||||
|
@ -488,7 +488,7 @@ static int32_t mndCreateDnode(SMnode *pMnode, SRpcMsg *pReq, SCreateDnodeReq *pC
|
|||
memcpy(dnodeObj.fqdn, pCreate->fqdn, TSDB_FQDN_LEN);
|
||||
snprintf(dnodeObj.ep, TSDB_EP_LEN, "%s:%u", dnodeObj.fqdn, dnodeObj.port);
|
||||
|
||||
pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_GLOBAL, pReq);
|
||||
pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_GLOBAL, pReq, "create-dnode");
|
||||
if (pTrans == NULL) goto _OVER;
|
||||
mDebug("trans:%d, used to create dnode:%s", pTrans->id, dnodeObj.ep);
|
||||
|
||||
|
@ -667,7 +667,7 @@ static int32_t mndDropDnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode, SM
|
|||
SSdbRaw *pRaw = NULL;
|
||||
STrans *pTrans = NULL;
|
||||
|
||||
pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq);
|
||||
pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq, "drop-dnode");
|
||||
if (pTrans == NULL) goto _OVER;
|
||||
mndTransSetSerial(pTrans);
|
||||
mInfo("trans:%d, used to drop dnode:%d", pTrans->id, pDnode->id);
|
||||
|
|
|
@ -219,7 +219,7 @@ static int32_t mndCreateFunc(SMnode *pMnode, SRpcMsg *pReq, SCreateFuncReq *pCre
|
|||
}
|
||||
memcpy(func.pCode, pCreate->pCode, func.codeSize);
|
||||
|
||||
pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq);
|
||||
pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "create-func");
|
||||
if (pTrans == NULL) goto _OVER;
|
||||
|
||||
mDebug("trans:%d, used to create func:%s", pTrans->id, pCreate->name);
|
||||
|
@ -249,7 +249,7 @@ _OVER:
|
|||
|
||||
static int32_t mndDropFunc(SMnode *pMnode, SRpcMsg *pReq, SFuncObj *pFunc) {
|
||||
int32_t code = -1;
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq);
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "drop-func");
|
||||
if (pTrans == NULL) goto _OVER;
|
||||
|
||||
mDebug("trans:%d, used to drop user:%s", pTrans->id, pFunc->name);
|
||||
|
|
|
@ -91,7 +91,7 @@ static int32_t mndCreateDefaultMnode(SMnode *pMnode) {
|
|||
|
||||
mInfo("mnode:%d, will be created when deploying, raw:%p", mnodeObj.id, pRaw);
|
||||
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, NULL);
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, NULL, "create-mnode");
|
||||
if (pTrans == NULL) {
|
||||
mError("mnode:%d, failed to create since %s", mnodeObj.id, terrstr());
|
||||
return -1;
|
||||
|
@ -362,7 +362,7 @@ static int32_t mndCreateMnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode,
|
|||
mnodeObj.createdTime = taosGetTimestampMs();
|
||||
mnodeObj.updateTime = mnodeObj.createdTime;
|
||||
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq);
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq, "create-mnode");
|
||||
if (pTrans == NULL) goto _OVER;
|
||||
mndTransSetSerial(pTrans);
|
||||
mInfo("trans:%d, used to create mnode:%d", pTrans->id, pCreate->dnodeId);
|
||||
|
@ -571,7 +571,7 @@ static int32_t mndDropMnode(SMnode *pMnode, SRpcMsg *pReq, SMnodeObj *pObj) {
|
|||
int32_t code = -1;
|
||||
STrans *pTrans = NULL;
|
||||
|
||||
pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq);
|
||||
pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq, "drop-mnode");
|
||||
if (pTrans == NULL) goto _OVER;
|
||||
mndTransSetSerial(pTrans);
|
||||
mInfo("trans:%d, used to drop mnode:%d", pTrans->id, pObj->id);
|
||||
|
|
|
@ -181,7 +181,7 @@ static int32_t mndProcessCommitOffsetReq(SRpcMsg *pMsg) {
|
|||
|
||||
tDecodeSMqCMCommitOffsetReq(&decoder, &commitOffsetReq);
|
||||
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pMsg);
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pMsg, "commit-offset");
|
||||
|
||||
for (int32_t i = 0; i < commitOffsetReq.num; i++) {
|
||||
SMqOffset *pOffset = &commitOffsetReq.offsets[i];
|
||||
|
|
|
@ -248,7 +248,7 @@ static int32_t mndCreateQnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode,
|
|||
qnodeObj.createdTime = taosGetTimestampMs();
|
||||
qnodeObj.updateTime = qnodeObj.createdTime;
|
||||
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq);
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "create-qnode");
|
||||
if (pTrans == NULL) goto _OVER;
|
||||
|
||||
mDebug("trans:%d, used to create qnode:%d", pTrans->id, pCreate->dnodeId);
|
||||
|
@ -364,7 +364,7 @@ int32_t mndSetDropQnodeInfoToTrans(SMnode *pMnode, STrans *pTrans, SQnodeObj *pO
|
|||
static int32_t mndDropQnode(SMnode *pMnode, SRpcMsg *pReq, SQnodeObj *pObj) {
|
||||
int32_t code = -1;
|
||||
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pReq);
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pReq, "drop-qnode");
|
||||
if (pTrans == NULL) goto _OVER;
|
||||
|
||||
mDebug("trans:%d, used to drop qnode:%d", pTrans->id, pObj->id);
|
||||
|
|
|
@ -587,7 +587,7 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea
|
|||
nodesDestroyNode((SNode *)pPlan);
|
||||
|
||||
int32_t code = -1;
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB, pReq);
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB, pReq, "create-sma");
|
||||
if (pTrans == NULL) goto _OVER;
|
||||
mndTransSetDbName(pTrans, pDb->name, NULL);
|
||||
mndTransSetSerial(pTrans);
|
||||
|
@ -799,7 +799,7 @@ static int32_t mndDropSma(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SSmaObj *p
|
|||
pStb = mndAcquireStb(pMnode, pSma->stb);
|
||||
if (pStb == NULL) goto _OVER;
|
||||
|
||||
pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB, pReq);
|
||||
pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB, pReq, "drop-sma");
|
||||
if (pTrans == NULL) goto _OVER;
|
||||
|
||||
mDebug("trans:%d, used to drop sma:%s", pTrans->id, pSma->name);
|
||||
|
|
|
@ -253,7 +253,7 @@ static int32_t mndCreateSnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode,
|
|||
snodeObj.createdTime = taosGetTimestampMs();
|
||||
snodeObj.updateTime = snodeObj.createdTime;
|
||||
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq);
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "create-snode");
|
||||
if (pTrans == NULL) goto _OVER;
|
||||
|
||||
mDebug("trans:%d, used to create snode:%d", pTrans->id, pCreate->dnodeId);
|
||||
|
@ -375,7 +375,7 @@ int32_t mndSetDropSnodeInfoToTrans(SMnode *pMnode, STrans *pTrans, SSnodeObj *pO
|
|||
static int32_t mndDropSnode(SMnode *pMnode, SRpcMsg *pReq, SSnodeObj *pObj) {
|
||||
int32_t code = -1;
|
||||
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pReq);
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pReq, "drop-snode");
|
||||
if (pTrans == NULL) goto _OVER;
|
||||
|
||||
mDebug("trans:%d, used to drop snode:%d", pTrans->id, pObj->id);
|
||||
|
|
|
@ -800,7 +800,7 @@ static int32_t mndCreateStb(SMnode *pMnode, SRpcMsg *pReq, SMCreateStbReq *pCrea
|
|||
SStbObj stbObj = {0};
|
||||
int32_t code = -1;
|
||||
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_DB_INSIDE, pReq);
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_DB_INSIDE, pReq, "create-stb");
|
||||
if (pTrans == NULL) goto _OVER;
|
||||
|
||||
mDebug("trans:%d, used to create stb:%s", pTrans->id, pCreate->name);
|
||||
|
@ -1843,7 +1843,7 @@ _OVER:
|
|||
static int32_t mndAlterStbImp(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SStbObj *pStb, bool needRsp,
|
||||
void *alterOriData, int32_t alterOriDataLen) {
|
||||
int32_t code = -1;
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB_INSIDE, pReq);
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB_INSIDE, pReq, "alter-stb");
|
||||
if (pTrans == NULL) goto _OVER;
|
||||
|
||||
mDebug("trans:%d, used to alter stb:%s", pTrans->id, pStb->name);
|
||||
|
@ -2042,7 +2042,7 @@ static int32_t mndSetDropStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *
|
|||
|
||||
static int32_t mndDropStb(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SStbObj *pStb) {
|
||||
int32_t code = -1;
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB_INSIDE, pReq);
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB_INSIDE, pReq, "drop-stb");
|
||||
if (pTrans == NULL) goto _OVER;
|
||||
|
||||
mDebug("trans:%d, used to drop stb:%s", pTrans->id, pStb->name);
|
||||
|
|
|
@ -666,7 +666,7 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
|
|||
goto _OVER;
|
||||
}
|
||||
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_DB_INSIDE, pReq);
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_DB_INSIDE, pReq, "create-stream");
|
||||
if (pTrans == NULL) {
|
||||
mError("stream:%s, failed to create since %s", createStreamReq.name, terrstr());
|
||||
goto _OVER;
|
||||
|
@ -759,7 +759,7 @@ static int32_t mndProcessDropStreamReq(SRpcMsg *pReq) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pReq);
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pReq, "drop-stream");
|
||||
if (pTrans == NULL) {
|
||||
mError("stream:%s, failed to drop since %s", dropReq.name, terrstr());
|
||||
sdbRelease(pMnode->pSdb, pStream);
|
||||
|
|
|
@ -441,7 +441,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
|
|||
}
|
||||
|
||||
static int32_t mndPersistRebResult(SMnode *pMnode, SRpcMsg *pMsg, const SMqRebOutputObj *pOutput) {
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_DB_INSIDE, pMsg);
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_DB_INSIDE, pMsg, "persist-reb");
|
||||
mndTransSetDbName(pTrans, pOutput->pSub->dbName, NULL);
|
||||
if (pTrans == NULL) return -1;
|
||||
|
||||
|
@ -674,7 +674,7 @@ static int32_t mndProcessDropCgroupReq(SRpcMsg *pReq) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq);
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "drop-cgroup");
|
||||
if (pTrans == NULL) {
|
||||
mError("cgroup: %s on topic:%s, failed to drop since %s", dropReq.cgroup, dropReq.topic, terrstr());
|
||||
mndReleaseSubscribe(pMnode, pSub);
|
||||
|
|
|
@ -440,7 +440,7 @@ static int32_t mndCreateTopic(SMnode *pMnode, SRpcMsg *pReq, SCMCreateTopicReq *
|
|||
/*topicObj.withTbName = 1;*/
|
||||
/*topicObj.withSchema = 1;*/
|
||||
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq);
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "create-topic");
|
||||
if (pTrans == NULL) {
|
||||
mError("topic:%s, failed to create since %s", pCreate->name, terrstr());
|
||||
taosMemoryFreeClear(topicObj.ast);
|
||||
|
@ -663,7 +663,7 @@ static int32_t mndProcessDropTopicReq(SRpcMsg *pReq) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_DB_INSIDE, pReq);
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_DB_INSIDE, pReq, "drop-topic");
|
||||
mndTransSetDbName(pTrans, pTopic->db, NULL);
|
||||
if (pTrans == NULL) {
|
||||
mError("topic:%s, failed to drop since %s", pTopic->name, terrstr());
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#define TRANS_VER_NUMBER 1
|
||||
#define TRANS_ARRAY_SIZE 8
|
||||
#define TRANS_RESERVE_SIZE 64
|
||||
#define TRANS_RESERVE_SIZE 48
|
||||
|
||||
static SSdbRaw *mndTransActionEncode(STrans *pTrans);
|
||||
static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw);
|
||||
|
@ -223,6 +223,7 @@ static SSdbRaw *mndTransActionEncode(STrans *pTrans) {
|
|||
SDB_SET_BINARY(pRaw, dataPos, pTrans->param, pTrans->paramLen, _OVER)
|
||||
}
|
||||
|
||||
SDB_SET_BINARY(pRaw, dataPos, pTrans->opername, TSDB_TRANS_OPER_LEN, _OVER)
|
||||
SDB_SET_RESERVE(pRaw, dataPos, TRANS_RESERVE_SIZE, _OVER)
|
||||
SDB_SET_DATALEN(pRaw, dataPos, _OVER)
|
||||
|
||||
|
@ -305,6 +306,7 @@ static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw) {
|
|||
if (pTrans->commitActions == NULL) goto _OVER;
|
||||
|
||||
for (int32_t i = 0; i < redoActionNum; ++i) {
|
||||
memset(&action, 0, sizeof(action));
|
||||
SDB_GET_INT32(pRaw, dataPos, &action.id, _OVER)
|
||||
SDB_GET_INT32(pRaw, dataPos, &action.errCode, _OVER)
|
||||
SDB_GET_INT32(pRaw, dataPos, &action.acceptableCode, _OVER)
|
||||
|
@ -340,6 +342,7 @@ static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw) {
|
|||
}
|
||||
|
||||
for (int32_t i = 0; i < undoActionNum; ++i) {
|
||||
memset(&action, 0, sizeof(action));
|
||||
SDB_GET_INT32(pRaw, dataPos, &action.id, _OVER)
|
||||
SDB_GET_INT32(pRaw, dataPos, &action.errCode, _OVER)
|
||||
SDB_GET_INT32(pRaw, dataPos, &action.acceptableCode, _OVER)
|
||||
|
@ -375,6 +378,7 @@ static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw) {
|
|||
}
|
||||
|
||||
for (int32_t i = 0; i < commitActionNum; ++i) {
|
||||
memset(&action, 0, sizeof(action));
|
||||
SDB_GET_INT32(pRaw, dataPos, &action.id, _OVER)
|
||||
SDB_GET_INT32(pRaw, dataPos, &action.errCode, _OVER)
|
||||
SDB_GET_INT32(pRaw, dataPos, &action.acceptableCode, _OVER)
|
||||
|
@ -417,6 +421,7 @@ static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw) {
|
|||
SDB_GET_BINARY(pRaw, dataPos, pTrans->param, pTrans->paramLen, _OVER);
|
||||
}
|
||||
|
||||
SDB_GET_BINARY(pRaw, dataPos, pTrans->opername, TSDB_TRANS_OPER_LEN, _OVER);
|
||||
SDB_GET_RESERVE(pRaw, dataPos, TRANS_RESERVE_SIZE, _OVER)
|
||||
|
||||
terrno = 0;
|
||||
|
@ -455,6 +460,20 @@ static const char *mndTransStr(ETrnStage stage) {
|
|||
}
|
||||
}
|
||||
|
||||
static void mndSetTransLastAction(STrans *pTrans, STransAction *pAction) {
|
||||
if (pAction != NULL) {
|
||||
pTrans->lastAction = pAction->id;
|
||||
pTrans->lastMsgType = pAction->msgType;
|
||||
pTrans->lastEpset = pAction->epSet;
|
||||
pTrans->lastErrorNo = pAction->errCode;
|
||||
} else {
|
||||
pTrans->lastAction = 0;
|
||||
pTrans->lastMsgType = 0;
|
||||
memset(&pTrans->lastEpset, 0, sizeof(pTrans->lastEpset));
|
||||
pTrans->lastErrorNo = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void mndTransTestStartFunc(SMnode *pMnode, void *param, int32_t paramLen) {
|
||||
mInfo("test trans start, param:%s, len:%d", (char *)param, paramLen);
|
||||
}
|
||||
|
@ -582,7 +601,8 @@ void mndReleaseTrans(SMnode *pMnode, STrans *pTrans) {
|
|||
sdbRelease(pSdb, pTrans);
|
||||
}
|
||||
|
||||
STrans *mndTransCreate(SMnode *pMnode, ETrnPolicy policy, ETrnConflct conflict, const SRpcMsg *pReq) {
|
||||
STrans *mndTransCreate(SMnode *pMnode, ETrnPolicy policy, ETrnConflct conflict, const SRpcMsg *pReq,
|
||||
const char *opername) {
|
||||
STrans *pTrans = taosMemoryCalloc(1, sizeof(STrans));
|
||||
if (pTrans == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
|
@ -590,6 +610,10 @@ STrans *mndTransCreate(SMnode *pMnode, ETrnPolicy policy, ETrnConflct conflict,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (opername != NULL) {
|
||||
tstrncpy(pTrans->opername, opername, TSDB_TRANS_OPER_LEN);
|
||||
}
|
||||
|
||||
pTrans->id = sdbGetMaxId(pMnode->pSdb, SDB_TRANS);
|
||||
pTrans->stage = TRN_STAGE_PREPARE;
|
||||
pTrans->policy = policy;
|
||||
|
@ -1037,18 +1061,12 @@ static int32_t mndTransWriteSingleLog(SMnode *pMnode, STrans *pTrans, STransActi
|
|||
mInfo("trans:%d, %s:%d write to sdb, type:%s status:%s", pTrans->id, mndTransStr(pAction->stage), pAction->id,
|
||||
sdbTableName(pAction->pRaw->type), sdbStatusName(pAction->pRaw->status));
|
||||
|
||||
pTrans->lastAction = pAction->id;
|
||||
pTrans->lastMsgType = pAction->msgType;
|
||||
pTrans->lastEpset = pAction->epSet;
|
||||
pTrans->lastErrorNo = 0;
|
||||
mndSetTransLastAction(pTrans, pAction);
|
||||
} else {
|
||||
pAction->errCode = (terrno != 0) ? terrno : code;
|
||||
mError("trans:%d, %s:%d failed to write sdb since %s, type:%s status:%s", pTrans->id, mndTransStr(pAction->stage),
|
||||
pAction->id, terrstr(), sdbTableName(pAction->pRaw->type), sdbStatusName(pAction->pRaw->status));
|
||||
pTrans->lastAction = pAction->id;
|
||||
pTrans->lastMsgType = pAction->msgType;
|
||||
pTrans->lastEpset = pAction->epSet;
|
||||
pTrans->lastErrorNo = pAction->errCode;
|
||||
mndSetTransLastAction(pTrans, pAction);
|
||||
}
|
||||
|
||||
return code;
|
||||
|
@ -1082,15 +1100,10 @@ static int32_t mndTransSendSingleMsg(SMnode *pMnode, STrans *pTrans, STransActio
|
|||
if (code == 0) {
|
||||
pAction->msgSent = 1;
|
||||
pAction->msgReceived = 0;
|
||||
pAction->errCode = 0;
|
||||
pAction->errCode = TSDB_CODE_ACTION_IN_PROGRESS;
|
||||
mInfo("trans:%d, %s:%d is sent, %s", pTrans->id, mndTransStr(pAction->stage), pAction->id, detail);
|
||||
|
||||
pTrans->lastAction = pAction->id;
|
||||
pTrans->lastMsgType = pAction->msgType;
|
||||
pTrans->lastEpset = pAction->epSet;
|
||||
if (pTrans->lastErrorNo == 0) {
|
||||
pTrans->lastErrorNo = TSDB_CODE_ACTION_IN_PROGRESS;
|
||||
}
|
||||
mndSetTransLastAction(pTrans, pAction);
|
||||
} else {
|
||||
pAction->msgSent = 0;
|
||||
pAction->msgReceived = 0;
|
||||
|
@ -1098,10 +1111,7 @@ static int32_t mndTransSendSingleMsg(SMnode *pMnode, STrans *pTrans, STransActio
|
|||
mError("trans:%d, %s:%d not send since %s, %s", pTrans->id, mndTransStr(pAction->stage), pAction->id, terrstr(),
|
||||
detail);
|
||||
|
||||
pTrans->lastAction = pAction->id;
|
||||
pTrans->lastMsgType = pAction->msgType;
|
||||
pTrans->lastEpset = pAction->epSet;
|
||||
pTrans->lastErrorNo = pAction->errCode;
|
||||
mndSetTransLastAction(pTrans, pAction);
|
||||
}
|
||||
|
||||
return code;
|
||||
|
@ -1112,10 +1122,7 @@ static int32_t mndTransExecNullMsg(SMnode *pMnode, STrans *pTrans, STransAction
|
|||
pAction->errCode = 0;
|
||||
mInfo("trans:%d, %s:%d confirm action executed", pTrans->id, mndTransStr(pAction->stage), pAction->id);
|
||||
|
||||
pTrans->lastAction = pAction->id;
|
||||
pTrans->lastMsgType = pAction->msgType;
|
||||
pTrans->lastEpset = pAction->epSet;
|
||||
pTrans->lastErrorNo = 0;
|
||||
mndSetTransLastAction(pTrans, pAction);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1161,25 +1168,19 @@ static int32_t mndTransExecuteActions(SMnode *pMnode, STrans *pTrans, SArray *pA
|
|||
errCode = pAction->errCode;
|
||||
pErrAction = pAction;
|
||||
}
|
||||
} else {
|
||||
pErrAction = pAction;
|
||||
}
|
||||
}
|
||||
|
||||
mndSetTransLastAction(pTrans, pErrAction);
|
||||
|
||||
if (numOfExecuted == numOfActions) {
|
||||
if (errCode == 0) {
|
||||
pTrans->lastAction = 0;
|
||||
pTrans->lastMsgType = 0;
|
||||
memset(&pTrans->lastEpset, 0, sizeof(pTrans->lastEpset));
|
||||
pTrans->lastErrorNo = 0;
|
||||
mInfo("trans:%d, all %d actions execute successfully", pTrans->id, numOfActions);
|
||||
return 0;
|
||||
} else {
|
||||
mError("trans:%d, all %d actions executed, code:0x%x", pTrans->id, numOfActions, errCode & 0XFFFF);
|
||||
if (pErrAction != NULL) {
|
||||
pTrans->lastAction = pErrAction->id;
|
||||
pTrans->lastMsgType = pErrAction->msgType;
|
||||
pTrans->lastEpset = pErrAction->epSet;
|
||||
pTrans->lastErrorNo = pErrAction->errCode;
|
||||
}
|
||||
mndTransResetActions(pMnode, pTrans, pArray);
|
||||
terrno = errCode;
|
||||
return errCode;
|
||||
|
@ -1220,6 +1221,8 @@ static int32_t mndTransExecuteRedoActionsSerial(SMnode *pMnode, STrans *pTrans)
|
|||
if (numOfActions == 0) return code;
|
||||
if (pTrans->redoActionPos >= numOfActions) return code;
|
||||
|
||||
mInfo("trans:%d, execute %d actions serial", pTrans->id, numOfActions);
|
||||
|
||||
for (int32_t action = pTrans->redoActionPos; action < numOfActions; ++action) {
|
||||
STransAction *pAction = taosArrayGet(pTrans->redoActions, pTrans->redoActionPos);
|
||||
|
||||
|
@ -1248,16 +1251,8 @@ static int32_t mndTransExecuteRedoActionsSerial(SMnode *pMnode, STrans *pTrans)
|
|||
|
||||
if (code == 0) {
|
||||
pTrans->failedTimes = 0;
|
||||
pTrans->lastAction = action;
|
||||
pTrans->lastMsgType = 0;
|
||||
pTrans->lastErrorNo = 0;
|
||||
memset(&pTrans->lastEpset, 0, sizeof(pTrans->lastEpset));
|
||||
} else {
|
||||
pTrans->lastAction = action;
|
||||
pTrans->lastMsgType = pAction->msgType;
|
||||
pTrans->lastErrorNo = code;
|
||||
pTrans->lastEpset = pAction->epSet;
|
||||
}
|
||||
mndSetTransLastAction(pTrans, pAction);
|
||||
|
||||
if (mndCannotExecuteTransAction(pMnode)) break;
|
||||
|
||||
|
@ -1599,6 +1594,11 @@ static int32_t mndRetrieveTrans(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl
|
|||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char *)stage, false);
|
||||
|
||||
char opername[TSDB_TRANS_OPER_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(opername, pTrans->opername, pShow->pMeta->pSchemas[cols].bytes);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char *)opername, false);
|
||||
|
||||
char dbname[TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(dbname, mndGetDbStr(pTrans->dbname), pShow->pMeta->pSchemas[cols].bytes);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
|
|
|
@ -81,7 +81,7 @@ static int32_t mndCreateDefaultUser(SMnode *pMnode, char *acct, char *user, char
|
|||
|
||||
mDebug("user:%s, will be created when deploying, raw:%p", userObj.user, pRaw);
|
||||
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, NULL);
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, NULL, "create-user");
|
||||
if (pTrans == NULL) {
|
||||
mError("user:%s, failed to create since %s", userObj.user, terrstr());
|
||||
return -1;
|
||||
|
@ -299,7 +299,7 @@ static int32_t mndCreateUser(SMnode *pMnode, char *acct, SCreateUserReq *pCreate
|
|||
userObj.sysInfo = pCreate->sysInfo;
|
||||
userObj.enable = pCreate->enable;
|
||||
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq);
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "create-user");
|
||||
if (pTrans == NULL) {
|
||||
mError("user:%s, failed to create since %s", pCreate->user, terrstr());
|
||||
return -1;
|
||||
|
@ -383,7 +383,7 @@ _OVER:
|
|||
}
|
||||
|
||||
static int32_t mndAlterUser(SMnode *pMnode, SUserObj *pOld, SUserObj *pNew, SRpcMsg *pReq) {
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq);
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "alter-user");
|
||||
if (pTrans == NULL) {
|
||||
mError("user:%s, failed to alter since %s", pOld->user, terrstr());
|
||||
return -1;
|
||||
|
@ -598,7 +598,7 @@ _OVER:
|
|||
}
|
||||
|
||||
static int32_t mndDropUser(SMnode *pMnode, SRpcMsg *pReq, SUserObj *pUser) {
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq);
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "drop-user");
|
||||
if (pTrans == NULL) {
|
||||
mError("user:%s, failed to drop since %s", pUser->user, terrstr());
|
||||
return -1;
|
||||
|
|
|
@ -1223,7 +1223,7 @@ static int32_t mndRedistributeVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb,
|
|||
SSdbRaw *pRaw = NULL;
|
||||
STrans *pTrans = NULL;
|
||||
|
||||
pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq);
|
||||
pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq, "red-vgroup");
|
||||
if (pTrans == NULL) goto _OVER;
|
||||
mndTransSetSerial(pTrans);
|
||||
mDebug("trans:%d, used to redistribute vgroup, vgId:%d", pTrans->id, pVgroup->vgId);
|
||||
|
@ -1606,7 +1606,7 @@ static int32_t mndSplitVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SVgObj
|
|||
STrans *pTrans = NULL;
|
||||
SArray *pArray = mndBuildDnodesArray(pMnode, 0);
|
||||
|
||||
pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq);
|
||||
pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq, "split-vgroup");
|
||||
if (pTrans == NULL) goto _OVER;
|
||||
mndTransSetSerial(pTrans);
|
||||
mDebug("trans:%d, used to split vgroup, vgId:%d", pTrans->id, pVgroup->vgId);
|
||||
|
@ -1774,7 +1774,7 @@ static int32_t mndBalanceVgroup(SMnode *pMnode, SRpcMsg *pReq, SArray *pArray) {
|
|||
pBalancedVgroups = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK);
|
||||
if (pBalancedVgroups == NULL) goto _OVER;
|
||||
|
||||
pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq);
|
||||
pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq, "balance-vgroup");
|
||||
if (pTrans == NULL) goto _OVER;
|
||||
mndTransSetSerial(pTrans);
|
||||
mDebug("trans:%d, used to balance vgroup", pTrans->id);
|
||||
|
|
|
@ -115,7 +115,7 @@ class MndTestTrans2 : public ::testing::Test {
|
|||
userObj.superUser = 1;
|
||||
|
||||
SRpcMsg rpcMsg = {0};
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, conflict, &rpcMsg);
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, conflict, &rpcMsg, "");
|
||||
SSdbRaw *pRedoRaw = mndUserActionEncode(&userObj);
|
||||
mndTransAppendRedolog(pTrans, pRedoRaw);
|
||||
sdbSetRawStatus(pRedoRaw, SDB_STATUS_READY);
|
||||
|
@ -148,7 +148,7 @@ class MndTestTrans2 : public ::testing::Test {
|
|||
userObj.superUser = 1;
|
||||
|
||||
SRpcMsg rpcMsg = {0};
|
||||
STrans *pTrans = mndTransCreate(pMnode, policy, conflict, &rpcMsg);
|
||||
STrans *pTrans = mndTransCreate(pMnode, policy, conflict, &rpcMsg, "");
|
||||
SSdbRaw *pRedoRaw = mndUserActionEncode(&userObj);
|
||||
mndTransAppendRedolog(pTrans, pRedoRaw);
|
||||
sdbSetRawStatus(pRedoRaw, SDB_STATUS_READY);
|
||||
|
@ -220,7 +220,7 @@ class MndTestTrans2 : public ::testing::Test {
|
|||
userObj.superUser = 1;
|
||||
|
||||
SRpcMsg rpcMsg = {0};
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, &rpcMsg);
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, &rpcMsg, "");
|
||||
SSdbRaw *pRedoRaw = mndUserActionEncode(&userObj);
|
||||
mndTransAppendRedolog(pTrans, pRedoRaw);
|
||||
sdbSetRawStatus(pRedoRaw, SDB_STATUS_READY);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue