Merge branch '3.0' into fix/td_19618
This commit is contained in:
commit
64f07523e2
|
@ -173,8 +173,8 @@ def pre_test_build_mac() {
|
||||||
'''
|
'''
|
||||||
sh '''
|
sh '''
|
||||||
cd ${WK}/debug
|
cd ${WK}/debug
|
||||||
cmake .. -DBUILD_TEST=true
|
cmake .. -DBUILD_TEST=true -DBUILD_HTTPS=false
|
||||||
make -j8
|
make -j10
|
||||||
'''
|
'''
|
||||||
sh '''
|
sh '''
|
||||||
date
|
date
|
||||||
|
@ -428,7 +428,7 @@ pipeline {
|
||||||
date
|
date
|
||||||
rm -rf ${WKC}/debug
|
rm -rf ${WKC}/debug
|
||||||
cd ${WKC}/tests/parallel_test
|
cd ${WKC}/tests/parallel_test
|
||||||
time ./container_build.sh -w ${WKDIR} -t 8 -e
|
time ./container_build.sh -w ${WKDIR} -t 10 -e
|
||||||
rm -f /tmp/cases.task
|
rm -f /tmp/cases.task
|
||||||
./collect_cases.sh -e
|
./collect_cases.sh -e
|
||||||
'''
|
'''
|
||||||
|
|
|
@ -100,6 +100,8 @@ IF (TD_WINDOWS)
|
||||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COMMON_FLAGS}")
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COMMON_FLAGS}")
|
||||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMMON_FLAGS}")
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMMON_FLAGS}")
|
||||||
|
|
||||||
|
SET(JEMALLOC_ENABLED OFF)
|
||||||
|
|
||||||
ELSE ()
|
ELSE ()
|
||||||
IF (${TD_DARWIN})
|
IF (${TD_DARWIN})
|
||||||
set(CMAKE_MACOSX_RPATH 0)
|
set(CMAKE_MACOSX_RPATH 0)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# taosadapter
|
# taosadapter
|
||||||
ExternalProject_Add(taosadapter
|
ExternalProject_Add(taosadapter
|
||||||
GIT_REPOSITORY https://github.com/taosdata/taosadapter.git
|
GIT_REPOSITORY https://github.com/taosdata/taosadapter.git
|
||||||
GIT_TAG cc43ef0
|
GIT_TAG a11131c
|
||||||
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter"
|
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter"
|
||||||
BINARY_DIR ""
|
BINARY_DIR ""
|
||||||
#BUILD_IN_SOURCE TRUE
|
#BUILD_IN_SOURCE TRUE
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# taos-tools
|
# taos-tools
|
||||||
ExternalProject_Add(taos-tools
|
ExternalProject_Add(taos-tools
|
||||||
GIT_REPOSITORY https://github.com/taosdata/taos-tools.git
|
GIT_REPOSITORY https://github.com/taosdata/taos-tools.git
|
||||||
GIT_TAG cc973e0
|
GIT_TAG 7321fbb
|
||||||
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools"
|
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools"
|
||||||
BINARY_DIR ""
|
BINARY_DIR ""
|
||||||
#BUILD_IN_SOURCE TRUE
|
#BUILD_IN_SOURCE TRUE
|
||||||
|
|
|
@ -270,7 +270,7 @@ if(${JEMALLOC_ENABLED})
|
||||||
PREFIX "jemalloc"
|
PREFIX "jemalloc"
|
||||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/jemalloc
|
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/jemalloc
|
||||||
BUILD_IN_SOURCE 1
|
BUILD_IN_SOURCE 1
|
||||||
CONFIGURE_COMMAND ./autogen.sh COMMAND ./configure --prefix=${CMAKE_BINARY_DIR}/build/ --disable-initial-exec-tls --with-malloc-conf='background_thread:true,metadata_thp:auto'
|
CONFIGURE_COMMAND ./autogen.sh COMMAND ./configure --prefix=${CMAKE_BINARY_DIR}/build/ --disable-initial-exec-tls
|
||||||
BUILD_COMMAND ${MAKE}
|
BUILD_COMMAND ${MAKE}
|
||||||
)
|
)
|
||||||
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/build/include)
|
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/build/include)
|
||||||
|
|
|
@ -40,25 +40,25 @@ ALTER ALL DNODES dnode_option
|
||||||
|
|
||||||
dnode_option: {
|
dnode_option: {
|
||||||
'resetLog'
|
'resetLog'
|
||||||
| 'balance' value
|
| 'balance' 'value'
|
||||||
| 'monitor' value
|
| 'monitor' 'value'
|
||||||
| 'debugFlag' value
|
| 'debugFlag' 'value'
|
||||||
| 'monDebugFlag' value
|
| 'monDebugFlag' 'value'
|
||||||
| 'vDebugFlag' value
|
| 'vDebugFlag' 'value'
|
||||||
| 'mDebugFlag' value
|
| 'mDebugFlag' 'value'
|
||||||
| 'cDebugFlag' value
|
| 'cDebugFlag' 'value'
|
||||||
| 'httpDebugFlag' value
|
| 'httpDebugFlag' 'value'
|
||||||
| 'qDebugflag' value
|
| 'qDebugflag' 'value'
|
||||||
| 'sdbDebugFlag' value
|
| 'sdbDebugFlag' 'value'
|
||||||
| 'uDebugFlag' value
|
| 'uDebugFlag' 'value'
|
||||||
| 'tsdbDebugFlag' value
|
| 'tsdbDebugFlag' 'value'
|
||||||
| 'sDebugflag' value
|
| 'sDebugflag' 'value'
|
||||||
| 'rpcDebugFlag' value
|
| 'rpcDebugFlag' 'value'
|
||||||
| 'dDebugFlag' value
|
| 'dDebugFlag' 'value'
|
||||||
| 'mqttDebugFlag' value
|
| 'mqttDebugFlag' 'value'
|
||||||
| 'wDebugFlag' value
|
| 'wDebugFlag' 'value'
|
||||||
| 'tmrDebugFlag' value
|
| 'tmrDebugFlag' 'value'
|
||||||
| 'cqDebugFlag' value
|
| 'cqDebugFlag' 'value'
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -127,11 +127,11 @@ ALTER LOCAL local_option
|
||||||
|
|
||||||
local_option: {
|
local_option: {
|
||||||
'resetLog'
|
'resetLog'
|
||||||
| 'rpcDebugFlag' value
|
| 'rpcDebugFlag' 'value'
|
||||||
| 'tmrDebugFlag' value
|
| 'tmrDebugFlag' 'value'
|
||||||
| 'cDebugFlag' value
|
| 'cDebugFlag' 'value'
|
||||||
| 'uDebugFlag' value
|
| 'uDebugFlag' 'value'
|
||||||
| 'debugFlag' value
|
| 'debugFlag' 'value'
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ The following return value results indicate that the verification passed.
|
||||||
## HTTP request URL format
|
## HTTP request URL format
|
||||||
|
|
||||||
```text
|
```text
|
||||||
http://<fqdn>:<port>/rest/sql/[db_name]
|
http://<fqdn>:<port>/rest/sql/[db_name][?tz=timezone]
|
||||||
```
|
```
|
||||||
|
|
||||||
Parameter Description:
|
Parameter Description:
|
||||||
|
@ -75,6 +75,7 @@ Parameter Description:
|
||||||
- fqnd: FQDN or IP address of any host in the cluster.
|
- fqnd: FQDN or IP address of any host in the cluster.
|
||||||
- port: httpPort configuration item in the configuration file, default is 6041.
|
- port: httpPort configuration item in the configuration file, default is 6041.
|
||||||
- db_name: Optional parameter that specifies the default database name for the executed SQL command.
|
- db_name: Optional parameter that specifies the default database name for the executed SQL command.
|
||||||
|
- tz: Optional parameter that specifies the timezone of the returned time, following the IANA Time Zone rules, e.g. `America/New_York`.
|
||||||
|
|
||||||
For example, `http://h1.taos.com:6041/rest/sql/test` is a URL to `h1.taos.com:6041` and sets the default database name to `test`.
|
For example, `http://h1.taos.com:6041/rest/sql/test` is a URL to `h1.taos.com:6041` and sets the default database name to `test`.
|
||||||
|
|
||||||
|
@ -97,13 +98,13 @@ The HTTP request's BODY is a complete SQL command, and the data table in the SQL
|
||||||
Use `curl` to initiate an HTTP request with a custom authentication method, with the following syntax.
|
Use `curl` to initiate an HTTP request with a custom authentication method, with the following syntax.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -L -H "Authorization: Basic <TOKEN>" -d "<SQL>" <ip>:<PORT>/rest/sql/[db_name]
|
curl -L -H "Authorization: Basic <TOKEN>" -d "<SQL>" <ip>:<PORT>/rest/sql/[db_name][?tz=timezone]
|
||||||
```
|
```
|
||||||
|
|
||||||
or
|
or
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -L -u username:password -d "<SQL>" <ip>:<PORT>/rest/sql/[db_name]
|
curl -L -u username:password -d "<SQL>" <ip>:<PORT>/rest/sql/[db_name][?tz=timezone]
|
||||||
```
|
```
|
||||||
|
|
||||||
where `TOKEN` is the string after Base64 encoding of `{username}:{password}`, e.g. `root:taosdata` is encoded as `cm9vdDp0YW9zZGF0YQ==`..
|
where `TOKEN` is the string after Base64 encoding of `{username}:{password}`, e.g. `root:taosdata` is encoded as `cm9vdDp0YW9zZGF0YQ==`..
|
||||||
|
|
|
@ -201,7 +201,7 @@ The configuration parameters in the URL are as follows:
|
||||||
- httpConnectTimeout: REST connection timeout in milliseconds, the default value is 5000 ms.
|
- httpConnectTimeout: REST connection timeout in milliseconds, the default value is 5000 ms.
|
||||||
- httpSocketTimeout: socket timeout in milliseconds, the default value is 5000 ms. It only takes effect when batchfetch is false.
|
- httpSocketTimeout: socket timeout in milliseconds, the default value is 5000 ms. It only takes effect when batchfetch is false.
|
||||||
- messageWaitTimeout: message transmission timeout in milliseconds, the default value is 3000 ms. It only takes effect when batchfetch is true.
|
- messageWaitTimeout: message transmission timeout in milliseconds, the default value is 3000 ms. It only takes effect when batchfetch is true.
|
||||||
- useSSL: connecting Securely Using SSL. true: using SSL conneciton, false: not using SSL connection.
|
- useSSL: connecting Securely Using SSL. true: using SSL connection, false: not using SSL connection.
|
||||||
|
|
||||||
**Note**: Some configuration items (e.g., locale, timezone) do not work in the REST connection.
|
**Note**: Some configuration items (e.g., locale, timezone) do not work in the REST connection.
|
||||||
|
|
||||||
|
@ -268,7 +268,7 @@ The configuration parameters in properties are as follows.
|
||||||
- TSDBDriver.HTTP_CONNECT_TIMEOUT: REST connection timeout in milliseconds, the default value is 5000 ms. It only takes effect when using JDBC REST connection.
|
- TSDBDriver.HTTP_CONNECT_TIMEOUT: REST connection timeout in milliseconds, the default value is 5000 ms. It only takes effect when using JDBC REST connection.
|
||||||
- TSDBDriver.HTTP_SOCKET_TIMEOUT: socket timeout in milliseconds, the default value is 5000 ms. It only takes effect when using JDBC REST connection and batchfetch is false.
|
- TSDBDriver.HTTP_SOCKET_TIMEOUT: socket timeout in milliseconds, the default value is 5000 ms. It only takes effect when using JDBC REST connection and batchfetch is false.
|
||||||
- TSDBDriver.PROPERTY_KEY_MESSAGE_WAIT_TIMEOUT: message transmission timeout in milliseconds, the default value is 3000 ms. It only takes effect when using JDBC REST connection and batchfetch is true.
|
- TSDBDriver.PROPERTY_KEY_MESSAGE_WAIT_TIMEOUT: message transmission timeout in milliseconds, the default value is 3000 ms. It only takes effect when using JDBC REST connection and batchfetch is true.
|
||||||
- TSDBDriver.PROPERTY_KEY_USE_SSL: connecting Securely Using SSL. true: using SSL conneciton, false: not using SSL connection. It only takes effect when using JDBC REST connection.
|
- TSDBDriver.PROPERTY_KEY_USE_SSL: connecting Securely Using SSL. true: using SSL connection, false: not using SSL connection. It only takes effect when using JDBC REST connection.
|
||||||
For JDBC native connections, you can specify other parameters, such as log level, SQL length, etc., by specifying URL and Properties. For more detailed configuration, please refer to [Client Configuration](/reference/config/#Client-Only).
|
For JDBC native connections, you can specify other parameters, such as log level, SQL length, etc., by specifying URL and Properties. For more detailed configuration, please refer to [Client Configuration](/reference/config/#Client-Only).
|
||||||
|
|
||||||
### Priority of configuration parameters
|
### Priority of configuration parameters
|
||||||
|
@ -824,7 +824,7 @@ Example usage is as follows.
|
||||||
//query or insert
|
//query or insert
|
||||||
// ...
|
// ...
|
||||||
|
|
||||||
connection.close(); // put back to conneciton pool
|
connection.close(); // put back to connection pool
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -856,7 +856,7 @@ public static void main(String[] args) throws Exception {
|
||||||
//query or insert
|
//query or insert
|
||||||
// ...
|
// ...
|
||||||
|
|
||||||
connection.close(); // put back to conneciton pool
|
connection.close(); // put back to connection pool
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -878,7 +878,9 @@ The source code of the sample application is under `TDengine/examples/JDBC`:
|
||||||
|
|
||||||
| taos-jdbcdriver version | major changes |
|
| taos-jdbcdriver version | major changes |
|
||||||
| :---------------------: | :--------------------------------------------: |
|
| :---------------------: | :--------------------------------------------: |
|
||||||
|
| 3.0.1 - 3.0.2 | fix the resultSet data is parsed incorrectly sometimes. 3.0.1 is compiled on JDK 11, you are advised to use 3.0.2 in the JDK 8 environment |
|
||||||
| 3.0.0 | Support for TDengine 3.0 |
|
| 3.0.0 | Support for TDengine 3.0 |
|
||||||
|
| 2.0.41 | fix decode method of username and password in REST connection |
|
||||||
| 2.0.39 - 2.0.40 | Add REST connection/request timeout parameters |
|
| 2.0.39 - 2.0.40 | Add REST connection/request timeout parameters |
|
||||||
| 2.0.38 | JDBC REST connections add bulk pull function |
|
| 2.0.38 | JDBC REST connections add bulk pull function |
|
||||||
| 2.0.37 | Support json tags |
|
| 2.0.37 | Support json tags |
|
||||||
|
@ -910,6 +912,12 @@ The source code of the sample application is under `TDengine/examples/JDBC`:
|
||||||
|
|
||||||
**Solution**: Use taos-jdbcdriver 2.* with your TDengine 2.* deployment.
|
**Solution**: Use taos-jdbcdriver 2.* with your TDengine 2.* deployment.
|
||||||
|
|
||||||
|
5. java.lang.NoSuchMethodError: java.nio.ByteBuffer.position(I)Ljava/nio/ByteBuffer; ... taos-jdbcdriver-3.0.1.jar
|
||||||
|
|
||||||
|
**Cause**:taos-jdbcdriver 3.0.1 is compiled on JDK 11.
|
||||||
|
|
||||||
|
**Solution**: Use taos-jdbcdriver 3.0.2.
|
||||||
|
|
||||||
For additional troubleshooting, see [FAQ](../../../train-faq/faq).
|
For additional troubleshooting, see [FAQ](../../../train-faq/faq).
|
||||||
|
|
||||||
## API Reference
|
## API Reference
|
||||||
|
|
|
@ -353,7 +353,7 @@ The `af` package encapsulates TDengine advanced functions such as connection man
|
||||||
|
|
||||||
Closes the connection.
|
Closes the connection.
|
||||||
|
|
||||||
#### Subscribe to
|
#### Subscribe
|
||||||
|
|
||||||
* `func NewConsumer(conf *Config) (*Consumer, error)`
|
* `func NewConsumer(conf *Config) (*Consumer, error)`
|
||||||
|
|
||||||
|
@ -387,7 +387,7 @@ Close consumer.
|
||||||
|
|
||||||
* `func (conn *Connector) InfluxDBInsertLines(lines []string, precision string) error`
|
* `func (conn *Connector) InfluxDBInsertLines(lines []string, precision string) error`
|
||||||
|
|
||||||
Write to influxDB line protocol.
|
Write to InfluxDB line protocol.
|
||||||
|
|
||||||
* `func (conn *Connector) OpenTSDBInsertTelnetLines(lines []string) error`
|
* `func (conn *Connector) OpenTSDBInsertTelnetLines(lines []string) error`
|
||||||
|
|
||||||
|
@ -413,7 +413,7 @@ Close consumer.
|
||||||
|
|
||||||
* `func (stmt *InsertStmt) SetTableName(name string) error`
|
* `func (stmt *InsertStmt) SetTableName(name string) error`
|
||||||
|
|
||||||
Bind the set table name parameter.
|
Bind the table name parameter.
|
||||||
|
|
||||||
* `func (stmt *InsertStmt) SetSubTableName(name string) error`
|
* `func (stmt *InsertStmt) SetSubTableName(name string) error`
|
||||||
|
|
||||||
|
@ -463,6 +463,54 @@ Close consumer.
|
||||||
|
|
||||||
For a complete example see [GitHub sample file](https://github.com/taosdata/driver-go/blob/3.0/examples/tmqoverws/main.go)
|
For a complete example see [GitHub sample file](https://github.com/taosdata/driver-go/blob/3.0/examples/tmqoverws/main.go)
|
||||||
|
|
||||||
|
### parameter binding via WebSocket
|
||||||
|
|
||||||
|
* `func NewConnector(config *Config) (*Connector, error)`
|
||||||
|
|
||||||
|
Create a connection.
|
||||||
|
|
||||||
|
* `func (c *Connector) Init() (*Stmt, error)`
|
||||||
|
|
||||||
|
Initialize the parameters.
|
||||||
|
|
||||||
|
* `func (c *Connector) Close() error`
|
||||||
|
|
||||||
|
Close the connection.
|
||||||
|
|
||||||
|
* `func (s *Stmt) Prepare(sql string) error`
|
||||||
|
|
||||||
|
Parameter binding preprocessing SQL statement.
|
||||||
|
|
||||||
|
* `func (s *Stmt) SetTableName(name string) error`
|
||||||
|
|
||||||
|
Bind the table name parameter.
|
||||||
|
|
||||||
|
* `func (s *Stmt) SetTags(tags *param.Param, bindType *param.ColumnType) error`
|
||||||
|
|
||||||
|
Set tags.
|
||||||
|
|
||||||
|
* `func (s *Stmt) BindParam(params []*param.Param, bindType *param.ColumnType) error`
|
||||||
|
|
||||||
|
Parameter bind multiple rows of data.
|
||||||
|
|
||||||
|
* `func (s *Stmt) AddBatch() error`
|
||||||
|
|
||||||
|
Add to a parameter-bound batch.
|
||||||
|
|
||||||
|
* `func (s *Stmt) Exec() error`
|
||||||
|
|
||||||
|
Execute a parameter binding.
|
||||||
|
|
||||||
|
* `func (s *Stmt) GetAffectedRows() int`
|
||||||
|
|
||||||
|
Gets the number of affected rows inserted by the parameter binding.
|
||||||
|
|
||||||
|
* `func (s *Stmt) Close() error`
|
||||||
|
|
||||||
|
Closes the parameter binding.
|
||||||
|
|
||||||
|
For a complete example see [GitHub sample file](https://github.com/taosdata/driver-go/blob/3.0/examples/stmtoverws/main.go)
|
||||||
|
|
||||||
## API Reference
|
## API Reference
|
||||||
|
|
||||||
Full API see [driver-go documentation](https://pkg.go.dev/github.com/taosdata/driver-go/v3)
|
Full API see [driver-go documentation](https://pkg.go.dev/github.com/taosdata/driver-go/v3)
|
||||||
|
|
|
@ -106,11 +106,11 @@ ALTER LOCAL local_option
|
||||||
|
|
||||||
local_option: {
|
local_option: {
|
||||||
'resetLog'
|
'resetLog'
|
||||||
| 'rpcDebugFlag' value
|
| 'rpcDebugFlag' 'value'
|
||||||
| 'tmrDebugFlag' value
|
| 'tmrDebugFlag' 'value'
|
||||||
| 'cDebugFlag' value
|
| 'cDebugFlag' 'value'
|
||||||
| 'uDebugFlag' value
|
| 'uDebugFlag' 'value'
|
||||||
| 'debugFlag' value
|
| 'debugFlag' 'value'
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
---
|
||||||
|
title: Releases
|
||||||
|
---
|
||||||
|
|
||||||
|
```mdx-code-block
|
||||||
|
import DocCardList from '@theme/DocCardList';
|
||||||
|
import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
|
||||||
|
|
||||||
|
<DocCardList items={useCurrentSidebarCategory().items}/>
|
||||||
|
```
|
|
@ -36,10 +36,10 @@ int main() {
|
||||||
executeSQL(taos, "CREATE DATABASE power");
|
executeSQL(taos, "CREATE DATABASE power");
|
||||||
executeSQL(taos, "USE power");
|
executeSQL(taos, "USE power");
|
||||||
executeSQL(taos, "CREATE STABLE meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (location BINARY(64), groupId INT)");
|
executeSQL(taos, "CREATE STABLE meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (location BINARY(64), groupId INT)");
|
||||||
executeSQL(taos, "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)"
|
executeSQL(taos, "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 meters TAGS(California.SanFrancisco, 3) VALUES ('2018-10-03 14:38:16.650', 10.30000, 218, 0.25000)"
|
"d1002 USING meters TAGS('California.SanFrancisco', 3) VALUES ('2018-10-03 14:38:16.650', 10.30000, 218, 0.25000)"
|
||||||
"d1003 USING 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)"
|
"d1003 USING 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 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)");
|
"d1004 USING 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)");
|
||||||
taos_close(taos);
|
taos_close(taos);
|
||||||
taos_cleanup();
|
taos_cleanup();
|
||||||
}
|
}
|
||||||
|
@ -48,4 +48,4 @@ int main() {
|
||||||
// affected rows 0
|
// affected rows 0
|
||||||
// affected rows 0
|
// affected rows 0
|
||||||
// affected rows 0
|
// affected rows 0
|
||||||
// affected rows 8
|
// affected rows 8
|
||||||
|
|
|
@ -69,7 +69,7 @@ curl -L -H "Authorization: Basic cm9vdDp0YW9zZGF0YQ==" \
|
||||||
## HTTP 请求格式
|
## HTTP 请求格式
|
||||||
|
|
||||||
```text
|
```text
|
||||||
http://<fqdn>:<port>/rest/sql/[db_name]
|
http://<fqdn>:<port>/rest/sql/[db_name][?tz=timezone]
|
||||||
```
|
```
|
||||||
|
|
||||||
参数说明:
|
参数说明:
|
||||||
|
@ -77,6 +77,7 @@ http://<fqdn>:<port>/rest/sql/[db_name]
|
||||||
- fqdn: 集群中的任一台主机 FQDN 或 IP 地址。
|
- fqdn: 集群中的任一台主机 FQDN 或 IP 地址。
|
||||||
- port: 配置文件中 httpPort 配置项,缺省为 6041。
|
- port: 配置文件中 httpPort 配置项,缺省为 6041。
|
||||||
- db_name: 可选参数,指定本次所执行的 SQL 语句的默认数据库库名。
|
- db_name: 可选参数,指定本次所执行的 SQL 语句的默认数据库库名。
|
||||||
|
- tz: 可选参数,指定返回时间的时区,遵照 IANA Time Zone 规则,如 `America/New_York`。
|
||||||
|
|
||||||
例如:`http://h1.taos.com:6041/rest/sql/test` 是指向地址为 `h1.taos.com:6041` 的 URL,并将默认使用的数据库库名设置为 `test`。
|
例如:`http://h1.taos.com:6041/rest/sql/test` 是指向地址为 `h1.taos.com:6041` 的 URL,并将默认使用的数据库库名设置为 `test`。
|
||||||
|
|
||||||
|
@ -99,13 +100,13 @@ HTTP 请求的 BODY 里就是一个完整的 SQL 语句,SQL 语句中的数据
|
||||||
使用 `curl` 通过自定义身份认证方式来发起一个 HTTP Request,语法如下:
|
使用 `curl` 通过自定义身份认证方式来发起一个 HTTP Request,语法如下:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -L -H "Authorization: Basic <TOKEN>" -d "<SQL>" <ip>:<PORT>/rest/sql/[db_name]
|
curl -L -H "Authorization: Basic <TOKEN>" -d "<SQL>" <ip>:<PORT>/rest/sql/[db_name][?tz=timezone]
|
||||||
```
|
```
|
||||||
|
|
||||||
或者,
|
或者,
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -L -u username:password -d "<SQL>" <ip>:<PORT>/rest/sql/[db_name]
|
curl -L -u username:password -d "<SQL>" <ip>:<PORT>/rest/sql/[db_name][?tz=timezone]
|
||||||
```
|
```
|
||||||
|
|
||||||
其中,`TOKEN` 为 `{username}:{password}` 经过 Base64 编码之后的字符串,例如 `root:taosdata` 编码后为 `cm9vdDp0YW9zZGF0YQ==`。
|
其中,`TOKEN` 为 `{username}:{password}` 经过 Base64 编码之后的字符串,例如 `root:taosdata` 编码后为 `cm9vdDp0YW9zZGF0YQ==`。
|
||||||
|
|
|
@ -68,38 +68,39 @@ TDengine 目前支持时间戳、数字、字符、布尔类型,与 Java 对
|
||||||
### 安装连接器
|
### 安装连接器
|
||||||
|
|
||||||
<Tabs defaultValue="maven">
|
<Tabs defaultValue="maven">
|
||||||
<TabItem value="maven" label="使用 Maven 安装">
|
<TabItem value="maven" label="使用 Maven 安装">
|
||||||
|
|
||||||
目前 taos-jdbcdriver 已经发布到 [Sonatype Repository](https://search.maven.org/artifact/com.taosdata.jdbc/taos-jdbcdriver) 仓库,且各大仓库都已同步。
|
目前 taos-jdbcdriver 已经发布到 [Sonatype Repository](https://search.maven.org/artifact/com.taosdata.jdbc/taos-jdbcdriver)
|
||||||
|
仓库,且各大仓库都已同步。
|
||||||
|
|
||||||
- [sonatype](https://search.maven.org/artifact/com.taosdata.jdbc/taos-jdbcdriver)
|
- [sonatype](https://search.maven.org/artifact/com.taosdata.jdbc/taos-jdbcdriver)
|
||||||
- [mvnrepository](https://mvnrepository.com/artifact/com.taosdata.jdbc/taos-jdbcdriver)
|
- [mvnrepository](https://mvnrepository.com/artifact/com.taosdata.jdbc/taos-jdbcdriver)
|
||||||
- [maven.aliyun](https://maven.aliyun.com/mvn/search)
|
- [maven.aliyun](https://maven.aliyun.com/mvn/search)
|
||||||
|
|
||||||
Maven 项目中,在 pom.xml 中添加以下依赖:
|
Maven 项目中,在 pom.xml 中添加以下依赖:
|
||||||
|
|
||||||
```xml-dtd
|
```xml-dtd
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.taosdata.jdbc</groupId>
|
<groupId>com.taosdata.jdbc</groupId>
|
||||||
<artifactId>taos-jdbcdriver</artifactId>
|
<artifactId>taos-jdbcdriver</artifactId>
|
||||||
<version>3.0.0</version>
|
<version>3.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
|
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem value="source" label="使用源码编译安装">
|
<TabItem value="source" label="使用源码编译安装">
|
||||||
|
|
||||||
可以通过下载 TDengine 的源码,自己编译最新版本的 Java connector
|
可以通过下载 TDengine 的源码,自己编译最新版本的 Java connector
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
git clone https://github.com/taosdata/taos-connector-jdbc.git
|
git clone https://github.com/taosdata/taos-connector-jdbc.git
|
||||||
cd taos-connector-jdbc
|
cd taos-connector-jdbc
|
||||||
mvn clean install -Dmaven.test.skip=true
|
mvn clean install -Dmaven.test.skip=true
|
||||||
```
|
```
|
||||||
|
|
||||||
编译后,在 target 目录下会产生 taos-jdbcdriver-3.0.*-dist.jar 的 jar 包,并自动将编译的 jar 文件放在本地的 Maven 仓库中。
|
编译后,在 target 目录下会产生 taos-jdbcdriver-3.0.*-dist.jar 的 jar 包,并自动将编译的 jar 文件放在本地的 Maven 仓库中。
|
||||||
|
|
||||||
</TabItem>
|
</TabItem>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
|
||||||
## 建立连接
|
## 建立连接
|
||||||
|
@ -110,116 +111,125 @@ TDengine 的 JDBC URL 规范格式为:
|
||||||
对于建立连接,原生连接与 REST 连接有细微不同。
|
对于建立连接,原生连接与 REST 连接有细微不同。
|
||||||
|
|
||||||
<Tabs defaultValue="rest">
|
<Tabs defaultValue="rest">
|
||||||
<TabItem value="native" label="原生连接">
|
<TabItem value="native" label="原生连接">
|
||||||
|
|
||||||
```java
|
```java
|
||||||
Class.forName("com.taosdata.jdbc.TSDBDriver");
|
Class.forName("com.taosdata.jdbc.TSDBDriver");
|
||||||
String jdbcUrl = "jdbc:TAOS://taosdemo.com:6030/test?user=root&password=taosdata";
|
String jdbcUrl = "jdbc:TAOS://taosdemo.com:6030/test?user=root&password=taosdata";
|
||||||
Connection conn = DriverManager.getConnection(jdbcUrl);
|
Connection conn = DriverManager.getConnection(jdbcUrl);
|
||||||
```
|
```
|
||||||
|
|
||||||
以上示例,使用了 JDBC 原生连接的 TSDBDriver,建立了到 hostname 为 taosdemo.com,端口为 6030(TDengine 的默认端口),数据库名为 test 的连接。这个 URL 中指定用户名(user)为 root,密码(password)为 taosdata。
|
以上示例,使用了 JDBC 原生连接的 TSDBDriver,建立了到 hostname 为 taosdemo.com,端口为 6030(TDengine 的默认端口),数据库名为 test 的连接。这个 URL
|
||||||
|
中指定用户名(user)为 root,密码(password)为 taosdata。
|
||||||
|
|
||||||
**注意**:使用 JDBC 原生连接,taos-jdbcdriver 需要依赖客户端驱动(Linux 下是 libtaos.so;Windows 下是 taos.dll;macOS 下是 libtaos.dylib)。
|
**注意**:使用 JDBC 原生连接,taos-jdbcdriver 需要依赖客户端驱动(Linux 下是 libtaos.so;Windows 下是 taos.dll;macOS 下是 libtaos.dylib)。
|
||||||
|
|
||||||
url 中的配置参数如下:
|
url 中的配置参数如下:
|
||||||
|
|
||||||
- user:登录 TDengine 用户名,默认值 'root'。
|
- user:登录 TDengine 用户名,默认值 'root'。
|
||||||
- password:用户登录密码,默认值 'taosdata'。
|
- password:用户登录密码,默认值 'taosdata'。
|
||||||
- cfgdir:客户端配置文件目录路径,Linux OS 上默认值 `/etc/taos`,Windows OS 上默认值 `C:/TDengine/cfg`。
|
- cfgdir:客户端配置文件目录路径,Linux OS 上默认值 `/etc/taos`,Windows OS 上默认值 `C:/TDengine/cfg`。
|
||||||
- charset:客户端使用的字符集,默认值为系统字符集。
|
- charset:客户端使用的字符集,默认值为系统字符集。
|
||||||
- locale:客户端语言环境,默认值系统当前 locale。
|
- locale:客户端语言环境,默认值系统当前 locale。
|
||||||
- timezone:客户端使用的时区,默认值为系统当前时区。
|
- timezone:客户端使用的时区,默认值为系统当前时区。
|
||||||
- batchfetch: true:在执行查询时批量拉取结果集;false:逐行拉取结果集。默认值为:true。开启批量拉取同时获取一批数据在查询数据量较大时批量拉取可以有效的提升查询性能。
|
- batchfetch: true:在执行查询时批量拉取结果集;false:逐行拉取结果集。默认值为:true。开启批量拉取同时获取一批数据在查询数据量较大时批量拉取可以有效的提升查询性能。
|
||||||
- batchErrorIgnore:true:在执行 Statement 的 executeBatch 时,如果中间有一条 SQL 执行失败将继续执行下面的 SQL。false:不再执行失败 SQL 后的任何语句。默认值为:false。
|
- batchErrorIgnore:true:在执行 Statement 的 executeBatch 时,如果中间有一条 SQL 执行失败将继续执行下面的 SQL。false:不再执行失败 SQL
|
||||||
|
后的任何语句。默认值为:false。
|
||||||
|
|
||||||
JDBC 原生连接的使用请参见[视频教程](https://www.taosdata.com/blog/2020/11/11/1955.html)。
|
JDBC 原生连接的使用请参见[视频教程](https://www.taosdata.com/blog/2020/11/11/1955.html)。
|
||||||
|
|
||||||
**使用 TDengine 客户端驱动配置文件建立连接 **
|
**使用 TDengine 客户端驱动配置文件建立连接 **
|
||||||
|
|
||||||
当使用 JDBC 原生连接连接 TDengine 集群时,可以使用 TDengine 客户端驱动配置文件,在配置文件中指定集群的 firstEp、secondEp 等参数。如下所示:
|
当使用 JDBC 原生连接连接 TDengine 集群时,可以使用 TDengine 客户端驱动配置文件,在配置文件中指定集群的 firstEp、secondEp 等参数。如下所示:
|
||||||
|
|
||||||
1. 在 Java 应用中不指定 hostname 和 port
|
1. 在 Java 应用中不指定 hostname 和 port
|
||||||
|
|
||||||
```java
|
```java
|
||||||
public Connection getConn() throws Exception{
|
public Connection getConn() throws Exception{
|
||||||
Class.forName("com.taosdata.jdbc.TSDBDriver");
|
Class.forName("com.taosdata.jdbc.TSDBDriver");
|
||||||
String jdbcUrl = "jdbc:TAOS://:/test?user=root&password=taosdata";
|
String jdbcUrl = "jdbc:TAOS://:/test?user=root&password=taosdata";
|
||||||
Properties connProps = new Properties();
|
Properties connProps = new Properties();
|
||||||
connProps.setProperty(TSDBDriver.PROPERTY_KEY_CHARSET, "UTF-8");
|
connProps.setProperty(TSDBDriver.PROPERTY_KEY_CHARSET, "UTF-8");
|
||||||
connProps.setProperty(TSDBDriver.PROPERTY_KEY_LOCALE, "en_US.UTF-8");
|
connProps.setProperty(TSDBDriver.PROPERTY_KEY_LOCALE, "en_US.UTF-8");
|
||||||
connProps.setProperty(TSDBDriver.PROPERTY_KEY_TIME_ZONE, "UTC-8");
|
connProps.setProperty(TSDBDriver.PROPERTY_KEY_TIME_ZONE, "UTC-8");
|
||||||
Connection conn = DriverManager.getConnection(jdbcUrl, connProps);
|
Connection conn = DriverManager.getConnection(jdbcUrl, connProps);
|
||||||
return conn;
|
return conn;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
2. 在配置文件中指定 firstEp 和 secondEp
|
2. 在配置文件中指定 firstEp 和 secondEp
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
# first fully qualified domain name (FQDN) for TDengine system
|
# first fully qualified domain name (FQDN) for TDengine system
|
||||||
firstEp cluster_node1:6030
|
firstEp cluster_node1:6030
|
||||||
|
|
||||||
# second fully qualified domain name (FQDN) for TDengine system, for cluster only
|
# second fully qualified domain name (FQDN) for TDengine system, for cluster only
|
||||||
secondEp cluster_node2:6030
|
secondEp cluster_node2:6030
|
||||||
|
|
||||||
# default system charset
|
# default system charset
|
||||||
# charset UTF-8
|
# charset UTF-8
|
||||||
|
|
||||||
# system locale
|
# system locale
|
||||||
# locale en_US.UTF-8
|
# locale en_US.UTF-8
|
||||||
```
|
```
|
||||||
|
|
||||||
以上示例,jdbc 会使用客户端的配置文件,建立到 hostname 为 cluster_node1、端口为 6030、数据库名为 test 的连接。当集群中 firstEp 节点失效时,JDBC 会尝试使用 secondEp 连接集群。
|
以上示例,jdbc 会使用客户端的配置文件,建立到 hostname 为 cluster_node1、端口为 6030、数据库名为 test 的连接。当集群中 firstEp 节点失效时,JDBC 会尝试使用 secondEp
|
||||||
|
连接集群。
|
||||||
|
|
||||||
TDengine 中,只要保证 firstEp 和 secondEp 中一个节点有效,就可以正常建立到集群的连接。
|
TDengine 中,只要保证 firstEp 和 secondEp 中一个节点有效,就可以正常建立到集群的连接。
|
||||||
|
|
||||||
> **注意**:这里的配置文件指的是调用 JDBC Connector 的应用程序所在机器上的配置文件,Linux OS 上默认值 /etc/taos/taos.cfg ,Windows OS 上默认值 C://TDengine/cfg/taos.cfg。
|
> **注意**:这里的配置文件指的是调用 JDBC Connector 的应用程序所在机器上的配置文件,Linux OS 上默认值 /etc/taos/taos.cfg ,Windows OS 上默认值
|
||||||
|
C://TDengine/cfg/taos.cfg。
|
||||||
|
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem value="rest" label="REST 连接">
|
<TabItem value="rest" label="REST 连接">
|
||||||
|
|
||||||
```java
|
```java
|
||||||
Class.forName("com.taosdata.jdbc.rs.RestfulDriver");
|
Class.forName("com.taosdata.jdbc.rs.RestfulDriver");
|
||||||
String jdbcUrl = "jdbc:TAOS-RS://taosdemo.com:6041/test?user=root&password=taosdata";
|
String jdbcUrl = "jdbc:TAOS-RS://taosdemo.com:6041/test?user=root&password=taosdata";
|
||||||
Connection conn = DriverManager.getConnection(jdbcUrl);
|
Connection conn = DriverManager.getConnection(jdbcUrl);
|
||||||
```
|
```
|
||||||
|
|
||||||
以上示例,使用了 JDBC REST 连接的 RestfulDriver,建立了到 hostname 为 taosdemo.com,端口为 6041,数据库名为 test 的连接。这个 URL 中指定用户名(user)为 root,密码(password)为 taosdata。
|
以上示例,使用了 JDBC REST 连接的 RestfulDriver,建立了到 hostname 为 taosdemo.com,端口为 6041,数据库名为 test 的连接。这个 URL 中指定用户名(user)为
|
||||||
|
root,密码(password)为 taosdata。
|
||||||
|
|
||||||
使用 JDBC REST 连接,不需要依赖客户端驱动。与 JDBC 原生连接相比,仅需要:
|
使用 JDBC REST 连接,不需要依赖客户端驱动。与 JDBC 原生连接相比,仅需要:
|
||||||
|
|
||||||
1. driverClass 指定为“com.taosdata.jdbc.rs.RestfulDriver”;
|
1. driverClass 指定为“com.taosdata.jdbc.rs.RestfulDriver”;
|
||||||
2. jdbcUrl 以“jdbc:TAOS-RS://”开头;
|
2. jdbcUrl 以“jdbc:TAOS-RS://”开头;
|
||||||
3. 使用 6041 作为连接端口。
|
3. 使用 6041 作为连接端口。
|
||||||
|
|
||||||
url 中的配置参数如下:
|
url 中的配置参数如下:
|
||||||
|
|
||||||
- user:登录 TDengine 用户名,默认值 'root'。
|
- user:登录 TDengine 用户名,默认值 'root'。
|
||||||
- password:用户登录密码,默认值 'taosdata'。
|
- password:用户登录密码,默认值 'taosdata'。
|
||||||
- batchfetch: true:在执行查询时批量拉取结果集;false:逐行拉取结果集。默认值为:false。逐行拉取结果集使用 HTTP 方式进行数据传输。JDBC REST 连接支持批量拉取数据功能。taos-jdbcdriver 与 TDengine 之间通过 WebSocket 连接进行数据传输。相较于 HTTP,WebSocket 可以使 JDBC REST 连接支持大数据量查询,并提升查询性能。
|
- batchfetch: true:在执行查询时批量拉取结果集;false:逐行拉取结果集。默认值为:false。逐行拉取结果集使用 HTTP 方式进行数据传输。JDBC REST
|
||||||
- charset: 当开启批量拉取数据时,指定解析字符串数据的字符集。
|
连接支持批量拉取数据功能。taos-jdbcdriver 与 TDengine 之间通过 WebSocket 连接进行数据传输。相较于 HTTP,WebSocket 可以使 JDBC REST 连接支持大数据量查询,并提升查询性能。
|
||||||
- batchErrorIgnore:true:在执行 Statement 的 executeBatch 时,如果中间有一条 SQL 执行失败,继续执行下面的 SQL 了。false:不再执行失败 SQL 后的任何语句。默认值为:false。
|
- charset: 当开启批量拉取数据时,指定解析字符串数据的字符集。
|
||||||
- httpConnectTimeout: 连接超时时间,单位 ms, 默认值为 5000。
|
- batchErrorIgnore:true:在执行 Statement 的 executeBatch 时,如果中间有一条 SQL 执行失败,继续执行下面的 SQL 了。false:不再执行失败 SQL
|
||||||
- httpSocketTimeout: socket 超时时间,单位 ms,默认值为 5000。仅在 batchfetch 设置为 false 时生效。
|
后的任何语句。默认值为:false。
|
||||||
- messageWaitTimeout: 消息超时时间, 单位 ms, 默认值为 3000。 仅在 batchfetch 设置为 true 时生效。
|
- httpConnectTimeout: 连接超时时间,单位 ms, 默认值为 5000。
|
||||||
- useSSL: 连接中是否使用 SSL。
|
- httpSocketTimeout: socket 超时时间,单位 ms,默认值为 5000。仅在 batchfetch 设置为 false 时生效。
|
||||||
|
- messageWaitTimeout: 消息超时时间, 单位 ms, 默认值为 3000。 仅在 batchfetch 设置为 true 时生效。
|
||||||
|
- useSSL: 连接中是否使用 SSL。
|
||||||
|
|
||||||
**注意**:部分配置项(比如:locale、timezone)在 REST 连接中不生效。
|
**注意**:部分配置项(比如:locale、timezone)在 REST 连接中不生效。
|
||||||
|
|
||||||
:::note
|
:::note
|
||||||
|
|
||||||
- 与原生连接方式不同,REST 接口是无状态的。在使用 JDBC REST 连接时,需要在 SQL 中指定表、超级表的数据库名称。例如:
|
- 与原生连接方式不同,REST 接口是无状态的。在使用 JDBC REST 连接时,需要在 SQL 中指定表、超级表的数据库名称。例如:
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
INSERT INTO test.t1 USING test.weather (ts, temperature) TAGS('California.SanFrancisco') VALUES(now, 24.6);
|
INSERT INTO test.t1 USING test.weather (ts, temperature) TAGS('California.SanFrancisco') VALUES(now, 24.6);
|
||||||
```
|
```
|
||||||
|
|
||||||
- 如果在 url 中指定了 dbname,那么,JDBC REST 连接会默认使用/rest/sql/dbname 作为 restful 请求的 url,在 SQL 中不需要指定 dbname。例如:url 为 jdbc:TAOS-RS://127.0.0.1:6041/test,那么,可以执行 sql:insert into t1 using weather(ts, temperature) tags('California.SanFrancisco') values(now, 24.6);
|
- 如果在 url 中指定了 dbname,那么,JDBC REST 连接会默认使用/rest/sql/dbname 作为 restful 请求的 url,在 SQL 中不需要指定 dbname。例如:url 为
|
||||||
|
jdbc:TAOS-RS://127.0.0.1:6041/test,那么,可以执行 sql:insert into t1 using weather(ts, temperature)
|
||||||
|
tags('California.SanFrancisco') values(now, 24.6);
|
||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
</TabItem>
|
</TabItem>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
|
||||||
### 指定 URL 和 Properties 获取连接
|
### 指定 URL 和 Properties 获取连接
|
||||||
|
@ -271,7 +281,7 @@ properties 中的配置参数如下:
|
||||||
- TSDBDriver.HTTP_SOCKET_TIMEOUT: socket 超时时间,单位 ms,默认值为 5000。仅在 REST 连接且 batchfetch 设置为 false 时生效。
|
- TSDBDriver.HTTP_SOCKET_TIMEOUT: socket 超时时间,单位 ms,默认值为 5000。仅在 REST 连接且 batchfetch 设置为 false 时生效。
|
||||||
- TSDBDriver.PROPERTY_KEY_MESSAGE_WAIT_TIMEOUT: 消息超时时间, 单位 ms, 默认值为 3000。 仅在 REST 连接且 batchfetch 设置为 true 时生效。
|
- TSDBDriver.PROPERTY_KEY_MESSAGE_WAIT_TIMEOUT: 消息超时时间, 单位 ms, 默认值为 3000。 仅在 REST 连接且 batchfetch 设置为 true 时生效。
|
||||||
- TSDBDriver.PROPERTY_KEY_USE_SSL: 连接中是否使用 SSL。仅在 REST 连接时生效。
|
- TSDBDriver.PROPERTY_KEY_USE_SSL: 连接中是否使用 SSL。仅在 REST 连接时生效。
|
||||||
此外对 JDBC 原生连接,通过指定 URL 和 Properties 还可以指定其他参数,比如日志级别、SQL 长度等。更多详细配置请参考[客户端配置](/reference/config/#仅客户端适用)。
|
此外对 JDBC 原生连接,通过指定 URL 和 Properties 还可以指定其他参数,比如日志级别、SQL 长度等。更多详细配置请参考[客户端配置](/reference/config/#仅客户端适用)。
|
||||||
|
|
||||||
### 配置参数的优先级
|
### 配置参数的优先级
|
||||||
|
|
||||||
|
@ -826,7 +836,7 @@ public abstract class ConsumerLoop {
|
||||||
//query or insert
|
//query or insert
|
||||||
// ...
|
// ...
|
||||||
|
|
||||||
connection.close(); // put back to conneciton pool
|
connection.close(); // put back to connection pool
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -858,7 +868,7 @@ public static void main(String[] args) throws Exception {
|
||||||
//query or insert
|
//query or insert
|
||||||
// ...
|
// ...
|
||||||
|
|
||||||
connection.close(); // put back to conneciton pool
|
connection.close(); // put back to connection pool
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -880,7 +890,9 @@ public static void main(String[] args) throws Exception {
|
||||||
|
|
||||||
| taos-jdbcdriver 版本 | 主要变化 |
|
| taos-jdbcdriver 版本 | 主要变化 |
|
||||||
| :------------------: | :----------------------------: |
|
| :------------------: | :----------------------------: |
|
||||||
|
| 3.0.1 - 3.0.2 | 修复一些情况下结果集数据解析错误的问题。3.0.1 在 JDK 11 环境编译,JDK 8 环境下建议使用 3.0.2 版本 |
|
||||||
| 3.0.0 | 支持 TDengine 3.0 |
|
| 3.0.0 | 支持 TDengine 3.0 |
|
||||||
|
| 2.0.41 | 修正 REST 连接中用户名和密码转码方式 |
|
||||||
| 2.0.39 - 2.0.40 | 增加 REST 连接/请求 超时设置 |
|
| 2.0.39 - 2.0.40 | 增加 REST 连接/请求 超时设置 |
|
||||||
| 2.0.38 | JDBC REST 连接增加批量拉取功能 |
|
| 2.0.38 | JDBC REST 连接增加批量拉取功能 |
|
||||||
| 2.0.37 | 增加对 json tag 支持 |
|
| 2.0.37 | 增加对 json tag 支持 |
|
||||||
|
@ -890,27 +902,33 @@ public static void main(String[] args) throws Exception {
|
||||||
|
|
||||||
1. 使用 Statement 的 `addBatch()` 和 `executeBatch()` 来执行“批量写入/更新”,为什么没有带来性能上的提升?
|
1. 使用 Statement 的 `addBatch()` 和 `executeBatch()` 来执行“批量写入/更新”,为什么没有带来性能上的提升?
|
||||||
|
|
||||||
**原因**:TDengine 的 JDBC 实现中,通过 `addBatch` 方法提交的 SQL 语句,会按照添加的顺序,依次执行,这种方式没有减少与服务端的交互次数,不会带来性能上的提升。
|
**原因**:TDengine 的 JDBC 实现中,通过 `addBatch` 方法提交的 SQL 语句,会按照添加的顺序,依次执行,这种方式没有减少与服务端的交互次数,不会带来性能上的提升。
|
||||||
|
|
||||||
**解决方法**:1. 在一条 insert 语句中拼接多个 values 值;2. 使用多线程的方式并发插入;3. 使用参数绑定的写入方式
|
**解决方法**:1. 在一条 insert 语句中拼接多个 values 值;2. 使用多线程的方式并发插入;3. 使用参数绑定的写入方式
|
||||||
|
|
||||||
2. java.lang.UnsatisfiedLinkError: no taos in java.library.path
|
2. java.lang.UnsatisfiedLinkError: no taos in java.library.path
|
||||||
|
|
||||||
**原因**:程序没有找到依赖的本地函数库 taos。
|
**原因**:程序没有找到依赖的本地函数库 taos。
|
||||||
|
|
||||||
**解决方法**:Windows 下可以将 C:\TDengine\driver\taos.dll 拷贝到 C:\Windows\System32\ 目录下,Linux 下将建立如下软链 `ln -s /usr/local/taos/driver/libtaos.so.x.x.x.x /usr/lib/libtaos.so` 即可,macOS 下需要建立软链 `ln -s /usr/local/lib/libtaos.dylib`。
|
**解决方法**:Windows 下可以将 C:\TDengine\driver\taos.dll 拷贝到 C:\Windows\System32\ 目录下,Linux 下将建立如下软链 `ln -s /usr/local/taos/driver/libtaos.so.x.x.x.x /usr/lib/libtaos.so` 即可,macOS 下需要建立软链 `ln -s /usr/local/lib/libtaos.dylib`。
|
||||||
|
|
||||||
3. java.lang.UnsatisfiedLinkError: taos.dll Can't load AMD 64 bit on a IA 32-bit platform
|
3. java.lang.UnsatisfiedLinkError: taos.dll Can't load AMD 64 bit on a IA 32-bit platform
|
||||||
|
|
||||||
**原因**:目前 TDengine 只支持 64 位 JDK。
|
**原因**:目前 TDengine 只支持 64 位 JDK。
|
||||||
|
|
||||||
**解决方法**:重新安装 64 位 JDK。
|
**解决方法**:重新安装 64 位 JDK。
|
||||||
|
|
||||||
4. java.lang.NoSuchMethodError: setByteArray
|
4. java.lang.NoSuchMethodError: setByteArray
|
||||||
|
|
||||||
**原因**:taos-jdbcdriver 3.* 版本仅支持 TDengine 3.0 及以上版本。
|
**原因**:taos-jdbcdriver 3.* 版本仅支持 TDengine 3.0 及以上版本。
|
||||||
|
|
||||||
**解决方法**: 使用 taos-jdbcdriver 2.* 版本连接 TDengine 2.* 版本。
|
**解决方法**: 使用 taos-jdbcdriver 2.* 版本连接 TDengine 2.* 版本。
|
||||||
|
|
||||||
|
5. java.lang.NoSuchMethodError: java.nio.ByteBuffer.position(I)Ljava/nio/ByteBuffer; ... taos-jdbcdriver-3.0.1.jar
|
||||||
|
|
||||||
|
**原因**:taos-jdbcdriver 3.0.1 版本需要在 JDK 11+ 环境使用。
|
||||||
|
|
||||||
|
**解决方法**: 更换 taos-jdbcdriver 3.0.2 版本。
|
||||||
|
|
||||||
其它问题请参考 [FAQ](../../../train-faq/faq)
|
其它问题请参考 [FAQ](../../../train-faq/faq)
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ title: TDengine Go Connector
|
||||||
import Tabs from '@theme/Tabs';
|
import Tabs from '@theme/Tabs';
|
||||||
import TabItem from '@theme/TabItem';
|
import TabItem from '@theme/TabItem';
|
||||||
|
|
||||||
import Preparition from "./_preparition.mdx"
|
import Preparation from "./_preparation.mdx"
|
||||||
import GoInsert from "../07-develop/03-insert-data/_go_sql.mdx"
|
import GoInsert from "../07-develop/03-insert-data/_go_sql.mdx"
|
||||||
import GoInfluxLine from "../07-develop/03-insert-data/_go_line.mdx"
|
import GoInfluxLine from "../07-develop/03-insert-data/_go_line.mdx"
|
||||||
import GoOpenTSDBTelnet from "../07-develop/03-insert-data/_go_opts_telnet.mdx"
|
import GoOpenTSDBTelnet from "../07-develop/03-insert-data/_go_opts_telnet.mdx"
|
||||||
|
@ -389,7 +389,7 @@ func main() {
|
||||||
|
|
||||||
* `func (conn *Connector) InfluxDBInsertLines(lines []string, precision string) error`
|
* `func (conn *Connector) InfluxDBInsertLines(lines []string, precision string) error`
|
||||||
|
|
||||||
写入 influxDB 行协议。
|
写入 InfluxDB 行协议。
|
||||||
|
|
||||||
* `func (conn *Connector) OpenTSDBInsertTelnetLines(lines []string) error`
|
* `func (conn *Connector) OpenTSDBInsertTelnetLines(lines []string) error`
|
||||||
|
|
||||||
|
@ -465,6 +465,54 @@ func main() {
|
||||||
|
|
||||||
完整订阅示例参见 [GitHub 示例文件](https://github.com/taosdata/driver-go/blob/3.0/examples/tmqoverws/main.go)
|
完整订阅示例参见 [GitHub 示例文件](https://github.com/taosdata/driver-go/blob/3.0/examples/tmqoverws/main.go)
|
||||||
|
|
||||||
|
### 通过 WebSocket 进行参数绑定
|
||||||
|
|
||||||
|
* `func NewConnector(config *Config) (*Connector, error)`
|
||||||
|
|
||||||
|
创建连接。
|
||||||
|
|
||||||
|
* `func (c *Connector) Init() (*Stmt, error)`
|
||||||
|
|
||||||
|
初始化参数。
|
||||||
|
|
||||||
|
* `func (c *Connector) Close() error`
|
||||||
|
|
||||||
|
关闭连接。
|
||||||
|
|
||||||
|
* `func (s *Stmt) Prepare(sql string) error`
|
||||||
|
|
||||||
|
参数绑定预处理 SQL 语句。
|
||||||
|
|
||||||
|
* `func (s *Stmt) SetTableName(name string) error`
|
||||||
|
|
||||||
|
参数绑定设置表名。
|
||||||
|
|
||||||
|
* `func (s *Stmt) SetTags(tags *param.Param, bindType *param.ColumnType) error`
|
||||||
|
|
||||||
|
参数绑定设置标签。
|
||||||
|
|
||||||
|
* `func (s *Stmt) BindParam(params []*param.Param, bindType *param.ColumnType) error`
|
||||||
|
|
||||||
|
参数绑定多行数据。
|
||||||
|
|
||||||
|
* `func (s *Stmt) AddBatch() error`
|
||||||
|
|
||||||
|
添加到参数绑定批处理。
|
||||||
|
|
||||||
|
* `func (s *Stmt) Exec() error`
|
||||||
|
|
||||||
|
执行参数绑定。
|
||||||
|
|
||||||
|
* `func (s *Stmt) GetAffectedRows() int`
|
||||||
|
|
||||||
|
获取参数绑定插入受影响行数。
|
||||||
|
|
||||||
|
* `func (s *Stmt) Close() error`
|
||||||
|
|
||||||
|
结束参数绑定。
|
||||||
|
|
||||||
|
完整参数绑定示例参见 [GitHub 示例文件](https://github.com/taosdata/driver-go/blob/3.0/examples/stmtoverws/main.go)
|
||||||
|
|
||||||
## API 参考
|
## API 参考
|
||||||
|
|
||||||
全部 API 见 [driver-go 文档](https://pkg.go.dev/github.com/taosdata/driver-go/v3)
|
全部 API 见 [driver-go 文档](https://pkg.go.dev/github.com/taosdata/driver-go/v3)
|
||||||
|
|
|
@ -7,7 +7,7 @@ title: TDengine Rust Connector
|
||||||
import Tabs from '@theme/Tabs';
|
import Tabs from '@theme/Tabs';
|
||||||
import TabItem from '@theme/TabItem';
|
import TabItem from '@theme/TabItem';
|
||||||
|
|
||||||
import Preparition from "./_preparition.mdx"
|
import Preparation from "./_preparation.mdx"
|
||||||
import RustInsert from "../07-develop/03-insert-data/_rust_sql.mdx"
|
import RustInsert from "../07-develop/03-insert-data/_rust_sql.mdx"
|
||||||
import RustBind from "../07-develop/03-insert-data/_rust_stmt.mdx"
|
import RustBind from "../07-develop/03-insert-data/_rust_stmt.mdx"
|
||||||
import RustQuery from "../07-develop/04-query-data/_rust.mdx"
|
import RustQuery from "../07-develop/04-query-data/_rust.mdx"
|
||||||
|
|
|
@ -7,7 +7,7 @@ title: TDengine Node.js Connector
|
||||||
import Tabs from "@theme/Tabs";
|
import Tabs from "@theme/Tabs";
|
||||||
import TabItem from "@theme/TabItem";
|
import TabItem from "@theme/TabItem";
|
||||||
|
|
||||||
import Preparition from "./_preparition.mdx";
|
import Preparation from "./_preparation.mdx";
|
||||||
import NodeInsert from "../07-develop/03-insert-data/_js_sql.mdx";
|
import NodeInsert from "../07-develop/03-insert-data/_js_sql.mdx";
|
||||||
import NodeInfluxLine from "../07-develop/03-insert-data/_js_line.mdx";
|
import NodeInfluxLine from "../07-develop/03-insert-data/_js_line.mdx";
|
||||||
import NodeOpenTSDBTelnet from "../07-develop/03-insert-data/_js_opts_telnet.mdx";
|
import NodeOpenTSDBTelnet from "../07-develop/03-insert-data/_js_opts_telnet.mdx";
|
||||||
|
@ -249,4 +249,4 @@ Node.js 连接器的使用参见[视频教程](https://www.taosdata.com/blog/202
|
||||||
|
|
||||||
## API 参考
|
## API 参考
|
||||||
|
|
||||||
[API 参考](https://docs.taosdata.com/api/td2.0-connector/)
|
[API 参考](https://docs.taosdata.com/api/td2.0-connector/)
|
||||||
|
|
|
@ -7,7 +7,7 @@ title: C# Connector
|
||||||
import Tabs from '@theme/Tabs';
|
import Tabs from '@theme/Tabs';
|
||||||
import TabItem from '@theme/TabItem';
|
import TabItem from '@theme/TabItem';
|
||||||
|
|
||||||
import Preparition from "./_preparition.mdx"
|
import Preparation from "./_preparation.mdx"
|
||||||
import CSInsert from "../07-develop/03-insert-data/_cs_sql.mdx"
|
import CSInsert from "../07-develop/03-insert-data/_cs_sql.mdx"
|
||||||
import CSInfluxLine from "../07-develop/03-insert-data/_cs_line.mdx"
|
import CSInfluxLine from "../07-develop/03-insert-data/_cs_line.mdx"
|
||||||
import CSOpenTSDBTelnet from "../07-develop/03-insert-data/_cs_opts_telnet.mdx"
|
import CSOpenTSDBTelnet from "../07-develop/03-insert-data/_cs_opts_telnet.mdx"
|
||||||
|
|
|
@ -41,25 +41,25 @@ ALTER ALL DNODES dnode_option
|
||||||
|
|
||||||
dnode_option: {
|
dnode_option: {
|
||||||
'resetLog'
|
'resetLog'
|
||||||
| 'balance' value
|
| 'balance' 'value'
|
||||||
| 'monitor' value
|
| 'monitor' 'value'
|
||||||
| 'debugFlag' value
|
| 'debugFlag' 'value'
|
||||||
| 'monDebugFlag' value
|
| 'monDebugFlag' 'value'
|
||||||
| 'vDebugFlag' value
|
| 'vDebugFlag' 'value'
|
||||||
| 'mDebugFlag' value
|
| 'mDebugFlag' 'value'
|
||||||
| 'cDebugFlag' value
|
| 'cDebugFlag' 'value'
|
||||||
| 'httpDebugFlag' value
|
| 'httpDebugFlag' 'value'
|
||||||
| 'qDebugflag' value
|
| 'qDebugflag' 'value'
|
||||||
| 'sdbDebugFlag' value
|
| 'sdbDebugFlag' 'value'
|
||||||
| 'uDebugFlag' value
|
| 'uDebugFlag' 'value'
|
||||||
| 'tsdbDebugFlag' value
|
| 'tsdbDebugFlag' 'value'
|
||||||
| 'sDebugflag' value
|
| 'sDebugflag' 'value'
|
||||||
| 'rpcDebugFlag' value
|
| 'rpcDebugFlag' 'value'
|
||||||
| 'dDebugFlag' value
|
| 'dDebugFlag' 'value'
|
||||||
| 'mqttDebugFlag' value
|
| 'mqttDebugFlag' 'value'
|
||||||
| 'wDebugFlag' value
|
| 'wDebugFlag' 'value'
|
||||||
| 'tmrDebugFlag' value
|
| 'tmrDebugFlag' 'value'
|
||||||
| 'cqDebugFlag' value
|
| 'cqDebugFlag' 'value'
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -128,11 +128,11 @@ ALTER LOCAL local_option
|
||||||
|
|
||||||
local_option: {
|
local_option: {
|
||||||
'resetLog'
|
'resetLog'
|
||||||
| 'rpcDebugFlag' value
|
| 'rpcDebugFlag' 'value'
|
||||||
| 'tmrDebugFlag' value
|
| 'tmrDebugFlag' 'value'
|
||||||
| 'cDebugFlag' value
|
| 'cDebugFlag' 'value'
|
||||||
| 'uDebugFlag' value
|
| 'uDebugFlag' 'value'
|
||||||
| 'debugFlag' value
|
| 'debugFlag' 'value'
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -201,7 +201,7 @@ SHOW TOPICS;
|
||||||
SHOW TRANSACTIONS;
|
SHOW TRANSACTIONS;
|
||||||
```
|
```
|
||||||
|
|
||||||
显示当前系统中正在执行的事务的信息
|
显示当前系统中正在执行的事务的信息(该事务仅针对除普通表以外的元数据级别)
|
||||||
|
|
||||||
## SHOW USERS
|
## SHOW USERS
|
||||||
|
|
||||||
|
|
|
@ -70,11 +70,11 @@ taos --dump-config
|
||||||
|
|
||||||
### serverPort
|
### serverPort
|
||||||
|
|
||||||
| 属性 | 说明 |
|
| 属性 | 说明 |
|
||||||
| -------- | ----------------------------------------------------------------------------------------------------------------------- |
|
| -------- | ------------------------------ |
|
||||||
| 适用范围 | 仅服务端适用 |
|
| 适用范围 | 仅服务端适用 |
|
||||||
| 含义 | taosd 启动后,对外服务的端口号 |
|
| 含义 | taosd 启动后,对外服务的端口号 |
|
||||||
| 缺省值 | 6030 |
|
| 缺省值 | 6030 |
|
||||||
|
|
||||||
:::note
|
:::note
|
||||||
确保集群中所有主机在端口 6030 上的 TCP 协议能够互通。(详细的端口情况请参见下表)
|
确保集群中所有主机在端口 6030 上的 TCP 协议能够互通。(详细的端口情况请参见下表)
|
||||||
|
@ -173,7 +173,6 @@ taos --dump-config
|
||||||
|
|
||||||
1: 表示使用 sma index,对符合的语句,直接从预计算的结果进行查询 |
|
1: 表示使用 sma index,对符合的语句,直接从预计算的结果进行查询 |
|
||||||
|
|
||||||
|
|
||||||
### maxNumOfDistinctRes
|
### maxNumOfDistinctRes
|
||||||
|
|
||||||
| 属性 | 说明 |
|
| 属性 | 说明 |
|
||||||
|
@ -625,7 +624,7 @@ charset 的有效值是 UTF-8。
|
||||||
| 适用范围 | 仅客户端适用 |
|
| 适用范围 | 仅客户端适用 |
|
||||||
| 含义 | schemaless tag 为空时默认的 tag 名字 |
|
| 含义 | schemaless tag 为空时默认的 tag 名字 |
|
||||||
| 类型 | 字符串 |
|
| 类型 | 字符串 |
|
||||||
| 缺省值 | _tag_null |
|
| 缺省值 | \_tag_null |
|
||||||
|
|
||||||
### smlDataFormat
|
### smlDataFormat
|
||||||
|
|
||||||
|
@ -658,173 +657,178 @@ charset 的有效值是 UTF-8。
|
||||||
| 缺省值 | 1 |
|
| 缺省值 | 1 |
|
||||||
|
|
||||||
## 2.X 与 3.0 配置参数对比
|
## 2.X 与 3.0 配置参数对比
|
||||||
| # | **参数** | **适用于 2.X 版本** | **适用于 3.0 版本** |
|
|
||||||
| --- | :-----------------: | --------------- | --------------- |
|
:::note
|
||||||
| 1 | firstEp | 是 | 是 |
|
对于 2.x 版本中适用但在 3.0 版本中废弃的参数,其当前行为会有特别说明
|
||||||
| 2 | secondEp | 是 | 是 |
|
|
||||||
| 3 | fqdn | 是 | 是 |
|
:::
|
||||||
| 4 | serverPort | 是 | 是 |
|
|
||||||
| 5 | maxShellConns | 是 | 是 |
|
| # | **参数** | **适用于 2.X ** | **适用于 3.0 ** | 3.0 版本的当前行为 |
|
||||||
| 6 | monitor | 是 | 是 |
|
| --- | :---------------------: | --------------- | --------------- | ------------------------------------------------- |
|
||||||
| 7 | monitorFqdn | 否 | 是 |
|
| 1 | firstEp | 是 | 是 | |
|
||||||
| 8 | monitorPort | 否 | 是 |
|
| 2 | secondEp | 是 | 是 | |
|
||||||
| 9 | monitorInterval | 是 | 是 |
|
| 3 | fqdn | 是 | 是 | |
|
||||||
| 10 | monitorMaxLogs | 否 | 是 |
|
| 4 | serverPort | 是 | 是 | |
|
||||||
| 11 | monitorComp | 否 | 是 |
|
| 5 | maxShellConns | 是 | 是 | |
|
||||||
| 12 | telemetryReporting | 是 | 是 |
|
| 6 | monitor | 是 | 是 | |
|
||||||
| 13 | telemetryInterval | 否 | 是 |
|
| 7 | monitorFqdn | 否 | 是 | |
|
||||||
| 14 | telemetryServer | 否 | 是 |
|
| 8 | monitorPort | 否 | 是 | |
|
||||||
| 15 | telemetryPort | 否 | 是 |
|
| 9 | monitorInterval | 是 | 是 | |
|
||||||
| 16 | queryPolicy | 否 | 是 |
|
| 10 | monitorMaxLogs | 否 | 是 | |
|
||||||
| 17 | querySmaOptimize | 否 | 是 |
|
| 11 | monitorComp | 否 | 是 | |
|
||||||
| 18 | queryRsmaTolerance | 否 | 是 |
|
| 12 | telemetryReporting | 是 | 是 | |
|
||||||
| 19 | queryBufferSize | 是 | 是 |
|
| 13 | telemetryInterval | 否 | 是 | |
|
||||||
| 20 | maxNumOfDistinctRes | 是 | 是 |
|
| 14 | telemetryServer | 否 | 是 | |
|
||||||
| 21 | minSlidingTime | 是 | 是 |
|
| 15 | telemetryPort | 否 | 是 | |
|
||||||
| 22 | minIntervalTime | 是 | 是 |
|
| 16 | queryPolicy | 否 | 是 | |
|
||||||
| 23 | countAlwaysReturnValue | 是 | 是 |
|
| 17 | querySmaOptimize | 否 | 是 | |
|
||||||
| 24 | dataDir | 是 | 是 |
|
| 18 | queryRsmaTolerance | 否 | 是 | |
|
||||||
| 25 | minimalDataDirGB | 是 | 是 |
|
| 19 | queryBufferSize | 是 | 是 | |
|
||||||
| 26 | supportVnodes | 否 | 是 |
|
| 20 | maxNumOfDistinctRes | 是 | 是 | |
|
||||||
| 27 | tempDir | 是 | 是 |
|
| 21 | minSlidingTime | 是 | 是 | |
|
||||||
| 28 | minimalTmpDirGB | 是 | 是 |
|
| 22 | minIntervalTime | 是 | 是 | |
|
||||||
| 29 | compressMsgSize | 是 | 是 |
|
| 23 | countAlwaysReturnValue | 是 | 是 | |
|
||||||
| 30 | compressColData | 是 | 是 |
|
| 24 | dataDir | 是 | 是 | |
|
||||||
| 31 | smlChildTableName | 是 | 是 |
|
| 25 | minimalDataDirGB | 是 | 是 | |
|
||||||
| 32 | smlTagName | 是 | 是 |
|
| 26 | supportVnodes | 否 | 是 | |
|
||||||
| 33 | smlDataFormat | 否 | 是 |
|
| 27 | tempDir | 是 | 是 | |
|
||||||
| 34 | statusInterval | 是 | 是 |
|
| 28 | minimalTmpDirGB | 是 | 是 | |
|
||||||
| 35 | shellActivityTimer | 是 | 是 |
|
| 29 | compressMsgSize | 是 | 是 | |
|
||||||
| 36 | transPullupInterval | 否 | 是 |
|
| 30 | compressColData | 是 | 是 | |
|
||||||
| 37 | mqRebalanceInterval | 否 | 是 |
|
| 31 | smlChildTableName | 是 | 是 | |
|
||||||
| 38 | ttlUnit | 否 | 是 |
|
| 32 | smlTagName | 是 | 是 | |
|
||||||
| 39 | ttlPushInterval | 否 | 是 |
|
| 33 | smlDataFormat | 否 | 是 | |
|
||||||
| 40 | numOfTaskQueueThreads | 否 | 是 |
|
| 34 | statusInterval | 是 | 是 | |
|
||||||
| 41 | numOfRpcThreads | 否 | 是 |
|
| 35 | shellActivityTimer | 是 | 是 | |
|
||||||
| 42 | numOfCommitThreads | 是 | 是 |
|
| 36 | transPullupInterval | 否 | 是 | |
|
||||||
| 43 | numOfMnodeReadThreads | 否 | 是 |
|
| 37 | mqRebalanceInterval | 否 | 是 | |
|
||||||
| 44 | numOfVnodeQueryThreads | 否 | 是 |
|
| 38 | ttlUnit | 否 | 是 | |
|
||||||
| 45 | numOfVnodeStreamThreads | 否 | 是 |
|
| 39 | ttlPushInterval | 否 | 是 | |
|
||||||
| 46 | numOfVnodeFetchThreads | 否 | 是 |
|
| 40 | numOfTaskQueueThreads | 否 | 是 | |
|
||||||
| 47 | numOfVnodeWriteThreads | 否 | 是 |
|
| 41 | numOfRpcThreads | 否 | 是 | |
|
||||||
| 48 | numOfVnodeSyncThreads | 否 | 是 |
|
| 42 | numOfCommitThreads | 是 | 是 | |
|
||||||
| 49 | numOfVnodeRsmaThreads | 否 | 是 |
|
| 43 | numOfMnodeReadThreads | 否 | 是 | |
|
||||||
| 50 | numOfQnodeQueryThreads | 否 | 是 |
|
| 44 | numOfVnodeQueryThreads | 否 | 是 | |
|
||||||
| 51 | numOfQnodeFetchThreads | 否 | 是 |
|
| 45 | numOfVnodeStreamThreads | 否 | 是 | |
|
||||||
| 52 | numOfSnodeSharedThreads | 否 | 是 |
|
| 46 | numOfVnodeFetchThreads | 否 | 是 | |
|
||||||
| 53 | numOfSnodeUniqueThreads | 否 | 是 |
|
| 47 | numOfVnodeWriteThreads | 否 | 是 | |
|
||||||
| 54 | rpcQueueMemoryAllowed | 否 | 是 |
|
| 48 | numOfVnodeSyncThreads | 否 | 是 | |
|
||||||
| 55 | logDir | 是 | 是 |
|
| 49 | numOfVnodeRsmaThreads | 否 | 是 | |
|
||||||
| 56 | minimalLogDirGB | 是 | 是 |
|
| 50 | numOfQnodeQueryThreads | 否 | 是 | |
|
||||||
| 57 | numOfLogLines | 是 | 是 |
|
| 51 | numOfQnodeFetchThreads | 否 | 是 | |
|
||||||
| 58 | asyncLog | 是 | 是 |
|
| 52 | numOfSnodeSharedThreads | 否 | 是 | |
|
||||||
| 59 | logKeepDays | 是 | 是 |
|
| 53 | numOfSnodeUniqueThreads | 否 | 是 | |
|
||||||
| 60 | debugFlag | 是 | 是 |
|
| 54 | rpcQueueMemoryAllowed | 否 | 是 | |
|
||||||
| 61 | tmrDebugFlag | 是 | 是 |
|
| 55 | logDir | 是 | 是 | |
|
||||||
| 62 | uDebugFlag | 是 | 是 |
|
| 56 | minimalLogDirGB | 是 | 是 | |
|
||||||
| 63 | rpcDebugFlag | 是 | 是 |
|
| 57 | numOfLogLines | 是 | 是 | |
|
||||||
| 64 | jniDebugFlag | 是 | 是 |
|
| 58 | asyncLog | 是 | 是 | |
|
||||||
| 65 | qDebugFlag | 是 | 是 |
|
| 59 | logKeepDays | 是 | 是 | |
|
||||||
| 66 | cDebugFlag | 是 | 是 |
|
| 60 | debugFlag | 是 | 是 | |
|
||||||
| 67 | dDebugFlag | 是 | 是 |
|
| 61 | tmrDebugFlag | 是 | 是 | |
|
||||||
| 68 | vDebugFlag | 是 | 是 |
|
| 62 | uDebugFlag | 是 | 是 | |
|
||||||
| 69 | mDebugFlag | 是 | 是 |
|
| 63 | rpcDebugFlag | 是 | 是 | |
|
||||||
| 70 | wDebugFlag | 是 | 是 |
|
| 64 | jniDebugFlag | 是 | 是 | |
|
||||||
| 71 | sDebugFlag | 是 | 是 |
|
| 65 | qDebugFlag | 是 | 是 | |
|
||||||
| 72 | tsdbDebugFlag | 是 | 是 |
|
| 66 | cDebugFlag | 是 | 是 | |
|
||||||
| 73 | tqDebugFlag | 否 | 是 |
|
| 67 | dDebugFlag | 是 | 是 | |
|
||||||
| 74 | fsDebugFlag | 是 | 是 |
|
| 68 | vDebugFlag | 是 | 是 | |
|
||||||
| 75 | udfDebugFlag | 否 | 是 |
|
| 69 | mDebugFlag | 是 | 是 | |
|
||||||
| 76 | smaDebugFlag | 否 | 是 |
|
| 70 | wDebugFlag | 是 | 是 | |
|
||||||
| 77 | idxDebugFlag | 否 | 是 |
|
| 71 | sDebugFlag | 是 | 是 | |
|
||||||
| 78 | tdbDebugFlag | 否 | 是 |
|
| 72 | tsdbDebugFlag | 是 | 是 | |
|
||||||
| 79 | metaDebugFlag | 否 | 是 |
|
| 73 | tqDebugFlag | 否 | 是 | |
|
||||||
| 80 | timezone | 是 | 是 |
|
| 74 | fsDebugFlag | 是 | 是 | |
|
||||||
| 81 | locale | 是 | 是 |
|
| 75 | udfDebugFlag | 否 | 是 | |
|
||||||
| 82 | charset | 是 | 是 |
|
| 76 | smaDebugFlag | 否 | 是 | |
|
||||||
| 83 | udf | 是 | 是 |
|
| 77 | idxDebugFlag | 否 | 是 | |
|
||||||
| 84 | enableCoreFile | 是 | 是 |
|
| 78 | tdbDebugFlag | 否 | 是 | |
|
||||||
| 85 | arbitrator | 是 | 否 |
|
| 79 | metaDebugFlag | 否 | 是 | |
|
||||||
| 86 | numOfThreadsPerCore | 是 | 否 |
|
| 80 | timezone | 是 | 是 | |
|
||||||
| 87 | numOfMnodes | 是 | 否 |
|
| 81 | locale | 是 | 是 | |
|
||||||
| 88 | vnodeBak | 是 | 否 |
|
| 82 | charset | 是 | 是 | |
|
||||||
| 89 | balance | 是 | 否 |
|
| 83 | udf | 是 | 是 | |
|
||||||
| 90 | balanceInterval | 是 | 否 |
|
| 84 | enableCoreFile | 是 | 是 | |
|
||||||
| 91 | offlineThreshold | 是 | 否 |
|
| 85 | arbitrator | 是 | 否 | 通过 RAFT 协议选主 |
|
||||||
| 92 | role | 是 | 否 |
|
| 86 | numOfThreadsPerCore | 是 | 否 | 有其它参数设置多种线程池的大小 |
|
||||||
| 93 | dnodeNopLoop | 是 | 否 |
|
| 87 | numOfMnodes | 是 | 否 | 通过 create mnode 命令动态创建 mnode |
|
||||||
| 94 | keepTimeOffset | 是 | 否 |
|
| 88 | vnodeBak | 是 | 否 | 3.0 行为未知 |
|
||||||
| 95 | rpcTimer | 是 | 否 |
|
| 89 | balance | 是 | 否 | 负载均衡功能由 split/merge vgroups 实现 |
|
||||||
| 96 | rpcMaxTime | 是 | 否 |
|
| 90 | balanceInterval | 是 | 否 | 随着 balance 参数失效 |
|
||||||
| 97 | rpcForceTcp | 是 | 否 |
|
| 91 | offlineThreshold | 是 | 否 | 3.0 行为未知 |
|
||||||
| 98 | tcpConnTimeout | 是 | 否 |
|
| 92 | role | 是 | 否 | 由 supportVnode 决定是否能够创建 |
|
||||||
| 99 | syncCheckInterval | 是 | 否 |
|
| 93 | dnodeNopLoop | 是 | 否 | 2.6 文档中未找到此参数 |
|
||||||
| 100 | maxTmrCtrl | 是 | 否 |
|
| 94 | keepTimeOffset | 是 | 否 | 2.6 文档中未找到此参数 |
|
||||||
| 101 | monitorReplica | 是 | 否 |
|
| 95 | rpcTimer | 是 | 否 | 3.0 行为未知 |
|
||||||
| 102 | smlTagNullName | 是 | 否 |
|
| 96 | rpcMaxTime | 是 | 否 | 3.0 行为未知 |
|
||||||
| 103 | keepColumnName | 是 | 否 |
|
| 97 | rpcForceTcp | 是 | 否 | 默认为 TCP |
|
||||||
| 104 | ratioOfQueryCores | 是 | 否 |
|
| 98 | tcpConnTimeout | 是 | 否 | 3.0 行为未知 |
|
||||||
| 105 | maxStreamCompDelay | 是 | 否 |
|
| 99 | syncCheckInterval | 是 | 否 | 3.0 行为未知 |
|
||||||
| 106 | maxFirstStreamCompDelay | 是 | 否 |
|
| 100 | maxTmrCtrl | 是 | 否 | 3.0 行为未知 |
|
||||||
| 107 | retryStreamCompDelay | 是 | 否 |
|
| 101 | monitorReplica | 是 | 否 | 由 RAFT 协议管理多副本 |
|
||||||
| 108 | streamCompDelayRatio | 是 | 否 |
|
| 102 | smlTagNullName | 是 | 否 | 3.0 行为未知 |
|
||||||
| 109 | maxVgroupsPerDb | 是 | 否 |
|
| 103 | keepColumnName | 是 | 否 | 3.0 行为未知 |
|
||||||
| 110 | maxTablesPerVnode | 是 | 否 |
|
| 104 | ratioOfQueryCores | 是 | 否 | 由 线程池 相关配置参数决定 |
|
||||||
| 111 | minTablesPerVnode | 是 | 否 |
|
| 105 | maxStreamCompDelay | 是 | 否 | 3.0 行为未知 |
|
||||||
| 112 | tableIncStepPerVnode | 是 | 否 |
|
| 106 | maxFirstStreamCompDelay | 是 | 否 | 3.0 行为未知 |
|
||||||
| 113 | cache | 是 | 否 |
|
| 107 | retryStreamCompDelay | 是 | 否 | 3.0 行为未知 |
|
||||||
| 114 | blocks | 是 | 否 |
|
| 108 | streamCompDelayRatio | 是 | 否 | 3.0 行为未知 |
|
||||||
| 115 | days | 是 | 否 |
|
| 109 | maxVgroupsPerDb | 是 | 否 | 由 create db 的参数 vgroups 指定实际 vgroups 数量 |
|
||||||
| 116 | keep | 是 | 否 |
|
| 110 | maxTablesPerVnode | 是 | 否 | DB 中的所有表近似平均分配到各个 vgroup |
|
||||||
| 117 | minRows | 是 | 否 |
|
| 111 | minTablesPerVnode | 是 | 否 | DB 中的所有表近似平均分配到各个 vgroup |
|
||||||
| 118 | maxRows | 是 | 否 |
|
| 112 | tableIncStepPerVnode | 是 | 否 | DB 中的所有表近似平均分配到各个 vgroup |
|
||||||
| 119 | quorum | 是 | 否 |
|
| 113 | cache | 是 | 否 | 由 buffer 代替 cache\*blocks |
|
||||||
| 120 | comp | 是 | 否 |
|
| 114 | blocks | 是 | 否 | 由 buffer 代替 cache\*blocks |
|
||||||
| 121 | walLevel | 是 | 否 |
|
| 115 | days | 是 | 否 | 由 create db 的参数 duration 取代 |
|
||||||
| 122 | fsync | 是 | 否 |
|
| 116 | keep | 是 | 否 | 由 create db 的参数 keep 取代 |
|
||||||
| 123 | replica | 是 | 否 |
|
| 117 | minRows | 是 | 否 | 由 create db 的参数 minRows 取代 |
|
||||||
| 124 | partitions | 是 | 否 |
|
| 118 | maxRows | 是 | 否 | 由 create db 的参数 maxRows 取代 |
|
||||||
| 125 | quorum | 是 | 否 |
|
| 119 | quorum | 是 | 否 | 由 RAFT 协议决定 |
|
||||||
| 126 | update | 是 | 否 |
|
| 120 | comp | 是 | 否 | 由 create db 的参数 comp 取代 |
|
||||||
| 127 | cachelast | 是 | 否 |
|
| 121 | walLevel | 是 | 否 | 由 create db 的参数 wal_level 取代 |
|
||||||
| 128 | maxSQLLength | 是 | 否 |
|
| 122 | fsync | 是 | 否 | 由 create db 的参数 wal_fsync_period 取代 |
|
||||||
| 129 | maxWildCardsLength | 是 | 否 |
|
| 123 | replica | 是 | 否 | 由 create db 的参数 replica 取代 |
|
||||||
| 130 | maxRegexStringLen | 是 | 否 |
|
| 124 | partitions | 是 | 否 | 3.0 行为未知 |
|
||||||
| 131 | maxNumOfOrderedRes | 是 | 否 |
|
| 125 | update | 是 | 否 | 允许更新部分列 |
|
||||||
| 132 | maxConnections | 是 | 否 |
|
| 126 | cachelast | 是 | 否 | 由 create db 的参数 cacheModel 取代 |
|
||||||
| 133 | mnodeEqualVnodeNum | 是 | 否 |
|
| 127 | maxSQLLength | 是 | 否 | SQL 上限为 1MB,无需参数控制 |
|
||||||
| 134 | http | 是 | 否 |
|
| 128 | maxWildCardsLength | 是 | 否 | 3.0 行为未知 |
|
||||||
| 135 | httpEnableRecordSql | 是 | 否 |
|
| 129 | maxRegexStringLen | 是 | 否 | 3.0 行为未知 |
|
||||||
| 136 | httpMaxThreads | 是 | 否 |
|
| 130 | maxNumOfOrderedRes | 是 | 否 | 3.0 行为未知 |
|
||||||
| 137 | restfulRowLimit | 是 | 否 |
|
| 131 | maxConnections | 是 | 否 | 取决于系统配置和系统处理能力,详见后面的 Note |
|
||||||
| 138 | httpDbNameMandatory | 是 | 否 |
|
| 132 | mnodeEqualVnodeNum | 是 | 否 | 3.0 行为未知 |
|
||||||
| 139 | httpKeepAlive | 是 | 否 |
|
| 133 | http | 是 | 否 | http 服务由 taosAdapter 提供 |
|
||||||
| 140 | enableRecordSql | 是 | 否 |
|
| 134 | httpEnableRecordSql | 是 | 否 | taosd 不提供 http 服务 |
|
||||||
| 141 | maxBinaryDisplayWidth | 是 | 否 |
|
| 135 | httpMaxThreads | 是 | 否 | taosd 不提供 http 服务 |
|
||||||
| 142 | stream | 是 | 否 |
|
| 136 | restfulRowLimit | 是 | 否 | taosd 不提供 http 服务 |
|
||||||
| 143 | retrieveBlockingModel | 是 | 否 |
|
| 137 | httpDbNameMandatory | 是 | 否 | taosd 不提供 http 服务 |
|
||||||
| 144 | tsdbMetaCompactRatio | 是 | 否 |
|
| 138 | httpKeepAlive | 是 | 否 | taosd 不提供 http 服务 |
|
||||||
| 145 | defaultJSONStrType | 是 | 否 |
|
| 139 | enableRecordSql | 是 | 否 | 3.0 行为未知 |
|
||||||
| 146 | walFlushSize | 是 | 否 |
|
| 140 | maxBinaryDisplayWidth | 是 | 否 | 3.0 行为未知 |
|
||||||
| 147 | keepTimeOffset | 是 | 否 |
|
| 141 | stream | 是 | 否 | 默认启用连续查询 |
|
||||||
| 148 | flowctrl | 是 | 否 |
|
| 142 | retrieveBlockingModel | 是 | 否 | 3.0 行为未知 |
|
||||||
| 149 | slaveQuery | 是 | 否 |
|
| 143 | tsdbMetaCompactRatio | 是 | 否 | 3.0 行为未知 |
|
||||||
| 150 | adjustMaster | 是 | 否 |
|
| 144 | defaultJSONStrType | 是 | 否 | 3.0 行为未知 |
|
||||||
| 151 | topicBinaryLen | 是 | 否 |
|
| 145 | walFlushSize | 是 | 否 | 3.0 行为未知 |
|
||||||
| 152 | telegrafUseFieldNum | 是 | 否 |
|
| 146 | keepTimeOffset | 是 | 否 | 3.0 行为未知 |
|
||||||
| 153 | deadLockKillQuery | 是 | 否 |
|
| 147 | flowctrl | 是 | 否 | 3.0 行为未知 |
|
||||||
| 154 | clientMerge | 是 | 否 |
|
| 148 | slaveQuery | 是 | 否 | 3.0 行为未知: slave vnode 是否能够处理查询? |
|
||||||
| 155 | sdbDebugFlag | 是 | 否 |
|
| 149 | adjustMaster | 是 | 否 | 3.0 行为未知 |
|
||||||
| 156 | odbcDebugFlag | 是 | 否 |
|
| 150 | topicBinaryLen | 是 | 否 | 3.0 行为未知 |
|
||||||
| 157 | httpDebugFlag | 是 | 否 |
|
| 151 | telegrafUseFieldNum | 是 | 否 | 3.0 行为未知 |
|
||||||
| 158 | monDebugFlag | 是 | 否 |
|
| 152 | deadLockKillQuery | 是 | 否 | 3.0 行为未知 |
|
||||||
| 159 | cqDebugFlag | 是 | 否 |
|
| 153 | clientMerge | 是 | 否 | 3.0 行为未知 |
|
||||||
| 160 | shortcutFlag | 是 | 否 |
|
| 154 | sdbDebugFlag | 是 | 否 | 参考 3.0 的 DebugFlag 系列参数 |
|
||||||
| 161 | probeSeconds | 是 | 否 |
|
| 155 | odbcDebugFlag | 是 | 否 | 参考 3.0 的 DebugFlag 系列参数 |
|
||||||
| 162 | probeKillSeconds | 是 | 否 |
|
| 156 | httpDebugFlag | 是 | 否 | 参考 3.0 的 DebugFlag 系列参数 |
|
||||||
| 163 | probeInterval | 是 | 否 |
|
| 157 | monDebugFlag | 是 | 否 | 参考 3.0 的 DebugFlag 系列参数 |
|
||||||
| 164 | lossyColumns | 是 | 否 |
|
| 158 | cqDebugFlag | 是 | 否 | 参考 3.0 的 DebugFlag 系列参数 |
|
||||||
| 165 | fPrecision | 是 | 否 |
|
| 159 | shortcutFlag | 是 | 否 | 参考 3.0 的 DebugFlag 系列参数 |
|
||||||
| 166 | dPrecision | 是 | 否 |
|
| 160 | probeSeconds | 是 | 否 | 3.0 行为未知 |
|
||||||
| 167 | maxRange | 是 | 否 |
|
| 161 | probeKillSeconds | 是 | 否 | 3.0 行为未知 |
|
||||||
| 168 | range | 是 | 否 |
|
| 162 | probeInterval | 是 | 否 | 3.0 行为未知 |
|
||||||
|
| 163 | lossyColumns | 是 | 否 | 3.0 行为未知 |
|
||||||
|
| 164 | fPrecision | 是 | 否 | 3.0 行为未知 |
|
||||||
|
| 165 | dPrecision | 是 | 否 | 3.0 行为未知 |
|
||||||
|
| 166 | maxRange | 是 | 否 | 3.0 行为未知 |
|
||||||
|
| 167 | range | 是 | 否 | 3.0 行为未知 |
|
||||||
|
|
|
@ -135,11 +135,11 @@ ALTER LOCAL local_option
|
||||||
|
|
||||||
local_option: {
|
local_option: {
|
||||||
'resetLog'
|
'resetLog'
|
||||||
| 'rpcDebugFlag' value
|
| 'rpcDebugFlag' 'value'
|
||||||
| 'tmrDebugFlag' value
|
| 'tmrDebugFlag' 'value'
|
||||||
| 'cDebugFlag' value
|
| 'cDebugFlag' 'value'
|
||||||
| 'uDebugFlag' value
|
| 'uDebugFlag' 'value'
|
||||||
| 'debugFlag' value
|
| 'debugFlag' 'value'
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ static int32_t msg_process(TAOS_RES* msg) {
|
||||||
int32_t precision = taos_result_precision(msg);
|
int32_t precision = taos_result_precision(msg);
|
||||||
rows++;
|
rows++;
|
||||||
taos_print_row(buf, row, fields, numOfFields);
|
taos_print_row(buf, row, fields, numOfFields);
|
||||||
printf("row content: %s\n", buf);
|
printf("precision: %d, row content: %s\n", precision, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rows;
|
return rows;
|
||||||
|
@ -70,7 +70,7 @@ static int32_t init_env() {
|
||||||
taos_free_result(pRes);
|
taos_free_result(pRes);
|
||||||
|
|
||||||
// create database
|
// create database
|
||||||
pRes = taos_query(pConn, "create database tmqdb");
|
pRes = taos_query(pConn, "create database tmqdb precision 'ns'");
|
||||||
if (taos_errno(pRes) != 0) {
|
if (taos_errno(pRes) != 0) {
|
||||||
printf("error in create tmqdb, reason:%s\n", taos_errstr(pRes));
|
printf("error in create tmqdb, reason:%s\n", taos_errstr(pRes));
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -161,16 +161,9 @@ typedef enum EStreamType {
|
||||||
STREAM_RETRIEVE,
|
STREAM_RETRIEVE,
|
||||||
STREAM_PULL_DATA,
|
STREAM_PULL_DATA,
|
||||||
STREAM_PULL_OVER,
|
STREAM_PULL_OVER,
|
||||||
|
STREAM_FILL_OVER,
|
||||||
} EStreamType;
|
} EStreamType;
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
SArray* pGroupList;
|
|
||||||
SArray* pTableList;
|
|
||||||
SHashObj* map; // speedup acquire the tableQueryInfo by table uid
|
|
||||||
bool needSortTableByGroupId;
|
|
||||||
uint64_t suid;
|
|
||||||
} STableListInfo;
|
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
typedef struct SColumnDataAgg {
|
typedef struct SColumnDataAgg {
|
||||||
int16_t colId;
|
int16_t colId;
|
||||||
|
|
|
@ -60,8 +60,8 @@ extern int32_t tsNumOfVnodeSyncThreads;
|
||||||
extern int32_t tsNumOfVnodeRsmaThreads;
|
extern int32_t tsNumOfVnodeRsmaThreads;
|
||||||
extern int32_t tsNumOfQnodeQueryThreads;
|
extern int32_t tsNumOfQnodeQueryThreads;
|
||||||
extern int32_t tsNumOfQnodeFetchThreads;
|
extern int32_t tsNumOfQnodeFetchThreads;
|
||||||
extern int32_t tsNumOfSnodeSharedThreads;
|
extern int32_t tsNumOfSnodeStreamThreads;
|
||||||
extern int32_t tsNumOfSnodeUniqueThreads;
|
extern int32_t tsNumOfSnodeWriteThreads;
|
||||||
extern int64_t tsRpcQueueMemoryAllowed;
|
extern int64_t tsRpcQueueMemoryAllowed;
|
||||||
|
|
||||||
// monitor
|
// monitor
|
||||||
|
@ -91,6 +91,7 @@ extern bool tsQueryPlannerTrace;
|
||||||
extern int32_t tsQueryNodeChunkSize;
|
extern int32_t tsQueryNodeChunkSize;
|
||||||
extern bool tsQueryUseNodeAllocator;
|
extern bool tsQueryUseNodeAllocator;
|
||||||
extern bool tsKeepColumnName;
|
extern bool tsKeepColumnName;
|
||||||
|
extern bool tsEnableQueryHb;
|
||||||
|
|
||||||
// client
|
// client
|
||||||
extern int32_t tsMinSlidingTime;
|
extern int32_t tsMinSlidingTime;
|
||||||
|
|
|
@ -1478,6 +1478,7 @@ typedef struct {
|
||||||
int32_t dnodeId;
|
int32_t dnodeId;
|
||||||
char fqdn[TSDB_FQDN_LEN];
|
char fqdn[TSDB_FQDN_LEN];
|
||||||
int32_t port;
|
int32_t port;
|
||||||
|
int8_t force;
|
||||||
} SDropDnodeReq;
|
} SDropDnodeReq;
|
||||||
|
|
||||||
int32_t tSerializeSDropDnodeReq(void* buf, int32_t bufLen, SDropDnodeReq* pReq);
|
int32_t tSerializeSDropDnodeReq(void* buf, int32_t bufLen, SDropDnodeReq* pReq);
|
||||||
|
@ -1726,6 +1727,9 @@ typedef struct {
|
||||||
#define STREAM_TRIGGER_WINDOW_CLOSE 2
|
#define STREAM_TRIGGER_WINDOW_CLOSE 2
|
||||||
#define STREAM_TRIGGER_MAX_DELAY 3
|
#define STREAM_TRIGGER_MAX_DELAY 3
|
||||||
#define STREAM_DEFAULT_IGNORE_EXPIRED 0
|
#define STREAM_DEFAULT_IGNORE_EXPIRED 0
|
||||||
|
#define STREAM_FILL_HISTORY_ON 1
|
||||||
|
#define STREAM_FILL_HISTORY_OFF 0
|
||||||
|
#define STREAM_DEFAULT_FILL_HISTORY STREAM_FILL_HISTORY_OFF
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char name[TSDB_STREAM_FNAME_LEN];
|
char name[TSDB_STREAM_FNAME_LEN];
|
||||||
|
|
|
@ -198,6 +198,9 @@ enum {
|
||||||
TD_DEF_MSG_TYPE(TDMT_VND_CONSUME, "vnode-consume", SMqPollReq, SMqDataBlkRsp)
|
TD_DEF_MSG_TYPE(TDMT_VND_CONSUME, "vnode-consume", SMqPollReq, SMqDataBlkRsp)
|
||||||
TD_DEF_MSG_TYPE(TDMT_VND_STREAM_TRIGGER, "vnode-stream-trigger", NULL, NULL)
|
TD_DEF_MSG_TYPE(TDMT_VND_STREAM_TRIGGER, "vnode-stream-trigger", NULL, NULL)
|
||||||
TD_DEF_MSG_TYPE(TDMT_VND_STREAM_DISPATCH_WRITE, "vnode-stream-task-dispatch-write", NULL, NULL)
|
TD_DEF_MSG_TYPE(TDMT_VND_STREAM_DISPATCH_WRITE, "vnode-stream-task-dispatch-write", NULL, NULL)
|
||||||
|
TD_DEF_MSG_TYPE(TDMT_VND_STREAM_RECOVER_STEP1, "vnode-stream-recover1", NULL, NULL)
|
||||||
|
TD_DEF_MSG_TYPE(TDMT_VND_STREAM_RECOVER_STEP2, "vnode-stream-recover2", NULL, NULL)
|
||||||
|
TD_DEF_MSG_TYPE(TDMT_VND_STREAM_RECOVER_FINISH, "vnode-stream-finish", NULL, NULL)
|
||||||
TD_DEF_MSG_TYPE(TDMT_VND_CREATE_SMA, "vnode-create-sma", NULL, NULL)
|
TD_DEF_MSG_TYPE(TDMT_VND_CREATE_SMA, "vnode-create-sma", NULL, NULL)
|
||||||
TD_DEF_MSG_TYPE(TDMT_VND_CANCEL_SMA, "vnode-cancel-sma", NULL, NULL)
|
TD_DEF_MSG_TYPE(TDMT_VND_CANCEL_SMA, "vnode-cancel-sma", NULL, NULL)
|
||||||
TD_DEF_MSG_TYPE(TDMT_VND_DROP_SMA, "vnode-drop-sma", NULL, NULL)
|
TD_DEF_MSG_TYPE(TDMT_VND_DROP_SMA, "vnode-drop-sma", NULL, NULL)
|
||||||
|
@ -266,6 +269,7 @@ enum {
|
||||||
TD_DEF_MSG_TYPE(TDMT_SYNC_SET_VNODE_STANDBY, "set-vnode-standby", NULL, NULL) // no longer used
|
TD_DEF_MSG_TYPE(TDMT_SYNC_SET_VNODE_STANDBY, "set-vnode-standby", NULL, NULL) // no longer used
|
||||||
TD_DEF_MSG_TYPE(TDMT_SYNC_HEARTBEAT, "sync-heartbeat", NULL, NULL)
|
TD_DEF_MSG_TYPE(TDMT_SYNC_HEARTBEAT, "sync-heartbeat", NULL, NULL)
|
||||||
TD_DEF_MSG_TYPE(TDMT_SYNC_HEARTBEAT_REPLY, "sync-heartbeat-reply", NULL, NULL)
|
TD_DEF_MSG_TYPE(TDMT_SYNC_HEARTBEAT_REPLY, "sync-heartbeat-reply", NULL, NULL)
|
||||||
|
TD_DEF_MSG_TYPE(TDMT_SYNC_LOCAL_CMD, "sync-local-cmd", NULL, NULL)
|
||||||
TD_DEF_MSG_TYPE(TDMT_SYNC_MAX_MSG, "sync-max", NULL, NULL)
|
TD_DEF_MSG_TYPE(TDMT_SYNC_MAX_MSG, "sync-max", NULL, NULL)
|
||||||
|
|
||||||
#if defined(TD_MSG_NUMBER_)
|
#if defined(TD_MSG_NUMBER_)
|
||||||
|
|
|
@ -169,7 +169,7 @@ typedef struct {
|
||||||
// #define TD_ROW_VER(r) ((r)->ver)
|
// #define TD_ROW_VER(r) ((r)->ver)
|
||||||
#define TD_ROW_KEY_ADDR(r) (r)
|
#define TD_ROW_KEY_ADDR(r) (r)
|
||||||
|
|
||||||
// N.B. If without STSchema, getExtendedRowSize() is used to get the rowMaxBytes and
|
// N.B. If without STSchema, insGetExtendedRowSize() is used to get the rowMaxBytes and
|
||||||
// (int32_t)ceil((double)nCols/TD_VTYPE_PARTS) should be added if TD_SUPPORT_BITMAP defined.
|
// (int32_t)ceil((double)nCols/TD_VTYPE_PARTS) should be added if TD_SUPPORT_BITMAP defined.
|
||||||
#define TD_ROW_MAX_BYTES_FROM_SCHEMA(s) ((s)->tlen + TD_ROW_HEAD_LEN)
|
#define TD_ROW_MAX_BYTES_FROM_SCHEMA(s) ((s)->tlen + TD_ROW_HEAD_LEN)
|
||||||
|
|
||||||
|
|
|
@ -66,279 +66,281 @@
|
||||||
#define TK_PORT 48
|
#define TK_PORT 48
|
||||||
#define TK_DNODES 49
|
#define TK_DNODES 49
|
||||||
#define TK_NK_IPTOKEN 50
|
#define TK_NK_IPTOKEN 50
|
||||||
#define TK_LOCAL 51
|
#define TK_FORCE 51
|
||||||
#define TK_QNODE 52
|
#define TK_LOCAL 52
|
||||||
#define TK_BNODE 53
|
#define TK_QNODE 53
|
||||||
#define TK_SNODE 54
|
#define TK_BNODE 54
|
||||||
#define TK_MNODE 55
|
#define TK_SNODE 55
|
||||||
#define TK_DATABASE 56
|
#define TK_MNODE 56
|
||||||
#define TK_USE 57
|
#define TK_DATABASE 57
|
||||||
#define TK_FLUSH 58
|
#define TK_USE 58
|
||||||
#define TK_TRIM 59
|
#define TK_FLUSH 59
|
||||||
#define TK_IF 60
|
#define TK_TRIM 60
|
||||||
#define TK_NOT 61
|
#define TK_IF 61
|
||||||
#define TK_EXISTS 62
|
#define TK_NOT 62
|
||||||
#define TK_BUFFER 63
|
#define TK_EXISTS 63
|
||||||
#define TK_CACHEMODEL 64
|
#define TK_BUFFER 64
|
||||||
#define TK_CACHESIZE 65
|
#define TK_CACHEMODEL 65
|
||||||
#define TK_COMP 66
|
#define TK_CACHESIZE 66
|
||||||
#define TK_DURATION 67
|
#define TK_COMP 67
|
||||||
#define TK_NK_VARIABLE 68
|
#define TK_DURATION 68
|
||||||
#define TK_MAXROWS 69
|
#define TK_NK_VARIABLE 69
|
||||||
#define TK_MINROWS 70
|
#define TK_MAXROWS 70
|
||||||
#define TK_KEEP 71
|
#define TK_MINROWS 71
|
||||||
#define TK_PAGES 72
|
#define TK_KEEP 72
|
||||||
#define TK_PAGESIZE 73
|
#define TK_PAGES 73
|
||||||
#define TK_TSDB_PAGESIZE 74
|
#define TK_PAGESIZE 74
|
||||||
#define TK_PRECISION 75
|
#define TK_TSDB_PAGESIZE 75
|
||||||
#define TK_REPLICA 76
|
#define TK_PRECISION 76
|
||||||
#define TK_STRICT 77
|
#define TK_REPLICA 77
|
||||||
#define TK_VGROUPS 78
|
#define TK_STRICT 78
|
||||||
#define TK_SINGLE_STABLE 79
|
#define TK_VGROUPS 79
|
||||||
#define TK_RETENTIONS 80
|
#define TK_SINGLE_STABLE 80
|
||||||
#define TK_SCHEMALESS 81
|
#define TK_RETENTIONS 81
|
||||||
#define TK_WAL_LEVEL 82
|
#define TK_SCHEMALESS 82
|
||||||
#define TK_WAL_FSYNC_PERIOD 83
|
#define TK_WAL_LEVEL 83
|
||||||
#define TK_WAL_RETENTION_PERIOD 84
|
#define TK_WAL_FSYNC_PERIOD 84
|
||||||
#define TK_WAL_RETENTION_SIZE 85
|
#define TK_WAL_RETENTION_PERIOD 85
|
||||||
#define TK_WAL_ROLL_PERIOD 86
|
#define TK_WAL_RETENTION_SIZE 86
|
||||||
#define TK_WAL_SEGMENT_SIZE 87
|
#define TK_WAL_ROLL_PERIOD 87
|
||||||
#define TK_STT_TRIGGER 88
|
#define TK_WAL_SEGMENT_SIZE 88
|
||||||
#define TK_TABLE_PREFIX 89
|
#define TK_STT_TRIGGER 89
|
||||||
#define TK_TABLE_SUFFIX 90
|
#define TK_TABLE_PREFIX 90
|
||||||
#define TK_NK_COLON 91
|
#define TK_TABLE_SUFFIX 91
|
||||||
#define TK_MAX_SPEED 92
|
#define TK_NK_COLON 92
|
||||||
#define TK_TABLE 93
|
#define TK_MAX_SPEED 93
|
||||||
#define TK_NK_LP 94
|
#define TK_TABLE 94
|
||||||
#define TK_NK_RP 95
|
#define TK_NK_LP 95
|
||||||
#define TK_STABLE 96
|
#define TK_NK_RP 96
|
||||||
#define TK_ADD 97
|
#define TK_STABLE 97
|
||||||
#define TK_COLUMN 98
|
#define TK_ADD 98
|
||||||
#define TK_MODIFY 99
|
#define TK_COLUMN 99
|
||||||
#define TK_RENAME 100
|
#define TK_MODIFY 100
|
||||||
#define TK_TAG 101
|
#define TK_RENAME 101
|
||||||
#define TK_SET 102
|
#define TK_TAG 102
|
||||||
#define TK_NK_EQ 103
|
#define TK_SET 103
|
||||||
#define TK_USING 104
|
#define TK_NK_EQ 104
|
||||||
#define TK_TAGS 105
|
#define TK_USING 105
|
||||||
#define TK_COMMENT 106
|
#define TK_TAGS 106
|
||||||
#define TK_BOOL 107
|
#define TK_COMMENT 107
|
||||||
#define TK_TINYINT 108
|
#define TK_BOOL 108
|
||||||
#define TK_SMALLINT 109
|
#define TK_TINYINT 109
|
||||||
#define TK_INT 110
|
#define TK_SMALLINT 110
|
||||||
#define TK_INTEGER 111
|
#define TK_INT 111
|
||||||
#define TK_BIGINT 112
|
#define TK_INTEGER 112
|
||||||
#define TK_FLOAT 113
|
#define TK_BIGINT 113
|
||||||
#define TK_DOUBLE 114
|
#define TK_FLOAT 114
|
||||||
#define TK_BINARY 115
|
#define TK_DOUBLE 115
|
||||||
#define TK_TIMESTAMP 116
|
#define TK_BINARY 116
|
||||||
#define TK_NCHAR 117
|
#define TK_TIMESTAMP 117
|
||||||
#define TK_UNSIGNED 118
|
#define TK_NCHAR 118
|
||||||
#define TK_JSON 119
|
#define TK_UNSIGNED 119
|
||||||
#define TK_VARCHAR 120
|
#define TK_JSON 120
|
||||||
#define TK_MEDIUMBLOB 121
|
#define TK_VARCHAR 121
|
||||||
#define TK_BLOB 122
|
#define TK_MEDIUMBLOB 122
|
||||||
#define TK_VARBINARY 123
|
#define TK_BLOB 123
|
||||||
#define TK_DECIMAL 124
|
#define TK_VARBINARY 124
|
||||||
#define TK_MAX_DELAY 125
|
#define TK_DECIMAL 125
|
||||||
#define TK_WATERMARK 126
|
#define TK_MAX_DELAY 126
|
||||||
#define TK_ROLLUP 127
|
#define TK_WATERMARK 127
|
||||||
#define TK_TTL 128
|
#define TK_ROLLUP 128
|
||||||
#define TK_SMA 129
|
#define TK_TTL 129
|
||||||
#define TK_FIRST 130
|
#define TK_SMA 130
|
||||||
#define TK_LAST 131
|
#define TK_FIRST 131
|
||||||
#define TK_SHOW 132
|
#define TK_LAST 132
|
||||||
#define TK_DATABASES 133
|
#define TK_SHOW 133
|
||||||
#define TK_TABLES 134
|
#define TK_DATABASES 134
|
||||||
#define TK_STABLES 135
|
#define TK_TABLES 135
|
||||||
#define TK_MNODES 136
|
#define TK_STABLES 136
|
||||||
#define TK_QNODES 137
|
#define TK_MNODES 137
|
||||||
#define TK_FUNCTIONS 138
|
#define TK_QNODES 138
|
||||||
#define TK_INDEXES 139
|
#define TK_FUNCTIONS 139
|
||||||
#define TK_ACCOUNTS 140
|
#define TK_INDEXES 140
|
||||||
#define TK_APPS 141
|
#define TK_ACCOUNTS 141
|
||||||
#define TK_CONNECTIONS 142
|
#define TK_APPS 142
|
||||||
#define TK_LICENCES 143
|
#define TK_CONNECTIONS 143
|
||||||
#define TK_GRANTS 144
|
#define TK_LICENCES 144
|
||||||
#define TK_QUERIES 145
|
#define TK_GRANTS 145
|
||||||
#define TK_SCORES 146
|
#define TK_QUERIES 146
|
||||||
#define TK_TOPICS 147
|
#define TK_SCORES 147
|
||||||
#define TK_VARIABLES 148
|
#define TK_TOPICS 148
|
||||||
#define TK_BNODES 149
|
#define TK_VARIABLES 149
|
||||||
#define TK_SNODES 150
|
#define TK_CLUSTER 150
|
||||||
#define TK_CLUSTER 151
|
#define TK_BNODES 151
|
||||||
#define TK_TRANSACTIONS 152
|
#define TK_SNODES 152
|
||||||
#define TK_DISTRIBUTED 153
|
#define TK_TRANSACTIONS 153
|
||||||
#define TK_CONSUMERS 154
|
#define TK_DISTRIBUTED 154
|
||||||
#define TK_SUBSCRIPTIONS 155
|
#define TK_CONSUMERS 155
|
||||||
#define TK_VNODES 156
|
#define TK_SUBSCRIPTIONS 156
|
||||||
#define TK_LIKE 157
|
#define TK_VNODES 157
|
||||||
#define TK_INDEX 158
|
#define TK_LIKE 158
|
||||||
#define TK_FUNCTION 159
|
#define TK_INDEX 159
|
||||||
#define TK_INTERVAL 160
|
#define TK_FUNCTION 160
|
||||||
#define TK_TOPIC 161
|
#define TK_INTERVAL 161
|
||||||
#define TK_AS 162
|
#define TK_TOPIC 162
|
||||||
#define TK_WITH 163
|
#define TK_AS 163
|
||||||
#define TK_META 164
|
#define TK_WITH 164
|
||||||
#define TK_CONSUMER 165
|
#define TK_META 165
|
||||||
#define TK_GROUP 166
|
#define TK_CONSUMER 166
|
||||||
#define TK_DESC 167
|
#define TK_GROUP 167
|
||||||
#define TK_DESCRIBE 168
|
#define TK_DESC 168
|
||||||
#define TK_RESET 169
|
#define TK_DESCRIBE 169
|
||||||
#define TK_QUERY 170
|
#define TK_RESET 170
|
||||||
#define TK_CACHE 171
|
#define TK_QUERY 171
|
||||||
#define TK_EXPLAIN 172
|
#define TK_CACHE 172
|
||||||
#define TK_ANALYZE 173
|
#define TK_EXPLAIN 173
|
||||||
#define TK_VERBOSE 174
|
#define TK_ANALYZE 174
|
||||||
#define TK_NK_BOOL 175
|
#define TK_VERBOSE 175
|
||||||
#define TK_RATIO 176
|
#define TK_NK_BOOL 176
|
||||||
#define TK_NK_FLOAT 177
|
#define TK_RATIO 177
|
||||||
#define TK_OUTPUTTYPE 178
|
#define TK_NK_FLOAT 178
|
||||||
#define TK_AGGREGATE 179
|
#define TK_OUTPUTTYPE 179
|
||||||
#define TK_BUFSIZE 180
|
#define TK_AGGREGATE 180
|
||||||
#define TK_STREAM 181
|
#define TK_BUFSIZE 181
|
||||||
#define TK_INTO 182
|
#define TK_STREAM 182
|
||||||
#define TK_TRIGGER 183
|
#define TK_INTO 183
|
||||||
#define TK_AT_ONCE 184
|
#define TK_TRIGGER 184
|
||||||
#define TK_WINDOW_CLOSE 185
|
#define TK_AT_ONCE 185
|
||||||
#define TK_IGNORE 186
|
#define TK_WINDOW_CLOSE 186
|
||||||
#define TK_EXPIRED 187
|
#define TK_IGNORE 187
|
||||||
#define TK_SUBTABLE 188
|
#define TK_EXPIRED 188
|
||||||
#define TK_KILL 189
|
#define TK_FILL_HISTORY 189
|
||||||
#define TK_CONNECTION 190
|
#define TK_SUBTABLE 190
|
||||||
#define TK_TRANSACTION 191
|
#define TK_KILL 191
|
||||||
#define TK_BALANCE 192
|
#define TK_CONNECTION 192
|
||||||
#define TK_VGROUP 193
|
#define TK_TRANSACTION 193
|
||||||
#define TK_MERGE 194
|
#define TK_BALANCE 194
|
||||||
#define TK_REDISTRIBUTE 195
|
#define TK_VGROUP 195
|
||||||
#define TK_SPLIT 196
|
#define TK_MERGE 196
|
||||||
#define TK_DELETE 197
|
#define TK_REDISTRIBUTE 197
|
||||||
#define TK_INSERT 198
|
#define TK_SPLIT 198
|
||||||
#define TK_NULL 199
|
#define TK_DELETE 199
|
||||||
#define TK_NK_QUESTION 200
|
#define TK_INSERT 200
|
||||||
#define TK_NK_ARROW 201
|
#define TK_NULL 201
|
||||||
#define TK_ROWTS 202
|
#define TK_NK_QUESTION 202
|
||||||
#define TK_TBNAME 203
|
#define TK_NK_ARROW 203
|
||||||
#define TK_QSTART 204
|
#define TK_ROWTS 204
|
||||||
#define TK_QEND 205
|
#define TK_TBNAME 205
|
||||||
#define TK_QDURATION 206
|
#define TK_QSTART 206
|
||||||
#define TK_WSTART 207
|
#define TK_QEND 207
|
||||||
#define TK_WEND 208
|
#define TK_QDURATION 208
|
||||||
#define TK_WDURATION 209
|
#define TK_WSTART 209
|
||||||
#define TK_IROWTS 210
|
#define TK_WEND 210
|
||||||
#define TK_QTAGS 211
|
#define TK_WDURATION 211
|
||||||
#define TK_CAST 212
|
#define TK_IROWTS 212
|
||||||
#define TK_NOW 213
|
#define TK_QTAGS 213
|
||||||
#define TK_TODAY 214
|
#define TK_CAST 214
|
||||||
#define TK_TIMEZONE 215
|
#define TK_NOW 215
|
||||||
#define TK_CLIENT_VERSION 216
|
#define TK_TODAY 216
|
||||||
#define TK_SERVER_VERSION 217
|
#define TK_TIMEZONE 217
|
||||||
#define TK_SERVER_STATUS 218
|
#define TK_CLIENT_VERSION 218
|
||||||
#define TK_CURRENT_USER 219
|
#define TK_SERVER_VERSION 219
|
||||||
#define TK_COUNT 220
|
#define TK_SERVER_STATUS 220
|
||||||
#define TK_LAST_ROW 221
|
#define TK_CURRENT_USER 221
|
||||||
#define TK_CASE 222
|
#define TK_COUNT 222
|
||||||
#define TK_END 223
|
#define TK_LAST_ROW 223
|
||||||
#define TK_WHEN 224
|
#define TK_CASE 224
|
||||||
#define TK_THEN 225
|
#define TK_END 225
|
||||||
#define TK_ELSE 226
|
#define TK_WHEN 226
|
||||||
#define TK_BETWEEN 227
|
#define TK_THEN 227
|
||||||
#define TK_IS 228
|
#define TK_ELSE 228
|
||||||
#define TK_NK_LT 229
|
#define TK_BETWEEN 229
|
||||||
#define TK_NK_GT 230
|
#define TK_IS 230
|
||||||
#define TK_NK_LE 231
|
#define TK_NK_LT 231
|
||||||
#define TK_NK_GE 232
|
#define TK_NK_GT 232
|
||||||
#define TK_NK_NE 233
|
#define TK_NK_LE 233
|
||||||
#define TK_MATCH 234
|
#define TK_NK_GE 234
|
||||||
#define TK_NMATCH 235
|
#define TK_NK_NE 235
|
||||||
#define TK_CONTAINS 236
|
#define TK_MATCH 236
|
||||||
#define TK_IN 237
|
#define TK_NMATCH 237
|
||||||
#define TK_JOIN 238
|
#define TK_CONTAINS 238
|
||||||
#define TK_INNER 239
|
#define TK_IN 239
|
||||||
#define TK_SELECT 240
|
#define TK_JOIN 240
|
||||||
#define TK_DISTINCT 241
|
#define TK_INNER 241
|
||||||
#define TK_WHERE 242
|
#define TK_SELECT 242
|
||||||
#define TK_PARTITION 243
|
#define TK_DISTINCT 243
|
||||||
#define TK_BY 244
|
#define TK_WHERE 244
|
||||||
#define TK_SESSION 245
|
#define TK_PARTITION 245
|
||||||
#define TK_STATE_WINDOW 246
|
#define TK_BY 246
|
||||||
#define TK_SLIDING 247
|
#define TK_SESSION 247
|
||||||
#define TK_FILL 248
|
#define TK_STATE_WINDOW 248
|
||||||
#define TK_VALUE 249
|
#define TK_SLIDING 249
|
||||||
#define TK_NONE 250
|
#define TK_FILL 250
|
||||||
#define TK_PREV 251
|
#define TK_VALUE 251
|
||||||
#define TK_LINEAR 252
|
#define TK_NONE 252
|
||||||
#define TK_NEXT 253
|
#define TK_PREV 253
|
||||||
#define TK_HAVING 254
|
#define TK_LINEAR 254
|
||||||
#define TK_RANGE 255
|
#define TK_NEXT 255
|
||||||
#define TK_EVERY 256
|
#define TK_HAVING 256
|
||||||
#define TK_ORDER 257
|
#define TK_RANGE 257
|
||||||
#define TK_SLIMIT 258
|
#define TK_EVERY 258
|
||||||
#define TK_SOFFSET 259
|
#define TK_ORDER 259
|
||||||
#define TK_LIMIT 260
|
#define TK_SLIMIT 260
|
||||||
#define TK_OFFSET 261
|
#define TK_SOFFSET 261
|
||||||
#define TK_ASC 262
|
#define TK_LIMIT 262
|
||||||
#define TK_NULLS 263
|
#define TK_OFFSET 263
|
||||||
#define TK_ABORT 264
|
#define TK_ASC 264
|
||||||
#define TK_AFTER 265
|
#define TK_NULLS 265
|
||||||
#define TK_ATTACH 266
|
#define TK_ABORT 266
|
||||||
#define TK_BEFORE 267
|
#define TK_AFTER 267
|
||||||
#define TK_BEGIN 268
|
#define TK_ATTACH 268
|
||||||
#define TK_BITAND 269
|
#define TK_BEFORE 269
|
||||||
#define TK_BITNOT 270
|
#define TK_BEGIN 270
|
||||||
#define TK_BITOR 271
|
#define TK_BITAND 271
|
||||||
#define TK_BLOCKS 272
|
#define TK_BITNOT 272
|
||||||
#define TK_CHANGE 273
|
#define TK_BITOR 273
|
||||||
#define TK_COMMA 274
|
#define TK_BLOCKS 274
|
||||||
#define TK_COMPACT 275
|
#define TK_CHANGE 275
|
||||||
#define TK_CONCAT 276
|
#define TK_COMMA 276
|
||||||
#define TK_CONFLICT 277
|
#define TK_COMPACT 277
|
||||||
#define TK_COPY 278
|
#define TK_CONCAT 278
|
||||||
#define TK_DEFERRED 279
|
#define TK_CONFLICT 279
|
||||||
#define TK_DELIMITERS 280
|
#define TK_COPY 280
|
||||||
#define TK_DETACH 281
|
#define TK_DEFERRED 281
|
||||||
#define TK_DIVIDE 282
|
#define TK_DELIMITERS 282
|
||||||
#define TK_DOT 283
|
#define TK_DETACH 283
|
||||||
#define TK_EACH 284
|
#define TK_DIVIDE 284
|
||||||
#define TK_FAIL 285
|
#define TK_DOT 285
|
||||||
#define TK_FILE 286
|
#define TK_EACH 286
|
||||||
#define TK_FOR 287
|
#define TK_FAIL 287
|
||||||
#define TK_GLOB 288
|
#define TK_FILE 288
|
||||||
#define TK_ID 289
|
#define TK_FOR 289
|
||||||
#define TK_IMMEDIATE 290
|
#define TK_GLOB 290
|
||||||
#define TK_IMPORT 291
|
#define TK_ID 291
|
||||||
#define TK_INITIALLY 292
|
#define TK_IMMEDIATE 292
|
||||||
#define TK_INSTEAD 293
|
#define TK_IMPORT 293
|
||||||
#define TK_ISNULL 294
|
#define TK_INITIALLY 294
|
||||||
#define TK_KEY 295
|
#define TK_INSTEAD 295
|
||||||
#define TK_MODULES 296
|
#define TK_ISNULL 296
|
||||||
#define TK_NK_BITNOT 297
|
#define TK_KEY 297
|
||||||
#define TK_NK_SEMI 298
|
#define TK_MODULES 298
|
||||||
#define TK_NOTNULL 299
|
#define TK_NK_BITNOT 299
|
||||||
#define TK_OF 300
|
#define TK_NK_SEMI 300
|
||||||
#define TK_PLUS 301
|
#define TK_NOTNULL 301
|
||||||
#define TK_PRIVILEGE 302
|
#define TK_OF 302
|
||||||
#define TK_RAISE 303
|
#define TK_PLUS 303
|
||||||
#define TK_REPLACE 304
|
#define TK_PRIVILEGE 304
|
||||||
#define TK_RESTRICT 305
|
#define TK_RAISE 305
|
||||||
#define TK_ROW 306
|
#define TK_REPLACE 306
|
||||||
#define TK_SEMI 307
|
#define TK_RESTRICT 307
|
||||||
#define TK_STAR 308
|
#define TK_ROW 308
|
||||||
#define TK_STATEMENT 309
|
#define TK_SEMI 309
|
||||||
#define TK_STRING 310
|
#define TK_STAR 310
|
||||||
#define TK_TIMES 311
|
#define TK_STATEMENT 311
|
||||||
#define TK_UPDATE 312
|
#define TK_STRING 312
|
||||||
#define TK_VALUES 313
|
#define TK_TIMES 313
|
||||||
#define TK_VARIABLE 314
|
#define TK_UPDATE 314
|
||||||
#define TK_VIEW 315
|
#define TK_VALUES 315
|
||||||
#define TK_WAL 316
|
#define TK_VARIABLE 316
|
||||||
|
#define TK_VIEW 317
|
||||||
|
#define TK_WAL 318
|
||||||
|
|
||||||
#define TK_NK_SPACE 300
|
#define TK_NK_SPACE 600
|
||||||
#define TK_NK_COMMENT 301
|
#define TK_NK_COMMENT 601
|
||||||
#define TK_NK_ILLEGAL 302
|
#define TK_NK_ILLEGAL 602
|
||||||
#define TK_NK_HEX 303 // hex number 0x123
|
#define TK_NK_HEX 603 // hex number 0x123
|
||||||
#define TK_NK_OCT 304 // oct number
|
#define TK_NK_OCT 604 // oct number
|
||||||
#define TK_NK_BIN 305 // bin format data 0b111
|
#define TK_NK_BIN 605 // bin format data 0b111
|
||||||
|
|
||||||
#define TK_NK_NIL 65535
|
#define TK_NK_NIL 65535
|
||||||
|
|
||||||
|
|
|
@ -290,6 +290,7 @@ typedef struct {
|
||||||
(IS_SIGNED_NUMERIC_TYPE(_t) || (_t) == (TSDB_DATA_TYPE_BOOL) || (_t) == (TSDB_DATA_TYPE_TIMESTAMP))
|
(IS_SIGNED_NUMERIC_TYPE(_t) || (_t) == (TSDB_DATA_TYPE_BOOL) || (_t) == (TSDB_DATA_TYPE_TIMESTAMP))
|
||||||
#define IS_CONVERT_AS_UNSIGNED(_t) (IS_UNSIGNED_NUMERIC_TYPE(_t) || (_t) == (TSDB_DATA_TYPE_BOOL))
|
#define IS_CONVERT_AS_UNSIGNED(_t) (IS_UNSIGNED_NUMERIC_TYPE(_t) || (_t) == (TSDB_DATA_TYPE_BOOL))
|
||||||
|
|
||||||
|
#if 0
|
||||||
// TODO remove this function
|
// TODO remove this function
|
||||||
static FORCE_INLINE bool isNull(const void *val, int32_t type) {
|
static FORCE_INLINE bool isNull(const void *val, int32_t type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
@ -325,6 +326,7 @@ static FORCE_INLINE bool isNull(const void *val, int32_t type) {
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct tDataTypeDescriptor {
|
typedef struct tDataTypeDescriptor {
|
||||||
int16_t type;
|
int16_t type;
|
||||||
|
|
|
@ -68,8 +68,8 @@ int32_t sndGetLoad(SSnode *pSnode, SSnodeLoad *pLoad);
|
||||||
* @param pMsg The request message
|
* @param pMsg The request message
|
||||||
* @param pRsp The response message
|
* @param pRsp The response message
|
||||||
*/
|
*/
|
||||||
int32_t sndProcessUMsg(SSnode *pSnode, SRpcMsg *pMsg);
|
int32_t sndProcessWriteMsg(SSnode *pSnode, SRpcMsg *pMsg, SRpcMsg *pRsp);
|
||||||
int32_t sndProcessSMsg(SSnode *pSnode, SRpcMsg *pMsg);
|
int32_t sndProcessStreamMsg(SSnode *pSnode, SRpcMsg *pMsg);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -203,6 +203,14 @@ int32_t catalogUpdateTableMeta(SCatalog* pCatalog, STableMetaRsp* rspMsg);
|
||||||
|
|
||||||
int32_t catalogUpdateTableMeta(SCatalog* pCatalog, STableMetaRsp* rspMsg);
|
int32_t catalogUpdateTableMeta(SCatalog* pCatalog, STableMetaRsp* rspMsg);
|
||||||
|
|
||||||
|
int32_t catalogGetCachedTableMeta(SCatalog* pCtg, SRequestConnInfo* pConn, const SName* pTableName, STableMeta** pTableMeta);
|
||||||
|
|
||||||
|
int32_t catalogGetCachedSTableMeta(SCatalog* pCtg, SRequestConnInfo* pConn, const SName* pTableName,
|
||||||
|
STableMeta** pTableMeta);
|
||||||
|
|
||||||
|
int32_t catalogGetCachedTableHashVgroup(SCatalog* pCtg, SRequestConnInfo* pConn, const SName* pTableName,
|
||||||
|
SVgroupInfo* pVgroup, bool* exists);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Force refresh DB's local cached vgroup info.
|
* Force refresh DB's local cached vgroup info.
|
||||||
* @param pCtg (input, got with catalogGetHandle)
|
* @param pCtg (input, got with catalogGetHandle)
|
||||||
|
|
|
@ -89,6 +89,16 @@ qTaskInfo_t qCreateQueueExecTaskInfo(void* msg, SReadHandle* readers, int32_t* n
|
||||||
*/
|
*/
|
||||||
int32_t qSetMultiStreamInput(qTaskInfo_t tinfo, const void* pBlocks, size_t numOfBlocks, int32_t type);
|
int32_t qSetMultiStreamInput(qTaskInfo_t tinfo, const void* pBlocks, size_t numOfBlocks, int32_t type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set block for sma
|
||||||
|
* @param tinfo
|
||||||
|
* @param pBlocks
|
||||||
|
* @param numOfInputBlock
|
||||||
|
* @param type
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int32_t qSetSMAInput(qTaskInfo_t tinfo, const void* pBlocks, size_t numOfBlocks, int32_t type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the table id list, add or remove.
|
* Update the table id list, add or remove.
|
||||||
*
|
*
|
||||||
|
@ -133,13 +143,6 @@ int32_t qGetQueryTableSchemaVersion(qTaskInfo_t tinfo, char* dbName, char* table
|
||||||
int32_t qExecTaskOpt(qTaskInfo_t tinfo, SArray* pResList, uint64_t* useconds, bool* hasMore, SLocalFetch* pLocal);
|
int32_t qExecTaskOpt(qTaskInfo_t tinfo, SArray* pResList, uint64_t* useconds, bool* hasMore, SLocalFetch* pLocal);
|
||||||
int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pBlock, uint64_t* useconds);
|
int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pBlock, uint64_t* useconds);
|
||||||
|
|
||||||
/**
|
|
||||||
* kill the ongoing query and free the query handle and corresponding resources automatically
|
|
||||||
* @param tinfo qhandle
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
int32_t qKillTask(qTaskInfo_t tinfo);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* kill the ongoing query asynchronously
|
* kill the ongoing query asynchronously
|
||||||
* @param tinfo qhandle
|
* @param tinfo qhandle
|
||||||
|
@ -176,6 +179,7 @@ int32_t qSerializeTaskStatus(qTaskInfo_t tinfo, char** pOutput, int32_t* len);
|
||||||
|
|
||||||
int32_t qDeserializeTaskStatus(qTaskInfo_t tinfo, const char* pInput, int32_t len);
|
int32_t qDeserializeTaskStatus(qTaskInfo_t tinfo, const char* pInput, int32_t len);
|
||||||
|
|
||||||
|
STimeWindow getAlignQueryTimeWindow(SInterval* pInterval, int32_t precision, int64_t key);
|
||||||
/**
|
/**
|
||||||
* return the scan info, in the form of tuple of two items, including table uid and current timestamp
|
* return the scan info, in the form of tuple of two items, including table uid and current timestamp
|
||||||
* @param tinfo
|
* @param tinfo
|
||||||
|
@ -207,9 +211,11 @@ int32_t qExtractStreamScanner(qTaskInfo_t tinfo, void** scanner);
|
||||||
|
|
||||||
int32_t qStreamInput(qTaskInfo_t tinfo, void* pItem);
|
int32_t qStreamInput(qTaskInfo_t tinfo, void* pItem);
|
||||||
|
|
||||||
int32_t qStreamPrepareRecover(qTaskInfo_t tinfo, int64_t startVer, int64_t endVer);
|
int32_t qStreamSetParamForRecover(qTaskInfo_t tinfo);
|
||||||
|
int32_t qStreamSourceRecoverStep1(qTaskInfo_t tinfo, int64_t ver);
|
||||||
STimeWindow getAlignQueryTimeWindow(SInterval* pInterval, int32_t precision, int64_t key);
|
int32_t qStreamSourceRecoverStep2(qTaskInfo_t tinfo, int64_t ver);
|
||||||
|
int32_t qStreamRecoverFinish(qTaskInfo_t tinfo);
|
||||||
|
int32_t qStreamRestoreParam(qTaskInfo_t tinfo);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -235,6 +235,7 @@ typedef struct SDropDnodeStmt {
|
||||||
int32_t dnodeId;
|
int32_t dnodeId;
|
||||||
char fqdn[TSDB_FQDN_LEN];
|
char fqdn[TSDB_FQDN_LEN];
|
||||||
int32_t port;
|
int32_t port;
|
||||||
|
bool force;
|
||||||
} SDropDnodeStmt;
|
} SDropDnodeStmt;
|
||||||
|
|
||||||
typedef struct SAlterDnodeStmt {
|
typedef struct SAlterDnodeStmt {
|
||||||
|
@ -274,6 +275,7 @@ typedef struct SShowTableDistributedStmt {
|
||||||
typedef struct SShowDnodeVariablesStmt {
|
typedef struct SShowDnodeVariablesStmt {
|
||||||
ENodeType type;
|
ENodeType type;
|
||||||
SNode* pDnodeId;
|
SNode* pDnodeId;
|
||||||
|
SNode* pLikePattern;
|
||||||
} SShowDnodeVariablesStmt;
|
} SShowDnodeVariablesStmt;
|
||||||
|
|
||||||
typedef struct SShowVnodesStmt {
|
typedef struct SShowVnodesStmt {
|
||||||
|
@ -373,6 +375,7 @@ typedef struct SStreamOptions {
|
||||||
int8_t triggerType;
|
int8_t triggerType;
|
||||||
SNode* pDelay;
|
SNode* pDelay;
|
||||||
SNode* pWatermark;
|
SNode* pWatermark;
|
||||||
|
int8_t fillHistory;
|
||||||
int8_t ignoreExpired;
|
int8_t ignoreExpired;
|
||||||
} SStreamOptions;
|
} SStreamOptions;
|
||||||
|
|
||||||
|
|
|
@ -567,6 +567,7 @@ typedef struct SSubplan {
|
||||||
SDataSinkNode* pDataSink; // data of the subplan flow into the datasink
|
SDataSinkNode* pDataSink; // data of the subplan flow into the datasink
|
||||||
SNode* pTagCond;
|
SNode* pTagCond;
|
||||||
SNode* pTagIndexCond;
|
SNode* pTagIndexCond;
|
||||||
|
bool showRewrite;
|
||||||
} SSubplan;
|
} SSubplan;
|
||||||
|
|
||||||
typedef enum EExplainMode { EXPLAIN_MODE_DISABLE = 1, EXPLAIN_MODE_STATIC, EXPLAIN_MODE_ANALYZE } EExplainMode;
|
typedef enum EExplainMode { EXPLAIN_MODE_DISABLE = 1, EXPLAIN_MODE_STATIC, EXPLAIN_MODE_ANALYZE } EExplainMode;
|
||||||
|
@ -585,8 +586,6 @@ typedef struct SQueryPlan {
|
||||||
SExplainInfo explainInfo;
|
SExplainInfo explainInfo;
|
||||||
} SQueryPlan;
|
} SQueryPlan;
|
||||||
|
|
||||||
void nodesWalkPhysiPlan(SNode* pNode, FNodeWalker walker, void* pContext);
|
|
||||||
|
|
||||||
const char* dataOrderStr(EDataOrderLevel order);
|
const char* dataOrderStr(EDataOrderLevel order);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -347,11 +347,6 @@ typedef struct SInsertStmt {
|
||||||
uint8_t precision;
|
uint8_t precision;
|
||||||
} SInsertStmt;
|
} SInsertStmt;
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
PAYLOAD_TYPE_KV = 0,
|
|
||||||
PAYLOAD_TYPE_RAW = 1,
|
|
||||||
} EPayloadType;
|
|
||||||
|
|
||||||
typedef struct SVgDataBlocks {
|
typedef struct SVgDataBlocks {
|
||||||
SVgroupInfo vg;
|
SVgroupInfo vg;
|
||||||
int32_t numOfTables; // number of tables in current submit block
|
int32_t numOfTables; // number of tables in current submit block
|
||||||
|
@ -363,7 +358,6 @@ typedef struct SVnodeModifOpStmt {
|
||||||
ENodeType nodeType;
|
ENodeType nodeType;
|
||||||
ENodeType sqlNodeType;
|
ENodeType sqlNodeType;
|
||||||
SArray* pDataBlocks; // data block for each vgroup, SArray<SVgDataBlocks*>.
|
SArray* pDataBlocks; // data block for each vgroup, SArray<SVgDataBlocks*>.
|
||||||
uint8_t payloadType; // EPayloadType. 0: K-V payload for non-prepare insert, 1: rawPayload for prepare insert
|
|
||||||
uint32_t insertType; // insert data from [file|sql statement| bound statement]
|
uint32_t insertType; // insert data from [file|sql statement| bound statement]
|
||||||
const char* sql; // current sql statement position
|
const char* sql; // current sql statement position
|
||||||
} SVnodeModifOpStmt;
|
} SVnodeModifOpStmt;
|
||||||
|
|
|
@ -61,7 +61,6 @@ int32_t qStringToSubplan(const char* pStr, SSubplan** pSubplan);
|
||||||
int32_t qSubPlanToMsg(const SSubplan* pSubplan, char** pStr, int32_t* pLen);
|
int32_t qSubPlanToMsg(const SSubplan* pSubplan, char** pStr, int32_t* pLen);
|
||||||
int32_t qMsgToSubplan(const char* pStr, int32_t len, SSubplan** pSubplan);
|
int32_t qMsgToSubplan(const char* pStr, int32_t len, SSubplan** pSubplan);
|
||||||
|
|
||||||
char* qQueryPlanToString(const SQueryPlan* pPlan);
|
|
||||||
SQueryPlan* qStringToQueryPlan(const char* pStr);
|
SQueryPlan* qStringToQueryPlan(const char* pStr);
|
||||||
|
|
||||||
void qDestroyQueryPlan(SQueryPlan* pPlan);
|
void qDestroyQueryPlan(SQueryPlan* pPlan);
|
||||||
|
|
|
@ -99,6 +99,8 @@ int32_t streamStateSeekLast(SStreamState* pState, SStreamStateCur* pCur);
|
||||||
int32_t streamStateCurNext(SStreamState* pState, SStreamStateCur* pCur);
|
int32_t streamStateCurNext(SStreamState* pState, SStreamStateCur* pCur);
|
||||||
int32_t streamStateCurPrev(SStreamState* pState, SStreamStateCur* pCur);
|
int32_t streamStateCurPrev(SStreamState* pState, SStreamStateCur* pCur);
|
||||||
|
|
||||||
|
// char* streamStateSessionDump(SStreamState* pState);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -47,7 +47,9 @@ enum {
|
||||||
TASK_STATUS__FAIL,
|
TASK_STATUS__FAIL,
|
||||||
TASK_STATUS__STOP,
|
TASK_STATUS__STOP,
|
||||||
TASK_STATUS__RECOVER_DOWNSTREAM,
|
TASK_STATUS__RECOVER_DOWNSTREAM,
|
||||||
TASK_STATUS__RECOVER_SELF,
|
TASK_STATUS__RECOVER_PREPARE,
|
||||||
|
TASK_STATUS__RECOVER1,
|
||||||
|
TASK_STATUS__RECOVER2,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
@ -329,6 +331,9 @@ typedef struct SStreamTask {
|
||||||
// state backend
|
// state backend
|
||||||
SStreamState* pState;
|
SStreamState* pState;
|
||||||
|
|
||||||
|
// do not serialize
|
||||||
|
int32_t recoverWaitingChild;
|
||||||
|
|
||||||
} SStreamTask;
|
} SStreamTask;
|
||||||
|
|
||||||
int32_t tEncodeStreamEpInfo(SEncoder* pEncoder, const SStreamChildEpInfo* pInfo);
|
int32_t tEncodeStreamEpInfo(SEncoder* pEncoder, const SStreamChildEpInfo* pInfo);
|
||||||
|
@ -435,6 +440,20 @@ typedef struct {
|
||||||
int32_t rspToTaskId;
|
int32_t rspToTaskId;
|
||||||
} SStreamRetrieveRsp;
|
} SStreamRetrieveRsp;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int64_t streamId;
|
||||||
|
int32_t taskId;
|
||||||
|
} SStreamRecoverStep1Req, SStreamRecoverStep2Req;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int64_t streamId;
|
||||||
|
int32_t taskId;
|
||||||
|
int32_t childId;
|
||||||
|
} SStreamRecoverFinishReq;
|
||||||
|
|
||||||
|
int32_t tEncodeSStreamRecoverFinishReq(SEncoder* pEncoder, const SStreamRecoverFinishReq* pReq);
|
||||||
|
int32_t tDecodeSStreamRecoverFinishReq(SDecoder* pDecoder, SStreamRecoverFinishReq* pReq);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int64_t streamId;
|
int64_t streamId;
|
||||||
|
@ -521,8 +540,29 @@ int32_t streamProcessRetrieveRsp(SStreamTask* pTask, SStreamRetrieveRsp* pRsp);
|
||||||
int32_t streamTryExec(SStreamTask* pTask);
|
int32_t streamTryExec(SStreamTask* pTask);
|
||||||
int32_t streamSchedExec(SStreamTask* pTask);
|
int32_t streamSchedExec(SStreamTask* pTask);
|
||||||
|
|
||||||
typedef int32_t FTaskExpand(void* ahandle, SStreamTask* pTask);
|
int32_t streamScanExec(SStreamTask* pTask, int32_t batchSz);
|
||||||
|
|
||||||
|
// recover and fill history
|
||||||
|
// common
|
||||||
|
int32_t streamSetParamForRecover(SStreamTask* pTask);
|
||||||
|
int32_t streamRestoreParam(SStreamTask* pTask);
|
||||||
|
int32_t streamSetStatusNormal(SStreamTask* pTask);
|
||||||
|
// source level
|
||||||
|
int32_t streamSourceRecoverPrepareStep1(SStreamTask* pTask, int64_t ver);
|
||||||
|
int32_t streamBuildSourceRecover1Req(SStreamTask* pTask, SStreamRecoverStep1Req* pReq);
|
||||||
|
int32_t streamSourceRecoverScanStep1(SStreamTask* pTask);
|
||||||
|
int32_t streamBuildSourceRecover2Req(SStreamTask* pTask, SStreamRecoverStep2Req* pReq);
|
||||||
|
int32_t streamSourceRecoverScanStep2(SStreamTask* pTask, int64_t ver);
|
||||||
|
int32_t streamDispatchRecoverFinishReq(SStreamTask* pTask);
|
||||||
|
// agg level
|
||||||
|
int32_t streamAggRecoverPrepare(SStreamTask* pTask);
|
||||||
|
// int32_t streamAggChildrenRecoverFinish(SStreamTask* pTask);
|
||||||
|
int32_t streamProcessRecoverFinishReq(SStreamTask* pTask, int32_t childId);
|
||||||
|
|
||||||
|
// expand and deploy
|
||||||
|
typedef int32_t FTaskExpand(void* ahandle, SStreamTask* pTask, int64_t ver);
|
||||||
|
|
||||||
|
// meta
|
||||||
typedef struct SStreamMeta {
|
typedef struct SStreamMeta {
|
||||||
char* path;
|
char* path;
|
||||||
TDB* db;
|
TDB* db;
|
||||||
|
@ -533,12 +573,13 @@ typedef struct SStreamMeta {
|
||||||
void* ahandle;
|
void* ahandle;
|
||||||
TXN txn;
|
TXN txn;
|
||||||
FTaskExpand* expandFunc;
|
FTaskExpand* expandFunc;
|
||||||
|
int32_t vgId;
|
||||||
} SStreamMeta;
|
} SStreamMeta;
|
||||||
|
|
||||||
SStreamMeta* streamMetaOpen(const char* path, void* ahandle, FTaskExpand expandFunc);
|
SStreamMeta* streamMetaOpen(const char* path, void* ahandle, FTaskExpand expandFunc, int32_t vgId);
|
||||||
void streamMetaClose(SStreamMeta* streamMeta);
|
void streamMetaClose(SStreamMeta* streamMeta);
|
||||||
|
|
||||||
// int32_t streamMetaAddTask(SStreamMeta* pMeta, SStreamTask* pTask);
|
int32_t streamMetaAddTask(SStreamMeta* pMeta, int64_t ver, SStreamTask* pTask);
|
||||||
int32_t streamMetaAddSerializedTask(SStreamMeta* pMeta, int64_t startVer, char* msg, int32_t msgLen);
|
int32_t streamMetaAddSerializedTask(SStreamMeta* pMeta, int64_t startVer, char* msg, int32_t msgLen);
|
||||||
int32_t streamMetaRemoveTask(SStreamMeta* pMeta, int32_t taskId);
|
int32_t streamMetaRemoveTask(SStreamMeta* pMeta, int32_t taskId);
|
||||||
SStreamTask* streamMetaGetTask(SStreamMeta* pMeta, int32_t taskId);
|
SStreamTask* streamMetaGetTask(SStreamMeta* pMeta, int32_t taskId);
|
||||||
|
|
|
@ -38,7 +38,7 @@ extern bool gRaftDetailLog;
|
||||||
#define SYNC_DEL_WAL_MS (1000 * 60)
|
#define SYNC_DEL_WAL_MS (1000 * 60)
|
||||||
#define SYNC_ADD_QUORUM_COUNT 3
|
#define SYNC_ADD_QUORUM_COUNT 3
|
||||||
#define SYNC_MNODE_LOG_RETENTION 10000
|
#define SYNC_MNODE_LOG_RETENTION 10000
|
||||||
#define SYNC_VNODE_LOG_RETENTION 500
|
#define SYNC_VNODE_LOG_RETENTION 100
|
||||||
|
|
||||||
#define SYNC_APPEND_ENTRIES_TIMEOUT_MS 10000
|
#define SYNC_APPEND_ENTRIES_TIMEOUT_MS 10000
|
||||||
|
|
||||||
|
@ -232,6 +232,8 @@ int32_t syncLeaderTransferTo(int64_t rid, SNodeInfo newLeader);
|
||||||
int32_t syncBeginSnapshot(int64_t rid, int64_t lastApplyIndex);
|
int32_t syncBeginSnapshot(int64_t rid, int64_t lastApplyIndex);
|
||||||
int32_t syncEndSnapshot(int64_t rid);
|
int32_t syncEndSnapshot(int64_t rid);
|
||||||
|
|
||||||
|
int32_t syncStepDown(int64_t rid, SyncTerm newTerm);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -678,24 +678,64 @@ void syncReconfigFinishPrint2(char* s, const SyncReconfigFinish* pMsg);
|
||||||
void syncReconfigFinishLog(const SyncReconfigFinish* pMsg);
|
void syncReconfigFinishLog(const SyncReconfigFinish* pMsg);
|
||||||
void syncReconfigFinishLog2(char* s, const SyncReconfigFinish* pMsg);
|
void syncReconfigFinishLog2(char* s, const SyncReconfigFinish* pMsg);
|
||||||
|
|
||||||
// on message ----------------------
|
// ---------------------------------------------
|
||||||
int32_t syncNodeOnPingCb(SSyncNode* ths, SyncPing* pMsg);
|
|
||||||
int32_t syncNodeOnPingReplyCb(SSyncNode* ths, SyncPingReply* pMsg);
|
typedef enum {
|
||||||
int32_t syncNodeOnTimer(SSyncNode* ths, SyncTimeout* pMsg);
|
SYNC_LOCAL_CMD_STEP_DOWN = 100,
|
||||||
|
} ESyncLocalCmd;
|
||||||
|
|
||||||
|
const char* syncLocalCmdGetStr(int32_t cmd);
|
||||||
|
|
||||||
|
typedef struct SyncLocalCmd {
|
||||||
|
uint32_t bytes;
|
||||||
|
int32_t vgId;
|
||||||
|
uint32_t msgType;
|
||||||
|
SRaftId srcId;
|
||||||
|
SRaftId destId;
|
||||||
|
|
||||||
|
int32_t cmd;
|
||||||
|
SyncTerm sdNewTerm; // step down new term
|
||||||
|
|
||||||
|
} SyncLocalCmd;
|
||||||
|
|
||||||
|
SyncLocalCmd* syncLocalCmdBuild(int32_t vgId);
|
||||||
|
void syncLocalCmdDestroy(SyncLocalCmd* pMsg);
|
||||||
|
void syncLocalCmdSerialize(const SyncLocalCmd* pMsg, char* buf, uint32_t bufLen);
|
||||||
|
void syncLocalCmdDeserialize(const char* buf, uint32_t len, SyncLocalCmd* pMsg);
|
||||||
|
char* syncLocalCmdSerialize2(const SyncLocalCmd* pMsg, uint32_t* len);
|
||||||
|
SyncLocalCmd* syncLocalCmdDeserialize2(const char* buf, uint32_t len);
|
||||||
|
void syncLocalCmd2RpcMsg(const SyncLocalCmd* pMsg, SRpcMsg* pRpcMsg);
|
||||||
|
void syncLocalCmdFromRpcMsg(const SRpcMsg* pRpcMsg, SyncLocalCmd* pMsg);
|
||||||
|
SyncLocalCmd* syncLocalCmdFromRpcMsg2(const SRpcMsg* pRpcMsg);
|
||||||
|
cJSON* syncLocalCmd2Json(const SyncLocalCmd* pMsg);
|
||||||
|
char* syncLocalCmd2Str(const SyncLocalCmd* pMsg);
|
||||||
|
|
||||||
|
// for debug ----------------------
|
||||||
|
void syncLocalCmdPrint(const SyncLocalCmd* pMsg);
|
||||||
|
void syncLocalCmdPrint2(char* s, const SyncLocalCmd* pMsg);
|
||||||
|
void syncLocalCmdLog(const SyncLocalCmd* pMsg);
|
||||||
|
void syncLocalCmdLog2(char* s, const SyncLocalCmd* pMsg);
|
||||||
|
|
||||||
|
// on message ----------------------
|
||||||
|
int32_t syncNodeOnPing(SSyncNode* ths, SyncPing* pMsg);
|
||||||
|
int32_t syncNodeOnPingReply(SSyncNode* ths, SyncPingReply* pMsg);
|
||||||
|
|
||||||
int32_t syncNodeOnHeartbeat(SSyncNode* ths, SyncHeartbeat* pMsg);
|
|
||||||
int32_t syncNodeOnHeartbeatReply(SSyncNode* ths, SyncHeartbeatReply* pMsg);
|
|
||||||
int32_t syncNodeOnClientRequest(SSyncNode* ths, SyncClientRequest* pMsg, SyncIndex* pRetIndex);
|
|
||||||
int32_t syncNodeOnRequestVote(SSyncNode* ths, SyncRequestVote* pMsg);
|
int32_t syncNodeOnRequestVote(SSyncNode* ths, SyncRequestVote* pMsg);
|
||||||
int32_t syncNodeOnRequestVoteReply(SSyncNode* ths, SyncRequestVoteReply* pMsg);
|
int32_t syncNodeOnRequestVoteReply(SSyncNode* ths, SyncRequestVoteReply* pMsg);
|
||||||
|
|
||||||
int32_t syncNodeOnAppendEntries(SSyncNode* ths, SyncAppendEntries* pMsg);
|
int32_t syncNodeOnAppendEntries(SSyncNode* ths, SyncAppendEntries* pMsg);
|
||||||
int32_t syncNodeOnAppendEntriesReply(SSyncNode* ths, SyncAppendEntriesReply* pMsg);
|
int32_t syncNodeOnAppendEntriesReply(SSyncNode* ths, SyncAppendEntriesReply* pMsg);
|
||||||
|
|
||||||
int32_t syncNodeOnSnapshot(SSyncNode* ths, SyncSnapshotSend* pMsg);
|
int32_t syncNodeOnSnapshot(SSyncNode* ths, SyncSnapshotSend* pMsg);
|
||||||
int32_t syncNodeOnSnapshotReply(SSyncNode* ths, SyncSnapshotRsp* pMsg);
|
int32_t syncNodeOnSnapshotReply(SSyncNode* ths, SyncSnapshotRsp* pMsg);
|
||||||
|
|
||||||
int32_t syncNodeOnHeartbeat(SSyncNode* ths, SyncHeartbeat* pMsg);
|
int32_t syncNodeOnHeartbeat(SSyncNode* ths, SyncHeartbeat* pMsg);
|
||||||
int32_t syncNodeOnHeartbeatReply(SSyncNode* ths, SyncHeartbeatReply* pMsg);
|
int32_t syncNodeOnHeartbeatReply(SSyncNode* ths, SyncHeartbeatReply* pMsg);
|
||||||
|
|
||||||
|
int32_t syncNodeOnClientRequest(SSyncNode* ths, SyncClientRequest* pMsg, SyncIndex* pRetIndex);
|
||||||
|
int32_t syncNodeOnTimer(SSyncNode* ths, SyncTimeout* pMsg);
|
||||||
|
int32_t syncNodeOnLocalCmd(SSyncNode* ths, SyncLocalCmd* pMsg);
|
||||||
|
|
||||||
// -----------------------------------------
|
// -----------------------------------------
|
||||||
typedef int32_t (*FpOnPingCb)(SSyncNode* ths, SyncPing* pMsg);
|
typedef int32_t (*FpOnPingCb)(SSyncNode* ths, SyncPing* pMsg);
|
||||||
typedef int32_t (*FpOnPingReplyCb)(SSyncNode* ths, SyncPingReply* pMsg);
|
typedef int32_t (*FpOnPingReplyCb)(SSyncNode* ths, SyncPingReply* pMsg);
|
||||||
|
|
|
@ -33,16 +33,16 @@ extern "C" {
|
||||||
#define wTrace(...) { if (wDebugFlag & DEBUG_TRACE) { taosPrintLog("WAL ", DEBUG_TRACE, wDebugFlag, __VA_ARGS__); }}
|
#define wTrace(...) { if (wDebugFlag & DEBUG_TRACE) { taosPrintLog("WAL ", DEBUG_TRACE, wDebugFlag, __VA_ARGS__); }}
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
#define WAL_PROTO_VER 0
|
#define WAL_PROTO_VER 0
|
||||||
#define WAL_NOSUFFIX_LEN 20
|
#define WAL_NOSUFFIX_LEN 20
|
||||||
#define WAL_SUFFIX_AT (WAL_NOSUFFIX_LEN + 1)
|
#define WAL_SUFFIX_AT (WAL_NOSUFFIX_LEN + 1)
|
||||||
#define WAL_LOG_SUFFIX "log"
|
#define WAL_LOG_SUFFIX "log"
|
||||||
#define WAL_INDEX_SUFFIX "idx"
|
#define WAL_INDEX_SUFFIX "idx"
|
||||||
#define WAL_REFRESH_MS 1000
|
#define WAL_REFRESH_MS 1000
|
||||||
#define WAL_PATH_LEN (TSDB_FILENAME_LEN + 12)
|
#define WAL_PATH_LEN (TSDB_FILENAME_LEN + 12)
|
||||||
#define WAL_FILE_LEN (WAL_PATH_LEN + 32)
|
#define WAL_FILE_LEN (WAL_PATH_LEN + 32)
|
||||||
#define WAL_MAGIC 0xFAFBFCFDF4F3F2F1ULL
|
#define WAL_MAGIC 0xFAFBFCFDF4F3F2F1ULL
|
||||||
#define WAL_SCAN_BUF_SIZE (1024 * 1024 * 3)
|
#define WAL_SCAN_BUF_SIZE (1024 * 1024 * 3)
|
||||||
#define WAL_RECOV_SIZE_LIMIT (100 * WAL_SCAN_BUF_SIZE)
|
#define WAL_RECOV_SIZE_LIMIT (100 * WAL_SCAN_BUF_SIZE)
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -204,7 +204,6 @@ SWalRef *walRefCommittedVer(SWal *);
|
||||||
SWalRef *walOpenRef(SWal *);
|
SWalRef *walOpenRef(SWal *);
|
||||||
void walCloseRef(SWal *pWal, int64_t refId);
|
void walCloseRef(SWal *pWal, int64_t refId);
|
||||||
int32_t walRefVer(SWalRef *, int64_t ver);
|
int32_t walRefVer(SWalRef *, int64_t ver);
|
||||||
int32_t walPreRefVer(SWalRef *pRef, int64_t ver);
|
|
||||||
void walUnrefVer(SWalRef *);
|
void walUnrefVer(SWalRef *);
|
||||||
|
|
||||||
// helper function for raft
|
// helper function for raft
|
||||||
|
|
|
@ -36,6 +36,7 @@ void *taosMemoryStrDup(const char *ptr);
|
||||||
void taosMemoryFree(void *ptr);
|
void taosMemoryFree(void *ptr);
|
||||||
int64_t taosMemorySize(void *ptr);
|
int64_t taosMemorySize(void *ptr);
|
||||||
void taosPrintBackTrace();
|
void taosPrintBackTrace();
|
||||||
|
void taosMemoryTrim(int32_t size);
|
||||||
|
|
||||||
#define taosMemoryFreeClear(ptr) \
|
#define taosMemoryFreeClear(ptr) \
|
||||||
do { \
|
do { \
|
||||||
|
|
|
@ -38,7 +38,6 @@ extern "C" {
|
||||||
#define TARRAY_MIN_SIZE 8
|
#define TARRAY_MIN_SIZE 8
|
||||||
#define TARRAY_GET_ELEM(array, index) ((void*)((char*)((array)->pData) + (index) * (array)->elemSize))
|
#define TARRAY_GET_ELEM(array, index) ((void*)((char*)((array)->pData) + (index) * (array)->elemSize))
|
||||||
#define TARRAY_ELEM_IDX(array, ele) (POINTER_DISTANCE(ele, (array)->pData) / (array)->elemSize)
|
#define TARRAY_ELEM_IDX(array, ele) (POINTER_DISTANCE(ele, (array)->pData) / (array)->elemSize)
|
||||||
#define TARRAY_GET_START(array) ((array)->pData)
|
|
||||||
|
|
||||||
typedef struct SArray {
|
typedef struct SArray {
|
||||||
size_t size;
|
size_t size;
|
||||||
|
@ -71,14 +70,6 @@ int32_t taosArrayEnsureCap(SArray* pArray, size_t tsize);
|
||||||
*/
|
*/
|
||||||
void* taosArrayAddBatch(SArray* pArray, const void* pData, int32_t nEles);
|
void* taosArrayAddBatch(SArray* pArray, const void* pData, int32_t nEles);
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param pArray
|
|
||||||
* @param pData position array list
|
|
||||||
* @param numOfElems the number of removed position
|
|
||||||
*/
|
|
||||||
void taosArrayRemoveBatch(SArray* pArray, const int32_t* pData, int32_t numOfElems);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param pArray
|
* @param pArray
|
||||||
|
@ -266,13 +257,6 @@ void* taosArraySearch(const SArray* pArray, const void* key, __compar_fn_t compa
|
||||||
*/
|
*/
|
||||||
int32_t taosArraySearchIdx(const SArray* pArray, const void* key, __compar_fn_t comparFn, int32_t flags);
|
int32_t taosArraySearchIdx(const SArray* pArray, const void* key, __compar_fn_t comparFn, int32_t flags);
|
||||||
|
|
||||||
/**
|
|
||||||
* search the array
|
|
||||||
* @param pArray
|
|
||||||
* @param key
|
|
||||||
*/
|
|
||||||
char* taosArraySearchString(const SArray* pArray, const char* key, __compar_fn_t comparFn, int32_t flags);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sort the pointer data in the array
|
* sort the pointer data in the array
|
||||||
* @param pArray
|
* @param pArray
|
||||||
|
@ -286,8 +270,6 @@ void taosArraySortPWithExt(SArray* pArray, __ext_compar_fn_t fn, const void* par
|
||||||
int32_t taosEncodeArray(void** buf, const SArray* pArray, FEncode encode);
|
int32_t taosEncodeArray(void** buf, const SArray* pArray, FEncode encode);
|
||||||
void* taosDecodeArray(const void* buf, SArray** pArray, FDecode decode, int32_t dataSz);
|
void* taosDecodeArray(const void* buf, SArray** pArray, FDecode decode, int32_t dataSz);
|
||||||
|
|
||||||
char* taosShowStrArray(const SArray* pArray);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* swap array
|
* swap array
|
||||||
* @param a
|
* @param a
|
||||||
|
@ -295,6 +277,7 @@ char* taosShowStrArray(const SArray* pArray);
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
void taosArraySwap(SArray* a, SArray* b);
|
void taosArraySwap(SArray* a, SArray* b);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -234,9 +234,9 @@ typedef enum ELogicConditionType {
|
||||||
* - Secondly, if all cols are VarDataT type except primary key, we need 4 bits to store the offset, thus
|
* - Secondly, if all cols are VarDataT type except primary key, we need 4 bits to store the offset, thus
|
||||||
* the final value is 65531-(4096-1)*4 = 49151.
|
* the final value is 65531-(4096-1)*4 = 49151.
|
||||||
*/
|
*/
|
||||||
#define TSDB_MAX_BYTES_PER_ROW 49151
|
#define TSDB_MAX_BYTES_PER_ROW 49151
|
||||||
#define TSDB_MAX_TAGS_LEN 16384
|
#define TSDB_MAX_TAGS_LEN 16384
|
||||||
#define TSDB_MAX_TAGS 128
|
#define TSDB_MAX_TAGS 128
|
||||||
|
|
||||||
#define TSDB_MAX_COL_TAG_NUM (TSDB_MAX_COLUMNS + TSDB_MAX_TAGS)
|
#define TSDB_MAX_COL_TAG_NUM (TSDB_MAX_COLUMNS + TSDB_MAX_TAGS)
|
||||||
#define TSDB_MAX_JSON_TAG_LEN 16384
|
#define TSDB_MAX_JSON_TAG_LEN 16384
|
||||||
|
@ -360,7 +360,7 @@ typedef enum ELogicConditionType {
|
||||||
#define TSDB_DEFAULT_DB_SCHEMALESS TSDB_DB_SCHEMALESS_OFF
|
#define TSDB_DEFAULT_DB_SCHEMALESS TSDB_DB_SCHEMALESS_OFF
|
||||||
#define TSDB_MIN_STT_TRIGGER 1
|
#define TSDB_MIN_STT_TRIGGER 1
|
||||||
#define TSDB_MAX_STT_TRIGGER 16
|
#define TSDB_MAX_STT_TRIGGER 16
|
||||||
#define TSDB_DEFAULT_SST_TRIGGER 8
|
#define TSDB_DEFAULT_SST_TRIGGER 1
|
||||||
#define TSDB_MIN_HASH_PREFIX 0
|
#define TSDB_MIN_HASH_PREFIX 0
|
||||||
#define TSDB_MAX_HASH_PREFIX 128
|
#define TSDB_MAX_HASH_PREFIX 128
|
||||||
#define TSDB_DEFAULT_HASH_PREFIX 0
|
#define TSDB_DEFAULT_HASH_PREFIX 0
|
||||||
|
@ -370,13 +370,13 @@ typedef enum ELogicConditionType {
|
||||||
|
|
||||||
#define TSDB_DB_MIN_WAL_RETENTION_PERIOD -1
|
#define TSDB_DB_MIN_WAL_RETENTION_PERIOD -1
|
||||||
#define TSDB_REP_DEF_DB_WAL_RET_PERIOD 0
|
#define TSDB_REP_DEF_DB_WAL_RET_PERIOD 0
|
||||||
#define TSDB_REPS_DEF_DB_WAL_RET_PERIOD (24 * 60 * 60 * 4)
|
#define TSDB_REPS_DEF_DB_WAL_RET_PERIOD 0
|
||||||
#define TSDB_DB_MIN_WAL_RETENTION_SIZE -1
|
#define TSDB_DB_MIN_WAL_RETENTION_SIZE -1
|
||||||
#define TSDB_REP_DEF_DB_WAL_RET_SIZE 0
|
#define TSDB_REP_DEF_DB_WAL_RET_SIZE 0
|
||||||
#define TSDB_REPS_DEF_DB_WAL_RET_SIZE -1
|
#define TSDB_REPS_DEF_DB_WAL_RET_SIZE 0
|
||||||
#define TSDB_DB_MIN_WAL_ROLL_PERIOD 0
|
#define TSDB_DB_MIN_WAL_ROLL_PERIOD 0
|
||||||
#define TSDB_REP_DEF_DB_WAL_ROLL_PERIOD 0
|
#define TSDB_REP_DEF_DB_WAL_ROLL_PERIOD 0
|
||||||
#define TSDB_REPS_DEF_DB_WAL_ROLL_PERIOD (24 * 60 * 60 * 1)
|
#define TSDB_REPS_DEF_DB_WAL_ROLL_PERIOD 0
|
||||||
#define TSDB_DB_MIN_WAL_SEGMENT_SIZE 0
|
#define TSDB_DB_MIN_WAL_SEGMENT_SIZE 0
|
||||||
#define TSDB_DEFAULT_DB_WAL_SEGMENT_SIZE 0
|
#define TSDB_DEFAULT_DB_WAL_SEGMENT_SIZE 0
|
||||||
|
|
||||||
|
@ -409,7 +409,7 @@ typedef enum ELogicConditionType {
|
||||||
#define TSDB_MAX_RPC_THREADS 10
|
#define TSDB_MAX_RPC_THREADS 10
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define TSDB_QUERY_TYPE_NON_TYPE 0x00u // none type
|
#define TSDB_QUERY_TYPE_NON_TYPE 0x00u // none type
|
||||||
|
|
||||||
#define TSDB_META_COMPACT_RATIO 0 // disable tsdb meta compact by default
|
#define TSDB_META_COMPACT_RATIO 0 // disable tsdb meta compact by default
|
||||||
|
|
||||||
|
@ -486,7 +486,7 @@ enum {
|
||||||
|
|
||||||
#define MAX_NUM_STR_SIZE 40
|
#define MAX_NUM_STR_SIZE 40
|
||||||
|
|
||||||
#define MAX_META_MSG_IN_BATCH 1048576
|
#define MAX_META_MSG_IN_BATCH 1048576
|
||||||
#define MAX_META_BATCH_RSP_SIZE (1 * 1048576 * 1024)
|
#define MAX_META_BATCH_RSP_SIZE (1 * 1048576 * 1024)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -1,56 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
|
||||||
*
|
|
||||||
* This program is free software: you can use, redistribute, and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License, version 3
|
|
||||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
#ifndef _TD_UTIL_FUNCTIONAL_H_
|
|
||||||
#define _TD_UTIL_FUNCTIONAL_H_
|
|
||||||
|
|
||||||
#include "os.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// TODO: hard to use, trying to rewrite it using va_list
|
|
||||||
|
|
||||||
typedef void* (*GenericVaFunc)(void* args[]);
|
|
||||||
typedef int32_t (*I32VaFunc)(void* args[]);
|
|
||||||
typedef void (*VoidVaFunc)(void* args[]);
|
|
||||||
|
|
||||||
typedef struct GenericSavedFunc {
|
|
||||||
GenericVaFunc func;
|
|
||||||
void* args[];
|
|
||||||
} tGenericSavedFunc;
|
|
||||||
|
|
||||||
typedef struct I32SavedFunc {
|
|
||||||
I32VaFunc func;
|
|
||||||
void* args[];
|
|
||||||
} tI32SavedFunc;
|
|
||||||
|
|
||||||
typedef struct VoidSavedFunc {
|
|
||||||
VoidVaFunc func;
|
|
||||||
void* args[];
|
|
||||||
} tVoidSavedFunc;
|
|
||||||
|
|
||||||
tGenericSavedFunc* genericSavedFuncInit(GenericVaFunc func, int32_t numOfArgs);
|
|
||||||
tI32SavedFunc* i32SavedFuncInit(I32VaFunc func, int32_t numOfArgs);
|
|
||||||
tVoidSavedFunc* voidSavedFuncInit(VoidVaFunc func, int32_t numOfArgs);
|
|
||||||
void* genericInvoke(tGenericSavedFunc* const pSavedFunc);
|
|
||||||
int32_t i32Invoke(tI32SavedFunc* const pSavedFunc);
|
|
||||||
void voidInvoke(tVoidSavedFunc* const pSavedFunc);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /*_TD_UTIL_FUNCTIONAL_H_*/
|
|
|
@ -19,7 +19,6 @@
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
#include "taos.h"
|
#include "taos.h"
|
||||||
#include "tarray.h"
|
#include "tarray.h"
|
||||||
#include "tfunctional.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -67,7 +66,6 @@ typedef struct SSkipList {
|
||||||
uint32_t size;
|
uint32_t size;
|
||||||
SSkipListNode *pHead; // point to the first element
|
SSkipListNode *pHead; // point to the first element
|
||||||
SSkipListNode *pTail; // point to the last element
|
SSkipListNode *pTail; // point to the last element
|
||||||
tGenericSavedFunc *insertHandleFn;
|
|
||||||
} SSkipList;
|
} SSkipList;
|
||||||
|
|
||||||
typedef struct SSkipListIterator {
|
typedef struct SSkipListIterator {
|
||||||
|
|
|
@ -5,42 +5,50 @@
|
||||||
# #
|
# #
|
||||||
########################################################
|
########################################################
|
||||||
|
|
||||||
# The end point of the first dnode in the cluster to be connected to when `taosd` or `taos` is started
|
######### 0. Client only configurations #############
|
||||||
|
|
||||||
|
# The interval for TDengine CLI to send heartbeat to mnode
|
||||||
|
# shellActivityTimer 3
|
||||||
|
|
||||||
|
|
||||||
|
############### 1. Cluster End point ############################
|
||||||
|
|
||||||
|
# The end point of the first dnode in the cluster to be connected to when this dnode or a TDengine CLI `taos` is started
|
||||||
# firstEp hostname:6030
|
# firstEp hostname:6030
|
||||||
|
|
||||||
# The end point of the second dnode to be connected to if the firstEp is not available when `taosd` or `taos` is started
|
# The end point of the second dnode to be connected to if the firstEp is not available
|
||||||
# secondEp
|
# secondEp
|
||||||
|
|
||||||
# The FQDN of the host where `taosd` will be started. It can be IP address
|
|
||||||
|
############### 2. Configuration Parameters of current dnode #####
|
||||||
|
|
||||||
|
# The FQDN of the host on which this dnode will be started. It can be IP address
|
||||||
# fqdn hostname
|
# fqdn hostname
|
||||||
|
|
||||||
# The port for external access after `taosd` is started
|
# The port for external access after this dnode is started
|
||||||
# serverPort 6030
|
# serverPort 6030
|
||||||
|
|
||||||
# The maximum number of connections a dnode can accept
|
# The maximum number of connections a dnode can accept
|
||||||
# maxShellConns 5000
|
# maxShellConns 5000
|
||||||
|
|
||||||
# The directory for writing log files
|
# The directory for writing log files, if you are using Windows platform please change to Windows path
|
||||||
# logDir /var/log/taos
|
# logDir /var/log/taos
|
||||||
|
|
||||||
# All data files are stored in this directory
|
# All data files are stored in this directory, if you are using Windows platform please change to Windows path
|
||||||
# dataDir /var/lib/taos
|
# dataDir /var/lib/taos
|
||||||
|
|
||||||
# temporary file's directory
|
# temporary file's directory, if you are using Windows platform please change to Windows path
|
||||||
# tempDir /tmp/
|
# tempDir /tmp/
|
||||||
|
|
||||||
# Switch for allowing TDengine to collect and report service usage information
|
# Switch for allowing TDengine to collect and report service usage information
|
||||||
# telemetryReporting 1
|
# telemetryReporting 1
|
||||||
|
|
||||||
# The maximum number of vnodes supported by dnode
|
# The maximum number of vnodes supported by this dnode
|
||||||
# supportVnodes 0
|
# supportVnodes 0
|
||||||
|
|
||||||
# The interval of dnode reporting status to mnode
|
# The interval of this dnode reporting status to mnode, [1..10] seconds
|
||||||
# statusInterval 1
|
# statusInterval 1
|
||||||
|
|
||||||
# The interval for TDengine CLI to send heartbeat to mnode
|
|
||||||
# shellActivityTimer 3
|
|
||||||
|
|
||||||
# The minimum sliding window time, milli-second
|
# The minimum sliding window time, milli-second
|
||||||
# minSlidingTime 10
|
# minSlidingTime 10
|
||||||
|
|
||||||
|
@ -66,13 +74,14 @@
|
||||||
|
|
||||||
# system time zone
|
# system time zone
|
||||||
# timezone Asia/Shanghai (CST, +0800)
|
# timezone Asia/Shanghai (CST, +0800)
|
||||||
|
|
||||||
# system time zone (for windows 10)
|
# system time zone (for windows 10)
|
||||||
# timezone UTC-8
|
# timezone UTC-8
|
||||||
|
|
||||||
# system locale
|
# system locale
|
||||||
# locale en_US.UTF-8
|
# locale en_US.UTF-8
|
||||||
|
|
||||||
# default system charset
|
# system charset
|
||||||
# charset UTF-8
|
# charset UTF-8
|
||||||
|
|
||||||
# stop writing logs when the disk size of the log folder is less than this value
|
# stop writing logs when the disk size of the log folder is less than this value
|
||||||
|
@ -81,7 +90,7 @@
|
||||||
# stop writing temporary files when the disk size of the tmp folder is less than this value
|
# stop writing temporary files when the disk size of the tmp folder is less than this value
|
||||||
# minimalTmpDirGB 1.0
|
# minimalTmpDirGB 1.0
|
||||||
|
|
||||||
# if disk free space is less than this value, taosd service exit directly within startup process
|
# if free disk space is less than this value, this dnode will fail to start
|
||||||
# minimalDataDirGB 2.0
|
# minimalDataDirGB 2.0
|
||||||
|
|
||||||
# enable/disable system monitor
|
# enable/disable system monitor
|
||||||
|
@ -91,14 +100,18 @@
|
||||||
# max number of lines per log filters
|
# max number of lines per log filters
|
||||||
# numOfLogLines 10000000
|
# numOfLogLines 10000000
|
||||||
|
|
||||||
# enable/disable async log
|
# write log in async way: 1 - async, 0 - sync
|
||||||
# asyncLog 1
|
# asyncLog 1
|
||||||
|
|
||||||
# time of keeping log files, days
|
# time period of keeping log files, in days
|
||||||
# logKeepDays 0
|
# logKeepDays 0
|
||||||
|
|
||||||
# The following parameters are used for debug purpose only.
|
|
||||||
# debugFlag 8 bits mask: FILE-SCREEN-UNUSED-HeartBeat-DUMP-TRACE_WARN-ERROR
|
############ 3. Debug Flag and levels #############################################
|
||||||
|
|
||||||
|
# The following parameters are used for debug purpose only by this dnode.
|
||||||
|
# debugFlag is a 8 bits mask: FILE-SCREEN-UNUSED-HeartBeat-DUMP-TRACE_WARN-ERROR
|
||||||
|
# Available debug levels are:
|
||||||
# 131: output warning and error
|
# 131: output warning and error
|
||||||
# 135: output debug, warning and error
|
# 135: output debug, warning and error
|
||||||
# 143: output trace, debug, warning and error to log
|
# 143: output trace, debug, warning and error to log
|
||||||
|
@ -166,4 +179,4 @@
|
||||||
# metaDebugFlag 131
|
# metaDebugFlag 131
|
||||||
|
|
||||||
# generate core file when service crash
|
# generate core file when service crash
|
||||||
# enableCoreFile 1
|
# enableCoreFile 1
|
|
@ -0,0 +1,26 @@
|
||||||
|
FROM ubuntu:18.04
|
||||||
|
|
||||||
|
WORKDIR /root
|
||||||
|
|
||||||
|
ARG pkgFile
|
||||||
|
ARG dirName
|
||||||
|
ARG cpuType
|
||||||
|
RUN echo ${pkgFile} && echo ${dirName}
|
||||||
|
|
||||||
|
COPY ${pkgFile} /root/
|
||||||
|
ENV TINI_VERSION v0.19.0
|
||||||
|
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${cpuType} /tini
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
WORKDIR /root/
|
||||||
|
RUN tar -zxf ${pkgFile} && cd /root/${dirName}/ && /bin/bash install.sh -e no && cd /root && rm /root/${pkgFile} && rm -rf /root/${dirName} && apt-get update && apt-get install -y locales tzdata netcat && locale-gen en_US.UTF-8 && apt-get clean && rm -rf /var/lib/apt/lists/ && chmod +x /tini
|
||||||
|
|
||||||
|
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib" \
|
||||||
|
LC_CTYPE=en_US.UTF-8 \
|
||||||
|
LANG=en_US.UTF-8 \
|
||||||
|
LC_ALL=en_US.UTF-8
|
||||||
|
COPY ./run.sh /usr/bin/
|
||||||
|
COPY ./bin/* /usr/bin/
|
||||||
|
|
||||||
|
ENTRYPOINT ["/tini", "--", "/usr/bin/entrypoint.sh"]
|
||||||
|
CMD ["bash", "-c", "/usr/bin/run.sh"]
|
||||||
|
VOLUME [ "/var/lib/taos", "/var/log/taos", "/corefile" ]
|
|
@ -19,8 +19,9 @@ passWord=""
|
||||||
pkgFile=""
|
pkgFile=""
|
||||||
verType="stable"
|
verType="stable"
|
||||||
dockerLatest="n"
|
dockerLatest="n"
|
||||||
|
cloudBuild="n"
|
||||||
|
|
||||||
while getopts "hc:n:p:f:V:a:b:" arg
|
while getopts "hc:n:p:f:V:a:b:d:" arg
|
||||||
do
|
do
|
||||||
case $arg in
|
case $arg in
|
||||||
c)
|
c)
|
||||||
|
@ -47,6 +48,10 @@ do
|
||||||
#echo "verType=$OPTARG"
|
#echo "verType=$OPTARG"
|
||||||
verType=$(echo $OPTARG)
|
verType=$(echo $OPTARG)
|
||||||
;;
|
;;
|
||||||
|
d)
|
||||||
|
#echo "cloudBuild=$OPTARG"
|
||||||
|
cloudBuild=$(echo $OPTARG)
|
||||||
|
;;
|
||||||
a)
|
a)
|
||||||
#echo "dockerLatest=$OPTARG"
|
#echo "dockerLatest=$OPTARG"
|
||||||
dockerLatest=$(echo $OPTARG)
|
dockerLatest=$(echo $OPTARG)
|
||||||
|
@ -58,6 +63,7 @@ do
|
||||||
echo " -V [stable | beta] "
|
echo " -V [stable | beta] "
|
||||||
echo " -f [pkg file] "
|
echo " -f [pkg file] "
|
||||||
echo " -a [y | n ] "
|
echo " -a [y | n ] "
|
||||||
|
echo " -d [cloud build ] "
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
?) #unknow option
|
?) #unknow option
|
||||||
|
@ -83,6 +89,9 @@ else
|
||||||
echo "unknow verType, nor stabel or beta"
|
echo "unknow verType, nor stabel or beta"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
if [ "$cloudBuild" == "y" ]; then
|
||||||
|
dockername=cloud-${dockername}
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
echo "cpuType=${cpuType} version=${version} pkgFile=${pkgFile} verType=${verType} "
|
echo "cpuType=${cpuType} version=${version} pkgFile=${pkgFile} verType=${verType} "
|
||||||
|
@ -90,10 +99,15 @@ echo "$(pwd)"
|
||||||
echo "====NOTES: ${pkgFile} must be in the same directory as dockerbuild.sh===="
|
echo "====NOTES: ${pkgFile} must be in the same directory as dockerbuild.sh===="
|
||||||
|
|
||||||
scriptDir=$(dirname $(readlink -f $0))
|
scriptDir=$(dirname $(readlink -f $0))
|
||||||
comunityArchiveDir=/nas/TDengine/v$version/community # community version’package directory
|
|
||||||
communityDir=${scriptDir}/../../../community
|
communityDir=${scriptDir}/../../../community
|
||||||
DockerfilePath=${communityDir}/packaging/docker/
|
DockerfilePath=${communityDir}/packaging/docker/
|
||||||
Dockerfile=${communityDir}/packaging/docker/Dockerfile
|
if [ "$cloudBuild" == "y" ]; then
|
||||||
|
comunityArchiveDir=/nas/TDengine/v$version/cloud
|
||||||
|
Dockerfile=${communityDir}/packaging/docker/DockerfileCloud
|
||||||
|
else
|
||||||
|
comunityArchiveDir=/nas/TDengine/v$version/community
|
||||||
|
Dockerfile=${communityDir}/packaging/docker/Dockerfile
|
||||||
|
fi
|
||||||
cd ${scriptDir}
|
cd ${scriptDir}
|
||||||
cp -f ${comunityArchiveDir}/${pkgFile} .
|
cp -f ${comunityArchiveDir}/${pkgFile} .
|
||||||
|
|
||||||
|
@ -111,42 +125,15 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
docker build --rm -f "${Dockerfile}" --network=host -t tdengine/tdengine-${dockername}:${version} "." --build-arg pkgFile=${pkgFile} --build-arg dirName=${dirName} --build-arg cpuType=${cpuTypeAlias}
|
docker build --rm -f "${Dockerfile}" --network=host -t tdengine/tdengine-${dockername}:${version} "." --build-arg pkgFile=${pkgFile} --build-arg dirName=${dirName} --build-arg cpuType=${cpuTypeAlias}
|
||||||
docker login -u tdengine -p ${passWord} #replace the docker registry username and password
|
if [ "$cloudBuild" != "y" ]; then
|
||||||
docker push tdengine/tdengine-${dockername}:${version}
|
docker login -u tdengine -p ${passWord} #replace the docker registry username and password
|
||||||
|
docker push tdengine/tdengine-${dockername}:${version}
|
||||||
if [ -n "$(docker ps -aq)" ] ;then
|
|
||||||
echo "delete docker process"
|
|
||||||
docker stop $(docker ps -aq)
|
|
||||||
docker rm $(docker ps -aq)
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$(pidof taosd)" ] ;then
|
|
||||||
echo "kill taosd "
|
|
||||||
kill -9 $(pidof taosd)
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$(pidof power)" ] ;then
|
|
||||||
echo "kill power "
|
|
||||||
kill -9 $(pidof power)
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
echo ">>>>>>>>>>>>> check whether tdengine/tdengine-${dockername}:${version} has been published"
|
|
||||||
docker run -d --name doctest -p 6030-6049:6030-6049 -p 6030-6049:6030-6049/udp tdengine/tdengine-${dockername}:${version}
|
|
||||||
sleep 2
|
|
||||||
curl -u root:taosdata -d 'show variables;' 127.0.0.1:6041/rest/sql > temp1.data
|
|
||||||
data_version=$( cat temp1.data |jq .data| jq '.[]' |grep "version" -A 2 -B 1 | jq ".[1]")
|
|
||||||
echo "${data_version}"
|
|
||||||
if [ "${data_version}" == "\"${version}\"" ] ; then
|
|
||||||
echo "docker version is right "
|
|
||||||
else
|
|
||||||
echo "docker version is wrong "
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
rm -rf temp1.data
|
|
||||||
|
|
||||||
# set this version to latest version
|
# set this version to latest version
|
||||||
if [ ${dockerLatest} == 'y' ] ;then
|
if [ "$cloudBuild" != "y" ] && [ ${dockerLatest} == 'y' ] ;then
|
||||||
docker tag tdengine/tdengine-${dockername}:${version} tdengine/tdengine-${dockername}:latest
|
docker tag tdengine/tdengine-${dockername}:${version} tdengine/tdengine-${dockername}:latest
|
||||||
docker push tdengine/tdengine-${dockername}:latest
|
docker push tdengine/tdengine-${dockername}:latest
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
rm -f ${pkgFile}
|
|
@ -0,0 +1,36 @@
|
||||||
|
#!/bin/bash
|
||||||
|
TAOS_RUN_TAOSBENCHMARK_TEST_ONCE=0
|
||||||
|
while ((1))
|
||||||
|
do
|
||||||
|
# echo "outer loop: $a"
|
||||||
|
sleep 10
|
||||||
|
output=`taos -k`
|
||||||
|
status=${output:0:1}
|
||||||
|
# echo $output
|
||||||
|
# echo $status
|
||||||
|
if [ "$status"x = "0"x ]
|
||||||
|
then
|
||||||
|
taosd &
|
||||||
|
fi
|
||||||
|
# echo "$status"x "$TAOS_RUN_TAOSBENCHMARK_TEST"x "$TAOS_RUN_TAOSBENCHMARK_TEST_ONCE"x
|
||||||
|
if [ "$status"x = "2"x ] && [ "$TAOS_RUN_TAOSBENCHMARK_TEST"x = "1"x ] && [ "$TAOS_RUN_TAOSBENCHMARK_TEST_ONCE"x = "0"x ]
|
||||||
|
then
|
||||||
|
TAOS_RUN_TAOSBENCHMARK_TEST_ONCE=1
|
||||||
|
# result=`taos -s "show databases;" | grep " test "`
|
||||||
|
# if [ "${result:0:5}"x != " test"x ]
|
||||||
|
# then
|
||||||
|
# taosBenchmark -y -t 1000 -n 1000 -S 900000
|
||||||
|
# fi
|
||||||
|
taos -s "select stable_name from information_schema.ins_stables where db_name = 'test';"|grep -q -w meters
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
taosBenchmark -y -t 1000 -n 1000 -S 900000
|
||||||
|
taos -s "create user admin_user pass 'NDS65R6t' sysinfo 0;"
|
||||||
|
taos -s "GRANT ALL on test.* to admin_user;"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
# check taosadapter
|
||||||
|
nc -z localhost 6041
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
taosadapter &
|
||||||
|
fi
|
||||||
|
done
|
|
@ -17,7 +17,7 @@ set -e
|
||||||
# -H [ false | true]
|
# -H [ false | true]
|
||||||
|
|
||||||
# set parameters by default value
|
# set parameters by default value
|
||||||
verMode=edge # [cluster, edge]
|
verMode=edge # [cluster, edge, cloud]
|
||||||
verType=stable # [stable, beta]
|
verType=stable # [stable, beta]
|
||||||
cpuType=x64 # [aarch32 | aarch64 | x64 | x86 | mips64 ...]
|
cpuType=x64 # [aarch32 | aarch64 | x64 | x86 | mips64 ...]
|
||||||
osType=Linux # [Linux | Kylin | Alpine | Raspberrypi | Darwin | Windows | Ningsi60 | Ningsi80 |...]
|
osType=Linux # [Linux | Kylin | Alpine | Raspberrypi | Darwin | Windows | Ningsi60 | Ningsi80 |...]
|
||||||
|
@ -169,7 +169,7 @@ build_time=$(date +"%F %R")
|
||||||
# get commint id from git
|
# get commint id from git
|
||||||
gitinfo=$(git rev-parse --verify HEAD)
|
gitinfo=$(git rev-parse --verify HEAD)
|
||||||
|
|
||||||
if [[ "$verMode" == "cluster" ]]; then
|
if [[ "$verMode" == "cluster" ]] || [[ "$verMode" == "cloud" ]]; then
|
||||||
enterprise_dir="${top_dir}/../enterprise"
|
enterprise_dir="${top_dir}/../enterprise"
|
||||||
cd ${enterprise_dir}
|
cd ${enterprise_dir}
|
||||||
gitinfoOfInternal=$(git rev-parse --verify HEAD)
|
gitinfoOfInternal=$(git rev-parse --verify HEAD)
|
||||||
|
@ -205,7 +205,7 @@ else
|
||||||
BUILD_HTTP=false
|
BUILD_HTTP=false
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$verMode" == "cluster" ]]; then
|
if [[ "$verMode" == "cluster" ]] || [[ "$verMode" == "cloud" ]]; then
|
||||||
BUILD_HTTP=internal
|
BUILD_HTTP=internal
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -217,10 +217,12 @@ fi
|
||||||
|
|
||||||
# check support cpu type
|
# check support cpu type
|
||||||
if [[ "$cpuType" == "x64" ]] || [[ "$cpuType" == "aarch64" ]] || [[ "$cpuType" == "aarch32" ]] || [[ "$cpuType" == "arm64" ]] || [[ "$cpuType" == "arm32" ]] || [[ "$cpuType" == "mips64" ]]; then
|
if [[ "$cpuType" == "x64" ]] || [[ "$cpuType" == "aarch64" ]] || [[ "$cpuType" == "aarch32" ]] || [[ "$cpuType" == "arm64" ]] || [[ "$cpuType" == "arm32" ]] || [[ "$cpuType" == "mips64" ]]; then
|
||||||
if [ "$verMode" != "cluster" ]; then
|
if [ "$verMode" == "edge" ]; then
|
||||||
# community-version compile
|
# community-version compile
|
||||||
cmake ../ -DCPUTYPE=${cpuType} -DWEBSOCKET=true -DOSTYPE=${osType} -DSOMODE=${soMode} -DDBNAME=${dbName} -DVERTYPE=${verType} -DVERDATE="${build_time}" -DGITINFO=${gitinfo} -DGITINFOI=${gitinfoOfInternal} -DVERNUMBER=${verNumber} -DVERCOMPATIBLE=${verNumberComp} -DPAGMODE=${pagMode} -DBUILD_HTTP=${BUILD_HTTP} -DBUILD_TOOLS=${BUILD_TOOLS} ${allocator_macro}
|
cmake ../ -DCPUTYPE=${cpuType} -DWEBSOCKET=true -DOSTYPE=${osType} -DSOMODE=${soMode} -DDBNAME=${dbName} -DVERTYPE=${verType} -DVERDATE="${build_time}" -DGITINFO=${gitinfo} -DGITINFOI=${gitinfoOfInternal} -DVERNUMBER=${verNumber} -DVERCOMPATIBLE=${verNumberComp} -DPAGMODE=${pagMode} -DBUILD_HTTP=${BUILD_HTTP} -DBUILD_TOOLS=${BUILD_TOOLS} ${allocator_macro}
|
||||||
else
|
elif [ "$verMode" == "cloud" ]; then
|
||||||
|
cmake ../../ -DCPUTYPE=${cpuType} -DWEBSOCKET=true -DBUILD_CLOUD=true -DOSTYPE=${osType} -DSOMODE=${soMode} -DDBNAME=${dbName} -DVERTYPE=${verType} -DVERDATE="${build_time}" -DGITINFO=${gitinfo} -DGITINFOI=${gitinfoOfInternal} -DVERNUMBER=${verNumber} -DVERCOMPATIBLE=${verNumberComp} -DBUILD_HTTP=${BUILD_HTTP} -DBUILD_TOOLS=${BUILD_TOOLS} ${allocator_macro}
|
||||||
|
elif [ "$verMode" == "cluster" ]; then
|
||||||
if [[ "$dbName" != "taos" ]]; then
|
if [[ "$dbName" != "taos" ]]; then
|
||||||
replace_enterprise_$dbName
|
replace_enterprise_$dbName
|
||||||
fi
|
fi
|
||||||
|
@ -244,7 +246,7 @@ cd ${curr_dir}
|
||||||
|
|
||||||
# 3. Call the corresponding script for packaging
|
# 3. Call the corresponding script for packaging
|
||||||
if [ "$osType" != "Darwin" ]; then
|
if [ "$osType" != "Darwin" ]; then
|
||||||
if [[ "$verMode" != "cluster" ]] && [[ "$pagMode" == "full" ]] && [[ "$cpuType" == "x64" ]] && [[ "$dbName" == "taos" ]]; then
|
if [[ "$verMode" != "cluster" ]] && [[ "$verMode" != "cloud" ]] && [[ "$pagMode" == "full" ]] && [[ "$cpuType" == "x64" ]] && [[ "$dbName" == "taos" ]]; then
|
||||||
ret='0'
|
ret='0'
|
||||||
command -v dpkg >/dev/null 2>&1 || { ret='1'; }
|
command -v dpkg >/dev/null 2>&1 || { ret='1'; }
|
||||||
if [ "$ret" -eq 0 ]; then
|
if [ "$ret" -eq 0 ]; then
|
||||||
|
|
|
@ -47,6 +47,15 @@ copy %binary_dir%\\build\\bin\\udfd.exe %tagert_dir% > nul
|
||||||
if exist %binary_dir%\\build\\bin\\taosBenchmark.exe (
|
if exist %binary_dir%\\build\\bin\\taosBenchmark.exe (
|
||||||
copy %binary_dir%\\build\\bin\\taosBenchmark.exe %tagert_dir% > nul
|
copy %binary_dir%\\build\\bin\\taosBenchmark.exe %tagert_dir% > nul
|
||||||
)
|
)
|
||||||
|
if exist %binary_dir%\\build\\lib\\taosws.dll.lib (
|
||||||
|
copy %binary_dir%\\build\\lib\\taosws.dll.lib %tagert_dir%\\driver > nul
|
||||||
|
)
|
||||||
|
if exist %binary_dir%\\build\\lib\\taosws.dll (
|
||||||
|
copy %binary_dir%\\build\\lib\\taosws.dll %tagert_dir%\\driver > nul
|
||||||
|
)
|
||||||
|
if exist %binary_dir%\\build\\bin\\taosdump.exe (
|
||||||
|
copy %binary_dir%\\build\\bin\\taosdump.exe %tagert_dir% > nul
|
||||||
|
)
|
||||||
if exist %binary_dir%\\build\\bin\\taosadapter.exe (
|
if exist %binary_dir%\\build\\bin\\taosadapter.exe (
|
||||||
copy %binary_dir%\\build\\bin\\taosadapter.exe %tagert_dir% > nul
|
copy %binary_dir%\\build\\bin\\taosadapter.exe %tagert_dir% > nul
|
||||||
)
|
)
|
||||||
|
@ -54,4 +63,7 @@ if exist %binary_dir%\\build\\bin\\taosadapter.exe (
|
||||||
mshta vbscript:createobject("shell.application").shellexecute("%~s0",":hasAdmin","","runas",1)(window.close)&& echo To start/stop TDengine with administrator privileges: sc start/stop taosd &goto :eof
|
mshta vbscript:createobject("shell.application").shellexecute("%~s0",":hasAdmin","","runas",1)(window.close)&& echo To start/stop TDengine with administrator privileges: sc start/stop taosd &goto :eof
|
||||||
:hasAdmin
|
:hasAdmin
|
||||||
copy /y C:\\TDengine\\driver\\taos.dll C:\\Windows\\System32 > nul
|
copy /y C:\\TDengine\\driver\\taos.dll C:\\Windows\\System32 > nul
|
||||||
|
if exist C:\\TDengine\\driver\\taosws.dll (
|
||||||
|
copy /y C:\\TDengine\\driver\\taosws.dll C:\\Windows\\System32 > nul
|
||||||
|
)
|
||||||
sc query "taosd" >nul || sc create "taosd" binPath= "C:\\TDengine\\taosd.exe --win_service" start= DEMAND
|
sc query "taosd" >nul || sc create "taosd" binPath= "C:\\TDengine\\taosd.exe --win_service" start= DEMAND
|
||||||
|
|
|
@ -39,6 +39,8 @@ release_dir="${top_dir}/release"
|
||||||
|
|
||||||
if [ "$verMode" == "cluster" ]; then
|
if [ "$verMode" == "cluster" ]; then
|
||||||
install_dir="${release_dir}/${productName}-enterprise-client-${version}"
|
install_dir="${release_dir}/${productName}-enterprise-client-${version}"
|
||||||
|
elif [ "$verMode" == "cloud" ]; then
|
||||||
|
install_dir="${release_dir}/${productName}-cloud-client-${version}"
|
||||||
else
|
else
|
||||||
install_dir="${release_dir}/${productName}-client-${version}"
|
install_dir="${release_dir}/${productName}-client-${version}"
|
||||||
fi
|
fi
|
||||||
|
@ -138,6 +140,10 @@ if [ "$verMode" == "cluster" ]; then
|
||||||
sed 's/verMode=edge/verMode=cluster/g' ${install_dir}/install_client.sh >>install_client_temp.sh
|
sed 's/verMode=edge/verMode=cluster/g' ${install_dir}/install_client.sh >>install_client_temp.sh
|
||||||
mv install_client_temp.sh ${install_dir}/install_client.sh
|
mv install_client_temp.sh ${install_dir}/install_client.sh
|
||||||
fi
|
fi
|
||||||
|
if [ "$verMode" == "cloud" ]; then
|
||||||
|
sed 's/verMode=edge/verMode=cloud/g' ${install_dir}/install_client.sh >>install_client_temp.sh
|
||||||
|
mv install_client_temp.sh ${install_dir}/install_client.sh
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$pagMode" == "lite" ]; then
|
if [ "$pagMode" == "lite" ]; then
|
||||||
sed 's/pagMode=full/pagMode=lite/g' ${install_dir}/install_client.sh >>install_client_temp.sh
|
sed 's/pagMode=full/pagMode=lite/g' ${install_dir}/install_client.sh >>install_client_temp.sh
|
||||||
|
@ -161,7 +167,7 @@ if [[ $productName == "TDengine" ]]; then
|
||||||
mkdir -p ${install_dir}/examples/taosbenchmark-json && cp ${examples_dir}/../tools/taos-tools/example/* ${install_dir}/examples/taosbenchmark-json
|
mkdir -p ${install_dir}/examples/taosbenchmark-json && cp ${examples_dir}/../tools/taos-tools/example/* ${install_dir}/examples/taosbenchmark-json
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$verMode" == "cluster" ]; then
|
if [ "$verMode" == "cluster" ] || [ "$verMode" == "cloud" ]; then
|
||||||
# Copy connector
|
# Copy connector
|
||||||
connector_dir="${code_dir}/connector"
|
connector_dir="${code_dir}/connector"
|
||||||
mkdir -p ${install_dir}/connector
|
mkdir -p ${install_dir}/connector
|
||||||
|
|
|
@ -39,6 +39,8 @@ release_dir="${top_dir}/release"
|
||||||
#package_name='linux'
|
#package_name='linux'
|
||||||
if [ "$verMode" == "cluster" ]; then
|
if [ "$verMode" == "cluster" ]; then
|
||||||
install_dir="${release_dir}/${productName}-enterprise-server-${version}"
|
install_dir="${release_dir}/${productName}-enterprise-server-${version}"
|
||||||
|
elif [ "$verMode" == "cloud" ]; then
|
||||||
|
install_dir="${release_dir}/${productName}-cloud-server-${version}"
|
||||||
else
|
else
|
||||||
install_dir="${release_dir}/${productName}-server-${version}"
|
install_dir="${release_dir}/${productName}-server-${version}"
|
||||||
fi
|
fi
|
||||||
|
@ -217,7 +219,10 @@ fi
|
||||||
if [ "$verMode" == "cluster" ]; then
|
if [ "$verMode" == "cluster" ]; then
|
||||||
sed 's/verMode=edge/verMode=cluster/g' ${install_dir}/bin/remove.sh >>remove_temp.sh
|
sed 's/verMode=edge/verMode=cluster/g' ${install_dir}/bin/remove.sh >>remove_temp.sh
|
||||||
mv remove_temp.sh ${install_dir}/bin/remove.sh
|
mv remove_temp.sh ${install_dir}/bin/remove.sh
|
||||||
|
fi
|
||||||
|
if [ "$verMode" == "cloud" ]; then
|
||||||
|
sed 's/verMode=edge/verMode=cloud/g' ${install_dir}/bin/remove.sh >>remove_temp.sh
|
||||||
|
mv remove_temp.sh ${install_dir}/bin/remove.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd ${install_dir}
|
cd ${install_dir}
|
||||||
|
@ -234,6 +239,10 @@ if [ "$verMode" == "cluster" ]; then
|
||||||
sed 's/verMode=edge/verMode=cluster/g' ${install_dir}/install.sh >>install_temp.sh
|
sed 's/verMode=edge/verMode=cluster/g' ${install_dir}/install.sh >>install_temp.sh
|
||||||
mv install_temp.sh ${install_dir}/install.sh
|
mv install_temp.sh ${install_dir}/install.sh
|
||||||
fi
|
fi
|
||||||
|
if [ "$verMode" == "cloud" ]; then
|
||||||
|
sed 's/verMode=edge/verMode=cloud/g' ${install_dir}/install.sh >>install_temp.sh
|
||||||
|
mv install_temp.sh ${install_dir}/install.sh
|
||||||
|
fi
|
||||||
if [ "$pagMode" == "lite" ]; then
|
if [ "$pagMode" == "lite" ]; then
|
||||||
sed 's/pagMode=full/pagMode=lite/g' ${install_dir}/install.sh >>install_temp.sh
|
sed 's/pagMode=full/pagMode=lite/g' ${install_dir}/install.sh >>install_temp.sh
|
||||||
mv install_temp.sh ${install_dir}/install.sh
|
mv install_temp.sh ${install_dir}/install.sh
|
||||||
|
@ -288,7 +297,7 @@ mkdir -p ${install_dir}/driver && cp ${lib_files} ${install_dir}/driver && echo
|
||||||
[ -f ${wslib_files} ] && cp ${wslib_files} ${install_dir}/driver || :
|
[ -f ${wslib_files} ] && cp ${wslib_files} ${install_dir}/driver || :
|
||||||
|
|
||||||
# Copy connector
|
# Copy connector
|
||||||
if [ "$verMode" == "cluster" ]; then
|
if [ "$verMode" == "cluster" ] || [ "$verMode" == "cloud" ]; then
|
||||||
connector_dir="${code_dir}/connector"
|
connector_dir="${code_dir}/connector"
|
||||||
mkdir -p ${install_dir}/connector
|
mkdir -p ${install_dir}/connector
|
||||||
if [[ "$pagMode" != "lite" ]] && [[ "$cpuType" != "aarch32" ]]; then
|
if [[ "$pagMode" != "lite" ]] && [[ "$cpuType" != "aarch32" ]]; then
|
||||||
|
|
|
@ -46,7 +46,6 @@ extern "C" {
|
||||||
|
|
||||||
#define ERROR_MSG_BUF_DEFAULT_SIZE 512
|
#define ERROR_MSG_BUF_DEFAULT_SIZE 512
|
||||||
#define HEARTBEAT_INTERVAL 1500 // ms
|
#define HEARTBEAT_INTERVAL 1500 // ms
|
||||||
#define SYNC_ON_TOP_OF_ASYNC 1
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
RES_TYPE__QUERY = 1,
|
RES_TYPE__QUERY = 1,
|
||||||
|
@ -271,9 +270,8 @@ void doFreeReqResultInfo(SReqResultInfo* pResInfo);
|
||||||
int32_t transferTableNameList(const char* tbList, int32_t acctId, char* dbName, SArray** pReq);
|
int32_t transferTableNameList(const char* tbList, int32_t acctId, char* dbName, SArray** pReq);
|
||||||
void syncCatalogFn(SMetaData* pResult, void* param, int32_t code);
|
void syncCatalogFn(SMetaData* pResult, void* param, int32_t code);
|
||||||
|
|
||||||
SRequestObj* execQuery(uint64_t connId, const char* sql, int sqlLen, bool validateOnly);
|
TAOS_RES* taosQueryImpl(TAOS* taos, const char* sql, bool validateOnly);
|
||||||
TAOS_RES* taosQueryImpl(TAOS* taos, const char* sql, bool validateOnly);
|
void taosAsyncQueryImpl(uint64_t connId, const char* sql, __taos_async_fn_t fp, void* param, bool validateOnly);
|
||||||
void taosAsyncQueryImpl(uint64_t connId, const char* sql, __taos_async_fn_t fp, void* param, bool validateOnly);
|
|
||||||
|
|
||||||
int32_t getVersion1BlockMetaSize(const char* p, int32_t numOfCols);
|
int32_t getVersion1BlockMetaSize(const char* p, int32_t numOfCols);
|
||||||
|
|
||||||
|
@ -349,8 +347,6 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet);
|
||||||
STscObj* taos_connect_internal(const char* ip, const char* user, const char* pass, const char* auth, const char* db,
|
STscObj* taos_connect_internal(const char* ip, const char* user, const char* pass, const char* auth, const char* db,
|
||||||
uint16_t port, int connType);
|
uint16_t port, int connType);
|
||||||
|
|
||||||
SRequestObj* launchQuery(uint64_t connId, const char* sql, int sqlLen, bool validateOnly, bool inRetry);
|
|
||||||
|
|
||||||
int32_t parseSql(SRequestObj* pRequest, bool topicQuery, SQuery** pQuery, SStmtCallback* pStmtCb);
|
int32_t parseSql(SRequestObj* pRequest, bool topicQuery, SQuery** pQuery, SStmtCallback* pStmtCb);
|
||||||
|
|
||||||
int32_t getPlan(SRequestObj* pRequest, SQuery* pQuery, SQueryPlan** pPlan, SArray* pNodeList);
|
int32_t getPlan(SRequestObj* pRequest, SQuery* pQuery, SQueryPlan** pPlan, SArray* pNodeList);
|
||||||
|
|
|
@ -30,7 +30,7 @@ extern "C" {
|
||||||
#define tscDebug(...) do { if (cDebugFlag & DEBUG_DEBUG) { taosPrintLog("TSC ", DEBUG_DEBUG, cDebugFlag, __VA_ARGS__); }} while(0)
|
#define tscDebug(...) do { if (cDebugFlag & DEBUG_DEBUG) { taosPrintLog("TSC ", DEBUG_DEBUG, cDebugFlag, __VA_ARGS__); }} while(0)
|
||||||
#define tscTrace(...) do { if (cDebugFlag & DEBUG_TRACE) { taosPrintLog("TSC ", DEBUG_TRACE, cDebugFlag, __VA_ARGS__); }} while(0)
|
#define tscTrace(...) do { if (cDebugFlag & DEBUG_TRACE) { taosPrintLog("TSC ", DEBUG_TRACE, cDebugFlag, __VA_ARGS__); }} while(0)
|
||||||
#define tscDebugL(...) do { if (cDebugFlag & DEBUG_DEBUG) { taosPrintLongString("TSC ", DEBUG_DEBUG, cDebugFlag, __VA_ARGS__); }} while(0)
|
#define tscDebugL(...) do { if (cDebugFlag & DEBUG_DEBUG) { taosPrintLongString("TSC ", DEBUG_DEBUG, cDebugFlag, __VA_ARGS__); }} while(0)
|
||||||
#define tscPerf(...) do { taosPrintLog("TSC ", 0, cDebugFlag, __VA_ARGS__); } while(0)
|
//#define tscPerf(...) do { if (cDebugFlag & DEBUG_INFO) { taosPrintLog("TSC ", DEBUG_INFO, cDebugFlag, __VA_ARGS__); }} while(0)
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -77,19 +77,19 @@ static void deregisterRequest(SRequestObj *pRequest) {
|
||||||
pRequest->self, pTscObj->id, pRequest->requestId, duration / 1000.0, num, currentInst);
|
pRequest->self, pTscObj->id, pRequest->requestId, duration / 1000.0, num, currentInst);
|
||||||
|
|
||||||
if (QUERY_NODE_VNODE_MODIF_STMT == pRequest->stmtType) {
|
if (QUERY_NODE_VNODE_MODIF_STMT == pRequest->stmtType) {
|
||||||
tscPerf("insert duration %" PRId64 "us: syntax:%" PRId64 "us, ctg:%" PRId64 "us, semantic:%" PRId64
|
// tscPerf("insert duration %" PRId64 "us: syntax:%" PRId64 "us, ctg:%" PRId64 "us, semantic:%" PRId64
|
||||||
"us, exec:%" PRId64 "us",
|
// "us, exec:%" PRId64 "us",
|
||||||
duration, pRequest->metric.syntaxEnd - pRequest->metric.syntaxStart,
|
// duration, pRequest->metric.syntaxEnd - pRequest->metric.syntaxStart,
|
||||||
pRequest->metric.ctgEnd - pRequest->metric.ctgStart, pRequest->metric.semanticEnd - pRequest->metric.ctgEnd,
|
// pRequest->metric.ctgEnd - pRequest->metric.ctgStart, pRequest->metric.semanticEnd - pRequest->metric.ctgEnd,
|
||||||
pRequest->metric.execEnd - pRequest->metric.semanticEnd);
|
// pRequest->metric.execEnd - pRequest->metric.semanticEnd);
|
||||||
atomic_add_fetch_64((int64_t *)&pActivity->insertElapsedTime, duration);
|
atomic_add_fetch_64((int64_t *)&pActivity->insertElapsedTime, duration);
|
||||||
} else if (QUERY_NODE_SELECT_STMT == pRequest->stmtType) {
|
} else if (QUERY_NODE_SELECT_STMT == pRequest->stmtType) {
|
||||||
tscPerf("select duration %" PRId64 "us: syntax:%" PRId64 "us, ctg:%" PRId64 "us, semantic:%" PRId64
|
// tscPerf("select duration %" PRId64 "us: syntax:%" PRId64 "us, ctg:%" PRId64 "us, semantic:%" PRId64
|
||||||
"us, planner:%" PRId64 "us, exec:%" PRId64 "us, reqId:0x%" PRIx64,
|
// "us, planner:%" PRId64 "us, exec:%" PRId64 "us, reqId:0x%" PRIx64,
|
||||||
duration, pRequest->metric.syntaxEnd - pRequest->metric.syntaxStart,
|
// duration, pRequest->metric.syntaxEnd - pRequest->metric.syntaxStart,
|
||||||
pRequest->metric.ctgEnd - pRequest->metric.ctgStart, pRequest->metric.semanticEnd - pRequest->metric.ctgEnd,
|
// pRequest->metric.ctgEnd - pRequest->metric.ctgStart, pRequest->metric.semanticEnd - pRequest->metric.ctgEnd,
|
||||||
pRequest->metric.planEnd - pRequest->metric.semanticEnd,
|
// pRequest->metric.planEnd - pRequest->metric.semanticEnd,
|
||||||
pRequest->metric.resultReady - pRequest->metric.planEnd, pRequest->requestId);
|
// pRequest->metric.resultReady - pRequest->metric.planEnd, pRequest->requestId);
|
||||||
|
|
||||||
atomic_add_fetch_64((int64_t *)&pActivity->queryElapsedTime, duration);
|
atomic_add_fetch_64((int64_t *)&pActivity->queryElapsedTime, duration);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1013,28 +1013,6 @@ SRequestObj* launchQueryImpl(SRequestObj* pRequest, SQuery* pQuery, bool keepQue
|
||||||
return pRequest;
|
return pRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
SRequestObj* launchQuery(uint64_t connId, const char* sql, int sqlLen, bool validateOnly, bool inRetry) {
|
|
||||||
SRequestObj* pRequest = NULL;
|
|
||||||
SQuery* pQuery = NULL;
|
|
||||||
|
|
||||||
int32_t code = buildRequest(connId, sql, sqlLen, NULL, validateOnly, &pRequest);
|
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
|
||||||
terrno = code;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
code = parseSql(pRequest, false, &pQuery, NULL);
|
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
|
||||||
pRequest->code = code;
|
|
||||||
return pRequest;
|
|
||||||
}
|
|
||||||
|
|
||||||
pRequest->inRetry = inRetry;
|
|
||||||
pRequest->stableQuery = pQuery->stableQuery;
|
|
||||||
|
|
||||||
return launchQueryImpl(pRequest, pQuery, false, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int32_t asyncExecSchQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaData* pResultMeta,
|
static int32_t asyncExecSchQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaData* pResultMeta,
|
||||||
SSqlCallbackWrapper* pWrapper) {
|
SSqlCallbackWrapper* pWrapper) {
|
||||||
pRequest->type = pQuery->msgType;
|
pRequest->type = pQuery->msgType;
|
||||||
|
@ -1197,32 +1175,6 @@ int32_t removeMeta(STscObj* pTscObj, SArray* tbList) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo remove it soon
|
|
||||||
SRequestObj* execQuery(uint64_t connId, const char* sql, int sqlLen, bool validateOnly) {
|
|
||||||
SRequestObj* pRequest = NULL;
|
|
||||||
int32_t retryNum = 0;
|
|
||||||
int32_t code = 0;
|
|
||||||
bool inRetry = false;
|
|
||||||
|
|
||||||
do {
|
|
||||||
destroyRequest(pRequest);
|
|
||||||
pRequest = launchQuery(connId, sql, sqlLen, validateOnly, inRetry);
|
|
||||||
if (pRequest == NULL || TSDB_CODE_SUCCESS == pRequest->code || !NEED_CLIENT_HANDLE_ERROR(pRequest->code)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
code = refreshMeta(pRequest->pTscObj, pRequest);
|
|
||||||
if (code) {
|
|
||||||
pRequest->code = code;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
inRetry = true;
|
|
||||||
} while (retryNum++ < REQUEST_TOTAL_EXEC_TIMES);
|
|
||||||
|
|
||||||
return pRequest;
|
|
||||||
}
|
|
||||||
|
|
||||||
int initEpSetFromCfg(const char* firstEp, const char* secondEp, SCorEpSet* pEpSet) {
|
int initEpSetFromCfg(const char* firstEp, const char* secondEp, SCorEpSet* pEpSet) {
|
||||||
pEpSet->version = 0;
|
pEpSet->version = 0;
|
||||||
|
|
||||||
|
@ -2291,7 +2243,6 @@ TAOS_RES* taosQueryImpl(TAOS* taos, const char* sql, bool validateOnly) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if SYNC_ON_TOP_OF_ASYNC
|
|
||||||
SSyncQueryParam* param = taosMemoryCalloc(1, sizeof(SSyncQueryParam));
|
SSyncQueryParam* param = taosMemoryCalloc(1, sizeof(SSyncQueryParam));
|
||||||
tsem_init(¶m->sem, 0, 0);
|
tsem_init(¶m->sem, 0, 0);
|
||||||
|
|
||||||
|
@ -2301,15 +2252,4 @@ TAOS_RES* taosQueryImpl(TAOS* taos, const char* sql, bool validateOnly) {
|
||||||
param->pRequest->syncQuery = true;
|
param->pRequest->syncQuery = true;
|
||||||
}
|
}
|
||||||
return param->pRequest;
|
return param->pRequest;
|
||||||
#else
|
|
||||||
size_t sqlLen = strlen(sql);
|
|
||||||
if (sqlLen > (size_t)TSDB_MAX_ALLOWED_SQL_LEN) {
|
|
||||||
tscError("sql string exceeds max length:%d", TSDB_MAX_ALLOWED_SQL_LEN);
|
|
||||||
terrno = TSDB_CODE_TSC_EXCEED_SQL_LIMIT;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
TAOS_RES* pRes = execQuery(*(int64_t*)taos, sql, sqlLen, validateOnly);
|
|
||||||
return pRes;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -261,12 +261,7 @@ TAOS_ROW taos_fetch_row(TAOS_RES *res) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if SYNC_ON_TOP_OF_ASYNC
|
|
||||||
return doAsyncFetchRows(pRequest, true, true);
|
return doAsyncFetchRows(pRequest, true, true);
|
||||||
#else
|
|
||||||
return doFetchRows(pRequest, true, true);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} else if (TD_RES_TMQ(res) || TD_RES_TMQ_METADATA(res)) {
|
} else if (TD_RES_TMQ(res) || TD_RES_TMQ_METADATA(res)) {
|
||||||
SMqRspObj *msg = ((SMqRspObj *)res);
|
SMqRspObj *msg = ((SMqRspObj *)res);
|
||||||
SReqResultInfo *pResultInfo;
|
SReqResultInfo *pResultInfo;
|
||||||
|
@ -549,11 +544,7 @@ int taos_fetch_block_s(TAOS_RES *res, int *numOfRows, TAOS_ROW *rows) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if SYNC_ON_TOP_OF_ASYNC
|
|
||||||
doAsyncFetchRows(pRequest, false, true);
|
doAsyncFetchRows(pRequest, false, true);
|
||||||
#else
|
|
||||||
doFetchRows(pRequest, true, true);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// TODO refactor
|
// TODO refactor
|
||||||
SReqResultInfo *pResultInfo = &pRequest->body.resInfo;
|
SReqResultInfo *pResultInfo = &pRequest->body.resInfo;
|
||||||
|
@ -601,11 +592,7 @@ int taos_fetch_raw_block(TAOS_RES *res, int *numOfRows, void **pData) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if SYNC_ON_TOP_OF_ASYNC
|
|
||||||
doAsyncFetchRows(pRequest, false, false);
|
doAsyncFetchRows(pRequest, false, false);
|
||||||
#else
|
|
||||||
doFetchRows(pRequest, false, false);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
SReqResultInfo *pResultInfo = &pRequest->body.resInfo;
|
SReqResultInfo *pResultInfo = &pRequest->body.resInfo;
|
||||||
|
|
||||||
|
@ -989,7 +976,7 @@ const void *taos_get_raw_block(TAOS_RES *res) {
|
||||||
return pRequest->body.resInfo.pData;
|
return pRequest->body.resInfo.pData;
|
||||||
}
|
}
|
||||||
|
|
||||||
int taos_get_db_route_info(TAOS* taos, const char* db, TAOS_DB_ROUTE_INFO* dbInfo) {
|
int taos_get_db_route_info(TAOS *taos, const char *db, TAOS_DB_ROUTE_INFO *dbInfo) {
|
||||||
if (NULL == taos) {
|
if (NULL == taos) {
|
||||||
terrno = TSDB_CODE_TSC_DISCONNECTED;
|
terrno = TSDB_CODE_TSC_DISCONNECTED;
|
||||||
return terrno;
|
return terrno;
|
||||||
|
@ -1001,16 +988,16 @@ int taos_get_db_route_info(TAOS* taos, const char* db, TAOS_DB_ROUTE_INFO* dbInf
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t connId = *(int64_t *)taos;
|
int64_t connId = *(int64_t *)taos;
|
||||||
SRequestObj *pRequest = NULL;
|
SRequestObj *pRequest = NULL;
|
||||||
char *sql = "taos_get_db_route_info";
|
char *sql = "taos_get_db_route_info";
|
||||||
int32_t code = buildRequest(connId, sql, strlen(sql), NULL, false, &pRequest);
|
int32_t code = buildRequest(connId, sql, strlen(sql), NULL, false, &pRequest);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
terrno = code;
|
terrno = code;
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
STscObj *pTscObj = pRequest->pTscObj;
|
STscObj *pTscObj = pRequest->pTscObj;
|
||||||
SCatalog *pCtg = NULL;
|
SCatalog *pCtg = NULL;
|
||||||
code = catalogGetHandle(pTscObj->pAppInfo->clusterId, &pCtg);
|
code = catalogGetHandle(pTscObj->pAppInfo->clusterId, &pCtg);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
@ -1024,7 +1011,7 @@ int taos_get_db_route_info(TAOS* taos, const char* db, TAOS_DB_ROUTE_INFO* dbInf
|
||||||
|
|
||||||
char dbFName[TSDB_DB_FNAME_LEN] = {0};
|
char dbFName[TSDB_DB_FNAME_LEN] = {0};
|
||||||
snprintf(dbFName, sizeof(dbFName), "%d.%s", pTscObj->acctId, db);
|
snprintf(dbFName, sizeof(dbFName), "%d.%s", pTscObj->acctId, db);
|
||||||
|
|
||||||
code = catalogGetDBVgInfo(pCtg, &conn, dbFName, dbInfo);
|
code = catalogGetDBVgInfo(pCtg, &conn, dbFName, dbInfo);
|
||||||
if (code) {
|
if (code) {
|
||||||
goto _return;
|
goto _return;
|
||||||
|
@ -1038,7 +1025,7 @@ _return:
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
int taos_get_table_vgId(TAOS* taos, const char* db, const char* table, int* vgId) {
|
int taos_get_table_vgId(TAOS *taos, const char *db, const char *table, int *vgId) {
|
||||||
if (NULL == taos) {
|
if (NULL == taos) {
|
||||||
terrno = TSDB_CODE_TSC_DISCONNECTED;
|
terrno = TSDB_CODE_TSC_DISCONNECTED;
|
||||||
return terrno;
|
return terrno;
|
||||||
|
@ -1050,15 +1037,15 @@ int taos_get_table_vgId(TAOS* taos, const char* db, const char* table, int* vgId
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t connId = *(int64_t *)taos;
|
int64_t connId = *(int64_t *)taos;
|
||||||
SRequestObj *pRequest = NULL;
|
SRequestObj *pRequest = NULL;
|
||||||
char *sql = "taos_get_table_vgId";
|
char *sql = "taos_get_table_vgId";
|
||||||
int32_t code = buildRequest(connId, sql, strlen(sql), NULL, false, &pRequest);
|
int32_t code = buildRequest(connId, sql, strlen(sql), NULL, false, &pRequest);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
STscObj *pTscObj = pRequest->pTscObj;
|
STscObj *pTscObj = pRequest->pTscObj;
|
||||||
SCatalog *pCtg = NULL;
|
SCatalog *pCtg = NULL;
|
||||||
code = catalogGetHandle(pTscObj->pAppInfo->clusterId, &pCtg);
|
code = catalogGetHandle(pTscObj->pAppInfo->clusterId, &pCtg);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
|
|
@ -1369,7 +1369,6 @@ int taos_write_raw_block(TAOS* taos, int rows, char* pData, const char* tbname)
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
SVnodeModifOpStmt* nodeStmt = (SVnodeModifOpStmt*)(pQuery->pRoot);
|
SVnodeModifOpStmt* nodeStmt = (SVnodeModifOpStmt*)(pQuery->pRoot);
|
||||||
nodeStmt->payloadType = PAYLOAD_TYPE_KV;
|
|
||||||
nodeStmt->pDataBlocks = taosArrayInit(1, POINTER_BYTES);
|
nodeStmt->pDataBlocks = taosArrayInit(1, POINTER_BYTES);
|
||||||
|
|
||||||
SVgDataBlocks* dst = taosMemoryCalloc(1, sizeof(SVgDataBlocks));
|
SVgDataBlocks* dst = taosMemoryCalloc(1, sizeof(SVgDataBlocks));
|
||||||
|
@ -1625,7 +1624,6 @@ static int32_t tmqWriteRawDataImpl(TAOS* taos, void* data, int32_t dataLen) {
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
SVnodeModifOpStmt* nodeStmt = (SVnodeModifOpStmt*)(pQuery->pRoot);
|
SVnodeModifOpStmt* nodeStmt = (SVnodeModifOpStmt*)(pQuery->pRoot);
|
||||||
nodeStmt->payloadType = PAYLOAD_TYPE_KV;
|
|
||||||
|
|
||||||
int32_t numOfVg = taosHashGetSize(pVgHash);
|
int32_t numOfVg = taosHashGetSize(pVgHash);
|
||||||
nodeStmt->pDataBlocks = taosArrayInit(numOfVg, POINTER_BYTES);
|
nodeStmt->pDataBlocks = taosArrayInit(numOfVg, POINTER_BYTES);
|
||||||
|
@ -1929,7 +1927,6 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen)
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
SVnodeModifOpStmt* nodeStmt = (SVnodeModifOpStmt*)(pQuery->pRoot);
|
SVnodeModifOpStmt* nodeStmt = (SVnodeModifOpStmt*)(pQuery->pRoot);
|
||||||
nodeStmt->payloadType = PAYLOAD_TYPE_KV;
|
|
||||||
|
|
||||||
int32_t numOfVg = taosHashGetSize(pVgHash);
|
int32_t numOfVg = taosHashGetSize(pVgHash);
|
||||||
nodeStmt->pDataBlocks = taosArrayInit(numOfVg, POINTER_BYTES);
|
nodeStmt->pDataBlocks = taosArrayInit(numOfVg, POINTER_BYTES);
|
||||||
|
|
|
@ -1531,7 +1531,6 @@ static SSmlHandle *smlBuildSmlInfo(STscObj *pTscObj, SRequestObj *request, SMLPr
|
||||||
uError("SML:0x%" PRIx64 " create info->pQuery->pRoot error", info->id);
|
uError("SML:0x%" PRIx64 " create info->pQuery->pRoot error", info->id);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
((SVnodeModifOpStmt *)(info->pQuery->pRoot))->payloadType = PAYLOAD_TYPE_KV;
|
|
||||||
|
|
||||||
if (pTscObj) {
|
if (pTscObj) {
|
||||||
info->taos = pTscObj;
|
info->taos = pTscObj;
|
||||||
|
@ -2394,7 +2393,7 @@ static int32_t smlParseLine(SSmlHandle *info, char *lines[], char* rawLine, char
|
||||||
code = smlParseJSON(info, rawLine);
|
code = smlParseJSON(info, rawLine);
|
||||||
}
|
}
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
uError("SML:0x%" PRIx64 " smlParseJSON failed:%s", info->id, *lines);
|
uError("SML:0x%" PRIx64 " smlParseJSON failed:%s", info->id, lines?*lines:rawLine);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
return code;
|
return code;
|
||||||
|
|
|
@ -1619,7 +1619,7 @@ void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout, bool pollIfReset) {
|
||||||
taosGetQitem(tmq->qall, (void**)&rspWrapper);
|
taosGetQitem(tmq->qall, (void**)&rspWrapper);
|
||||||
|
|
||||||
if (rspWrapper == NULL) {
|
if (rspWrapper == NULL) {
|
||||||
tscDebug("consumer %" PRId64 " mqueue empty", tmq->consumerId);
|
/*tscDebug("consumer %" PRId64 " mqueue empty", tmq->consumerId);*/
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1732,6 +1732,7 @@ TAOS_RES* tmq_consumer_poll(tmq_t* tmq, int64_t timeout) {
|
||||||
|
|
||||||
// in no topic status, delayed task also need to be processed
|
// in no topic status, delayed task also need to be processed
|
||||||
if (atomic_load_8(&tmq->status) == TMQ_CONSUMER_STATUS__INIT) {
|
if (atomic_load_8(&tmq->status) == TMQ_CONSUMER_STATUS__INIT) {
|
||||||
|
tscDebug("consumer:%" PRId64 ", poll return since consumer status is init", tmq->consumerId);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -230,8 +230,8 @@ static const SSysDbTableSchema transSchema[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static const SSysDbTableSchema configSchema[] = {
|
static const SSysDbTableSchema configSchema[] = {
|
||||||
{.name = "name", .bytes = TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
|
{.name = "name", .bytes = TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
|
||||||
{.name = "value", .bytes = TSDB_CONFIG_VALUE_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
|
{.name = "value", .bytes = TSDB_CONFIG_VALUE_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
|
||||||
};
|
};
|
||||||
|
|
||||||
static const SSysDbTableSchema variablesSchema[] = {
|
static const SSysDbTableSchema variablesSchema[] = {
|
||||||
|
@ -270,7 +270,7 @@ static const SSysTableMeta infosMeta[] = {
|
||||||
{TSDB_INS_TABLE_MNODES, mnodesSchema, tListLen(mnodesSchema), true},
|
{TSDB_INS_TABLE_MNODES, mnodesSchema, tListLen(mnodesSchema), true},
|
||||||
{TSDB_INS_TABLE_MODULES, modulesSchema, tListLen(modulesSchema), true},
|
{TSDB_INS_TABLE_MODULES, modulesSchema, tListLen(modulesSchema), true},
|
||||||
{TSDB_INS_TABLE_QNODES, qnodesSchema, tListLen(qnodesSchema), true},
|
{TSDB_INS_TABLE_QNODES, qnodesSchema, tListLen(qnodesSchema), true},
|
||||||
// {TSDB_INS_TABLE_SNODES, snodesSchema, tListLen(snodesSchema)},
|
{TSDB_INS_TABLE_SNODES, snodesSchema, tListLen(snodesSchema)},
|
||||||
{TSDB_INS_TABLE_CLUSTER, clusterSchema, tListLen(clusterSchema), true},
|
{TSDB_INS_TABLE_CLUSTER, clusterSchema, tListLen(clusterSchema), true},
|
||||||
{TSDB_INS_TABLE_DATABASES, userDBSchema, tListLen(userDBSchema), false},
|
{TSDB_INS_TABLE_DATABASES, userDBSchema, tListLen(userDBSchema), false},
|
||||||
{TSDB_INS_TABLE_FUNCTIONS, userFuncSchema, tListLen(userFuncSchema), false},
|
{TSDB_INS_TABLE_FUNCTIONS, userFuncSchema, tListLen(userFuncSchema), false},
|
||||||
|
@ -282,7 +282,7 @@ static const SSysTableMeta infosMeta[] = {
|
||||||
{TSDB_INS_TABLE_USERS, userUsersSchema, tListLen(userUsersSchema), false},
|
{TSDB_INS_TABLE_USERS, userUsersSchema, tListLen(userUsersSchema), false},
|
||||||
{TSDB_INS_TABLE_LICENCES, grantsSchema, tListLen(grantsSchema), true},
|
{TSDB_INS_TABLE_LICENCES, grantsSchema, tListLen(grantsSchema), true},
|
||||||
{TSDB_INS_TABLE_VGROUPS, vgroupsSchema, tListLen(vgroupsSchema), true},
|
{TSDB_INS_TABLE_VGROUPS, vgroupsSchema, tListLen(vgroupsSchema), true},
|
||||||
{TSDB_INS_TABLE_CONFIGS, configSchema, tListLen(configSchema), true},
|
{TSDB_INS_TABLE_CONFIGS, configSchema, tListLen(configSchema), false},
|
||||||
{TSDB_INS_TABLE_DNODE_VARIABLES, variablesSchema, tListLen(variablesSchema), true},
|
{TSDB_INS_TABLE_DNODE_VARIABLES, variablesSchema, tListLen(variablesSchema), true},
|
||||||
{TSDB_INS_TABLE_TOPICS, topicSchema, tListLen(topicSchema), false},
|
{TSDB_INS_TABLE_TOPICS, topicSchema, tListLen(topicSchema), false},
|
||||||
{TSDB_INS_TABLE_SUBSCRIPTIONS, subscriptionSchema, tListLen(subscriptionSchema), false},
|
{TSDB_INS_TABLE_SUBSCRIPTIONS, subscriptionSchema, tListLen(subscriptionSchema), false},
|
||||||
|
|
|
@ -1707,8 +1707,6 @@ void* tDecodeDataBlock(const void* buf, SSDataBlock* pBlock) {
|
||||||
|
|
||||||
if (IS_VAR_DATA_TYPE(data.info.type)) {
|
if (IS_VAR_DATA_TYPE(data.info.type)) {
|
||||||
buf = taosDecodeBinary(buf, (void**)&data.varmeta.offset, pBlock->info.rows * sizeof(int32_t));
|
buf = taosDecodeBinary(buf, (void**)&data.varmeta.offset, pBlock->info.rows * sizeof(int32_t));
|
||||||
data.varmeta.length = pBlock->info.rows * sizeof(int32_t);
|
|
||||||
data.varmeta.allocLen = data.varmeta.length;
|
|
||||||
} else {
|
} else {
|
||||||
buf = taosDecodeBinary(buf, (void**)&data.nullbitmap, BitmapLen(pBlock->info.rows));
|
buf = taosDecodeBinary(buf, (void**)&data.nullbitmap, BitmapLen(pBlock->info.rows));
|
||||||
}
|
}
|
||||||
|
@ -1716,6 +1714,10 @@ void* tDecodeDataBlock(const void* buf, SSDataBlock* pBlock) {
|
||||||
int32_t len = 0;
|
int32_t len = 0;
|
||||||
buf = taosDecodeFixedI32(buf, &len);
|
buf = taosDecodeFixedI32(buf, &len);
|
||||||
buf = taosDecodeBinary(buf, (void**)&data.pData, len);
|
buf = taosDecodeBinary(buf, (void**)&data.pData, len);
|
||||||
|
if (IS_VAR_DATA_TYPE(data.info.type)) {
|
||||||
|
data.varmeta.length = len;
|
||||||
|
data.varmeta.allocLen = len;
|
||||||
|
}
|
||||||
taosArrayPush(pBlock->pDataBlock, &data);
|
taosArrayPush(pBlock->pDataBlock, &data);
|
||||||
}
|
}
|
||||||
return (void*)buf;
|
return (void*)buf;
|
||||||
|
|
|
@ -55,8 +55,8 @@ int32_t tsNumOfVnodeSyncThreads = 2;
|
||||||
int32_t tsNumOfVnodeRsmaThreads = 2;
|
int32_t tsNumOfVnodeRsmaThreads = 2;
|
||||||
int32_t tsNumOfQnodeQueryThreads = 4;
|
int32_t tsNumOfQnodeQueryThreads = 4;
|
||||||
int32_t tsNumOfQnodeFetchThreads = 1;
|
int32_t tsNumOfQnodeFetchThreads = 1;
|
||||||
int32_t tsNumOfSnodeSharedThreads = 2;
|
int32_t tsNumOfSnodeStreamThreads = 4;
|
||||||
int32_t tsNumOfSnodeUniqueThreads = 2;
|
int32_t tsNumOfSnodeWriteThreads = 1;
|
||||||
|
|
||||||
// monitor
|
// monitor
|
||||||
bool tsEnableMonitor = true;
|
bool tsEnableMonitor = true;
|
||||||
|
@ -82,6 +82,7 @@ bool tsSmlDataFormat = false;
|
||||||
// query
|
// query
|
||||||
int32_t tsQueryPolicy = 1;
|
int32_t tsQueryPolicy = 1;
|
||||||
int32_t tsQueryRspPolicy = 0;
|
int32_t tsQueryRspPolicy = 0;
|
||||||
|
bool tsEnableQueryHb = false;
|
||||||
int32_t tsQuerySmaOptimize = 0;
|
int32_t tsQuerySmaOptimize = 0;
|
||||||
int32_t tsQueryRsmaTolerance = 1000; // the tolerance time (ms) to judge from which level to query rsma data.
|
int32_t tsQueryRsmaTolerance = 1000; // the tolerance time (ms) to judge from which level to query rsma data.
|
||||||
bool tsQueryPlannerTrace = false;
|
bool tsQueryPlannerTrace = false;
|
||||||
|
@ -132,7 +133,7 @@ int32_t tsDiskCfgNum = 0;
|
||||||
SDiskCfg tsDiskCfg[TFS_MAX_DISKS] = {0};
|
SDiskCfg tsDiskCfg[TFS_MAX_DISKS] = {0};
|
||||||
|
|
||||||
// stream scheduler
|
// stream scheduler
|
||||||
bool tsSchedStreamToSnode = true;
|
bool tsDeployOnSnode = true;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* minimum scale for whole system, millisecond by default
|
* minimum scale for whole system, millisecond by default
|
||||||
|
@ -284,6 +285,7 @@ static int32_t taosAddClientCfg(SConfig *pCfg) {
|
||||||
if (cfgAddInt32(pCfg, "compressMsgSize", tsCompressMsgSize, -1, 100000000, 1) != 0) return -1;
|
if (cfgAddInt32(pCfg, "compressMsgSize", tsCompressMsgSize, -1, 100000000, 1) != 0) return -1;
|
||||||
if (cfgAddInt32(pCfg, "compressColData", tsCompressColData, -1, 100000000, 1) != 0) return -1;
|
if (cfgAddInt32(pCfg, "compressColData", tsCompressColData, -1, 100000000, 1) != 0) return -1;
|
||||||
if (cfgAddInt32(pCfg, "queryPolicy", tsQueryPolicy, 1, 4, 1) != 0) return -1;
|
if (cfgAddInt32(pCfg, "queryPolicy", tsQueryPolicy, 1, 4, 1) != 0) return -1;
|
||||||
|
if (cfgAddBool(pCfg, "enableQueryHb", tsEnableQueryHb, false) != 0) return -1;
|
||||||
if (cfgAddInt32(pCfg, "querySmaOptimize", tsQuerySmaOptimize, 0, 1, 1) != 0) return -1;
|
if (cfgAddInt32(pCfg, "querySmaOptimize", tsQuerySmaOptimize, 0, 1, 1) != 0) return -1;
|
||||||
if (cfgAddBool(pCfg, "queryPlannerTrace", tsQueryPlannerTrace, true) != 0) return -1;
|
if (cfgAddBool(pCfg, "queryPlannerTrace", tsQueryPlannerTrace, true) != 0) return -1;
|
||||||
if (cfgAddInt32(pCfg, "queryNodeChunkSize", tsQueryNodeChunkSize, 1024, 128 * 1024, true) != 0) return -1;
|
if (cfgAddInt32(pCfg, "queryNodeChunkSize", tsQueryNodeChunkSize, 1024, 128 * 1024, true) != 0) return -1;
|
||||||
|
@ -388,13 +390,13 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
|
||||||
// tsNumOfQnodeFetchThreads = TMAX(tsNumOfQnodeFetchThreads, 4);
|
// tsNumOfQnodeFetchThreads = TMAX(tsNumOfQnodeFetchThreads, 4);
|
||||||
// if (cfgAddInt32(pCfg, "numOfQnodeFetchThreads", tsNumOfQnodeFetchThreads, 1, 1024, 0) != 0) return -1;
|
// if (cfgAddInt32(pCfg, "numOfQnodeFetchThreads", tsNumOfQnodeFetchThreads, 1, 1024, 0) != 0) return -1;
|
||||||
|
|
||||||
tsNumOfSnodeSharedThreads = tsNumOfCores / 4;
|
tsNumOfSnodeStreamThreads = tsNumOfCores / 4;
|
||||||
tsNumOfSnodeSharedThreads = TRANGE(tsNumOfSnodeSharedThreads, 2, 4);
|
tsNumOfSnodeStreamThreads = TRANGE(tsNumOfSnodeStreamThreads, 2, 4);
|
||||||
if (cfgAddInt32(pCfg, "numOfSnodeSharedThreads", tsNumOfSnodeSharedThreads, 2, 1024, 0) != 0) return -1;
|
if (cfgAddInt32(pCfg, "numOfSnodeSharedThreads", tsNumOfSnodeStreamThreads, 2, 1024, 0) != 0) return -1;
|
||||||
|
|
||||||
tsNumOfSnodeUniqueThreads = tsNumOfCores / 4;
|
tsNumOfSnodeWriteThreads = tsNumOfCores / 4;
|
||||||
tsNumOfSnodeUniqueThreads = TRANGE(tsNumOfSnodeUniqueThreads, 2, 4);
|
tsNumOfSnodeWriteThreads = TRANGE(tsNumOfSnodeWriteThreads, 2, 4);
|
||||||
if (cfgAddInt32(pCfg, "numOfSnodeUniqueThreads", tsNumOfSnodeUniqueThreads, 2, 1024, 0) != 0) return -1;
|
if (cfgAddInt32(pCfg, "numOfSnodeUniqueThreads", tsNumOfSnodeWriteThreads, 2, 1024, 0) != 0) return -1;
|
||||||
|
|
||||||
tsRpcQueueMemoryAllowed = tsTotalMemoryKB * 1024 * 0.1;
|
tsRpcQueueMemoryAllowed = tsTotalMemoryKB * 1024 * 0.1;
|
||||||
tsRpcQueueMemoryAllowed = TRANGE(tsRpcQueueMemoryAllowed, TSDB_MAX_MSG_SIZE * 10LL, TSDB_MAX_MSG_SIZE * 10000LL);
|
tsRpcQueueMemoryAllowed = TRANGE(tsRpcQueueMemoryAllowed, TSDB_MAX_MSG_SIZE * 10LL, TSDB_MAX_MSG_SIZE * 10000LL);
|
||||||
|
@ -540,17 +542,17 @@ static int32_t taosUpdateServerCfg(SConfig *pCfg) {
|
||||||
|
|
||||||
pItem = cfgGetItem(tsCfg, "numOfSnodeSharedThreads");
|
pItem = cfgGetItem(tsCfg, "numOfSnodeSharedThreads");
|
||||||
if (pItem != NULL && pItem->stype == CFG_STYPE_DEFAULT) {
|
if (pItem != NULL && pItem->stype == CFG_STYPE_DEFAULT) {
|
||||||
tsNumOfSnodeSharedThreads = numOfCores / 4;
|
tsNumOfSnodeStreamThreads = numOfCores / 4;
|
||||||
tsNumOfSnodeSharedThreads = TRANGE(tsNumOfSnodeSharedThreads, 2, 4);
|
tsNumOfSnodeStreamThreads = TRANGE(tsNumOfSnodeStreamThreads, 2, 4);
|
||||||
pItem->i32 = tsNumOfSnodeSharedThreads;
|
pItem->i32 = tsNumOfSnodeStreamThreads;
|
||||||
pItem->stype = stype;
|
pItem->stype = stype;
|
||||||
}
|
}
|
||||||
|
|
||||||
pItem = cfgGetItem(tsCfg, "numOfSnodeUniqueThreads");
|
pItem = cfgGetItem(tsCfg, "numOfSnodeUniqueThreads");
|
||||||
if (pItem != NULL && pItem->stype == CFG_STYPE_DEFAULT) {
|
if (pItem != NULL && pItem->stype == CFG_STYPE_DEFAULT) {
|
||||||
tsNumOfSnodeUniqueThreads = numOfCores / 4;
|
tsNumOfSnodeWriteThreads = numOfCores / 4;
|
||||||
tsNumOfSnodeUniqueThreads = TRANGE(tsNumOfSnodeUniqueThreads, 2, 4);
|
tsNumOfSnodeWriteThreads = TRANGE(tsNumOfSnodeWriteThreads, 2, 4);
|
||||||
pItem->i32 = tsNumOfSnodeUniqueThreads;
|
pItem->i32 = tsNumOfSnodeWriteThreads;
|
||||||
pItem->stype = stype;
|
pItem->stype = stype;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -644,6 +646,7 @@ static int32_t taosSetClientCfg(SConfig *pCfg) {
|
||||||
tsCompressColData = cfgGetItem(pCfg, "compressColData")->i32;
|
tsCompressColData = cfgGetItem(pCfg, "compressColData")->i32;
|
||||||
tsNumOfTaskQueueThreads = cfgGetItem(pCfg, "numOfTaskQueueThreads")->i32;
|
tsNumOfTaskQueueThreads = cfgGetItem(pCfg, "numOfTaskQueueThreads")->i32;
|
||||||
tsQueryPolicy = cfgGetItem(pCfg, "queryPolicy")->i32;
|
tsQueryPolicy = cfgGetItem(pCfg, "queryPolicy")->i32;
|
||||||
|
tsEnableQueryHb = cfgGetItem(pCfg, "enableQueryHb")->bval;
|
||||||
tsQuerySmaOptimize = cfgGetItem(pCfg, "querySmaOptimize")->i32;
|
tsQuerySmaOptimize = cfgGetItem(pCfg, "querySmaOptimize")->i32;
|
||||||
tsQueryPlannerTrace = cfgGetItem(pCfg, "queryPlannerTrace")->bval;
|
tsQueryPlannerTrace = cfgGetItem(pCfg, "queryPlannerTrace")->bval;
|
||||||
tsQueryNodeChunkSize = cfgGetItem(pCfg, "queryNodeChunkSize")->i32;
|
tsQueryNodeChunkSize = cfgGetItem(pCfg, "queryNodeChunkSize")->i32;
|
||||||
|
@ -693,8 +696,8 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
|
||||||
tsNumOfVnodeRsmaThreads = cfgGetItem(pCfg, "numOfVnodeRsmaThreads")->i32;
|
tsNumOfVnodeRsmaThreads = cfgGetItem(pCfg, "numOfVnodeRsmaThreads")->i32;
|
||||||
tsNumOfQnodeQueryThreads = cfgGetItem(pCfg, "numOfQnodeQueryThreads")->i32;
|
tsNumOfQnodeQueryThreads = cfgGetItem(pCfg, "numOfQnodeQueryThreads")->i32;
|
||||||
// tsNumOfQnodeFetchThreads = cfgGetItem(pCfg, "numOfQnodeFetchThreads")->i32;
|
// tsNumOfQnodeFetchThreads = cfgGetItem(pCfg, "numOfQnodeFetchThreads")->i32;
|
||||||
tsNumOfSnodeSharedThreads = cfgGetItem(pCfg, "numOfSnodeSharedThreads")->i32;
|
tsNumOfSnodeStreamThreads = cfgGetItem(pCfg, "numOfSnodeSharedThreads")->i32;
|
||||||
tsNumOfSnodeUniqueThreads = cfgGetItem(pCfg, "numOfSnodeUniqueThreads")->i32;
|
tsNumOfSnodeWriteThreads = cfgGetItem(pCfg, "numOfSnodeUniqueThreads")->i32;
|
||||||
tsRpcQueueMemoryAllowed = cfgGetItem(pCfg, "rpcQueueMemoryAllowed")->i64;
|
tsRpcQueueMemoryAllowed = cfgGetItem(pCfg, "rpcQueueMemoryAllowed")->i64;
|
||||||
|
|
||||||
tsEnableMonitor = cfgGetItem(pCfg, "monitor")->bval;
|
tsEnableMonitor = cfgGetItem(pCfg, "monitor")->bval;
|
||||||
|
@ -780,6 +783,8 @@ int32_t taosSetCfg(SConfig *pCfg, char *name) {
|
||||||
if (strcasecmp("enableCoreFile", name) == 0) {
|
if (strcasecmp("enableCoreFile", name) == 0) {
|
||||||
bool enableCore = cfgGetItem(pCfg, "enableCoreFile")->bval;
|
bool enableCore = cfgGetItem(pCfg, "enableCoreFile")->bval;
|
||||||
taosSetCoreDump(enableCore);
|
taosSetCoreDump(enableCore);
|
||||||
|
} else if (strcasecmp("enableQueryHb", name) == 0) {
|
||||||
|
tsEnableQueryHb = cfgGetItem(pCfg, "enableQueryHb")->bval;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -941,9 +946,9 @@ int32_t taosSetCfg(SConfig *pCfg, char *name) {
|
||||||
tsNumOfQnodeFetchThreads = cfgGetItem(pCfg, "numOfQnodeFetchThreads")->i32;
|
tsNumOfQnodeFetchThreads = cfgGetItem(pCfg, "numOfQnodeFetchThreads")->i32;
|
||||||
*/
|
*/
|
||||||
} else if (strcasecmp("numOfSnodeSharedThreads", name) == 0) {
|
} else if (strcasecmp("numOfSnodeSharedThreads", name) == 0) {
|
||||||
tsNumOfSnodeSharedThreads = cfgGetItem(pCfg, "numOfSnodeSharedThreads")->i32;
|
tsNumOfSnodeStreamThreads = cfgGetItem(pCfg, "numOfSnodeSharedThreads")->i32;
|
||||||
} else if (strcasecmp("numOfSnodeUniqueThreads", name) == 0) {
|
} else if (strcasecmp("numOfSnodeUniqueThreads", name) == 0) {
|
||||||
tsNumOfSnodeUniqueThreads = cfgGetItem(pCfg, "numOfSnodeUniqueThreads")->i32;
|
tsNumOfSnodeWriteThreads = cfgGetItem(pCfg, "numOfSnodeUniqueThreads")->i32;
|
||||||
} else if (strcasecmp("numOfLogLines", name) == 0) {
|
} else if (strcasecmp("numOfLogLines", name) == 0) {
|
||||||
tsNumOfLogLines = cfgGetItem(pCfg, "numOfLogLines")->i32;
|
tsNumOfLogLines = cfgGetItem(pCfg, "numOfLogLines")->i32;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1485,6 +1485,7 @@ int32_t tSerializeSDropDnodeReq(void *buf, int32_t bufLen, SDropDnodeReq *pReq)
|
||||||
if (tEncodeI32(&encoder, pReq->dnodeId) < 0) return -1;
|
if (tEncodeI32(&encoder, pReq->dnodeId) < 0) return -1;
|
||||||
if (tEncodeCStr(&encoder, pReq->fqdn) < 0) return -1;
|
if (tEncodeCStr(&encoder, pReq->fqdn) < 0) return -1;
|
||||||
if (tEncodeI32(&encoder, pReq->port) < 0) return -1;
|
if (tEncodeI32(&encoder, pReq->port) < 0) return -1;
|
||||||
|
if (tEncodeI8(&encoder, pReq->force) < 0) return -1;
|
||||||
tEndEncode(&encoder);
|
tEndEncode(&encoder);
|
||||||
|
|
||||||
int32_t tlen = encoder.pos;
|
int32_t tlen = encoder.pos;
|
||||||
|
@ -1500,6 +1501,7 @@ int32_t tDeserializeSDropDnodeReq(void *buf, int32_t bufLen, SDropDnodeReq *pReq
|
||||||
if (tDecodeI32(&decoder, &pReq->dnodeId) < 0) return -1;
|
if (tDecodeI32(&decoder, &pReq->dnodeId) < 0) return -1;
|
||||||
if (tDecodeCStrTo(&decoder, pReq->fqdn) < 0) return -1;
|
if (tDecodeCStrTo(&decoder, pReq->fqdn) < 0) return -1;
|
||||||
if (tDecodeI32(&decoder, &pReq->port) < 0) return -1;
|
if (tDecodeI32(&decoder, &pReq->port) < 0) return -1;
|
||||||
|
if (tDecodeI8(&decoder, &pReq->force) < 0) return -1;
|
||||||
tEndDecode(&decoder);
|
tEndDecode(&decoder);
|
||||||
|
|
||||||
tDecoderClear(&decoder);
|
tDecoderClear(&decoder);
|
||||||
|
@ -4853,6 +4855,7 @@ int32_t tSerializeSCMCreateStreamReq(void *buf, int32_t bufLen, const SCMCreateS
|
||||||
if (tEncodeCStr(&encoder, pReq->sourceDB) < 0) return -1;
|
if (tEncodeCStr(&encoder, pReq->sourceDB) < 0) return -1;
|
||||||
if (tEncodeCStr(&encoder, pReq->targetStbFullName) < 0) return -1;
|
if (tEncodeCStr(&encoder, pReq->targetStbFullName) < 0) return -1;
|
||||||
if (tEncodeI8(&encoder, pReq->igExists) < 0) return -1;
|
if (tEncodeI8(&encoder, pReq->igExists) < 0) return -1;
|
||||||
|
if (tEncodeI8(&encoder, pReq->fillHistory) < 0) return -1;
|
||||||
if (tEncodeI32(&encoder, sqlLen) < 0) return -1;
|
if (tEncodeI32(&encoder, sqlLen) < 0) return -1;
|
||||||
if (tEncodeI32(&encoder, astLen) < 0) return -1;
|
if (tEncodeI32(&encoder, astLen) < 0) return -1;
|
||||||
if (tEncodeI8(&encoder, pReq->triggerType) < 0) return -1;
|
if (tEncodeI8(&encoder, pReq->triggerType) < 0) return -1;
|
||||||
|
@ -4889,6 +4892,7 @@ int32_t tDeserializeSCMCreateStreamReq(void *buf, int32_t bufLen, SCMCreateStrea
|
||||||
if (tDecodeCStrTo(&decoder, pReq->sourceDB) < 0) return -1;
|
if (tDecodeCStrTo(&decoder, pReq->sourceDB) < 0) return -1;
|
||||||
if (tDecodeCStrTo(&decoder, pReq->targetStbFullName) < 0) return -1;
|
if (tDecodeCStrTo(&decoder, pReq->targetStbFullName) < 0) return -1;
|
||||||
if (tDecodeI8(&decoder, &pReq->igExists) < 0) return -1;
|
if (tDecodeI8(&decoder, &pReq->igExists) < 0) return -1;
|
||||||
|
if (tDecodeI8(&decoder, &pReq->fillHistory) < 0) return -1;
|
||||||
if (tDecodeI32(&decoder, &sqlLen) < 0) return -1;
|
if (tDecodeI32(&decoder, &sqlLen) < 0) return -1;
|
||||||
if (tDecodeI32(&decoder, &astLen) < 0) return -1;
|
if (tDecodeI32(&decoder, &astLen) < 0) return -1;
|
||||||
if (tDecodeI8(&decoder, &pReq->triggerType) < 0) return -1;
|
if (tDecodeI8(&decoder, &pReq->triggerType) < 0) return -1;
|
||||||
|
@ -4994,6 +4998,7 @@ int32_t tDeserializeSMRecoverStreamReq(void *buf, int32_t bufLen, SMRecoverStrea
|
||||||
}
|
}
|
||||||
|
|
||||||
void tFreeSCMCreateStreamReq(SCMCreateStreamReq *pReq) {
|
void tFreeSCMCreateStreamReq(SCMCreateStreamReq *pReq) {
|
||||||
|
taosArrayDestroy(pReq->pTags);
|
||||||
taosMemoryFreeClear(pReq->sql);
|
taosMemoryFreeClear(pReq->sql);
|
||||||
taosMemoryFreeClear(pReq->ast);
|
taosMemoryFreeClear(pReq->ast);
|
||||||
}
|
}
|
||||||
|
@ -5158,7 +5163,7 @@ int tDecodeSVCreateTbReq(SDecoder *pCoder, SVCreateTbReq *pReq) {
|
||||||
char name[TSDB_COL_NAME_LEN] = {0};
|
char name[TSDB_COL_NAME_LEN] = {0};
|
||||||
char *tmp = NULL;
|
char *tmp = NULL;
|
||||||
if (tDecodeCStr(pCoder, &tmp) < 0) return -1;
|
if (tDecodeCStr(pCoder, &tmp) < 0) return -1;
|
||||||
strcpy(name, tmp);
|
strncpy(name, tmp, TSDB_COL_NAME_LEN - 1);
|
||||||
taosArrayPush(pReq->ctb.tagName, name);
|
taosArrayPush(pReq->ctb.tagName, name);
|
||||||
}
|
}
|
||||||
} else if (pReq->type == TSDB_NORMAL_TABLE) {
|
} else if (pReq->type == TSDB_NORMAL_TABLE) {
|
||||||
|
@ -5986,7 +5991,11 @@ int32_t tDecodeSMqDataRsp(SDecoder *pDecoder, SMqDataRsp *pRsp) {
|
||||||
if (pRsp->withSchema) {
|
if (pRsp->withSchema) {
|
||||||
SSchemaWrapper *pSW = (SSchemaWrapper *)taosMemoryCalloc(1, sizeof(SSchemaWrapper));
|
SSchemaWrapper *pSW = (SSchemaWrapper *)taosMemoryCalloc(1, sizeof(SSchemaWrapper));
|
||||||
if (pSW == NULL) return -1;
|
if (pSW == NULL) return -1;
|
||||||
if (tDecodeSSchemaWrapper(pDecoder, pSW) < 0) return -1;
|
if (tDecodeSSchemaWrapper(pDecoder, pSW) < 0) {
|
||||||
|
taosMemoryFree(pSW);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
taosArrayPush(pRsp->blockSchema, &pSW);
|
taosArrayPush(pRsp->blockSchema, &pSW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6067,7 +6076,10 @@ int32_t tDecodeSTaosxRsp(SDecoder *pDecoder, STaosxRsp *pRsp) {
|
||||||
if (pRsp->withSchema) {
|
if (pRsp->withSchema) {
|
||||||
SSchemaWrapper *pSW = (SSchemaWrapper *)taosMemoryCalloc(1, sizeof(SSchemaWrapper));
|
SSchemaWrapper *pSW = (SSchemaWrapper *)taosMemoryCalloc(1, sizeof(SSchemaWrapper));
|
||||||
if (pSW == NULL) return -1;
|
if (pSW == NULL) return -1;
|
||||||
if (tDecodeSSchemaWrapper(pDecoder, pSW) < 0) return -1;
|
if (tDecodeSSchemaWrapper(pDecoder, pSW) < 0) {
|
||||||
|
taosMemoryFree(pSW);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
taosArrayPush(pRsp->blockSchema, &pSW);
|
taosArrayPush(pRsp->blockSchema, &pSW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,13 @@ void tdSCellValPrint(SCellVal *pVal, int8_t colType) {
|
||||||
} else if (tdValTypeIsNone(pVal->valType)) {
|
} else if (tdValTypeIsNone(pVal->valType)) {
|
||||||
printf("NONE ");
|
printf("NONE ");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
if(!pVal->val) {
|
||||||
|
ASSERT(0);
|
||||||
|
printf("BadVal ");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (colType) {
|
switch (colType) {
|
||||||
case TSDB_DATA_TYPE_BOOL:
|
case TSDB_DATA_TYPE_BOOL:
|
||||||
printf("%s ", (*(int8_t *)pVal->val) == 0 ? "false" : "true");
|
printf("%s ", (*(int8_t *)pVal->val) == 0 ? "false" : "true");
|
||||||
|
@ -678,6 +684,10 @@ int32_t tdAppendColValToRow(SRowBuilder *pBuilder, col_id_t colId, int8_t colTyp
|
||||||
}
|
}
|
||||||
// TS KEY is stored in STSRow.ts and not included in STSRow.data field.
|
// TS KEY is stored in STSRow.ts and not included in STSRow.data field.
|
||||||
if (colId == PRIMARYKEY_TIMESTAMP_COL_ID) {
|
if (colId == PRIMARYKEY_TIMESTAMP_COL_ID) {
|
||||||
|
if (!val) {
|
||||||
|
terrno = TSDB_CODE_INVALID_PARA;
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
TD_ROW_KEY(pRow) = *(TSKEY *)val;
|
TD_ROW_KEY(pRow) = *(TSKEY *)val;
|
||||||
// The primary TS key is Norm all the time, thus its valType is not stored in bitmap.
|
// The primary TS key is Norm all the time, thus its valType is not stored in bitmap.
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
|
|
|
@ -507,29 +507,29 @@ int64_t convertTimeFromPrecisionToUnit(int64_t time, int32_t fromPrecision, char
|
||||||
double tmp = time;
|
double tmp = time;
|
||||||
switch (toUnit) {
|
switch (toUnit) {
|
||||||
case 's': {
|
case 's': {
|
||||||
tmp /= (NANOSECOND_PER_SEC / factors[fromPrecision]); // the result of division is an integer
|
|
||||||
time /= (NANOSECOND_PER_SEC / factors[fromPrecision]);
|
time /= (NANOSECOND_PER_SEC / factors[fromPrecision]);
|
||||||
|
tmp = (double)time;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'm':
|
case 'm':
|
||||||
tmp /= (NANOSECOND_PER_MINUTE / factors[fromPrecision]); // the result of division is an integer
|
|
||||||
time /= (NANOSECOND_PER_MINUTE / factors[fromPrecision]);
|
time /= (NANOSECOND_PER_MINUTE / factors[fromPrecision]);
|
||||||
|
tmp = (double)time;
|
||||||
break;
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
tmp /= (NANOSECOND_PER_HOUR / factors[fromPrecision]); // the result of division is an integer
|
|
||||||
time /= (NANOSECOND_PER_HOUR / factors[fromPrecision]);
|
time /= (NANOSECOND_PER_HOUR / factors[fromPrecision]);
|
||||||
|
tmp = (double)time;
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
tmp /= (NANOSECOND_PER_DAY / factors[fromPrecision]); // the result of division is an integer
|
|
||||||
time /= (NANOSECOND_PER_DAY / factors[fromPrecision]);
|
time /= (NANOSECOND_PER_DAY / factors[fromPrecision]);
|
||||||
|
tmp = (double)time;
|
||||||
break;
|
break;
|
||||||
case 'w':
|
case 'w':
|
||||||
tmp /= (NANOSECOND_PER_WEEK / factors[fromPrecision]); // the result of division is an integer
|
|
||||||
time /= (NANOSECOND_PER_WEEK / factors[fromPrecision]);
|
time /= (NANOSECOND_PER_WEEK / factors[fromPrecision]);
|
||||||
|
tmp = (double)time;
|
||||||
break;
|
break;
|
||||||
case 'a':
|
case 'a':
|
||||||
tmp /= (NANOSECOND_PER_MSEC / factors[fromPrecision]); // the result of division is an integer
|
|
||||||
time /= (NANOSECOND_PER_MSEC / factors[fromPrecision]);
|
time /= (NANOSECOND_PER_MSEC / factors[fromPrecision]);
|
||||||
|
tmp = (double)time;
|
||||||
break;
|
break;
|
||||||
case 'u':
|
case 'u':
|
||||||
// the result of (NANOSECOND_PER_USEC/(double)factors[fromPrecision]) maybe a double
|
// the result of (NANOSECOND_PER_USEC/(double)factors[fromPrecision]) maybe a double
|
||||||
|
@ -540,13 +540,13 @@ int64_t convertTimeFromPrecisionToUnit(int64_t time, int32_t fromPrecision, char
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TSDB_TIME_PRECISION_MICRO: {
|
case TSDB_TIME_PRECISION_MICRO: {
|
||||||
tmp /= 1;
|
|
||||||
time /= 1;
|
time /= 1;
|
||||||
|
tmp = (double)time;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TSDB_TIME_PRECISION_NANO: {
|
case TSDB_TIME_PRECISION_NANO: {
|
||||||
tmp /= 1000;
|
|
||||||
time /= 1000;
|
time /= 1000;
|
||||||
|
tmp = (double)time;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,7 +187,9 @@ void* tsBufDestroy(STSBuf* pTSBuf) {
|
||||||
|
|
||||||
if (pTSBuf->autoDelete) {
|
if (pTSBuf->autoDelete) {
|
||||||
// ("tsBuf %p destroyed, delete tmp file:%s", pTSBuf, pTSBuf->path);
|
// ("tsBuf %p destroyed, delete tmp file:%s", pTSBuf, pTSBuf->path);
|
||||||
taosRemoveFile(pTSBuf->path);
|
if (taosRemoveFile(pTSBuf->path) != 0) {
|
||||||
|
// tscError("tsBuf %p destroyed, failed to remove tmp file:%s", pTSBuf, pTSBuf->path);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// tscDebug("tsBuf %p destroyed, tmp file:%s, remains", pTSBuf, pTSBuf->path);
|
// tscDebug("tsBuf %p destroyed, tmp file:%s, remains", pTSBuf, pTSBuf->path);
|
||||||
}
|
}
|
||||||
|
|
|
@ -332,7 +332,6 @@ SArray *dmGetMsgHandles() {
|
||||||
|
|
||||||
// Requests handled by MNODE
|
// Requests handled by MNODE
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_GRANT, dmPutNodeMsgToMgmtQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_GRANT, dmPutNodeMsgToMgmtQueue, 0) == NULL) goto _OVER;
|
||||||
// if (dmSetMgmtHandle(pArray, TDMT_MND_GRANT_RSP, dmPutNodeMsgToMgmtQueue, 0) == NULL) goto _OVER;
|
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_AUTH_RSP, dmPutNodeMsgToMgmtQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_AUTH_RSP, dmPutNodeMsgToMgmtQueue, 0) == NULL) goto _OVER;
|
||||||
|
|
||||||
code = 0;
|
code = 0;
|
||||||
|
|
|
@ -20,7 +20,7 @@ static void *dmStatusThreadFp(void *param) {
|
||||||
SDnodeMgmt *pMgmt = param;
|
SDnodeMgmt *pMgmt = param;
|
||||||
int64_t lastTime = taosGetTimestampMs();
|
int64_t lastTime = taosGetTimestampMs();
|
||||||
setThreadName("dnode-status");
|
setThreadName("dnode-status");
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
taosMsleep(200);
|
taosMsleep(200);
|
||||||
if (pMgmt->pData->dropped || pMgmt->pData->stopped) break;
|
if (pMgmt->pData->dropped || pMgmt->pData->stopped) break;
|
||||||
|
@ -28,6 +28,7 @@ static void *dmStatusThreadFp(void *param) {
|
||||||
int64_t curTime = taosGetTimestampMs();
|
int64_t curTime = taosGetTimestampMs();
|
||||||
float interval = (curTime - lastTime) / 1000.0f;
|
float interval = (curTime - lastTime) / 1000.0f;
|
||||||
if (interval >= tsStatusInterval) {
|
if (interval >= tsStatusInterval) {
|
||||||
|
taosMemoryTrim(0);
|
||||||
dmSendStatusReq(pMgmt);
|
dmSendStatusReq(pMgmt);
|
||||||
lastTime = curTime;
|
lastTime = curTime;
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,6 +124,7 @@ SArray *mmGetMsgHandles() {
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_VGROUP_LIST, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_VGROUP_LIST, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_REDISTRIBUTE_VGROUP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_REDISTRIBUTE_VGROUP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_MERGE_VGROUP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_MERGE_VGROUP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||||
|
if (dmSetMgmtHandle(pArray, TDMT_MND_SPLIT_VGROUP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_BALANCE_VGROUP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_BALANCE_VGROUP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_CREATE_FUNC, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_CREATE_FUNC, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_RETRIEVE_FUNC, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_RETRIEVE_FUNC, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||||
|
|
|
@ -30,9 +30,9 @@ typedef struct SSnodeMgmt {
|
||||||
SMsgCb msgCb;
|
SMsgCb msgCb;
|
||||||
const char *path;
|
const char *path;
|
||||||
const char *name;
|
const char *name;
|
||||||
int8_t uniqueWorkerInUse;
|
int8_t writeWorkerInUse;
|
||||||
SArray *uniqueWorkers; // SArray<SMultiWorker*>
|
SArray *writeWroker; // SArray<SMultiWorker*>
|
||||||
SSingleWorker sharedWorker;
|
SSingleWorker streamWorker;
|
||||||
} SSnodeMgmt;
|
} SSnodeMgmt;
|
||||||
|
|
||||||
// smHandle.c
|
// smHandle.c
|
||||||
|
@ -43,13 +43,14 @@ int32_t smProcessDropReq(const SMgmtInputOpt *pInput, SRpcMsg *pMsg);
|
||||||
// smWorker.c
|
// smWorker.c
|
||||||
int32_t smStartWorker(SSnodeMgmt *pMgmt);
|
int32_t smStartWorker(SSnodeMgmt *pMgmt);
|
||||||
void smStopWorker(SSnodeMgmt *pMgmt);
|
void smStopWorker(SSnodeMgmt *pMgmt);
|
||||||
|
int32_t smPutMsgToQueue(SSnodeMgmt *pMgmt, EQueueType qtype, SRpcMsg *pMsg);
|
||||||
int32_t smPutNodeMsgToMgmtQueue(SSnodeMgmt *pMgmt, SRpcMsg *pMsg);
|
int32_t smPutNodeMsgToMgmtQueue(SSnodeMgmt *pMgmt, SRpcMsg *pMsg);
|
||||||
int32_t smPutNodeMsgToUniqueQueue(SSnodeMgmt *pMgmt, SRpcMsg *pMsg);
|
int32_t smPutNodeMsgToWriteQueue(SSnodeMgmt *pMgmt, SRpcMsg *pMsg);
|
||||||
int32_t smPutNodeMsgToSharedQueue(SSnodeMgmt *pMgmt, SRpcMsg *pMsg);
|
int32_t smPutNodeMsgToStreamQueue(SSnodeMgmt *pMgmt, SRpcMsg *pMsg);
|
||||||
int32_t smPutNodeMsgToExecQueue(SSnodeMgmt *pMgmt, SRpcMsg *pMsg);
|
void sndEnqueueStreamDispatch(SSnode *pSnode, SRpcMsg *pMsg);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /*_TD_DND_SNODE_INT_H_*/
|
#endif /*_TD_DND_SNODE_INT_H_*/
|
||||||
|
|
|
@ -69,13 +69,13 @@ SArray *smGetMsgHandles() {
|
||||||
|
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_DEPLOY, smPutNodeMsgToMgmtQueue, 1) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_DEPLOY, smPutNodeMsgToMgmtQueue, 1) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_DROP, smPutNodeMsgToMgmtQueue, 1) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_DROP, smPutNodeMsgToMgmtQueue, 1) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_RUN, smPutNodeMsgToSharedQueue, 1) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_RUN, smPutNodeMsgToStreamQueue, 1) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_DISPATCH, smPutNodeMsgToSharedQueue, 1) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_DISPATCH, smPutNodeMsgToStreamQueue, 1) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_DISPATCH_RSP, smPutNodeMsgToSharedQueue, 1) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_DISPATCH_RSP, smPutNodeMsgToStreamQueue, 1) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_RECOVER, smPutNodeMsgToSharedQueue, 1) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_RECOVER, smPutNodeMsgToStreamQueue, 1) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_RECOVER_RSP, smPutNodeMsgToSharedQueue, 1) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_RECOVER_RSP, smPutNodeMsgToStreamQueue, 1) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_STREAM_RETRIEVE, smPutNodeMsgToSharedQueue, 1) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_STREAM_RETRIEVE, smPutNodeMsgToStreamQueue, 1) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_STREAM_RETRIEVE_RSP, smPutNodeMsgToSharedQueue, 1) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_STREAM_RETRIEVE_RSP, smPutNodeMsgToStreamQueue, 1) == NULL) goto _OVER;
|
||||||
|
|
||||||
code = 0;
|
code = 0;
|
||||||
_OVER:
|
_OVER:
|
||||||
|
|
|
@ -45,6 +45,7 @@ int32_t smOpen(SMgmtInputOpt *pInput, SMgmtOutputOpt *pOutput) {
|
||||||
pMgmt->name = pInput->name;
|
pMgmt->name = pInput->name;
|
||||||
pMgmt->msgCb = pInput->msgCb;
|
pMgmt->msgCb = pInput->msgCb;
|
||||||
pMgmt->msgCb.mgmt = pMgmt;
|
pMgmt->msgCb.mgmt = pMgmt;
|
||||||
|
pMgmt->msgCb.putToQueueFp = (PutToQueueFp)smPutMsgToQueue;
|
||||||
|
|
||||||
SSnodeOpt option = {0};
|
SSnodeOpt option = {0};
|
||||||
smInitOption(pMgmt, &option);
|
smInitOption(pMgmt, &option);
|
||||||
|
|
|
@ -26,18 +26,24 @@ static inline void smSendRsp(SRpcMsg *pMsg, int32_t code) {
|
||||||
tmsgSendRsp(&rsp);
|
tmsgSendRsp(&rsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void smProcessUniqueQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) {
|
static void smProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) {
|
||||||
SSnodeMgmt *pMgmt = pInfo->ahandle;
|
SSnodeMgmt *pMgmt = pInfo->ahandle;
|
||||||
|
|
||||||
for (int32_t i = 0; i < numOfMsgs; i++) {
|
for (int32_t i = 0; i < numOfMsgs; i++) {
|
||||||
SRpcMsg *pMsg = NULL;
|
SRpcMsg *pMsg = NULL;
|
||||||
taosGetQitem(qall, (void **)&pMsg);
|
taosGetQitem(qall, (void **)&pMsg);
|
||||||
|
const STraceId *trace = &pMsg->info.traceId;
|
||||||
|
|
||||||
dTrace("msg:%p, get from snode-unique queue", pMsg);
|
dTrace("msg:%p, get from snode-write queue", pMsg);
|
||||||
if (sndProcessUMsg(pMgmt->pSnode, pMsg) < 0) {
|
int32_t code = sndProcessWriteMsg(pMgmt->pSnode, pMsg, NULL);
|
||||||
ASSERT(0);
|
if (code < 0) {
|
||||||
|
dGError("snd, msg:%p failed to process write since %s", pMsg, terrstr(code));
|
||||||
|
if (pMsg->info.handle != NULL) {
|
||||||
|
tmsgSendRsp(pMsg);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
smSendRsp(pMsg, 0);
|
||||||
}
|
}
|
||||||
smSendRsp(pMsg, 0);
|
|
||||||
|
|
||||||
dTrace("msg:%p, is freed", pMsg);
|
dTrace("msg:%p, is freed", pMsg);
|
||||||
rpcFreeCont(pMsg->pCont);
|
rpcFreeCont(pMsg->pCont);
|
||||||
|
@ -45,13 +51,15 @@ static void smProcessUniqueQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t num
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void smProcessSharedQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
|
static void smProcessStreamQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
|
||||||
SSnodeMgmt *pMgmt = pInfo->ahandle;
|
SSnodeMgmt *pMgmt = pInfo->ahandle;
|
||||||
|
const STraceId *trace = &pMsg->info.traceId;
|
||||||
|
|
||||||
dTrace("msg:%p, get from snode-shared queue", pMsg);
|
dTrace("msg:%p, get from snode-stream queue", pMsg);
|
||||||
if (sndProcessSMsg(pMgmt->pSnode, pMsg) < 0) {
|
int32_t code = sndProcessStreamMsg(pMgmt->pSnode, pMsg);
|
||||||
|
if (code < 0) {
|
||||||
|
dGError("snd, msg:%p failed to process stream since %s", pMsg, terrstr(code));
|
||||||
smSendRsp(pMsg, terrno);
|
smSendRsp(pMsg, terrno);
|
||||||
ASSERT(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dTrace("msg:%p, is freed", pMsg);
|
dTrace("msg:%p, is freed", pMsg);
|
||||||
|
@ -60,44 +68,44 @@ static void smProcessSharedQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t smStartWorker(SSnodeMgmt *pMgmt) {
|
int32_t smStartWorker(SSnodeMgmt *pMgmt) {
|
||||||
pMgmt->uniqueWorkers = taosArrayInit(0, sizeof(SMultiWorker *));
|
pMgmt->writeWroker = taosArrayInit(0, sizeof(SMultiWorker *));
|
||||||
if (pMgmt->uniqueWorkers == NULL) {
|
if (pMgmt->writeWroker == NULL) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t i = 0; i < tsNumOfSnodeUniqueThreads; i++) {
|
for (int32_t i = 0; i < tsNumOfSnodeWriteThreads; i++) {
|
||||||
SMultiWorker *pUniqueWorker = taosMemoryMalloc(sizeof(SMultiWorker));
|
SMultiWorker *pWriteWorker = taosMemoryMalloc(sizeof(SMultiWorker));
|
||||||
if (pUniqueWorker == NULL) {
|
if (pWriteWorker == NULL) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
SMultiWorkerCfg cfg = {
|
SMultiWorkerCfg cfg = {
|
||||||
.max = 1,
|
.max = 1,
|
||||||
.name = "snode-unique",
|
.name = "snode-write",
|
||||||
.fp = smProcessUniqueQueue,
|
.fp = smProcessWriteQueue,
|
||||||
.param = pMgmt,
|
.param = pMgmt,
|
||||||
};
|
};
|
||||||
if (tMultiWorkerInit(pUniqueWorker, &cfg) != 0) {
|
if (tMultiWorkerInit(pWriteWorker, &cfg) != 0) {
|
||||||
dError("failed to start snode-unique worker since %s", terrstr());
|
dError("failed to start snode-unique worker since %s", terrstr());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (taosArrayPush(pMgmt->uniqueWorkers, &pUniqueWorker) == NULL) {
|
if (taosArrayPush(pMgmt->writeWroker, &pWriteWorker) == NULL) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SSingleWorkerCfg cfg = {
|
SSingleWorkerCfg cfg = {
|
||||||
.min = tsNumOfSnodeSharedThreads,
|
.min = tsNumOfSnodeStreamThreads,
|
||||||
.max = tsNumOfSnodeSharedThreads,
|
.max = tsNumOfSnodeStreamThreads,
|
||||||
.name = "snode-shared",
|
.name = "snode-stream",
|
||||||
.fp = (FItem)smProcessSharedQueue,
|
.fp = (FItem)smProcessStreamQueue,
|
||||||
.param = pMgmt,
|
.param = pMgmt,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (tSingleWorkerInit(&pMgmt->sharedWorker, &cfg)) {
|
if (tSingleWorkerInit(&pMgmt->streamWorker, &cfg)) {
|
||||||
dError("failed to start snode shared-worker since %s", terrstr());
|
dError("failed to start snode shared-worker since %s", terrstr());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -107,30 +115,50 @@ int32_t smStartWorker(SSnodeMgmt *pMgmt) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void smStopWorker(SSnodeMgmt *pMgmt) {
|
void smStopWorker(SSnodeMgmt *pMgmt) {
|
||||||
for (int32_t i = 0; i < taosArrayGetSize(pMgmt->uniqueWorkers); i++) {
|
for (int32_t i = 0; i < taosArrayGetSize(pMgmt->writeWroker); i++) {
|
||||||
SMultiWorker *pWorker = taosArrayGetP(pMgmt->uniqueWorkers, i);
|
SMultiWorker *pWorker = taosArrayGetP(pMgmt->writeWroker, i);
|
||||||
tMultiWorkerCleanup(pWorker);
|
tMultiWorkerCleanup(pWorker);
|
||||||
}
|
}
|
||||||
taosArrayDestroy(pMgmt->uniqueWorkers);
|
taosArrayDestroy(pMgmt->writeWroker);
|
||||||
tSingleWorkerCleanup(&pMgmt->sharedWorker);
|
tSingleWorkerCleanup(&pMgmt->streamWorker);
|
||||||
dDebug("snode workers are closed");
|
dDebug("snode workers are closed");
|
||||||
}
|
}
|
||||||
|
|
||||||
static FORCE_INLINE int32_t smGetSWIdFromMsg(SRpcMsg *pMsg) {
|
int32_t smPutMsgToQueue(SSnodeMgmt *pMgmt, EQueueType qtype, SRpcMsg *pRpc) {
|
||||||
SMsgHead *pHead = pMsg->pCont;
|
SRpcMsg *pMsg = taosAllocateQitem(sizeof(SRpcMsg), RPC_QITEM);
|
||||||
pHead->vgId = htonl(pHead->vgId);
|
if (pMsg == NULL) {
|
||||||
return pHead->vgId % tsNumOfSnodeUniqueThreads;
|
rpcFreeCont(pRpc->pCont);
|
||||||
}
|
pRpc->pCont = NULL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
static FORCE_INLINE int32_t smGetSWTypeFromMsg(SRpcMsg *pMsg) {
|
SSnode *pSnode = pMgmt->pSnode;
|
||||||
/*SMsgHead *pHead = pMsg->pCont;*/
|
if (pSnode == NULL) {
|
||||||
/*pHead->workerType = htonl(pHead->workerType);*/
|
dError("snode: msg:%p failed to put into vnode queue since %s, type:%s qtype:%d", pMsg, terrstr(),
|
||||||
/*return pHead->workerType;*/
|
TMSG_INFO(pMsg->msgType), qtype);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
SMsgHead *pHead = pRpc->pCont;
|
||||||
|
pHead->contLen = htonl(pHead->contLen);
|
||||||
|
pHead->vgId = SNODE_HANDLE;
|
||||||
|
memcpy(pMsg, pRpc, sizeof(SRpcMsg));
|
||||||
|
|
||||||
|
switch (qtype) {
|
||||||
|
case STREAM_QUEUE:
|
||||||
|
smPutNodeMsgToStreamQueue(pMgmt, pMsg);
|
||||||
|
break;
|
||||||
|
case WRITE_QUEUE:
|
||||||
|
smPutNodeMsgToWriteQueue(pMgmt, pMsg);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ASSERT(0);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t smPutNodeMsgToMgmtQueue(SSnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
int32_t smPutNodeMsgToMgmtQueue(SSnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
||||||
SMultiWorker *pWorker = taosArrayGetP(pMgmt->uniqueWorkers, 0);
|
SMultiWorker *pWorker = taosArrayGetP(pMgmt->writeWroker, 0);
|
||||||
if (pWorker == NULL) {
|
if (pWorker == NULL) {
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -141,9 +169,8 @@ int32_t smPutNodeMsgToMgmtQueue(SSnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t smPutNodeMsgToUniqueQueue(SSnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
int32_t smPutNodeMsgToWriteQueue(SSnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
||||||
int32_t index = smGetSWIdFromMsg(pMsg);
|
SMultiWorker *pWorker = taosArrayGetP(pMgmt->writeWroker, 0);
|
||||||
SMultiWorker *pWorker = taosArrayGetP(pMgmt->uniqueWorkers, index);
|
|
||||||
if (pWorker == NULL) {
|
if (pWorker == NULL) {
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -154,19 +181,14 @@ int32_t smPutNodeMsgToUniqueQueue(SSnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t smPutNodeMsgToSharedQueue(SSnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
int32_t smPutNodeMsgToStreamQueue(SSnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
||||||
SSingleWorker *pWorker = &pMgmt->sharedWorker;
|
SSingleWorker *pWorker = &pMgmt->streamWorker;
|
||||||
|
|
||||||
dTrace("msg:%p, put into worker %s", pMsg, pWorker->name);
|
dTrace("msg:%p, put into worker %s", pMsg, pWorker->name);
|
||||||
taosWriteQitem(pWorker->queue, pMsg);
|
if (pMsg->msgType == TDMT_STREAM_TASK_DISPATCH) {
|
||||||
return 0;
|
sndEnqueueStreamDispatch(pMgmt->pSnode, pMsg);
|
||||||
}
|
|
||||||
|
|
||||||
int32_t smPutNodeMsgToExecQueue(SSnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
|
||||||
int32_t workerType = smGetSWTypeFromMsg(pMsg);
|
|
||||||
if (workerType == SND_WORKER_TYPE__SHARED) {
|
|
||||||
return smPutNodeMsgToSharedQueue(pMgmt, pMsg);
|
|
||||||
} else {
|
} else {
|
||||||
return smPutNodeMsgToUniqueQueue(pMgmt, pMsg);
|
taosWriteQitem(pWorker->queue, pMsg);
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -307,6 +307,10 @@ int32_t vmGetQueueSize(SVnodeMgmt *pMgmt, int32_t vgId, EQueueType qtype) {
|
||||||
}
|
}
|
||||||
vmReleaseVnode(pMgmt, pVnode);
|
vmReleaseVnode(pMgmt, pVnode);
|
||||||
}
|
}
|
||||||
|
if (size < 0) {
|
||||||
|
dError("vgId:%d, can't get size from queue since %s, qtype:%d", vgId, terrstr(), qtype);
|
||||||
|
size = 0;
|
||||||
|
}
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,8 @@ class TestServer {
|
||||||
public:
|
public:
|
||||||
bool Start();
|
bool Start();
|
||||||
void Stop();
|
void Stop();
|
||||||
|
bool runnning;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TdThread threadId;
|
TdThread threadId;
|
||||||
};
|
};
|
||||||
|
|
|
@ -16,8 +16,18 @@
|
||||||
#include "sut.h"
|
#include "sut.h"
|
||||||
|
|
||||||
void* serverLoop(void* param) {
|
void* serverLoop(void* param) {
|
||||||
dmInit();
|
TestServer* server = (TestServer*)param;
|
||||||
dmRun();
|
server->runnning = false;
|
||||||
|
|
||||||
|
if (dmInit() != 0) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
server->runnning = true;
|
||||||
|
if (dmRun() != 0) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
dmCleanup();
|
dmCleanup();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -26,10 +36,10 @@ bool TestServer::Start() {
|
||||||
TdThreadAttr thAttr;
|
TdThreadAttr thAttr;
|
||||||
taosThreadAttrInit(&thAttr);
|
taosThreadAttrInit(&thAttr);
|
||||||
taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE);
|
taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE);
|
||||||
taosThreadCreate(&threadId, &thAttr, serverLoop, NULL);
|
taosThreadCreate(&threadId, &thAttr, serverLoop, this);
|
||||||
taosThreadAttrDestroy(&thAttr);
|
taosThreadAttrDestroy(&thAttr);
|
||||||
taosMsleep(2100);
|
taosMsleep(2100);
|
||||||
return true;
|
return runnning;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestServer::Stop() {
|
void TestServer::Stop() {
|
||||||
|
|
|
@ -53,7 +53,10 @@ void Testbase::Init(const char* path, int16_t port) {
|
||||||
taosMkDir(path);
|
taosMkDir(path);
|
||||||
InitLog(TD_TMP_DIR_PATH "td");
|
InitLog(TD_TMP_DIR_PATH "td");
|
||||||
|
|
||||||
server.Start();
|
if (!server.Start()) {
|
||||||
|
printf("failed to start server, exit\n");
|
||||||
|
exit(0);
|
||||||
|
};
|
||||||
client.Init("root", "taosdata");
|
client.Init("root", "taosdata");
|
||||||
showRsp = NULL;
|
showRsp = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,8 +80,8 @@ typedef struct {
|
||||||
} SProfileMgmt;
|
} SProfileMgmt;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
SRWLatch lock;
|
TdThreadMutex lock;
|
||||||
char email[TSDB_FQDN_LEN];
|
char email[TSDB_FQDN_LEN];
|
||||||
} STelemMgmt;
|
} STelemMgmt;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -28,7 +28,7 @@ SMnodeObj *mndAcquireMnode(SMnode *pMnode, int32_t mnodeId);
|
||||||
void mndReleaseMnode(SMnode *pMnode, SMnodeObj *pObj);
|
void mndReleaseMnode(SMnode *pMnode, SMnodeObj *pObj);
|
||||||
bool mndIsMnode(SMnode *pMnode, int32_t dnodeId);
|
bool mndIsMnode(SMnode *pMnode, int32_t dnodeId);
|
||||||
void mndGetMnodeEpSet(SMnode *pMnode, SEpSet *pEpSet);
|
void mndGetMnodeEpSet(SMnode *pMnode, SEpSet *pEpSet);
|
||||||
int32_t mndSetDropMnodeInfoToTrans(SMnode *pMnode, STrans *pTrans, SMnodeObj *pObj);
|
int32_t mndSetDropMnodeInfoToTrans(SMnode *pMnode, STrans *pTrans, SMnodeObj *pObj, bool force);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,50 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
|
||||||
*
|
|
||||||
* This program is free software: you can use, redistribute, and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License, version 3
|
|
||||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _TD_MND_OFFSET_H_
|
|
||||||
#define _TD_MND_OFFSET_H_
|
|
||||||
|
|
||||||
#include "mndInt.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int32_t mndInitOffset(SMnode *pMnode);
|
|
||||||
void mndCleanupOffset(SMnode *pMnode);
|
|
||||||
|
|
||||||
SMqOffsetObj *mndAcquireOffset(SMnode *pMnode, const char *key);
|
|
||||||
void mndReleaseOffset(SMnode *pMnode, SMqOffsetObj *pOffset);
|
|
||||||
|
|
||||||
SSdbRaw *mndOffsetActionEncode(SMqOffsetObj *pOffset);
|
|
||||||
SSdbRow *mndOffsetActionDecode(SSdbRaw *pRaw);
|
|
||||||
|
|
||||||
int32_t mndCreateOffsets(STrans *pTrans, const char *cgroup, const char *topicName, const SArray *vgs);
|
|
||||||
|
|
||||||
static FORCE_INLINE int32_t mndMakePartitionKey(char *key, const char *cgroup, const char *topicName, int32_t vgId) {
|
|
||||||
return snprintf(key, TSDB_PARTITION_KEY_LEN, "%d:%s:%s", vgId, cgroup, topicName);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t mndDropOffsetByDB(SMnode *pMnode, STrans *pTrans, SDbObj *pDb);
|
|
||||||
int32_t mndDropOffsetByTopic(SMnode *pMnode, STrans *pTrans, const char *topic);
|
|
||||||
int32_t mndDropOffsetBySubKey(SMnode *pMnode, STrans *pTrans, const char *subKey);
|
|
||||||
|
|
||||||
bool mndOffsetFromTopic(SMqOffsetObj *pOffset, const char *topic);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /*_TD_MND_OFFSET_H_*/
|
|
|
@ -29,7 +29,7 @@ void mndCleanupQnode(SMnode *pMnode);
|
||||||
SQnodeObj *mndAcquireQnode(SMnode *pMnode, int32_t qnodeId);
|
SQnodeObj *mndAcquireQnode(SMnode *pMnode, int32_t qnodeId);
|
||||||
void mndReleaseQnode(SMnode *pMnode, SQnodeObj *pObj);
|
void mndReleaseQnode(SMnode *pMnode, SQnodeObj *pObj);
|
||||||
int32_t mndCreateQnodeList(SMnode *pMnode, SArray **pList, int32_t limit);
|
int32_t mndCreateQnodeList(SMnode *pMnode, SArray **pList, int32_t limit);
|
||||||
int32_t mndSetDropQnodeInfoToTrans(SMnode *pMnode, STrans *pTrans, SQnodeObj *pObj);
|
int32_t mndSetDropQnodeInfoToTrans(SMnode *pMnode, STrans *pTrans, SQnodeObj *pObj, bool force);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ void mndCleanupSnode(SMnode *pMnode);
|
||||||
SSnodeObj *mndAcquireSnode(SMnode *pMnode, int32_t qnodeId);
|
SSnodeObj *mndAcquireSnode(SMnode *pMnode, int32_t qnodeId);
|
||||||
void mndReleaseSnode(SMnode *pMnode, SSnodeObj *pObj);
|
void mndReleaseSnode(SMnode *pMnode, SSnodeObj *pObj);
|
||||||
SEpSet mndAcquireEpFromSnode(SMnode *pMnode, const SSnodeObj *pSnode);
|
SEpSet mndAcquireEpFromSnode(SMnode *pMnode, const SSnodeObj *pSnode);
|
||||||
int32_t mndSetDropSnodeInfoToTrans(SMnode *pMnode, STrans *pTrans, SSnodeObj *pObj);
|
int32_t mndSetDropSnodeInfoToTrans(SMnode *pMnode, STrans *pTrans, SSnodeObj *pObj, bool force);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,10 @@ void mndReleaseSubscribe(SMnode *pMnode, SMqSubscribeObj *pSub);
|
||||||
|
|
||||||
int32_t mndMakeSubscribeKey(char *key, const char *cgroup, const char *topicName);
|
int32_t mndMakeSubscribeKey(char *key, const char *cgroup, const char *topicName);
|
||||||
|
|
||||||
|
static FORCE_INLINE int32_t mndMakePartitionKey(char *key, const char *cgroup, const char *topicName, int32_t vgId) {
|
||||||
|
return snprintf(key, TSDB_PARTITION_KEY_LEN, "%d:%s:%s", vgId, cgroup, topicName);
|
||||||
|
}
|
||||||
|
|
||||||
int32_t mndDropSubByDB(SMnode *pMnode, STrans *pTrans, SDbObj *pDb);
|
int32_t mndDropSubByDB(SMnode *pMnode, STrans *pTrans, SDbObj *pDb);
|
||||||
int32_t mndDropSubByTopic(SMnode *pMnode, STrans *pTrans, const char *topic);
|
int32_t mndDropSubByTopic(SMnode *pMnode, STrans *pTrans, const char *topic);
|
||||||
int32_t mndSetDropSubCommitLogs(SMnode *pMnode, STrans *pTrans, SMqSubscribeObj *pSub);
|
int32_t mndSetDropSubCommitLogs(SMnode *pMnode, STrans *pTrans, SMqSubscribeObj *pSub);
|
||||||
|
|
|
@ -42,8 +42,7 @@ int32_t mndAddCreateVnodeAction(SMnode *, STrans *pTrans, SDbObj *pDb, SVgObj *p
|
||||||
int32_t mndAddAlterVnodeConfirmAction(SMnode *, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup);
|
int32_t mndAddAlterVnodeConfirmAction(SMnode *, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup);
|
||||||
int32_t mndAddAlterVnodeAction(SMnode *, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, tmsg_t msgType);
|
int32_t mndAddAlterVnodeAction(SMnode *, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, tmsg_t msgType);
|
||||||
int32_t mndAddDropVnodeAction(SMnode *, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, SVnodeGid *pVgid, bool isRedo);
|
int32_t mndAddDropVnodeAction(SMnode *, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, SVnodeGid *pVgid, bool isRedo);
|
||||||
int32_t mndSetMoveVgroupInfoToTrans(SMnode *, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, int32_t vn, SArray *pArray);
|
int32_t mndSetMoveVgroupsInfoToTrans(SMnode *, STrans *pTrans, int32_t dropDnodeId, bool force);
|
||||||
int32_t mndSetMoveVgroupsInfoToTrans(SMnode *, STrans *pTrans, int32_t dropDnodeId);
|
|
||||||
int32_t mndBuildAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pOldDb, SDbObj *pNewDb, SVgObj *pVgroup,
|
int32_t mndBuildAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pOldDb, SDbObj *pNewDb, SVgObj *pVgroup,
|
||||||
SArray *pArray);
|
SArray *pArray);
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
#include "mndDb.h"
|
#include "mndDb.h"
|
||||||
#include "mndDnode.h"
|
#include "mndDnode.h"
|
||||||
#include "mndMnode.h"
|
#include "mndMnode.h"
|
||||||
#include "mndOffset.h"
|
|
||||||
#include "mndPrivilege.h"
|
#include "mndPrivilege.h"
|
||||||
#include "mndShow.h"
|
#include "mndShow.h"
|
||||||
#include "mndStb.h"
|
#include "mndStb.h"
|
||||||
|
@ -408,12 +407,6 @@ static int32_t mndProcessAskEpReq(SRpcMsg *pMsg) {
|
||||||
.offset = -1,
|
.offset = -1,
|
||||||
};
|
};
|
||||||
|
|
||||||
// 2.2.2 fetch vg offset
|
|
||||||
SMqOffsetObj *pOffsetObj = mndAcquireOffset(pMnode, offsetKey);
|
|
||||||
if (pOffsetObj != NULL) {
|
|
||||||
vgEp.offset = atomic_load_64(&pOffsetObj->offset);
|
|
||||||
mndReleaseOffset(pMnode, pOffsetObj);
|
|
||||||
}
|
|
||||||
taosArrayPush(topicEp.vgs, &vgEp);
|
taosArrayPush(topicEp.vgs, &vgEp);
|
||||||
}
|
}
|
||||||
taosArrayPush(rsp.topics, &topicEp);
|
taosArrayPush(rsp.topics, &topicEp);
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
#include "mndDb.h"
|
#include "mndDb.h"
|
||||||
#include "mndCluster.h"
|
#include "mndCluster.h"
|
||||||
#include "mndDnode.h"
|
#include "mndDnode.h"
|
||||||
#include "mndOffset.h"
|
|
||||||
#include "mndPrivilege.h"
|
#include "mndPrivilege.h"
|
||||||
#include "mndShow.h"
|
#include "mndShow.h"
|
||||||
#include "mndSma.h"
|
#include "mndSma.h"
|
||||||
|
@ -641,12 +640,8 @@ static int32_t mndSetDbCfgFromAlterDbReq(SDbObj *pDb, SAlterDbReq *pAlter) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pAlter->pageSize > 0 && pAlter->pageSize != pDb->cfg.pageSize) {
|
if (pAlter->pageSize > 0 && pAlter->pageSize != pDb->cfg.pageSize) {
|
||||||
#if 1
|
|
||||||
terrno = TSDB_CODE_OPS_NOT_SUPPORT;
|
|
||||||
#else
|
|
||||||
pDb->cfg.pageSize = pAlter->pageSize;
|
pDb->cfg.pageSize = pAlter->pageSize;
|
||||||
terrno = 0;
|
terrno = 0;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pAlter->daysPerFile > 0 && pAlter->daysPerFile != pDb->cfg.daysPerFile) {
|
if (pAlter->daysPerFile > 0 && pAlter->daysPerFile != pDb->cfg.daysPerFile) {
|
||||||
|
|
|
@ -670,7 +670,7 @@ _OVER:
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t mndDropDnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode, SMnodeObj *pMObj, SQnodeObj *pQObj,
|
static int32_t mndDropDnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode, SMnodeObj *pMObj, SQnodeObj *pQObj,
|
||||||
SSnodeObj *pSObj, int32_t numOfVnodes) {
|
SSnodeObj *pSObj, int32_t numOfVnodes, bool force) {
|
||||||
int32_t code = -1;
|
int32_t code = -1;
|
||||||
SSdbRaw *pRaw = NULL;
|
SSdbRaw *pRaw = NULL;
|
||||||
STrans *pTrans = NULL;
|
STrans *pTrans = NULL;
|
||||||
|
@ -678,7 +678,7 @@ static int32_t mndDropDnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode, SM
|
||||||
pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq, "drop-dnode");
|
pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq, "drop-dnode");
|
||||||
if (pTrans == NULL) goto _OVER;
|
if (pTrans == NULL) goto _OVER;
|
||||||
mndTransSetSerial(pTrans);
|
mndTransSetSerial(pTrans);
|
||||||
mInfo("trans:%d, used to drop dnode:%d", pTrans->id, pDnode->id);
|
mInfo("trans:%d, used to drop dnode:%d, force:%d", pTrans->id, pDnode->id, force);
|
||||||
|
|
||||||
pRaw = mndDnodeActionEncode(pDnode);
|
pRaw = mndDnodeActionEncode(pDnode);
|
||||||
if (pRaw == NULL) goto _OVER;
|
if (pRaw == NULL) goto _OVER;
|
||||||
|
@ -694,22 +694,22 @@ static int32_t mndDropDnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode, SM
|
||||||
|
|
||||||
if (pMObj != NULL) {
|
if (pMObj != NULL) {
|
||||||
mInfo("trans:%d, mnode on dnode:%d will be dropped", pTrans->id, pDnode->id);
|
mInfo("trans:%d, mnode on dnode:%d will be dropped", pTrans->id, pDnode->id);
|
||||||
if (mndSetDropMnodeInfoToTrans(pMnode, pTrans, pMObj) != 0) goto _OVER;
|
if (mndSetDropMnodeInfoToTrans(pMnode, pTrans, pMObj, force) != 0) goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pQObj != NULL) {
|
if (pQObj != NULL) {
|
||||||
mInfo("trans:%d, qnode on dnode:%d will be dropped", pTrans->id, pDnode->id);
|
mInfo("trans:%d, qnode on dnode:%d will be dropped", pTrans->id, pDnode->id);
|
||||||
if (mndSetDropQnodeInfoToTrans(pMnode, pTrans, pQObj) != 0) goto _OVER;
|
if (mndSetDropQnodeInfoToTrans(pMnode, pTrans, pQObj, force) != 0) goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pSObj != NULL) {
|
if (pSObj != NULL) {
|
||||||
mInfo("trans:%d, snode on dnode:%d will be dropped", pTrans->id, pDnode->id);
|
mInfo("trans:%d, snode on dnode:%d will be dropped", pTrans->id, pDnode->id);
|
||||||
if (mndSetDropSnodeInfoToTrans(pMnode, pTrans, pSObj) != 0) goto _OVER;
|
if (mndSetDropSnodeInfoToTrans(pMnode, pTrans, pSObj, force) != 0) goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (numOfVnodes > 0) {
|
if (numOfVnodes > 0) {
|
||||||
mInfo("trans:%d, %d vnodes on dnode:%d will be dropped", pTrans->id, numOfVnodes, pDnode->id);
|
mInfo("trans:%d, %d vnodes on dnode:%d will be dropped", pTrans->id, numOfVnodes, pDnode->id);
|
||||||
if (mndSetMoveVgroupsInfoToTrans(pMnode, pTrans, pDnode->id) != 0) goto _OVER;
|
if (mndSetMoveVgroupsInfoToTrans(pMnode, pTrans, pDnode->id, force) != 0) goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
|
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
|
||||||
|
@ -767,21 +767,16 @@ static int32_t mndProcessDropDnodeReq(SRpcMsg *pReq) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t numOfVnodes = mndGetVnodesNum(pMnode, pDnode->id);
|
int32_t numOfVnodes = mndGetVnodesNum(pMnode, pDnode->id);
|
||||||
if (numOfVnodes > 0 || pMObj != NULL) {
|
if ((numOfVnodes > 0 || pMObj != NULL || pSObj != NULL || pQObj != NULL) && !dropReq.force) {
|
||||||
if (!mndIsDnodeOnline(pDnode, taosGetTimestampMs())) {
|
if (!mndIsDnodeOnline(pDnode, taosGetTimestampMs())) {
|
||||||
terrno = TSDB_CODE_NODE_OFFLINE;
|
terrno = TSDB_CODE_NODE_OFFLINE;
|
||||||
mError("dnode:%d, failed to drop since %s, has_mnode:%d numOfVnodes:%d", pDnode->id, terrstr(), pMObj != NULL,
|
mError("dnode:%d, failed to drop since %s, vnodes:%d mnode:%d qnode:%d snode:%d", pDnode->id, terrstr(),
|
||||||
numOfVnodes);
|
numOfVnodes, pMObj != NULL, pQObj != NULL, pSObj != NULL);
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (numOfVnodes > 0) {
|
code = mndDropDnode(pMnode, pReq, pDnode, pMObj, pQObj, pSObj, numOfVnodes, dropReq.force);
|
||||||
terrno = TSDB_CODE_OPS_NOT_SUPPORT;
|
|
||||||
goto _OVER;
|
|
||||||
}
|
|
||||||
|
|
||||||
code = mndDropDnode(pMnode, pReq, pDnode, pMObj, pQObj, pSObj, numOfVnodes);
|
|
||||||
if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS;
|
if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS;
|
||||||
|
|
||||||
_OVER:
|
_OVER:
|
||||||
|
|
|
@ -21,10 +21,8 @@
|
||||||
|
|
||||||
static int32_t mndRetrieveGrant(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) {
|
static int32_t mndRetrieveGrant(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) {
|
||||||
int32_t numOfRows = 0;
|
int32_t numOfRows = 0;
|
||||||
char *pWrite;
|
|
||||||
int32_t cols = 0;
|
int32_t cols = 0;
|
||||||
char tmp[32];
|
char tmp[32];
|
||||||
char tmp1[32];
|
|
||||||
|
|
||||||
if (pShow->numOfRows < 1) {
|
if (pShow->numOfRows < 1) {
|
||||||
cols = 0;
|
cols = 0;
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#include "mndGrant.h"
|
#include "mndGrant.h"
|
||||||
#include "mndInfoSchema.h"
|
#include "mndInfoSchema.h"
|
||||||
#include "mndMnode.h"
|
#include "mndMnode.h"
|
||||||
#include "mndOffset.h"
|
|
||||||
#include "mndPerfSchema.h"
|
#include "mndPerfSchema.h"
|
||||||
#include "mndPrivilege.h"
|
#include "mndPrivilege.h"
|
||||||
#include "mndProfile.h"
|
#include "mndProfile.h"
|
||||||
|
@ -305,7 +304,6 @@ static int32_t mndInitSteps(SMnode *pMnode) {
|
||||||
if (mndAllocStep(pMnode, "mnode-topic", mndInitTopic, mndCleanupTopic) != 0) return -1;
|
if (mndAllocStep(pMnode, "mnode-topic", mndInitTopic, mndCleanupTopic) != 0) return -1;
|
||||||
if (mndAllocStep(pMnode, "mnode-consumer", mndInitConsumer, mndCleanupConsumer) != 0) return -1;
|
if (mndAllocStep(pMnode, "mnode-consumer", mndInitConsumer, mndCleanupConsumer) != 0) return -1;
|
||||||
if (mndAllocStep(pMnode, "mnode-subscribe", mndInitSubscribe, mndCleanupSubscribe) != 0) return -1;
|
if (mndAllocStep(pMnode, "mnode-subscribe", mndInitSubscribe, mndCleanupSubscribe) != 0) return -1;
|
||||||
if (mndAllocStep(pMnode, "mnode-offset", mndInitOffset, mndCleanupOffset) != 0) return -1;
|
|
||||||
if (mndAllocStep(pMnode, "mnode-vgroup", mndInitVgroup, mndCleanupVgroup) != 0) return -1;
|
if (mndAllocStep(pMnode, "mnode-vgroup", mndInitVgroup, mndCleanupVgroup) != 0) return -1;
|
||||||
if (mndAllocStep(pMnode, "mnode-stb", mndInitStb, mndCleanupStb) != 0) return -1;
|
if (mndAllocStep(pMnode, "mnode-stb", mndInitStb, mndCleanupStb) != 0) return -1;
|
||||||
if (mndAllocStep(pMnode, "mnode-sma", mndInitSma, mndCleanupSma) != 0) return -1;
|
if (mndAllocStep(pMnode, "mnode-sma", mndInitSma, mndCleanupSma) != 0) return -1;
|
||||||
|
@ -424,7 +422,7 @@ SMnode *mndOpen(const char *path, const SMnodeOpt *pOption) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
mInfo("mnode open successfully ");
|
mInfo("mnode open successfully");
|
||||||
return pMnode;
|
return pMnode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -540,12 +538,12 @@ int32_t mndProcessSyncMsg(SRpcMsg *pMsg) {
|
||||||
|
|
||||||
} else if (pMsg->msgType == TDMT_SYNC_PING) {
|
} else if (pMsg->msgType == TDMT_SYNC_PING) {
|
||||||
SyncPing *pSyncMsg = syncPingFromRpcMsg2(pMsg);
|
SyncPing *pSyncMsg = syncPingFromRpcMsg2(pMsg);
|
||||||
code = syncNodeOnPingCb(pSyncNode, pSyncMsg);
|
code = syncNodeOnPing(pSyncNode, pSyncMsg);
|
||||||
syncPingDestroy(pSyncMsg);
|
syncPingDestroy(pSyncMsg);
|
||||||
|
|
||||||
} else if (pMsg->msgType == TDMT_SYNC_PING_REPLY) {
|
} else if (pMsg->msgType == TDMT_SYNC_PING_REPLY) {
|
||||||
SyncPingReply *pSyncMsg = syncPingReplyFromRpcMsg2(pMsg);
|
SyncPingReply *pSyncMsg = syncPingReplyFromRpcMsg2(pMsg);
|
||||||
code = syncNodeOnPingReplyCb(pSyncNode, pSyncMsg);
|
code = syncNodeOnPingReply(pSyncNode, pSyncMsg);
|
||||||
syncPingReplyDestroy(pSyncMsg);
|
syncPingReplyDestroy(pSyncMsg);
|
||||||
|
|
||||||
} else if (pMsg->msgType == TDMT_SYNC_CLIENT_REQUEST) {
|
} else if (pMsg->msgType == TDMT_SYNC_CLIENT_REQUEST) {
|
||||||
|
@ -588,6 +586,11 @@ int32_t mndProcessSyncMsg(SRpcMsg *pMsg) {
|
||||||
SRpcMsg rsp = {.code = code, .info = pMsg->info};
|
SRpcMsg rsp = {.code = code, .info = pMsg->info};
|
||||||
tmsgSendRsp(&rsp);
|
tmsgSendRsp(&rsp);
|
||||||
|
|
||||||
|
} else if (pMsg->msgType == TDMT_SYNC_LOCAL_CMD) {
|
||||||
|
SyncLocalCmd *pSyncMsg = syncLocalCmdFromRpcMsg2(pMsg);
|
||||||
|
code = syncNodeOnLocalCmd(pSyncNode, pSyncMsg);
|
||||||
|
syncLocalCmdDestroy(pSyncMsg);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
mError("failed to process msg:%p since invalid type:%s", pMsg, TMSG_INFO(pMsg->msgType));
|
mError("failed to process msg:%p since invalid type:%s", pMsg, TMSG_INFO(pMsg->msgType));
|
||||||
code = -1;
|
code = -1;
|
||||||
|
|
|
@ -472,7 +472,8 @@ static int32_t mndSetDropMnodeCommitLogs(SMnode *pMnode, STrans *pTrans, SMnodeO
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t mndSetDropMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDnodeObj *pDnode, SMnodeObj *pObj) {
|
static int32_t mndSetDropMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDnodeObj *pDnode, SMnodeObj *pObj,
|
||||||
|
bool force) {
|
||||||
SSdb *pSdb = pMnode->pSdb;
|
SSdb *pSdb = pMnode->pSdb;
|
||||||
void *pIter = NULL;
|
void *pIter = NULL;
|
||||||
SDDropMnodeReq dropReq = {0};
|
SDDropMnodeReq dropReq = {0};
|
||||||
|
@ -485,12 +486,21 @@ static int32_t mndSetDropMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDnode
|
||||||
|
|
||||||
int32_t totalMnodes = sdbGetSize(pSdb, SDB_MNODE);
|
int32_t totalMnodes = sdbGetSize(pSdb, SDB_MNODE);
|
||||||
if (totalMnodes == 2) {
|
if (totalMnodes == 2) {
|
||||||
|
if (force) {
|
||||||
|
mError("cant't force drop dnode, since a mnode on it and replica is 2");
|
||||||
|
terrno = TSDB_CODE_NODE_OFFLINE;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
mInfo("vgId:1, has %d mnodes, exec redo log first", totalMnodes);
|
mInfo("vgId:1, has %d mnodes, exec redo log first", totalMnodes);
|
||||||
if (mndSetDropMnodeRedoLogs(pMnode, pTrans, pObj) != 0) return -1;
|
if (mndSetDropMnodeRedoLogs(pMnode, pTrans, pObj) != 0) return -1;
|
||||||
if (mndBuildDropMnodeRedoAction(pTrans, &dropReq, &dropEpSet) != 0) return -1;
|
if (!force) {
|
||||||
|
if (mndBuildDropMnodeRedoAction(pTrans, &dropReq, &dropEpSet) != 0) return -1;
|
||||||
|
}
|
||||||
} else if (totalMnodes == 3) {
|
} else if (totalMnodes == 3) {
|
||||||
mInfo("vgId:1, has %d mnodes, exec redo action first", totalMnodes);
|
mInfo("vgId:1, has %d mnodes, exec redo action first", totalMnodes);
|
||||||
if (mndBuildDropMnodeRedoAction(pTrans, &dropReq, &dropEpSet) != 0) return -1;
|
if (!force) {
|
||||||
|
if (mndBuildDropMnodeRedoAction(pTrans, &dropReq, &dropEpSet) != 0) return -1;
|
||||||
|
}
|
||||||
if (mndSetDropMnodeRedoLogs(pMnode, pTrans, pObj) != 0) return -1;
|
if (mndSetDropMnodeRedoLogs(pMnode, pTrans, pObj) != 0) return -1;
|
||||||
} else {
|
} else {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -499,9 +509,9 @@ static int32_t mndSetDropMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDnode
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t mndSetDropMnodeInfoToTrans(SMnode *pMnode, STrans *pTrans, SMnodeObj *pObj) {
|
int32_t mndSetDropMnodeInfoToTrans(SMnode *pMnode, STrans *pTrans, SMnodeObj *pObj, bool force) {
|
||||||
if (pObj == NULL) return 0;
|
if (pObj == NULL) return 0;
|
||||||
if (mndSetDropMnodeRedoActions(pMnode, pTrans, pObj->pDnode, pObj) != 0) return -1;
|
if (mndSetDropMnodeRedoActions(pMnode, pTrans, pObj->pDnode, pObj, force) != 0) return -1;
|
||||||
if (mndSetDropMnodeCommitLogs(pMnode, pTrans, pObj) != 0) return -1;
|
if (mndSetDropMnodeCommitLogs(pMnode, pTrans, pObj) != 0) return -1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -515,7 +525,7 @@ static int32_t mndDropMnode(SMnode *pMnode, SRpcMsg *pReq, SMnodeObj *pObj) {
|
||||||
mndTransSetSerial(pTrans);
|
mndTransSetSerial(pTrans);
|
||||||
mInfo("trans:%d, used to drop mnode:%d", pTrans->id, pObj->id);
|
mInfo("trans:%d, used to drop mnode:%d", pTrans->id, pObj->id);
|
||||||
|
|
||||||
if (mndSetDropMnodeInfoToTrans(pMnode, pTrans, pObj) != 0) goto _OVER;
|
if (mndSetDropMnodeInfoToTrans(pMnode, pTrans, pObj, false) != 0) goto _OVER;
|
||||||
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
|
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
|
||||||
|
|
||||||
code = 0;
|
code = 0;
|
||||||
|
@ -743,7 +753,7 @@ static void mndReloadSyncConfig(SMnode *pMnode) {
|
||||||
mInfo("vgId:1, mnode sync not reconfig since readyMnodes:%d updatingMnodes:%d", readyMnodes, updatingMnodes);
|
mInfo("vgId:1, mnode sync not reconfig since readyMnodes:%d updatingMnodes:%d", readyMnodes, updatingMnodes);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// ASSERT(0);
|
// ASSERT(0);
|
||||||
|
|
||||||
if (cfg.myIndex == -1) {
|
if (cfg.myIndex == -1) {
|
||||||
#if 1
|
#if 1
|
||||||
|
|
|
@ -1,370 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
|
||||||
*
|
|
||||||
* This program is free software: you can use, redistribute, and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License, version 3
|
|
||||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define _DEFAULT_SOURCE
|
|
||||||
#include "mndOffset.h"
|
|
||||||
#include "mndDb.h"
|
|
||||||
#include "mndDnode.h"
|
|
||||||
#include "mndMnode.h"
|
|
||||||
#include "mndPrivilege.h"
|
|
||||||
#include "mndShow.h"
|
|
||||||
#include "mndStb.h"
|
|
||||||
#include "mndTopic.h"
|
|
||||||
#include "mndTrans.h"
|
|
||||||
#include "mndUser.h"
|
|
||||||
#include "mndVgroup.h"
|
|
||||||
#include "tname.h"
|
|
||||||
|
|
||||||
#define MND_OFFSET_VER_NUMBER 1
|
|
||||||
#define MND_OFFSET_RESERVE_SIZE 64
|
|
||||||
|
|
||||||
static int32_t mndOffsetActionInsert(SSdb *pSdb, SMqOffsetObj *pOffset);
|
|
||||||
static int32_t mndOffsetActionDelete(SSdb *pSdb, SMqOffsetObj *pOffset);
|
|
||||||
static int32_t mndOffsetActionUpdate(SSdb *pSdb, SMqOffsetObj *pOffset, SMqOffsetObj *pNewOffset);
|
|
||||||
static int32_t mndProcessCommitOffsetReq(SRpcMsg *pReq);
|
|
||||||
|
|
||||||
int32_t mndInitOffset(SMnode *pMnode) {
|
|
||||||
SSdbTable table = {
|
|
||||||
.sdbType = SDB_OFFSET,
|
|
||||||
.keyType = SDB_KEY_BINARY,
|
|
||||||
.encodeFp = (SdbEncodeFp)mndOffsetActionEncode,
|
|
||||||
.decodeFp = (SdbDecodeFp)mndOffsetActionDecode,
|
|
||||||
.insertFp = (SdbInsertFp)mndOffsetActionInsert,
|
|
||||||
.updateFp = (SdbUpdateFp)mndOffsetActionUpdate,
|
|
||||||
.deleteFp = (SdbDeleteFp)mndOffsetActionDelete,
|
|
||||||
};
|
|
||||||
|
|
||||||
mndSetMsgHandle(pMnode, TDMT_MND_MQ_COMMIT_OFFSET, mndProcessCommitOffsetReq);
|
|
||||||
|
|
||||||
return sdbSetTable(pMnode->pSdb, table);
|
|
||||||
}
|
|
||||||
|
|
||||||
void mndCleanupOffset(SMnode *pMnode) {}
|
|
||||||
|
|
||||||
bool mndOffsetFromTopic(SMqOffsetObj *pOffset, const char *topic) {
|
|
||||||
int32_t i = 0;
|
|
||||||
while (pOffset->key[i] != ':') i++;
|
|
||||||
while (pOffset->key[i] != ':') i++;
|
|
||||||
if (strcmp(&pOffset->key[i + 1], topic) == 0) return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool mndOffsetFromSubKey(SMqOffsetObj *pOffset, const char *subKey) {
|
|
||||||
int32_t i = 0;
|
|
||||||
while (pOffset->key[i] != ':') i++;
|
|
||||||
if (strcmp(&pOffset->key[i + 1], subKey) == 0) return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
SSdbRaw *mndOffsetActionEncode(SMqOffsetObj *pOffset) {
|
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
|
||||||
void *buf = NULL;
|
|
||||||
int32_t tlen = tEncodeSMqOffsetObj(NULL, pOffset);
|
|
||||||
int32_t size = sizeof(int32_t) + tlen + MND_OFFSET_RESERVE_SIZE;
|
|
||||||
|
|
||||||
SSdbRaw *pRaw = sdbAllocRaw(SDB_OFFSET, MND_OFFSET_VER_NUMBER, size);
|
|
||||||
if (pRaw == NULL) goto OFFSET_ENCODE_OVER;
|
|
||||||
|
|
||||||
buf = taosMemoryMalloc(tlen);
|
|
||||||
if (buf == NULL) goto OFFSET_ENCODE_OVER;
|
|
||||||
|
|
||||||
void *abuf = buf;
|
|
||||||
tEncodeSMqOffsetObj(&abuf, pOffset);
|
|
||||||
|
|
||||||
int32_t dataPos = 0;
|
|
||||||
SDB_SET_INT32(pRaw, dataPos, tlen, OFFSET_ENCODE_OVER);
|
|
||||||
SDB_SET_BINARY(pRaw, dataPos, buf, tlen, OFFSET_ENCODE_OVER);
|
|
||||||
SDB_SET_RESERVE(pRaw, dataPos, MND_OFFSET_RESERVE_SIZE, OFFSET_ENCODE_OVER);
|
|
||||||
SDB_SET_DATALEN(pRaw, dataPos, OFFSET_ENCODE_OVER);
|
|
||||||
|
|
||||||
terrno = TSDB_CODE_SUCCESS;
|
|
||||||
|
|
||||||
OFFSET_ENCODE_OVER:
|
|
||||||
taosMemoryFreeClear(buf);
|
|
||||||
if (terrno != TSDB_CODE_SUCCESS) {
|
|
||||||
mError("offset:%s, failed to encode to raw:%p since %s", pOffset->key, pRaw, terrstr());
|
|
||||||
sdbFreeRaw(pRaw);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
mTrace("offset:%s, encode to raw:%p, row:%p", pOffset->key, pRaw, pOffset);
|
|
||||||
return pRaw;
|
|
||||||
}
|
|
||||||
|
|
||||||
SSdbRow *mndOffsetActionDecode(SSdbRaw *pRaw) {
|
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
|
||||||
void *buf = NULL;
|
|
||||||
|
|
||||||
int8_t sver = 0;
|
|
||||||
if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto OFFSET_DECODE_OVER;
|
|
||||||
|
|
||||||
if (sver != MND_OFFSET_VER_NUMBER) {
|
|
||||||
terrno = TSDB_CODE_SDB_INVALID_DATA_VER;
|
|
||||||
goto OFFSET_DECODE_OVER;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t size = sizeof(SMqOffsetObj);
|
|
||||||
SSdbRow *pRow = sdbAllocRow(size);
|
|
||||||
if (pRow == NULL) goto OFFSET_DECODE_OVER;
|
|
||||||
|
|
||||||
SMqOffsetObj *pOffset = sdbGetRowObj(pRow);
|
|
||||||
if (pOffset == NULL) goto OFFSET_DECODE_OVER;
|
|
||||||
|
|
||||||
int32_t dataPos = 0;
|
|
||||||
int32_t tlen;
|
|
||||||
SDB_GET_INT32(pRaw, dataPos, &tlen, OFFSET_DECODE_OVER);
|
|
||||||
buf = taosMemoryMalloc(tlen + 1);
|
|
||||||
if (buf == NULL) goto OFFSET_DECODE_OVER;
|
|
||||||
SDB_GET_BINARY(pRaw, dataPos, buf, tlen, OFFSET_DECODE_OVER);
|
|
||||||
SDB_GET_RESERVE(pRaw, dataPos, MND_OFFSET_RESERVE_SIZE, OFFSET_DECODE_OVER);
|
|
||||||
|
|
||||||
if (tDecodeSMqOffsetObj(buf, pOffset) == NULL) {
|
|
||||||
goto OFFSET_DECODE_OVER;
|
|
||||||
}
|
|
||||||
|
|
||||||
terrno = TSDB_CODE_SUCCESS;
|
|
||||||
|
|
||||||
OFFSET_DECODE_OVER:
|
|
||||||
taosMemoryFreeClear(buf);
|
|
||||||
if (terrno != TSDB_CODE_SUCCESS) {
|
|
||||||
mError("offset:%s, failed to decode from raw:%p since %s", pOffset->key, pRaw, terrstr());
|
|
||||||
taosMemoryFreeClear(pRow);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
mTrace("offset:%s, decode from raw:%p, row:%p", pOffset->key, pRaw, pOffset);
|
|
||||||
return pRow;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t mndCreateOffsets(STrans *pTrans, const char *cgroup, const char *topicName, const SArray *vgs) {
|
|
||||||
int32_t sz = taosArrayGetSize(vgs);
|
|
||||||
for (int32_t i = 0; i < sz; i++) {
|
|
||||||
int32_t vgId = *(int32_t *)taosArrayGet(vgs, i);
|
|
||||||
SMqOffsetObj offsetObj = {0};
|
|
||||||
if (mndMakePartitionKey(offsetObj.key, cgroup, topicName, vgId) < 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
// TODO assign db
|
|
||||||
offsetObj.offset = -1;
|
|
||||||
SSdbRaw *pOffsetRaw = mndOffsetActionEncode(&offsetObj);
|
|
||||||
if (pOffsetRaw == NULL) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
(void)sdbSetRawStatus(pOffsetRaw, SDB_STATUS_READY);
|
|
||||||
// commit log or redo log?
|
|
||||||
if (mndTransAppendRedolog(pTrans, pOffsetRaw) < 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int32_t mndProcessCommitOffsetReq(SRpcMsg *pMsg) {
|
|
||||||
char key[TSDB_PARTITION_KEY_LEN];
|
|
||||||
|
|
||||||
SMnode *pMnode = pMsg->info.node;
|
|
||||||
char *msgStr = pMsg->pCont;
|
|
||||||
SMqCMCommitOffsetReq commitOffsetReq;
|
|
||||||
SDecoder decoder;
|
|
||||||
tDecoderInit(&decoder, msgStr, pMsg->contLen);
|
|
||||||
|
|
||||||
tDecodeSMqCMCommitOffsetReq(&decoder, &commitOffsetReq);
|
|
||||||
|
|
||||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pMsg, "commit-offset");
|
|
||||||
if (pTrans == NULL) {
|
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
|
||||||
tDecoderClear(&decoder);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int32_t i = 0; i < commitOffsetReq.num; i++) {
|
|
||||||
SMqOffset *pOffset = &commitOffsetReq.offsets[i];
|
|
||||||
mInfo("commit offset %" PRId64 " to vgId:%d of consumer group %s on topic %s", pOffset->offset, pOffset->vgId,
|
|
||||||
pOffset->cgroup, pOffset->topicName);
|
|
||||||
if (mndMakePartitionKey(key, pOffset->cgroup, pOffset->topicName, pOffset->vgId) < 0) {
|
|
||||||
mError("submit offset to topic %s failed", pOffset->topicName);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
bool create = false;
|
|
||||||
SMqOffsetObj *pOffsetObj = mndAcquireOffset(pMnode, key);
|
|
||||||
if (pOffsetObj == NULL) {
|
|
||||||
SMqTopicObj *pTopic = mndAcquireTopic(pMnode, pOffset->topicName);
|
|
||||||
if (pTopic == NULL) {
|
|
||||||
terrno = TSDB_CODE_MND_TOPIC_NOT_EXIST;
|
|
||||||
mError("submit offset to topic %s failed since %s", pOffset->topicName, terrstr());
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
pOffsetObj = taosMemoryMalloc(sizeof(SMqOffsetObj));
|
|
||||||
pOffsetObj->dbUid = pTopic->dbUid;
|
|
||||||
mndReleaseTopic(pMnode, pTopic);
|
|
||||||
memcpy(pOffsetObj->key, key, TSDB_PARTITION_KEY_LEN);
|
|
||||||
create = true;
|
|
||||||
}
|
|
||||||
pOffsetObj->offset = pOffset->offset;
|
|
||||||
SSdbRaw *pOffsetRaw = mndOffsetActionEncode(pOffsetObj);
|
|
||||||
(void)sdbSetRawStatus(pOffsetRaw, SDB_STATUS_READY);
|
|
||||||
mndTransAppendCommitlog(pTrans, pOffsetRaw);
|
|
||||||
if (create) {
|
|
||||||
taosMemoryFree(pOffsetObj);
|
|
||||||
} else {
|
|
||||||
mndReleaseOffset(pMnode, pOffsetObj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tDecoderClear(&decoder);
|
|
||||||
|
|
||||||
if (mndTransPrepare(pMnode, pTrans) != 0) {
|
|
||||||
mError("mq-commit-offset-trans:%d, failed to prepare since %s", pTrans->id, terrstr());
|
|
||||||
mndTransDrop(pTrans);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
mndTransDrop(pTrans);
|
|
||||||
return TSDB_CODE_ACTION_IN_PROGRESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int32_t mndOffsetActionInsert(SSdb *pSdb, SMqOffsetObj *pOffset) {
|
|
||||||
mTrace("offset:%s, perform insert action", pOffset->key);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int32_t mndOffsetActionDelete(SSdb *pSdb, SMqOffsetObj *pOffset) {
|
|
||||||
mTrace("offset:%s, perform delete action", pOffset->key);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int32_t mndOffsetActionUpdate(SSdb *pSdb, SMqOffsetObj *pOldOffset, SMqOffsetObj *pNewOffset) {
|
|
||||||
mTrace("offset:%s, perform update action", pOldOffset->key);
|
|
||||||
atomic_store_64(&pOldOffset->offset, pNewOffset->offset);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
SMqOffsetObj *mndAcquireOffset(SMnode *pMnode, const char *key) {
|
|
||||||
SSdb *pSdb = pMnode->pSdb;
|
|
||||||
SMqOffsetObj *pOffset = sdbAcquire(pSdb, SDB_OFFSET, key);
|
|
||||||
if (pOffset == NULL && terrno == TSDB_CODE_SDB_OBJ_NOT_THERE) {
|
|
||||||
terrno = TSDB_CODE_MND_OFFSET_NOT_EXIST;
|
|
||||||
}
|
|
||||||
return pOffset;
|
|
||||||
}
|
|
||||||
|
|
||||||
void mndReleaseOffset(SMnode *pMnode, SMqOffsetObj *pOffset) {
|
|
||||||
SSdb *pSdb = pMnode->pSdb;
|
|
||||||
sdbRelease(pSdb, pOffset);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void mndCancelGetNextOffset(SMnode *pMnode, void *pIter) {
|
|
||||||
SSdb *pSdb = pMnode->pSdb;
|
|
||||||
sdbCancelFetch(pSdb, pIter);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int32_t mndSetDropOffsetCommitLogs(SMnode *pMnode, STrans *pTrans, SMqOffsetObj *pOffset) {
|
|
||||||
SSdbRaw *pCommitRaw = mndOffsetActionEncode(pOffset);
|
|
||||||
if (pCommitRaw == NULL) return -1;
|
|
||||||
if (mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) return -1;
|
|
||||||
if (sdbSetRawStatus(pCommitRaw, SDB_STATUS_DROPPED) != 0) return -1;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int32_t mndSetDropOffsetRedoLogs(SMnode *pMnode, STrans *pTrans, SMqOffsetObj *pOffset) {
|
|
||||||
SSdbRaw *pRedoRaw = mndOffsetActionEncode(pOffset);
|
|
||||||
if (pRedoRaw == NULL) return -1;
|
|
||||||
if (mndTransAppendRedolog(pTrans, pRedoRaw) != 0) return -1;
|
|
||||||
if (sdbSetRawStatus(pRedoRaw, SDB_STATUS_DROPPED) != 0) return -1;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t mndDropOffsetByDB(SMnode *pMnode, STrans *pTrans, SDbObj *pDb) {
|
|
||||||
int32_t code = 0;
|
|
||||||
SSdb *pSdb = pMnode->pSdb;
|
|
||||||
|
|
||||||
void *pIter = NULL;
|
|
||||||
SMqOffsetObj *pOffset = NULL;
|
|
||||||
while (1) {
|
|
||||||
pIter = sdbFetch(pSdb, SDB_OFFSET, pIter, (void **)&pOffset);
|
|
||||||
if (pIter == NULL) break;
|
|
||||||
|
|
||||||
if (pOffset->dbUid != pDb->uid) {
|
|
||||||
sdbRelease(pSdb, pOffset);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mndSetDropOffsetCommitLogs(pMnode, pTrans, pOffset) < 0) {
|
|
||||||
sdbRelease(pSdb, pOffset);
|
|
||||||
sdbCancelFetch(pSdb, pIter);
|
|
||||||
code = -1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
sdbRelease(pSdb, pOffset);
|
|
||||||
}
|
|
||||||
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t mndDropOffsetByTopic(SMnode *pMnode, STrans *pTrans, const char *topic) {
|
|
||||||
int32_t code = -1;
|
|
||||||
SSdb *pSdb = pMnode->pSdb;
|
|
||||||
|
|
||||||
void *pIter = NULL;
|
|
||||||
SMqOffsetObj *pOffset = NULL;
|
|
||||||
while (1) {
|
|
||||||
pIter = sdbFetch(pSdb, SDB_OFFSET, pIter, (void **)&pOffset);
|
|
||||||
if (pIter == NULL) break;
|
|
||||||
|
|
||||||
if (!mndOffsetFromTopic(pOffset, topic)) {
|
|
||||||
sdbRelease(pSdb, pOffset);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mndSetDropOffsetCommitLogs(pMnode, pTrans, pOffset) < 0) {
|
|
||||||
sdbRelease(pSdb, pOffset);
|
|
||||||
goto END;
|
|
||||||
}
|
|
||||||
|
|
||||||
sdbRelease(pSdb, pOffset);
|
|
||||||
}
|
|
||||||
|
|
||||||
code = 0;
|
|
||||||
END:
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t mndDropOffsetBySubKey(SMnode *pMnode, STrans *pTrans, const char *subKey) {
|
|
||||||
int32_t code = -1;
|
|
||||||
SSdb *pSdb = pMnode->pSdb;
|
|
||||||
|
|
||||||
void *pIter = NULL;
|
|
||||||
SMqOffsetObj *pOffset = NULL;
|
|
||||||
while (1) {
|
|
||||||
pIter = sdbFetch(pSdb, SDB_OFFSET, pIter, (void **)&pOffset);
|
|
||||||
if (pIter == NULL) break;
|
|
||||||
|
|
||||||
if (!mndOffsetFromSubKey(pOffset, subKey)) {
|
|
||||||
sdbRelease(pSdb, pOffset);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mndSetDropOffsetCommitLogs(pMnode, pTrans, pOffset) < 0) {
|
|
||||||
sdbRelease(pSdb, pOffset);
|
|
||||||
goto END;
|
|
||||||
}
|
|
||||||
|
|
||||||
sdbRelease(pSdb, pOffset);
|
|
||||||
}
|
|
||||||
|
|
||||||
code = 0;
|
|
||||||
END:
|
|
||||||
return code;
|
|
||||||
}
|
|
|
@ -353,11 +353,13 @@ static int32_t mndSetDropQnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SQn
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t mndSetDropQnodeInfoToTrans(SMnode *pMnode, STrans *pTrans, SQnodeObj *pObj) {
|
int32_t mndSetDropQnodeInfoToTrans(SMnode *pMnode, STrans *pTrans, SQnodeObj *pObj, bool force) {
|
||||||
if (pObj == NULL) return 0;
|
if (pObj == NULL) return 0;
|
||||||
if (mndSetDropQnodeRedoLogs(pTrans, pObj) != 0) return -1;
|
if (mndSetDropQnodeRedoLogs(pTrans, pObj) != 0) return -1;
|
||||||
if (mndSetDropQnodeCommitLogs(pTrans, pObj) != 0) return -1;
|
if (mndSetDropQnodeCommitLogs(pTrans, pObj) != 0) return -1;
|
||||||
if (mndSetDropQnodeRedoActions(pTrans, pObj->pDnode, pObj) != 0) return -1;
|
if (!force) {
|
||||||
|
if (mndSetDropQnodeRedoActions(pTrans, pObj->pDnode, pObj) != 0) return -1;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -368,7 +370,7 @@ static int32_t mndDropQnode(SMnode *pMnode, SRpcMsg *pReq, SQnodeObj *pObj) {
|
||||||
if (pTrans == NULL) goto _OVER;
|
if (pTrans == NULL) goto _OVER;
|
||||||
|
|
||||||
mInfo("trans:%d, used to drop qnode:%d", pTrans->id, pObj->id);
|
mInfo("trans:%d, used to drop qnode:%d", pTrans->id, pObj->id);
|
||||||
if (mndSetDropQnodeInfoToTrans(pMnode, pTrans, pObj) != 0) goto _OVER;
|
if (mndSetDropQnodeInfoToTrans(pMnode, pTrans, pObj, false) != 0) goto _OVER;
|
||||||
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
|
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
|
||||||
|
|
||||||
code = 0;
|
code = 0;
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
#include "mndDb.h"
|
#include "mndDb.h"
|
||||||
#include "mndDnode.h"
|
#include "mndDnode.h"
|
||||||
#include "mndMnode.h"
|
#include "mndMnode.h"
|
||||||
#include "mndOffset.h"
|
|
||||||
#include "mndShow.h"
|
#include "mndShow.h"
|
||||||
#include "mndSnode.h"
|
#include "mndSnode.h"
|
||||||
#include "mndStb.h"
|
#include "mndStb.h"
|
||||||
|
@ -33,7 +32,7 @@
|
||||||
#include "tname.h"
|
#include "tname.h"
|
||||||
#include "tuuid.h"
|
#include "tuuid.h"
|
||||||
|
|
||||||
extern bool tsSchedStreamToSnode;
|
extern bool tsDeployOnSnode;
|
||||||
|
|
||||||
static int32_t mndAddTaskToTaskSet(SArray* pArray, SStreamTask* pTask) {
|
static int32_t mndAddTaskToTaskSet(SArray* pArray, SStreamTask* pTask) {
|
||||||
int32_t childId = taosArrayGetSize(pArray);
|
int32_t childId = taosArrayGetSize(pArray);
|
||||||
|
@ -191,7 +190,7 @@ int32_t mndAssignTaskToSnode(SMnode* pMnode, SStreamTask* pTask, SSubplan* plan,
|
||||||
pTask->nodeId = SNODE_HANDLE;
|
pTask->nodeId = SNODE_HANDLE;
|
||||||
pTask->epSet = mndAcquireEpFromSnode(pMnode, pSnode);
|
pTask->epSet = mndAcquireEpFromSnode(pMnode, pSnode);
|
||||||
|
|
||||||
plan->execNode.nodeId = 0;
|
plan->execNode.nodeId = SNODE_HANDLE;
|
||||||
plan->execNode.epSet = pTask->epSet;
|
plan->execNode.epSet = pTask->epSet;
|
||||||
|
|
||||||
if (qSubPlanToString(plan, &pTask->exec.qmsg, &msgLen) < 0) {
|
if (qSubPlanToString(plan, &pTask->exec.qmsg, &msgLen) < 0) {
|
||||||
|
@ -374,7 +373,7 @@ int32_t mndScheduleStream(SMnode* pMnode, SStreamObj* pStream) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tsSchedStreamToSnode) {
|
if (tsDeployOnSnode) {
|
||||||
SSnodeObj* pSnode = mndSchedFetchOneSnode(pMnode);
|
SSnodeObj* pSnode = mndSchedFetchOneSnode(pMnode);
|
||||||
if (pSnode == NULL) {
|
if (pSnode == NULL) {
|
||||||
SVgObj* pVgroup = mndSchedFetchOneVg(pMnode, pStream->sourceDbUid);
|
SVgObj* pVgroup = mndSchedFetchOneVg(pMnode, pStream->sourceDbUid);
|
||||||
|
|
|
@ -273,9 +273,6 @@ _OVER:
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t mndProcessCreateSnodeReq(SRpcMsg *pReq) {
|
static int32_t mndProcessCreateSnodeReq(SRpcMsg *pReq) {
|
||||||
#if 1
|
|
||||||
return TSDB_CODE_OPS_NOT_SUPPORT;
|
|
||||||
#else
|
|
||||||
SMnode *pMnode = pReq->info.node;
|
SMnode *pMnode = pReq->info.node;
|
||||||
int32_t code = -1;
|
int32_t code = -1;
|
||||||
SSnodeObj *pObj = NULL;
|
SSnodeObj *pObj = NULL;
|
||||||
|
@ -318,7 +315,6 @@ _OVER:
|
||||||
mndReleaseSnode(pMnode, pObj);
|
mndReleaseSnode(pMnode, pObj);
|
||||||
mndReleaseDnode(pMnode, pDnode);
|
mndReleaseDnode(pMnode, pDnode);
|
||||||
return code;
|
return code;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t mndSetDropSnodeRedoLogs(STrans *pTrans, SSnodeObj *pObj) {
|
static int32_t mndSetDropSnodeRedoLogs(STrans *pTrans, SSnodeObj *pObj) {
|
||||||
|
@ -364,11 +360,13 @@ static int32_t mndSetDropSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SSn
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t mndSetDropSnodeInfoToTrans(SMnode *pMnode, STrans *pTrans, SSnodeObj *pObj) {
|
int32_t mndSetDropSnodeInfoToTrans(SMnode *pMnode, STrans *pTrans, SSnodeObj *pObj, bool force) {
|
||||||
if (pObj == NULL) return 0;
|
if (pObj == NULL) return 0;
|
||||||
if (mndSetDropSnodeRedoLogs(pTrans, pObj) != 0) return -1;
|
if (mndSetDropSnodeRedoLogs(pTrans, pObj) != 0) return -1;
|
||||||
if (mndSetDropSnodeCommitLogs(pTrans, pObj) != 0) return -1;
|
if (mndSetDropSnodeCommitLogs(pTrans, pObj) != 0) return -1;
|
||||||
if (mndSetDropSnodeRedoActions(pTrans, pObj->pDnode, pObj) != 0) return -1;
|
if (!force) {
|
||||||
|
if (mndSetDropSnodeRedoActions(pTrans, pObj->pDnode, pObj) != 0) return -1;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -379,7 +377,7 @@ static int32_t mndDropSnode(SMnode *pMnode, SRpcMsg *pReq, SSnodeObj *pObj) {
|
||||||
if (pTrans == NULL) goto _OVER;
|
if (pTrans == NULL) goto _OVER;
|
||||||
|
|
||||||
mInfo("trans:%d, used to drop snode:%d", pTrans->id, pObj->id);
|
mInfo("trans:%d, used to drop snode:%d", pTrans->id, pObj->id);
|
||||||
if (mndSetDropSnodeInfoToTrans(pMnode, pTrans, pObj) != 0) goto _OVER;
|
if (mndSetDropSnodeInfoToTrans(pMnode, pTrans, pObj, false) != 0) goto _OVER;
|
||||||
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
|
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
|
||||||
|
|
||||||
code = 0;
|
code = 0;
|
||||||
|
@ -390,12 +388,9 @@ _OVER:
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t mndProcessDropSnodeReq(SRpcMsg *pReq) {
|
static int32_t mndProcessDropSnodeReq(SRpcMsg *pReq) {
|
||||||
#if 1
|
SMnode *pMnode = pReq->info.node;
|
||||||
return TSDB_CODE_OPS_NOT_SUPPORT;
|
int32_t code = -1;
|
||||||
#else
|
SSnodeObj *pObj = NULL;
|
||||||
SMnode *pMnode = pReq->info.node;
|
|
||||||
int32_t code = -1;
|
|
||||||
SSnodeObj *pObj = NULL;
|
|
||||||
SMDropSnodeReq dropReq = {0};
|
SMDropSnodeReq dropReq = {0};
|
||||||
|
|
||||||
if (tDeserializeSCreateDropMQSNodeReq(pReq->pCont, pReq->contLen, &dropReq) != 0) {
|
if (tDeserializeSCreateDropMQSNodeReq(pReq->pCont, pReq->contLen, &dropReq) != 0) {
|
||||||
|
@ -429,7 +424,6 @@ _OVER:
|
||||||
|
|
||||||
mndReleaseSnode(pMnode, pObj);
|
mndReleaseSnode(pMnode, pObj);
|
||||||
return code;
|
return code;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t mndRetrieveSnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) {
|
static int32_t mndRetrieveSnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) {
|
||||||
|
|
|
@ -2029,7 +2029,7 @@ static int32_t mndSetDropStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *
|
||||||
action.pCont = pReq;
|
action.pCont = pReq;
|
||||||
action.contLen = contLen;
|
action.contLen = contLen;
|
||||||
action.msgType = TDMT_VND_DROP_STB;
|
action.msgType = TDMT_VND_DROP_STB;
|
||||||
action.acceptableCode = TSDB_CODE_VND_TB_NOT_EXIST;
|
action.acceptableCode = TSDB_CODE_TDB_STB_NOT_EXIST;
|
||||||
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
|
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
|
||||||
taosMemoryFree(pReq);
|
taosMemoryFree(pReq);
|
||||||
sdbCancelFetch(pSdb, pIter);
|
sdbCancelFetch(pSdb, pIter);
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue