Merge branch '3.0' of github.com:taosdata/TDengine into szhou/python-udf-improvement
This commit is contained in:
commit
accebcedc4
|
@ -2,7 +2,7 @@
|
|||
# taos-tools
|
||||
ExternalProject_Add(taos-tools
|
||||
GIT_REPOSITORY https://github.com/taosdata/taos-tools.git
|
||||
GIT_TAG 04296a5
|
||||
GIT_TAG e82b9fc
|
||||
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools"
|
||||
BINARY_DIR ""
|
||||
#BUILD_IN_SOURCE TRUE
|
||||
|
|
|
@ -18,14 +18,8 @@ To achieve absolutely no data loss, set wal_level to 2 and wal_fsync_period to 0
|
|||
|
||||
## Disaster Recovery
|
||||
|
||||
TDengine uses replication to provide high availability.
|
||||
TDengine provides disaster recovery by using taosX to replicate data between two TDengine clusters which are deployed in two distant data centers. Assume there are two TDengine clusters, A and B, A is the source and B is the target, and A takes the workload of writing and querying. You can deploy `taosX` in the data center where cluster A resides in, `taosX` consumes the data written into cluster A and writes into cluster B. If the data center of cluster A is disrupted because of disaster, you can switch to cluster B to take the workload of data writing and querying, and deploy a `taosX` in the data center of cluster B to replicate data from cluster B to cluster A if cluster A has been recovered, or another cluster C if cluster A has not been recovered.
|
||||
|
||||
A TDengine cluster is managed by mnodes. You can configure up to three mnodes to ensure high availability. The data replication between mnode replicas is performed in a synchronous way to guarantee metadata consistency.
|
||||
You can use the data replication feature of `taosX` to build more complicated disaster recovery solution.
|
||||
|
||||
The number of replicas for time series data in TDengine is associated with each database. There can be many databases in a cluster and each database can be configured with a different number of replicas. When creating a database, the parameter `replica` is used to specify the number of replicas. To achieve high availability, set `replica` to 3.
|
||||
|
||||
The number of dnodes in a TDengine cluster must NOT be lower than the number of replicas for any database, otherwise it would fail when trying to create a table.
|
||||
|
||||
As long as the dnodes of a TDengine cluster are deployed on different physical machines and the replica number is higher than 1, high availability can be achieved without any other assistance. For disaster recovery, dnodes of a TDengine cluster should be deployed in geographically different data centers.
|
||||
|
||||
Alternatively, you can use taosX to synchronize the data from one TDengine cluster to another cluster in a remote location. However, taosX is only available in TDengine enterprise version, for more information please contact tdengine.com.
|
||||
taosX is only provided in TDengine enterprise edition, for more details please contact business@tdengine.com.
|
||||
|
|
|
@ -353,6 +353,86 @@ For a more detailed description of the `sql()` method, please refer to [RestClie
|
|||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
### Usage with req_id
|
||||
|
||||
By using the optional req_id parameter, you can specify a request ID that can be used for tracing.
|
||||
|
||||
<Tabs defaultValue="rest">
|
||||
<TabItem value="native" label="native connection">
|
||||
|
||||
##### TaosConnection class
|
||||
|
||||
The `TaosConnection` class contains both an implementation of the PEP249 Connection interface (e.g., the `cursor()` method and the `close()` method) and many extensions (e.g., the `execute()`, `query()`, `schemaless_insert()`, and `subscribe()` methods).
|
||||
|
||||
```python title="execute method"
|
||||
{{#include docs/examples/python/connection_usage_native_reference_with_req_id.py:insert}}
|
||||
```
|
||||
|
||||
```python title="query method"
|
||||
{{#include docs/examples/python/connection_usage_native_reference_with_req_id.py:query}}
|
||||
```
|
||||
|
||||
:::tip
|
||||
The queried results can only be fetched once. For example, only one of `fetch_all()` and `fetch_all_into_dict()` can be used in the example above. Repeated fetches will result in an empty list.
|
||||
:::
|
||||
|
||||
##### Use of TaosResult class
|
||||
|
||||
In the above example of using the `TaosConnection` class, we have shown two ways to get the result of a query: `fetch_all()` and `fetch_all_into_dict()`. In addition, `TaosResult` also provides methods to iterate through the result set by rows (`rows_iter`) or by data blocks (`blocks_iter`). Using these two methods will be more efficient in scenarios where the query has a large amount of data.
|
||||
|
||||
```python title="blocks_iter method"
|
||||
{{#include docs/examples/python/result_set_with_req_id_examples.py}}
|
||||
```
|
||||
##### Use of the TaosCursor class
|
||||
|
||||
The `TaosConnection` class and the `TaosResult` class already implement all the functionality of the native interface. If you are familiar with the interfaces in the PEP249 specification, you can also use the methods provided by the `TaosCursor` class.
|
||||
|
||||
```python title="Use of TaosCursor"
|
||||
{{#include docs/examples/python/cursor_usage_native_reference_with_req_id.py}}
|
||||
```
|
||||
|
||||
:::note
|
||||
The TaosCursor class uses native connections for write and query operations. In a client-side multi-threaded scenario, this cursor instance must remain thread exclusive and cannot be shared across threads for use, otherwise, it will result in errors in the returned results.
|
||||
|
||||
:::
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="rest" label="REST connection">
|
||||
|
||||
##### Use of TaosRestCursor class
|
||||
|
||||
The `TaosRestCursor` class is an implementation of the PEP249 Cursor interface.
|
||||
|
||||
```python title="Use of TaosRestCursor"
|
||||
{{#include docs/examples/python/connect_rest_with_req_id_examples.py:basic}}
|
||||
```
|
||||
- `cursor.execute`: Used to execute arbitrary SQL statements.
|
||||
- `cursor.rowcount` : For write operations, returns the number of successful rows written. For query operations, returns the number of rows in the result set.
|
||||
- `cursor.description` : Returns the description of the field. Please refer to [TaosRestCursor](https://docs.taosdata.com/api/taospy/taosrest/cursor.html) for the specific format of the description information.
|
||||
|
||||
##### Use of the RestClient class
|
||||
|
||||
The `RestClient` class is a direct wrapper for the [REST API](/reference/rest-api). It contains only a `sql()` method for executing arbitrary SQL statements and returning the result.
|
||||
|
||||
```python title="Use of RestClient"
|
||||
{{#include docs/examples/python/rest_client_with_req_id_example.py}}
|
||||
```
|
||||
|
||||
For a more detailed description of the `sql()` method, please refer to [RestClient](https://docs.taosdata.com/api/taospy/taosrest/restclient.html).
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="websocket" label="WebSocket connection">
|
||||
|
||||
```python
|
||||
{{#include docs/examples/python/connect_websocket_with_req_id_examples.py:basic}}
|
||||
```
|
||||
|
||||
- `conn.execute`: can use to execute arbitrary SQL statements, and return the number of rows affected.
|
||||
- `conn.query`: can use to execute query SQL statements, and return the query results.
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
### Used with pandas
|
||||
|
||||
<Tabs defaultValue="rest">
|
||||
|
|
|
@ -99,6 +99,9 @@ The parameters described in this document by the effect that they have on the sy
|
|||
|
||||
## Monitoring Parameters
|
||||
|
||||
:::note
|
||||
Please note the `taoskeeper` needs to be installed and running to create the `log` database and receiving metrics sent by `taosd` as the full monitoring solution.
|
||||
|
||||
### monitor
|
||||
|
||||
| Attribute | Description |
|
||||
|
|
|
@ -13,14 +13,12 @@ taosKeeper is a tool for TDengine that exports monitoring metrics. With taosKeep
|
|||
|
||||
## Installation
|
||||
|
||||
<!-- There are two ways to install taosKeeper: -->
|
||||
There are two ways to install taosKeeper:
|
||||
Methods of installing taosKeeper:
|
||||
|
||||
<!--- Installing the official TDengine installer will automatically install taosKeeper. Please refer to [TDengine installation](/operation/pkg-install) for details. -->
|
||||
|
||||
- You can compile taosKeeper separately and install it. Please refer to the [taosKeeper](https://github.com/taosdata/taoskeeper) repository for details. -->
|
||||
You can compile taosKeeper separately and install it. Please refer to the [taosKeeper](https://github.com/taosdata/taoskeeper) repository for details.
|
||||
- Installing the official TDengine installer will automatically install taosKeeper. Please refer to [TDengine installation](/operation/pkg-install) for details.
|
||||
|
||||
- You can compile taosKeeper separately and install it. Please refer to the [taosKeeper](https://github.com/taosdata/taoskeeper) repository for details.
|
||||
## Configuration and Launch
|
||||
|
||||
### Configuration
|
||||
|
|
|
@ -70,7 +70,7 @@ static int32_t init_env() {
|
|||
taos_free_result(pRes);
|
||||
|
||||
// create database
|
||||
pRes = taos_query(pConn, "create database tmqdb");
|
||||
pRes = taos_query(pConn, "create database tmqdb wal_retention_period 3600");
|
||||
if (taos_errno(pRes) != 0) {
|
||||
printf("error in create tmqdb, reason:%s\n", taos_errstr(pRes));
|
||||
return -1;
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace TDengineExample
|
|||
|
||||
static void PrepareDatabase(IntPtr conn)
|
||||
{
|
||||
IntPtr res = TDengine.Query(conn, "CREATE DATABASE test");
|
||||
IntPtr res = TDengine.Query(conn, "CREATE DATABASE test WAL_RETENTION_PERIOD 3600");
|
||||
if (TDengine.ErrorNo(res) != 0)
|
||||
{
|
||||
throw new Exception("failed to create database, reason: " + TDengine.Error(res));
|
||||
|
|
|
@ -54,7 +54,7 @@ namespace TDengineExample
|
|||
|
||||
static void PrepareDatabase(IntPtr conn)
|
||||
{
|
||||
IntPtr res = TDengine.Query(conn, "CREATE DATABASE test");
|
||||
IntPtr res = TDengine.Query(conn, "CREATE DATABASE test WAL_RETENTION_PERIOD 3600");
|
||||
if (TDengine.ErrorNo(res) != 0)
|
||||
{
|
||||
throw new Exception("failed to create database, reason: " + TDengine.Error(res));
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace TDengineExample
|
|||
|
||||
static void PrepareDatabase(IntPtr conn)
|
||||
{
|
||||
IntPtr res = TDengine.Query(conn, "CREATE DATABASE test");
|
||||
IntPtr res = TDengine.Query(conn, "CREATE DATABASE test WAL_RETENTION_PERIOD 3600");
|
||||
if (TDengine.ErrorNo(res) != 0)
|
||||
{
|
||||
throw new Exception("failed to create database, reason: " + TDengine.Error(res));
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace TDengineExample
|
|||
IntPtr conn = GetConnection();
|
||||
try
|
||||
{
|
||||
IntPtr res = TDengine.Query(conn, "CREATE DATABASE power");
|
||||
IntPtr res = TDengine.Query(conn, "CREATE DATABASE power WAL_RETENTION_PERIOD 3600");
|
||||
CheckRes(conn, res, "failed to create database");
|
||||
res = TDengine.Query(conn, "USE power");
|
||||
CheckRes(conn, res, "failed to change database");
|
||||
|
|
|
@ -76,7 +76,7 @@ namespace TDengineExample
|
|||
|
||||
static void PrepareSTable()
|
||||
{
|
||||
IntPtr res = TDengine.Query(conn, "CREATE DATABASE power");
|
||||
IntPtr res = TDengine.Query(conn, "CREATE DATABASE power WAL_RETENTION_PERIOD 3600");
|
||||
CheckResPtr(res, "failed to create database");
|
||||
res = TDengine.Query(conn, "USE power");
|
||||
CheckResPtr(res, "failed to change database");
|
||||
|
|
|
@ -15,7 +15,7 @@ func main() {
|
|||
panic(err)
|
||||
}
|
||||
defer db.Close()
|
||||
_, err = db.Exec("create database if not exists example_tmq")
|
||||
_, err = db.Exec("create database if not exists example_tmq wal_retention_period 3600")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ public class SubscribeDemo {
|
|||
try (Statement statement = connection.createStatement()) {
|
||||
statement.executeUpdate("drop topic if exists " + TOPIC);
|
||||
statement.executeUpdate("drop database if exists " + DB_NAME);
|
||||
statement.executeUpdate("create database " + DB_NAME);
|
||||
statement.executeUpdate("create database " + DB_NAME + " wal_retention_period 3600");
|
||||
statement.executeUpdate("use " + DB_NAME);
|
||||
statement.executeUpdate(
|
||||
"CREATE TABLE `meters` (`ts` TIMESTAMP, `current` FLOAT, `voltage` INT) TAGS (`groupid` INT, `location` BINARY(24))");
|
||||
|
|
|
@ -35,7 +35,7 @@ public class WebsocketSubscribeDemo {
|
|||
Statement statement = connection.createStatement()) {
|
||||
statement.executeUpdate("drop topic if exists " + TOPIC);
|
||||
statement.executeUpdate("drop database if exists " + DB_NAME);
|
||||
statement.executeUpdate("create database " + DB_NAME);
|
||||
statement.executeUpdate("create database " + DB_NAME + " wal_retention_period 3600");
|
||||
statement.executeUpdate("use " + DB_NAME);
|
||||
statement.executeUpdate(
|
||||
"CREATE TABLE `meters` (`ts` TIMESTAMP, `current` FLOAT, `voltage` INT) TAGS (`groupid` INT, `location` BINARY(24))");
|
||||
|
|
|
@ -4,7 +4,7 @@ import taos
|
|||
|
||||
taos_conn = taos.connect()
|
||||
taos_conn.execute('drop database if exists power')
|
||||
taos_conn.execute('create database if not exists power')
|
||||
taos_conn.execute('create database if not exists power wal_retention_period 3600')
|
||||
taos_conn.execute("use power")
|
||||
taos_conn.execute(
|
||||
"CREATE STABLE power.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (location BINARY(64), groupId INT)")
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
# ANCHOR: connect
|
||||
from taosrest import connect, TaosRestConnection, TaosRestCursor
|
||||
|
||||
conn = connect(url="http://localhost:6041",
|
||||
user="root",
|
||||
password="taosdata",
|
||||
timeout=30)
|
||||
|
||||
# ANCHOR_END: connect
|
||||
# ANCHOR: basic
|
||||
# create STable
|
||||
cursor = conn.cursor()
|
||||
cursor.execute("DROP DATABASE IF EXISTS power", req_id=1)
|
||||
cursor.execute("CREATE DATABASE power", req_id=2)
|
||||
cursor.execute(
|
||||
"CREATE STABLE power.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (location BINARY(64), groupId INT)", req_id=3)
|
||||
|
||||
# insert data
|
||||
cursor.execute("""INSERT INTO power.d1001 USING power.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)
|
||||
power.d1002 USING power.meters TAGS('California.SanFrancisco', 3) VALUES ('2018-10-03 14:38:16.650', 10.30000, 218, 0.25000)
|
||||
power.d1003 USING power.meters TAGS('California.LosAngeles', 2) VALUES ('2018-10-03 14:38:05.500', 11.80000, 221, 0.28000) ('2018-10-03 14:38:16.600', 13.40000, 223, 0.29000)
|
||||
power.d1004 USING power.meters TAGS('California.LosAngeles', 3) VALUES ('2018-10-03 14:38:05.000', 10.80000, 223, 0.29000) ('2018-10-03 14:38:06.500', 11.50000, 221, 0.35000)""", req_id=4)
|
||||
print("inserted row count:", cursor.rowcount)
|
||||
|
||||
# query data
|
||||
cursor.execute("SELECT * FROM power.meters LIMIT 3", req_id=5)
|
||||
# get total rows
|
||||
print("queried row count:", cursor.rowcount)
|
||||
# get column names from cursor
|
||||
column_names = [meta[0] for meta in cursor.description]
|
||||
# get rows
|
||||
data = cursor.fetchall()
|
||||
print(column_names)
|
||||
for row in data:
|
||||
print(row)
|
||||
|
||||
# output:
|
||||
# inserted row count: 8
|
||||
# queried row count: 3
|
||||
# ['ts', 'current', 'voltage', 'phase', 'location', 'groupid']
|
||||
# [datetime.datetime(2018, 10, 3, 14, 38, 5, 500000, tzinfo=datetime.timezone(datetime.timedelta(seconds=28800), '+08:00')), 11.8, 221, 0.28, 'california.losangeles', 2]
|
||||
# [datetime.datetime(2018, 10, 3, 14, 38, 16, 600000, tzinfo=datetime.timezone(datetime.timedelta(seconds=28800), '+08:00')), 13.4, 223, 0.29, 'california.losangeles', 2]
|
||||
# [datetime.datetime(2018, 10, 3, 14, 38, 5, tzinfo=datetime.timezone(datetime.timedelta(seconds=28800), '+08:00')), 10.8, 223, 0.29, 'california.losangeles', 3]
|
||||
# ANCHOR_END: basic
|
|
@ -6,7 +6,7 @@ conn = taosws.connect("taosws://root:taosdata@localhost:6041")
|
|||
|
||||
# ANCHOR: basic
|
||||
conn.execute("drop database if exists connwspy")
|
||||
conn.execute("create database if not exists connwspy")
|
||||
conn.execute("create database if not exists connwspy wal_retention_period 3600")
|
||||
conn.execute("use connwspy")
|
||||
conn.execute("create table if not exists stb (ts timestamp, c1 int) tags (t1 int)")
|
||||
conn.execute("create table if not exists tb1 using stb tags (1)")
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
# ANCHOR: connect
|
||||
import taosws
|
||||
|
||||
conn = taosws.connect("taosws://root:taosdata@localhost:6041")
|
||||
# ANCHOR_END: connect
|
||||
|
||||
# ANCHOR: basic
|
||||
conn.execute("drop database if exists connwspy", req_id=1)
|
||||
conn.execute("create database if not exists connwspy", req_id=2)
|
||||
conn.execute("use connwspy", req_id=3)
|
||||
conn.execute("create table if not exists stb (ts timestamp, c1 int) tags (t1 int)", req_id=4)
|
||||
conn.execute("create table if not exists tb1 using stb tags (1)", req_id=5)
|
||||
conn.execute("insert into tb1 values (now, 1)", req_id=6)
|
||||
conn.execute("insert into tb1 values (now, 2)", req_id=7)
|
||||
conn.execute("insert into tb1 values (now, 3)", req_id=8)
|
||||
|
||||
r = conn.execute("select * from stb", req_id=9)
|
||||
result = conn.query("select * from stb", req_id=10)
|
||||
num_of_fields = result.field_count
|
||||
print(num_of_fields)
|
||||
|
||||
for row in result:
|
||||
print(row)
|
||||
|
||||
# output:
|
||||
# 3
|
||||
# ('2023-02-28 15:56:13.329 +08:00', 1, 1)
|
||||
# ('2023-02-28 15:56:13.333 +08:00', 2, 1)
|
||||
# ('2023-02-28 15:56:13.337 +08:00', 3, 1)
|
|
@ -0,0 +1,45 @@
|
|||
import taos
|
||||
|
||||
# ANCHOR: insert
|
||||
conn = taos.connect()
|
||||
# Execute a sql, ignore the result set, just get affected rows. It's useful for DDL and DML statement.
|
||||
conn.execute("DROP DATABASE IF EXISTS test", req_id=1)
|
||||
conn.execute("CREATE DATABASE test", req_id=2)
|
||||
# change database. same as execute "USE db"
|
||||
conn.select_db("test")
|
||||
conn.execute("CREATE STABLE weather(ts TIMESTAMP, temperature FLOAT) TAGS (location INT)", req_id=3)
|
||||
affected_row = conn.execute("INSERT INTO t1 USING weather TAGS(1) VALUES (now, 23.5) (now+1m, 23.5) (now+2m, 24.4)", req_id=4)
|
||||
print("affected_row", affected_row)
|
||||
# output:
|
||||
# affected_row 3
|
||||
# ANCHOR_END: insert
|
||||
|
||||
# ANCHOR: query
|
||||
# Execute a sql and get its result set. It's useful for SELECT statement
|
||||
result = conn.query("SELECT * from weather", req_id=5)
|
||||
|
||||
# Get fields from result
|
||||
fields = result.fields
|
||||
for field in fields:
|
||||
print(field) # {name: ts, type: 9, bytes: 8}
|
||||
|
||||
# output:
|
||||
# {name: ts, type: 9, bytes: 8}
|
||||
# {name: temperature, type: 6, bytes: 4}
|
||||
# {name: location, type: 4, bytes: 4}
|
||||
|
||||
# Get data from result as list of tuple
|
||||
data = result.fetch_all()
|
||||
print(data)
|
||||
# output:
|
||||
# [(datetime.datetime(2022, 4, 27, 9, 4, 25, 367000), 23.5, 1), (datetime.datetime(2022, 4, 27, 9, 5, 25, 367000), 23.5, 1), (datetime.datetime(2022, 4, 27, 9, 6, 25, 367000), 24.399999618530273, 1)]
|
||||
|
||||
# Or get data from result as a list of dict
|
||||
# map_data = result.fetch_all_into_dict()
|
||||
# print(map_data)
|
||||
# output:
|
||||
# [{'ts': datetime.datetime(2022, 4, 27, 9, 1, 15, 343000), 'temperature': 23.5, 'location': 1}, {'ts': datetime.datetime(2022, 4, 27, 9, 2, 15, 343000), 'temperature': 23.5, 'location': 1}, {'ts': datetime.datetime(2022, 4, 27, 9, 3, 15, 343000), 'temperature': 24.399999618530273, 'location': 1}]
|
||||
# ANCHOR_END: query
|
||||
|
||||
|
||||
conn.close()
|
|
@ -0,0 +1,32 @@
|
|||
import taos
|
||||
|
||||
conn = taos.connect()
|
||||
cursor = conn.cursor()
|
||||
|
||||
cursor.execute("DROP DATABASE IF EXISTS test", req_id=1)
|
||||
cursor.execute("CREATE DATABASE test", req_id=2)
|
||||
cursor.execute("USE test", req_id=3)
|
||||
cursor.execute("CREATE STABLE weather(ts TIMESTAMP, temperature FLOAT) TAGS (location INT)", req_id=4)
|
||||
|
||||
for i in range(1000):
|
||||
location = str(i % 10)
|
||||
tb = "t" + location
|
||||
cursor.execute(f"INSERT INTO {tb} USING weather TAGS({location}) VALUES (now+{i}a, 23.5) (now+{i + 1}a, 23.5)", req_id=5+i)
|
||||
|
||||
cursor.execute("SELECT count(*) FROM weather", req_id=1005)
|
||||
data = cursor.fetchall()
|
||||
print("count:", data[0][0])
|
||||
cursor.execute("SELECT tbname, * FROM weather LIMIT 2", req_id=1006)
|
||||
col_names = [meta[0] for meta in cursor.description]
|
||||
print(col_names)
|
||||
rows = cursor.fetchall()
|
||||
print(rows)
|
||||
|
||||
cursor.close()
|
||||
conn.close()
|
||||
|
||||
# output:
|
||||
# count: 2000
|
||||
# ['tbname', 'ts', 'temperature', 'location']
|
||||
# row_count: -1
|
||||
# [('t0', datetime.datetime(2022, 4, 27, 14, 54, 24, 392000), 23.5, 0), ('t0', datetime.datetime(2022, 4, 27, 14, 54, 24, 393000), 23.5, 0)]
|
|
@ -5,7 +5,7 @@ LOCATIONS = ['California.SanFrancisco', 'California.LosAngles', 'California.SanD
|
|||
'California.PaloAlto', 'California.Campbell', 'California.MountainView', 'California.Sunnyvale',
|
||||
'California.SantaClara', 'California.Cupertino']
|
||||
|
||||
CREATE_DATABASE_SQL = 'create database if not exists {} keep 365 duration 10 buffer 16 wal_level 1'
|
||||
CREATE_DATABASE_SQL = 'create database if not exists {} keep 365 duration 10 buffer 16 wal_level 1 wal_retention_period 3600'
|
||||
USE_DATABASE_SQL = 'use {}'
|
||||
DROP_TABLE_SQL = 'drop table if exists meters'
|
||||
DROP_DATABASE_SQL = 'drop database if exists {}'
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
from taosrest import RestClient
|
||||
|
||||
client = RestClient("http://localhost:6041", user="root", password="taosdata")
|
||||
res: dict = client.sql("SELECT ts, current FROM power.meters LIMIT 1", req_id=1)
|
||||
print(res)
|
||||
|
||||
# output:
|
||||
# {'status': 'succ', 'head': ['ts', 'current'], 'column_meta': [['ts', 9, 8], ['current', 6, 4]], 'data': [[datetime.datetime(2018, 10, 3, 14, 38, 5, tzinfo=datetime.timezone(datetime.timedelta(seconds=28800), '+08:00')), 10.3]], 'rows': 1}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
import taos
|
||||
|
||||
conn = taos.connect()
|
||||
conn.execute("DROP DATABASE IF EXISTS test", req_id=1)
|
||||
conn.execute("CREATE DATABASE test", req_id=2)
|
||||
conn.select_db("test")
|
||||
conn.execute("CREATE STABLE weather(ts TIMESTAMP, temperature FLOAT) TAGS (location INT)", req_id=3)
|
||||
# prepare data
|
||||
for i in range(2000):
|
||||
location = str(i % 10)
|
||||
tb = "t" + location
|
||||
conn.execute(f"INSERT INTO {tb} USING weather TAGS({location}) VALUES (now+{i}a, 23.5) (now+{i + 1}a, 23.5)", req_id=4+i)
|
||||
|
||||
result: taos.TaosResult = conn.query("SELECT * FROM weather", req_id=2004)
|
||||
|
||||
block_index = 0
|
||||
blocks: taos.TaosBlocks = result.blocks_iter()
|
||||
for rows, length in blocks:
|
||||
print("block ", block_index, " length", length)
|
||||
print("first row in this block:", rows[0])
|
||||
block_index += 1
|
||||
|
||||
conn.close()
|
||||
|
||||
# possible output:
|
||||
# block 0 length 1200
|
||||
# first row in this block: (datetime.datetime(2022, 4, 27, 15, 14, 52, 46000), 23.5, 0)
|
||||
# block 1 length 1200
|
||||
# first row in this block: (datetime.datetime(2022, 4, 27, 15, 14, 52, 76000), 23.5, 3)
|
||||
# block 2 length 1200
|
||||
# first row in this block: (datetime.datetime(2022, 4, 27, 15, 14, 52, 99000), 23.5, 6)
|
||||
# block 3 length 400
|
||||
# first row in this block: (datetime.datetime(2022, 4, 27, 15, 14, 52, 122000), 23.5, 9)
|
|
@ -6,7 +6,7 @@ def init_tmq_env(db, topic):
|
|||
conn = taos.connect()
|
||||
conn.execute("drop topic if exists {}".format(topic))
|
||||
conn.execute("drop database if exists {}".format(db))
|
||||
conn.execute("create database if not exists {}".format(db))
|
||||
conn.execute("create database if not exists {} wal_retention_period 3600".format(db))
|
||||
conn.select_db(db)
|
||||
conn.execute(
|
||||
"create stable if not exists stb1 (ts timestamp, c1 int, c2 float, c3 varchar(16)) tags(t1 int, t3 varchar(16))")
|
||||
|
|
|
@ -353,6 +353,85 @@ TaosCursor 类使用原生连接进行写入、查询操作。在客户端多线
|
|||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
### 与 req_id 一起使用
|
||||
|
||||
使用可选的 req_id 参数,指定请求 id,可以用于 tracing
|
||||
|
||||
<Tabs defaultValue="rest">
|
||||
<TabItem value="native" label="原生连接">
|
||||
|
||||
##### TaosConnection 类的使用
|
||||
|
||||
`TaosConnection` 类既包含对 PEP249 Connection 接口的实现(如:`cursor`方法和 `close` 方法),也包含很多扩展功能(如: `execute`、 `query`、`schemaless_insert` 和 `subscribe` 方法。
|
||||
|
||||
```python title="execute 方法"
|
||||
{{#include docs/examples/python/connection_usage_native_reference_with_req_id.py:insert}}
|
||||
```
|
||||
|
||||
```python title="query 方法"
|
||||
{{#include docs/examples/python/connection_usage_native_reference_with_req_id.py:query}}
|
||||
```
|
||||
|
||||
:::tip
|
||||
查询结果只能获取一次。比如上面的示例中 `fetch_all()` 和 `fetch_all_into_dict()` 只能用一个。重复获取得到的结果为空列表。
|
||||
:::
|
||||
|
||||
##### TaosResult 类的使用
|
||||
|
||||
上面 `TaosConnection` 类的使用示例中,我们已经展示了两种获取查询结果的方法: `fetch_all()` 和 `fetch_all_into_dict()`。除此之外 `TaosResult` 还提供了按行迭代(`rows_iter`)或按数据块迭代(`blocks_iter`)结果集的方法。在查询数据量较大的场景,使用这两个方法会更高效。
|
||||
|
||||
```python title="blocks_iter 方法"
|
||||
{{#include docs/examples/python/result_set_with_req_id_examples.py}}
|
||||
```
|
||||
##### TaosCursor 类的使用
|
||||
|
||||
`TaosConnection` 类和 `TaosResult` 类已经实现了原生接口的所有功能。如果你对 PEP249 规范中的接口比较熟悉也可以使用 `TaosCursor` 类提供的方法。
|
||||
|
||||
```python title="TaosCursor 的使用"
|
||||
{{#include docs/examples/python/cursor_usage_native_reference_with_req_id.py}}
|
||||
```
|
||||
|
||||
:::note
|
||||
TaosCursor 类使用原生连接进行写入、查询操作。在客户端多线程的场景下,这个游标实例必须保持线程独享,不能跨线程共享使用,否则会导致返回结果出现错误。
|
||||
|
||||
:::
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="rest" label="REST 连接">
|
||||
|
||||
##### TaosRestCursor 类的使用
|
||||
|
||||
`TaosRestCursor` 类是对 PEP249 Cursor 接口的实现。
|
||||
|
||||
```python title="TaosRestCursor 的使用"
|
||||
{{#include docs/examples/python/connect_rest_with_req_id_examples.py:basic}}
|
||||
```
|
||||
- `cursor.execute` : 用来执行任意 SQL 语句。
|
||||
- `cursor.rowcount`: 对于写入操作返回写入成功记录数。对于查询操作,返回结果集行数。
|
||||
- `cursor.description` : 返回字段的描述信息。关于描述信息的具体格式请参考[TaosRestCursor](https://docs.taosdata.com/api/taospy/taosrest/cursor.html)。
|
||||
|
||||
##### RestClient 类的使用
|
||||
|
||||
`RestClient` 类是对于 [REST API](../rest-api) 的直接封装。它只包含一个 `sql()` 方法用于执行任意 SQL 语句, 并返回执行结果。
|
||||
|
||||
```python title="RestClient 的使用"
|
||||
{{#include docs/examples/python/rest_client_with_req_id_example.py}}
|
||||
```
|
||||
|
||||
对于 `sql()` 方法更详细的介绍, 请参考 [RestClient](https://docs.taosdata.com/api/taospy/taosrest/restclient.html)。
|
||||
</TabItem>
|
||||
<TabItem value="websocket" label="WebSocket 连接">
|
||||
|
||||
```python
|
||||
{{#include docs/examples/python/connect_websocket_with_req_id_examples.py:basic}}
|
||||
```
|
||||
|
||||
- `conn.execute`: 用来执行任意 SQL 语句,返回影响的行数
|
||||
- `conn.query`: 用来执行查询 SQL 语句,返回查询结果
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
### 与 pandas 一起使用
|
||||
|
||||
<Tabs defaultValue="rest">
|
||||
|
|
|
@ -99,6 +99,9 @@ taos --dump-config
|
|||
|
||||
## 监控相关
|
||||
|
||||
:::note
|
||||
请注意,完整的监控功能需要安装并运行 `taoskeeper` 服务。taoskeeper 负责接收监控指标数据并创建 `log` 库。
|
||||
|
||||
### monitor
|
||||
|
||||
| 属性 | 说明 |
|
||||
|
|
|
@ -13,12 +13,11 @@ taosKeeper 是 TDengine 3.0 版本监控指标的导出工具,通过简单的
|
|||
|
||||
## 安装
|
||||
|
||||
<!-- taosKeeper 有两种安装方式: -->
|
||||
taosKeeper 有两种安装方式:
|
||||
taosKeeper 安装方式:
|
||||
|
||||
<!-- - 安装 TDengine 官方安装包的同时会自动安装 taosKeeper, 详情请参考[ TDengine 安装](/operation/pkg-install)。-->
|
||||
- 安装 TDengine 官方安装包的同时会自动安装 taosKeeper, 详情请参考[ TDengine 安装](/operation/pkg-install)。
|
||||
|
||||
<!-- - 单独编译 taosKeeper 并安装,详情请参考 [taosKeeper](https://github.com/taosdata/taoskeeper) 仓库。-->
|
||||
- 单独编译 taosKeeper 并安装,详情请参考 [taosKeeper](https://github.com/taosdata/taoskeeper) 仓库。
|
||||
|
||||
## 配置和运行方式
|
||||
|
|
|
@ -19,12 +19,8 @@ TDengine 接收到应用的请求数据包时,先将请求的原始数据包
|
|||
|
||||
## 灾备
|
||||
|
||||
TDengine 的集群通过多个副本的机制,来提供系统的高可用性,同时具备一定的灾备能力。
|
||||
TDengine 灾备是通过在异地的两个数据中心中设置两个 TDengine 集群并利用 taosX 的数据复制能力来实现的。假定两个集群为集群 A 和集群 B,其中集群 A 为源集群,承担写入请求并提供查询服务。则在集群 A 所在数据中心中可以配置 taosX 利用 TDengine 提供的数据订阅能力,实时消费集群 A 中新写入的数据,并同步到集群 B。如果发生了灾难导致集群 A 所在数据中心不可用,则可以启用集群 B 作为数据写入和查询的主节点,并在集群 B 所处数据中心中配置 taosX 将数据复制到已经恢复的集群 A 或者新建的集群 C。
|
||||
|
||||
TDengine 集群是由 mnode 负责管理的,为保证 mnode 的高可靠,可以配置 三个 mnode 副本。为保证元数据的强一致性,mnode 副本之间通过同步方式进行数据复制,保证了元数据的强一致性。
|
||||
利用 taosX 的数据复制能力也可以构造出更复杂的灾备方案。
|
||||
|
||||
TDengine 集群中的时序数据的副本数是与数据库关联的,一个集群里可以有多个数据库,每个数据库可以配置不同的副本数。创建数据库时,通过参数 replica 指定副本数。为了支持高可靠,需要设置副本数为 3。
|
||||
|
||||
TDengine 集群的节点数必须大于等于副本数,否则创建表时将报错。
|
||||
|
||||
当 TDengine 集群中的节点部署在不同的物理机上,并设置多个副本数时,就实现了系统的高可靠性,无需再使用其他软件或工具。TDengine 企业版还可以将副本部署在不同机房,从而实现异地容灾。
|
||||
taosX 只在 TDengine 企业版中提供,关于其具体细节,请联系 business@taosdata.com
|
||||
|
|
|
@ -289,6 +289,7 @@ int32_t* taosGetErrno();
|
|||
#define TSDB_CODE_MND_INVALID_DB_ACCT TAOS_DEF_ERROR_CODE(0, 0x0389) // internal
|
||||
#define TSDB_CODE_MND_DB_OPTION_UNCHANGED TAOS_DEF_ERROR_CODE(0, 0x038A) //
|
||||
#define TSDB_CODE_MND_DB_INDEX_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x038B)
|
||||
#define TSDB_CODE_MND_DB_RETENTION_PERIOD_ZERO TAOS_DEF_ERROR_CODE(0, 0x038C)
|
||||
// #define TSDB_CODE_MND_INVALID_DB_OPTION_DAYS TAOS_DEF_ERROR_CODE(0, 0x0390) // 2.x
|
||||
// #define TSDB_CODE_MND_INVALID_DB_OPTION_KEEP TAOS_DEF_ERROR_CODE(0, 0x0391) // 2.x
|
||||
// #define TSDB_CODE_MND_INVALID_TOPIC TAOS_DEF_ERROR_CODE(0, 0x0392) // 2.x
|
||||
|
|
|
@ -32,6 +32,7 @@ bool mndTopicExistsForDb(SMnode *pMnode, SDbObj *pDb);
|
|||
const char *mndTopicGetShowName(const char topic[TSDB_TOPIC_FNAME_LEN]);
|
||||
|
||||
int32_t mndSetTopicCommitLogs(SMnode *pMnode, STrans *pTrans, SMqTopicObj *pTopic);
|
||||
int32_t mndGetNumOfTopics(SMnode *pMnode, char *dbName, int32_t *pNumOfTopics);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -846,6 +846,18 @@ static int32_t mndProcessAlterDbReq(SRpcMsg *pReq) {
|
|||
goto _OVER;
|
||||
}
|
||||
|
||||
int32_t numOfTopics = 0;
|
||||
if (mndGetNumOfTopics(pMnode, pDb->name, &numOfTopics) != 0) {
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
if (numOfTopics != 0 && alterReq.walRetentionPeriod == 0) {
|
||||
terrno = TSDB_CODE_MND_DB_RETENTION_PERIOD_ZERO;
|
||||
mError("db:%s, not allowed to set WAL_RETENTION_PERIOD 0 when there are topics defined. numOfTopics:%d", pDb->name,
|
||||
numOfTopics);
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
memcpy(&dbObj, pDb, sizeof(SDbObj));
|
||||
if (dbObj.cfg.pRetensions != NULL) {
|
||||
dbObj.cfg.pRetensions = taosArrayDup(pDb->cfg.pRetensions, NULL);
|
||||
|
|
|
@ -653,7 +653,7 @@ _OVER:
|
|||
pMsg->msgType == TDMT_MND_TRANS_TIMER || pMsg->msgType == TDMT_MND_TTL_TIMER ||
|
||||
pMsg->msgType == TDMT_MND_UPTIME_TIMER) {
|
||||
mTrace("timer not process since mnode restored:%d stopped:%d, sync restored:%d role:%s ", pMnode->restored,
|
||||
pMnode->stopped, state.restored, syncStr(state.restored));
|
||||
pMnode->stopped, state.restored, syncStr(state.state));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -605,6 +605,12 @@ static int32_t mndProcessCreateTopicReq(SRpcMsg *pReq) {
|
|||
goto _OVER;
|
||||
}
|
||||
|
||||
if (pDb->cfg.walRetentionPeriod == 0) {
|
||||
terrno = TSDB_CODE_MND_DB_RETENTION_PERIOD_ZERO;
|
||||
mError("db:%s, not allowed to create topic when WAL_RETENTION_PERIOD is zero", pDb->name);
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
code = mndCreateTopic(pMnode, pReq, &createTopicReq, pDb, pReq->info.conn.user);
|
||||
if (code == 0) {
|
||||
code = TSDB_CODE_ACTION_IN_PROGRESS;
|
||||
|
@ -793,7 +799,7 @@ static int32_t mndProcessDropTopicReq(SRpcMsg *pReq) {
|
|||
return TSDB_CODE_ACTION_IN_PROGRESS;
|
||||
}
|
||||
|
||||
static int32_t mndGetNumOfTopics(SMnode *pMnode, char *dbName, int32_t *pNumOfTopics) {
|
||||
int32_t mndGetNumOfTopics(SMnode *pMnode, char *dbName, int32_t *pNumOfTopics) {
|
||||
*pNumOfTopics = 0;
|
||||
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
|
|
|
@ -290,14 +290,22 @@ int32_t walEndSnapshot(SWal *pWal) {
|
|||
int ts = taosGetTimestampSec();
|
||||
|
||||
ver = TMAX(ver - pWal->vers.logRetention, pWal->vers.firstVer - 1);
|
||||
|
||||
bool hasTopic = false;
|
||||
int64_t refVer = ver;
|
||||
void *pIter = NULL;
|
||||
while (1) {
|
||||
pIter = taosHashIterate(pWal->pRefHash, pIter);
|
||||
if (pIter == NULL) break;
|
||||
SWalRef *pRef = *(SWalRef **)pIter;
|
||||
if (pRef->refVer == -1) continue;
|
||||
ver = TMIN(ver, pRef->refVer - 1);
|
||||
refVer = TMIN(refVer, pRef->refVer - 1);
|
||||
wDebug("vgId:%d, wal found ref %" PRId64 ", refId %" PRId64, pWal->cfg.vgId, pRef->refVer, pRef->refId);
|
||||
hasTopic = true;
|
||||
}
|
||||
// compatible mode
|
||||
if (pWal->cfg.retentionPeriod == 0 && hasTopic) {
|
||||
ver = TMIN(ver, refVer);
|
||||
}
|
||||
|
||||
int deleteCnt = 0;
|
||||
|
|
|
@ -224,6 +224,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_DB, "Invalid database name
|
|||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TOO_MANY_DATABASES, "Too many databases for account")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_DB_IN_DROPPING, "Database in dropping status")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_DB_NOT_EXIST, "Database not exist")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_DB_RETENTION_PERIOD_ZERO, "WAL retention period is zero")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_DB_ACCT, "Invalid database account")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_DB_OPTION_UNCHANGED, "Database options not changed")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_DB_INDEX_NOT_EXIST, "Index not exist")
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
"num_of_records_per_req": 10,
|
||||
"databases": [{
|
||||
"dbinfo": {
|
||||
"name": "db",
|
||||
"name": "opentsdb_telnet",
|
||||
"drop": "yes"
|
||||
},
|
||||
"super_tables": [{
|
||||
|
|
|
@ -52,7 +52,7 @@ python3 conn_rest_pandas.py
|
|||
taos -s "drop database if exists power"
|
||||
|
||||
# 11
|
||||
taos -s "create database if not exists test"
|
||||
taos -s "create database if not exists test wal_retention_period 3600"
|
||||
python3 connect_native_reference.py
|
||||
|
||||
# 12
|
||||
|
|
|
@ -1102,9 +1102,9 @@
|
|||
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/json_tag.py
|
||||
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/query_json.py
|
||||
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/sample_csv_json.py
|
||||
#,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/sml_json_alltypes.py
|
||||
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/sml_json_alltypes.py
|
||||
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/taosdemoTestQueryWithJson.py -R
|
||||
#,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/telnet_tcp.py -R
|
||||
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/telnet_tcp.py -R
|
||||
|
||||
#docs-examples test
|
||||
,,n,docs-examples-test,bash python.sh
|
||||
|
|
|
@ -270,12 +270,12 @@ class TDSql:
|
|||
args = (caller.filename, caller.lineno, self.sql, row, col, self.queryResult[row][col], data)
|
||||
tdLog.exit("%s(%d) failed: sql:%s row:%d col:%d data:%s != expect:%s" % args)
|
||||
return
|
||||
elif isinstance(data,int) :
|
||||
if len(str(data)) == 16 :
|
||||
elif isinstance(data,int):
|
||||
if len(str(data)) == 16:
|
||||
precision = 'us'
|
||||
elif len(str(data)) == 13 :
|
||||
elif len(str(data)) == 13:
|
||||
precision = 'ms'
|
||||
elif len(str(data)) == 19 :
|
||||
elif len(str(data)) == 19:
|
||||
precision = 'ns'
|
||||
else:
|
||||
caller = inspect.getframeinfo(inspect.stack()[1][0])
|
||||
|
@ -303,12 +303,22 @@ class TDSql:
|
|||
args = (caller.filename, caller.lineno, self.sql, row, col, self.queryResult[row][col], data)
|
||||
tdLog.exit("%s(%d) failed: sql:%s row:%d col:%d data:%s != expect:%s" % args)
|
||||
return
|
||||
elif isinstance(data,datetime.datetime):
|
||||
dt_obj = self.queryResult[row][col]
|
||||
delt_data = data-datetime.datetime.fromtimestamp(0,data.tzinfo)
|
||||
delt_result = self.queryResult[row][col] - datetime.datetime.fromtimestamp(0,self.queryResult[row][col].tzinfo)
|
||||
if delt_data == delt_result:
|
||||
tdLog.info("check successfully")
|
||||
else:
|
||||
caller = inspect.getframeinfo(inspect.stack()[1][0])
|
||||
args = (caller.filename, caller.lineno, self.sql, row, col, self.queryResult[row][col], data)
|
||||
tdLog.exit("%s(%d) failed: sql:%s row:%d col:%d data:%s != expect:%s" % args)
|
||||
return
|
||||
else:
|
||||
caller = inspect.getframeinfo(inspect.stack()[1][0])
|
||||
args = (caller.filename, caller.lineno, self.sql, row, col, self.queryResult[row][col], data)
|
||||
tdLog.exit("%s(%d) failed: sql:%s row:%d col:%d data:%s != expect:%s" % args)
|
||||
|
||||
|
||||
if str(self.queryResult[row][col]) == str(data):
|
||||
# tdLog.info(f"sql:{self.sql}, row:{row} col:{col} data:{self.queryResult[row][col]} == expect:{data}")
|
||||
tdLog.info("check successfully")
|
||||
|
|
|
@ -34,6 +34,9 @@ $showRow = 0
|
|||
sql connect
|
||||
sql use $dbName
|
||||
|
||||
print == alter database
|
||||
sql alter database $dbName wal_retention_period 3600
|
||||
|
||||
print == create topics from super table
|
||||
sql create topic topic_stb_column as select ts, c3 from stb
|
||||
sql create topic topic_stb_all as select ts, c1, c2, c3 from stb
|
||||
|
@ -83,6 +86,9 @@ sql create database $cdbName vgroups 1
|
|||
sleep 500
|
||||
sql use $cdbName
|
||||
|
||||
print == alter database
|
||||
sql alter database $cdbName wal_retention_period 3600
|
||||
|
||||
print == create consume info table and consume result table
|
||||
sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)
|
||||
sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)
|
||||
|
@ -155,6 +161,9 @@ sql create database $cdbName vgroups 1
|
|||
sleep 500
|
||||
sql use $cdbName
|
||||
|
||||
print == alter database
|
||||
sql alter database $cdbName wal_retention_period 3600
|
||||
|
||||
print == create consume info table and consume result table
|
||||
sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)
|
||||
sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)
|
||||
|
@ -226,6 +235,9 @@ sql create database $cdbName vgroups 1
|
|||
sleep 500
|
||||
sql use $cdbName
|
||||
|
||||
print == alter database
|
||||
sql alter database $cdbName wal_retention_period 3600
|
||||
|
||||
print == create consume info table and consume result table
|
||||
sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)
|
||||
sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)
|
||||
|
|
|
@ -34,6 +34,9 @@ $showRow = 0
|
|||
sql connect
|
||||
sql use $dbName
|
||||
|
||||
print == alter database
|
||||
sql alter database $dbName wal_retention_period 3600
|
||||
|
||||
print == create topics from super table
|
||||
sql create topic topic_stb_column as select ts, c3 from stb
|
||||
sql create topic topic_stb_all as select ts, c1, c2, c3 from stb
|
||||
|
@ -83,6 +86,9 @@ sql create database $cdbName vgroups 1
|
|||
sleep 500
|
||||
sql use $cdbName
|
||||
|
||||
print == alter database
|
||||
sql alter database $cdbName wal_retention_period 3600
|
||||
|
||||
print == create consume info table and consume result table for stb
|
||||
sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)
|
||||
sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)
|
||||
|
@ -186,6 +192,9 @@ sql create database $cdbName vgroups 1
|
|||
sleep 500
|
||||
sql use $cdbName
|
||||
|
||||
print == alter database
|
||||
sql alter database $cdbName wal_retention_period 3600
|
||||
|
||||
print == create consume info table and consume result table for ctb
|
||||
sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)
|
||||
sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)
|
||||
|
@ -288,6 +297,9 @@ sql create database $cdbName vgroups 1
|
|||
sleep 500
|
||||
sql use $cdbName
|
||||
|
||||
print == alter database
|
||||
sql alter database $cdbName wal_retention_period 3600
|
||||
|
||||
print == create consume info table and consume result table for ntb
|
||||
sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)
|
||||
sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)
|
||||
|
|
|
@ -34,6 +34,9 @@ $showRow = 0
|
|||
sql connect
|
||||
sql use $dbName
|
||||
|
||||
print == alter database
|
||||
sql alter database $dbName wal_retention_period 3600
|
||||
|
||||
print == create topics from super table
|
||||
sql create topic topic_stb_column as select ts, c3 from stb
|
||||
sql create topic topic_stb_all as select ts, c1, c2, c3 from stb
|
||||
|
@ -118,6 +121,9 @@ sql create database $cdbName vgroups 1
|
|||
sleep 500
|
||||
sql use $cdbName
|
||||
|
||||
print == alter database
|
||||
sql alter database $cdbName wal_retention_period 3600
|
||||
|
||||
print == create consume info table and consume result table
|
||||
sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)
|
||||
sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)
|
||||
|
@ -175,6 +181,9 @@ sql create database $cdbName vgroups 1
|
|||
sleep 500
|
||||
sql use $cdbName
|
||||
|
||||
print == alter database
|
||||
sql alter database $cdbName wal_retention_period 3600
|
||||
|
||||
print == create consume info table and consume result table
|
||||
sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)
|
||||
sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)
|
||||
|
|
|
@ -34,6 +34,9 @@ $showRow = 0
|
|||
sql connect
|
||||
sql use $dbName
|
||||
|
||||
print == alter database
|
||||
sql alter database $dbName wal_retention_period 3600
|
||||
|
||||
print == create topics from super table
|
||||
sql create topic topic_stb_column as select ts, c3 from stb
|
||||
sql create topic topic_stb_all as select ts, c1, c2, c3 from stb
|
||||
|
@ -147,6 +150,9 @@ sql create database $cdbName vgroups 1
|
|||
sleep 500
|
||||
sql use $cdbName
|
||||
|
||||
print == alter database
|
||||
sql alter database $cdbName wal_retention_period 3600
|
||||
|
||||
print == create consume info table and consume result table for ctb
|
||||
sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)
|
||||
sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)
|
||||
|
@ -234,6 +240,9 @@ sql create database $cdbName vgroups 1
|
|||
sleep 500
|
||||
sql use $cdbName
|
||||
|
||||
print == alter database
|
||||
sql alter database $cdbName wal_retention_period 3600
|
||||
|
||||
print == create consume info table and consume result table for ntb
|
||||
sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)
|
||||
sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)
|
||||
|
|
|
@ -34,6 +34,9 @@ $showRow = 0
|
|||
sql connect
|
||||
sql use $dbName
|
||||
|
||||
print == alter database
|
||||
sql alter database $dbName wal_retention_period 3600
|
||||
|
||||
print == create topics from super table
|
||||
sql create topic topic_stb_column as select ts, c3 from stb
|
||||
sql create topic topic_stb_all as select ts, c1, c2, c3 from stb
|
||||
|
@ -168,6 +171,9 @@ sql create database $cdbName vgroups 1
|
|||
sleep 500
|
||||
sql use $cdbName
|
||||
|
||||
print == alter database
|
||||
sql alter database $cdbName wal_retention_period 3600
|
||||
|
||||
print == create consume info table and consume result table for ctb
|
||||
sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)
|
||||
sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)
|
||||
|
@ -259,6 +265,9 @@ sql create database $cdbName vgroups 1
|
|||
sleep 500
|
||||
sql use $cdbName
|
||||
|
||||
print == alter database
|
||||
sql alter database $cdbName wal_retention_period 3600
|
||||
|
||||
print == create consume info table and consume result table for ntb
|
||||
sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)
|
||||
sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)
|
||||
|
|
|
@ -34,6 +34,9 @@ $showRow = 0
|
|||
sql connect
|
||||
sql use $dbName
|
||||
|
||||
print == alter database
|
||||
sql alter database $dbName wal_retention_period 3600
|
||||
|
||||
print == create topics from super table
|
||||
sql create topic topic_stb_column as select ts, c3 from stb
|
||||
sql create topic topic_stb_all as select ts, c1, c2, c3 from stb
|
||||
|
@ -83,6 +86,9 @@ sql create database $cdbName vgroups 1
|
|||
sleep 500
|
||||
sql use $cdbName
|
||||
|
||||
print == alter database
|
||||
sql alter database $cdbName wal_retention_period 3600
|
||||
|
||||
print == create consume info table and consume result table
|
||||
sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)
|
||||
sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)
|
||||
|
@ -154,6 +160,9 @@ sql create database $cdbName vgroups 1
|
|||
sleep 500
|
||||
sql use $cdbName
|
||||
|
||||
print == alter database
|
||||
sql alter database $cdbName wal_retention_period 3600
|
||||
|
||||
print == create consume info table and consume result table
|
||||
sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)
|
||||
sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)
|
||||
|
@ -225,6 +234,9 @@ sql create database $cdbName vgroups 1
|
|||
sleep 500
|
||||
sql use $cdbName
|
||||
|
||||
print == alter database
|
||||
sql alter database $cdbName wal_retention_period 3600
|
||||
|
||||
print == create consume info table and consume result table
|
||||
sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)
|
||||
sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)
|
||||
|
|
|
@ -34,6 +34,9 @@ $showRow = 0
|
|||
sql connect
|
||||
sql use $dbName
|
||||
|
||||
print == alter database
|
||||
sql alter database $dbName wal_retention_period 3600
|
||||
|
||||
print == create topics from super table
|
||||
sql create topic topic_stb_column as select ts, c3 from stb
|
||||
sql create topic topic_stb_all as select ts, c1, c2, c3 from stb
|
||||
|
@ -82,6 +85,9 @@ sql create database $cdbName vgroups 1
|
|||
sleep 500
|
||||
sql use $cdbName
|
||||
|
||||
print == alter database
|
||||
sql alter database $cdbName wal_retention_period 3600
|
||||
|
||||
print == create consume info table and consume result table
|
||||
sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)
|
||||
sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)
|
||||
|
@ -197,6 +203,9 @@ sql create database $cdbName vgroups 1
|
|||
sleep 500
|
||||
sql use $cdbName
|
||||
|
||||
print == alter database
|
||||
sql alter database $cdbName wal_retention_period 3600
|
||||
|
||||
print == create consume info table and consume result table
|
||||
sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)
|
||||
sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)
|
||||
|
@ -299,6 +308,9 @@ sql create database $cdbName vgroups 1
|
|||
sleep 500
|
||||
sql use $cdbName
|
||||
|
||||
print == alter database
|
||||
sql alter database $cdbName wal_retention_period 3600
|
||||
|
||||
print == create consume info table and consume result table
|
||||
sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)
|
||||
sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)
|
||||
|
|
|
@ -34,6 +34,9 @@ $showRow = 0
|
|||
sql connect
|
||||
sql use $dbName
|
||||
|
||||
print == alter database
|
||||
sql alter database $dbName wal_retention_period 3600
|
||||
|
||||
print == create topics from super table
|
||||
sql create topic topic_stb_column as select ts, c3 from stb
|
||||
sql create topic topic_stb_all as select ts, c1, c2, c3 from stb
|
||||
|
@ -115,6 +118,9 @@ sql create database $cdbName vgroups 1
|
|||
sleep 500
|
||||
sql use $cdbName
|
||||
|
||||
print == alter database
|
||||
sql alter database $cdbName wal_retention_period 3600
|
||||
|
||||
print == create consume info table and consume result table
|
||||
sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)
|
||||
sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)
|
||||
|
@ -172,6 +178,9 @@ sql create database $cdbName vgroups 1
|
|||
sleep 500
|
||||
sql use $cdbName
|
||||
|
||||
print == alter database
|
||||
sql alter database $cdbName wal_retention_period 3600
|
||||
|
||||
print == create consume info table and consume result table
|
||||
sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)
|
||||
sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)
|
||||
|
|
|
@ -34,6 +34,9 @@ $showRow = 0
|
|||
sql connect
|
||||
sql use $dbName
|
||||
|
||||
print == alter database
|
||||
sql alter database $dbName wal_retention_period 3600
|
||||
|
||||
print == create topics from super table
|
||||
sql create topic topic_stb_column as select ts, c3 from stb
|
||||
sql create topic topic_stb_all as select ts, c1, c2, c3 from stb
|
||||
|
@ -156,6 +159,9 @@ sql create database $cdbName vgroups 1
|
|||
sleep 500
|
||||
sql use $cdbName
|
||||
|
||||
print == alter database
|
||||
sql alter database $cdbName wal_retention_period 3600
|
||||
|
||||
print == create consume info table and consume result table
|
||||
sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)
|
||||
sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)
|
||||
|
@ -244,6 +250,9 @@ sql create database $cdbName vgroups 1
|
|||
sleep 500
|
||||
sql use $cdbName
|
||||
|
||||
print == alter database
|
||||
sql alter database $cdbName wal_retention_period 3600
|
||||
|
||||
print == create consume info table and consume result table
|
||||
sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)
|
||||
sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)
|
||||
|
|
|
@ -34,6 +34,9 @@ $showRow = 0
|
|||
sql connect
|
||||
sql use $dbName
|
||||
|
||||
print == alter database
|
||||
sql alter database $dbName wal_retention_period 3600
|
||||
|
||||
print == create topics from super table
|
||||
sql create topic topic_stb_column as select ts, c3 from stb
|
||||
sql create topic topic_stb_all as select ts, c1, c2, c3 from stb
|
||||
|
@ -83,6 +86,9 @@ sql create database $cdbName vgroups 1
|
|||
sleep 500
|
||||
sql use $cdbName
|
||||
|
||||
print == alter database
|
||||
sql alter database $cdbName wal_retention_period 3600
|
||||
|
||||
print == create consume info table and consume result table
|
||||
sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)
|
||||
sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)
|
||||
|
@ -152,6 +158,9 @@ sql create database $cdbName vgroups 1
|
|||
sleep 500
|
||||
sql use $cdbName
|
||||
|
||||
print == alter database
|
||||
sql alter database $cdbName wal_retention_period 3600
|
||||
|
||||
print == create consume info table and consume result table
|
||||
sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)
|
||||
sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)
|
||||
|
@ -223,6 +232,9 @@ sql create database $cdbName vgroups 1
|
|||
sleep 500
|
||||
sql use $cdbName
|
||||
|
||||
print == alter database
|
||||
sql alter database $cdbName wal_retention_period 3600
|
||||
|
||||
print == create consume info table and consume result table
|
||||
sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)
|
||||
sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)
|
||||
|
|
|
@ -34,6 +34,9 @@ $showRow = 0
|
|||
sql connect
|
||||
sql use $dbName
|
||||
|
||||
print == alter database
|
||||
sql alter database $dbName wal_retention_period 3600
|
||||
|
||||
print == create topics from super table
|
||||
sql create topic topic_stb_column as select ts, c3 from stb
|
||||
sql create topic topic_stb_all as select ts, c1, c2, c3 from stb
|
||||
|
@ -147,6 +150,9 @@ sql create database $cdbName vgroups 1
|
|||
sleep 500
|
||||
sql use $cdbName
|
||||
|
||||
print == alter database
|
||||
sql alter database $cdbName wal_retention_period 3600
|
||||
|
||||
print == create consume info table and consume result table for ctb
|
||||
sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)
|
||||
sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)
|
||||
|
@ -224,6 +230,9 @@ sql create database $cdbName vgroups 1
|
|||
sleep 500
|
||||
sql use $cdbName
|
||||
|
||||
print == alter database
|
||||
sql alter database $cdbName wal_retention_period 3600
|
||||
|
||||
print == create consume info table and consume result table for ntb
|
||||
sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)
|
||||
sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)
|
||||
|
|
|
@ -39,6 +39,8 @@ endi
|
|||
|
||||
sql use $dbName
|
||||
|
||||
print == alter database
|
||||
sql alter database $dbName wal_retention_period 3600
|
||||
|
||||
print == create super table
|
||||
sql create table $stbPrefix (ts timestamp, c1 int, c2 float, c3 binary(16)) tags (t1 int)
|
||||
|
|
|
@ -4,13 +4,13 @@ system sh/exec.sh -n dnode1 -s start
|
|||
sql connect
|
||||
|
||||
print =============== create db
|
||||
sql create database d1 vgroups 1;
|
||||
sql create database d1 vgroups 1 wal_retention_period 3600;
|
||||
sql use d1
|
||||
sql create table d1_stb (ts timestamp, i int) tags (j int)
|
||||
sql create topic d1_topic_1 as select ts, i from d1_stb
|
||||
|
||||
sql create database d2 vgroups 1;
|
||||
sql create database d3 vgroups 1;
|
||||
sql create database d2 vgroups 1 wal_retention_period 3600;
|
||||
sql create database d3 vgroups 1 wal_retention_period 3600;
|
||||
sql select * from information_schema.ins_databases
|
||||
if $rows != 5 then
|
||||
return -1
|
||||
|
|
|
@ -4,9 +4,9 @@ system sh/exec.sh -n dnode1 -s start
|
|||
sql connect
|
||||
|
||||
print =============== create db
|
||||
sql create database root_d1 vgroups 1;
|
||||
sql create database root_d2 vgroups 1;
|
||||
sql create database root_d3 vgroups 1;
|
||||
sql create database root_d1 vgroups 1 wal_retention_period 3600;
|
||||
sql create database root_d2 vgroups 1 wal_retention_period 3600;
|
||||
sql create database root_d3 vgroups 1 wal_retention_period 3600;
|
||||
|
||||
sql show user privileges
|
||||
if $rows != 1 then
|
||||
|
|
|
@ -29,7 +29,7 @@ class TDTestCase:
|
|||
self.streamname = 'stm'
|
||||
self.streamtb = 'stm_stb'
|
||||
def topic_name_check(self):
|
||||
tdSql.execute(f'create database if not exists {self.dbname}')
|
||||
tdSql.execute(f'create database if not exists {self.dbname} wal_retention_period 3600')
|
||||
tdSql.execute(f'use {self.dbname}')
|
||||
tdSql.execute(f'create stable {self.stbname} (ts timestamp,c0 int) tags(t0 int)')
|
||||
for name in [self.dbname,self.stbname]:
|
||||
|
@ -56,12 +56,12 @@ class TDTestCase:
|
|||
tdSql.execute(f'drop topic `{name}`')
|
||||
|
||||
def db_name_check(self):
|
||||
tdSql.execute(f'create database if not exists `{self.dbname}`')
|
||||
tdSql.execute(f'create database if not exists `{self.dbname}` wal_retention_period 3600')
|
||||
tdSql.execute(f'use `{self.dbname}`')
|
||||
tdSql.execute(f'drop database {self.dbname}')
|
||||
|
||||
def stream_name_check(self):
|
||||
tdSql.execute(f'create database if not exists {self.dbname}')
|
||||
tdSql.execute(f'create database if not exists {self.dbname} wal_retention_period 3600')
|
||||
tdSql.execute(f'use {self.dbname}')
|
||||
tdSql.execute(f'create stable {self.stbname} (ts timestamp,c0 int) tags(t0 int)')
|
||||
tdSql.execute(f'create stream `{self.streamname}` into `{self.streamtb}` as select count(*) from {self.stbname} interval(10s);')
|
||||
|
|
|
@ -187,6 +187,7 @@ class TDTestCase:
|
|||
tdsql.execute("drop database if exists db")
|
||||
tdsql.execute("create database db")
|
||||
tdsql.execute("use db")
|
||||
tdsql.execute("alter database db wal_retention_period 3600")
|
||||
tdsql.execute("create stable db.stb1 (ts timestamp, c1 int) tags (t1 int);")
|
||||
tdsql.execute("insert into db.ct1 using db.stb1 TAGS(1) values(now(),11);")
|
||||
tdsql.error(" insert into `db.ct2` using db.stb1 TAGS(9) values(now(),11);")
|
||||
|
|
|
@ -75,7 +75,7 @@ class TDTestCase:
|
|||
def prepare_data(self):
|
||||
tdSql.execute(f"create database if not exists {self.dbname} vgroups 2") #1 query
|
||||
tdSql.execute(f'use {self.dbname}') #1 query
|
||||
|
||||
tdsql.execute(f"alter database {self.dbname} wal_retention_period 3600")
|
||||
tdSql.execute(self.setsql.set_create_stable_sql(self.stbname,self.column_dict,self.tag_dict)) #1 query
|
||||
|
||||
for i in range(self.tbnum): #self.tbnum query
|
||||
|
@ -92,12 +92,12 @@ class TDTestCase:
|
|||
def run(self):
|
||||
tdSqlTran = TDSql()
|
||||
tdSqlTran.init(self.obj.conn.cursor())
|
||||
tdSqlTran.execute(f"create database if not exists %s vgroups 20"%(self.obj.transTestDBName))
|
||||
tdSqlTran.execute(f"create database if not exists %s vgroups 20 wal_retention_period 3600"%(self.obj.transTestDBName))
|
||||
tdSqlTran.execute(f"DROP DATABASE %s"%(self.obj.transTestDBName))
|
||||
|
||||
def init_tmq_env(self, db, topic):
|
||||
self.conn.execute("drop topic if exists {}".format(topic))
|
||||
self.conn.execute("create database if not exists {}".format(db))
|
||||
self.conn.execute("create database if not exists {} wal_retention_period 3600".format(db))
|
||||
self.conn.select_db(db)
|
||||
self.conn.execute(
|
||||
"create stable if not exists stb_sub (ts timestamp, c1 int, c2 float, c3 varchar(16)) tags(t1 int, t3 varchar(16))")
|
||||
|
|
|
@ -129,7 +129,7 @@ class TDTestCase:
|
|||
# database\stb\tb\chiild-tb\rows\topics
|
||||
tdSql.execute("create user testpy pass 'testpy'")
|
||||
tdSql.execute("drop database if exists db0;")
|
||||
tdSql.execute("create database db0;")
|
||||
tdSql.execute("create database db0 wal_retention_period 3600;")
|
||||
tdSql.execute("use db0;")
|
||||
tdSql.execute("create table if not exists db0.stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int unsigned);")
|
||||
tdSql.execute("create table db0.ct1 using db0.stb tags(1000);")
|
||||
|
@ -145,7 +145,7 @@ class TDTestCase:
|
|||
|
||||
#stream
|
||||
tdSql.execute("drop database if exists source_db;")
|
||||
tdSql.query("create database source_db vgroups 3;")
|
||||
tdSql.query("create database source_db vgroups 3 wal_retention_period 3600;")
|
||||
tdSql.query("use source_db")
|
||||
tdSql.query("create table if not exists source_db.stb (ts timestamp, k int) tags (a int);")
|
||||
tdSql.query("create table source_db.ct1 using source_db.stb tags(1000);create table source_db.ct2 using source_db.stb tags(2000);create table source_db.ct3 using source_db.stb tags(3000);")
|
||||
|
|
|
@ -13,7 +13,7 @@ def init_tmq_env(db, topic):
|
|||
|
||||
conn.execute("drop topic if exists {}".format(topic))
|
||||
conn.execute("drop database if exists {}".format(db))
|
||||
conn.execute("create database if not exists {} replica 1 ".format(db))
|
||||
conn.execute("create database if not exists {} replica 1 wal_retention_period 3600".format(db))
|
||||
conn.select_db(db)
|
||||
conn.execute(
|
||||
"create stable if not exists stb1 (ts timestamp, c1 int, c2 float, c3 varchar(16)) tags(t1 int, t3 varchar(16))")
|
||||
|
@ -37,7 +37,7 @@ def init_tmq_rest_env(db, topic):
|
|||
|
||||
conn.execute("drop topic if exists {}".format(topic))
|
||||
conn.execute("drop database if exists {}".format(db))
|
||||
conn.execute("create database if not exists {} replica 3 ".format(db))
|
||||
conn.execute("create database if not exists {} replica 3 wal_retention_period 3600".format(db))
|
||||
conn.select_db(db)
|
||||
conn.execute(
|
||||
"create stable if not exists stb1 (ts timestamp, c1 int, c2 float, c3 varchar(16)) tags(t1 int, t3 varchar(16))")
|
||||
|
|
|
@ -115,6 +115,7 @@ class TDTestCase:
|
|||
jiacy0_read_conn = taos.connect(user='jiacy0_read', password='123')
|
||||
jiacy0_write_conn = taos.connect(user='jiacy0_write', password='123')
|
||||
jiacy0_none_conn = taos.connect(user='jiacy0_none', password='123')
|
||||
tdSql.execute('alter database db wal_retention_period 3600')
|
||||
tdSql.execute('create topic root_db as select * from db.stb')
|
||||
for user in [jiacy1_all_conn, jiacy1_read_conn, jiacy0_all_conn, jiacy0_read_conn]:
|
||||
user.execute(f'create topic db_jiacy as select * from db.stb')
|
||||
|
|
|
@ -58,7 +58,7 @@ class TDTestCase:
|
|||
|
||||
#stream
|
||||
tdSql.execute("drop database if exists source_db;")
|
||||
tdSql.query("create database source_db vgroups 3;")
|
||||
tdSql.query("create database source_db vgroups 3 wal_retention_period 3600;")
|
||||
tdSql.query("use source_db")
|
||||
tdSql.query("create table if not exists source_db.stb (ts timestamp, k int) tags (a int);")
|
||||
tdSql.query("create table source_db.ct1 using source_db.stb tags(1000);create table source_db.ct2 using source_db.stb tags(2000);create table source_db.ct3 using source_db.stb tags(3000);")
|
||||
|
|
|
@ -54,7 +54,7 @@ class TDTestCase:
|
|||
insert_list = []
|
||||
self.setsql.insert_values(column_dict,i,insert_sql,insert_list,self.ts)
|
||||
def drop_ntb_check(self):
|
||||
tdSql.execute(f'create database if not exists {self.dbname} replica {self.replicaVar}')
|
||||
tdSql.execute(f'create database if not exists {self.dbname} replica {self.replicaVar} wal_retention_period 3600')
|
||||
tdSql.execute(f'use {self.dbname}')
|
||||
tdSql.execute(self.setsql.set_create_normaltable_sql(self.ntbname,self.column_dict))
|
||||
self.insert_data(self.column_dict,self.ntbname,self.rowNum)
|
||||
|
@ -80,7 +80,7 @@ class TDTestCase:
|
|||
tag_values = [
|
||||
f'1'
|
||||
]
|
||||
tdSql.execute(f"create database if not exists {self.dbname} replica {self.replicaVar}")
|
||||
tdSql.execute(f"create database if not exists {self.dbname} replica {self.replicaVar} wal_retention_period 3600")
|
||||
tdSql.execute(f'use {self.dbname}')
|
||||
tdSql.execute(self.setsql.set_create_stable_sql(stbname,self.column_dict,tag_dict))
|
||||
for i in range(self.tbnum):
|
||||
|
@ -116,7 +116,7 @@ class TDTestCase:
|
|||
tdSql.checkRows(self.tbnum)
|
||||
tdSql.execute(f'drop database {self.dbname}')
|
||||
def drop_topic_check(self):
|
||||
tdSql.execute(f'create database {self.dbname} replica {self.replicaVar}')
|
||||
tdSql.execute(f'create database {self.dbname} replica {self.replicaVar} wal_retention_period 3600')
|
||||
tdSql.execute(f'use {self.dbname}')
|
||||
stbname = tdCom.getLongName(5,"letters")
|
||||
topic_name = tdCom.getLongName(5,"letters")
|
||||
|
@ -132,7 +132,7 @@ class TDTestCase:
|
|||
tdSql.execute(f'drop database {self.dbname}')
|
||||
|
||||
def drop_stream_check(self):
|
||||
tdSql.execute(f'create database {self.dbname} replica 1')
|
||||
tdSql.execute(f'create database {self.dbname} replica 1 wal_retention_period 3600')
|
||||
tdSql.execute(f'use {self.dbname}')
|
||||
stbname = tdCom.getLongName(5,"letters")
|
||||
stream_name = tdCom.getLongName(5,"letters")
|
||||
|
|
|
@ -38,11 +38,8 @@ class TDTestCase:
|
|||
if data_tb_col[i] is None:
|
||||
tdSql.checkData( i, 0 , None )
|
||||
if col_name not in ["c2", "double"] or tbname != f"{self.dbname}.t1" or i != 10:
|
||||
utc_zone = datetime.timezone.utc
|
||||
utc_8 = datetime.timezone(datetime.timedelta(hours=8))
|
||||
date_init_stamp = datetime.datetime.utcfromtimestamp(data_tb_col[i]/1000)
|
||||
date_data = date_init_stamp.replace(tzinfo=utc_zone).astimezone(utc_8).strftime("%Y-%m-%d %H:%M:%S.%f")
|
||||
tdSql.checkData( i, 0, date_data)
|
||||
date_init_stamp = datetime.datetime.fromtimestamp(data_tb_col[i]/1000)
|
||||
tdSql.checkData( i, 0, date_init_stamp)
|
||||
|
||||
def __range_to_timestamp(self, cols, tables):
|
||||
for col in cols:
|
||||
|
@ -60,7 +57,7 @@ class TDTestCase:
|
|||
self.__range_to_timestamp(cols=__col_list, tables=__table_list)
|
||||
|
||||
def all_test(self):
|
||||
|
||||
_datetime_epoch = datetime.datetime.fromtimestamp(0)
|
||||
tdSql.query(f"select c1 from {self.dbname}.ct4")
|
||||
data_ct4_c1 = [tdSql.getData(i,0) for i in range(tdSql.queryRows)]
|
||||
tdSql.query(f"select c1 from {self.dbname}.t1")
|
||||
|
@ -99,22 +96,16 @@ class TDTestCase:
|
|||
if data_ct4_c1[i] is None:
|
||||
tdSql.checkData( i, 0 , None )
|
||||
else:
|
||||
utc_zone = datetime.timezone.utc
|
||||
utc_8 = datetime.timezone(datetime.timedelta(hours=8))
|
||||
date_init_stamp = datetime.datetime.utcfromtimestamp(data_ct4_c1[i]/1000)
|
||||
date_data = date_init_stamp.replace(tzinfo=utc_zone).astimezone(utc_8).strftime("%Y-%m-%d %H:%M:%S.%f")
|
||||
tdSql.checkData( i, 0, date_data)
|
||||
date_init_stamp = _datetime_epoch+datetime.timedelta(seconds=int(data_ct4_c1[i]) / 1000.0)
|
||||
tdSql.checkData( i, 0, date_init_stamp)
|
||||
|
||||
tdSql.query(f"select cast(c1 as timestamp) as b from {self.dbname}.t1")
|
||||
for i in range(len(data_t1_c1)):
|
||||
if data_t1_c1[i] is None:
|
||||
tdSql.checkData( i, 0 , None )
|
||||
else:
|
||||
utc_zone = datetime.timezone.utc
|
||||
utc_8 = datetime.timezone(datetime.timedelta(hours=8))
|
||||
date_init_stamp = datetime.datetime.utcfromtimestamp(data_t1_c1[i]/1000)
|
||||
date_data = date_init_stamp.replace(tzinfo=utc_zone).astimezone(utc_8).strftime("%Y-%m-%d %H:%M:%S.%f")
|
||||
tdSql.checkData( i, 0, date_data)
|
||||
date_init_stamp = _datetime_epoch+datetime.timedelta(seconds=int(data_t1_c1[i]) / 1000.0)
|
||||
tdSql.checkData( i, 0, date_init_stamp)
|
||||
|
||||
|
||||
tdLog.printNoPrefix("==========step8: cast bigint to bigint, expect no changes")
|
||||
|
@ -156,11 +147,8 @@ class TDTestCase:
|
|||
if data_ct4_c2[i] is None:
|
||||
tdSql.checkData( i, 0 , None )
|
||||
else:
|
||||
utc_zone = datetime.timezone.utc
|
||||
utc_8 = datetime.timezone(datetime.timedelta(hours=8))
|
||||
date_init_stamp = datetime.datetime.utcfromtimestamp(data_ct4_c2[i]/1000)
|
||||
date_data = date_init_stamp.replace(tzinfo=utc_zone).astimezone(utc_8).strftime("%Y-%m-%d %H:%M:%S.%f")
|
||||
tdSql.checkData( i, 0, date_data)
|
||||
date_init_stamp = _datetime_epoch+datetime.timedelta(seconds=int(data_ct4_c2[i]) / 1000.0)
|
||||
tdSql.checkData( i, 0, date_init_stamp)
|
||||
|
||||
|
||||
tdSql.query(f"select cast(c2 as timestamp) as b from {self.dbname}.t1")
|
||||
|
@ -170,11 +158,8 @@ class TDTestCase:
|
|||
elif i == 10:
|
||||
continue
|
||||
else:
|
||||
utc_zone = datetime.timezone.utc
|
||||
utc_8 = datetime.timezone(datetime.timedelta(hours=8))
|
||||
date_init_stamp = datetime.datetime.utcfromtimestamp(data_t1_c2[i]/1000)
|
||||
date_data = date_init_stamp.replace(tzinfo=utc_zone).astimezone(utc_8).strftime("%Y-%m-%d %H:%M:%S.%f")
|
||||
tdSql.checkData( i, 0, date_data)
|
||||
date_init_stamp = _datetime_epoch+datetime.timedelta(seconds=int(data_t1_c2[i]) / 1000.0)
|
||||
tdSql.checkData( i, 0, date_init_stamp)
|
||||
|
||||
|
||||
tdLog.printNoPrefix("==========step12: cast smallint to bigint, expect no changes")
|
||||
|
@ -216,22 +201,16 @@ class TDTestCase:
|
|||
if data_ct4_c3[i] is None:
|
||||
tdSql.checkData( i, 0 , None )
|
||||
else:
|
||||
utc_zone = datetime.timezone.utc
|
||||
utc_8 = datetime.timezone(datetime.timedelta(hours=8))
|
||||
date_init_stamp = datetime.datetime.utcfromtimestamp(data_ct4_c3[i]/1000)
|
||||
date_data = date_init_stamp.replace(tzinfo=utc_zone).astimezone(utc_8).strftime("%Y-%m-%d %H:%M:%S.%f")
|
||||
tdSql.checkData( i, 0, date_data)
|
||||
date_init_stamp = _datetime_epoch+datetime.timedelta(seconds=int(data_ct4_c3[i]) / 1000.0)
|
||||
tdSql.checkData( i, 0, date_init_stamp)
|
||||
|
||||
tdSql.query(f"select cast(c3 as timestamp) as b from {self.dbname}.t1")
|
||||
for i in range(len(data_t1_c3)):
|
||||
if data_t1_c3[i] is None:
|
||||
tdSql.checkData( i, 0 , None )
|
||||
else:
|
||||
utc_zone = datetime.timezone.utc
|
||||
utc_8 = datetime.timezone(datetime.timedelta(hours=8))
|
||||
date_init_stamp = datetime.datetime.utcfromtimestamp(data_t1_c3[i]/1000)
|
||||
date_data = date_init_stamp.replace(tzinfo=utc_zone).astimezone(utc_8).strftime("%Y-%m-%d %H:%M:%S.%f")
|
||||
tdSql.checkData( i, 0, date_data)
|
||||
date_init_stamp = _datetime_epoch+datetime.timedelta(seconds=int(data_t1_c3[i]) / 1000.0)
|
||||
tdSql.checkData( i, 0, date_init_stamp)
|
||||
|
||||
|
||||
tdLog.printNoPrefix("==========step16: cast tinyint to bigint, expect no changes")
|
||||
|
@ -273,22 +252,16 @@ class TDTestCase:
|
|||
if data_ct4_c4[i] is None:
|
||||
tdSql.checkData( i, 0 , None )
|
||||
else:
|
||||
utc_zone = datetime.timezone.utc
|
||||
utc_8 = datetime.timezone(datetime.timedelta(hours=8))
|
||||
date_init_stamp = datetime.datetime.utcfromtimestamp(data_ct4_c4[i]/1000)
|
||||
date_data = date_init_stamp.replace(tzinfo=utc_zone).astimezone(utc_8).strftime("%Y-%m-%d %H:%M:%S.%f")
|
||||
tdSql.checkData( i, 0, date_data)
|
||||
date_init_stamp = _datetime_epoch+datetime.timedelta(seconds=int(data_ct4_c4[i]) / 1000.0)
|
||||
tdSql.checkData( i, 0, date_init_stamp)
|
||||
|
||||
tdSql.query(f"select cast(c4 as timestamp) as b from {self.dbname}.t1")
|
||||
for i in range(len(data_t1_c4)):
|
||||
if data_t1_c4[i] is None:
|
||||
tdSql.checkData( i, 0 , None )
|
||||
else:
|
||||
utc_zone = datetime.timezone.utc
|
||||
utc_8 = datetime.timezone(datetime.timedelta(hours=8))
|
||||
date_init_stamp = datetime.datetime.utcfromtimestamp(data_t1_c4[i]/1000)
|
||||
date_data = date_init_stamp.replace(tzinfo=utc_zone).astimezone(utc_8).strftime("%Y-%m-%d %H:%M:%S.%f")
|
||||
tdSql.checkData( i, 0, date_data)
|
||||
date_init_stamp = _datetime_epoch+datetime.timedelta(seconds=int(data_t1_c4[i]) / 1000.0)
|
||||
tdSql.checkData( i, 0, date_init_stamp)
|
||||
|
||||
|
||||
tdLog.printNoPrefix("==========step20: cast float to bigint, expect no changes")
|
||||
|
@ -326,21 +299,15 @@ class TDTestCase:
|
|||
if data_ct4_c5[i] is None:
|
||||
tdSql.checkData( i, 0 , None )
|
||||
else:
|
||||
utc_zone = datetime.timezone.utc
|
||||
utc_8 = datetime.timezone(datetime.timedelta(hours=8))
|
||||
date_init_stamp = datetime.datetime.utcfromtimestamp(int(data_ct4_c5[i])/1000)
|
||||
date_data = date_init_stamp.replace(tzinfo=utc_zone).astimezone(utc_8).strftime("%Y-%m-%d %H:%M:%S.%f")
|
||||
tdSql.checkData( i, 0, date_data)
|
||||
date_init_stamp = _datetime_epoch+datetime.timedelta(seconds=int(data_ct4_c5[i]) / 1000.0)
|
||||
tdSql.checkData( i, 0, date_init_stamp)
|
||||
tdSql.query(f"select cast(c5 as timestamp) as b from {self.dbname}.t1")
|
||||
for i in range(len(data_t1_c5)):
|
||||
if data_t1_c5[i] is None:
|
||||
tdSql.checkData( i, 0 , None )
|
||||
else:
|
||||
utc_zone = datetime.timezone.utc
|
||||
utc_8 = datetime.timezone(datetime.timedelta(hours=8))
|
||||
date_init_stamp = datetime.datetime.utcfromtimestamp(int(data_t1_c5[i])/1000)
|
||||
date_data = date_init_stamp.replace(tzinfo=utc_zone).astimezone(utc_8).strftime("%Y-%m-%d %H:%M:%S.%f")
|
||||
tdSql.checkData( i, 0, date_data)
|
||||
date_init_stamp = _datetime_epoch+datetime.timedelta(seconds=int(data_t1_c5[i]) / 1000.0)
|
||||
tdSql.checkData( i, 0, date_init_stamp)
|
||||
|
||||
tdLog.printNoPrefix("==========step24: cast double to bigint, expect no changes")
|
||||
tdSql.query(f"select c6 from {self.dbname}.ct4")
|
||||
|
@ -382,11 +349,8 @@ class TDTestCase:
|
|||
if data_ct4_c6[i] is None:
|
||||
tdSql.checkData( i, 0 , None )
|
||||
else:
|
||||
utc_zone = datetime.timezone.utc
|
||||
utc_8 = datetime.timezone(datetime.timedelta(hours=8))
|
||||
date_init_stamp = datetime.datetime.utcfromtimestamp(int(data_ct4_c6[i])/1000)
|
||||
date_data = date_init_stamp.replace(tzinfo=utc_zone).astimezone(utc_8).strftime("%Y-%m-%d %H:%M:%S.%f")
|
||||
tdSql.checkData( i, 0, date_data)
|
||||
date_init_stamp = _datetime_epoch+datetime.timedelta(seconds=int(data_ct4_c6[i]) / 1000.0)
|
||||
tdSql.checkData( i, 0, date_init_stamp)
|
||||
|
||||
tdSql.query(f"select cast(c6 as timestamp) as b from {self.dbname}.t1")
|
||||
for i in range(len(data_t1_c6)):
|
||||
|
@ -395,11 +359,8 @@ class TDTestCase:
|
|||
elif i == 10:
|
||||
continue
|
||||
else:
|
||||
utc_zone = datetime.timezone.utc
|
||||
utc_8 = datetime.timezone(datetime.timedelta(hours=8))
|
||||
date_init_stamp = datetime.datetime.utcfromtimestamp(int(data_t1_c6[i])/1000)
|
||||
date_data = date_init_stamp.replace(tzinfo=utc_zone).astimezone(utc_8).strftime("%Y-%m-%d %H:%M:%S.%f")
|
||||
tdSql.checkData( i, 0, date_data)
|
||||
date_init_stamp = _datetime_epoch+datetime.timedelta(seconds=int(data_t1_c6[i]) / 1000.0)
|
||||
tdSql.checkData( i, 0, date_init_stamp)
|
||||
|
||||
tdLog.printNoPrefix("==========step28: cast bool to bigint, expect no changes")
|
||||
tdSql.query(f"select c7 from {self.dbname}.ct4")
|
||||
|
@ -436,21 +397,15 @@ class TDTestCase:
|
|||
if data_ct4_c7[i] is None:
|
||||
tdSql.checkData( i, 0 , None )
|
||||
else:
|
||||
utc_zone = datetime.timezone.utc
|
||||
utc_8 = datetime.timezone(datetime.timedelta(hours=8))
|
||||
date_init_stamp = datetime.datetime.utcfromtimestamp(int(data_ct4_c7[i])/1000)
|
||||
date_data = date_init_stamp.replace(tzinfo=utc_zone).astimezone(utc_8).strftime("%Y-%m-%d %H:%M:%S.%f")
|
||||
tdSql.checkData( i, 0, date_data)
|
||||
date_init_stamp = _datetime_epoch+datetime.timedelta(seconds=int(data_ct4_c7[i]) / 1000.0)
|
||||
tdSql.checkData( i, 0, date_init_stamp)
|
||||
tdSql.query(f"select cast(c7 as timestamp) as b from {self.dbname}.t1")
|
||||
for i in range(len(data_t1_c7)):
|
||||
if data_t1_c7[i] is None:
|
||||
tdSql.checkData( i, 0 , None )
|
||||
else:
|
||||
utc_zone = datetime.timezone.utc
|
||||
utc_8 = datetime.timezone(datetime.timedelta(hours=8))
|
||||
date_init_stamp = datetime.datetime.utcfromtimestamp(int(data_t1_c7[i])/1000)
|
||||
date_data = date_init_stamp.replace(tzinfo=utc_zone).astimezone(utc_8).strftime("%Y-%m-%d %H:%M:%S.%f")
|
||||
tdSql.checkData( i, 0, date_data)
|
||||
date_init_stamp = _datetime_epoch+datetime.timedelta(seconds=int(data_t1_c7[i]) / 1000.0)
|
||||
tdSql.checkData( i, 0, date_init_stamp)
|
||||
|
||||
|
||||
tdSql.query(f"select c8 from {self.dbname}.ct4")
|
||||
|
|
|
@ -57,7 +57,7 @@ class TDTestCase:
|
|||
return cur
|
||||
|
||||
def create_tables(self,tsql, dbName,vgroups,stbName,ctbNum,rowsPerTbl):
|
||||
tsql.execute("create database if not exists %s vgroups %d"%(dbName, vgroups))
|
||||
tsql.execute("create database if not exists %s vgroups %d wal_retention_period 3600"%(dbName, vgroups))
|
||||
tsql.execute("use %s" %dbName)
|
||||
tsql.execute("create table if not exists %s (ts timestamp, c1 bigint, c2 binary(16)) tags(t1 int)"%stbName)
|
||||
pre_create = "create table"
|
||||
|
@ -149,6 +149,7 @@ class TDTestCase:
|
|||
topicFromStb = 'topic_stb_column'
|
||||
topicFromCtb = 'topic_ctb_column'
|
||||
|
||||
tdSql.execute("alter database %s wal_retention_period 3600" % (parameterDict['dbName']))
|
||||
tdSql.execute("create topic %s as select ts, c1, c2 from %s.%s" %(topicFromStb, parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.execute("create topic %s as select ts, c1, c2 from %s.%s_0" %(topicFromCtb, parameterDict['dbName'], parameterDict['stbName']))
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ class TDTestCase:
|
|||
def wrong_topic(self):
|
||||
tdSql.prepare()
|
||||
tdSql.execute('use db')
|
||||
tdSql.execute('alter database db wal_retention_period 3600')
|
||||
stbname = f'db.{tdCom.getLongName(5, "letters")}'
|
||||
tag_dict = {
|
||||
't0':'int'
|
||||
|
|
|
@ -67,6 +67,7 @@ class TDTestCase:
|
|||
|
||||
tdLog.info("flush db to let data falls into the disk")
|
||||
tdSql.query("flush database %s"%(paraDict['dbName']))
|
||||
tdSql.execute("alter database %s wal_retention_period 3600"%(paraDict['dbName']))
|
||||
return
|
||||
|
||||
def tmqCase1(self):
|
||||
|
|
|
@ -67,6 +67,7 @@ class TDTestCase:
|
|||
|
||||
tdLog.info("flush db to let data falls into the disk")
|
||||
tdSql.query("flush database %s"%(paraDict['dbName']))
|
||||
tdSql.execute("alter database %s wal_retention_period 3600"%(paraDict['dbName']))
|
||||
return
|
||||
|
||||
def tmqCase1(self):
|
||||
|
|
|
@ -60,7 +60,7 @@ class TDTestCase:
|
|||
def initConsumerTable(self,cdbName='cdb'):
|
||||
tdLog.info("create consume database, and consume info table, and consume result table")
|
||||
tdSql.query("drop database if exists %s "%(cdbName))
|
||||
tdSql.query("create database %s vgroups 1"%(cdbName))
|
||||
tdSql.query("create database %s vgroups 1 wal_retention_period 3600"%(cdbName))
|
||||
tdSql.query("drop table if exists %s.consumeinfo "%(cdbName))
|
||||
tdSql.query("drop table if exists %s.consumeresult "%(cdbName))
|
||||
|
||||
|
|
|
@ -134,6 +134,7 @@ class TDTestCase:
|
|||
paraDict['ctbNum'] = self.ctbNum
|
||||
paraDict['rowsPerTbl'] = self.rowsPerTbl
|
||||
|
||||
tdSql.execute("alter database dbt wal_retention_period 3600")
|
||||
tdLog.info("create topics from stb1")
|
||||
topicFromStb1 = 'topic_stb1'
|
||||
queryString = "select ts, c1, c2 from %s.%s where t4 == 'beijing' or t4 == 'changsha' "%(paraDict['dbName'], paraDict['stbName'])
|
||||
|
|
|
@ -60,7 +60,7 @@ class TDTestCase:
|
|||
def initConsumerTable(self,cdbName='cdb'):
|
||||
tdLog.info("create consume database, and consume info table, and consume result table")
|
||||
tdSql.query("drop database if exists %s "%(cdbName))
|
||||
tdSql.query("create database %s vgroups 1"%(cdbName))
|
||||
tdSql.query("create database %s vgroups 1 wal_retention_period 3600"%(cdbName))
|
||||
tdSql.query("drop table if exists %s.consumeinfo "%(cdbName))
|
||||
tdSql.query("drop table if exists %s.consumeresult "%(cdbName))
|
||||
|
||||
|
@ -115,7 +115,7 @@ class TDTestCase:
|
|||
if dropFlag == 1:
|
||||
tsql.execute("drop database if exists %s"%(dbName))
|
||||
|
||||
tsql.execute("create database if not exists %s vgroups %d replica %d"%(dbName, vgroups, replica))
|
||||
tsql.execute("create database if not exists %s vgroups %d replica %d wal_retention_period 3600"%(dbName, vgroups, replica))
|
||||
tdLog.debug("complete to create database %s"%(dbName))
|
||||
return
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ class TDTestCase:
|
|||
|
||||
tmqCom.initConsumerTable()
|
||||
tmqCom.create_database(tsql=tdSql, dbName=paraDict["dbName"],dropFlag=paraDict["dropFlag"], vgroups=paraDict['vgroups'],replica=paraDict['replica'])
|
||||
tdSql.execute("alter database %s wal_retention_period 3600"%(paraDict["dbName"]))
|
||||
tdLog.info("create stb")
|
||||
tmqCom.create_stable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"])
|
||||
tdLog.info("create ctb")
|
||||
|
|
|
@ -106,6 +106,7 @@ class TDTestCase:
|
|||
# ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"],
|
||||
# startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx'])
|
||||
|
||||
tdSql.execute("alter database dbt wal_retention_period 3600")
|
||||
tdLog.info("create topics from stb1")
|
||||
topicFromStb1 = 'topic_UpperCase_stb1'
|
||||
# queryString = "select ts, c1, c2 from %s.%s where t4 == 'shanghai' or t4 == 'changsha'"%(paraDict['dbName'], paraDict['stbName'])
|
||||
|
|
|
@ -54,6 +54,7 @@ class TDTestCase:
|
|||
|
||||
tmqCom.initConsumerTable()
|
||||
tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=paraDict["vgroups"],replica=1)
|
||||
tdSql.execute("alter database %s wal_retention_period 3600" %(paraDict['dbName']))
|
||||
tdLog.info("create stb")
|
||||
tmqCom.create_stable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"])
|
||||
tdLog.info("create ctb")
|
||||
|
|
|
@ -52,7 +52,7 @@ class TDTestCase:
|
|||
|
||||
def initConsumerTable(self,cdbName='cdb'):
|
||||
tdLog.info("create consume database, and consume info table, and consume result table")
|
||||
tdSql.query("create database if not exists %s vgroups 1"%(cdbName))
|
||||
tdSql.query("create database if not exists %s vgroups 1 wal_retention_period 3600"%(cdbName))
|
||||
tdSql.query("drop table if exists %s.consumeinfo "%(cdbName))
|
||||
tdSql.query("drop table if exists %s.consumeresult "%(cdbName))
|
||||
|
||||
|
@ -99,7 +99,7 @@ class TDTestCase:
|
|||
os.system(shellCmd)
|
||||
|
||||
def create_tables(self,tsql, dbName,vgroups,stbName,ctbNum):
|
||||
tsql.execute("create database if not exists %s vgroups %d"%(dbName, vgroups))
|
||||
tsql.execute("create database if not exists %s vgroups %d wal_retention_period 3600"%(dbName, vgroups))
|
||||
tsql.execute("use %s" %dbName)
|
||||
tsql.execute("create table if not exists %s (ts timestamp, c1 bigint, c2 binary(16)) tags(t1 int)"%stbName)
|
||||
pre_create = "create table"
|
||||
|
@ -180,7 +180,7 @@ class TDTestCase:
|
|||
|
||||
self.initConsumerTable()
|
||||
|
||||
tdSql.execute("create database if not exists %s vgroups %d replica %d" %(parameterDict['dbName'], parameterDict['vgroups'], parameterDict['replica']))
|
||||
tdSql.execute("create database if not exists %s vgroups %d replica %d wal_retention_period 3600" %(parameterDict['dbName'], parameterDict['vgroups'], parameterDict['replica']))
|
||||
|
||||
prepareEnvThread = threading.Thread(target=self.prepareEnv, kwargs=parameterDict)
|
||||
prepareEnvThread.start()
|
||||
|
@ -278,7 +278,7 @@ class TDTestCase:
|
|||
|
||||
self.initConsumerTable()
|
||||
|
||||
tdSql.execute("create database if not exists %s vgroups %d replica %d" %(parameterDict['dbName'], parameterDict['vgroups'], parameterDict['replica']))
|
||||
tdSql.execute("create database if not exists %s vgroups %d replica %d wal_retention_period 3600" %(parameterDict['dbName'], parameterDict['vgroups'], parameterDict['replica']))
|
||||
|
||||
prepareEnvThread = threading.Thread(target=self.prepareEnv, kwargs=parameterDict)
|
||||
prepareEnvThread.start()
|
||||
|
@ -345,7 +345,7 @@ class TDTestCase:
|
|||
|
||||
self.initConsumerTable()
|
||||
|
||||
tdSql.execute("create database if not exists %s vgroups %d" %(parameterDict['dbName'], parameterDict['vgroups']))
|
||||
tdSql.execute("create database if not exists %s vgroups %d wal_retention_period 3600" %(parameterDict['dbName'], parameterDict['vgroups']))
|
||||
tdSql.execute("create table if not exists %s.%s (ts timestamp, c1 bigint, c2 binary(16)) tags(t1 int)"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
|
||||
tdLog.info("create topics from db")
|
||||
|
@ -415,7 +415,7 @@ class TDTestCase:
|
|||
|
||||
self.initConsumerTable()
|
||||
|
||||
tdSql.execute("create database if not exists %s vgroups %d replica %d" %(parameterDict['dbName'], parameterDict['vgroups'], parameterDict['replica']))
|
||||
tdSql.execute("create database if not exists %s vgroups %d replica %d wal_retention_period 3600" %(parameterDict['dbName'], parameterDict['vgroups'], parameterDict['replica']))
|
||||
|
||||
prepareEnvThread = threading.Thread(target=self.prepareEnv, kwargs=parameterDict)
|
||||
prepareEnvThread.start()
|
||||
|
|
|
@ -52,7 +52,7 @@ class TDTestCase:
|
|||
|
||||
def initConsumerTable(self,cdbName='cdb'):
|
||||
tdLog.info("create consume database, and consume info table, and consume result table")
|
||||
tdSql.query("create database if not exists %s vgroups 1"%(cdbName))
|
||||
tdSql.query("create database if not exists %s vgroups 1 wal_retention_period 3600"%(cdbName))
|
||||
tdSql.query("drop table if exists %s.consumeinfo "%(cdbName))
|
||||
tdSql.query("drop table if exists %s.consumeresult "%(cdbName))
|
||||
|
||||
|
@ -99,7 +99,7 @@ class TDTestCase:
|
|||
os.system(shellCmd)
|
||||
|
||||
def create_tables(self,tsql, dbName,vgroups,stbName,ctbNum):
|
||||
tsql.execute("create database if not exists %s vgroups %d"%(dbName, vgroups))
|
||||
tsql.execute("create database if not exists %s vgroups %d wal_retention_period 3600"%(dbName, vgroups))
|
||||
tsql.execute("use %s" %dbName)
|
||||
tsql.execute("create table if not exists %s (ts timestamp, c1 bigint, c2 binary(16)) tags(t1 int)"%stbName)
|
||||
pre_create = "create table"
|
||||
|
@ -180,7 +180,7 @@ class TDTestCase:
|
|||
|
||||
self.initConsumerTable()
|
||||
|
||||
tdSql.execute("create database if not exists %s vgroups %d replica %d" %(parameterDict['dbName'], parameterDict['vgroups'], parameterDict['replica']))
|
||||
tdSql.execute("create database if not exists %s vgroups %d replica %d wal_retention_period 3600" %(parameterDict['dbName'], parameterDict['vgroups'], parameterDict['replica']))
|
||||
|
||||
prepareEnvThread = threading.Thread(target=self.prepareEnv, kwargs=parameterDict)
|
||||
prepareEnvThread.start()
|
||||
|
@ -262,7 +262,7 @@ class TDTestCase:
|
|||
|
||||
self.initConsumerTable()
|
||||
|
||||
tdSql.execute("create database if not exists %s vgroups %d replica %d" %(parameterDict['dbName'], parameterDict['vgroups'], parameterDict['replica']))
|
||||
tdSql.execute("create database if not exists %s vgroups %d replica %d wal_retention_period 3600" %(parameterDict['dbName'], parameterDict['vgroups'], parameterDict['replica']))
|
||||
|
||||
prepareEnvThread = threading.Thread(target=self.prepareEnv, kwargs=parameterDict)
|
||||
prepareEnvThread.start()
|
||||
|
|
|
@ -52,7 +52,7 @@ class TDTestCase:
|
|||
|
||||
def initConsumerTable(self,cdbName='cdb'):
|
||||
tdLog.info("create consume database, and consume info table, and consume result table")
|
||||
tdSql.query("create database if not exists %s vgroups 1"%(cdbName))
|
||||
tdSql.query("create database if not exists %s vgroups 1 wal_retention_period 3600"%(cdbName))
|
||||
tdSql.query("drop table if exists %s.consumeinfo "%(cdbName))
|
||||
tdSql.query("drop table if exists %s.consumeresult "%(cdbName))
|
||||
|
||||
|
@ -99,7 +99,7 @@ class TDTestCase:
|
|||
os.system(shellCmd)
|
||||
|
||||
def create_tables(self,tsql, dbName,vgroups,stbName,ctbNum):
|
||||
tsql.execute("create database if not exists %s vgroups %d"%(dbName, vgroups))
|
||||
tsql.execute("create database if not exists %s vgroups %d wal_retention_period 3600"%(dbName, vgroups))
|
||||
tsql.execute("use %s" %dbName)
|
||||
tsql.execute("create table if not exists %s (ts timestamp, c1 bigint, c2 binary(16)) tags(t1 int)"%stbName)
|
||||
pre_create = "create table"
|
||||
|
@ -180,8 +180,8 @@ class TDTestCase:
|
|||
parameterDict['cfg'] = cfgPath
|
||||
|
||||
self.initConsumerTable()
|
||||
tdLog.info("create database if not exists %s vgroups %d replica %d" %(parameterDict['dbName'], parameterDict['vgroups'], parameterDict['replica']))
|
||||
tdSql.execute("create database if not exists %s vgroups %d replica %d" %(parameterDict['dbName'], parameterDict['vgroups'], parameterDict['replica']))
|
||||
tdLog.info("create database if not exists %s vgroups %d replica %d wal_retention_period 3600" %(parameterDict['dbName'], parameterDict['vgroups'], parameterDict['replica']))
|
||||
tdSql.execute("create database if not exists %s vgroups %d replica %d wal_retention_period 3600" %(parameterDict['dbName'], parameterDict['vgroups'], parameterDict['replica']))
|
||||
|
||||
prepareEnvThread = threading.Thread(target=self.prepareEnv, kwargs=parameterDict)
|
||||
prepareEnvThread.start()
|
||||
|
@ -197,7 +197,7 @@ class TDTestCase:
|
|||
'startTs': 1640966400000} # 2022-01-01 00:00:00.000
|
||||
parameterDict['cfg'] = cfgPath
|
||||
|
||||
tdSql.execute("create database if not exists %s vgroups %d replica %d" %(parameterDict2['dbName'], parameterDict2['vgroups'], parameterDict2['replica']))
|
||||
tdSql.execute("create database if not exists %s vgroups %d replica %d wal_retention_period 3600" %(parameterDict2['dbName'], parameterDict2['vgroups'], parameterDict2['replica']))
|
||||
|
||||
prepareEnvThread2 = threading.Thread(target=self.prepareEnv, kwargs=parameterDict2)
|
||||
prepareEnvThread2.start()
|
||||
|
@ -268,7 +268,7 @@ class TDTestCase:
|
|||
|
||||
self.initConsumerTable()
|
||||
|
||||
tdSql.execute("create database if not exists %s vgroups %d replica %d" %(parameterDict['dbName'], parameterDict['vgroups'], parameterDict['replica']))
|
||||
tdSql.execute("create database if not exists %s vgroups %d replica %d wal_retention_period 3600" %(parameterDict['dbName'], parameterDict['vgroups'], parameterDict['replica']))
|
||||
|
||||
prepareEnvThread = threading.Thread(target=self.prepareEnv, kwargs=parameterDict)
|
||||
prepareEnvThread.start()
|
||||
|
@ -284,7 +284,7 @@ class TDTestCase:
|
|||
'startTs': 1640966400000} # 2022-01-01 00:00:00.000
|
||||
parameterDict['cfg'] = cfgPath
|
||||
|
||||
tdSql.execute("create database if not exists %s vgroups %d replica %d" %(parameterDict2['dbName'], parameterDict2['vgroups'], parameterDict2['replica']))
|
||||
tdSql.execute("create database if not exists %s vgroups %d replica %d wal_retention_period 3600" %(parameterDict2['dbName'], parameterDict2['vgroups'], parameterDict2['replica']))
|
||||
|
||||
prepareEnvThread2 = threading.Thread(target=self.prepareEnv, kwargs=parameterDict2)
|
||||
prepareEnvThread2.start()
|
||||
|
|
|
@ -53,7 +53,7 @@ class TDTestCase:
|
|||
|
||||
def initConsumerTable(self,cdbName='cdb'):
|
||||
tdLog.info("create consume database, and consume info table, and consume result table")
|
||||
tdSql.query("create database if not exists %s vgroups 1"%(cdbName))
|
||||
tdSql.query("create database if not exists %s vgroups 1 wal_retention_period 3600"%(cdbName))
|
||||
tdSql.query("drop table if exists %s.consumeinfo "%(cdbName))
|
||||
tdSql.query("drop table if exists %s.consumeresult "%(cdbName))
|
||||
|
||||
|
@ -100,7 +100,7 @@ class TDTestCase:
|
|||
os.system(shellCmd)
|
||||
|
||||
def create_tables(self,tsql, dbName,vgroups,stbName,ctbNum,rowsPerTbl):
|
||||
tsql.execute("create database if not exists %s vgroups %d"%(dbName, vgroups))
|
||||
tsql.execute("create database if not exists %s vgroups %d wal_retention_period 3600"%(dbName, vgroups))
|
||||
tsql.execute("use %s" %dbName)
|
||||
tsql.execute("create table if not exists %s (ts timestamp, c1 bigint, c2 binary(16)) tags(t1 int)"%stbName)
|
||||
pre_create = "create table"
|
||||
|
@ -185,7 +185,7 @@ class TDTestCase:
|
|||
|
||||
self.initConsumerTable()
|
||||
|
||||
tdSql.execute("create database if not exists %s vgroups %d" %(parameterDict['dbName'], parameterDict['vgroups']))
|
||||
tdSql.execute("create database if not exists %s vgroups %d wal_retention_period 3600" %(parameterDict['dbName'], parameterDict['vgroups']))
|
||||
|
||||
prepareEnvThread = threading.Thread(target=self.prepareEnv, kwargs=parameterDict)
|
||||
prepareEnvThread.start()
|
||||
|
@ -263,7 +263,7 @@ class TDTestCase:
|
|||
|
||||
self.initConsumerTable()
|
||||
|
||||
tdSql.execute("create database if not exists %s vgroups %d" %(parameterDict['dbName'], parameterDict['vgroups']))
|
||||
tdSql.execute("create database if not exists %s vgroups %d wal_retention_period 3600" %(parameterDict['dbName'], parameterDict['vgroups']))
|
||||
|
||||
prepareEnvThread = threading.Thread(target=self.prepareEnv, kwargs=parameterDict)
|
||||
prepareEnvThread.start()
|
||||
|
|
|
@ -52,7 +52,7 @@ class TDTestCase:
|
|||
|
||||
def initConsumerTable(self,cdbName='cdb'):
|
||||
tdLog.info("create consume database, and consume info table, and consume result table")
|
||||
tdSql.query("create database if not exists %s vgroups 1"%(cdbName))
|
||||
tdSql.query("create database if not exists %s vgroups 1 wal_retention_period 3600"%(cdbName))
|
||||
tdSql.query("drop table if exists %s.consumeinfo "%(cdbName))
|
||||
tdSql.query("drop table if exists %s.consumeresult "%(cdbName))
|
||||
tdSql.query("drop table if exists %s.notifyinfo "%(cdbName))
|
||||
|
@ -122,7 +122,7 @@ class TDTestCase:
|
|||
os.system(shellCmd)
|
||||
|
||||
def create_tables(self,tsql, dbName,vgroups,stbName,ctbNum,rowsPerTbl):
|
||||
tsql.execute("create database if not exists %s vgroups %d"%(dbName, vgroups))
|
||||
tsql.execute("create database if not exists %s vgroups %d wal_retention_period 3600"%(dbName, vgroups))
|
||||
tsql.execute("use %s" %dbName)
|
||||
tsql.execute("create table if not exists %s (ts timestamp, c1 bigint, c2 binary(16)) tags(t1 int)"%stbName)
|
||||
pre_create = "create table"
|
||||
|
@ -203,7 +203,7 @@ class TDTestCase:
|
|||
|
||||
self.initConsumerTable()
|
||||
|
||||
tdSql.execute("create database if not exists %s vgroups %d" %(parameterDict['dbName'], parameterDict['vgroups']))
|
||||
tdSql.execute("create database if not exists %s vgroups %d wal_retention_period 3600" %(parameterDict['dbName'], parameterDict['vgroups']))
|
||||
|
||||
prepareEnvThread = threading.Thread(target=self.prepareEnv, kwargs=parameterDict)
|
||||
prepareEnvThread.start()
|
||||
|
@ -280,7 +280,7 @@ class TDTestCase:
|
|||
|
||||
self.initConsumerTable()
|
||||
|
||||
tdSql.execute("create database if not exists %s vgroups %d" %(parameterDict['dbName'], parameterDict['vgroups']))
|
||||
tdSql.execute("create database if not exists %s vgroups %d wal_retention_period 3600" %(parameterDict['dbName'], parameterDict['vgroups']))
|
||||
|
||||
prepareEnvThread = threading.Thread(target=self.prepareEnv, kwargs=parameterDict)
|
||||
prepareEnvThread.start()
|
||||
|
|
|
@ -65,6 +65,7 @@ class TDTestCase:
|
|||
tmqCom.initConsumerTable(self.cdbName)
|
||||
|
||||
tdCom.create_database(tdSql,self.paraDict["dbName"],self.paraDict["dropFlag"])
|
||||
tdSql.execute("alter database %s wal_retention_period 3600" % (self.paraDict['dbName']))
|
||||
|
||||
self.paraDict["stbName"] = 'stb1'
|
||||
tdCom.create_stable(tdSql,dbname=self.paraDict["dbName"],stbname=self.paraDict["stbName"],column_elm_list=self.paraDict["colSchema"],tag_elm_list=self.paraDict["tagSchema"],count=1, default_stbname_prefix=self.paraDict["stbName"])
|
||||
|
|
|
@ -59,7 +59,7 @@ class TDTestCase:
|
|||
|
||||
def initConsumerTable(self,cdbName='cdb'):
|
||||
tdLog.info("create consume database, and consume info table, and consume result table")
|
||||
tdSql.query("create database if not exists %s vgroups 1"%(cdbName))
|
||||
tdSql.query("create database if not exists %s vgroups 1 wal_retention_period 3600"%(cdbName))
|
||||
tdSql.query("drop table if exists %s.consumeinfo "%(cdbName))
|
||||
tdSql.query("drop table if exists %s.consumeresult "%(cdbName))
|
||||
|
||||
|
@ -114,7 +114,7 @@ class TDTestCase:
|
|||
if dropFlag == 1:
|
||||
tsql.execute("drop database if exists %s"%(dbName))
|
||||
|
||||
tsql.execute("create database if not exists %s vgroups %d replica %d"%(dbName, vgroups, replica))
|
||||
tsql.execute("create database if not exists %s vgroups %d replica %d wal_retention_period 3600"%(dbName, vgroups, replica))
|
||||
tdLog.debug("complete to create database %s"%(dbName))
|
||||
return
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ class TDTestCase:
|
|||
|
||||
def initConsumerTable(self,cdbName='cdb'):
|
||||
tdLog.info("create consume database, and consume info table, and consume result table")
|
||||
tdSql.query("create database if not exists %s vgroups 1"%(cdbName))
|
||||
tdSql.query("create database if not exists %s vgroups 1 wal_retention_period 3600"%(cdbName))
|
||||
tdSql.query("drop table if exists %s.consumeinfo "%(cdbName))
|
||||
tdSql.query("drop table if exists %s.consumeresult "%(cdbName))
|
||||
|
||||
|
@ -114,7 +114,7 @@ class TDTestCase:
|
|||
if dropFlag == 1:
|
||||
tsql.execute("drop database if exists %s"%(dbName))
|
||||
|
||||
tsql.execute("create database if not exists %s vgroups %d replica %d"%(dbName, vgroups, replica))
|
||||
tsql.execute("create database if not exists %s vgroups %d replica %d wal_retention_period 3600"%(dbName, vgroups, replica))
|
||||
tdLog.debug("complete to create database %s"%(dbName))
|
||||
return
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ class TDTestCase:
|
|||
|
||||
def initConsumerTable(self,cdbName='cdb'):
|
||||
tdLog.info("create consume database, and consume info table, and consume result table")
|
||||
tdSql.query("create database if not exists %s vgroups 1"%(cdbName))
|
||||
tdSql.query("create database if not exists %s vgroups 1 wal_retention_period 3600"%(cdbName))
|
||||
tdSql.query("drop table if exists %s.consumeinfo "%(cdbName))
|
||||
tdSql.query("drop table if exists %s.consumeresult "%(cdbName))
|
||||
|
||||
|
@ -114,7 +114,7 @@ class TDTestCase:
|
|||
if dropFlag == 1:
|
||||
tsql.execute("drop database if exists %s"%(dbName))
|
||||
|
||||
tsql.execute("create database if not exists %s vgroups %d replica %d"%(dbName, vgroups, replica))
|
||||
tsql.execute("create database if not exists %s vgroups %d replica %d wal_retention_period 3600"%(dbName, vgroups, replica))
|
||||
tdLog.debug("complete to create database %s"%(dbName))
|
||||
return
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ class TDTestCase:
|
|||
|
||||
def initConsumerTable(self,cdbName='cdb'):
|
||||
tdLog.info("create consume database, and consume info table, and consume result table")
|
||||
tdSql.query("create database if not exists %s vgroups 1"%(cdbName))
|
||||
tdSql.query("create database if not exists %s vgroups 1 wal_retention_period 3600"%(cdbName))
|
||||
tdSql.query("drop table if exists %s.consumeinfo "%(cdbName))
|
||||
tdSql.query("drop table if exists %s.consumeresult "%(cdbName))
|
||||
|
||||
|
@ -114,7 +114,7 @@ class TDTestCase:
|
|||
if dropFlag == 1:
|
||||
tsql.execute("drop database if exists %s"%(dbName))
|
||||
|
||||
tsql.execute("create database if not exists %s vgroups %d replica %d"%(dbName, vgroups, replica))
|
||||
tsql.execute("create database if not exists %s vgroups %d replica %d wal_retention_period 3600"%(dbName, vgroups, replica))
|
||||
tdLog.debug("complete to create database %s"%(dbName))
|
||||
return
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ class TDTestCase:
|
|||
|
||||
def initConsumerTable(self,cdbName='cdb'):
|
||||
tdLog.info("create consume database, and consume info table, and consume result table")
|
||||
tdSql.query("create database if not exists %s vgroups 1"%(cdbName))
|
||||
tdSql.query("create database if not exists %s vgroups 1 wal_retention_period 3600"%(cdbName))
|
||||
tdSql.query("drop table if exists %s.consumeinfo "%(cdbName))
|
||||
tdSql.query("drop table if exists %s.consumeresult "%(cdbName))
|
||||
|
||||
|
@ -114,7 +114,7 @@ class TDTestCase:
|
|||
if dropFlag == 1:
|
||||
tsql.execute("drop database if exists %s"%(dbName))
|
||||
|
||||
tsql.execute("create database if not exists %s vgroups %d replica %d"%(dbName, vgroups, replica))
|
||||
tsql.execute("create database if not exists %s vgroups %d replica %d wal_retention_period 3600"%(dbName, vgroups, replica))
|
||||
tdLog.debug("complete to create database %s"%(dbName))
|
||||
return
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ class TDTestCase:
|
|||
|
||||
def initConsumerTable(self,cdbName='cdb'):
|
||||
tdLog.info("create consume database, and consume info table, and consume result table")
|
||||
tdSql.query("create database if not exists %s vgroups 1"%(cdbName))
|
||||
tdSql.query("create database if not exists %s vgroups 1 wal_retention_period 3600"%(cdbName))
|
||||
tdSql.query("drop table if exists %s.consumeinfo "%(cdbName))
|
||||
tdSql.query("drop table if exists %s.consumeresult "%(cdbName))
|
||||
|
||||
|
@ -114,7 +114,7 @@ class TDTestCase:
|
|||
if dropFlag == 1:
|
||||
tsql.execute("drop database if exists %s"%(dbName))
|
||||
|
||||
tsql.execute("create database if not exists %s vgroups %d replica %d"%(dbName, vgroups, replica))
|
||||
tsql.execute("create database if not exists %s vgroups %d replica %d wal_retention_period 3600"%(dbName, vgroups, replica))
|
||||
tdLog.debug("complete to create database %s"%(dbName))
|
||||
return
|
||||
|
||||
|
|
|
@ -200,6 +200,7 @@ class TDTestCase:
|
|||
tdLog.info("async insert data")
|
||||
pThread = tmqCom.asyncInsertData(paraDict)
|
||||
|
||||
tdSql.execute("alter database %s wal_retention_period 3600" %(paraDict['dbName']))
|
||||
tdLog.info("create topics from stb with filter")
|
||||
# queryString = "select ts, log(c1), ceil(pow(c1,3)) from %s.%s where c1 %% 7 == 0" %(paraDict['dbName'], paraDict['stbName'])
|
||||
|
||||
|
|
|
@ -65,6 +65,7 @@ class TDTestCase:
|
|||
queryStringList = []
|
||||
tmqCom.initConsumerTable()
|
||||
tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=4,replica=1)
|
||||
tdSql.execute("alter database %s wal_retention_period 3600" %(paraDict['dbName']))
|
||||
tdLog.info("create stb")
|
||||
tdCom.create_stable(tdSql, dbname=paraDict["dbName"],stbname=paraDict["stbName"], column_elm_list=paraDict['colSchema'], tag_elm_list=paraDict['tagSchema'])
|
||||
tdLog.info("create ctb")
|
||||
|
@ -175,6 +176,7 @@ class TDTestCase:
|
|||
queryStringList = []
|
||||
tmqCom.initConsumerTable()
|
||||
tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=4,replica=1)
|
||||
tdSql.execute("alter database %s wal_retention_period 3600" %(paraDict['dbName']))
|
||||
tdLog.info("create stb")
|
||||
tdCom.create_stable(tdSql, dbname=paraDict["dbName"],stbname=paraDict["stbName"], column_elm_list=paraDict['colSchema'], tag_elm_list=paraDict['tagSchema'])
|
||||
tdLog.info("create ntb")
|
||||
|
|
|
@ -54,6 +54,7 @@ class TDTestCase:
|
|||
|
||||
tmqCom.initConsumerTable()
|
||||
tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=paraDict["vgroups"],replica=1, wal_retention_size=-1,wal_retention_period=-1)
|
||||
tdSql.execute("alter database %s wal_retention_period 3600" % (paraDict['dbName']))
|
||||
tdLog.info("create stb")
|
||||
tmqCom.create_stable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"])
|
||||
# tdLog.info("create ctb")
|
||||
|
|
|
@ -80,6 +80,7 @@ class TDTestCase:
|
|||
tdLog.info("insert data")
|
||||
tmqCom.insert_data(tdSql,paraDict["dbName"],paraDict["ctbPrefix"],paraDict["ctbNum"],paraDict["rowsPerTbl"],paraDict["batchNum"],paraDict["startTs"])
|
||||
|
||||
tdSql.execute("alter database %s wal_retention_period 3600" % (paraDict['dbName']))
|
||||
tdLog.info("create topics from stb with filter")
|
||||
queryString = "select ts, log(c1), ceil(pow(c1,3)) from %s.%s where c1 %% 7 == 0" %(paraDict['dbName'], paraDict['stbName'])
|
||||
sqlString = "create topic %s as %s" %(topicNameList[0], queryString)
|
||||
|
|
|
@ -73,6 +73,7 @@ class TDTestCase:
|
|||
expectRowsList = []
|
||||
tmqCom.initConsumerTable()
|
||||
tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=4,replica=1)
|
||||
tdSql.execute("alter database %s wal_retention_period 3600" % (paraDict['dbName']))
|
||||
tdLog.info("create stb")
|
||||
tdCom.create_stable(tdSql, dbname=paraDict["dbName"],stbname=paraDict["stbName"], column_elm_list=paraDict['colSchema'], tag_elm_list=paraDict['tagSchema'])
|
||||
tdLog.info("create ctb")
|
||||
|
|
|
@ -54,6 +54,7 @@ class TDTestCase:
|
|||
|
||||
tmqCom.initConsumerTable()
|
||||
tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=paraDict["vgroups"],replica=1)
|
||||
tdSql.execute("alter database %s wal_retention_period 3600" % (paraDict['dbName']))
|
||||
tdLog.info("create stb")
|
||||
tmqCom.create_stable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"])
|
||||
tdLog.info("create ctb")
|
||||
|
|
|
@ -54,6 +54,7 @@ class TDTestCase:
|
|||
|
||||
tmqCom.initConsumerTable()
|
||||
tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=paraDict["vgroups"],replica=1)
|
||||
tdSql.execute("alter database %s wal_retention_period 3600" % (paraDict['dbName']))
|
||||
tdLog.info("create stb")
|
||||
tmqCom.create_stable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"])
|
||||
tdLog.info("create ctb")
|
||||
|
|
|
@ -54,6 +54,7 @@ class TDTestCase:
|
|||
|
||||
tmqCom.initConsumerTable()
|
||||
tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=paraDict["vgroups"],replica=1)
|
||||
tdSql.execute("alter database %s wal_retention_period 3600" % (paraDict['dbName']))
|
||||
tdLog.info("create stb")
|
||||
tmqCom.create_stable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"])
|
||||
tdLog.info("create ctb")
|
||||
|
|
|
@ -54,6 +54,7 @@ class TDTestCase:
|
|||
|
||||
tmqCom.initConsumerTable()
|
||||
tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=paraDict["vgroups"],replica=1)
|
||||
tdSql.execute("alter database %s wal_retention_period 3600" % (paraDict['dbName']))
|
||||
tdLog.info("create stb")
|
||||
tmqCom.create_stable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"])
|
||||
tdLog.info("create ctb")
|
||||
|
|
|
@ -54,6 +54,7 @@ class TDTestCase:
|
|||
|
||||
tmqCom.initConsumerTable()
|
||||
tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=paraDict["vgroups"],replica=1)
|
||||
tdSql.execute("alter database %s wal_retention_period 3600" % (paraDict['dbName']))
|
||||
tdLog.info("create stb")
|
||||
tmqCom.create_stable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"])
|
||||
tdLog.info("create ctb")
|
||||
|
|
|
@ -54,6 +54,7 @@ class TDTestCase:
|
|||
|
||||
tmqCom.initConsumerTable()
|
||||
tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=paraDict["vgroups"],replica=self.replicaVar)
|
||||
tdSql.execute("alter database %s wal_retention_period 3600" % (paraDict['dbName']))
|
||||
tdLog.info("create stb")
|
||||
tmqCom.create_stable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"])
|
||||
tdLog.info("create ctb")
|
||||
|
|
|
@ -54,6 +54,7 @@ class TDTestCase:
|
|||
|
||||
tmqCom.initConsumerTable()
|
||||
tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=paraDict["vgroups"],replica=1)
|
||||
tdSql.execute("alter database %s wal_retention_period 3600" % (paraDict['dbName']))
|
||||
tdLog.info("create stb")
|
||||
tmqCom.create_stable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"])
|
||||
tdLog.info("create ctb")
|
||||
|
|
|
@ -54,6 +54,7 @@ class TDTestCase:
|
|||
|
||||
tmqCom.initConsumerTable()
|
||||
tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=paraDict["vgroups"],replica=1)
|
||||
tdSql.execute("alter database %s wal_retention_period 3600" % (paraDict['dbName']))
|
||||
tdLog.info("create stb")
|
||||
tmqCom.create_stable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"])
|
||||
tdLog.info("create ctb")
|
||||
|
|
|
@ -54,6 +54,7 @@ class TDTestCase:
|
|||
|
||||
tmqCom.initConsumerTable()
|
||||
tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=paraDict["vgroups"],replica=1)
|
||||
tdSql.execute("alter database %s wal_retention_period 3600" % (paraDict['dbName']))
|
||||
tdLog.info("create stb")
|
||||
tmqCom.create_stable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"])
|
||||
tdLog.info("create ctb")
|
||||
|
|
|
@ -54,6 +54,7 @@ class TDTestCase:
|
|||
|
||||
tmqCom.initConsumerTable()
|
||||
tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=paraDict["vgroups"],replica=1)
|
||||
tdSql.execute("alter database %s wal_retention_period 3600" % (paraDict['dbName']))
|
||||
tdLog.info("create stb")
|
||||
tmqCom.create_stable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"])
|
||||
tdLog.info("create ctb")
|
||||
|
|
|
@ -54,6 +54,7 @@ class TDTestCase:
|
|||
|
||||
tmqCom.initConsumerTable()
|
||||
tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=paraDict["vgroups"],replica=1)
|
||||
tdSql.execute("alter database %s wal_retention_period 3600" % (paraDict['dbName']))
|
||||
tdLog.info("create stb")
|
||||
tmqCom.create_stable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"])
|
||||
tdLog.info("create ctb")
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue