Merge remote-tracking branch 'origin/3.0' into enh/msgRefactor1
This commit is contained in:
commit
a6c3bc20f1
|
@ -2,7 +2,7 @@
|
||||||
IF (DEFINED VERNUMBER)
|
IF (DEFINED VERNUMBER)
|
||||||
SET(TD_VER_NUMBER ${VERNUMBER})
|
SET(TD_VER_NUMBER ${VERNUMBER})
|
||||||
ELSE ()
|
ELSE ()
|
||||||
SET(TD_VER_NUMBER "3.0.1.6")
|
SET(TD_VER_NUMBER "3.0.1.7")
|
||||||
ENDIF ()
|
ENDIF ()
|
||||||
|
|
||||||
IF (DEFINED VERCOMPATIBLE)
|
IF (DEFINED VERCOMPATIBLE)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# taosws-rs
|
# taosws-rs
|
||||||
ExternalProject_Add(taosws-rs
|
ExternalProject_Add(taosws-rs
|
||||||
GIT_REPOSITORY https://github.com/taosdata/taos-connector-rust.git
|
GIT_REPOSITORY https://github.com/taosdata/taos-connector-rust.git
|
||||||
GIT_TAG 9843872
|
GIT_TAG f406d51
|
||||||
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosws-rs"
|
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosws-rs"
|
||||||
BINARY_DIR ""
|
BINARY_DIR ""
|
||||||
#BUILD_IN_SOURCE TRUE
|
#BUILD_IN_SOURCE TRUE
|
||||||
|
|
|
@ -205,13 +205,13 @@ Additional functions are defined in `taosudf.h` to make it easier to work with t
|
||||||
|
|
||||||
To use your user-defined function in TDengine, first compile it to a dynamically linked library (DLL).
|
To use your user-defined function in TDengine, first compile it to a dynamically linked library (DLL).
|
||||||
|
|
||||||
For example, the sample UDF `add_one.c` can be compiled into a DLL as follows:
|
For example, the sample UDF `bit_and.c` can be compiled into a DLL as follows:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
gcc -g -O0 -fPIC -shared add_one.c -o add_one.so
|
gcc -g -O0 -fPIC -shared bit_and.c -o libbitand.so
|
||||||
```
|
```
|
||||||
|
|
||||||
The generated DLL file `add_one.so` can now be used to implement your function. Note: GCC 7.5 or later is required.
|
The generated DLL file `libbitand.so` can now be used to implement your function. Note: GCC 7.5 or later is required.
|
||||||
|
|
||||||
## Manage and Use User-Defined Functions
|
## Manage and Use User-Defined Functions
|
||||||
After compiling your function into a DLL, you add it to TDengine. For more information, see [User-Defined Functions](../12-taos-sql/26-udf.md).
|
After compiling your function into a DLL, you add it to TDengine. For more information, see [User-Defined Functions](../12-taos-sql/26-udf.md).
|
||||||
|
|
|
@ -23,7 +23,7 @@ The following characters cannot occur in a password: single quotation marks ('),
|
||||||
|
|
||||||
## General Limits
|
## General Limits
|
||||||
|
|
||||||
- Maximum length of database name is 32 bytes
|
- Maximum length of database name is 64 bytes
|
||||||
- Maximum length of table name is 192 bytes, excluding the database name prefix and the separator.
|
- Maximum length of table name is 192 bytes, excluding the database name prefix and the separator.
|
||||||
- Maximum length of each data row is 48K bytes. Note that the upper limit includes the extra 2 bytes consumed by each column of BINARY/NCHAR type.
|
- Maximum length of each data row is 48K bytes. Note that the upper limit includes the extra 2 bytes consumed by each column of BINARY/NCHAR type.
|
||||||
- The maximum length of a column name is 64 bytes.
|
- The maximum length of a column name is 64 bytes.
|
||||||
|
@ -35,7 +35,7 @@ The following characters cannot occur in a password: single quotation marks ('),
|
||||||
- Maximum numbers of databases, STables, tables are dependent only on the system resources.
|
- Maximum numbers of databases, STables, tables are dependent only on the system resources.
|
||||||
- The number of replicas can only be 1 or 3.
|
- The number of replicas can only be 1 or 3.
|
||||||
- The maximum length of a username is 23 bytes.
|
- The maximum length of a username is 23 bytes.
|
||||||
- The maximum length of a password is 15 bytes.
|
- The maximum length of a password is 128 bytes.
|
||||||
- The maximum number of rows depends on system resources.
|
- The maximum number of rows depends on system resources.
|
||||||
- The maximum number of vnodes in a database is 1024.
|
- The maximum number of vnodes in a database is 1024.
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ SHOW FUNCTIONS;
|
||||||
|
|
||||||
The function name specified when creating UDF can be used directly in SQL statements, just like builtin functions. For example:
|
The function name specified when creating UDF can be used directly in SQL statements, just like builtin functions. For example:
|
||||||
```sql
|
```sql
|
||||||
SELECT X(c1,c2) FROM table/stable;
|
SELECT bit_and(c1,c2) FROM table;
|
||||||
```
|
```
|
||||||
|
|
||||||
The above SQL statement invokes function X for column c1 and c2. You can use query keywords like WHERE with user-defined functions.
|
The above SQL statement invokes function X for column c1 and c2 on table. You can use query keywords like WHERE with user-defined functions.
|
||||||
|
|
|
@ -10,6 +10,10 @@ For TDengine 2.x installation packages by version, please visit [here](https://w
|
||||||
|
|
||||||
import Release from "/components/ReleaseV3";
|
import Release from "/components/ReleaseV3";
|
||||||
|
|
||||||
|
## 3.0.1.7
|
||||||
|
|
||||||
|
<Release type="tdengine" version="3.0.1.7" />
|
||||||
|
|
||||||
## 3.0.1.6
|
## 3.0.1.6
|
||||||
|
|
||||||
<Release type="tdengine" version="3.0.1.6" />
|
<Release type="tdengine" version="3.0.1.6" />
|
||||||
|
|
|
@ -10,6 +10,10 @@ For other historical version installers, please visit [here](https://www.taosdat
|
||||||
|
|
||||||
import Release from "/components/ReleaseV3";
|
import Release from "/components/ReleaseV3";
|
||||||
|
|
||||||
|
## 2.2.9
|
||||||
|
|
||||||
|
<Release type="tools" version="2.2.9" />
|
||||||
|
|
||||||
## 2.2.7
|
## 2.2.7
|
||||||
|
|
||||||
<Release type="tools" version="2.2.7" />
|
<Release type="tools" version="2.2.7" />
|
||||||
|
|
|
@ -10,4 +10,4 @@ chrono = "0.4"
|
||||||
serde = { version = "1", features = ["derive"] }
|
serde = { version = "1", features = ["derive"] }
|
||||||
tokio = { version = "1", features = ["rt", "macros", "rt-multi-thread"] }
|
tokio = { version = "1", features = ["rt", "macros", "rt-multi-thread"] }
|
||||||
|
|
||||||
taos = { version = "0.*" }
|
taos = { version = "0.4.8" }
|
||||||
|
|
|
@ -12,7 +12,10 @@ async fn main() -> anyhow::Result<()> {
|
||||||
// bind table name and tags
|
// bind table name and tags
|
||||||
stmt.set_tbname_tags(
|
stmt.set_tbname_tags(
|
||||||
"d1001",
|
"d1001",
|
||||||
&[Value::VarChar("California.SanFransico".into()), Value::Int(2)],
|
&[
|
||||||
|
Value::VarChar("California.SanFransico".into()),
|
||||||
|
Value::Int(2),
|
||||||
|
],
|
||||||
)?;
|
)?;
|
||||||
// bind values.
|
// bind values.
|
||||||
let values = vec![
|
let values = vec![
|
||||||
|
@ -30,9 +33,9 @@ async fn main() -> anyhow::Result<()> {
|
||||||
ColumnView::from_floats(vec![0.33]),
|
ColumnView::from_floats(vec![0.33]),
|
||||||
];
|
];
|
||||||
stmt.bind(&values2)?;
|
stmt.bind(&values2)?;
|
||||||
|
|
||||||
stmt.add_batch()?;
|
stmt.add_batch()?;
|
||||||
|
|
||||||
// execute.
|
// execute.
|
||||||
let rows = stmt.execute()?;
|
let rows = stmt.execute()?;
|
||||||
assert_eq!(rows, 2);
|
assert_eq!(rows, 2);
|
||||||
|
|
|
@ -50,7 +50,7 @@ async fn main() -> anyhow::Result<()> {
|
||||||
// create super table
|
// create super table
|
||||||
format!("CREATE TABLE `meters` (`ts` TIMESTAMP, `current` FLOAT, `voltage` INT, `phase` FLOAT) TAGS (`groupid` INT, `location` BINARY(24))"),
|
format!("CREATE TABLE `meters` (`ts` TIMESTAMP, `current` FLOAT, `voltage` INT, `phase` FLOAT) TAGS (`groupid` INT, `location` BINARY(24))"),
|
||||||
// create topic for subscription
|
// create topic for subscription
|
||||||
format!("CREATE TOPIC tmq_meters with META AS DATABASE {db}")
|
format!("CREATE TOPIC tmq_meters AS SELECT * FROM `meters`")
|
||||||
])
|
])
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
@ -64,13 +64,9 @@ async fn main() -> anyhow::Result<()> {
|
||||||
let mut consumer = tmq.build()?;
|
let mut consumer = tmq.build()?;
|
||||||
consumer.subscribe(["tmq_meters"]).await?;
|
consumer.subscribe(["tmq_meters"]).await?;
|
||||||
|
|
||||||
{
|
consumer
|
||||||
let mut stream = consumer.stream();
|
.stream()
|
||||||
|
.try_for_each(|(offset, message)| async {
|
||||||
while let Some((offset, message)) = stream.try_next().await? {
|
|
||||||
// get information from offset
|
|
||||||
|
|
||||||
// the topic
|
|
||||||
let topic = offset.topic();
|
let topic = offset.topic();
|
||||||
// the vgroup id, like partition id in kafka.
|
// the vgroup id, like partition id in kafka.
|
||||||
let vgroup_id = offset.vgroup_id();
|
let vgroup_id = offset.vgroup_id();
|
||||||
|
@ -78,20 +74,14 @@ async fn main() -> anyhow::Result<()> {
|
||||||
|
|
||||||
if let Some(data) = message.into_data() {
|
if let Some(data) = message.into_data() {
|
||||||
while let Some(block) = data.fetch_raw_block().await? {
|
while let Some(block) = data.fetch_raw_block().await? {
|
||||||
// one block for one table, get table name if needed
|
|
||||||
let name = block.table_name();
|
|
||||||
let records: Vec<Record> = block.deserialize().try_collect()?;
|
let records: Vec<Record> = block.deserialize().try_collect()?;
|
||||||
println!(
|
println!("** read {} records: {:#?}\n", records.len(), records);
|
||||||
"** table: {}, got {} records: {:#?}\n",
|
|
||||||
name.unwrap(),
|
|
||||||
records.len(),
|
|
||||||
records
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
consumer.commit(offset).await?;
|
consumer.commit(offset).await?;
|
||||||
}
|
Ok(())
|
||||||
}
|
})
|
||||||
|
.await?;
|
||||||
|
|
||||||
consumer.unsubscribe().await;
|
consumer.unsubscribe().await;
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ async fn main() -> anyhow::Result<()> {
|
||||||
let dsn = "ws://";
|
let dsn = "ws://";
|
||||||
let taos = TaosBuilder::from_dsn(dsn)?.build()?;
|
let taos = TaosBuilder::from_dsn(dsn)?.build()?;
|
||||||
|
|
||||||
|
|
||||||
taos.exec_many([
|
taos.exec_many([
|
||||||
"DROP DATABASE IF EXISTS power",
|
"DROP DATABASE IF EXISTS power",
|
||||||
"CREATE DATABASE power",
|
"CREATE DATABASE power",
|
||||||
|
|
|
@ -18,7 +18,18 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
|
||||||
<DocCardList items={useCurrentSidebarCategory().items}/>
|
<DocCardList items={useCurrentSidebarCategory().items}/>
|
||||||
```
|
```
|
||||||
|
|
||||||
### 加入 TDengine 官方社区
|
## 学习 TDengine 知识地图
|
||||||
|
|
||||||
|
TDengine 知识地图中涵盖了 TDengine 的各种知识点,揭示了各概念实体之间的调用关系和数据流向。学习和了解 TDengine 知识地图有助于你快速掌握 TDengine 的知识体系。
|
||||||
|
|
||||||
|
<figure>
|
||||||
|
<center>
|
||||||
|
<a href="pathname:///img/tdengine-map.svg" target="_blank"><img src="/img/tdengine-map.svg" width="80%" /></a>
|
||||||
|
<figcaption>图 1. TDengine 知识地图</figcaption>
|
||||||
|
</center>
|
||||||
|
</figure>
|
||||||
|
|
||||||
|
## 加入 TDengine 官方社区
|
||||||
|
|
||||||
微信扫描以下二维码,学习了解 TDengine 的最新技术,与大家共同交流物联网大数据技术应用、TDengine 使用问题和技巧等话题。
|
微信扫描以下二维码,学习了解 TDengine 的最新技术,与大家共同交流物联网大数据技术应用、TDengine 使用问题和技巧等话题。
|
||||||
|
|
||||||
|
|
|
@ -205,13 +205,13 @@ typedef struct SUdfInterBuf {
|
||||||
|
|
||||||
用户定义函数的 C 语言源代码无法直接被 TDengine 系统使用,而是需要先编译为 动态链接库,之后才能载入 TDengine 系统。
|
用户定义函数的 C 语言源代码无法直接被 TDengine 系统使用,而是需要先编译为 动态链接库,之后才能载入 TDengine 系统。
|
||||||
|
|
||||||
例如,按照上一章节描述的规则准备好了用户定义函数的源代码 add_one.c,以 Linux 为例可以执行如下指令编译得到动态链接库文件:
|
例如,按照上一章节描述的规则准备好了用户定义函数的源代码 bit_and.c,以 Linux 为例可以执行如下指令编译得到动态链接库文件:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
gcc -g -O0 -fPIC -shared add_one.c -o add_one.so
|
gcc -g -O0 -fPIC -shared bit_and.c -o libbitand.so
|
||||||
```
|
```
|
||||||
|
|
||||||
这样就准备好了动态链接库 add_one.so 文件,可以供后文创建 UDF 时使用了。为了保证可靠的系统运行,编译器 GCC 推荐使用 7.5 及以上版本。
|
这样就准备好了动态链接库 libbitand.so 文件,可以供后文创建 UDF 时使用了。为了保证可靠的系统运行,编译器 GCC 推荐使用 7.5 及以上版本。
|
||||||
|
|
||||||
## 管理和使用UDF
|
## 管理和使用UDF
|
||||||
编译好的UDF,还需要将其加入到系统才能被正常的SQL调用。关于如何管理和使用UDF,参见[UDF使用说明](../12-taos-sql/26-udf.md)
|
编译好的UDF,还需要将其加入到系统才能被正常的SQL调用。关于如何管理和使用UDF,参见[UDF使用说明](../12-taos-sql/26-udf.md)
|
||||||
|
|
|
@ -24,19 +24,19 @@ description: 合法字符集和命名中的限制规则
|
||||||
|
|
||||||
## 一般限制
|
## 一般限制
|
||||||
|
|
||||||
- 数据库名最大长度为 32
|
- 数据库名最大长度为 64 字节
|
||||||
- 表名最大长度为 192,不包括数据库名前缀和分隔符
|
- 表名最大长度为 192 字节,不包括数据库名前缀和分隔符
|
||||||
- 每行数据最大长度 48KB (注意:数据行内每个 BINARY/NCHAR 类型的列还会额外占用 2 个字节的存储位置)
|
- 每行数据最大长度 48KB (注意:数据行内每个 BINARY/NCHAR 类型的列还会额外占用 2 个字节的存储位置)
|
||||||
- 列名最大长度为 64
|
- 列名最大长度为 64 字节
|
||||||
- 最多允许 4096 列,最少需要 2 列,第一列必须是时间戳。
|
- 最多允许 4096 列,最少需要 2 列,第一列必须是时间戳。
|
||||||
- 标签名最大长度为 64
|
- 标签名最大长度为 64 字节
|
||||||
- 最多允许 128 个,至少要有 1 个标签,一个表中标签值的总长度不超过 16KB
|
- 最多允许 128 个,至少要有 1 个标签,一个表中标签值的总长度不超过 16KB
|
||||||
- SQL 语句最大长度 1048576 个字符
|
- SQL 语句最大长度 1048576 个字符
|
||||||
- SELECT 语句的查询结果,最多允许返回 4096 列(语句中的函数调用可能也会占用一些列空间),超限时需要显式指定较少的返回数据列,以避免语句执行报错
|
- SELECT 语句的查询结果,最多允许返回 4096 列(语句中的函数调用可能也会占用一些列空间),超限时需要显式指定较少的返回数据列,以避免语句执行报错
|
||||||
- 库的数目,超级表的数目、表的数目,系统不做限制,仅受系统资源限制
|
- 库的数目,超级表的数目、表的数目,系统不做限制,仅受系统资源限制
|
||||||
- 数据库的副本数只能设置为 1 或 3
|
- 数据库的副本数只能设置为 1 或 3
|
||||||
- 用户名的最大长度是 23 个字节
|
- 用户名的最大长度是 23 字节
|
||||||
- 用户密码的最大长度是 15 个字节
|
- 用户密码的最大长度是 128 字节
|
||||||
- 总数据行数取决于可用资源
|
- 总数据行数取决于可用资源
|
||||||
- 单个数据库的虚拟结点数上限为 1024
|
- 单个数据库的虚拟结点数上限为 1024
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ SHOW FUNCTIONS;
|
||||||
|
|
||||||
在 SQL 指令中,可以直接以在系统中创建 UDF 时赋予的函数名来调用用户定义函数。例如:
|
在 SQL 指令中,可以直接以在系统中创建 UDF 时赋予的函数名来调用用户定义函数。例如:
|
||||||
```sql
|
```sql
|
||||||
SELECT X(c1,c2) FROM table/stable;
|
SELECT bit_and(c1,c2) FROM table;
|
||||||
```
|
```
|
||||||
|
|
||||||
表示对名为 c1, c2 的数据列调用名为 X 的用户定义函数。SQL 指令中用户定义函数可以配合 WHERE 等查询特性来使用。
|
表示对表 table 上名为 c1, c2 的数据列调用名为 bit_and 的用户定义函数。SQL 指令中用户定义函数可以配合 WHERE 等查询特性来使用。
|
||||||
|
|
|
@ -10,6 +10,10 @@ TDengine 2.x 各版本安装包请访问[这里](https://www.taosdata.com/all-do
|
||||||
|
|
||||||
import Release from "/components/ReleaseV3";
|
import Release from "/components/ReleaseV3";
|
||||||
|
|
||||||
|
## 3.0.1.7
|
||||||
|
|
||||||
|
<Release type="tdengine" version="3.0.1.7" />
|
||||||
|
|
||||||
## 3.0.1.6
|
## 3.0.1.6
|
||||||
|
|
||||||
<Release type="tdengine" version="3.0.1.6" />
|
<Release type="tdengine" version="3.0.1.6" />
|
||||||
|
|
|
@ -10,6 +10,10 @@ taosTools 各版本安装包下载链接如下:
|
||||||
|
|
||||||
import Release from "/components/ReleaseV3";
|
import Release from "/components/ReleaseV3";
|
||||||
|
|
||||||
|
## 2.2.9
|
||||||
|
|
||||||
|
<Release type="tools" version="2.2.9" />
|
||||||
|
|
||||||
## 2.2.7
|
## 2.2.7
|
||||||
|
|
||||||
<Release type="tools" version="2.2.7" />
|
<Release type="tools" version="2.2.7" />
|
||||||
|
|
|
@ -3199,6 +3199,14 @@ typedef struct {
|
||||||
|
|
||||||
int32_t tSerializeSBatchReq(void *buf, int32_t bufLen, SBatchReq *pReq);
|
int32_t tSerializeSBatchReq(void *buf, int32_t bufLen, SBatchReq *pReq);
|
||||||
int32_t tDeserializeSBatchReq(void *buf, int32_t bufLen, SBatchReq *pReq);
|
int32_t tDeserializeSBatchReq(void *buf, int32_t bufLen, SBatchReq *pReq);
|
||||||
|
static FORCE_INLINE void tFreeSBatchReqMsg(void* msg) {
|
||||||
|
if (NULL == msg) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
SBatchMsg* pMsg = (SBatchMsg*)msg;
|
||||||
|
taosMemoryFree(pMsg->msg);
|
||||||
|
}
|
||||||
|
|
||||||
int32_t tSerializeSBatchRsp(void *buf, int32_t bufLen, SBatchRsp *pRsp);
|
int32_t tSerializeSBatchRsp(void *buf, int32_t bufLen, SBatchRsp *pRsp);
|
||||||
int32_t tDeserializeSBatchRsp(void *buf, int32_t bufLen, SBatchRsp *pRsp);
|
int32_t tDeserializeSBatchRsp(void *buf, int32_t bufLen, SBatchRsp *pRsp);
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ typedef struct SVariant {
|
||||||
int64_t i;
|
int64_t i;
|
||||||
uint64_t u;
|
uint64_t u;
|
||||||
double d;
|
double d;
|
||||||
|
float f;
|
||||||
char *pz;
|
char *pz;
|
||||||
TdUcs4 *ucs4;
|
TdUcs4 *ucs4;
|
||||||
SArray *arr; // only for 'in' query to hold value list, not value for a field
|
SArray *arr; // only for 'in' query to hold value list, not value for a field
|
||||||
|
@ -47,7 +48,7 @@ void taosVariantAssign(SVariant *pDst, const SVariant *pSrc);
|
||||||
|
|
||||||
int32_t taosVariantCompare(const SVariant *p1, const SVariant *p2);
|
int32_t taosVariantCompare(const SVariant *p1, const SVariant *p2);
|
||||||
|
|
||||||
char *taosVariantGet(SVariant *pVar, int32_t type);
|
char *taosVariantGet(SVariant *pVar, int32_t type);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,16 +27,21 @@ typedef struct SStreamTask SStreamTask;
|
||||||
|
|
||||||
typedef bool (*state_key_cmpr_fn)(void* pKey1, void* pKey2);
|
typedef bool (*state_key_cmpr_fn)(void* pKey1, void* pKey2);
|
||||||
|
|
||||||
// incremental state storage
|
typedef struct STdbState {
|
||||||
typedef struct {
|
|
||||||
SStreamTask* pOwner;
|
SStreamTask* pOwner;
|
||||||
TDB* db;
|
TDB* db;
|
||||||
TTB* pStateDb;
|
TTB* pStateDb;
|
||||||
TTB* pFuncStateDb;
|
TTB* pFuncStateDb;
|
||||||
TTB* pFillStateDb; // todo refactor
|
TTB* pFillStateDb; // todo refactor
|
||||||
TTB* pSessionStateDb;
|
TTB* pSessionStateDb;
|
||||||
|
TTB* pParNameDb;
|
||||||
TXN txn;
|
TXN txn;
|
||||||
int32_t number;
|
} STdbState;
|
||||||
|
|
||||||
|
// incremental state storage
|
||||||
|
typedef struct {
|
||||||
|
STdbState* pTdbState;
|
||||||
|
int32_t number;
|
||||||
} SStreamState;
|
} SStreamState;
|
||||||
|
|
||||||
SStreamState* streamStateOpen(char* path, SStreamTask* pTask, bool specPath, int32_t szPage, int32_t pages);
|
SStreamState* streamStateOpen(char* path, SStreamTask* pTask, bool specPath, int32_t szPage, int32_t pages);
|
||||||
|
@ -44,6 +49,7 @@ void streamStateClose(SStreamState* pState);
|
||||||
int32_t streamStateBegin(SStreamState* pState);
|
int32_t streamStateBegin(SStreamState* pState);
|
||||||
int32_t streamStateCommit(SStreamState* pState);
|
int32_t streamStateCommit(SStreamState* pState);
|
||||||
int32_t streamStateAbort(SStreamState* pState);
|
int32_t streamStateAbort(SStreamState* pState);
|
||||||
|
void streamStateDestroy(SStreamState* pState);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
TBC* pCur;
|
TBC* pCur;
|
||||||
|
@ -99,6 +105,9 @@ int32_t streamStateSeekLast(SStreamState* pState, SStreamStateCur* pCur);
|
||||||
int32_t streamStateCurNext(SStreamState* pState, SStreamStateCur* pCur);
|
int32_t streamStateCurNext(SStreamState* pState, SStreamStateCur* pCur);
|
||||||
int32_t streamStateCurPrev(SStreamState* pState, SStreamStateCur* pCur);
|
int32_t streamStateCurPrev(SStreamState* pState, SStreamStateCur* pCur);
|
||||||
|
|
||||||
|
int32_t streamStatePutParName(SStreamState* pState, int64_t groupId, const char* tbname);
|
||||||
|
int32_t streamStateGetParName(SStreamState* pState, int64_t groupId, void** pVal);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
char* streamStateSessionDump(SStreamState* pState);
|
char* streamStateSessionDump(SStreamState* pState);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -47,7 +47,7 @@ typedef struct SUpdateInfo {
|
||||||
|
|
||||||
SUpdateInfo *updateInfoInitP(SInterval *pInterval, int64_t watermark);
|
SUpdateInfo *updateInfoInitP(SInterval *pInterval, int64_t watermark);
|
||||||
SUpdateInfo *updateInfoInit(int64_t interval, int32_t precision, int64_t watermark);
|
SUpdateInfo *updateInfoInit(int64_t interval, int32_t precision, int64_t watermark);
|
||||||
void updateInfoFillBlockData(SUpdateInfo *pInfo, SSDataBlock *pBlock, int32_t primaryTsCol);
|
TSKEY updateInfoFillBlockData(SUpdateInfo *pInfo, SSDataBlock *pBlock, int32_t primaryTsCol);
|
||||||
bool updateInfoIsUpdated(SUpdateInfo *pInfo, uint64_t tableId, TSKEY ts);
|
bool updateInfoIsUpdated(SUpdateInfo *pInfo, uint64_t tableId, TSKEY ts);
|
||||||
bool updateInfoIsTableInserted(SUpdateInfo *pInfo, int64_t tbUid);
|
bool updateInfoIsTableInserted(SUpdateInfo *pInfo, int64_t tbUid);
|
||||||
void updateInfoSetScanRange(SUpdateInfo *pInfo, STimeWindow *pWin, uint64_t groupId, uint64_t version);
|
void updateInfoSetScanRange(SUpdateInfo *pInfo, STimeWindow *pWin, uint64_t groupId, uint64_t version);
|
||||||
|
|
|
@ -352,6 +352,7 @@ int32_t* taosGetErrno();
|
||||||
#define TSDB_CODE_TDB_STB_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x061A)
|
#define TSDB_CODE_TDB_STB_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x061A)
|
||||||
#define TSDB_CODE_TDB_INVALID_TABLE_SCHEMA_VER TAOS_DEF_ERROR_CODE(0, 0x061B)
|
#define TSDB_CODE_TDB_INVALID_TABLE_SCHEMA_VER TAOS_DEF_ERROR_CODE(0, 0x061B)
|
||||||
#define TSDB_CODE_TDB_TDB_ENV_OPEN_ERROR TAOS_DEF_ERROR_CODE(0, 0x061C)
|
#define TSDB_CODE_TDB_TDB_ENV_OPEN_ERROR TAOS_DEF_ERROR_CODE(0, 0x061C)
|
||||||
|
#define TSDB_CODE_TDB_TABLE_IN_OTHER_STABLE TAOS_DEF_ERROR_CODE(0, 0x061D)
|
||||||
|
|
||||||
// query
|
// query
|
||||||
#define TSDB_CODE_QRY_INVALID_QHANDLE TAOS_DEF_ERROR_CODE(0, 0x0700)
|
#define TSDB_CODE_QRY_INVALID_QHANDLE TAOS_DEF_ERROR_CODE(0, 0x0700)
|
||||||
|
|
|
@ -489,6 +489,9 @@ enum {
|
||||||
#define MAX_META_MSG_IN_BATCH 1048576
|
#define MAX_META_MSG_IN_BATCH 1048576
|
||||||
#define MAX_META_BATCH_RSP_SIZE (1 * 1048576 * 1024)
|
#define MAX_META_BATCH_RSP_SIZE (1 * 1048576 * 1024)
|
||||||
|
|
||||||
|
// sort page size by default
|
||||||
|
#define DEFAULT_PAGESIZE 4096
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -73,10 +73,10 @@
|
||||||
# compressColData -1
|
# compressColData -1
|
||||||
|
|
||||||
# system time zone
|
# system time zone
|
||||||
# timezone Asia/Shanghai (CST, +0800)
|
# timezone UTC-8
|
||||||
|
|
||||||
# system time zone (for windows 10)
|
# system time zone (for windows 10)
|
||||||
# timezone UTC-8
|
# timezone Asia/Shanghai (CST, +0800)
|
||||||
|
|
||||||
# system locale
|
# system locale
|
||||||
# locale en_US.UTF-8
|
# locale en_US.UTF-8
|
||||||
|
@ -179,4 +179,4 @@
|
||||||
# metaDebugFlag 131
|
# metaDebugFlag 131
|
||||||
|
|
||||||
# generate core file when service crash
|
# generate core file when service crash
|
||||||
# enableCoreFile 1
|
# enableCoreFile 1
|
||||||
|
|
|
@ -7,6 +7,9 @@ ARG dirName
|
||||||
ARG cpuType
|
ARG cpuType
|
||||||
RUN echo ${pkgFile} && echo ${dirName}
|
RUN echo ${pkgFile} && echo ${dirName}
|
||||||
|
|
||||||
|
RUN apt update
|
||||||
|
RUN apt install -y curl
|
||||||
|
|
||||||
COPY ${pkgFile} /root/
|
COPY ${pkgFile} /root/
|
||||||
ENV TINI_VERSION v0.19.0
|
ENV TINI_VERSION v0.19.0
|
||||||
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${cpuType} /tini
|
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${cpuType} /tini
|
||||||
|
|
|
@ -1,16 +1,160 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
TAOS_RUN_TAOSBENCHMARK_TEST_ONCE=0
|
TAOS_RUN_TAOSBENCHMARK_TEST_ONCE=0
|
||||||
|
#ADMIN_URL=${ADMIN_URL:-http://172.26.10.84:10001}
|
||||||
|
TAOSD_STARTUP_TIMEOUT_SECOND=${TAOSD_STARTUP_TIMEOUT_SECOND:-160}
|
||||||
|
TAOS_TIMEOUT_SECOND=${TAOS_TIMEOUT_SECOND:-5}
|
||||||
|
BACKUP_CORE_FOLDER=/var/log/corefile
|
||||||
|
ALERT_URL=app/system/alert/add
|
||||||
|
|
||||||
|
echo "ADMIN_URL: ${ADMIN_URL}"
|
||||||
|
echo "TAOS_TIMEOUT_SECOND: ${TAOS_TIMEOUT_SECOND}"
|
||||||
|
|
||||||
|
function set_service_state() {
|
||||||
|
#echo "set service state: $1, $2"
|
||||||
|
service_state="$1"
|
||||||
|
service_msg="$2"
|
||||||
|
}
|
||||||
|
set_service_state "init" "ok"
|
||||||
|
app_name=`hostname |cut -d\- -f1`
|
||||||
|
|
||||||
|
function check_taosd() {
|
||||||
|
timeout $TAOS_TIMEOUT_SECOND taos -s "show databases;" >/dev/null
|
||||||
|
local ret=$?
|
||||||
|
if [ $ret -ne 0 ]; then
|
||||||
|
echo "`date` check taosd error $ret"
|
||||||
|
if [ "x$1" != "xignore" ]; then
|
||||||
|
set_service_state "error" "taos check failed $ret"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
set_service_state "ready" "ok"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
function post_error_msg() {
|
||||||
|
if [ ! -z "${ADMIN_URL}" ]; then
|
||||||
|
taos_version=`taos --version`
|
||||||
|
echo "app_name: ${app_name}"
|
||||||
|
echo "service_state: ${service_state}"
|
||||||
|
echo "`date` service_msg: ${service_msg}"
|
||||||
|
echo "${taos_version}"
|
||||||
|
curl --connect-timeout 10 --max-time 20 -X POST -H "Content-Type: application/json" \
|
||||||
|
-d"{\"appName\":\"${app_name}\",\
|
||||||
|
\"alertLevel\":\"${service_state}\",\
|
||||||
|
\"taosVersion\":\"${taos_version}\",\
|
||||||
|
\"alertMsg\":\"${service_msg}\"}" \
|
||||||
|
${ADMIN_URL}/${ALERT_URL}
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
function check_taosd_exit_type() {
|
||||||
|
local core_pattern=`cat /proc/sys/kernel/core_pattern`
|
||||||
|
echo "$core_pattern" | grep -q "^/"
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
core_folder=`dirname $core_pattern`
|
||||||
|
core_prefix=`basename $core_pattern | sed "s/%.*//"`
|
||||||
|
else
|
||||||
|
core_folder=`pwd`
|
||||||
|
core_prefix="$core_pattern"
|
||||||
|
fi
|
||||||
|
local core_files=`ls $core_folder | grep "^${core_prefix}"`
|
||||||
|
if [ ! -z "$core_files" ]; then
|
||||||
|
# move core files to another folder
|
||||||
|
mkdir -p ${BACKUP_CORE_FOLDER}
|
||||||
|
mv ${core_folder}/${core_prefix}* ${BACKUP_CORE_FOLDER}/
|
||||||
|
set_service_state "error" "taosd exit with core file"
|
||||||
|
else
|
||||||
|
set_service_state "error" "taosd exit without core file"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
disk_usage_level=(60 80 99)
|
||||||
|
current_disk_level=0
|
||||||
|
disk_state="ok"
|
||||||
|
disk_msg="ok"
|
||||||
|
get_usage_ok="yes"
|
||||||
|
function post_disk_error_msg() {
|
||||||
|
if [ ! -z "${ADMIN_URL}" ]; then
|
||||||
|
taos_version=`taos --version`
|
||||||
|
echo "app_name: ${app_name}"
|
||||||
|
echo "disk_state: ${disk_state}"
|
||||||
|
echo "`date` disk_msg: ${disk_msg}"
|
||||||
|
echo "${taos_version}"
|
||||||
|
curl --connect-timeout 10 --max-time 20 -X POST -H "Content-Type: application/json" \
|
||||||
|
-d"{\"appName\":\"${app_name}\",\
|
||||||
|
\"alertLevel\":\"${disk_state}\",\
|
||||||
|
\"taosVersion\":\"${taos_version}\",\
|
||||||
|
\"alertMsg\":\"${disk_msg}\"}" \
|
||||||
|
${ADMIN_URL}/${ALERT_URL}
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
function check_disk() {
|
||||||
|
local folder=`cat /etc/taos/taos.cfg|grep -v "^#"|grep dataDir|awk '{print $NF}'`
|
||||||
|
if [ -z "$folder" ]; then
|
||||||
|
folder="/var/lib/taos"
|
||||||
|
fi
|
||||||
|
local mount_point="$folder"
|
||||||
|
local usage=""
|
||||||
|
while [ -z "$usage" ]; do
|
||||||
|
usage=`df -h|grep -w "${mount_point}"|awk '{print $5}'|grep -v Use|sed "s/%$//"`
|
||||||
|
if [ "x${mount_point}" = "x/" ]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
mount_point=`dirname ${mount_point}`
|
||||||
|
done
|
||||||
|
if [ -z "$usage" ]; then
|
||||||
|
disk_state="error"
|
||||||
|
disk_msg="cannot get disk usage"
|
||||||
|
if [ "$get_usage_ok" = "yes" ]; then
|
||||||
|
post_disk_error_msg
|
||||||
|
get_usage_ok="no"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
get_usage_ok="yes"
|
||||||
|
local current_level=0
|
||||||
|
for level in ${disk_usage_level[*]}; do
|
||||||
|
if [ ${usage} -ge ${level} ]; then
|
||||||
|
disk_state="error"
|
||||||
|
disk_msg="disk usage over ${level}%"
|
||||||
|
current_level=${level}
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [ ${current_level} -gt ${current_disk_level} ]; then
|
||||||
|
post_disk_error_msg
|
||||||
|
elif [ ${current_level} -lt ${current_disk_level} ]; then
|
||||||
|
echo "disk usage reduced from ${current_disk_level} to ${current_level}"
|
||||||
|
fi
|
||||||
|
current_disk_level=${current_level}
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
function run_taosd() {
|
||||||
|
taosd
|
||||||
|
set_service_state "error" "taosd exit"
|
||||||
|
# post error msg
|
||||||
|
# check crash or OOM
|
||||||
|
check_taosd_exit_type
|
||||||
|
post_error_msg
|
||||||
|
}
|
||||||
|
function print_service_state_change() {
|
||||||
|
if [ "x$1" != "x${service_state}" ]; then
|
||||||
|
echo "`date` service state: ${service_state}, ${service_msg}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
taosd_start_time=`date +%s`
|
||||||
while ((1))
|
while ((1))
|
||||||
do
|
do
|
||||||
|
check_disk
|
||||||
# echo "outer loop: $a"
|
# echo "outer loop: $a"
|
||||||
sleep 10
|
output=`timeout $TAOS_TIMEOUT_SECOND taos -k`
|
||||||
output=`taos -k`
|
if [ -z "${output}" ]; then
|
||||||
status=${output:0:1}
|
echo "`date` taos -k error"
|
||||||
|
status=""
|
||||||
|
else
|
||||||
|
status=${output:0:1}
|
||||||
|
fi
|
||||||
# echo $output
|
# echo $output
|
||||||
# echo $status
|
# echo $status
|
||||||
if [ "$status"x = "0"x ]
|
if [ "$status"x = "0"x ]
|
||||||
then
|
then
|
||||||
taosd &
|
# taosd_start_time=`date +%s`
|
||||||
|
run_taosd &
|
||||||
fi
|
fi
|
||||||
# echo "$status"x "$TAOS_RUN_TAOSBENCHMARK_TEST"x "$TAOS_RUN_TAOSBENCHMARK_TEST_ONCE"x
|
# echo "$status"x "$TAOS_RUN_TAOSBENCHMARK_TEST"x "$TAOS_RUN_TAOSBENCHMARK_TEST_ONCE"x
|
||||||
if [ "$status"x = "2"x ] && [ "$TAOS_RUN_TAOSBENCHMARK_TEST"x = "1"x ] && [ "$TAOS_RUN_TAOSBENCHMARK_TEST_ONCE"x = "0"x ]
|
if [ "$status"x = "2"x ] && [ "$TAOS_RUN_TAOSBENCHMARK_TEST"x = "1"x ] && [ "$TAOS_RUN_TAOSBENCHMARK_TEST_ONCE"x = "0"x ]
|
||||||
|
@ -24,13 +168,37 @@ do
|
||||||
taos -s "select stable_name from information_schema.ins_stables where db_name = 'test';"|grep -q -w meters
|
taos -s "select stable_name from information_schema.ins_stables where db_name = 'test';"|grep -q -w meters
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
taosBenchmark -y -t 1000 -n 1000 -S 900000
|
taosBenchmark -y -t 1000 -n 1000 -S 900000
|
||||||
taos -s "create user admin_user pass 'NDS65R6t' sysinfo 0;"
|
taos -s "create user admin_user pass 'NDS65R6t' sysinfo 0;"
|
||||||
taos -s "GRANT ALL on test.* to admin_user;"
|
taos -s "GRANT ALL on test.* to admin_user;"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
# check taosd status
|
||||||
|
if [ "$service_state" = "ready" ]; then
|
||||||
|
# check taosd status
|
||||||
|
check_taosd
|
||||||
|
print_service_state_change "ready"
|
||||||
|
if [ "$service_state" = "error" ]; then
|
||||||
|
post_error_msg
|
||||||
|
fi
|
||||||
|
elif [ "$service_state" = "init" ]; then
|
||||||
|
check_taosd "ignore"
|
||||||
|
# check timeout
|
||||||
|
current_time=`date +%s`
|
||||||
|
time_elapsed=$(( current_time - taosd_start_time ))
|
||||||
|
if [ ${time_elapsed} -gt ${TAOSD_STARTUP_TIMEOUT_SECOND} ]; then
|
||||||
|
set_service_state "error" "taosd startup timeout"
|
||||||
|
post_error_msg
|
||||||
|
fi
|
||||||
|
print_service_state_change "init"
|
||||||
|
elif [ "$service_state" = "error" ]; then
|
||||||
|
# check taosd status
|
||||||
|
check_taosd
|
||||||
|
print_service_state_change "error"
|
||||||
|
fi
|
||||||
# check taosadapter
|
# check taosadapter
|
||||||
nc -z localhost 6041
|
nc -z localhost 6041
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
taosadapter &
|
taosadapter &
|
||||||
fi
|
fi
|
||||||
|
sleep 10
|
||||||
done
|
done
|
||||||
|
|
|
@ -63,7 +63,7 @@ Source: {#MyAppSourceDir}{#MyAppTaosdemoExeName}; DestDir: "{app}"; Flags: igNor
|
||||||
|
|
||||||
[run]
|
[run]
|
||||||
Filename: {sys}\sc.exe; Parameters: "create taosd start= DEMAND binPath= ""C:\\TDengine\\taosd.exe --win_service""" ; Flags: runhidden
|
Filename: {sys}\sc.exe; Parameters: "create taosd start= DEMAND binPath= ""C:\\TDengine\\taosd.exe --win_service""" ; Flags: runhidden
|
||||||
Filename: {sys}\sc.exe; Parameters: "create taosadapter start= DEMAND binPath= ""C:\\TDengine\\taosadapter.exe --win_service""" ; Flags: runhidden
|
Filename: {sys}\sc.exe; Parameters: "create taosadapter start= DEMAND binPath= ""C:\\TDengine\\taosadapter.exe""" ; Flags: runhidden
|
||||||
|
|
||||||
[UninstallRun]
|
[UninstallRun]
|
||||||
RunOnceId: "stoptaosd"; Filename: {sys}\sc.exe; Parameters: "stop taosd" ; Flags: runhidden
|
RunOnceId: "stoptaosd"; Filename: {sys}\sc.exe; Parameters: "stop taosd" ; Flags: runhidden
|
||||||
|
|
|
@ -1403,6 +1403,7 @@ SSDataBlock* createOneDataBlock(const SSDataBlock* pDataBlock, bool copyData) {
|
||||||
pBlock->info = pDataBlock->info;
|
pBlock->info = pDataBlock->info;
|
||||||
pBlock->info.rows = 0;
|
pBlock->info.rows = 0;
|
||||||
pBlock->info.capacity = 0;
|
pBlock->info.capacity = 0;
|
||||||
|
pBlock->info.rowSize = 0;
|
||||||
|
|
||||||
size_t numOfCols = taosArrayGetSize(pDataBlock->pDataBlock);
|
size_t numOfCols = taosArrayGetSize(pDataBlock->pDataBlock);
|
||||||
for (int32_t i = 0; i < numOfCols; ++i) {
|
for (int32_t i = 0; i < numOfCols; ++i) {
|
||||||
|
|
|
@ -4510,7 +4510,7 @@ int32_t tDeserializeSBatchReq(void *buf, int32_t bufLen, SBatchReq *pReq) {
|
||||||
if (tDecodeI32(&decoder, &msg.msgIdx) < 0) return -1;
|
if (tDecodeI32(&decoder, &msg.msgIdx) < 0) return -1;
|
||||||
if (tDecodeI32(&decoder, &msg.msgType) < 0) return -1;
|
if (tDecodeI32(&decoder, &msg.msgType) < 0) return -1;
|
||||||
if (tDecodeI32(&decoder, &msg.msgLen) < 0) return -1;
|
if (tDecodeI32(&decoder, &msg.msgLen) < 0) return -1;
|
||||||
if (tDecodeBinary(&decoder, (uint8_t**)&msg.msg, NULL) < 0) return -1;
|
if (tDecodeBinaryAlloc(&decoder, &msg.msg, NULL) < 0) return -1;
|
||||||
if (NULL == taosArrayPush(pReq->pMsgs, &msg)) return -1;
|
if (NULL == taosArrayPush(pReq->pMsgs, &msg)) return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -436,21 +436,24 @@ int64_t convertTimePrecision(int64_t utime, int32_t fromPrecision, int32_t toPre
|
||||||
ASSERT(toPrecision == TSDB_TIME_PRECISION_MILLI || toPrecision == TSDB_TIME_PRECISION_MICRO ||
|
ASSERT(toPrecision == TSDB_TIME_PRECISION_MILLI || toPrecision == TSDB_TIME_PRECISION_MICRO ||
|
||||||
toPrecision == TSDB_TIME_PRECISION_NANO);
|
toPrecision == TSDB_TIME_PRECISION_NANO);
|
||||||
|
|
||||||
double tempResult = (double)utime;
|
|
||||||
|
|
||||||
switch (fromPrecision) {
|
switch (fromPrecision) {
|
||||||
case TSDB_TIME_PRECISION_MILLI: {
|
case TSDB_TIME_PRECISION_MILLI: {
|
||||||
switch (toPrecision) {
|
switch (toPrecision) {
|
||||||
case TSDB_TIME_PRECISION_MILLI:
|
case TSDB_TIME_PRECISION_MILLI:
|
||||||
return utime;
|
return utime;
|
||||||
case TSDB_TIME_PRECISION_MICRO:
|
case TSDB_TIME_PRECISION_MICRO:
|
||||||
tempResult *= 1000;
|
if (utime > INT64_MAX / 1000) {
|
||||||
utime *= 1000;
|
return INT64_MAX;
|
||||||
goto end_;
|
}
|
||||||
|
return utime * 1000;
|
||||||
case TSDB_TIME_PRECISION_NANO:
|
case TSDB_TIME_PRECISION_NANO:
|
||||||
tempResult *= 1000000;
|
if (utime > INT64_MAX / 1000000) {
|
||||||
utime *= 1000000;
|
return INT64_MAX;
|
||||||
goto end_;
|
}
|
||||||
|
return utime * 1000000;
|
||||||
|
default:
|
||||||
|
ASSERT(0);
|
||||||
|
return utime;
|
||||||
}
|
}
|
||||||
} // end from milli
|
} // end from milli
|
||||||
case TSDB_TIME_PRECISION_MICRO: {
|
case TSDB_TIME_PRECISION_MICRO: {
|
||||||
|
@ -460,9 +463,13 @@ int64_t convertTimePrecision(int64_t utime, int32_t fromPrecision, int32_t toPre
|
||||||
case TSDB_TIME_PRECISION_MICRO:
|
case TSDB_TIME_PRECISION_MICRO:
|
||||||
return utime;
|
return utime;
|
||||||
case TSDB_TIME_PRECISION_NANO:
|
case TSDB_TIME_PRECISION_NANO:
|
||||||
tempResult *= 1000;
|
if (utime > INT64_MAX / 1000) {
|
||||||
utime *= 1000;
|
return INT64_MAX;
|
||||||
goto end_;
|
}
|
||||||
|
return utime * 1000;
|
||||||
|
default:
|
||||||
|
ASSERT(0);
|
||||||
|
return utime;
|
||||||
}
|
}
|
||||||
} // end from micro
|
} // end from micro
|
||||||
case TSDB_TIME_PRECISION_NANO: {
|
case TSDB_TIME_PRECISION_NANO: {
|
||||||
|
@ -473,17 +480,17 @@ int64_t convertTimePrecision(int64_t utime, int32_t fromPrecision, int32_t toPre
|
||||||
return utime / 1000;
|
return utime / 1000;
|
||||||
case TSDB_TIME_PRECISION_NANO:
|
case TSDB_TIME_PRECISION_NANO:
|
||||||
return utime;
|
return utime;
|
||||||
|
default:
|
||||||
|
ASSERT(0);
|
||||||
|
return utime;
|
||||||
}
|
}
|
||||||
} // end from nano
|
} // end from nano
|
||||||
default: {
|
default: {
|
||||||
assert(0);
|
ASSERT(0);
|
||||||
return utime; // only to pass windows compilation
|
return utime; // only to pass windows compilation
|
||||||
}
|
}
|
||||||
} // end switch fromPrecision
|
} // end switch fromPrecision
|
||||||
|
|
||||||
end_:
|
|
||||||
if (tempResult >= (double)INT64_MAX) return INT64_MAX;
|
|
||||||
if (tempResult <= (double)INT64_MIN) return INT64_MIN; // INT64_MIN means NULL
|
|
||||||
return utime;
|
return utime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -599,18 +606,33 @@ int32_t convertStringToTimestamp(int16_t type, char* inputData, int64_t timePrec
|
||||||
static int32_t getDuration(int64_t val, char unit, int64_t* result, int32_t timePrecision) {
|
static int32_t getDuration(int64_t val, char unit, int64_t* result, int32_t timePrecision) {
|
||||||
switch (unit) {
|
switch (unit) {
|
||||||
case 's':
|
case 's':
|
||||||
|
if (val > INT64_MAX / MILLISECOND_PER_SECOND) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
(*result) = convertTimePrecision(val * MILLISECOND_PER_SECOND, TSDB_TIME_PRECISION_MILLI, timePrecision);
|
(*result) = convertTimePrecision(val * MILLISECOND_PER_SECOND, TSDB_TIME_PRECISION_MILLI, timePrecision);
|
||||||
break;
|
break;
|
||||||
case 'm':
|
case 'm':
|
||||||
|
if (val > INT64_MAX / MILLISECOND_PER_MINUTE) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
(*result) = convertTimePrecision(val * MILLISECOND_PER_MINUTE, TSDB_TIME_PRECISION_MILLI, timePrecision);
|
(*result) = convertTimePrecision(val * MILLISECOND_PER_MINUTE, TSDB_TIME_PRECISION_MILLI, timePrecision);
|
||||||
break;
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
|
if (val > INT64_MAX / MILLISECOND_PER_MINUTE) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
(*result) = convertTimePrecision(val * MILLISECOND_PER_HOUR, TSDB_TIME_PRECISION_MILLI, timePrecision);
|
(*result) = convertTimePrecision(val * MILLISECOND_PER_HOUR, TSDB_TIME_PRECISION_MILLI, timePrecision);
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
|
if (val > INT64_MAX / MILLISECOND_PER_DAY) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
(*result) = convertTimePrecision(val * MILLISECOND_PER_DAY, TSDB_TIME_PRECISION_MILLI, timePrecision);
|
(*result) = convertTimePrecision(val * MILLISECOND_PER_DAY, TSDB_TIME_PRECISION_MILLI, timePrecision);
|
||||||
break;
|
break;
|
||||||
case 'w':
|
case 'w':
|
||||||
|
if (val > INT64_MAX / MILLISECOND_PER_WEEK) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
(*result) = convertTimePrecision(val * MILLISECOND_PER_WEEK, TSDB_TIME_PRECISION_MILLI, timePrecision);
|
(*result) = convertTimePrecision(val * MILLISECOND_PER_WEEK, TSDB_TIME_PRECISION_MILLI, timePrecision);
|
||||||
break;
|
break;
|
||||||
case 'a':
|
case 'a':
|
||||||
|
@ -650,7 +672,7 @@ int32_t parseAbsoluteDuration(const char* token, int32_t tokenlen, int64_t* dura
|
||||||
|
|
||||||
/* get the basic numeric value */
|
/* get the basic numeric value */
|
||||||
int64_t timestamp = taosStr2Int64(token, &endPtr, 10);
|
int64_t timestamp = taosStr2Int64(token, &endPtr, 10);
|
||||||
if (errno != 0) {
|
if (timestamp < 0 || errno != 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -668,7 +690,7 @@ int32_t parseNatualDuration(const char* token, int32_t tokenLen, int64_t* durati
|
||||||
|
|
||||||
/* get the basic numeric value */
|
/* get the basic numeric value */
|
||||||
*duration = taosStr2Int64(token, NULL, 10);
|
*duration = taosStr2Int64(token, NULL, 10);
|
||||||
if (errno != 0) {
|
if (*duration < 0 || errno != 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,7 @@ void taosVariantCreateFromBinary(SVariant *pVar, const char *pz, size_t len, uin
|
||||||
}
|
}
|
||||||
case TSDB_DATA_TYPE_FLOAT: {
|
case TSDB_DATA_TYPE_FLOAT: {
|
||||||
pVar->nLen = tDataTypes[type].bytes;
|
pVar->nLen = tDataTypes[type].bytes;
|
||||||
pVar->d = GET_FLOAT_VAL(pz);
|
pVar->f = GET_FLOAT_VAL(pz);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TSDB_DATA_TYPE_NCHAR: { // here we get the nchar length from raw binary bits length
|
case TSDB_DATA_TYPE_NCHAR: { // here we get the nchar length from raw binary bits length
|
||||||
|
@ -223,12 +223,18 @@ int32_t taosVariantCompare(const SVariant *p1, const SVariant *p2) {
|
||||||
} else {
|
} else {
|
||||||
return p1->nLen > p2->nLen ? 1 : -1;
|
return p1->nLen > p2->nLen ? 1 : -1;
|
||||||
}
|
}
|
||||||
} else if (p1->nType == TSDB_DATA_TYPE_FLOAT || p1->nType == TSDB_DATA_TYPE_DOUBLE) {
|
} else if (p1->nType == TSDB_DATA_TYPE_DOUBLE) {
|
||||||
if (p1->d == p2->d) {
|
if (p1->d == p2->d) {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
return p1->d > p2->d ? 1 : -1;
|
return p1->d > p2->d ? 1 : -1;
|
||||||
}
|
}
|
||||||
|
} else if (p1->nType == TSDB_DATA_TYPE_FLOAT) {
|
||||||
|
if (p1->f == p2->f) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
return p1->f > p2->f ? 1 : -1;
|
||||||
|
}
|
||||||
} else if (IS_UNSIGNED_NUMERIC_TYPE(p1->nType)) {
|
} else if (IS_UNSIGNED_NUMERIC_TYPE(p1->nType)) {
|
||||||
if (p1->u == p2->u) {
|
if (p1->u == p2->u) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -259,8 +265,9 @@ char *taosVariantGet(SVariant *pVar, int32_t type) {
|
||||||
case TSDB_DATA_TYPE_UBIGINT:
|
case TSDB_DATA_TYPE_UBIGINT:
|
||||||
return (char *)&pVar->u;
|
return (char *)&pVar->u;
|
||||||
case TSDB_DATA_TYPE_DOUBLE:
|
case TSDB_DATA_TYPE_DOUBLE:
|
||||||
case TSDB_DATA_TYPE_FLOAT:
|
|
||||||
return (char *)&pVar->d;
|
return (char *)&pVar->d;
|
||||||
|
case TSDB_DATA_TYPE_FLOAT:
|
||||||
|
return (char *)&pVar->f;
|
||||||
case TSDB_DATA_TYPE_BINARY:
|
case TSDB_DATA_TYPE_BINARY:
|
||||||
case TSDB_DATA_TYPE_JSON:
|
case TSDB_DATA_TYPE_JSON:
|
||||||
return (char *)pVar->pz;
|
return (char *)pVar->pz;
|
||||||
|
|
|
@ -56,6 +56,9 @@ static void mmProcessRpcMsg(SQueueInfo *pInfo, SRpcMsg *pMsg) {
|
||||||
if (IsReq(pMsg) && pMsg->info.handle != NULL && code != TSDB_CODE_ACTION_IN_PROGRESS) {
|
if (IsReq(pMsg) && pMsg->info.handle != NULL && code != TSDB_CODE_ACTION_IN_PROGRESS) {
|
||||||
if (code != 0 && terrno != 0) code = terrno;
|
if (code != 0 && terrno != 0) code = terrno;
|
||||||
mmSendRsp(pMsg, code);
|
mmSendRsp(pMsg, code);
|
||||||
|
} else {
|
||||||
|
rpcFreeCont(pMsg->info.rsp);
|
||||||
|
pMsg->info.rsp = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (code == TSDB_CODE_RPC_REDIRECT) {
|
if (code == TSDB_CODE_RPC_REDIRECT) {
|
||||||
|
|
|
@ -577,9 +577,9 @@ static int32_t mndCheckMnodeState(SRpcMsg *pMsg) {
|
||||||
|
|
||||||
int32_t contLen = tSerializeSEpSet(NULL, 0, &epSet);
|
int32_t contLen = tSerializeSEpSet(NULL, 0, &epSet);
|
||||||
pMsg->info.rsp = rpcMallocCont(contLen);
|
pMsg->info.rsp = rpcMallocCont(contLen);
|
||||||
pMsg->info.hasEpSet = 1;
|
|
||||||
if (pMsg->info.rsp != NULL) {
|
if (pMsg->info.rsp != NULL) {
|
||||||
tSerializeSEpSet(pMsg->info.rsp, contLen, &epSet);
|
tSerializeSEpSet(pMsg->info.rsp, contLen, &epSet);
|
||||||
|
pMsg->info.hasEpSet = 1;
|
||||||
pMsg->info.rspLen = contLen;
|
pMsg->info.rspLen = contLen;
|
||||||
terrno = TSDB_CODE_RPC_REDIRECT;
|
terrno = TSDB_CODE_RPC_REDIRECT;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -157,6 +157,7 @@ _exit:
|
||||||
mError("mnd get batch meta failed cause of %s", tstrerror(code));
|
mError("mnd get batch meta failed cause of %s", tstrerror(code));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
taosArrayDestroyEx(batchReq.pMsgs, tFreeSBatchReqMsg);
|
||||||
taosArrayDestroyEx(batchRsp.pRsps, mnodeFreeSBatchRspMsg);
|
taosArrayDestroyEx(batchRsp.pRsps, mnodeFreeSBatchRspMsg);
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
|
|
|
@ -1277,9 +1277,11 @@ static int32_t mndTransExecuteRedoActionsSerial(SMnode *pMnode, STrans *pTrans)
|
||||||
pAction->id);
|
pAction->id);
|
||||||
code = mndTransSync(pMnode, pTrans);
|
code = mndTransSync(pMnode, pTrans);
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
|
pTrans->redoActionPos--;
|
||||||
pTrans->code = terrno;
|
pTrans->code = terrno;
|
||||||
mError("trans:%d, %s:%d is executed and failed to sync to other mnodes since %s", pTrans->id,
|
mError("trans:%d, %s:%d is executed and failed to sync to other mnodes since %s", pTrans->id,
|
||||||
mndTransStr(pAction->stage), pAction->id, terrstr());
|
mndTransStr(pAction->stage), pAction->id, terrstr());
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else if (code == TSDB_CODE_ACTION_IN_PROGRESS) {
|
} else if (code == TSDB_CODE_ACTION_IN_PROGRESS) {
|
||||||
mInfo("trans:%d, %s:%d is in progress and wait it finish", pTrans->id, mndTransStr(pAction->stage), pAction->id);
|
mInfo("trans:%d, %s:%d is in progress and wait it finish", pTrans->id, mndTransStr(pAction->stage), pAction->id);
|
||||||
|
|
|
@ -1739,6 +1739,7 @@ static int32_t mndSplitVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SVgObj
|
||||||
code = 0;
|
code = 0;
|
||||||
|
|
||||||
_OVER:
|
_OVER:
|
||||||
|
taosArrayDestroy(pArray);
|
||||||
mndTransDrop(pTrans);
|
mndTransDrop(pTrans);
|
||||||
sdbFreeRaw(pRaw);
|
sdbFreeRaw(pRaw);
|
||||||
return code;
|
return code;
|
||||||
|
@ -1907,6 +1908,7 @@ static int32_t mndBalanceVgroup(SMnode *pMnode, SRpcMsg *pReq, SArray *pArray) {
|
||||||
}
|
}
|
||||||
|
|
||||||
_OVER:
|
_OVER:
|
||||||
|
taosHashCleanup(pBalancedVgroups);
|
||||||
mndTransDrop(pTrans);
|
mndTransDrop(pTrans);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
|
@ -403,6 +403,11 @@ int metaCreateTable(SMeta *pMeta, int64_t version, SVCreateTbReq *pReq, STableMe
|
||||||
// validate req
|
// validate req
|
||||||
metaReaderInit(&mr, pMeta, 0);
|
metaReaderInit(&mr, pMeta, 0);
|
||||||
if (metaGetTableEntryByName(&mr, pReq->name) == 0) {
|
if (metaGetTableEntryByName(&mr, pReq->name) == 0) {
|
||||||
|
if (pReq->type == TSDB_CHILD_TABLE && pReq->ctb.suid != mr.me.ctbEntry.suid) {
|
||||||
|
terrno = TSDB_CODE_TDB_TABLE_IN_OTHER_STABLE;
|
||||||
|
metaReaderClear(&mr);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
pReq->uid = mr.me.uid;
|
pReq->uid = mr.me.uid;
|
||||||
if (pReq->type == TSDB_CHILD_TABLE) {
|
if (pReq->type == TSDB_CHILD_TABLE) {
|
||||||
pReq->ctb.suid = mr.me.ctbEntry.suid;
|
pReq->ctb.suid = mr.me.ctbEntry.suid;
|
||||||
|
|
|
@ -398,6 +398,35 @@ bool tqNextDataBlock(STqReader* pReader) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t tqMaskBlock(SSchemaWrapper* pDst, SSDataBlock* pBlock, const SSchemaWrapper* pSrc, char* mask) {
|
||||||
|
int32_t code;
|
||||||
|
|
||||||
|
int32_t cnt = 0;
|
||||||
|
for (int32_t i = 0; i < pSrc->nCols; i++) {
|
||||||
|
cnt += mask[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
pDst->nCols = cnt;
|
||||||
|
pDst->pSchema = taosMemoryCalloc(cnt, sizeof(SSchema));
|
||||||
|
if (pDst->pSchema == NULL) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t j = 0;
|
||||||
|
for (int32_t i = 0; i < pSrc->nCols; i++) {
|
||||||
|
if (mask[i]) {
|
||||||
|
pDst->pSchema[j++] = pSrc->pSchema[i];
|
||||||
|
SColumnInfoData colInfo =
|
||||||
|
createColumnInfoData(pSrc->pSchema[i].type, pSrc->pSchema[i].bytes, pSrc->pSchema[i].colId);
|
||||||
|
code = blockDataAppendColInfo(pBlock, &colInfo);
|
||||||
|
if (code != 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
bool tqNextDataBlockFilterOut(STqReader* pHandle, SHashObj* filterOutUids) {
|
bool tqNextDataBlockFilterOut(STqReader* pHandle, SHashObj* filterOutUids) {
|
||||||
while (1) {
|
while (1) {
|
||||||
if (tGetSubmitMsgNext(&pHandle->msgIter, &pHandle->pBlock) < 0) {
|
if (tGetSubmitMsgNext(&pHandle->msgIter, &pHandle->pBlock) < 0) {
|
||||||
|
@ -527,6 +556,119 @@ FAIL:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t tqSplitRetrieveDataBlock(STqReader* pReader, SArray* blocks, SArray* schemas) {
|
||||||
|
int32_t sversion = htonl(pReader->pBlock->sversion);
|
||||||
|
|
||||||
|
if (pReader->cachedSchemaSuid == 0 || pReader->cachedSchemaVer != sversion ||
|
||||||
|
pReader->cachedSchemaSuid != pReader->msgIter.suid) {
|
||||||
|
if (pReader->pSchema) taosMemoryFree(pReader->pSchema);
|
||||||
|
pReader->pSchema = metaGetTbTSchema(pReader->pVnodeMeta, pReader->msgIter.uid, sversion, 1);
|
||||||
|
if (pReader->pSchema == NULL) {
|
||||||
|
tqWarn("cannot found tsschema for table: uid:%" PRId64 " (suid:%" PRId64 "), version %d, possibly dropped table",
|
||||||
|
pReader->msgIter.uid, pReader->msgIter.suid, pReader->cachedSchemaVer);
|
||||||
|
/*ASSERT(0);*/
|
||||||
|
pReader->cachedSchemaSuid = 0;
|
||||||
|
terrno = TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pReader->pSchemaWrapper) tDeleteSSchemaWrapper(pReader->pSchemaWrapper);
|
||||||
|
pReader->pSchemaWrapper = metaGetTableSchema(pReader->pVnodeMeta, pReader->msgIter.uid, sversion, 1);
|
||||||
|
if (pReader->pSchemaWrapper == NULL) {
|
||||||
|
tqWarn("cannot found schema wrapper for table: suid:%" PRId64 ", version %d, possibly dropped table",
|
||||||
|
pReader->msgIter.uid, pReader->cachedSchemaVer);
|
||||||
|
/*ASSERT(0);*/
|
||||||
|
pReader->cachedSchemaSuid = 0;
|
||||||
|
terrno = TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
pReader->cachedSchemaVer = sversion;
|
||||||
|
pReader->cachedSchemaSuid = pReader->msgIter.suid;
|
||||||
|
}
|
||||||
|
|
||||||
|
STSchema* pTschema = pReader->pSchema;
|
||||||
|
SSchemaWrapper* pSchemaWrapper = pReader->pSchemaWrapper;
|
||||||
|
|
||||||
|
int32_t colAtMost = pSchemaWrapper->nCols;
|
||||||
|
|
||||||
|
int32_t curRow = 0;
|
||||||
|
|
||||||
|
char* assigned = taosMemoryCalloc(1, pSchemaWrapper->nCols);
|
||||||
|
if (assigned) return -1;
|
||||||
|
|
||||||
|
tInitSubmitBlkIter(&pReader->msgIter, pReader->pBlock, &pReader->blkIter);
|
||||||
|
STSRowIter iter = {0};
|
||||||
|
tdSTSRowIterInit(&iter, pTschema);
|
||||||
|
STSRow* row;
|
||||||
|
|
||||||
|
while ((row = tGetSubmitBlkNext(&pReader->blkIter)) != NULL) {
|
||||||
|
bool buildNew = false;
|
||||||
|
tdSTSRowIterReset(&iter, row);
|
||||||
|
|
||||||
|
for (int32_t i = 0; i < colAtMost; i++) {
|
||||||
|
SCellVal sVal = {0};
|
||||||
|
if (!tdSTSRowIterFetch(&iter, pSchemaWrapper->pSchema[i].colId, pSchemaWrapper->pSchema[i].type, &sVal)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (curRow == 0) {
|
||||||
|
assigned[i] = sVal.valType != TD_VTYPE_NONE;
|
||||||
|
buildNew = true;
|
||||||
|
} else {
|
||||||
|
bool currentRowAssigned = sVal.valType != TD_VTYPE_NONE;
|
||||||
|
if (currentRowAssigned != assigned[i]) {
|
||||||
|
assigned[i] = currentRowAssigned;
|
||||||
|
buildNew = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (buildNew) {
|
||||||
|
SSDataBlock block;
|
||||||
|
SSchemaWrapper sw;
|
||||||
|
if (tqMaskBlock(&sw, &block, pSchemaWrapper, assigned) < 0) {
|
||||||
|
goto FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
taosArrayPush(blocks, &block);
|
||||||
|
taosArrayPush(schemas, &sw);
|
||||||
|
}
|
||||||
|
|
||||||
|
SSDataBlock* pBlock = taosArrayGetLast(blocks);
|
||||||
|
pBlock->info.uid = pReader->msgIter.uid;
|
||||||
|
pBlock->info.rows = pReader->msgIter.numOfRows;
|
||||||
|
pBlock->info.version = pReader->pMsg->version;
|
||||||
|
|
||||||
|
if (blockDataEnsureCapacity(pBlock, pReader->msgIter.numOfRows - curRow) < 0) {
|
||||||
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
goto FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
tdSTSRowIterInit(&iter, pTschema);
|
||||||
|
for (int32_t i = 0; i < taosArrayGetSize(pBlock->pDataBlock); i++) {
|
||||||
|
SColumnInfoData* pColData = taosArrayGet(pBlock->pDataBlock, i);
|
||||||
|
SCellVal sVal = {0};
|
||||||
|
|
||||||
|
if (!tdSTSRowIterFetch(&iter, pColData->info.colId, pColData->info.type, &sVal)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
ASSERT(sVal.valType != TD_VTYPE_NONE);
|
||||||
|
|
||||||
|
if (colDataAppend(pColData, curRow, sVal.val, sVal.valType != TD_VTYPE_NORM) < 0) {
|
||||||
|
goto FAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
curRow++;
|
||||||
|
}
|
||||||
|
|
||||||
|
taosMemoryFree(assigned);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
FAIL:
|
||||||
|
taosMemoryFree(assigned);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
void tqReaderSetColIdList(STqReader* pReader, SArray* pColIdList) { pReader->pColIdList = pColIdList; }
|
void tqReaderSetColIdList(STqReader* pReader, SArray* pColIdList) { pReader->pColIdList = pColIdList; }
|
||||||
|
|
||||||
int tqReaderSetTbUidList(STqReader* pReader, const SArray* tbUidList) {
|
int tqReaderSetTbUidList(STqReader* pReader, const SArray* tbUidList) {
|
||||||
|
|
|
@ -49,7 +49,7 @@ int tsdbOpen(SVnode *pVnode, STsdb **ppTsdb, const char *dir, STsdbKeepCfg *pKee
|
||||||
|
|
||||||
pTsdb->path = (char *)&pTsdb[1];
|
pTsdb->path = (char *)&pTsdb[1];
|
||||||
snprintf(pTsdb->path, TD_PATH_MAX, "%s%s%s", pVnode->path, TD_DIRSEP, dir);
|
snprintf(pTsdb->path, TD_PATH_MAX, "%s%s%s", pVnode->path, TD_DIRSEP, dir);
|
||||||
taosRealPath(pTsdb->path, NULL, slen);
|
// taosRealPath(pTsdb->path, NULL, slen);
|
||||||
pTsdb->pVnode = pVnode;
|
pTsdb->pVnode = pVnode;
|
||||||
taosThreadRwlockInit(&pTsdb->rwLock, NULL);
|
taosThreadRwlockInit(&pTsdb->rwLock, NULL);
|
||||||
if (!pKeepCfg) {
|
if (!pKeepCfg) {
|
||||||
|
|
|
@ -1698,7 +1698,7 @@ int32_t tsdbCmprColData(SColData *pColData, int8_t cmprAlg, SBlockCol *pBlockCol
|
||||||
size += pBlockCol->szBitmap;
|
size += pBlockCol->szBitmap;
|
||||||
|
|
||||||
// offset
|
// offset
|
||||||
if (IS_VAR_DATA_TYPE(pColData->type)) {
|
if (IS_VAR_DATA_TYPE(pColData->type) && pColData->flag != (HAS_NULL | HAS_NONE)) {
|
||||||
code = tsdbCmprData((uint8_t *)pColData->aOffset, sizeof(int32_t) * pColData->nVal, TSDB_DATA_TYPE_INT, cmprAlg,
|
code = tsdbCmprData((uint8_t *)pColData->aOffset, sizeof(int32_t) * pColData->nVal, TSDB_DATA_TYPE_INT, cmprAlg,
|
||||||
ppOut, nOut + size, &pBlockCol->szOffset, ppBuf);
|
ppOut, nOut + size, &pBlockCol->szOffset, ppBuf);
|
||||||
if (code) goto _exit;
|
if (code) goto _exit;
|
||||||
|
|
|
@ -366,6 +366,7 @@ _exit:
|
||||||
qError("vnd get batch meta failed cause of %s", tstrerror(code));
|
qError("vnd get batch meta failed cause of %s", tstrerror(code));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
taosArrayDestroyEx(batchReq.pMsgs, tFreeSBatchReqMsg);
|
||||||
taosArrayDestroyEx(batchRsp.pRsps, tFreeSBatchRspMsg);
|
taosArrayDestroyEx(batchRsp.pRsps, tFreeSBatchRspMsg);
|
||||||
|
|
||||||
tmsgSendRsp(&rspMsg);
|
tmsgSendRsp(&rspMsg);
|
||||||
|
|
|
@ -163,7 +163,7 @@ typedef struct {
|
||||||
SArray* pStopInfo;
|
SArray* pStopInfo;
|
||||||
} STaskStopInfo;
|
} STaskStopInfo;
|
||||||
|
|
||||||
typedef struct SExecTaskInfo {
|
struct SExecTaskInfo {
|
||||||
STaskIdInfo id;
|
STaskIdInfo id;
|
||||||
uint32_t status;
|
uint32_t status;
|
||||||
STimeWindow window;
|
STimeWindow window;
|
||||||
|
@ -182,7 +182,7 @@ typedef struct SExecTaskInfo {
|
||||||
struct SOperatorInfo* pRoot;
|
struct SOperatorInfo* pRoot;
|
||||||
SLocalFetch localFetch;
|
SLocalFetch localFetch;
|
||||||
STaskStopInfo stopInfo;
|
STaskStopInfo stopInfo;
|
||||||
} SExecTaskInfo;
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
OP_NOT_OPENED = 0x0,
|
OP_NOT_OPENED = 0x0,
|
||||||
|
@ -315,37 +315,39 @@ typedef struct STableMetaCacheInfo {
|
||||||
uint64_t cacheHit;
|
uint64_t cacheHit;
|
||||||
} STableMetaCacheInfo;
|
} STableMetaCacheInfo;
|
||||||
|
|
||||||
typedef struct STableScanInfo {
|
typedef struct STableScanBase {
|
||||||
STsdbReader* dataReader;
|
STsdbReader* dataReader;
|
||||||
SReadHandle readHandle;
|
|
||||||
SLimitInfo limitInfo;
|
|
||||||
SFileBlockLoadRecorder readRecorder;
|
SFileBlockLoadRecorder readRecorder;
|
||||||
|
SQueryTableDataCond cond;
|
||||||
|
SAggOptrPushDownInfo pdInfo;
|
||||||
|
SColMatchInfo matchInfo;
|
||||||
|
SReadHandle readHandle;
|
||||||
|
SExprSupp pseudoSup;
|
||||||
|
STableMetaCacheInfo metaCache;
|
||||||
|
int32_t scanFlag; // table scan flag to denote if it is a repeat/reverse/main scan
|
||||||
|
int32_t dataBlockLoadFlag;
|
||||||
|
SLimitInfo limitInfo;
|
||||||
|
} STableScanBase;
|
||||||
|
|
||||||
|
typedef struct STableScanInfo {
|
||||||
|
STableScanBase base;
|
||||||
SScanInfo scanInfo;
|
SScanInfo scanInfo;
|
||||||
int32_t scanTimes;
|
int32_t scanTimes;
|
||||||
SSDataBlock* pResBlock;
|
SSDataBlock* pResBlock;
|
||||||
SColMatchInfo matchInfo;
|
|
||||||
SExprSupp pseudoSup;
|
|
||||||
SQueryTableDataCond cond;
|
|
||||||
int32_t scanFlag; // table scan flag to denote if it is a repeat/reverse/main scan
|
|
||||||
int32_t dataBlockLoadFlag;
|
|
||||||
SSampleExecInfo sample; // sample execution info
|
SSampleExecInfo sample; // sample execution info
|
||||||
int32_t currentGroupId;
|
int32_t currentGroupId;
|
||||||
int32_t currentTable;
|
int32_t currentTable;
|
||||||
int8_t scanMode;
|
int8_t scanMode;
|
||||||
SAggOptrPushDownInfo pdInfo;
|
|
||||||
int8_t assignBlockUid;
|
int8_t assignBlockUid;
|
||||||
STableMetaCacheInfo metaCache;
|
|
||||||
} STableScanInfo;
|
} STableScanInfo;
|
||||||
|
|
||||||
typedef struct STableMergeScanInfo {
|
typedef struct STableMergeScanInfo {
|
||||||
STableListInfo* tableListInfo;
|
|
||||||
int32_t tableStartIndex;
|
int32_t tableStartIndex;
|
||||||
int32_t tableEndIndex;
|
int32_t tableEndIndex;
|
||||||
bool hasGroupId;
|
bool hasGroupId;
|
||||||
uint64_t groupId;
|
uint64_t groupId;
|
||||||
SArray* queryConds; // array of queryTableDataCond
|
SArray* queryConds; // array of queryTableDataCond
|
||||||
STsdbReader* pReader;
|
STableScanBase base;
|
||||||
SReadHandle readHandle;
|
|
||||||
int32_t bufPageSize;
|
int32_t bufPageSize;
|
||||||
uint32_t sortBufSize; // max buffer size for in-memory sort
|
uint32_t sortBufSize; // max buffer size for in-memory sort
|
||||||
SArray* pSortInfo;
|
SArray* pSortInfo;
|
||||||
|
@ -354,27 +356,12 @@ typedef struct STableMergeScanInfo {
|
||||||
int64_t startTs; // sort start time
|
int64_t startTs; // sort start time
|
||||||
SArray* sortSourceParams;
|
SArray* sortSourceParams;
|
||||||
SLimitInfo limitInfo;
|
SLimitInfo limitInfo;
|
||||||
SFileBlockLoadRecorder readRecorder;
|
|
||||||
int64_t numOfRows;
|
int64_t numOfRows;
|
||||||
SScanInfo scanInfo;
|
SScanInfo scanInfo;
|
||||||
int32_t scanTimes;
|
int32_t scanTimes;
|
||||||
SqlFunctionCtx* pCtx; // which belongs to the direct upstream operator operator query context
|
|
||||||
SResultRowInfo* pResultRowInfo;
|
|
||||||
int32_t* rowEntryInfoOffset;
|
|
||||||
SExprInfo* pExpr;
|
|
||||||
SSDataBlock* pResBlock;
|
SSDataBlock* pResBlock;
|
||||||
SColMatchInfo matchInfo;
|
SSampleExecInfo sample; // sample execution info
|
||||||
int32_t numOfOutput;
|
SSortExecInfo sortExecInfo;
|
||||||
SExprSupp pseudoSup;
|
|
||||||
SQueryTableDataCond cond;
|
|
||||||
int32_t scanFlag; // table scan flag to denote if it is a repeat/reverse/main scan
|
|
||||||
int32_t dataBlockLoadFlag;
|
|
||||||
|
|
||||||
// if the upstream is an interval operator, the interval info is also kept here to get the time
|
|
||||||
// window to check if current data block needs to be loaded.
|
|
||||||
SInterval interval;
|
|
||||||
SSampleExecInfo sample; // sample execution info
|
|
||||||
SSortExecInfo sortExecInfo;
|
|
||||||
} STableMergeScanInfo;
|
} STableMergeScanInfo;
|
||||||
|
|
||||||
typedef struct STagScanInfo {
|
typedef struct STagScanInfo {
|
||||||
|
@ -387,17 +374,17 @@ typedef struct STagScanInfo {
|
||||||
} STagScanInfo;
|
} STagScanInfo;
|
||||||
|
|
||||||
typedef struct SLastrowScanInfo {
|
typedef struct SLastrowScanInfo {
|
||||||
SSDataBlock* pRes;
|
SSDataBlock* pRes;
|
||||||
SReadHandle readHandle;
|
SReadHandle readHandle;
|
||||||
void* pLastrowReader;
|
void* pLastrowReader;
|
||||||
SColMatchInfo matchInfo;
|
SColMatchInfo matchInfo;
|
||||||
int32_t* pSlotIds;
|
int32_t* pSlotIds;
|
||||||
SExprSupp pseudoExprSup;
|
SExprSupp pseudoExprSup;
|
||||||
int32_t retrieveType;
|
int32_t retrieveType;
|
||||||
int32_t currentGroupIndex;
|
int32_t currentGroupIndex;
|
||||||
SSDataBlock* pBufferredRes;
|
SSDataBlock* pBufferredRes;
|
||||||
SArray* pUidList;
|
SArray* pUidList;
|
||||||
int32_t indexOfBufferedRes;
|
int32_t indexOfBufferedRes;
|
||||||
} SLastrowScanInfo;
|
} SLastrowScanInfo;
|
||||||
|
|
||||||
typedef enum EStreamScanMode {
|
typedef enum EStreamScanMode {
|
||||||
|
@ -414,13 +401,6 @@ enum {
|
||||||
PROJECT_RETRIEVE_DONE = 0x2,
|
PROJECT_RETRIEVE_DONE = 0x2,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct SCatchSupporter {
|
|
||||||
SHashObj* pWindowHashTable; // quick locate the window object for each window
|
|
||||||
SDiskbasedBuf* pDataBuf; // buffer based on blocked-wised disk file
|
|
||||||
int32_t keySize;
|
|
||||||
int64_t* pKeyBuf;
|
|
||||||
} SCatchSupporter;
|
|
||||||
|
|
||||||
typedef struct SStreamAggSupporter {
|
typedef struct SStreamAggSupporter {
|
||||||
int32_t resultRowSize; // the result buffer size for each result row, with the meta data size for each row
|
int32_t resultRowSize; // the result buffer size for each result row, with the meta data size for each row
|
||||||
SSDataBlock* pScanBlock;
|
SSDataBlock* pScanBlock;
|
||||||
|
@ -504,7 +484,6 @@ typedef struct SStreamScanInfo {
|
||||||
STimeWindow updateWin;
|
STimeWindow updateWin;
|
||||||
STimeWindowAggSupp twAggSup;
|
STimeWindowAggSupp twAggSup;
|
||||||
SSDataBlock* pUpdateDataRes;
|
SSDataBlock* pUpdateDataRes;
|
||||||
SHashObj* pGroupIdTbNameMap;
|
|
||||||
// status for tmq
|
// status for tmq
|
||||||
SNodeList* pGroupTags;
|
SNodeList* pGroupTags;
|
||||||
SNode* pTagCond;
|
SNode* pTagCond;
|
||||||
|
@ -612,7 +591,6 @@ typedef struct SStreamIntervalOperatorInfo {
|
||||||
SArray* pChildren;
|
SArray* pChildren;
|
||||||
SStreamState* pState;
|
SStreamState* pState;
|
||||||
SWinKey delKey;
|
SWinKey delKey;
|
||||||
SHashObj* pGroupIdTbNameMap; // uint64_t -> char[TSDB_TABLE_NAME_LEN]
|
|
||||||
} SStreamIntervalOperatorInfo;
|
} SStreamIntervalOperatorInfo;
|
||||||
|
|
||||||
typedef struct SAggOperatorInfo {
|
typedef struct SAggOperatorInfo {
|
||||||
|
@ -745,7 +723,6 @@ typedef struct SStreamSessionAggOperatorInfo {
|
||||||
SPhysiNode* pPhyNode; // create new child
|
SPhysiNode* pPhyNode; // create new child
|
||||||
bool isFinal;
|
bool isFinal;
|
||||||
bool ignoreExpiredData;
|
bool ignoreExpiredData;
|
||||||
SHashObj* pGroupIdTbNameMap;
|
|
||||||
} SStreamSessionAggOperatorInfo;
|
} SStreamSessionAggOperatorInfo;
|
||||||
|
|
||||||
typedef struct SStreamStateAggOperatorInfo {
|
typedef struct SStreamStateAggOperatorInfo {
|
||||||
|
@ -761,7 +738,6 @@ typedef struct SStreamStateAggOperatorInfo {
|
||||||
void* pDelIterator;
|
void* pDelIterator;
|
||||||
SArray* pChildren; // cache for children's result;
|
SArray* pChildren; // cache for children's result;
|
||||||
bool ignoreExpiredData;
|
bool ignoreExpiredData;
|
||||||
SHashObj* pGroupIdTbNameMap;
|
|
||||||
} SStreamStateAggOperatorInfo;
|
} SStreamStateAggOperatorInfo;
|
||||||
|
|
||||||
typedef struct SStreamPartitionOperatorInfo {
|
typedef struct SStreamPartitionOperatorInfo {
|
||||||
|
@ -800,7 +776,6 @@ typedef struct STimeSliceOperatorInfo {
|
||||||
SArray* pPrevRow; // SArray<SGroupValue>
|
SArray* pPrevRow; // SArray<SGroupValue>
|
||||||
SArray* pNextRow; // SArray<SGroupValue>
|
SArray* pNextRow; // SArray<SGroupValue>
|
||||||
SArray* pLinearInfo; // SArray<SFillLinearInfo>
|
SArray* pLinearInfo; // SArray<SFillLinearInfo>
|
||||||
bool fillLastPoint;
|
|
||||||
bool isPrevRowSet;
|
bool isPrevRowSet;
|
||||||
bool isNextRowSet;
|
bool isNextRowSet;
|
||||||
int32_t fillType; // fill type
|
int32_t fillType; // fill type
|
||||||
|
@ -1046,8 +1021,8 @@ int32_t finalizeResultRows(SDiskbasedBuf* pBuf, SResultRowPosition* resultRowPos
|
||||||
|
|
||||||
SOperatorInfo* createGroupSortOperatorInfo(SOperatorInfo* downstream, SGroupSortPhysiNode* pSortPhyNode,
|
SOperatorInfo* createGroupSortOperatorInfo(SOperatorInfo* downstream, SGroupSortPhysiNode* pSortPhyNode,
|
||||||
SExecTaskInfo* pTaskInfo);
|
SExecTaskInfo* pTaskInfo);
|
||||||
SOperatorInfo* createTableMergeScanOperatorInfo(STableScanPhysiNode* pTableScanNode, STableListInfo* pTableListInfo,
|
SOperatorInfo* createTableMergeScanOperatorInfo(STableScanPhysiNode* pTableScanNode, SReadHandle* readHandle,
|
||||||
SReadHandle* readHandle, SExecTaskInfo* pTaskInfo);
|
SExecTaskInfo* pTaskInfo);
|
||||||
|
|
||||||
void copyUpdateDataBlock(SSDataBlock* pDest, SSDataBlock* pSource, int32_t tsColIndex);
|
void copyUpdateDataBlock(SSDataBlock* pDest, SSDataBlock* pSource, int32_t tsColIndex);
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,8 @@ typedef struct SFillColInfo {
|
||||||
typedef struct SFillLinearInfo {
|
typedef struct SFillLinearInfo {
|
||||||
SPoint start;
|
SPoint start;
|
||||||
SPoint end;
|
SPoint end;
|
||||||
bool hasNull;
|
bool isStartSet;
|
||||||
|
bool isEndSet;
|
||||||
int16_t type;
|
int16_t type;
|
||||||
int32_t bytes;
|
int32_t bytes;
|
||||||
} SFillLinearInfo;
|
} SFillLinearInfo;
|
||||||
|
|
|
@ -163,9 +163,10 @@ SSortExecInfo tsortGetSortExecInfo(SSortHandle* pHandle);
|
||||||
/**
|
/**
|
||||||
* get proper sort buffer pages according to the row size
|
* get proper sort buffer pages according to the row size
|
||||||
* @param rowSize
|
* @param rowSize
|
||||||
|
* @param numOfCols columns count that be put into page
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int32_t getProperSortPageSize(size_t rowSize);
|
int32_t getProperSortPageSize(size_t rowSize, uint32_t numOfCols);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -1026,8 +1026,8 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT
|
||||||
SStreamScanInfo* pInfo = pOperator->info;
|
SStreamScanInfo* pInfo = pOperator->info;
|
||||||
if (pOffset->type == TMQ_OFFSET__LOG) {
|
if (pOffset->type == TMQ_OFFSET__LOG) {
|
||||||
STableScanInfo* pTSInfo = pInfo->pTableScanOp->info;
|
STableScanInfo* pTSInfo = pInfo->pTableScanOp->info;
|
||||||
tsdbReaderClose(pTSInfo->dataReader);
|
tsdbReaderClose(pTSInfo->base.dataReader);
|
||||||
pTSInfo->dataReader = NULL;
|
pTSInfo->base.dataReader = NULL;
|
||||||
#if 0
|
#if 0
|
||||||
if (tOffsetEqual(pOffset, &pTaskInfo->streamInfo.lastStatus) &&
|
if (tOffsetEqual(pOffset, &pTaskInfo->streamInfo.lastStatus) &&
|
||||||
pInfo->tqReader->pWalReader->curVersion != pOffset->version) {
|
pInfo->tqReader->pWalReader->curVersion != pOffset->version) {
|
||||||
|
@ -1079,23 +1079,23 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT
|
||||||
// TODO after dropping table, table may not found
|
// TODO after dropping table, table may not found
|
||||||
ASSERT(found);
|
ASSERT(found);
|
||||||
|
|
||||||
if (pTableScanInfo->dataReader == NULL) {
|
if (pTableScanInfo->base.dataReader == NULL) {
|
||||||
STableKeyInfo* pList = tableListGetInfo(pTaskInfo->pTableInfoList, 0);
|
STableKeyInfo* pList = tableListGetInfo(pTaskInfo->pTableInfoList, 0);
|
||||||
int32_t num = tableListGetSize(pTaskInfo->pTableInfoList);
|
int32_t num = tableListGetSize(pTaskInfo->pTableInfoList);
|
||||||
|
|
||||||
if (tsdbReaderOpen(pTableScanInfo->readHandle.vnode, &pTableScanInfo->cond, pList, num,
|
if (tsdbReaderOpen(pTableScanInfo->base.readHandle.vnode, &pTableScanInfo->base.cond, pList, num,
|
||||||
&pTableScanInfo->dataReader, NULL) < 0 ||
|
&pTableScanInfo->base.dataReader, NULL) < 0 ||
|
||||||
pTableScanInfo->dataReader == NULL) {
|
pTableScanInfo->base.dataReader == NULL) {
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
STableKeyInfo tki = {.uid = uid};
|
STableKeyInfo tki = {.uid = uid};
|
||||||
tsdbSetTableList(pTableScanInfo->dataReader, &tki, 1);
|
tsdbSetTableList(pTableScanInfo->base.dataReader, &tki, 1);
|
||||||
int64_t oldSkey = pTableScanInfo->cond.twindows.skey;
|
int64_t oldSkey = pTableScanInfo->base.cond.twindows.skey;
|
||||||
pTableScanInfo->cond.twindows.skey = ts + 1;
|
pTableScanInfo->base.cond.twindows.skey = ts + 1;
|
||||||
tsdbReaderReset(pTableScanInfo->dataReader, &pTableScanInfo->cond);
|
tsdbReaderReset(pTableScanInfo->base.dataReader, &pTableScanInfo->base.cond);
|
||||||
pTableScanInfo->cond.twindows.skey = oldSkey;
|
pTableScanInfo->base.cond.twindows.skey = oldSkey;
|
||||||
pTableScanInfo->scanTimes = 0;
|
pTableScanInfo->scanTimes = 0;
|
||||||
|
|
||||||
qDebug("tsdb reader offset seek to uid %" PRId64 " ts %" PRId64 ", table cur set to %d , all table num %d", uid,
|
qDebug("tsdb reader offset seek to uid %" PRId64 " ts %" PRId64 ", table cur set to %d , all table num %d", uid,
|
||||||
|
|
|
@ -1000,12 +1000,6 @@ int32_t loadDataBlockOnDemand(SExecTaskInfo* pTaskInfo, STableScanInfo* pTableSc
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void updateTableQueryInfoForReverseScan(STableQueryInfo* pTableQueryInfo) {
|
|
||||||
if (pTableQueryInfo == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void setTaskStatus(SExecTaskInfo* pTaskInfo, int8_t status) {
|
void setTaskStatus(SExecTaskInfo* pTaskInfo, int8_t status) {
|
||||||
if (status == TASK_NOT_COMPLETED) {
|
if (status == TASK_NOT_COMPLETED) {
|
||||||
pTaskInfo->status = status;
|
pTaskInfo->status = status;
|
||||||
|
@ -1054,7 +1048,7 @@ void doFilter(SSDataBlock* pBlock, SFilterInfo* pFilterInfo, SColMatchInfo* pCol
|
||||||
}
|
}
|
||||||
|
|
||||||
SFilterColumnParam param1 = {.numOfCols = taosArrayGetSize(pBlock->pDataBlock), .pDataBlock = pBlock->pDataBlock};
|
SFilterColumnParam param1 = {.numOfCols = taosArrayGetSize(pBlock->pDataBlock), .pDataBlock = pBlock->pDataBlock};
|
||||||
int32_t code = filterSetDataFromSlotId(pFilterInfo, ¶m1);
|
int32_t code = filterSetDataFromSlotId(pFilterInfo, ¶m1);
|
||||||
|
|
||||||
SColumnInfoData* p = NULL;
|
SColumnInfoData* p = NULL;
|
||||||
int32_t status = 0;
|
int32_t status = 0;
|
||||||
|
@ -1064,7 +1058,7 @@ void doFilter(SSDataBlock* pBlock, SFilterInfo* pFilterInfo, SColMatchInfo* pCol
|
||||||
extractQualifiedTupleByFilterResult(pBlock, p, keep, status);
|
extractQualifiedTupleByFilterResult(pBlock, p, keep, status);
|
||||||
|
|
||||||
if (pColMatchInfo != NULL) {
|
if (pColMatchInfo != NULL) {
|
||||||
size_t size = taosArrayGetSize(pColMatchInfo->pList);
|
size_t size = taosArrayGetSize(pColMatchInfo->pList);
|
||||||
for (int32_t i = 0; i < size; ++i) {
|
for (int32_t i = 0; i < size; ++i) {
|
||||||
SColMatchItem* pInfo = taosArrayGet(pColMatchInfo->pList, i);
|
SColMatchItem* pInfo = taosArrayGet(pColMatchInfo->pList, i);
|
||||||
if (pInfo->colId == PRIMARYKEY_TIMESTAMP_COL_ID) {
|
if (pInfo->colId == PRIMARYKEY_TIMESTAMP_COL_ID) {
|
||||||
|
@ -1336,27 +1330,14 @@ void doBuildStreamResBlock(SOperatorInfo* pOperator, SOptrBasicInfo* pbInfo, SGr
|
||||||
pBlock->info.groupId = 0;
|
pBlock->info.groupId = 0;
|
||||||
ASSERT(!pbInfo->mergeResultBlock);
|
ASSERT(!pbInfo->mergeResultBlock);
|
||||||
doCopyToSDataBlock(pTaskInfo, pBlock, &pOperator->exprSupp, pBuf, pGroupResInfo);
|
doCopyToSDataBlock(pTaskInfo, pBlock, &pOperator->exprSupp, pBuf, pGroupResInfo);
|
||||||
if (pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE) {
|
|
||||||
SStreamStateAggOperatorInfo* pInfo = pOperator->info;
|
|
||||||
|
|
||||||
char* tbname = taosHashGet(pInfo->pGroupIdTbNameMap, &pBlock->info.groupId, sizeof(int64_t));
|
void* tbname = NULL;
|
||||||
if (tbname != NULL) {
|
if (streamStateGetParName(pTaskInfo->streamInfo.pState, pBlock->info.groupId, &tbname) < 0) {
|
||||||
memcpy(pBlock->info.parTbName, tbname, TSDB_TABLE_NAME_LEN);
|
pBlock->info.parTbName[0] = 0;
|
||||||
} else {
|
} else {
|
||||||
pBlock->info.parTbName[0] = 0;
|
memcpy(pBlock->info.parTbName, tbname, TSDB_TABLE_NAME_LEN);
|
||||||
}
|
|
||||||
} else if (pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION ||
|
|
||||||
pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_SESSION ||
|
|
||||||
pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_SESSION) {
|
|
||||||
SStreamSessionAggOperatorInfo* pInfo = pOperator->info;
|
|
||||||
|
|
||||||
char* tbname = taosHashGet(pInfo->pGroupIdTbNameMap, &pBlock->info.groupId, sizeof(int64_t));
|
|
||||||
if (tbname != NULL) {
|
|
||||||
memcpy(pBlock->info.parTbName, tbname, TSDB_TABLE_NAME_LEN);
|
|
||||||
} else {
|
|
||||||
pBlock->info.parTbName[0] = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
tdbFree(tbname);
|
||||||
}
|
}
|
||||||
|
|
||||||
void doBuildResultDatablock(SOperatorInfo* pOperator, SOptrBasicInfo* pbInfo, SGroupResInfo* pGroupResInfo,
|
void doBuildResultDatablock(SOperatorInfo* pOperator, SOptrBasicInfo* pbInfo, SGroupResInfo* pGroupResInfo,
|
||||||
|
@ -1665,55 +1646,6 @@ int32_t appendDownstream(SOperatorInfo* p, SOperatorInfo** pDownstream, int32_t
|
||||||
static int32_t doInitAggInfoSup(SAggSupporter* pAggSup, SqlFunctionCtx* pCtx, int32_t numOfOutput, size_t keyBufSize,
|
static int32_t doInitAggInfoSup(SAggSupporter* pAggSup, SqlFunctionCtx* pCtx, int32_t numOfOutput, size_t keyBufSize,
|
||||||
const char* pKey);
|
const char* pKey);
|
||||||
|
|
||||||
static bool needToMerge(SSDataBlock* pBlock, SArray* groupInfo, char** buf, int32_t rowIndex) {
|
|
||||||
size_t size = taosArrayGetSize(groupInfo);
|
|
||||||
if (size == 0) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int32_t i = 0; i < size; ++i) {
|
|
||||||
int32_t* index = taosArrayGet(groupInfo, i);
|
|
||||||
|
|
||||||
SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, *index);
|
|
||||||
bool isNull = colDataIsNull(pColInfo, rowIndex, pBlock->info.rows, NULL);
|
|
||||||
|
|
||||||
if ((isNull && buf[i] != NULL) || (!isNull && buf[i] == NULL)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
char* pCell = colDataGetData(pColInfo, rowIndex);
|
|
||||||
if (IS_VAR_DATA_TYPE(pColInfo->info.type)) {
|
|
||||||
if (varDataLen(pCell) != varDataLen(buf[i])) {
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
if (memcmp(varDataVal(pCell), varDataVal(buf[i]), varDataLen(pCell)) != 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (memcmp(pCell, buf[i], pColInfo->info.bytes) != 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool saveCurrentTuple(char** rowColData, SArray* pColumnList, SSDataBlock* pBlock, int32_t rowIndex) {
|
|
||||||
int32_t size = (int32_t)taosArrayGetSize(pColumnList);
|
|
||||||
|
|
||||||
for (int32_t i = 0; i < size; ++i) {
|
|
||||||
int32_t* index = taosArrayGet(pColumnList, i);
|
|
||||||
SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, *index);
|
|
||||||
|
|
||||||
char* data = colDataGetData(pColInfo, rowIndex);
|
|
||||||
memcpy(rowColData[i], data, colDataGetLength(pColInfo, rowIndex));
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t getTableScanInfo(SOperatorInfo* pOperator, int32_t* order, int32_t* scanFlag) {
|
int32_t getTableScanInfo(SOperatorInfo* pOperator, int32_t* order, int32_t* scanFlag) {
|
||||||
// todo add more information about exchange operation
|
// todo add more information about exchange operation
|
||||||
int32_t type = pOperator->operatorType;
|
int32_t type = pOperator->operatorType;
|
||||||
|
@ -1725,13 +1657,13 @@ int32_t getTableScanInfo(SOperatorInfo* pOperator, int32_t* order, int32_t* scan
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
} else if (type == QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN) {
|
} else if (type == QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN) {
|
||||||
STableScanInfo* pTableScanInfo = pOperator->info;
|
STableScanInfo* pTableScanInfo = pOperator->info;
|
||||||
*order = pTableScanInfo->cond.order;
|
*order = pTableScanInfo->base.cond.order;
|
||||||
*scanFlag = pTableScanInfo->scanFlag;
|
*scanFlag = pTableScanInfo->base.scanFlag;
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
} else if (type == QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN) {
|
} else if (type == QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN) {
|
||||||
STableMergeScanInfo* pTableScanInfo = pOperator->info;
|
STableMergeScanInfo* pTableScanInfo = pOperator->info;
|
||||||
*order = pTableScanInfo->cond.order;
|
*order = pTableScanInfo->base.cond.order;
|
||||||
*scanFlag = pTableScanInfo->scanFlag;
|
*scanFlag = pTableScanInfo->base.scanFlag;
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
} else {
|
} else {
|
||||||
if (pOperator->pDownstream == NULL || pOperator->pDownstream[0] == NULL) {
|
if (pOperator->pDownstream == NULL || pOperator->pDownstream[0] == NULL) {
|
||||||
|
@ -1994,8 +1926,7 @@ static void doHandleRemainBlockForNewGroupImpl(SOperatorInfo* pOperator, SFillOp
|
||||||
int32_t scanFlag = MAIN_SCAN;
|
int32_t scanFlag = MAIN_SCAN;
|
||||||
getTableScanInfo(pOperator, &order, &scanFlag);
|
getTableScanInfo(pOperator, &order, &scanFlag);
|
||||||
|
|
||||||
int64_t ekey =
|
int64_t ekey = pInfo->existNewGroupBlock->info.window.ekey;
|
||||||
Q_STATUS_EQUAL(pTaskInfo->status, TASK_COMPLETED) ? pInfo->win.ekey : pInfo->existNewGroupBlock->info.window.ekey;
|
|
||||||
taosResetFillInfo(pInfo->pFillInfo, getFillInfoStart(pInfo->pFillInfo));
|
taosResetFillInfo(pInfo->pFillInfo, getFillInfoStart(pInfo->pFillInfo));
|
||||||
|
|
||||||
blockDataCleanup(pInfo->pRes);
|
blockDataCleanup(pInfo->pRes);
|
||||||
|
@ -2146,7 +2077,7 @@ static SSDataBlock* doFill(SOperatorInfo* pOperator) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
doFilter(fillResult, pOperator->exprSupp.pFilterInfo, &pInfo->matchInfo );
|
doFilter(fillResult, pOperator->exprSupp.pFilterInfo, &pInfo->matchInfo);
|
||||||
if (fillResult->info.rows > 0) {
|
if (fillResult->info.rows > 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2373,14 +2304,14 @@ SOperatorInfo* createAggregateOperatorInfo(SOperatorInfo* downstream, SAggPhysiN
|
||||||
pInfo->binfo.mergeResultBlock = pAggNode->mergeDataBlock;
|
pInfo->binfo.mergeResultBlock = pAggNode->mergeDataBlock;
|
||||||
pInfo->groupId = UINT64_MAX;
|
pInfo->groupId = UINT64_MAX;
|
||||||
|
|
||||||
setOperatorInfo(pOperator, "TableAggregate", QUERY_NODE_PHYSICAL_PLAN_HASH_AGG, true, OP_NOT_OPENED, pInfo, pTaskInfo);
|
setOperatorInfo(pOperator, "TableAggregate", QUERY_NODE_PHYSICAL_PLAN_HASH_AGG, true, OP_NOT_OPENED, pInfo,
|
||||||
pOperator->fpSet =
|
pTaskInfo);
|
||||||
createOperatorFpSet(doOpenAggregateOptr, getAggregateResult, NULL, destroyAggOperatorInfo, NULL);
|
pOperator->fpSet = createOperatorFpSet(doOpenAggregateOptr, getAggregateResult, NULL, destroyAggOperatorInfo, NULL);
|
||||||
|
|
||||||
if (downstream->operatorType == QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN) {
|
if (downstream->operatorType == QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN) {
|
||||||
STableScanInfo* pTableScanInfo = downstream->info;
|
STableScanInfo* pTableScanInfo = downstream->info;
|
||||||
pTableScanInfo->pdInfo.pExprSup = &pOperator->exprSupp;
|
pTableScanInfo->base.pdInfo.pExprSup = &pOperator->exprSupp;
|
||||||
pTableScanInfo->pdInfo.pAggSup = &pInfo->aggSup;
|
pTableScanInfo->base.pdInfo.pAggSup = &pInfo->aggSup;
|
||||||
}
|
}
|
||||||
|
|
||||||
code = appendDownstream(pOperator, &downstream, 1);
|
code = appendDownstream(pOperator, &downstream, 1);
|
||||||
|
@ -2745,7 +2676,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
STableScanInfo* pScanInfo = pOperator->info;
|
STableScanInfo* pScanInfo = pOperator->info;
|
||||||
pTaskInfo->cost.pRecoder = &pScanInfo->readRecorder;
|
pTaskInfo->cost.pRecoder = &pScanInfo->base.readRecorder;
|
||||||
} else if (QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN == type) {
|
} else if (QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN == type) {
|
||||||
STableMergeScanPhysiNode* pTableScanNode = (STableMergeScanPhysiNode*)pPhyNode;
|
STableMergeScanPhysiNode* pTableScanNode = (STableMergeScanPhysiNode*)pPhyNode;
|
||||||
|
|
||||||
|
@ -2763,14 +2694,14 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
pOperator = createTableMergeScanOperatorInfo(pTableScanNode, pTableListInfo, pHandle, pTaskInfo);
|
pOperator = createTableMergeScanOperatorInfo(pTableScanNode, pHandle, pTaskInfo);
|
||||||
if (NULL == pOperator) {
|
if (NULL == pOperator) {
|
||||||
pTaskInfo->code = terrno;
|
pTaskInfo->code = terrno;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
STableScanInfo* pScanInfo = pOperator->info;
|
STableScanInfo* pScanInfo = pOperator->info;
|
||||||
pTaskInfo->cost.pRecoder = &pScanInfo->readRecorder;
|
pTaskInfo->cost.pRecoder = &pScanInfo->base.readRecorder;
|
||||||
} else if (QUERY_NODE_PHYSICAL_PLAN_EXCHANGE == type) {
|
} else if (QUERY_NODE_PHYSICAL_PLAN_EXCHANGE == type) {
|
||||||
pOperator = createExchangeOperatorInfo(pHandle ? pHandle->pMsgCb->clientRpc : NULL, (SExchangePhysiNode*)pPhyNode,
|
pOperator = createExchangeOperatorInfo(pHandle ? pHandle->pMsgCb->clientRpc : NULL, (SExchangePhysiNode*)pPhyNode,
|
||||||
pTaskInfo);
|
pTaskInfo);
|
||||||
|
@ -3352,13 +3283,13 @@ int32_t buildDataBlockFromGroupRes(SOperatorInfo* pOperator, SStreamState* pStat
|
||||||
|
|
||||||
if (pBlock->info.groupId == 0) {
|
if (pBlock->info.groupId == 0) {
|
||||||
pBlock->info.groupId = pPos->groupId;
|
pBlock->info.groupId = pPos->groupId;
|
||||||
SStreamIntervalOperatorInfo* pInfo = pOperator->info;
|
void* tbname = NULL;
|
||||||
char* tbname = taosHashGet(pInfo->pGroupIdTbNameMap, &pBlock->info.groupId, sizeof(int64_t));
|
if (streamStateGetParName(pTaskInfo->streamInfo.pState, pBlock->info.groupId, &tbname) < 0) {
|
||||||
if (tbname != NULL) {
|
|
||||||
memcpy(pBlock->info.parTbName, tbname, TSDB_TABLE_NAME_LEN);
|
|
||||||
} else {
|
|
||||||
pBlock->info.parTbName[0] = 0;
|
pBlock->info.parTbName[0] = 0;
|
||||||
|
} else {
|
||||||
|
memcpy(pBlock->info.parTbName, tbname, TSDB_TABLE_NAME_LEN);
|
||||||
}
|
}
|
||||||
|
tdbFree(tbname);
|
||||||
} else {
|
} else {
|
||||||
// current value belongs to different group, it can't be packed into one datablock
|
// current value belongs to different group, it can't be packed into one datablock
|
||||||
if (pBlock->info.groupId != pPos->groupId) {
|
if (pBlock->info.groupId != pPos->groupId) {
|
||||||
|
@ -3444,30 +3375,13 @@ int32_t buildSessionResultDataBlock(SOperatorInfo* pOperator, SStreamState* pSta
|
||||||
if (pBlock->info.groupId == 0) {
|
if (pBlock->info.groupId == 0) {
|
||||||
pBlock->info.groupId = pKey->groupId;
|
pBlock->info.groupId = pKey->groupId;
|
||||||
|
|
||||||
if (pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE) {
|
void* tbname = NULL;
|
||||||
SStreamStateAggOperatorInfo* pInfo = pOperator->info;
|
if (streamStateGetParName(pTaskInfo->streamInfo.pState, pBlock->info.groupId, &tbname) < 0) {
|
||||||
|
pBlock->info.parTbName[0] = 0;
|
||||||
char* tbname = taosHashGet(pInfo->pGroupIdTbNameMap, &pBlock->info.groupId, sizeof(int64_t));
|
|
||||||
if (tbname != NULL) {
|
|
||||||
memcpy(pBlock->info.parTbName, tbname, TSDB_TABLE_NAME_LEN);
|
|
||||||
} else {
|
|
||||||
pBlock->info.parTbName[0] = 0;
|
|
||||||
}
|
|
||||||
} else if (pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION ||
|
|
||||||
pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_SESSION ||
|
|
||||||
pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_SESSION) {
|
|
||||||
SStreamSessionAggOperatorInfo* pInfo = pOperator->info;
|
|
||||||
|
|
||||||
char* tbname = taosHashGet(pInfo->pGroupIdTbNameMap, &pBlock->info.groupId, sizeof(int64_t));
|
|
||||||
if (tbname != NULL) {
|
|
||||||
memcpy(pBlock->info.parTbName, tbname, TSDB_TABLE_NAME_LEN);
|
|
||||||
} else {
|
|
||||||
pBlock->info.parTbName[0] = 0;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
ASSERT(0);
|
memcpy(pBlock->info.parTbName, tbname, TSDB_TABLE_NAME_LEN);
|
||||||
}
|
}
|
||||||
|
tdbFree(tbname);
|
||||||
} else {
|
} else {
|
||||||
// current value belongs to different group, it can't be packed into one datablock
|
// current value belongs to different group, it can't be packed into one datablock
|
||||||
if (pBlock->info.groupId != pKey->groupId) {
|
if (pBlock->info.groupId != pKey->groupId) {
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -760,7 +760,8 @@ SOperatorInfo* createMultiwayMergeOperatorInfo(SOperatorInfo** downStreams, size
|
||||||
pInfo->groupSort = pMergePhyNode->groupSort;
|
pInfo->groupSort = pMergePhyNode->groupSort;
|
||||||
pInfo->pSortInfo = createSortInfo(pMergePhyNode->pMergeKeys);
|
pInfo->pSortInfo = createSortInfo(pMergePhyNode->pMergeKeys);
|
||||||
pInfo->pInputBlock = pInputBlock;
|
pInfo->pInputBlock = pInputBlock;
|
||||||
pInfo->bufPageSize = getProperSortPageSize(rowSize);
|
size_t numOfCols = taosArrayGetSize(pInfo->binfo.pRes->pDataBlock);
|
||||||
|
pInfo->bufPageSize = getProperSortPageSize(rowSize, numOfCols);
|
||||||
pInfo->sortBufSize = pInfo->bufPageSize * (numStreams + 1); // one additional is reserved for merged result.
|
pInfo->sortBufSize = pInfo->bufPageSize * (numStreams + 1); // one additional is reserved for merged result.
|
||||||
|
|
||||||
setOperatorInfo(pOperator, "MultiwayMergeOperator", QUERY_NODE_PHYSICAL_PLAN_MERGE, false, OP_NOT_OPENED, pInfo, pTaskInfo);
|
setOperatorInfo(pOperator, "MultiwayMergeOperator", QUERY_NODE_PHYSICAL_PLAN_MERGE, false, OP_NOT_OPENED, pInfo, pTaskInfo);
|
||||||
|
|
|
@ -1450,7 +1450,6 @@ static int32_t closeStreamIntervalWindow(SSHashObj* pHashMap, STimeWindowAggSupp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tSimpleHashIterateRemove(pHashMap, pWinKey, sizeof(SWinKey), &pIte, &iter);
|
tSimpleHashIterateRemove(pHashMap, pWinKey, sizeof(SWinKey), &pIte, &iter);
|
||||||
/*taosHashRemove(pInfo->pGroupIdTbNameMap, &pWinKey->groupId, sizeof(int64_t));*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
|
@ -1547,7 +1546,8 @@ static void doBuildDeleteResult(SStreamIntervalOperatorInfo* pInfo, SArray* pWin
|
||||||
uint64_t uid = 0;
|
uint64_t uid = 0;
|
||||||
for (int32_t i = *index; i < size; i++) {
|
for (int32_t i = *index; i < size; i++) {
|
||||||
SWinKey* pWin = taosArrayGet(pWins, i);
|
SWinKey* pWin = taosArrayGet(pWins, i);
|
||||||
char* tbname = taosHashGet(pInfo->pGroupIdTbNameMap, &pWin->groupId, sizeof(int64_t));
|
void* tbname = NULL;
|
||||||
|
streamStateGetParName(pInfo->pState, pWin->groupId, &tbname);
|
||||||
if (tbname == NULL) {
|
if (tbname == NULL) {
|
||||||
appendOneRowToStreamSpecialBlock(pBlock, &pWin->ts, &pWin->ts, &uid, &pWin->groupId, NULL);
|
appendOneRowToStreamSpecialBlock(pBlock, &pWin->ts, &pWin->ts, &uid, &pWin->groupId, NULL);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1555,6 +1555,7 @@ static void doBuildDeleteResult(SStreamIntervalOperatorInfo* pInfo, SArray* pWin
|
||||||
STR_WITH_MAXSIZE_TO_VARSTR(parTbName, tbname, sizeof(parTbName));
|
STR_WITH_MAXSIZE_TO_VARSTR(parTbName, tbname, sizeof(parTbName));
|
||||||
appendOneRowToStreamSpecialBlock(pBlock, &pWin->ts, &pWin->ts, &uid, &pWin->groupId, parTbName);
|
appendOneRowToStreamSpecialBlock(pBlock, &pWin->ts, &pWin->ts, &uid, &pWin->groupId, parTbName);
|
||||||
}
|
}
|
||||||
|
tdbFree(tbname);
|
||||||
(*index)++;
|
(*index)++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1610,17 +1611,13 @@ void destroyStreamFinalIntervalOperatorInfo(void* param) {
|
||||||
int32_t size = taosArrayGetSize(pInfo->pChildren);
|
int32_t size = taosArrayGetSize(pInfo->pChildren);
|
||||||
for (int32_t i = 0; i < size; i++) {
|
for (int32_t i = 0; i < size; i++) {
|
||||||
SOperatorInfo* pChildOp = taosArrayGetP(pInfo->pChildren, i);
|
SOperatorInfo* pChildOp = taosArrayGetP(pInfo->pChildren, i);
|
||||||
destroyStreamFinalIntervalOperatorInfo(pChildOp->info);
|
destroyOperatorInfo(pChildOp);
|
||||||
taosMemoryFree(pChildOp->pDownstream);
|
|
||||||
cleanupExprSupp(&pChildOp->exprSupp);
|
|
||||||
taosMemoryFreeClear(pChildOp);
|
|
||||||
}
|
}
|
||||||
taosArrayDestroy(pInfo->pChildren);
|
taosArrayDestroy(pInfo->pChildren);
|
||||||
}
|
}
|
||||||
nodesDestroyNode((SNode*)pInfo->pPhyNode);
|
nodesDestroyNode((SNode*)pInfo->pPhyNode);
|
||||||
colDataDestroy(&pInfo->twAggSup.timeWindowData);
|
colDataDestroy(&pInfo->twAggSup.timeWindowData);
|
||||||
cleanupGroupResInfo(&pInfo->groupResInfo);
|
cleanupGroupResInfo(&pInfo->groupResInfo);
|
||||||
taosHashCleanup(pInfo->pGroupIdTbNameMap);
|
|
||||||
|
|
||||||
taosMemoryFreeClear(param);
|
taosMemoryFreeClear(param);
|
||||||
}
|
}
|
||||||
|
@ -1945,10 +1942,8 @@ static void doKeepPrevRows(STimeSliceOperatorInfo* pSliceInfo, const SSDataBlock
|
||||||
for (int32_t i = 0; i < numOfCols; ++i) {
|
for (int32_t i = 0; i < numOfCols; ++i) {
|
||||||
SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, i);
|
SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, i);
|
||||||
|
|
||||||
// null data should not be kept since it can not be used to perform interpolation
|
SGroupKeys* pkey = taosArrayGet(pSliceInfo->pPrevRow, i);
|
||||||
if (!colDataIsNull_s(pColInfoData, i)) {
|
if (!colDataIsNull_s(pColInfoData, rowIndex)) {
|
||||||
SGroupKeys* pkey = taosArrayGet(pSliceInfo->pPrevRow, i);
|
|
||||||
|
|
||||||
pkey->isNull = false;
|
pkey->isNull = false;
|
||||||
char* val = colDataGetData(pColInfoData, rowIndex);
|
char* val = colDataGetData(pColInfoData, rowIndex);
|
||||||
if (!IS_VAR_DATA_TYPE(pkey->type)) {
|
if (!IS_VAR_DATA_TYPE(pkey->type)) {
|
||||||
|
@ -1956,6 +1951,8 @@ static void doKeepPrevRows(STimeSliceOperatorInfo* pSliceInfo, const SSDataBlock
|
||||||
} else {
|
} else {
|
||||||
memcpy(pkey->pData, val, varDataLen(val));
|
memcpy(pkey->pData, val, varDataLen(val));
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
pkey->isNull = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1967,10 +1964,8 @@ static void doKeepNextRows(STimeSliceOperatorInfo* pSliceInfo, const SSDataBlock
|
||||||
for (int32_t i = 0; i < numOfCols; ++i) {
|
for (int32_t i = 0; i < numOfCols; ++i) {
|
||||||
SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, i);
|
SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, i);
|
||||||
|
|
||||||
// null data should not be kept since it can not be used to perform interpolation
|
SGroupKeys* pkey = taosArrayGet(pSliceInfo->pNextRow, i);
|
||||||
if (!colDataIsNull_s(pColInfoData, i)) {
|
if (!colDataIsNull_s(pColInfoData, rowIndex)) {
|
||||||
SGroupKeys* pkey = taosArrayGet(pSliceInfo->pNextRow, i);
|
|
||||||
|
|
||||||
pkey->isNull = false;
|
pkey->isNull = false;
|
||||||
char* val = colDataGetData(pColInfoData, rowIndex);
|
char* val = colDataGetData(pColInfoData, rowIndex);
|
||||||
if (!IS_VAR_DATA_TYPE(pkey->type)) {
|
if (!IS_VAR_DATA_TYPE(pkey->type)) {
|
||||||
|
@ -1978,50 +1973,51 @@ static void doKeepNextRows(STimeSliceOperatorInfo* pSliceInfo, const SSDataBlock
|
||||||
} else {
|
} else {
|
||||||
memcpy(pkey->pData, val, varDataLen(val));
|
memcpy(pkey->pData, val, varDataLen(val));
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
pkey->isNull = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pSliceInfo->isNextRowSet = true;
|
pSliceInfo->isNextRowSet = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void doKeepLinearInfo(STimeSliceOperatorInfo* pSliceInfo, const SSDataBlock* pBlock, int32_t rowIndex,
|
static void doKeepLinearInfo(STimeSliceOperatorInfo* pSliceInfo, const SSDataBlock* pBlock, int32_t rowIndex) {
|
||||||
bool isLastRow) {
|
|
||||||
int32_t numOfCols = taosArrayGetSize(pBlock->pDataBlock);
|
int32_t numOfCols = taosArrayGetSize(pBlock->pDataBlock);
|
||||||
bool fillLastPoint = pSliceInfo->fillLastPoint;
|
|
||||||
for (int32_t i = 0; i < numOfCols; ++i) {
|
for (int32_t i = 0; i < numOfCols; ++i) {
|
||||||
SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, i);
|
SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, i);
|
||||||
SColumnInfoData* pTsCol = taosArrayGet(pBlock->pDataBlock, pSliceInfo->tsCol.slotId);
|
SColumnInfoData* pTsCol = taosArrayGet(pBlock->pDataBlock, pSliceInfo->tsCol.slotId);
|
||||||
SFillLinearInfo* pLinearInfo = taosArrayGet(pSliceInfo->pLinearInfo, i);
|
SFillLinearInfo* pLinearInfo = taosArrayGet(pSliceInfo->pLinearInfo, i);
|
||||||
|
|
||||||
// null data should not be kept since it can not be used to perform interpolation
|
// null value is represented by using key = INT64_MIN for now.
|
||||||
if (!colDataIsNull_s(pColInfoData, i)) {
|
// TODO: optimize to ignore null values for linear interpolation.
|
||||||
if (isLastRow) {
|
if (!pLinearInfo->isStartSet) {
|
||||||
|
if (!colDataIsNull_s(pColInfoData, rowIndex)) {
|
||||||
pLinearInfo->start.key = *(int64_t*)colDataGetData(pTsCol, rowIndex);
|
pLinearInfo->start.key = *(int64_t*)colDataGetData(pTsCol, rowIndex);
|
||||||
memcpy(pLinearInfo->start.val, colDataGetData(pColInfoData, rowIndex), pLinearInfo->bytes);
|
memcpy(pLinearInfo->start.val, colDataGetData(pColInfoData, rowIndex), pLinearInfo->bytes);
|
||||||
} else if (fillLastPoint) {
|
}
|
||||||
|
pLinearInfo->isStartSet = true;
|
||||||
|
} else if (!pLinearInfo->isEndSet) {
|
||||||
|
if (!colDataIsNull_s(pColInfoData, rowIndex)) {
|
||||||
|
pLinearInfo->end.key = *(int64_t*)colDataGetData(pTsCol, rowIndex);
|
||||||
|
memcpy(pLinearInfo->end.val, colDataGetData(pColInfoData, rowIndex), pLinearInfo->bytes);
|
||||||
|
}
|
||||||
|
pLinearInfo->isEndSet = true;
|
||||||
|
} else {
|
||||||
|
pLinearInfo->start.key = pLinearInfo->end.key;
|
||||||
|
memcpy(pLinearInfo->start.val, pLinearInfo->end.val, pLinearInfo->bytes);
|
||||||
|
|
||||||
|
if (!colDataIsNull_s(pColInfoData, rowIndex)) {
|
||||||
pLinearInfo->end.key = *(int64_t*)colDataGetData(pTsCol, rowIndex);
|
pLinearInfo->end.key = *(int64_t*)colDataGetData(pTsCol, rowIndex);
|
||||||
memcpy(pLinearInfo->end.val, colDataGetData(pColInfoData, rowIndex), pLinearInfo->bytes);
|
memcpy(pLinearInfo->end.val, colDataGetData(pColInfoData, rowIndex), pLinearInfo->bytes);
|
||||||
} else {
|
} else {
|
||||||
pLinearInfo->start.key = *(int64_t*)colDataGetData(pTsCol, rowIndex);
|
pLinearInfo->end.key = INT64_MIN;
|
||||||
pLinearInfo->end.key = *(int64_t*)colDataGetData(pTsCol, rowIndex + 1);
|
|
||||||
|
|
||||||
char* val;
|
|
||||||
val = colDataGetData(pColInfoData, rowIndex);
|
|
||||||
memcpy(pLinearInfo->start.val, val, pLinearInfo->bytes);
|
|
||||||
val = colDataGetData(pColInfoData, rowIndex + 1);
|
|
||||||
memcpy(pLinearInfo->end.val, val, pLinearInfo->bytes);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pLinearInfo->hasNull = false;
|
|
||||||
} else {
|
|
||||||
pLinearInfo->hasNull = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pSliceInfo->fillLastPoint = isLastRow;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void genInterpolationResult(STimeSliceOperatorInfo* pSliceInfo, SExprSupp* pExprSup, SSDataBlock* pResBlock) {
|
static bool genInterpolationResult(STimeSliceOperatorInfo* pSliceInfo, SExprSupp* pExprSup, SSDataBlock* pResBlock, bool beforeTs) {
|
||||||
int32_t rows = pResBlock->info.rows;
|
int32_t rows = pResBlock->info.rows;
|
||||||
blockDataEnsureCapacity(pResBlock, rows + 1);
|
blockDataEnsureCapacity(pResBlock, rows + 1);
|
||||||
// todo set the correct primary timestamp column
|
// todo set the correct primary timestamp column
|
||||||
|
@ -2040,7 +2036,6 @@ static void genInterpolationResult(STimeSliceOperatorInfo* pSliceInfo, SExprSupp
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t srcSlot = pExprInfo->base.pParam[0].pCol->slotId;
|
int32_t srcSlot = pExprInfo->base.pParam[0].pCol->slotId;
|
||||||
// SColumnInfoData* pSrc = taosArrayGet(pBlock->pDataBlock, srcSlot);
|
|
||||||
switch (pSliceInfo->fillType) {
|
switch (pSliceInfo->fillType) {
|
||||||
case TSDB_FILL_NULL: {
|
case TSDB_FILL_NULL: {
|
||||||
colDataAppendNULL(pDst, rows);
|
colDataAppendNULL(pDst, rows);
|
||||||
|
@ -2072,21 +2067,26 @@ static void genInterpolationResult(STimeSliceOperatorInfo* pSliceInfo, SExprSupp
|
||||||
SPoint start = pLinearInfo->start;
|
SPoint start = pLinearInfo->start;
|
||||||
SPoint end = pLinearInfo->end;
|
SPoint end = pLinearInfo->end;
|
||||||
SPoint current = {.key = pSliceInfo->current};
|
SPoint current = {.key = pSliceInfo->current};
|
||||||
current.val = taosMemoryCalloc(pLinearInfo->bytes, 1);
|
|
||||||
|
|
||||||
// before interp range, do not fill
|
// do not interpolate before ts range, only increate pSliceInfo->current
|
||||||
if (start.key == INT64_MIN || end.key == INT64_MAX) {
|
if (beforeTs && !pLinearInfo->isEndSet) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!pLinearInfo->isStartSet || !pLinearInfo->isEndSet) {
|
||||||
hasInterp = false;
|
hasInterp = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pLinearInfo->hasNull) {
|
if (start.key == INT64_MIN || end.key == INT64_MIN) {
|
||||||
colDataAppendNULL(pDst, rows);
|
colDataAppendNULL(pDst, rows);
|
||||||
} else {
|
break;
|
||||||
taosGetLinearInterpolationVal(¤t, pLinearInfo->type, &start, &end, pLinearInfo->type);
|
|
||||||
colDataAppend(pDst, rows, (char*)current.val, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
current.val = taosMemoryCalloc(pLinearInfo->bytes, 1);
|
||||||
|
taosGetLinearInterpolationVal(¤t, pLinearInfo->type, &start, &end, pLinearInfo->type);
|
||||||
|
colDataAppend(pDst, rows, (char*)current.val, false);
|
||||||
|
|
||||||
taosMemoryFree(current.val);
|
taosMemoryFree(current.val);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2097,7 +2097,11 @@ static void genInterpolationResult(STimeSliceOperatorInfo* pSliceInfo, SExprSupp
|
||||||
}
|
}
|
||||||
|
|
||||||
SGroupKeys* pkey = taosArrayGet(pSliceInfo->pPrevRow, srcSlot);
|
SGroupKeys* pkey = taosArrayGet(pSliceInfo->pPrevRow, srcSlot);
|
||||||
colDataAppend(pDst, rows, pkey->pData, false);
|
if (pkey->isNull == false) {
|
||||||
|
colDataAppend(pDst, rows, pkey->pData, false);
|
||||||
|
} else {
|
||||||
|
colDataAppendNULL(pDst, rows);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2108,7 +2112,11 @@ static void genInterpolationResult(STimeSliceOperatorInfo* pSliceInfo, SExprSupp
|
||||||
}
|
}
|
||||||
|
|
||||||
SGroupKeys* pkey = taosArrayGet(pSliceInfo->pNextRow, srcSlot);
|
SGroupKeys* pkey = taosArrayGet(pSliceInfo->pNextRow, srcSlot);
|
||||||
colDataAppend(pDst, rows, pkey->pData, false);
|
if (pkey->isNull == false) {
|
||||||
|
colDataAppend(pDst, rows, pkey->pData, false);
|
||||||
|
} else {
|
||||||
|
colDataAppendNULL(pDst, rows);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2121,8 +2129,40 @@ static void genInterpolationResult(STimeSliceOperatorInfo* pSliceInfo, SExprSupp
|
||||||
if (hasInterp) {
|
if (hasInterp) {
|
||||||
pResBlock->info.rows += 1;
|
pResBlock->info.rows += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return hasInterp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void addCurrentRowToResult(STimeSliceOperatorInfo* pSliceInfo, SExprSupp* pExprSup, SSDataBlock* pResBlock,
|
||||||
|
SSDataBlock* pSrcBlock, int32_t index) {
|
||||||
|
blockDataEnsureCapacity(pResBlock, pResBlock->info.rows + 1);
|
||||||
|
for (int32_t j = 0; j < pExprSup->numOfExprs; ++j) {
|
||||||
|
SExprInfo* pExprInfo = &pExprSup->pExprInfo[j];
|
||||||
|
|
||||||
|
int32_t dstSlot = pExprInfo->base.resSchema.slotId;
|
||||||
|
SColumnInfoData* pDst = taosArrayGet(pResBlock->pDataBlock, dstSlot);
|
||||||
|
|
||||||
|
if (IS_TIMESTAMP_TYPE(pExprInfo->base.resSchema.type)) {
|
||||||
|
colDataAppend(pDst, pResBlock->info.rows, (char*)&pSliceInfo->current, false);
|
||||||
|
} else {
|
||||||
|
int32_t srcSlot = pExprInfo->base.pParam[0].pCol->slotId;
|
||||||
|
SColumnInfoData* pSrc = taosArrayGet(pSrcBlock->pDataBlock, srcSlot);
|
||||||
|
|
||||||
|
if (colDataIsNull_s(pSrc, index)) {
|
||||||
|
colDataAppendNULL(pDst, pResBlock->info.rows);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
char* v = colDataGetData(pSrc, index);
|
||||||
|
colDataAppend(pDst, pResBlock->info.rows, v, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pResBlock->info.rows += 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int32_t initPrevRowsKeeper(STimeSliceOperatorInfo* pInfo, SSDataBlock* pBlock) {
|
static int32_t initPrevRowsKeeper(STimeSliceOperatorInfo* pInfo, SSDataBlock* pBlock) {
|
||||||
if (pInfo->pPrevRow != NULL) {
|
if (pInfo->pPrevRow != NULL) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
|
@ -2193,24 +2233,19 @@ static int32_t initFillLinearInfo(STimeSliceOperatorInfo* pInfo, SSDataBlock* pB
|
||||||
|
|
||||||
SFillLinearInfo linearInfo = {0};
|
SFillLinearInfo linearInfo = {0};
|
||||||
linearInfo.start.key = INT64_MIN;
|
linearInfo.start.key = INT64_MIN;
|
||||||
linearInfo.end.key = INT64_MAX;
|
linearInfo.end.key = INT64_MIN;
|
||||||
linearInfo.start.val = taosMemoryCalloc(1, pColInfo->info.bytes);
|
linearInfo.start.val = taosMemoryCalloc(1, pColInfo->info.bytes);
|
||||||
linearInfo.end.val = taosMemoryCalloc(1, pColInfo->info.bytes);
|
linearInfo.end.val = taosMemoryCalloc(1, pColInfo->info.bytes);
|
||||||
linearInfo.hasNull = false;
|
linearInfo.isStartSet = false;
|
||||||
|
linearInfo.isEndSet = false;
|
||||||
linearInfo.type = pColInfo->info.type;
|
linearInfo.type = pColInfo->info.type;
|
||||||
linearInfo.bytes = pColInfo->info.bytes;
|
linearInfo.bytes = pColInfo->info.bytes;
|
||||||
taosArrayPush(pInfo->pLinearInfo, &linearInfo);
|
taosArrayPush(pInfo->pLinearInfo, &linearInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
pInfo->fillLastPoint = false;
|
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool needToFillLastPoint(STimeSliceOperatorInfo* pSliceInfo) {
|
|
||||||
return (pSliceInfo->fillLastPoint == true && pSliceInfo->fillType == TSDB_FILL_LINEAR);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int32_t initKeeperInfo(STimeSliceOperatorInfo* pInfo, SSDataBlock* pBlock) {
|
static int32_t initKeeperInfo(STimeSliceOperatorInfo* pInfo, SSDataBlock* pBlock) {
|
||||||
int32_t code;
|
int32_t code;
|
||||||
code = initPrevRowsKeeper(pInfo, pBlock);
|
code = initPrevRowsKeeper(pInfo, pBlock);
|
||||||
|
@ -2266,195 +2301,73 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) {
|
||||||
for (int32_t i = 0; i < pBlock->info.rows; ++i) {
|
for (int32_t i = 0; i < pBlock->info.rows; ++i) {
|
||||||
int64_t ts = *(int64_t*)colDataGetData(pTsCol, i);
|
int64_t ts = *(int64_t*)colDataGetData(pTsCol, i);
|
||||||
|
|
||||||
if (i == 0 && needToFillLastPoint(pSliceInfo)) { // first row in current block
|
|
||||||
doKeepLinearInfo(pSliceInfo, pBlock, i, false);
|
|
||||||
while (pSliceInfo->current < ts && pSliceInfo->current <= pSliceInfo->win.ekey) {
|
|
||||||
genInterpolationResult(pSliceInfo, &pOperator->exprSupp, pResBlock);
|
|
||||||
pSliceInfo->current =
|
|
||||||
taosTimeAdd(pSliceInfo->current, pInterval->interval, pInterval->intervalUnit, pInterval->precision);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pSliceInfo->current > pSliceInfo->win.ekey) {
|
if (pSliceInfo->current > pSliceInfo->win.ekey) {
|
||||||
setOperatorCompleted(pOperator);
|
setOperatorCompleted(pOperator);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ts == pSliceInfo->current) {
|
if (ts == pSliceInfo->current) {
|
||||||
blockDataEnsureCapacity(pResBlock, pResBlock->info.rows + 1);
|
addCurrentRowToResult(pSliceInfo, &pOperator->exprSupp, pResBlock, pBlock, i);
|
||||||
for (int32_t j = 0; j < pOperator->exprSupp.numOfExprs; ++j) {
|
|
||||||
SExprInfo* pExprInfo = &pOperator->exprSupp.pExprInfo[j];
|
|
||||||
|
|
||||||
int32_t dstSlot = pExprInfo->base.resSchema.slotId;
|
|
||||||
SColumnInfoData* pDst = taosArrayGet(pResBlock->pDataBlock, dstSlot);
|
|
||||||
|
|
||||||
if (IS_TIMESTAMP_TYPE(pExprInfo->base.resSchema.type)) {
|
|
||||||
colDataAppend(pDst, pResBlock->info.rows, (char*)&pSliceInfo->current, false);
|
|
||||||
} else {
|
|
||||||
int32_t srcSlot = pExprInfo->base.pParam[0].pCol->slotId;
|
|
||||||
SColumnInfoData* pSrc = taosArrayGet(pBlock->pDataBlock, srcSlot);
|
|
||||||
|
|
||||||
if (colDataIsNull_s(pSrc, i)) {
|
|
||||||
colDataAppendNULL(pDst, pResBlock->info.rows);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
char* v = colDataGetData(pSrc, i);
|
|
||||||
colDataAppend(pDst, pResBlock->info.rows, v, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pResBlock->info.rows += 1;
|
|
||||||
doKeepPrevRows(pSliceInfo, pBlock, i);
|
doKeepPrevRows(pSliceInfo, pBlock, i);
|
||||||
|
doKeepLinearInfo(pSliceInfo, pBlock, i);
|
||||||
|
|
||||||
// for linear interpolation, always fill value between this and next points;
|
pSliceInfo->current =
|
||||||
// if its the first point in data block, also fill values between previous(if there's any) and this point;
|
taosTimeAdd(pSliceInfo->current, pInterval->interval, pInterval->intervalUnit, pInterval->precision);
|
||||||
// if its the last point in data block, no need to fill, but reserve this point as the start value and do
|
if (pSliceInfo->current > pSliceInfo->win.ekey) {
|
||||||
// the interpolation when processing next data block.
|
setOperatorCompleted(pOperator);
|
||||||
if (pSliceInfo->fillType == TSDB_FILL_LINEAR) {
|
break;
|
||||||
pSliceInfo->current =
|
|
||||||
taosTimeAdd(pSliceInfo->current, pInterval->interval, pInterval->intervalUnit, pInterval->precision);
|
|
||||||
if (i < pBlock->info.rows - 1) {
|
|
||||||
doKeepLinearInfo(pSliceInfo, pBlock, i, false);
|
|
||||||
int64_t nextTs = *(int64_t*)colDataGetData(pTsCol, i + 1);
|
|
||||||
if (nextTs > pSliceInfo->current) {
|
|
||||||
while (pSliceInfo->current < nextTs && pSliceInfo->current <= pSliceInfo->win.ekey) {
|
|
||||||
genInterpolationResult(pSliceInfo, &pOperator->exprSupp, pResBlock);
|
|
||||||
pSliceInfo->current = taosTimeAdd(pSliceInfo->current, pInterval->interval, pInterval->intervalUnit,
|
|
||||||
pInterval->precision);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pSliceInfo->current > pSliceInfo->win.ekey) {
|
|
||||||
setOperatorCompleted(pOperator);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else { // it is the last row of current block
|
|
||||||
// store ts value as start, and calculate interp value when processing next block
|
|
||||||
doKeepLinearInfo(pSliceInfo, pBlock, i, true);
|
|
||||||
}
|
|
||||||
} else { // non-linear interpolation
|
|
||||||
pSliceInfo->current =
|
|
||||||
taosTimeAdd(pSliceInfo->current, pInterval->interval, pInterval->intervalUnit, pInterval->precision);
|
|
||||||
if (pSliceInfo->current > pSliceInfo->win.ekey) {
|
|
||||||
setOperatorCompleted(pOperator);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (ts < pSliceInfo->current) {
|
} else if (ts < pSliceInfo->current) {
|
||||||
// in case of interpolation window starts and ends between two datapoints, fill(prev) need to interpolate
|
// in case of interpolation window starts and ends between two datapoints, fill(prev) need to interpolate
|
||||||
doKeepPrevRows(pSliceInfo, pBlock, i);
|
doKeepPrevRows(pSliceInfo, pBlock, i);
|
||||||
|
doKeepLinearInfo(pSliceInfo, pBlock, i);
|
||||||
|
|
||||||
if (pSliceInfo->fillType == TSDB_FILL_LINEAR) {
|
if (i < pBlock->info.rows - 1) {
|
||||||
// no need to increate pSliceInfo->current here
|
// in case of interpolation window starts and ends between two datapoints, fill(next) need to interpolate
|
||||||
// pSliceInfo->current =
|
doKeepNextRows(pSliceInfo, pBlock, i + 1);
|
||||||
// taosTimeAdd(pSliceInfo->current, pInterval->interval, pInterval->intervalUnit, pInterval->precision);
|
int64_t nextTs = *(int64_t*)colDataGetData(pTsCol, i + 1);
|
||||||
if (i < pBlock->info.rows - 1) {
|
if (nextTs > pSliceInfo->current) {
|
||||||
doKeepLinearInfo(pSliceInfo, pBlock, i, false);
|
while (pSliceInfo->current < nextTs && pSliceInfo->current <= pSliceInfo->win.ekey) {
|
||||||
int64_t nextTs = *(int64_t*)colDataGetData(pTsCol, i + 1);
|
if (!genInterpolationResult(pSliceInfo, &pOperator->exprSupp, pResBlock, false) && pSliceInfo->fillType == TSDB_FILL_LINEAR) {
|
||||||
if (nextTs > pSliceInfo->current) {
|
|
||||||
while (pSliceInfo->current < nextTs && pSliceInfo->current <= pSliceInfo->win.ekey) {
|
|
||||||
genInterpolationResult(pSliceInfo, &pOperator->exprSupp, pResBlock);
|
|
||||||
pSliceInfo->current = taosTimeAdd(pSliceInfo->current, pInterval->interval, pInterval->intervalUnit,
|
|
||||||
pInterval->precision);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pSliceInfo->current > pSliceInfo->win.ekey) {
|
|
||||||
setOperatorCompleted(pOperator);
|
|
||||||
break;
|
break;
|
||||||
|
} else {
|
||||||
|
pSliceInfo->current =
|
||||||
|
taosTimeAdd(pSliceInfo->current, pInterval->interval, pInterval->intervalUnit, pInterval->precision);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pSliceInfo->current > pSliceInfo->win.ekey) {
|
||||||
|
setOperatorCompleted(pOperator);
|
||||||
|
break;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// store ts value as start, and calculate interp value when processing next block
|
// ignore current row, and do nothing
|
||||||
doKeepLinearInfo(pSliceInfo, pBlock, i, true);
|
|
||||||
}
|
|
||||||
} else { // non-linear interpolation
|
|
||||||
if (i < pBlock->info.rows - 1) {
|
|
||||||
// in case of interpolation window starts and ends between two datapoints, fill(next) need to interpolate
|
|
||||||
doKeepNextRows(pSliceInfo, pBlock, i + 1);
|
|
||||||
int64_t nextTs = *(int64_t*)colDataGetData(pTsCol, i + 1);
|
|
||||||
if (nextTs > pSliceInfo->current) {
|
|
||||||
while (pSliceInfo->current < nextTs && pSliceInfo->current <= pSliceInfo->win.ekey) {
|
|
||||||
genInterpolationResult(pSliceInfo, &pOperator->exprSupp, pResBlock);
|
|
||||||
pSliceInfo->current = taosTimeAdd(pSliceInfo->current, pInterval->interval, pInterval->intervalUnit,
|
|
||||||
pInterval->precision);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pSliceInfo->current > pSliceInfo->win.ekey) {
|
|
||||||
setOperatorCompleted(pOperator);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// ignore current row, and do nothing
|
|
||||||
}
|
|
||||||
} else { // it is the last row of current block
|
|
||||||
doKeepPrevRows(pSliceInfo, pBlock, i);
|
|
||||||
}
|
}
|
||||||
|
} else { // it is the last row of current block
|
||||||
|
doKeepPrevRows(pSliceInfo, pBlock, i);
|
||||||
}
|
}
|
||||||
} else { // ts > pSliceInfo->current
|
} else { // ts > pSliceInfo->current
|
||||||
// in case of interpolation window starts and ends between two datapoints, fill(next) need to interpolate
|
// in case of interpolation window starts and ends between two datapoints, fill(next) need to interpolate
|
||||||
doKeepNextRows(pSliceInfo, pBlock, i);
|
doKeepNextRows(pSliceInfo, pBlock, i);
|
||||||
|
doKeepLinearInfo(pSliceInfo, pBlock, i);
|
||||||
|
|
||||||
while (pSliceInfo->current < ts && pSliceInfo->current <= pSliceInfo->win.ekey) {
|
while (pSliceInfo->current < ts && pSliceInfo->current <= pSliceInfo->win.ekey) {
|
||||||
genInterpolationResult(pSliceInfo, &pOperator->exprSupp, pResBlock);
|
if (!genInterpolationResult(pSliceInfo, &pOperator->exprSupp, pResBlock, true) && pSliceInfo->fillType == TSDB_FILL_LINEAR) {
|
||||||
pSliceInfo->current =
|
break;
|
||||||
taosTimeAdd(pSliceInfo->current, pInterval->interval, pInterval->intervalUnit, pInterval->precision);
|
} else {
|
||||||
|
pSliceInfo->current =
|
||||||
|
taosTimeAdd(pSliceInfo->current, pInterval->interval, pInterval->intervalUnit, pInterval->precision);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// add current row if timestamp match
|
// add current row if timestamp match
|
||||||
if (ts == pSliceInfo->current && pSliceInfo->current <= pSliceInfo->win.ekey) {
|
if (ts == pSliceInfo->current && pSliceInfo->current <= pSliceInfo->win.ekey) {
|
||||||
blockDataEnsureCapacity(pResBlock, pResBlock->info.rows + 1);
|
addCurrentRowToResult(pSliceInfo, &pOperator->exprSupp, pResBlock, pBlock, i);
|
||||||
for (int32_t j = 0; j < pOperator->exprSupp.numOfExprs; ++j) {
|
|
||||||
SExprInfo* pExprInfo = &pOperator->exprSupp.pExprInfo[j];
|
|
||||||
|
|
||||||
int32_t dstSlot = pExprInfo->base.resSchema.slotId;
|
|
||||||
SColumnInfoData* pDst = taosArrayGet(pResBlock->pDataBlock, dstSlot);
|
|
||||||
|
|
||||||
if (IS_TIMESTAMP_TYPE(pExprInfo->base.resSchema.type)) {
|
|
||||||
colDataAppend(pDst, pResBlock->info.rows, (char*)&pSliceInfo->current, false);
|
|
||||||
} else {
|
|
||||||
int32_t srcSlot = pExprInfo->base.pParam[0].pCol->slotId;
|
|
||||||
SColumnInfoData* pSrc = taosArrayGet(pBlock->pDataBlock, srcSlot);
|
|
||||||
|
|
||||||
if (colDataIsNull_s(pSrc, i)) {
|
|
||||||
colDataAppendNULL(pDst, pResBlock->info.rows);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
char* v = colDataGetData(pSrc, i);
|
|
||||||
colDataAppend(pDst, pResBlock->info.rows, v, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pResBlock->info.rows += 1;
|
|
||||||
doKeepPrevRows(pSliceInfo, pBlock, i);
|
doKeepPrevRows(pSliceInfo, pBlock, i);
|
||||||
|
|
||||||
if (pSliceInfo->fillType == TSDB_FILL_LINEAR) {
|
pSliceInfo->current =
|
||||||
pSliceInfo->current =
|
taosTimeAdd(pSliceInfo->current, pInterval->interval, pInterval->intervalUnit, pInterval->precision);
|
||||||
taosTimeAdd(pSliceInfo->current, pInterval->interval, pInterval->intervalUnit, pInterval->precision);
|
|
||||||
if (i < pBlock->info.rows - 1) {
|
|
||||||
doKeepLinearInfo(pSliceInfo, pBlock, i, false);
|
|
||||||
int64_t nextTs = *(int64_t*)colDataGetData(pTsCol, i + 1);
|
|
||||||
if (nextTs > pSliceInfo->current) {
|
|
||||||
while (pSliceInfo->current < nextTs && pSliceInfo->current <= pSliceInfo->win.ekey) {
|
|
||||||
genInterpolationResult(pSliceInfo, &pOperator->exprSupp, pResBlock);
|
|
||||||
pSliceInfo->current = taosTimeAdd(pSliceInfo->current, pInterval->interval, pInterval->intervalUnit,
|
|
||||||
pInterval->precision);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pSliceInfo->current > pSliceInfo->win.ekey) {
|
|
||||||
setOperatorCompleted(pOperator);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else { // it is the last row of current block
|
|
||||||
// store ts value as start, and calculate interp value when processing next block
|
|
||||||
doKeepLinearInfo(pSliceInfo, pBlock, i, true);
|
|
||||||
}
|
|
||||||
} else { // non-linear interpolation
|
|
||||||
pSliceInfo->current =
|
|
||||||
taosTimeAdd(pSliceInfo->current, pInterval->interval, pInterval->intervalUnit, pInterval->precision);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pSliceInfo->current > pSliceInfo->win.ekey) {
|
if (pSliceInfo->current > pSliceInfo->win.ekey) {
|
||||||
|
@ -2469,7 +2382,7 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) {
|
||||||
// except for fill(next), fill(linear)
|
// except for fill(next), fill(linear)
|
||||||
while (pSliceInfo->current <= pSliceInfo->win.ekey && pSliceInfo->fillType != TSDB_FILL_NEXT &&
|
while (pSliceInfo->current <= pSliceInfo->win.ekey && pSliceInfo->fillType != TSDB_FILL_NEXT &&
|
||||||
pSliceInfo->fillType != TSDB_FILL_LINEAR) {
|
pSliceInfo->fillType != TSDB_FILL_LINEAR) {
|
||||||
genInterpolationResult(pSliceInfo, &pOperator->exprSupp, pResBlock);
|
genInterpolationResult(pSliceInfo, &pOperator->exprSupp, pResBlock, false);
|
||||||
pSliceInfo->current =
|
pSliceInfo->current =
|
||||||
taosTimeAdd(pSliceInfo->current, pInterval->interval, pInterval->intervalUnit, pInterval->precision);
|
taosTimeAdd(pSliceInfo->current, pInterval->interval, pInterval->intervalUnit, pInterval->precision);
|
||||||
}
|
}
|
||||||
|
@ -2548,9 +2461,11 @@ SOperatorInfo* createTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode
|
||||||
pInfo->interval.interval = pInterpPhyNode->interval;
|
pInfo->interval.interval = pInterpPhyNode->interval;
|
||||||
pInfo->current = pInfo->win.skey;
|
pInfo->current = pInfo->win.skey;
|
||||||
|
|
||||||
STableScanInfo* pScanInfo = (STableScanInfo*)downstream->info;
|
if (downstream->operatorType == QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN) {
|
||||||
pScanInfo->cond.twindows = pInfo->win;
|
STableScanInfo* pScanInfo = (STableScanInfo*)downstream->info;
|
||||||
pScanInfo->cond.type = TIMEWINDOW_RANGE_EXTERNAL;
|
pScanInfo->base.cond.twindows = pInfo->win;
|
||||||
|
pScanInfo->base.cond.type = TIMEWINDOW_RANGE_EXTERNAL;
|
||||||
|
}
|
||||||
|
|
||||||
setOperatorInfo(pOperator, "TimeSliceOperator", QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC, false, OP_NOT_OPENED, pInfo,
|
setOperatorInfo(pOperator, "TimeSliceOperator", QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC, false, OP_NOT_OPENED, pInfo,
|
||||||
pTaskInfo);
|
pTaskInfo);
|
||||||
|
@ -3156,11 +3071,6 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) {
|
||||||
}
|
}
|
||||||
printDataBlock(pBlock, IS_FINAL_OP(pInfo) ? "interval final recv" : "interval semi recv");
|
printDataBlock(pBlock, IS_FINAL_OP(pInfo) ? "interval final recv" : "interval semi recv");
|
||||||
|
|
||||||
if (pBlock->info.parTbName[0]) {
|
|
||||||
taosHashPut(pInfo->pGroupIdTbNameMap, &pBlock->info.groupId, sizeof(int64_t), &pBlock->info.parTbName,
|
|
||||||
TSDB_TABLE_NAME_LEN);
|
|
||||||
}
|
|
||||||
|
|
||||||
ASSERT(pBlock->info.type != STREAM_INVERT);
|
ASSERT(pBlock->info.type != STREAM_INVERT);
|
||||||
if (pBlock->info.type == STREAM_NORMAL || pBlock->info.type == STREAM_PULL_DATA) {
|
if (pBlock->info.type == STREAM_NORMAL || pBlock->info.type == STREAM_PULL_DATA) {
|
||||||
pInfo->binfo.pRes->info.type = pBlock->info.type;
|
pInfo->binfo.pRes->info.type = pBlock->info.type;
|
||||||
|
@ -3375,9 +3285,6 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream,
|
||||||
pInfo->delKey.ts = INT64_MAX;
|
pInfo->delKey.ts = INT64_MAX;
|
||||||
pInfo->delKey.groupId = 0;
|
pInfo->delKey.groupId = 0;
|
||||||
|
|
||||||
pInfo->pGroupIdTbNameMap =
|
|
||||||
taosHashInit(1024, taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT), false, HASH_NO_LOCK);
|
|
||||||
|
|
||||||
pOperator->operatorType = pPhyNode->type;
|
pOperator->operatorType = pPhyNode->type;
|
||||||
pOperator->blocking = true;
|
pOperator->blocking = true;
|
||||||
pOperator->status = OP_NOT_OPENED;
|
pOperator->status = OP_NOT_OPENED;
|
||||||
|
@ -3418,18 +3325,16 @@ void destroyStreamSessionAggOperatorInfo(void* param) {
|
||||||
if (pInfo->pChildren != NULL) {
|
if (pInfo->pChildren != NULL) {
|
||||||
int32_t size = taosArrayGetSize(pInfo->pChildren);
|
int32_t size = taosArrayGetSize(pInfo->pChildren);
|
||||||
for (int32_t i = 0; i < size; i++) {
|
for (int32_t i = 0; i < size; i++) {
|
||||||
SOperatorInfo* pChild = taosArrayGetP(pInfo->pChildren, i);
|
SOperatorInfo* pChild = taosArrayGetP(pInfo->pChildren, i);
|
||||||
SStreamSessionAggOperatorInfo* pChInfo = pChild->info;
|
destroyOperatorInfo(pChild);
|
||||||
destroyStreamSessionAggOperatorInfo(pChInfo);
|
|
||||||
taosMemoryFreeClear(pChild);
|
|
||||||
}
|
}
|
||||||
|
taosArrayDestroy(pInfo->pChildren);
|
||||||
}
|
}
|
||||||
colDataDestroy(&pInfo->twAggSup.timeWindowData);
|
colDataDestroy(&pInfo->twAggSup.timeWindowData);
|
||||||
blockDataDestroy(pInfo->pDelRes);
|
blockDataDestroy(pInfo->pDelRes);
|
||||||
blockDataDestroy(pInfo->pWinBlock);
|
blockDataDestroy(pInfo->pWinBlock);
|
||||||
blockDataDestroy(pInfo->pUpdateRes);
|
blockDataDestroy(pInfo->pUpdateRes);
|
||||||
tSimpleHashCleanup(pInfo->pStDeleted);
|
tSimpleHashCleanup(pInfo->pStDeleted);
|
||||||
taosHashCleanup(pInfo->pGroupIdTbNameMap);
|
|
||||||
|
|
||||||
taosMemoryFreeClear(param);
|
taosMemoryFreeClear(param);
|
||||||
}
|
}
|
||||||
|
@ -3470,7 +3375,9 @@ void initDownStream(SOperatorInfo* downstream, SStreamAggSupporter* pAggSup, int
|
||||||
}
|
}
|
||||||
SStreamScanInfo* pScanInfo = downstream->info;
|
SStreamScanInfo* pScanInfo = downstream->info;
|
||||||
pScanInfo->windowSup = (SWindowSupporter){.pStreamAggSup = pAggSup, .gap = pAggSup->gap, .parentType = type};
|
pScanInfo->windowSup = (SWindowSupporter){.pStreamAggSup = pAggSup, .gap = pAggSup->gap, .parentType = type};
|
||||||
pScanInfo->pUpdateInfo = updateInfoInit(60000, TSDB_TIME_PRECISION_MILLI, waterMark);
|
if (!pScanInfo->pUpdateInfo) {
|
||||||
|
pScanInfo->pUpdateInfo = updateInfoInit(60000, TSDB_TIME_PRECISION_MILLI, waterMark);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t initStreamAggSupporter(SStreamAggSupporter* pSup, SqlFunctionCtx* pCtx, int32_t numOfOutput, int64_t gap,
|
int32_t initStreamAggSupporter(SStreamAggSupporter* pSup, SqlFunctionCtx* pCtx, int32_t numOfOutput, int64_t gap,
|
||||||
|
@ -3859,30 +3766,18 @@ void doBuildDeleteDataBlock(SOperatorInfo* pOp, SSHashObj* pStDeleted, SSDataBlo
|
||||||
SColumnInfoData* pCalEdCol = taosArrayGet(pBlock->pDataBlock, CALCULATE_END_TS_COLUMN_INDEX);
|
SColumnInfoData* pCalEdCol = taosArrayGet(pBlock->pDataBlock, CALCULATE_END_TS_COLUMN_INDEX);
|
||||||
colDataAppendNULL(pCalEdCol, pBlock->info.rows);
|
colDataAppendNULL(pCalEdCol, pBlock->info.rows);
|
||||||
|
|
||||||
SHashObj* pGroupIdTbNameMap = NULL;
|
|
||||||
if (pOp->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION ||
|
|
||||||
pOp->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_SESSION ||
|
|
||||||
pOp->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_SESSION) {
|
|
||||||
SStreamSessionAggOperatorInfo* pInfo = pOp->info;
|
|
||||||
pGroupIdTbNameMap = pInfo->pGroupIdTbNameMap;
|
|
||||||
} else if (pOp->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE) {
|
|
||||||
SStreamStateAggOperatorInfo* pInfo = pOp->info;
|
|
||||||
pGroupIdTbNameMap = pInfo->pGroupIdTbNameMap;
|
|
||||||
} else {
|
|
||||||
ASSERT(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
char* tbname = taosHashGet(pGroupIdTbNameMap, &res->groupId, sizeof(int64_t));
|
|
||||||
SColumnInfoData* pTableCol = taosArrayGet(pBlock->pDataBlock, TABLE_NAME_COLUMN_INDEX);
|
SColumnInfoData* pTableCol = taosArrayGet(pBlock->pDataBlock, TABLE_NAME_COLUMN_INDEX);
|
||||||
|
|
||||||
|
void* tbname = NULL;
|
||||||
|
streamStateGetParName(pOp->pTaskInfo->streamInfo.pState, res->groupId, &tbname);
|
||||||
if (tbname == NULL) {
|
if (tbname == NULL) {
|
||||||
/*printf("\n\n no tbname for group id %" PRId64 "%p %p\n\n", res->groupId, pOp->info, pGroupIdTbNameMap);*/
|
|
||||||
colDataAppendNULL(pTableCol, pBlock->info.rows);
|
colDataAppendNULL(pTableCol, pBlock->info.rows);
|
||||||
} else {
|
} else {
|
||||||
char parTbName[VARSTR_HEADER_SIZE + TSDB_TABLE_NAME_LEN];
|
char parTbName[VARSTR_HEADER_SIZE + TSDB_TABLE_NAME_LEN];
|
||||||
STR_WITH_MAXSIZE_TO_VARSTR(parTbName, tbname, sizeof(parTbName));
|
STR_WITH_MAXSIZE_TO_VARSTR(parTbName, tbname, sizeof(parTbName));
|
||||||
colDataAppend(pTableCol, pBlock->info.rows, (const char*)parTbName, false);
|
colDataAppend(pTableCol, pBlock->info.rows, (const char*)parTbName, false);
|
||||||
/*printf("\n\n get tbname %s group id %" PRId64 "\n\n", tbname, res->groupId);*/
|
|
||||||
}
|
}
|
||||||
|
tdbFree(tbname);
|
||||||
pBlock->info.rows += 1;
|
pBlock->info.rows += 1;
|
||||||
}
|
}
|
||||||
if ((*Ite) == NULL) {
|
if ((*Ite) == NULL) {
|
||||||
|
@ -4055,19 +3950,6 @@ static SSDataBlock* doStreamSessionAgg(SOperatorInfo* pOperator) {
|
||||||
}
|
}
|
||||||
printDataBlock(pBlock, IS_FINAL_OP(pInfo) ? "final session recv" : "single session recv");
|
printDataBlock(pBlock, IS_FINAL_OP(pInfo) ? "final session recv" : "single session recv");
|
||||||
|
|
||||||
if (pBlock->info.parTbName[0]) {
|
|
||||||
taosHashPut(pInfo->pGroupIdTbNameMap, &pBlock->info.groupId, sizeof(int64_t), &pBlock->info.parTbName,
|
|
||||||
TSDB_TABLE_NAME_LEN);
|
|
||||||
/*printf("\n\n put tbname %s group id %" PRId64 "\n\n into %p %p", pBlock->info.parTbName, pBlock->info.groupId,*/
|
|
||||||
/*pInfo, pInfo->pGroupIdTbNameMap);*/
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pBlock->info.parTbName[0]) {
|
|
||||||
taosHashPut(pInfo->pGroupIdTbNameMap, &pBlock->info.groupId, sizeof(int64_t), &pBlock->info.parTbName,
|
|
||||||
TSDB_TABLE_NAME_LEN);
|
|
||||||
/*printf("\n\n put tbname %s\n\n", pBlock->info.parTbName);*/
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pBlock->info.type == STREAM_DELETE_DATA || pBlock->info.type == STREAM_DELETE_RESULT ||
|
if (pBlock->info.type == STREAM_DELETE_DATA || pBlock->info.type == STREAM_DELETE_RESULT ||
|
||||||
pBlock->info.type == STREAM_CLEAR) {
|
pBlock->info.type == STREAM_CLEAR) {
|
||||||
SArray* pWins = taosArrayInit(16, sizeof(SSessionKey));
|
SArray* pWins = taosArrayInit(16, sizeof(SSessionKey));
|
||||||
|
@ -4211,8 +4093,6 @@ SOperatorInfo* createStreamSessionAggOperatorInfo(SOperatorInfo* downstream, SPh
|
||||||
pInfo->isFinal = false;
|
pInfo->isFinal = false;
|
||||||
pInfo->pPhyNode = pPhyNode;
|
pInfo->pPhyNode = pPhyNode;
|
||||||
pInfo->ignoreExpiredData = pSessionNode->window.igExpired;
|
pInfo->ignoreExpiredData = pSessionNode->window.igExpired;
|
||||||
pInfo->pGroupIdTbNameMap =
|
|
||||||
taosHashInit(1024, taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT), false, HASH_NO_LOCK);
|
|
||||||
|
|
||||||
setOperatorInfo(pOperator, "StreamSessionWindowAggOperator", QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION, true,
|
setOperatorInfo(pOperator, "StreamSessionWindowAggOperator", QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION, true,
|
||||||
OP_NOT_OPENED, pInfo, pTaskInfo);
|
OP_NOT_OPENED, pInfo, pTaskInfo);
|
||||||
|
@ -4287,12 +4167,6 @@ static SSDataBlock* doStreamSessionSemiAgg(SOperatorInfo* pOperator) {
|
||||||
}
|
}
|
||||||
printDataBlock(pBlock, "semi session recv");
|
printDataBlock(pBlock, "semi session recv");
|
||||||
|
|
||||||
if (pBlock->info.parTbName[0]) {
|
|
||||||
taosHashPut(pInfo->pGroupIdTbNameMap, &pBlock->info.groupId, sizeof(int64_t), &pBlock->info.parTbName,
|
|
||||||
TSDB_TABLE_NAME_LEN);
|
|
||||||
/*printf("\n\n put tbname %s\n\n", pBlock->info.parTbName);*/
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pBlock->info.type == STREAM_DELETE_DATA || pBlock->info.type == STREAM_DELETE_RESULT ||
|
if (pBlock->info.type == STREAM_DELETE_DATA || pBlock->info.type == STREAM_DELETE_RESULT ||
|
||||||
pBlock->info.type == STREAM_CLEAR) {
|
pBlock->info.type == STREAM_CLEAR) {
|
||||||
// gap must be 0
|
// gap must be 0
|
||||||
|
@ -4374,9 +4248,6 @@ SOperatorInfo* createStreamFinalSessionAggOperatorInfo(SOperatorInfo* downstream
|
||||||
|
|
||||||
setOperatorInfo(pOperator, name, pPhyNode->type, false, OP_NOT_OPENED, pInfo, pTaskInfo);
|
setOperatorInfo(pOperator, name, pPhyNode->type, false, OP_NOT_OPENED, pInfo, pTaskInfo);
|
||||||
|
|
||||||
pInfo->pGroupIdTbNameMap =
|
|
||||||
taosHashInit(1024, taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT), false, HASH_NO_LOCK);
|
|
||||||
|
|
||||||
pOperator->operatorType = pPhyNode->type;
|
pOperator->operatorType = pPhyNode->type;
|
||||||
if (numOfChild > 0) {
|
if (numOfChild > 0) {
|
||||||
pInfo->pChildren = taosArrayInit(numOfChild, sizeof(void*));
|
pInfo->pChildren = taosArrayInit(numOfChild, sizeof(void*));
|
||||||
|
@ -4415,16 +4286,14 @@ void destroyStreamStateOperatorInfo(void* param) {
|
||||||
if (pInfo->pChildren != NULL) {
|
if (pInfo->pChildren != NULL) {
|
||||||
int32_t size = taosArrayGetSize(pInfo->pChildren);
|
int32_t size = taosArrayGetSize(pInfo->pChildren);
|
||||||
for (int32_t i = 0; i < size; i++) {
|
for (int32_t i = 0; i < size; i++) {
|
||||||
SOperatorInfo* pChild = taosArrayGetP(pInfo->pChildren, i);
|
SOperatorInfo* pChild = taosArrayGetP(pInfo->pChildren, i);
|
||||||
SStreamSessionAggOperatorInfo* pChInfo = pChild->info;
|
destroyOperatorInfo(pChild);
|
||||||
destroyStreamSessionAggOperatorInfo(pChInfo);
|
|
||||||
taosMemoryFreeClear(pChild);
|
|
||||||
}
|
}
|
||||||
|
taosArrayDestroy(pInfo->pChildren);
|
||||||
}
|
}
|
||||||
colDataDestroy(&pInfo->twAggSup.timeWindowData);
|
colDataDestroy(&pInfo->twAggSup.timeWindowData);
|
||||||
blockDataDestroy(pInfo->pDelRes);
|
blockDataDestroy(pInfo->pDelRes);
|
||||||
tSimpleHashCleanup(pInfo->pSeDeleted);
|
tSimpleHashCleanup(pInfo->pSeDeleted);
|
||||||
taosHashCleanup(pInfo->pGroupIdTbNameMap);
|
|
||||||
taosMemoryFreeClear(param);
|
taosMemoryFreeClear(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4618,12 +4487,6 @@ static SSDataBlock* doStreamStateAgg(SOperatorInfo* pOperator) {
|
||||||
}
|
}
|
||||||
printDataBlock(pBlock, "single state recv");
|
printDataBlock(pBlock, "single state recv");
|
||||||
|
|
||||||
if (pBlock->info.parTbName[0]) {
|
|
||||||
taosHashPut(pInfo->pGroupIdTbNameMap, &pBlock->info.groupId, sizeof(int64_t), &pBlock->info.parTbName,
|
|
||||||
TSDB_TABLE_NAME_LEN);
|
|
||||||
/*printf("\n\n put tbname %s\n\n", pBlock->info.parTbName);*/
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pBlock->info.type == STREAM_DELETE_DATA || pBlock->info.type == STREAM_DELETE_RESULT ||
|
if (pBlock->info.type == STREAM_DELETE_DATA || pBlock->info.type == STREAM_DELETE_RESULT ||
|
||||||
pBlock->info.type == STREAM_CLEAR) {
|
pBlock->info.type == STREAM_CLEAR) {
|
||||||
SArray* pWins = taosArrayInit(16, sizeof(SSessionKey));
|
SArray* pWins = taosArrayInit(16, sizeof(SSessionKey));
|
||||||
|
@ -4737,9 +4600,6 @@ SOperatorInfo* createStreamStateAggOperatorInfo(SOperatorInfo* downstream, SPhys
|
||||||
pInfo->pChildren = NULL;
|
pInfo->pChildren = NULL;
|
||||||
pInfo->ignoreExpiredData = pStateNode->window.igExpired;
|
pInfo->ignoreExpiredData = pStateNode->window.igExpired;
|
||||||
|
|
||||||
pInfo->pGroupIdTbNameMap =
|
|
||||||
taosHashInit(1024, taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT), false, HASH_NO_LOCK);
|
|
||||||
|
|
||||||
setOperatorInfo(pOperator, "StreamStateAggOperator", QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE, true, OP_NOT_OPENED,
|
setOperatorInfo(pOperator, "StreamStateAggOperator", QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE, true, OP_NOT_OPENED,
|
||||||
pInfo, pTaskInfo);
|
pInfo, pTaskInfo);
|
||||||
pOperator->fpSet =
|
pOperator->fpSet =
|
||||||
|
@ -4898,6 +4758,7 @@ static void doMergeAlignedIntervalAgg(SOperatorInfo* pOperator) {
|
||||||
if (pMiaInfo->groupId == 0) {
|
if (pMiaInfo->groupId == 0) {
|
||||||
if (pMiaInfo->groupId != pBlock->info.groupId) {
|
if (pMiaInfo->groupId != pBlock->info.groupId) {
|
||||||
pMiaInfo->groupId = pBlock->info.groupId;
|
pMiaInfo->groupId = pBlock->info.groupId;
|
||||||
|
pRes->info.groupId = pMiaInfo->groupId;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (pMiaInfo->groupId != pBlock->info.groupId) {
|
if (pMiaInfo->groupId != pBlock->info.groupId) {
|
||||||
|
@ -4911,6 +4772,7 @@ static void doMergeAlignedIntervalAgg(SOperatorInfo* pOperator) {
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
// continue
|
// continue
|
||||||
|
pRes->info.groupId = pMiaInfo->groupId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5388,12 +5250,6 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) {
|
||||||
}
|
}
|
||||||
printDataBlock(pBlock, "single interval recv");
|
printDataBlock(pBlock, "single interval recv");
|
||||||
|
|
||||||
if (pBlock->info.parTbName[0]) {
|
|
||||||
taosHashPut(pInfo->pGroupIdTbNameMap, &pBlock->info.groupId, sizeof(int64_t), &pBlock->info.parTbName,
|
|
||||||
TSDB_TABLE_NAME_LEN);
|
|
||||||
/*printf("\n\n put tbname %s\n\n", pBlock->info.parTbName);*/
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pBlock->info.type == STREAM_DELETE_DATA || pBlock->info.type == STREAM_DELETE_RESULT ||
|
if (pBlock->info.type == STREAM_DELETE_DATA || pBlock->info.type == STREAM_DELETE_RESULT ||
|
||||||
pBlock->info.type == STREAM_CLEAR) {
|
pBlock->info.type == STREAM_CLEAR) {
|
||||||
doDeleteWindows(pOperator, &pInfo->interval, pBlock, pInfo->pDelWins, pUpdatedMap);
|
doDeleteWindows(pOperator, &pInfo->interval, pBlock, pInfo->pDelWins, pUpdatedMap);
|
||||||
|
@ -5551,9 +5407,6 @@ SOperatorInfo* createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SPhys
|
||||||
pInfo->delKey.ts = INT64_MAX;
|
pInfo->delKey.ts = INT64_MAX;
|
||||||
pInfo->delKey.groupId = 0;
|
pInfo->delKey.groupId = 0;
|
||||||
|
|
||||||
pInfo->pGroupIdTbNameMap =
|
|
||||||
taosHashInit(1024, taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT), false, HASH_NO_LOCK);
|
|
||||||
|
|
||||||
setOperatorInfo(pOperator, "StreamIntervalOperator", QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL, true, OP_NOT_OPENED,
|
setOperatorInfo(pOperator, "StreamIntervalOperator", QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL, true, OP_NOT_OPENED,
|
||||||
pInfo, pTaskInfo);
|
pInfo, pTaskInfo);
|
||||||
pOperator->fpSet =
|
pOperator->fpSet =
|
||||||
|
|
|
@ -584,15 +584,11 @@ static int32_t doInternalMergeSort(SSortHandle* pHandle) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO consider the page meta size
|
// get sort page size
|
||||||
int32_t getProperSortPageSize(size_t rowSize) {
|
int32_t getProperSortPageSize(size_t rowSize, uint32_t numOfCols) {
|
||||||
uint32_t defaultPageSize = 4096;
|
uint32_t pgSize = rowSize * 4 + blockDataGetSerialMetaSize(numOfCols);
|
||||||
|
if (pgSize < DEFAULT_PAGESIZE) {
|
||||||
uint32_t pgSize = 0;
|
return DEFAULT_PAGESIZE;
|
||||||
if (rowSize * 4 > defaultPageSize) {
|
|
||||||
pgSize = rowSize * 4;
|
|
||||||
} else {
|
|
||||||
pgSize = defaultPageSize;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return pgSize;
|
return pgSize;
|
||||||
|
@ -612,7 +608,8 @@ static int32_t createInitialSources(SSortHandle* pHandle) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pHandle->pDataBlock == NULL) {
|
if (pHandle->pDataBlock == NULL) {
|
||||||
pHandle->pageSize = getProperSortPageSize(blockDataGetRowSize(pBlock));
|
uint32_t numOfCols = taosArrayGetSize(pBlock->pDataBlock);
|
||||||
|
pHandle->pageSize = getProperSortPageSize(blockDataGetRowSize(pBlock), numOfCols);
|
||||||
|
|
||||||
// todo, number of pages are set according to the total available sort buffer
|
// todo, number of pages are set according to the total available sort buffer
|
||||||
pHandle->numOfPages = 1024;
|
pHandle->numOfPages = 1024;
|
||||||
|
|
|
@ -917,6 +917,7 @@ static bool validateHistogramBinDesc(char* binDescStr, int8_t binType, char* err
|
||||||
int32_t startIndex;
|
int32_t startIndex;
|
||||||
if (numOfParams != 4) {
|
if (numOfParams != 4) {
|
||||||
snprintf(errMsg, msgLen, "%s", msg1);
|
snprintf(errMsg, msgLen, "%s", msg1);
|
||||||
|
cJSON_Delete(binDesc);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -928,17 +929,20 @@ static bool validateHistogramBinDesc(char* binDescStr, int8_t binType, char* err
|
||||||
|
|
||||||
if (!cJSON_IsNumber(start) || !cJSON_IsNumber(count) || !cJSON_IsBool(infinity)) {
|
if (!cJSON_IsNumber(start) || !cJSON_IsNumber(count) || !cJSON_IsBool(infinity)) {
|
||||||
snprintf(errMsg, msgLen, "%s", msg3);
|
snprintf(errMsg, msgLen, "%s", msg3);
|
||||||
|
cJSON_Delete(binDesc);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count->valueint <= 0 || count->valueint > 1000) { // limit count to 1000
|
if (count->valueint <= 0 || count->valueint > 1000) { // limit count to 1000
|
||||||
snprintf(errMsg, msgLen, "%s", msg4);
|
snprintf(errMsg, msgLen, "%s", msg4);
|
||||||
|
cJSON_Delete(binDesc);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isinf(start->valuedouble) || (width != NULL && isinf(width->valuedouble)) ||
|
if (isinf(start->valuedouble) || (width != NULL && isinf(width->valuedouble)) ||
|
||||||
(factor != NULL && isinf(factor->valuedouble)) || (count != NULL && isinf(count->valuedouble))) {
|
(factor != NULL && isinf(factor->valuedouble)) || (count != NULL && isinf(count->valuedouble))) {
|
||||||
snprintf(errMsg, msgLen, "%s", msg5);
|
snprintf(errMsg, msgLen, "%s", msg5);
|
||||||
|
cJSON_Delete(binDesc);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -957,6 +961,7 @@ static bool validateHistogramBinDesc(char* binDescStr, int8_t binType, char* err
|
||||||
if (width->valuedouble == 0) {
|
if (width->valuedouble == 0) {
|
||||||
snprintf(errMsg, msgLen, "%s", msg6);
|
snprintf(errMsg, msgLen, "%s", msg6);
|
||||||
taosMemoryFree(intervals);
|
taosMemoryFree(intervals);
|
||||||
|
cJSON_Delete(binDesc);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < counter + 1; ++i) {
|
for (int i = 0; i < counter + 1; ++i) {
|
||||||
|
@ -964,6 +969,7 @@ static bool validateHistogramBinDesc(char* binDescStr, int8_t binType, char* err
|
||||||
if (isinf(intervals[startIndex])) {
|
if (isinf(intervals[startIndex])) {
|
||||||
snprintf(errMsg, msgLen, "%s", msg5);
|
snprintf(errMsg, msgLen, "%s", msg5);
|
||||||
taosMemoryFree(intervals);
|
taosMemoryFree(intervals);
|
||||||
|
cJSON_Delete(binDesc);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
startIndex++;
|
startIndex++;
|
||||||
|
@ -973,11 +979,13 @@ static bool validateHistogramBinDesc(char* binDescStr, int8_t binType, char* err
|
||||||
if (start->valuedouble == 0) {
|
if (start->valuedouble == 0) {
|
||||||
snprintf(errMsg, msgLen, "%s", msg7);
|
snprintf(errMsg, msgLen, "%s", msg7);
|
||||||
taosMemoryFree(intervals);
|
taosMemoryFree(intervals);
|
||||||
|
cJSON_Delete(binDesc);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (factor->valuedouble < 0 || factor->valuedouble == 0 || factor->valuedouble == 1) {
|
if (factor->valuedouble < 0 || factor->valuedouble == 0 || factor->valuedouble == 1) {
|
||||||
snprintf(errMsg, msgLen, "%s", msg8);
|
snprintf(errMsg, msgLen, "%s", msg8);
|
||||||
taosMemoryFree(intervals);
|
taosMemoryFree(intervals);
|
||||||
|
cJSON_Delete(binDesc);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < counter + 1; ++i) {
|
for (int i = 0; i < counter + 1; ++i) {
|
||||||
|
@ -985,6 +993,7 @@ static bool validateHistogramBinDesc(char* binDescStr, int8_t binType, char* err
|
||||||
if (isinf(intervals[startIndex])) {
|
if (isinf(intervals[startIndex])) {
|
||||||
snprintf(errMsg, msgLen, "%s", msg5);
|
snprintf(errMsg, msgLen, "%s", msg5);
|
||||||
taosMemoryFree(intervals);
|
taosMemoryFree(intervals);
|
||||||
|
cJSON_Delete(binDesc);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
startIndex++;
|
startIndex++;
|
||||||
|
@ -992,6 +1001,7 @@ static bool validateHistogramBinDesc(char* binDescStr, int8_t binType, char* err
|
||||||
} else {
|
} else {
|
||||||
snprintf(errMsg, msgLen, "%s", msg3);
|
snprintf(errMsg, msgLen, "%s", msg3);
|
||||||
taosMemoryFree(intervals);
|
taosMemoryFree(intervals);
|
||||||
|
cJSON_Delete(binDesc);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1007,6 +1017,7 @@ static bool validateHistogramBinDesc(char* binDescStr, int8_t binType, char* err
|
||||||
} else if (cJSON_IsArray(binDesc)) { /* user input bins */
|
} else if (cJSON_IsArray(binDesc)) { /* user input bins */
|
||||||
if (binType != USER_INPUT_BIN) {
|
if (binType != USER_INPUT_BIN) {
|
||||||
snprintf(errMsg, msgLen, "%s", msg3);
|
snprintf(errMsg, msgLen, "%s", msg3);
|
||||||
|
cJSON_Delete(binDesc);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
numOfBins = cJSON_GetArraySize(binDesc);
|
numOfBins = cJSON_GetArraySize(binDesc);
|
||||||
|
@ -1015,6 +1026,7 @@ static bool validateHistogramBinDesc(char* binDescStr, int8_t binType, char* err
|
||||||
if (bin == NULL) {
|
if (bin == NULL) {
|
||||||
snprintf(errMsg, msgLen, "%s", msg3);
|
snprintf(errMsg, msgLen, "%s", msg3);
|
||||||
taosMemoryFree(intervals);
|
taosMemoryFree(intervals);
|
||||||
|
cJSON_Delete(binDesc);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -1023,11 +1035,13 @@ static bool validateHistogramBinDesc(char* binDescStr, int8_t binType, char* err
|
||||||
if (!cJSON_IsNumber(bin)) {
|
if (!cJSON_IsNumber(bin)) {
|
||||||
snprintf(errMsg, msgLen, "%s", msg3);
|
snprintf(errMsg, msgLen, "%s", msg3);
|
||||||
taosMemoryFree(intervals);
|
taosMemoryFree(intervals);
|
||||||
|
cJSON_Delete(binDesc);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (i != 0 && intervals[i] <= intervals[i - 1]) {
|
if (i != 0 && intervals[i] <= intervals[i - 1]) {
|
||||||
snprintf(errMsg, msgLen, "%s", msg3);
|
snprintf(errMsg, msgLen, "%s", msg3);
|
||||||
taosMemoryFree(intervals);
|
taosMemoryFree(intervals);
|
||||||
|
cJSON_Delete(binDesc);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bin = bin->next;
|
bin = bin->next;
|
||||||
|
@ -1035,6 +1049,7 @@ static bool validateHistogramBinDesc(char* binDescStr, int8_t binType, char* err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
snprintf(errMsg, msgLen, "%s", msg3);
|
snprintf(errMsg, msgLen, "%s", msg3);
|
||||||
|
cJSON_Delete(binDesc);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1464,11 +1479,16 @@ static int32_t translateDerivative(SFunctionNode* pFunc, char* pErrBuf, int32_t
|
||||||
uint8_t colType = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->resType.type;
|
uint8_t colType = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->resType.type;
|
||||||
|
|
||||||
// param1
|
// param1
|
||||||
SNode* pParamNode1 = nodesListGetNode(pFunc->pParameterList, 1);
|
SNode* pParamNode1 = nodesListGetNode(pFunc->pParameterList, 1);
|
||||||
|
SValueNode* pValue1 = (SValueNode*)pParamNode1;
|
||||||
if (QUERY_NODE_VALUE != nodeType(pParamNode1)) {
|
if (QUERY_NODE_VALUE != nodeType(pParamNode1)) {
|
||||||
return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName);
|
return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pValue1->datum.i <= 0) {
|
||||||
|
return invaildFuncParaValueErrMsg(pErrBuf, len, pFunc->functionName);
|
||||||
|
}
|
||||||
|
|
||||||
SValueNode* pValue = (SValueNode*)pParamNode1;
|
SValueNode* pValue = (SValueNode*)pParamNode1;
|
||||||
pValue->notReserved = true;
|
pValue->notReserved = true;
|
||||||
|
|
||||||
|
|
|
@ -48,8 +48,8 @@ typedef struct SSumRes {
|
||||||
double dsum;
|
double dsum;
|
||||||
};
|
};
|
||||||
int16_t type;
|
int16_t type;
|
||||||
int64_t prevTs; // used for csum only
|
int64_t prevTs; // used for csum only
|
||||||
bool isPrevTsSet; //used for csum only
|
bool isPrevTsSet; // used for csum only
|
||||||
|
|
||||||
} SSumRes;
|
} SSumRes;
|
||||||
|
|
||||||
|
@ -1083,7 +1083,10 @@ int32_t avgFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
|
||||||
SAvgRes* pAvgRes = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx));
|
SAvgRes* pAvgRes = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx));
|
||||||
int32_t type = pAvgRes->type;
|
int32_t type = pAvgRes->type;
|
||||||
|
|
||||||
if (IS_SIGNED_NUMERIC_TYPE(type)) {
|
if (pAvgRes->count == 0) {
|
||||||
|
// [ASAN] runtime error: division by zero
|
||||||
|
GET_RES_INFO(pCtx)->numOfRes = 0;
|
||||||
|
} else if (IS_SIGNED_NUMERIC_TYPE(type)) {
|
||||||
pAvgRes->result = pAvgRes->sum.isum / ((double)pAvgRes->count);
|
pAvgRes->result = pAvgRes->sum.isum / ((double)pAvgRes->count);
|
||||||
} else if (IS_UNSIGNED_NUMERIC_TYPE(type)) {
|
} else if (IS_UNSIGNED_NUMERIC_TYPE(type)) {
|
||||||
pAvgRes->result = pAvgRes->sum.usum / ((double)pAvgRes->count);
|
pAvgRes->result = pAvgRes->sum.usum / ((double)pAvgRes->count);
|
||||||
|
@ -2217,8 +2220,8 @@ bool leastSQRFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResultInf
|
||||||
|
|
||||||
SLeastSQRInfo* pInfo = GET_ROWCELL_INTERBUF(pResultInfo);
|
SLeastSQRInfo* pInfo = GET_ROWCELL_INTERBUF(pResultInfo);
|
||||||
|
|
||||||
pInfo->startVal = IS_FLOAT_TYPE(pCtx->param[1].param.nType) ? pCtx->param[1].param.d : (double)pCtx->param[1].param.i;
|
GET_TYPED_DATA(pInfo->startVal, double, pCtx->param[1].param.nType, &pCtx->param[1].param.i);
|
||||||
pInfo->stepVal = IS_FLOAT_TYPE(pCtx->param[2].param.nType) ? pCtx->param[2].param.d : (double)pCtx->param[2].param.i;
|
GET_TYPED_DATA(pInfo->stepVal, double, pCtx->param[2].param.nType, &pCtx->param[2].param.i);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2562,8 +2565,8 @@ int32_t percentileFunction(SqlFunctionCtx* pCtx) {
|
||||||
|
|
||||||
int32_t percentileFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
|
int32_t percentileFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
|
||||||
SVariant* pVal = &pCtx->param[1].param;
|
SVariant* pVal = &pCtx->param[1].param;
|
||||||
double v =
|
double v = 0;
|
||||||
(IS_SIGNED_NUMERIC_TYPE(pVal->nType) ? pVal->i : (IS_UNSIGNED_NUMERIC_TYPE(pVal->nType) ? pVal->u : pVal->d));
|
GET_TYPED_DATA(v, double, pVal->nType, &pVal->i);
|
||||||
|
|
||||||
SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx);
|
SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx);
|
||||||
SPercentileInfo* ppInfo = (SPercentileInfo*)GET_ROWCELL_INTERBUF(pResInfo);
|
SPercentileInfo* ppInfo = (SPercentileInfo*)GET_ROWCELL_INTERBUF(pResInfo);
|
||||||
|
@ -2622,8 +2625,8 @@ bool apercentileFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResult
|
||||||
SAPercentileInfo* pInfo = GET_ROWCELL_INTERBUF(pResultInfo);
|
SAPercentileInfo* pInfo = GET_ROWCELL_INTERBUF(pResultInfo);
|
||||||
|
|
||||||
SVariant* pVal = &pCtx->param[1].param;
|
SVariant* pVal = &pCtx->param[1].param;
|
||||||
pInfo->percent =
|
pInfo->percent = 0;
|
||||||
(IS_SIGNED_NUMERIC_TYPE(pVal->nType) ? pVal->i : (IS_UNSIGNED_NUMERIC_TYPE(pVal->nType) ? pVal->u : pVal->d));
|
GET_TYPED_DATA(pInfo->percent, double, pVal->nType, &pVal->i);
|
||||||
|
|
||||||
if (pCtx->numOfParams == 2) {
|
if (pCtx->numOfParams == 2) {
|
||||||
pInfo->algo = APERCT_ALGO_DEFAULT;
|
pInfo->algo = APERCT_ALGO_DEFAULT;
|
||||||
|
@ -3719,6 +3722,12 @@ static int32_t topBotResComparFn(const void* p1, const void* p2, const void* par
|
||||||
}
|
}
|
||||||
|
|
||||||
return (val1->v.u > val2->v.u) ? 1 : -1;
|
return (val1->v.u > val2->v.u) ? 1 : -1;
|
||||||
|
} else if (TSDB_DATA_TYPE_FLOAT == type) {
|
||||||
|
if (val1->v.f == val2->v.f) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (val1->v.f > val2->v.f) ? 1 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (val1->v.d == val2->v.d) {
|
if (val1->v.d == val2->v.d) {
|
||||||
|
@ -3759,10 +3768,12 @@ void doAddIntoResult(SqlFunctionCtx* pCtx, void* pData, int32_t rowIndex, SSData
|
||||||
} else { // replace the minimum value in the result
|
} else { // replace the minimum value in the result
|
||||||
if ((isTopQuery && ((IS_SIGNED_NUMERIC_TYPE(type) && val.i > pItems[0].v.i) ||
|
if ((isTopQuery && ((IS_SIGNED_NUMERIC_TYPE(type) && val.i > pItems[0].v.i) ||
|
||||||
(IS_UNSIGNED_NUMERIC_TYPE(type) && val.u > pItems[0].v.u) ||
|
(IS_UNSIGNED_NUMERIC_TYPE(type) && val.u > pItems[0].v.u) ||
|
||||||
(IS_FLOAT_TYPE(type) && val.d > pItems[0].v.d))) ||
|
(TSDB_DATA_TYPE_FLOAT == type && val.f > pItems[0].v.f) ||
|
||||||
|
(TSDB_DATA_TYPE_DOUBLE == type && val.d > pItems[0].v.d))) ||
|
||||||
(!isTopQuery && ((IS_SIGNED_NUMERIC_TYPE(type) && val.i < pItems[0].v.i) ||
|
(!isTopQuery && ((IS_SIGNED_NUMERIC_TYPE(type) && val.i < pItems[0].v.i) ||
|
||||||
(IS_UNSIGNED_NUMERIC_TYPE(type) && val.u < pItems[0].v.u) ||
|
(IS_UNSIGNED_NUMERIC_TYPE(type) && val.u < pItems[0].v.u) ||
|
||||||
(IS_FLOAT_TYPE(type) && val.d < pItems[0].v.d)))) {
|
(TSDB_DATA_TYPE_FLOAT == type && val.f < pItems[0].v.f) ||
|
||||||
|
(TSDB_DATA_TYPE_DOUBLE == type && val.d < pItems[0].v.d)))) {
|
||||||
// replace the old data and the coresponding tuple data
|
// replace the old data and the coresponding tuple data
|
||||||
STopBotResItem* pItem = &pItems[0];
|
STopBotResItem* pItem = &pItems[0];
|
||||||
pItem->v = val;
|
pItem->v = val;
|
||||||
|
@ -3925,12 +3936,7 @@ int32_t topBotFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
|
||||||
}
|
}
|
||||||
for (int32_t i = 0; i < pEntryInfo->numOfRes; ++i) {
|
for (int32_t i = 0; i < pEntryInfo->numOfRes; ++i) {
|
||||||
STopBotResItem* pItem = &pRes->pItems[i];
|
STopBotResItem* pItem = &pRes->pItems[i];
|
||||||
if (type == TSDB_DATA_TYPE_FLOAT) {
|
colDataAppend(pCol, currentRow, (const char*)&pItem->v.i, false);
|
||||||
float v = pItem->v.d;
|
|
||||||
colDataAppend(pCol, currentRow, (const char*)&v, false);
|
|
||||||
} else {
|
|
||||||
colDataAppend(pCol, currentRow, (const char*)&pItem->v.i, false);
|
|
||||||
}
|
|
||||||
#ifdef BUF_PAGE_DEBUG
|
#ifdef BUF_PAGE_DEBUG
|
||||||
qDebug("page_finalize i:%d,item:%p,pageId:%d, offset:%d\n", i, pItem, pItem->tuplePos.pageId,
|
qDebug("page_finalize i:%d,item:%p,pageId:%d, offset:%d\n", i, pItem, pItem->tuplePos.pageId,
|
||||||
pItem->tuplePos.offset);
|
pItem->tuplePos.offset);
|
||||||
|
@ -3961,10 +3967,12 @@ void addResult(SqlFunctionCtx* pCtx, STopBotResItem* pSourceItem, int16_t type,
|
||||||
} else { // replace the minimum value in the result
|
} else { // replace the minimum value in the result
|
||||||
if ((isTopQuery && ((IS_SIGNED_NUMERIC_TYPE(type) && pSourceItem->v.i > pItems[0].v.i) ||
|
if ((isTopQuery && ((IS_SIGNED_NUMERIC_TYPE(type) && pSourceItem->v.i > pItems[0].v.i) ||
|
||||||
(IS_UNSIGNED_NUMERIC_TYPE(type) && pSourceItem->v.u > pItems[0].v.u) ||
|
(IS_UNSIGNED_NUMERIC_TYPE(type) && pSourceItem->v.u > pItems[0].v.u) ||
|
||||||
(IS_FLOAT_TYPE(type) && pSourceItem->v.d > pItems[0].v.d))) ||
|
(TSDB_DATA_TYPE_FLOAT == type && pSourceItem->v.f > pItems[0].v.f) ||
|
||||||
|
(TSDB_DATA_TYPE_DOUBLE == type && pSourceItem->v.d > pItems[0].v.d))) ||
|
||||||
(!isTopQuery && ((IS_SIGNED_NUMERIC_TYPE(type) && pSourceItem->v.i < pItems[0].v.i) ||
|
(!isTopQuery && ((IS_SIGNED_NUMERIC_TYPE(type) && pSourceItem->v.i < pItems[0].v.i) ||
|
||||||
(IS_UNSIGNED_NUMERIC_TYPE(type) && pSourceItem->v.u < pItems[0].v.u) ||
|
(IS_UNSIGNED_NUMERIC_TYPE(type) && pSourceItem->v.u < pItems[0].v.u) ||
|
||||||
(IS_FLOAT_TYPE(type) && pSourceItem->v.d < pItems[0].v.d)))) {
|
(TSDB_DATA_TYPE_FLOAT == type && pSourceItem->v.f < pItems[0].v.f) ||
|
||||||
|
(TSDB_DATA_TYPE_DOUBLE == type && pSourceItem->v.d < pItems[0].v.d)))) {
|
||||||
// replace the old data and the coresponding tuple data
|
// replace the old data and the coresponding tuple data
|
||||||
STopBotResItem* pItem = &pItems[0];
|
STopBotResItem* pItem = &pItems[0];
|
||||||
pItem->v = pSourceItem->v;
|
pItem->v = pSourceItem->v;
|
||||||
|
@ -6035,7 +6043,7 @@ int32_t twaFinalize(struct SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
|
||||||
} else {
|
} else {
|
||||||
if (pInfo->win.ekey == pInfo->win.skey) {
|
if (pInfo->win.ekey == pInfo->win.skey) {
|
||||||
pInfo->dOutput = pInfo->p.val;
|
pInfo->dOutput = pInfo->p.val;
|
||||||
} else if (pInfo->win.ekey == INT64_MAX || pInfo->win.skey == INT64_MIN) { //no data in timewindow
|
} else if (pInfo->win.ekey == INT64_MAX || pInfo->win.skey == INT64_MIN) { // no data in timewindow
|
||||||
pInfo->dOutput = 0;
|
pInfo->dOutput = 0;
|
||||||
} else {
|
} else {
|
||||||
pInfo->dOutput = pInfo->dOutput / (pInfo->win.ekey - pInfo->win.skey);
|
pInfo->dOutput = pInfo->dOutput / (pInfo->win.ekey - pInfo->win.skey);
|
||||||
|
|
|
@ -2036,6 +2036,8 @@ void nodesValueNodeToVariant(const SValueNode* pNode, SVariant* pVal) {
|
||||||
pVal->u = pNode->datum.u;
|
pVal->u = pNode->datum.u;
|
||||||
break;
|
break;
|
||||||
case TSDB_DATA_TYPE_FLOAT:
|
case TSDB_DATA_TYPE_FLOAT:
|
||||||
|
pVal->f = pNode->datum.d;
|
||||||
|
break;
|
||||||
case TSDB_DATA_TYPE_DOUBLE:
|
case TSDB_DATA_TYPE_DOUBLE:
|
||||||
pVal->d = pNode->datum.d;
|
pVal->d = pNode->datum.d;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -2762,17 +2762,17 @@ static bool needFill(SNode* pNode) {
|
||||||
return hasFillFunc;
|
return hasFillFunc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool mismatchFillDataType(SDataType origDt, SDataType fillDt) {
|
static int32_t convertFillValue(STranslateContext* pCxt, SDataType dt, SNodeList* pValues, int32_t index) {
|
||||||
if (TSDB_DATA_TYPE_NULL == fillDt.type) {
|
SListCell* pCell = nodesListGetCell(pValues, index);
|
||||||
return false;
|
if (dataTypeEqual(&dt, &((SExprNode*)pCell->pNode)->resType)) {
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
if (IS_NUMERIC_TYPE(origDt.type) && !IS_NUMERIC_TYPE(fillDt.type)) {
|
SNode* pCaseFunc = NULL;
|
||||||
return true;
|
int32_t code = createCastFunc(pCxt, pCell->pNode, dt, &pCaseFunc);
|
||||||
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
code = scalarCalculateConstants(pCaseFunc, &pCell->pNode);
|
||||||
}
|
}
|
||||||
if (IS_VAR_DATA_TYPE(origDt.type) && !IS_VAR_DATA_TYPE(fillDt.type)) {
|
return code;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t checkFillValues(STranslateContext* pCxt, SFillNode* pFill, SNodeList* pProjectionList) {
|
static int32_t checkFillValues(STranslateContext* pCxt, SFillNode* pFill, SNodeList* pProjectionList) {
|
||||||
|
@ -2788,8 +2788,8 @@ static int32_t checkFillValues(STranslateContext* pCxt, SFillNode* pFill, SNodeL
|
||||||
if (fillNo >= LIST_LENGTH(pFillValues->pNodeList)) {
|
if (fillNo >= LIST_LENGTH(pFillValues->pNodeList)) {
|
||||||
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_WRONG_VALUE_TYPE, "Filled values number mismatch");
|
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_WRONG_VALUE_TYPE, "Filled values number mismatch");
|
||||||
}
|
}
|
||||||
if (mismatchFillDataType(((SExprNode*)pProject)->resType,
|
if (TSDB_CODE_SUCCESS !=
|
||||||
((SExprNode*)nodesListGetNode(pFillValues->pNodeList, fillNo))->resType)) {
|
convertFillValue(pCxt, ((SExprNode*)pProject)->resType, pFillValues->pNodeList, fillNo)) {
|
||||||
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_WRONG_VALUE_TYPE, "Filled data type mismatch");
|
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_WRONG_VALUE_TYPE, "Filled data type mismatch");
|
||||||
}
|
}
|
||||||
++fillNo;
|
++fillNo;
|
||||||
|
|
|
@ -348,7 +348,9 @@ static int32_t scanPathOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLogicSub
|
||||||
int32_t code = scanPathOptMatch(pCxt, pLogicSubplan->pNode, &info);
|
int32_t code = scanPathOptMatch(pCxt, pLogicSubplan->pNode, &info);
|
||||||
if (TSDB_CODE_SUCCESS == code && info.pScan) {
|
if (TSDB_CODE_SUCCESS == code && info.pScan) {
|
||||||
scanPathOptSetScanWin(info.pScan);
|
scanPathOptSetScanWin(info.pScan);
|
||||||
scanPathOptSetScanOrder(info.scanOrder, info.pScan);
|
if (!pCxt->pPlanCxt->streamQuery) {
|
||||||
|
scanPathOptSetScanOrder(info.scanOrder, info.pScan);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code && (NULL != info.pDsoFuncs || NULL != info.pSdrFuncs)) {
|
if (TSDB_CODE_SUCCESS == code && (NULL != info.pDsoFuncs || NULL != info.pSdrFuncs)) {
|
||||||
info.pScan->dataRequired = scanPathOptGetDataRequired(info.pSdrFuncs);
|
info.pScan->dataRequired = scanPathOptGetDataRequired(info.pSdrFuncs);
|
||||||
|
|
|
@ -1191,6 +1191,8 @@ void qWorkerStopAllTasks(void *qWorkerMgmt) {
|
||||||
|
|
||||||
if (QW_QUERY_RUNNING(ctx)) {
|
if (QW_QUERY_RUNNING(ctx)) {
|
||||||
qwKillTaskHandle(ctx);
|
qwKillTaskHandle(ctx);
|
||||||
|
} else if (!QW_EVENT_PROCESSED(ctx, QW_EVENT_DROP)) {
|
||||||
|
QW_SET_EVENT_RECEIVED(ctx, QW_EVENT_DROP);
|
||||||
}
|
}
|
||||||
|
|
||||||
QW_UNLOCK(QW_WRITE, &ctx->lock);
|
QW_UNLOCK(QW_WRITE, &ctx->lock);
|
||||||
|
|
|
@ -1704,7 +1704,8 @@ void filterDumpInfoToString(SFilterInfo *info, const char *msg, int32_t options)
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug("GROUP Num:%u", info->groupNum);
|
qDebug("GROUP Num:%u", info->groupNum);
|
||||||
for (uint32_t i = 0; i < info->groupNum; ++i) {
|
uint32_t maxDbgGrpNum = TMIN(info->groupNum, 1000);
|
||||||
|
for (uint32_t i = 0; i < maxDbgGrpNum; ++i) {
|
||||||
SFilterGroup *group = &info->groups[i];
|
SFilterGroup *group = &info->groups[i];
|
||||||
qDebug("Group%d : unit num[%u]", i, group->unitNum);
|
qDebug("Group%d : unit num[%u]", i, group->unitNum);
|
||||||
|
|
||||||
|
@ -3248,14 +3249,18 @@ bool filterExecuteImpl(void *pinfo, int32_t numOfRows, SColumnInfoData *pRes, SC
|
||||||
for (uint32_t u = 0; u < group->unitNum; ++u) {
|
for (uint32_t u = 0; u < group->unitNum; ++u) {
|
||||||
uint32_t uidx = group->unitIdxs[u];
|
uint32_t uidx = group->unitIdxs[u];
|
||||||
SFilterComUnit *cunit = &info->cunits[uidx];
|
SFilterComUnit *cunit = &info->cunits[uidx];
|
||||||
void *colData = colDataGetData((SColumnInfoData *)(cunit->colData), i);
|
void *colData = NULL;
|
||||||
|
bool isNull = colDataIsNull((SColumnInfoData *)(cunit->colData), 0, i, NULL);
|
||||||
// if (FILTER_UNIT_GET_F(info, uidx)) {
|
// if (FILTER_UNIT_GET_F(info, uidx)) {
|
||||||
// p[i] = FILTER_UNIT_GET_R(info, uidx);
|
// p[i] = FILTER_UNIT_GET_R(info, uidx);
|
||||||
// } else {
|
// } else {
|
||||||
uint8_t optr = cunit->optr;
|
uint8_t optr = cunit->optr;
|
||||||
|
|
||||||
if (colData == NULL || colDataIsNull((SColumnInfoData *)(cunit->colData), 0, i, NULL)) {
|
if (!isNull) {
|
||||||
|
colData = colDataGetData((SColumnInfoData *)(cunit->colData), i);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (colData == NULL || isNull) {
|
||||||
p[i] = optr == OP_TYPE_IS_NULL ? true : false;
|
p[i] = optr == OP_TYPE_IS_NULL ? true : false;
|
||||||
} else {
|
} else {
|
||||||
if (optr == OP_TYPE_IS_NOT_NULL) {
|
if (optr == OP_TYPE_IS_NOT_NULL) {
|
||||||
|
@ -3916,6 +3921,10 @@ EDealRes fltReviseRewriter(SNode **pNode, void *pContext) {
|
||||||
} else {
|
} else {
|
||||||
SColumnNode *refNode = (SColumnNode *)node->pLeft;
|
SColumnNode *refNode = (SColumnNode *)node->pLeft;
|
||||||
SNodeListNode *listNode = (SNodeListNode *)node->pRight;
|
SNodeListNode *listNode = (SNodeListNode *)node->pRight;
|
||||||
|
if (LIST_LENGTH(listNode->pNodeList) > 10) {
|
||||||
|
stat->scalarMode = true;
|
||||||
|
return DEAL_RES_CONTINUE;
|
||||||
|
}
|
||||||
int32_t type = vectorGetConvertType(refNode->node.resType.type, listNode->dataType.type);
|
int32_t type = vectorGetConvertType(refNode->node.resType.type, listNode->dataType.type);
|
||||||
if (0 != type && type != refNode->node.resType.type) {
|
if (0 != type && type != refNode->node.resType.type) {
|
||||||
stat->scalarMode = true;
|
stat->scalarMode = true;
|
||||||
|
|
|
@ -91,6 +91,7 @@ int32_t streamScanExec(SStreamTask* pTask, int32_t batchSz) {
|
||||||
void* exec = pTask->exec.executor;
|
void* exec = pTask->exec.executor;
|
||||||
|
|
||||||
qSetStreamOpOpen(exec);
|
qSetStreamOpOpen(exec);
|
||||||
|
bool finished = false;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
SArray* pRes = taosArrayInit(0, sizeof(SSDataBlock));
|
SArray* pRes = taosArrayInit(0, sizeof(SSDataBlock));
|
||||||
|
@ -106,7 +107,10 @@ int32_t streamScanExec(SStreamTask* pTask, int32_t batchSz) {
|
||||||
if (qExecTask(exec, &output, &ts) < 0) {
|
if (qExecTask(exec, &output, &ts) < 0) {
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
}
|
}
|
||||||
if (output == NULL) break;
|
if (output == NULL) {
|
||||||
|
finished = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
SSDataBlock block = {0};
|
SSDataBlock block = {0};
|
||||||
assignOneDataBlock(&block, output);
|
assignOneDataBlock(&block, output);
|
||||||
|
@ -133,6 +137,7 @@ int32_t streamScanExec(SStreamTask* pTask, int32_t batchSz) {
|
||||||
if (pTask->outputType == TASK_OUTPUT__FIXED_DISPATCH || pTask->outputType == TASK_OUTPUT__SHUFFLE_DISPATCH) {
|
if (pTask->outputType == TASK_OUTPUT__FIXED_DISPATCH || pTask->outputType == TASK_OUTPUT__SHUFFLE_DISPATCH) {
|
||||||
streamDispatch(pTask);
|
streamDispatch(pTask);
|
||||||
}
|
}
|
||||||
|
if (finished) break;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "executor.h"
|
#include "executor.h"
|
||||||
#include "streamInc.h"
|
#include "streamInc.h"
|
||||||
#include "tcommon.h"
|
#include "tcommon.h"
|
||||||
|
#include "tcompare.h"
|
||||||
#include "ttimer.h"
|
#include "ttimer.h"
|
||||||
|
|
||||||
// todo refactor
|
// todo refactor
|
||||||
|
@ -113,6 +114,12 @@ SStreamState* streamStateOpen(char* path, SStreamTask* pTask, bool specPath, int
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
pState->pTdbState = taosMemoryCalloc(1, sizeof(STdbState));
|
||||||
|
if (pState->pTdbState == NULL) {
|
||||||
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
streamStateDestroy(pState);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
char statePath[1024];
|
char statePath[1024];
|
||||||
if (!specPath) {
|
if (!specPath) {
|
||||||
|
@ -121,26 +128,34 @@ SStreamState* streamStateOpen(char* path, SStreamTask* pTask, bool specPath, int
|
||||||
memset(statePath, 0, 1024);
|
memset(statePath, 0, 1024);
|
||||||
tstrncpy(statePath, path, 1024);
|
tstrncpy(statePath, path, 1024);
|
||||||
}
|
}
|
||||||
if (tdbOpen(statePath, szPage, pages, &pState->db, 0) < 0) {
|
if (tdbOpen(statePath, szPage, pages, &pState->pTdbState->db, 0) < 0) {
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
// open state storage backend
|
// open state storage backend
|
||||||
if (tdbTbOpen("state.db", sizeof(SStateKey), -1, stateKeyCmpr, pState->db, &pState->pStateDb, 0) < 0) {
|
if (tdbTbOpen("state.db", sizeof(SStateKey), -1, stateKeyCmpr, pState->pTdbState->db, &pState->pTdbState->pStateDb,
|
||||||
|
0) < 0) {
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo refactor
|
// todo refactor
|
||||||
if (tdbTbOpen("fill.state.db", sizeof(SWinKey), -1, winKeyCmpr, pState->db, &pState->pFillStateDb, 0) < 0) {
|
if (tdbTbOpen("fill.state.db", sizeof(SWinKey), -1, winKeyCmpr, pState->pTdbState->db,
|
||||||
|
&pState->pTdbState->pFillStateDb, 0) < 0) {
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tdbTbOpen("session.state.db", sizeof(SStateSessionKey), -1, stateSessionKeyCmpr, pState->db,
|
if (tdbTbOpen("session.state.db", sizeof(SStateSessionKey), -1, stateSessionKeyCmpr, pState->pTdbState->db,
|
||||||
&pState->pSessionStateDb, 0) < 0) {
|
&pState->pTdbState->pSessionStateDb, 0) < 0) {
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tdbTbOpen("func.state.db", sizeof(STupleKey), -1, STupleKeyCmpr, pState->db, &pState->pFuncStateDb, 0) < 0) {
|
if (tdbTbOpen("func.state.db", sizeof(STupleKey), -1, STupleKeyCmpr, pState->pTdbState->db,
|
||||||
|
&pState->pTdbState->pFuncStateDb, 0) < 0) {
|
||||||
|
goto _err;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tdbTbOpen("parname.state.db", sizeof(int64_t), TSDB_TABLE_NAME_LEN, NULL, pState->pTdbState->db,
|
||||||
|
&pState->pTdbState->pParNameDb, 0) < 0) {
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,115 +163,117 @@ SStreamState* streamStateOpen(char* path, SStreamTask* pTask, bool specPath, int
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
pState->pOwner = pTask;
|
pState->pTdbState->pOwner = pTask;
|
||||||
|
|
||||||
return pState;
|
return pState;
|
||||||
|
|
||||||
_err:
|
_err:
|
||||||
tdbTbClose(pState->pStateDb);
|
tdbTbClose(pState->pTdbState->pStateDb);
|
||||||
tdbTbClose(pState->pFuncStateDb);
|
tdbTbClose(pState->pTdbState->pFuncStateDb);
|
||||||
tdbTbClose(pState->pFillStateDb);
|
tdbTbClose(pState->pTdbState->pFillStateDb);
|
||||||
tdbTbClose(pState->pSessionStateDb);
|
tdbTbClose(pState->pTdbState->pSessionStateDb);
|
||||||
tdbClose(pState->db);
|
tdbTbClose(pState->pTdbState->pParNameDb);
|
||||||
taosMemoryFree(pState);
|
tdbClose(pState->pTdbState->db);
|
||||||
|
streamStateDestroy(pState);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void streamStateClose(SStreamState* pState) {
|
void streamStateClose(SStreamState* pState) {
|
||||||
tdbCommit(pState->db, &pState->txn);
|
tdbCommit(pState->pTdbState->db, &pState->pTdbState->txn);
|
||||||
tdbPostCommit(pState->db, &pState->txn);
|
tdbPostCommit(pState->pTdbState->db, &pState->pTdbState->txn);
|
||||||
tdbTbClose(pState->pStateDb);
|
tdbTbClose(pState->pTdbState->pStateDb);
|
||||||
tdbTbClose(pState->pFuncStateDb);
|
tdbTbClose(pState->pTdbState->pFuncStateDb);
|
||||||
tdbTbClose(pState->pFillStateDb);
|
tdbTbClose(pState->pTdbState->pFillStateDb);
|
||||||
tdbTbClose(pState->pSessionStateDb);
|
tdbTbClose(pState->pTdbState->pSessionStateDb);
|
||||||
tdbClose(pState->db);
|
tdbTbClose(pState->pTdbState->pParNameDb);
|
||||||
|
tdbClose(pState->pTdbState->db);
|
||||||
|
|
||||||
taosMemoryFree(pState);
|
streamStateDestroy(pState);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t streamStateBegin(SStreamState* pState) {
|
int32_t streamStateBegin(SStreamState* pState) {
|
||||||
if (tdbTxnOpen(&pState->txn, 0, tdbDefaultMalloc, tdbDefaultFree, NULL, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED) <
|
if (tdbTxnOpen(&pState->pTdbState->txn, 0, tdbDefaultMalloc, tdbDefaultFree, NULL,
|
||||||
0) {
|
TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tdbBegin(pState->db, &pState->txn) < 0) {
|
if (tdbBegin(pState->pTdbState->db, &pState->pTdbState->txn) < 0) {
|
||||||
tdbTxnClose(&pState->txn);
|
tdbTxnClose(&pState->pTdbState->txn);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t streamStateCommit(SStreamState* pState) {
|
int32_t streamStateCommit(SStreamState* pState) {
|
||||||
if (tdbCommit(pState->db, &pState->txn) < 0) {
|
if (tdbCommit(pState->pTdbState->db, &pState->pTdbState->txn) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (tdbPostCommit(pState->db, &pState->txn) < 0) {
|
if (tdbPostCommit(pState->pTdbState->db, &pState->pTdbState->txn) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
memset(&pState->txn, 0, sizeof(TXN));
|
memset(&pState->pTdbState->txn, 0, sizeof(TXN));
|
||||||
if (tdbTxnOpen(&pState->txn, 0, tdbDefaultMalloc, tdbDefaultFree, NULL, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED) <
|
if (tdbTxnOpen(&pState->pTdbState->txn, 0, tdbDefaultMalloc, tdbDefaultFree, NULL,
|
||||||
0) {
|
TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (tdbBegin(pState->db, &pState->txn) < 0) {
|
if (tdbBegin(pState->pTdbState->db, &pState->pTdbState->txn) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t streamStateAbort(SStreamState* pState) {
|
int32_t streamStateAbort(SStreamState* pState) {
|
||||||
if (tdbAbort(pState->db, &pState->txn) < 0) {
|
if (tdbAbort(pState->pTdbState->db, &pState->pTdbState->txn) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
memset(&pState->txn, 0, sizeof(TXN));
|
memset(&pState->pTdbState->txn, 0, sizeof(TXN));
|
||||||
if (tdbTxnOpen(&pState->txn, 0, tdbDefaultMalloc, tdbDefaultFree, NULL, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED) <
|
if (tdbTxnOpen(&pState->pTdbState->txn, 0, tdbDefaultMalloc, tdbDefaultFree, NULL,
|
||||||
0) {
|
TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (tdbBegin(pState->db, &pState->txn) < 0) {
|
if (tdbBegin(pState->pTdbState->db, &pState->pTdbState->txn) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t streamStateFuncPut(SStreamState* pState, const STupleKey* key, const void* value, int32_t vLen) {
|
int32_t streamStateFuncPut(SStreamState* pState, const STupleKey* key, const void* value, int32_t vLen) {
|
||||||
return tdbTbUpsert(pState->pFuncStateDb, key, sizeof(STupleKey), value, vLen, &pState->txn);
|
return tdbTbUpsert(pState->pTdbState->pFuncStateDb, key, sizeof(STupleKey), value, vLen, &pState->pTdbState->txn);
|
||||||
}
|
}
|
||||||
int32_t streamStateFuncGet(SStreamState* pState, const STupleKey* key, void** pVal, int32_t* pVLen) {
|
int32_t streamStateFuncGet(SStreamState* pState, const STupleKey* key, void** pVal, int32_t* pVLen) {
|
||||||
return tdbTbGet(pState->pFuncStateDb, key, sizeof(STupleKey), pVal, pVLen);
|
return tdbTbGet(pState->pTdbState->pFuncStateDb, key, sizeof(STupleKey), pVal, pVLen);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t streamStateFuncDel(SStreamState* pState, const STupleKey* key) {
|
int32_t streamStateFuncDel(SStreamState* pState, const STupleKey* key) {
|
||||||
return tdbTbDelete(pState->pFuncStateDb, key, sizeof(STupleKey), &pState->txn);
|
return tdbTbDelete(pState->pTdbState->pFuncStateDb, key, sizeof(STupleKey), &pState->pTdbState->txn);
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo refactor
|
// todo refactor
|
||||||
int32_t streamStatePut(SStreamState* pState, const SWinKey* key, const void* value, int32_t vLen) {
|
int32_t streamStatePut(SStreamState* pState, const SWinKey* key, const void* value, int32_t vLen) {
|
||||||
SStateKey sKey = {.key = *key, .opNum = pState->number};
|
SStateKey sKey = {.key = *key, .opNum = pState->number};
|
||||||
return tdbTbUpsert(pState->pStateDb, &sKey, sizeof(SStateKey), value, vLen, &pState->txn);
|
return tdbTbUpsert(pState->pTdbState->pStateDb, &sKey, sizeof(SStateKey), value, vLen, &pState->pTdbState->txn);
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo refactor
|
// todo refactor
|
||||||
int32_t streamStateFillPut(SStreamState* pState, const SWinKey* key, const void* value, int32_t vLen) {
|
int32_t streamStateFillPut(SStreamState* pState, const SWinKey* key, const void* value, int32_t vLen) {
|
||||||
return tdbTbUpsert(pState->pFillStateDb, key, sizeof(SWinKey), value, vLen, &pState->txn);
|
return tdbTbUpsert(pState->pTdbState->pFillStateDb, key, sizeof(SWinKey), value, vLen, &pState->pTdbState->txn);
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo refactor
|
// todo refactor
|
||||||
int32_t streamStateGet(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen) {
|
int32_t streamStateGet(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen) {
|
||||||
SStateKey sKey = {.key = *key, .opNum = pState->number};
|
SStateKey sKey = {.key = *key, .opNum = pState->number};
|
||||||
return tdbTbGet(pState->pStateDb, &sKey, sizeof(SStateKey), pVal, pVLen);
|
return tdbTbGet(pState->pTdbState->pStateDb, &sKey, sizeof(SStateKey), pVal, pVLen);
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo refactor
|
// todo refactor
|
||||||
int32_t streamStateFillGet(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen) {
|
int32_t streamStateFillGet(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen) {
|
||||||
return tdbTbGet(pState->pFillStateDb, key, sizeof(SWinKey), pVal, pVLen);
|
return tdbTbGet(pState->pTdbState->pFillStateDb, key, sizeof(SWinKey), pVal, pVLen);
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo refactor
|
// todo refactor
|
||||||
int32_t streamStateDel(SStreamState* pState, const SWinKey* key) {
|
int32_t streamStateDel(SStreamState* pState, const SWinKey* key) {
|
||||||
SStateKey sKey = {.key = *key, .opNum = pState->number};
|
SStateKey sKey = {.key = *key, .opNum = pState->number};
|
||||||
return tdbTbDelete(pState->pStateDb, &sKey, sizeof(SStateKey), &pState->txn);
|
return tdbTbDelete(pState->pTdbState->pStateDb, &sKey, sizeof(SStateKey), &pState->pTdbState->txn);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t streamStateClear(SStreamState* pState) {
|
int32_t streamStateClear(SStreamState* pState) {
|
||||||
|
@ -280,7 +297,7 @@ void streamStateSetNumber(SStreamState* pState, int32_t number) { pState->number
|
||||||
|
|
||||||
// todo refactor
|
// todo refactor
|
||||||
int32_t streamStateFillDel(SStreamState* pState, const SWinKey* key) {
|
int32_t streamStateFillDel(SStreamState* pState, const SWinKey* key) {
|
||||||
return tdbTbDelete(pState->pFillStateDb, key, sizeof(SWinKey), &pState->txn);
|
return tdbTbDelete(pState->pTdbState->pFillStateDb, key, sizeof(SWinKey), &pState->pTdbState->txn);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t streamStateAddIfNotExist(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen) {
|
int32_t streamStateAddIfNotExist(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen) {
|
||||||
|
@ -306,7 +323,7 @@ int32_t streamStateReleaseBuf(SStreamState* pState, const SWinKey* key, void* pV
|
||||||
SStreamStateCur* streamStateGetCur(SStreamState* pState, const SWinKey* key) {
|
SStreamStateCur* streamStateGetCur(SStreamState* pState, const SWinKey* key) {
|
||||||
SStreamStateCur* pCur = taosMemoryCalloc(1, sizeof(SStreamStateCur));
|
SStreamStateCur* pCur = taosMemoryCalloc(1, sizeof(SStreamStateCur));
|
||||||
if (pCur == NULL) return NULL;
|
if (pCur == NULL) return NULL;
|
||||||
tdbTbcOpen(pState->pStateDb, &pCur->pCur, NULL);
|
tdbTbcOpen(pState->pTdbState->pStateDb, &pCur->pCur, NULL);
|
||||||
|
|
||||||
int32_t c = 0;
|
int32_t c = 0;
|
||||||
SStateKey sKey = {.key = *key, .opNum = pState->number};
|
SStateKey sKey = {.key = *key, .opNum = pState->number};
|
||||||
|
@ -322,7 +339,7 @@ SStreamStateCur* streamStateGetCur(SStreamState* pState, const SWinKey* key) {
|
||||||
SStreamStateCur* streamStateFillGetCur(SStreamState* pState, const SWinKey* key) {
|
SStreamStateCur* streamStateFillGetCur(SStreamState* pState, const SWinKey* key) {
|
||||||
SStreamStateCur* pCur = taosMemoryCalloc(1, sizeof(SStreamStateCur));
|
SStreamStateCur* pCur = taosMemoryCalloc(1, sizeof(SStreamStateCur));
|
||||||
if (pCur == NULL) return NULL;
|
if (pCur == NULL) return NULL;
|
||||||
tdbTbcOpen(pState->pFillStateDb, &pCur->pCur, NULL);
|
tdbTbcOpen(pState->pTdbState->pFillStateDb, &pCur->pCur, NULL);
|
||||||
|
|
||||||
int32_t c = 0;
|
int32_t c = 0;
|
||||||
tdbTbcMoveTo(pCur->pCur, key, sizeof(SWinKey), &c);
|
tdbTbcMoveTo(pCur->pCur, key, sizeof(SWinKey), &c);
|
||||||
|
@ -414,7 +431,7 @@ SStreamStateCur* streamStateSeekKeyNext(SStreamState* pState, const SWinKey* key
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
pCur->number = pState->number;
|
pCur->number = pState->number;
|
||||||
if (tdbTbcOpen(pState->pStateDb, &pCur->pCur, NULL) < 0) {
|
if (tdbTbcOpen(pState->pTdbState->pStateDb, &pCur->pCur, NULL) < 0) {
|
||||||
streamStateFreeCur(pCur);
|
streamStateFreeCur(pCur);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -440,7 +457,7 @@ SStreamStateCur* streamStateFillSeekKeyNext(SStreamState* pState, const SWinKey*
|
||||||
if (!pCur) {
|
if (!pCur) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (tdbTbcOpen(pState->pFillStateDb, &pCur->pCur, NULL) < 0) {
|
if (tdbTbcOpen(pState->pTdbState->pFillStateDb, &pCur->pCur, NULL) < 0) {
|
||||||
streamStateFreeCur(pCur);
|
streamStateFreeCur(pCur);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -465,7 +482,7 @@ SStreamStateCur* streamStateFillSeekKeyPrev(SStreamState* pState, const SWinKey*
|
||||||
if (pCur == NULL) {
|
if (pCur == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (tdbTbcOpen(pState->pFillStateDb, &pCur->pCur, NULL) < 0) {
|
if (tdbTbcOpen(pState->pTdbState->pFillStateDb, &pCur->pCur, NULL) < 0) {
|
||||||
streamStateFreeCur(pCur);
|
streamStateFreeCur(pCur);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -512,7 +529,8 @@ void streamFreeVal(void* val) { tdbFree(val); }
|
||||||
|
|
||||||
int32_t streamStateSessionPut(SStreamState* pState, const SSessionKey* key, const void* value, int32_t vLen) {
|
int32_t streamStateSessionPut(SStreamState* pState, const SSessionKey* key, const void* value, int32_t vLen) {
|
||||||
SStateSessionKey sKey = {.key = *key, .opNum = pState->number};
|
SStateSessionKey sKey = {.key = *key, .opNum = pState->number};
|
||||||
return tdbTbUpsert(pState->pSessionStateDb, &sKey, sizeof(SStateSessionKey), value, vLen, &pState->txn);
|
return tdbTbUpsert(pState->pTdbState->pSessionStateDb, &sKey, sizeof(SStateSessionKey), value, vLen,
|
||||||
|
&pState->pTdbState->txn);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t streamStateSessionGet(SStreamState* pState, SSessionKey* key, void** pVal, int32_t* pVLen) {
|
int32_t streamStateSessionGet(SStreamState* pState, SSessionKey* key, void** pVal, int32_t* pVLen) {
|
||||||
|
@ -535,7 +553,7 @@ int32_t streamStateSessionGet(SStreamState* pState, SSessionKey* key, void** pVa
|
||||||
|
|
||||||
int32_t streamStateSessionDel(SStreamState* pState, const SSessionKey* key) {
|
int32_t streamStateSessionDel(SStreamState* pState, const SSessionKey* key) {
|
||||||
SStateSessionKey sKey = {.key = *key, .opNum = pState->number};
|
SStateSessionKey sKey = {.key = *key, .opNum = pState->number};
|
||||||
return tdbTbDelete(pState->pSessionStateDb, &sKey, sizeof(SStateSessionKey), &pState->txn);
|
return tdbTbDelete(pState->pTdbState->pSessionStateDb, &sKey, sizeof(SStateSessionKey), &pState->pTdbState->txn);
|
||||||
}
|
}
|
||||||
|
|
||||||
SStreamStateCur* streamStateSessionSeekKeyCurrentPrev(SStreamState* pState, const SSessionKey* key) {
|
SStreamStateCur* streamStateSessionSeekKeyCurrentPrev(SStreamState* pState, const SSessionKey* key) {
|
||||||
|
@ -544,7 +562,7 @@ SStreamStateCur* streamStateSessionSeekKeyCurrentPrev(SStreamState* pState, cons
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
pCur->number = pState->number;
|
pCur->number = pState->number;
|
||||||
if (tdbTbcOpen(pState->pSessionStateDb, &pCur->pCur, NULL) < 0) {
|
if (tdbTbcOpen(pState->pTdbState->pSessionStateDb, &pCur->pCur, NULL) < 0) {
|
||||||
streamStateFreeCur(pCur);
|
streamStateFreeCur(pCur);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -571,7 +589,7 @@ SStreamStateCur* streamStateSessionSeekKeyCurrentNext(SStreamState* pState, cons
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
pCur->number = pState->number;
|
pCur->number = pState->number;
|
||||||
if (tdbTbcOpen(pState->pSessionStateDb, &pCur->pCur, NULL) < 0) {
|
if (tdbTbcOpen(pState->pTdbState->pSessionStateDb, &pCur->pCur, NULL) < 0) {
|
||||||
streamStateFreeCur(pCur);
|
streamStateFreeCur(pCur);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -599,7 +617,7 @@ SStreamStateCur* streamStateSessionSeekKeyNext(SStreamState* pState, const SSess
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
pCur->number = pState->number;
|
pCur->number = pState->number;
|
||||||
if (tdbTbcOpen(pState->pSessionStateDb, &pCur->pCur, NULL) < 0) {
|
if (tdbTbcOpen(pState->pTdbState->pSessionStateDb, &pCur->pCur, NULL) < 0) {
|
||||||
streamStateFreeCur(pCur);
|
streamStateFreeCur(pCur);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -666,7 +684,7 @@ int32_t streamStateSessionGetKeyByRange(SStreamState* pState, const SSessionKey*
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
pCur->number = pState->number;
|
pCur->number = pState->number;
|
||||||
if (tdbTbcOpen(pState->pSessionStateDb, &pCur->pCur, NULL) < 0) {
|
if (tdbTbcOpen(pState->pTdbState->pSessionStateDb, &pCur->pCur, NULL) < 0) {
|
||||||
streamStateFreeCur(pCur);
|
streamStateFreeCur(pCur);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -812,6 +830,22 @@ _end:
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t streamStatePutParName(SStreamState* pState, int64_t groupId, const char tbname[TSDB_TABLE_NAME_LEN]) {
|
||||||
|
tdbTbUpsert(pState->pTdbState->pParNameDb, &groupId, sizeof(int64_t), tbname, TSDB_TABLE_NAME_LEN,
|
||||||
|
&pState->pTdbState->txn);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t streamStateGetParName(SStreamState* pState, int64_t groupId, void** pVal) {
|
||||||
|
int32_t len;
|
||||||
|
return tdbTbGet(pState->pTdbState->pParNameDb, &groupId, sizeof(int64_t), pVal, &len);
|
||||||
|
}
|
||||||
|
|
||||||
|
void streamStateDestroy(SStreamState* pState) {
|
||||||
|
taosMemoryFreeClear(pState->pTdbState);
|
||||||
|
taosMemoryFreeClear(pState);
|
||||||
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
char* streamStateSessionDump(SStreamState* pState) {
|
char* streamStateSessionDump(SStreamState* pState) {
|
||||||
SStreamStateCur* pCur = taosMemoryCalloc(1, sizeof(SStreamStateCur));
|
SStreamStateCur* pCur = taosMemoryCalloc(1, sizeof(SStreamStateCur));
|
||||||
|
@ -819,7 +853,7 @@ char* streamStateSessionDump(SStreamState* pState) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
pCur->number = pState->number;
|
pCur->number = pState->number;
|
||||||
if (tdbTbcOpen(pState->pSessionStateDb, &pCur->pCur, NULL) < 0) {
|
if (tdbTbcOpen(pState->pTdbState->pSessionStateDb, &pCur->pCur, NULL) < 0) {
|
||||||
streamStateFreeCur(pCur);
|
streamStateFreeCur(pCur);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,9 +163,9 @@ bool updateInfoIsTableInserted(SUpdateInfo *pInfo, int64_t tbUid) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateInfoFillBlockData(SUpdateInfo *pInfo, SSDataBlock *pBlock, int32_t primaryTsCol) {
|
TSKEY updateInfoFillBlockData(SUpdateInfo *pInfo, SSDataBlock *pBlock, int32_t primaryTsCol) {
|
||||||
if (pBlock == NULL || pBlock->info.rows == 0) return;
|
if (pBlock == NULL || pBlock->info.rows == 0) return INT64_MIN;
|
||||||
TSKEY maxTs = -1;
|
TSKEY maxTs = INT64_MIN;
|
||||||
int64_t tbUid = pBlock->info.uid;
|
int64_t tbUid = pBlock->info.uid;
|
||||||
|
|
||||||
SColumnInfoData *pColDataInfo = taosArrayGet(pBlock->pDataBlock, primaryTsCol);
|
SColumnInfoData *pColDataInfo = taosArrayGet(pBlock->pDataBlock, primaryTsCol);
|
||||||
|
@ -186,6 +186,7 @@ void updateInfoFillBlockData(SUpdateInfo *pInfo, SSDataBlock *pBlock, int32_t pr
|
||||||
if (pMaxTs == NULL || *pMaxTs > maxTs) {
|
if (pMaxTs == NULL || *pMaxTs > maxTs) {
|
||||||
taosHashPut(pInfo->pMap, &tbUid, sizeof(int64_t), &maxTs, sizeof(TSKEY));
|
taosHashPut(pInfo->pMap, &tbUid, sizeof(int64_t), &maxTs, sizeof(TSKEY));
|
||||||
}
|
}
|
||||||
|
return maxTs;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool updateInfoIsUpdated(SUpdateInfo *pInfo, uint64_t tableId, TSKEY ts) {
|
bool updateInfoIsUpdated(SUpdateInfo *pInfo, uint64_t tableId, TSKEY ts) {
|
||||||
|
|
|
@ -57,6 +57,11 @@ void syncNodeRemove(int64_t rid);
|
||||||
SSyncNode* syncNodeAcquire(int64_t rid);
|
SSyncNode* syncNodeAcquire(int64_t rid);
|
||||||
void syncNodeRelease(SSyncNode* pNode);
|
void syncNodeRelease(SSyncNode* pNode);
|
||||||
|
|
||||||
|
int64_t syncHbTimerDataAdd(SSyncHbTimerData* pData);
|
||||||
|
void syncHbTimerDataRemove(int64_t rid);
|
||||||
|
SSyncHbTimerData* syncHbTimerDataAcquire(int64_t rid);
|
||||||
|
void syncHbTimerDataRelease(SSyncHbTimerData* pData);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -57,10 +57,11 @@ typedef struct SRaftId {
|
||||||
} SRaftId;
|
} SRaftId;
|
||||||
|
|
||||||
typedef struct SSyncHbTimerData {
|
typedef struct SSyncHbTimerData {
|
||||||
SSyncNode* pSyncNode;
|
int64_t syncNodeRid;
|
||||||
SSyncTimer* pTimer;
|
SSyncTimer* pTimer;
|
||||||
SRaftId destId;
|
SRaftId destId;
|
||||||
uint64_t logicClock;
|
uint64_t logicClock;
|
||||||
|
int64_t rid;
|
||||||
} SSyncHbTimerData;
|
} SSyncHbTimerData;
|
||||||
|
|
||||||
typedef struct SSyncTimer {
|
typedef struct SSyncTimer {
|
||||||
|
@ -70,7 +71,7 @@ typedef struct SSyncTimer {
|
||||||
uint64_t counter;
|
uint64_t counter;
|
||||||
int32_t timerMS;
|
int32_t timerMS;
|
||||||
SRaftId destId;
|
SRaftId destId;
|
||||||
SSyncHbTimerData hbData;
|
int64_t hbDataRid;
|
||||||
} SSyncTimer;
|
} SSyncTimer;
|
||||||
|
|
||||||
typedef struct SElectTimerParam {
|
typedef struct SElectTimerParam {
|
||||||
|
@ -189,6 +190,8 @@ typedef struct SSyncNode {
|
||||||
int64_t leaderTime;
|
int64_t leaderTime;
|
||||||
int64_t lastReplicateTime;
|
int64_t lastReplicateTime;
|
||||||
|
|
||||||
|
bool isStart;
|
||||||
|
|
||||||
} SSyncNode;
|
} SSyncNode;
|
||||||
|
|
||||||
// open/close --------------
|
// open/close --------------
|
||||||
|
@ -198,6 +201,7 @@ void syncNodeStartStandBy(SSyncNode* pSyncNode);
|
||||||
void syncNodeClose(SSyncNode* pSyncNode);
|
void syncNodeClose(SSyncNode* pSyncNode);
|
||||||
void syncNodePreClose(SSyncNode* pSyncNode);
|
void syncNodePreClose(SSyncNode* pSyncNode);
|
||||||
int32_t syncNodePropose(SSyncNode* pSyncNode, SRpcMsg* pMsg, bool isWeak);
|
int32_t syncNodePropose(SSyncNode* pSyncNode, SRpcMsg* pMsg, bool isWeak);
|
||||||
|
void syncHbTimerDataFree(SSyncHbTimerData* pData);
|
||||||
|
|
||||||
// on message ---------------------
|
// on message ---------------------
|
||||||
int32_t syncNodeOnTimeout(SSyncNode* ths, const SRpcMsg* pMsg);
|
int32_t syncNodeOnTimeout(SSyncNode* ths, const SRpcMsg* pMsg);
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
static SSyncEnv gSyncEnv = {0};
|
static SSyncEnv gSyncEnv = {0};
|
||||||
static int32_t gNodeRefId = -1;
|
static int32_t gNodeRefId = -1;
|
||||||
|
static int32_t gHbDataRefId = -1;
|
||||||
static void syncEnvTick(void *param, void *tmrId);
|
static void syncEnvTick(void *param, void *tmrId);
|
||||||
|
|
||||||
SSyncEnv *syncEnv() { return &gSyncEnv; }
|
SSyncEnv *syncEnv() { return &gSyncEnv; }
|
||||||
|
@ -50,6 +51,13 @@ int32_t syncInit() {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gHbDataRefId = taosOpenRef(200, (RefFp)syncHbTimerDataFree);
|
||||||
|
if (gHbDataRefId < 0) {
|
||||||
|
sError("failed to init hb-data ref");
|
||||||
|
syncCleanUp();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
sDebug("sync rsetId:%d is open", gNodeRefId);
|
sDebug("sync rsetId:%d is open", gNodeRefId);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -64,6 +72,12 @@ void syncCleanUp() {
|
||||||
taosCloseRef(gNodeRefId);
|
taosCloseRef(gNodeRefId);
|
||||||
gNodeRefId = -1;
|
gNodeRefId = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gHbDataRefId != -1) {
|
||||||
|
sDebug("sync rsetId:%d is closed", gHbDataRefId);
|
||||||
|
taosCloseRef(gHbDataRefId);
|
||||||
|
gHbDataRefId = -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t syncNodeAdd(SSyncNode *pNode) {
|
int64_t syncNodeAdd(SSyncNode *pNode) {
|
||||||
|
@ -88,6 +102,26 @@ SSyncNode *syncNodeAcquire(int64_t rid) {
|
||||||
|
|
||||||
void syncNodeRelease(SSyncNode *pNode) { taosReleaseRef(gNodeRefId, pNode->rid); }
|
void syncNodeRelease(SSyncNode *pNode) { taosReleaseRef(gNodeRefId, pNode->rid); }
|
||||||
|
|
||||||
|
int64_t syncHbTimerDataAdd(SSyncHbTimerData *pData) {
|
||||||
|
pData->rid = taosAddRef(gHbDataRefId, pData);
|
||||||
|
if (pData->rid < 0) return -1;
|
||||||
|
return pData->rid;
|
||||||
|
}
|
||||||
|
|
||||||
|
void syncHbTimerDataRemove(int64_t rid) { taosRemoveRef(gHbDataRefId, rid); }
|
||||||
|
|
||||||
|
SSyncHbTimerData *syncHbTimerDataAcquire(int64_t rid) {
|
||||||
|
SSyncHbTimerData *pData = taosAcquireRef(gHbDataRefId, rid);
|
||||||
|
if (pData == NULL) {
|
||||||
|
sError("failed to acquire hb-timer-data from refId:%" PRId64, rid);
|
||||||
|
terrno = TSDB_CODE_SYN_INTERNAL_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
return pData;
|
||||||
|
}
|
||||||
|
|
||||||
|
void syncHbTimerDataRelease(SSyncHbTimerData *pData) { taosReleaseRef(gHbDataRefId, pData->rid); }
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
void syncEnvStartTimer() {
|
void syncEnvStartTimer() {
|
||||||
taosTmrReset(gSyncEnv.FpEnvTickTimer, gSyncEnv.envTickTimerMS, &gSyncEnv, gSyncEnv.pTimerManager,
|
taosTmrReset(gSyncEnv.FpEnvTickTimer, gSyncEnv.envTickTimerMS, &gSyncEnv, gSyncEnv.pTimerManager,
|
||||||
|
|
|
@ -91,6 +91,7 @@ void syncStart(int64_t rid) {
|
||||||
void syncStop(int64_t rid) {
|
void syncStop(int64_t rid) {
|
||||||
SSyncNode* pSyncNode = syncNodeAcquire(rid);
|
SSyncNode* pSyncNode = syncNodeAcquire(rid);
|
||||||
if (pSyncNode != NULL) {
|
if (pSyncNode != NULL) {
|
||||||
|
pSyncNode->isStart = false;
|
||||||
syncNodeRelease(pSyncNode);
|
syncNodeRelease(pSyncNode);
|
||||||
syncNodeRemove(rid);
|
syncNodeRemove(rid);
|
||||||
}
|
}
|
||||||
|
@ -435,8 +436,15 @@ int32_t syncNodeLeaderTransfer(SSyncNode* pSyncNode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t ret = 0;
|
int32_t ret = 0;
|
||||||
if (pSyncNode->state == TAOS_SYNC_STATE_LEADER) {
|
if (pSyncNode->state == TAOS_SYNC_STATE_LEADER && pSyncNode->replicaNum > 1) {
|
||||||
SNodeInfo newLeader = (pSyncNode->peersNodeInfo)[0];
|
SNodeInfo newLeader = (pSyncNode->peersNodeInfo)[0];
|
||||||
|
if (pSyncNode->peersNum == 2) {
|
||||||
|
SyncIndex matchIndex0 = syncIndexMgrGetIndex(pSyncNode->pMatchIndex, &(pSyncNode->peersId[0]));
|
||||||
|
SyncIndex matchIndex1 = syncIndexMgrGetIndex(pSyncNode->pMatchIndex, &(pSyncNode->peersId[1]));
|
||||||
|
if (matchIndex1 > matchIndex0) {
|
||||||
|
newLeader = (pSyncNode->peersNodeInfo)[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
ret = syncNodeLeaderTransferTo(pSyncNode, newLeader);
|
ret = syncNodeLeaderTransferTo(pSyncNode, newLeader);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -665,13 +673,20 @@ static int32_t syncHbTimerInit(SSyncNode* pSyncNode, SSyncTimer* pSyncTimer, SRa
|
||||||
static int32_t syncHbTimerStart(SSyncNode* pSyncNode, SSyncTimer* pSyncTimer) {
|
static int32_t syncHbTimerStart(SSyncNode* pSyncNode, SSyncTimer* pSyncTimer) {
|
||||||
int32_t ret = 0;
|
int32_t ret = 0;
|
||||||
if (syncIsInit()) {
|
if (syncIsInit()) {
|
||||||
SSyncHbTimerData* pData = &pSyncTimer->hbData;
|
SSyncHbTimerData* pData = syncHbTimerDataAcquire(pSyncTimer->hbDataRid);
|
||||||
pData->pSyncNode = pSyncNode;
|
if (pData == NULL) {
|
||||||
|
pData = taosMemoryMalloc(sizeof(SSyncHbTimerData));
|
||||||
|
pData->rid = syncHbTimerDataAdd(pData);
|
||||||
|
}
|
||||||
|
pSyncTimer->hbDataRid = pData->rid;
|
||||||
|
|
||||||
|
pData->syncNodeRid = pSyncNode->rid;
|
||||||
pData->pTimer = pSyncTimer;
|
pData->pTimer = pSyncTimer;
|
||||||
pData->destId = pSyncTimer->destId;
|
pData->destId = pSyncTimer->destId;
|
||||||
pData->logicClock = pSyncTimer->logicClock;
|
pData->logicClock = pSyncTimer->logicClock;
|
||||||
|
|
||||||
taosTmrReset(pSyncTimer->timerCb, pSyncTimer->timerMS, pData, syncEnv()->pTimerManager, &pSyncTimer->pTimer);
|
taosTmrReset(pSyncTimer->timerCb, pSyncTimer->timerMS, (void*)(pData->rid), syncEnv()->pTimerManager,
|
||||||
|
&pSyncTimer->pTimer);
|
||||||
} else {
|
} else {
|
||||||
sError("vgId:%d, start ctrl hb timer error, sync env is stop", pSyncNode->vgId);
|
sError("vgId:%d, start ctrl hb timer error, sync env is stop", pSyncNode->vgId);
|
||||||
}
|
}
|
||||||
|
@ -683,6 +698,8 @@ static int32_t syncHbTimerStop(SSyncNode* pSyncNode, SSyncTimer* pSyncTimer) {
|
||||||
atomic_add_fetch_64(&pSyncTimer->logicClock, 1);
|
atomic_add_fetch_64(&pSyncTimer->logicClock, 1);
|
||||||
taosTmrStop(pSyncTimer->pTimer);
|
taosTmrStop(pSyncTimer->pTimer);
|
||||||
pSyncTimer->pTimer = NULL;
|
pSyncTimer->pTimer = NULL;
|
||||||
|
syncHbTimerDataRemove(pSyncTimer->hbDataRid);
|
||||||
|
pSyncTimer->hbDataRid = -1;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -934,6 +951,7 @@ SSyncNode* syncNodeOpen(SSyncInfo* pSyncInfo) {
|
||||||
SSyncSnapshotSender* pSender = snapshotSenderCreate(pSyncNode, i);
|
SSyncSnapshotSender* pSender = snapshotSenderCreate(pSyncNode, i);
|
||||||
// ASSERT(pSender != NULL);
|
// ASSERT(pSender != NULL);
|
||||||
(pSyncNode->senders)[i] = pSender;
|
(pSyncNode->senders)[i] = pSender;
|
||||||
|
sSTrace(pSender, "snapshot sender create new while open, data:%p", pSender);
|
||||||
}
|
}
|
||||||
|
|
||||||
// snapshot receivers
|
// snapshot receivers
|
||||||
|
@ -960,7 +978,8 @@ SSyncNode* syncNodeOpen(SSyncInfo* pSyncInfo) {
|
||||||
// snapshotting
|
// snapshotting
|
||||||
atomic_store_64(&pSyncNode->snapshottingIndex, SYNC_INDEX_INVALID);
|
atomic_store_64(&pSyncNode->snapshottingIndex, SYNC_INDEX_INVALID);
|
||||||
|
|
||||||
sNTrace(pSyncNode, "sync open");
|
pSyncNode->isStart = true;
|
||||||
|
sNTrace(pSyncNode, "sync open, node:%p", pSyncNode);
|
||||||
|
|
||||||
return pSyncNode;
|
return pSyncNode;
|
||||||
|
|
||||||
|
@ -1027,15 +1046,13 @@ void syncNodePreClose(SSyncNode* pSyncNode) {
|
||||||
syncNodeStopHeartbeatTimer(pSyncNode);
|
syncNodeStopHeartbeatTimer(pSyncNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void syncHbTimerDataFree(SSyncHbTimerData* pData) { taosMemoryFree(pData); }
|
||||||
|
|
||||||
void syncNodeClose(SSyncNode* pSyncNode) {
|
void syncNodeClose(SSyncNode* pSyncNode) {
|
||||||
if (pSyncNode == NULL) {
|
if (pSyncNode == NULL) return;
|
||||||
return;
|
sNTrace(pSyncNode, "sync close, data:%p", pSyncNode);
|
||||||
}
|
|
||||||
int32_t ret;
|
|
||||||
|
|
||||||
sNTrace(pSyncNode, "sync close");
|
int32_t ret = raftStoreClose(pSyncNode->pRaftStore);
|
||||||
|
|
||||||
ret = raftStoreClose(pSyncNode->pRaftStore);
|
|
||||||
ASSERT(ret == 0);
|
ASSERT(ret == 0);
|
||||||
pSyncNode->pRaftStore = NULL;
|
pSyncNode->pRaftStore = NULL;
|
||||||
|
|
||||||
|
@ -1064,6 +1081,7 @@ void syncNodeClose(SSyncNode* pSyncNode) {
|
||||||
|
|
||||||
for (int32_t i = 0; i < TSDB_MAX_REPLICA; ++i) {
|
for (int32_t i = 0; i < TSDB_MAX_REPLICA; ++i) {
|
||||||
if ((pSyncNode->senders)[i] != NULL) {
|
if ((pSyncNode->senders)[i] != NULL) {
|
||||||
|
sSTrace((pSyncNode->senders)[i], "snapshot sender destroy while close, data:%p", (pSyncNode->senders)[i]);
|
||||||
snapshotSenderDestroy((pSyncNode->senders)[i]);
|
snapshotSenderDestroy((pSyncNode->senders)[i]);
|
||||||
(pSyncNode->senders)[i] = NULL;
|
(pSyncNode->senders)[i] = NULL;
|
||||||
}
|
}
|
||||||
|
@ -1385,7 +1403,7 @@ void syncNodeDoConfigChange(SSyncNode* pSyncNode, SSyncCfg* pNewConfig, SyncInde
|
||||||
// reset sender
|
// reset sender
|
||||||
bool reset = false;
|
bool reset = false;
|
||||||
for (int32_t j = 0; j < TSDB_MAX_REPLICA; ++j) {
|
for (int32_t j = 0; j < TSDB_MAX_REPLICA; ++j) {
|
||||||
if (syncUtilSameId(&(pSyncNode->replicasId)[i], &oldReplicasId[j])) {
|
if (syncUtilSameId(&(pSyncNode->replicasId)[i], &oldReplicasId[j]) && oldSenders[j] != NULL) {
|
||||||
char host[128];
|
char host[128];
|
||||||
uint16_t port;
|
uint16_t port;
|
||||||
syncUtilU642Addr((pSyncNode->replicasId)[i].addr, host, sizeof(host), &port);
|
syncUtilU642Addr((pSyncNode->replicasId)[i].addr, host, sizeof(host), &port);
|
||||||
|
@ -1402,6 +1420,8 @@ void syncNodeDoConfigChange(SSyncNode* pSyncNode, SSyncCfg* pNewConfig, SyncInde
|
||||||
|
|
||||||
sNTrace(pSyncNode, "snapshot sender udpate replicaIndex from %d to %d, %s:%d, %p, reset:%d", oldreplicaIndex,
|
sNTrace(pSyncNode, "snapshot sender udpate replicaIndex from %d to %d, %s:%d, %p, reset:%d", oldreplicaIndex,
|
||||||
i, host, port, (pSyncNode->senders)[i], reset);
|
i, host, port, (pSyncNode->senders)[i], reset);
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1410,15 +1430,17 @@ void syncNodeDoConfigChange(SSyncNode* pSyncNode, SSyncCfg* pNewConfig, SyncInde
|
||||||
for (int32_t i = 0; i < TSDB_MAX_REPLICA; ++i) {
|
for (int32_t i = 0; i < TSDB_MAX_REPLICA; ++i) {
|
||||||
if ((pSyncNode->senders)[i] == NULL) {
|
if ((pSyncNode->senders)[i] == NULL) {
|
||||||
(pSyncNode->senders)[i] = snapshotSenderCreate(pSyncNode, i);
|
(pSyncNode->senders)[i] = snapshotSenderCreate(pSyncNode, i);
|
||||||
sSTrace((pSyncNode->senders)[i], "snapshot sender create new");
|
sSTrace((pSyncNode->senders)[i], "snapshot sender create new while reconfig, data:%p", (pSyncNode->senders)[i]);
|
||||||
|
} else {
|
||||||
|
sSTrace((pSyncNode->senders)[i], "snapshot sender already exist, data:%p", (pSyncNode->senders)[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// free old
|
// free old
|
||||||
for (int32_t i = 0; i < TSDB_MAX_REPLICA; ++i) {
|
for (int32_t i = 0; i < TSDB_MAX_REPLICA; ++i) {
|
||||||
if (oldSenders[i] != NULL) {
|
if (oldSenders[i] != NULL) {
|
||||||
|
sNTrace(pSyncNode, "snapshot sender destroy old, data:%p replica-index:%d", oldSenders[i], i);
|
||||||
snapshotSenderDestroy(oldSenders[i]);
|
snapshotSenderDestroy(oldSenders[i]);
|
||||||
sNTrace(pSyncNode, "snapshot sender delete old %p replica-index:%d", oldSenders[i], i);
|
|
||||||
oldSenders[i] = NULL;
|
oldSenders[i] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1929,29 +1951,59 @@ static void syncNodeEqHeartbeatTimer(void* param, void* tmrId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void syncNodeEqPeerHeartbeatTimer(void* param, void* tmrId) {
|
static void syncNodeEqPeerHeartbeatTimer(void* param, void* tmrId) {
|
||||||
SSyncHbTimerData* pData = (SSyncHbTimerData*)param;
|
int64_t hbDataRid = (int64_t)param;
|
||||||
SSyncNode* pSyncNode = pData->pSyncNode;
|
|
||||||
SSyncTimer* pSyncTimer = pData->pTimer;
|
|
||||||
|
|
||||||
|
SSyncHbTimerData* pData = syncHbTimerDataAcquire(hbDataRid);
|
||||||
|
if (pData == NULL) {
|
||||||
|
sError("hb timer get pData NULL, %" PRId64, hbDataRid);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SSyncNode* pSyncNode = syncNodeAcquire(pData->syncNodeRid);
|
||||||
if (pSyncNode == NULL) {
|
if (pSyncNode == NULL) {
|
||||||
|
syncHbTimerDataRelease(pData);
|
||||||
|
sError("hb timer get pSyncNode NULL");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SSyncTimer* pSyncTimer = pData->pTimer;
|
||||||
|
|
||||||
|
if (!pSyncNode->isStart) {
|
||||||
|
syncNodeRelease(pSyncNode);
|
||||||
|
syncHbTimerDataRelease(pData);
|
||||||
|
sError("vgId:%d, hb timer sync node already stop", pSyncNode->vgId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pSyncNode->state != TAOS_SYNC_STATE_LEADER) {
|
if (pSyncNode->state != TAOS_SYNC_STATE_LEADER) {
|
||||||
|
syncNodeRelease(pSyncNode);
|
||||||
|
syncHbTimerDataRelease(pData);
|
||||||
|
sError("vgId:%d, hb timer sync node not leader", pSyncNode->vgId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pSyncNode->pRaftStore == NULL) {
|
if (pSyncNode->pRaftStore == NULL) {
|
||||||
|
syncNodeRelease(pSyncNode);
|
||||||
|
syncHbTimerDataRelease(pData);
|
||||||
|
sError("vgId:%d, hb timer raft store already stop", pSyncNode->vgId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// sNTrace(pSyncNode, "eq peer hb timer");
|
// sTrace("vgId:%d, eq peer hb timer", pSyncNode->vgId);
|
||||||
|
|
||||||
int64_t timerLogicClock = atomic_load_64(&pSyncTimer->logicClock);
|
|
||||||
int64_t msgLogicClock = atomic_load_64(&pData->logicClock);
|
|
||||||
|
|
||||||
if (pSyncNode->replicaNum > 1) {
|
if (pSyncNode->replicaNum > 1) {
|
||||||
|
int64_t timerLogicClock = atomic_load_64(&pSyncTimer->logicClock);
|
||||||
|
int64_t msgLogicClock = atomic_load_64(&pData->logicClock);
|
||||||
|
|
||||||
if (timerLogicClock == msgLogicClock) {
|
if (timerLogicClock == msgLogicClock) {
|
||||||
|
if (syncIsInit()) {
|
||||||
|
// sTrace("vgId:%d, reset peer hb timer", pSyncNode->vgId);
|
||||||
|
taosTmrReset(syncNodeEqPeerHeartbeatTimer, pSyncTimer->timerMS, (void*)hbDataRid, syncEnv()->pTimerManager,
|
||||||
|
&pSyncTimer->pTimer);
|
||||||
|
} else {
|
||||||
|
sError("sync env is stop, reset peer hb timer error");
|
||||||
|
}
|
||||||
|
|
||||||
SRpcMsg rpcMsg = {0};
|
SRpcMsg rpcMsg = {0};
|
||||||
(void)syncBuildHeartbeat(&rpcMsg, pSyncNode->vgId);
|
(void)syncBuildHeartbeat(&rpcMsg, pSyncNode->vgId);
|
||||||
|
|
||||||
|
@ -1966,18 +2018,14 @@ static void syncNodeEqPeerHeartbeatTimer(void* param, void* tmrId) {
|
||||||
// send msg
|
// send msg
|
||||||
syncNodeSendHeartbeat(pSyncNode, &pSyncMsg->destId, &rpcMsg);
|
syncNodeSendHeartbeat(pSyncNode, &pSyncMsg->destId, &rpcMsg);
|
||||||
|
|
||||||
if (syncIsInit()) {
|
|
||||||
taosTmrReset(syncNodeEqPeerHeartbeatTimer, pSyncTimer->timerMS, pData, syncEnv()->pTimerManager,
|
|
||||||
&pSyncTimer->pTimer);
|
|
||||||
} else {
|
|
||||||
sError("sync env is stop, syncNodeEqHeartbeatTimer");
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
sTrace("==syncNodeEqPeerHeartbeatTimer== timerLogicClock:%" PRId64 ", msgLogicClock:%" PRId64 "", timerLogicClock,
|
sTrace("vgId:%d, do not send hb, timerLogicClock:%" PRId64 ", msgLogicClock:%" PRId64 "", pSyncNode->vgId,
|
||||||
msgLogicClock);
|
timerLogicClock, msgLogicClock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
syncHbTimerDataRelease(pData);
|
||||||
|
syncNodeRelease(pSyncNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t syncNodeEqNoop(SSyncNode* pNode) {
|
static int32_t syncNodeEqNoop(SSyncNode* pNode) {
|
||||||
|
|
|
@ -38,7 +38,7 @@ SSyncLogStore* logStoreCreate(SSyncNode* pSyncNode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// pLogStore->pCache = taosLRUCacheInit(10 * 1024 * 1024, 1, .5);
|
// pLogStore->pCache = taosLRUCacheInit(10 * 1024 * 1024, 1, .5);
|
||||||
pLogStore->pCache = taosLRUCacheInit(100 * 1024 * 1024, 1, .5);
|
pLogStore->pCache = taosLRUCacheInit(30 * 1024 * 1024, 1, .5);
|
||||||
if (pLogStore->pCache == NULL) {
|
if (pLogStore->pCache == NULL) {
|
||||||
taosMemoryFree(pLogStore);
|
taosMemoryFree(pLogStore);
|
||||||
terrno = TSDB_CODE_WAL_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_WAL_OUT_OF_MEMORY;
|
||||||
|
|
|
@ -44,7 +44,13 @@ int32_t tmsgSendReq(const SEpSet* epSet, SRpcMsg* pMsg) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tmsgSendRsp(SRpcMsg* pMsg) { return (*defaultMsgCb.sendRspFp)(pMsg); }
|
void tmsgSendRsp(SRpcMsg* pMsg) {
|
||||||
|
#if 1
|
||||||
|
rpcSendResponse(pMsg);
|
||||||
|
#else
|
||||||
|
return (*defaultMsgCb.sendRspFp)(pMsg);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void tmsgSendRedirectRsp(SRpcMsg* pMsg, const SEpSet* pNewEpSet) { (*defaultMsgCb.sendRedirectRspFp)(pMsg, pNewEpSet); }
|
void tmsgSendRedirectRsp(SRpcMsg* pMsg, const SEpSet* pNewEpSet) { (*defaultMsgCb.sendRedirectRspFp)(pMsg, pNewEpSet); }
|
||||||
|
|
||||||
|
|
|
@ -462,8 +462,6 @@ static void uvStartSendResp(SSvrMsg* smsg) {
|
||||||
if (pConn->broken == true) {
|
if (pConn->broken == true) {
|
||||||
// persist by
|
// persist by
|
||||||
destroySmsg(smsg);
|
destroySmsg(smsg);
|
||||||
// transFreeMsg(smsg->msg.pCont);
|
|
||||||
// taosMemoryFree(smsg);
|
|
||||||
transUnrefSrvHandle(pConn);
|
transUnrefSrvHandle(pConn);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1234,7 +1232,9 @@ int transReleaseSrvHandle(void* handle) {
|
||||||
m->type = Release;
|
m->type = Release;
|
||||||
|
|
||||||
tTrace("%s conn %p start to release", transLabel(pThrd->pTransInst), exh->handle);
|
tTrace("%s conn %p start to release", transLabel(pThrd->pTransInst), exh->handle);
|
||||||
transAsyncSend(pThrd->asyncPool, &m->q);
|
if (0 != transAsyncSend(pThrd->asyncPool, &m->q)) {
|
||||||
|
destroySmsg(m);
|
||||||
|
}
|
||||||
|
|
||||||
transReleaseExHandle(transGetRefMgt(), refId);
|
transReleaseExHandle(transGetRefMgt(), refId);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1269,7 +1269,9 @@ int transSendResponse(const STransMsg* msg) {
|
||||||
|
|
||||||
STraceId* trace = (STraceId*)&msg->info.traceId;
|
STraceId* trace = (STraceId*)&msg->info.traceId;
|
||||||
tGTrace("conn %p start to send resp (1/2)", exh->handle);
|
tGTrace("conn %p start to send resp (1/2)", exh->handle);
|
||||||
transAsyncSend(pThrd->asyncPool, &m->q);
|
if (0 != transAsyncSend(pThrd->asyncPool, &m->q)) {
|
||||||
|
destroySmsg(m);
|
||||||
|
}
|
||||||
|
|
||||||
transReleaseExHandle(transGetRefMgt(), refId);
|
transReleaseExHandle(transGetRefMgt(), refId);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1303,7 +1305,9 @@ int transRegisterMsg(const STransMsg* msg) {
|
||||||
|
|
||||||
STrans* pTransInst = pThrd->pTransInst;
|
STrans* pTransInst = pThrd->pTransInst;
|
||||||
tTrace("%s conn %p start to register brokenlink callback", transLabel(pTransInst), exh->handle);
|
tTrace("%s conn %p start to register brokenlink callback", transLabel(pTransInst), exh->handle);
|
||||||
transAsyncSend(pThrd->asyncPool, &m->q);
|
if (0 != transAsyncSend(pThrd->asyncPool, &m->q)) {
|
||||||
|
destroySmsg(m);
|
||||||
|
}
|
||||||
|
|
||||||
transReleaseExHandle(transGetRefMgt(), refId);
|
transReleaseExHandle(transGetRefMgt(), refId);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -251,7 +251,7 @@ static void walFsyncAll() {
|
||||||
int32_t code = taosFsyncFile(pWal->pLogFile);
|
int32_t code = taosFsyncFile(pWal->pLogFile);
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
wError("vgId:%d, file:%" PRId64 ".log, failed to fsync since %s", pWal->cfg.vgId, walGetLastFileFirstVer(pWal),
|
wError("vgId:%d, file:%" PRId64 ".log, failed to fsync since %s", pWal->cfg.vgId, walGetLastFileFirstVer(pWal),
|
||||||
strerror(code));
|
strerror(errno));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pWal = taosIterateRef(tsWal.refSetId, pWal->refId);
|
pWal = taosIterateRef(tsWal.refSetId, pWal->refId);
|
||||||
|
|
|
@ -336,12 +336,14 @@ int32_t taosRealPath(char *dirname, char *realPath, int32_t maxlen) {
|
||||||
#else
|
#else
|
||||||
if (realpath(dirname, tmp) != NULL) {
|
if (realpath(dirname, tmp) != NULL) {
|
||||||
#endif
|
#endif
|
||||||
if (realPath == NULL) {
|
if (strlen(tmp) < maxlen) {
|
||||||
strncpy(dirname, tmp, maxlen);
|
if (realPath == NULL) {
|
||||||
} else {
|
strncpy(dirname, tmp, maxlen);
|
||||||
strncpy(realPath, tmp, maxlen);
|
} else {
|
||||||
|
strncpy(realPath, tmp, maxlen);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -344,6 +344,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_TDB_STB_ALREADY_EXIST, "Stable already exists
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_STB_NOT_EXIST, "Stable not exists")
|
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_STB_NOT_EXIST, "Stable not exists")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_INVALID_TABLE_SCHEMA_VER, "Table schema is old")
|
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_INVALID_TABLE_SCHEMA_VER, "Table schema is old")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_TDB_ENV_OPEN_ERROR, "TDB env open error")
|
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_TDB_ENV_OPEN_ERROR, "TDB env open error")
|
||||||
|
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_TABLE_IN_OTHER_STABLE, "Table already exists in other stables")
|
||||||
|
|
||||||
// query
|
// query
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_INVALID_QHANDLE, "Invalid handle")
|
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_INVALID_QHANDLE, "Invalid handle")
|
||||||
|
@ -646,7 +647,12 @@ const char* tstrerror(int32_t err) {
|
||||||
|
|
||||||
// this is a system errno
|
// this is a system errno
|
||||||
if ((err & 0x00ff0000) == 0x00ff0000) {
|
if ((err & 0x00ff0000) == 0x00ff0000) {
|
||||||
return strerror(err & 0x0000ffff);
|
int32_t code = err & 0x0000ffff;
|
||||||
|
if (code >= 0 && code < 36) {
|
||||||
|
return strerror(code);
|
||||||
|
} else {
|
||||||
|
return "unknown err";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t s = 0;
|
int32_t s = 0;
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
,,y,script,./test.sh -f tsim/user/privilege_db.sim
|
,,y,script,./test.sh -f tsim/user/privilege_db.sim
|
||||||
,,y,script,./test.sh -f tsim/user/privilege_sysinfo.sim
|
,,y,script,./test.sh -f tsim/user/privilege_sysinfo.sim
|
||||||
,,y,script,./test.sh -f tsim/db/alter_option.sim
|
,,y,script,./test.sh -f tsim/db/alter_option.sim
|
||||||
,,,script,./test.sh -f tsim/db/alter_replica_13.sim
|
,,y,script,./test.sh -f tsim/db/alter_replica_13.sim
|
||||||
,,y,script,./test.sh -f tsim/db/alter_replica_31.sim
|
,,y,script,./test.sh -f tsim/db/alter_replica_31.sim
|
||||||
,,y,script,./test.sh -f tsim/db/basic1.sim
|
,,y,script,./test.sh -f tsim/db/basic1.sim
|
||||||
,,y,script,./test.sh -f tsim/db/basic2.sim
|
,,y,script,./test.sh -f tsim/db/basic2.sim
|
||||||
|
@ -35,30 +35,30 @@
|
||||||
,,y,script,./test.sh -f tsim/db/show_create_table.sim
|
,,y,script,./test.sh -f tsim/db/show_create_table.sim
|
||||||
,,y,script,./test.sh -f tsim/db/tables.sim
|
,,y,script,./test.sh -f tsim/db/tables.sim
|
||||||
,,y,script,./test.sh -f tsim/db/taosdlog.sim
|
,,y,script,./test.sh -f tsim/db/taosdlog.sim
|
||||||
,,,script,./test.sh -f tsim/dnode/balance_replica1.sim
|
,,y,script,./test.sh -f tsim/dnode/balance_replica1.sim
|
||||||
,,,script,./test.sh -f tsim/dnode/balance_replica3.sim
|
,,y,script,./test.sh -f tsim/dnode/balance_replica3.sim
|
||||||
,,,script,./test.sh -f tsim/dnode/balance1.sim
|
,,y,script,./test.sh -f tsim/dnode/balance1.sim
|
||||||
,,,script,./test.sh -f tsim/dnode/balance2.sim
|
,,y,script,./test.sh -f tsim/dnode/balance2.sim
|
||||||
,,,script,./test.sh -f tsim/dnode/balance3.sim
|
,,y,script,./test.sh -f tsim/dnode/balance3.sim
|
||||||
,,,script,./test.sh -f tsim/dnode/balancex.sim
|
,,y,script,./test.sh -f tsim/dnode/balancex.sim
|
||||||
,,y,script,./test.sh -f tsim/dnode/create_dnode.sim
|
,,y,script,./test.sh -f tsim/dnode/create_dnode.sim
|
||||||
,,y,script,./test.sh -f tsim/dnode/drop_dnode_has_mnode.sim
|
,,y,script,./test.sh -f tsim/dnode/drop_dnode_has_mnode.sim
|
||||||
,,y,script,./test.sh -f tsim/dnode/drop_dnode_has_qnode_snode.sim
|
,,y,script,./test.sh -f tsim/dnode/drop_dnode_has_qnode_snode.sim
|
||||||
,,,script,./test.sh -f tsim/dnode/drop_dnode_has_vnode_replica1.sim
|
,,y,script,./test.sh -f tsim/dnode/drop_dnode_has_vnode_replica1.sim
|
||||||
,,,script,./test.sh -f tsim/dnode/drop_dnode_has_vnode_replica3.sim
|
,,y,script,./test.sh -f tsim/dnode/drop_dnode_has_vnode_replica3.sim
|
||||||
,,,script,./test.sh -f tsim/dnode/drop_dnode_has_multi_vnode_replica1.sim
|
,,y,script,./test.sh -f tsim/dnode/drop_dnode_has_multi_vnode_replica1.sim
|
||||||
,,,script,./test.sh -f tsim/dnode/drop_dnode_has_multi_vnode_replica3.sim
|
,,y,script,./test.sh -f tsim/dnode/drop_dnode_has_multi_vnode_replica3.sim
|
||||||
,,,script,./test.sh -f tsim/dnode/drop_dnode_force.sim
|
,,y,script,./test.sh -f tsim/dnode/drop_dnode_force.sim
|
||||||
,,y,script,./test.sh -f tsim/dnode/offline_reason.sim
|
,,y,script,./test.sh -f tsim/dnode/offline_reason.sim
|
||||||
,,,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica1.sim
|
,,y,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica1.sim
|
||||||
,,,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v1_leader.sim
|
,,y,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v1_leader.sim
|
||||||
,,,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v1_follower.sim
|
,,y,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v1_follower.sim
|
||||||
,,,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v2.sim
|
,,y,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v2.sim
|
||||||
,,,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v3.sim
|
,,y,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v3.sim
|
||||||
,,,script,./test.sh -f tsim/dnode/vnode_clean.sim
|
,,y,script,./test.sh -f tsim/dnode/vnode_clean.sim
|
||||||
,,,script,./test.sh -f tsim/dnode/use_dropped_dnode.sim
|
,,y,script,./test.sh -f tsim/dnode/use_dropped_dnode.sim
|
||||||
,,,script,./test.sh -f tsim/dnode/split_vgroup_replica1.sim
|
,,y,script,./test.sh -f tsim/dnode/split_vgroup_replica1.sim
|
||||||
,,,script,./test.sh -f tsim/dnode/split_vgroup_replica3.sim
|
,,y,script,./test.sh -f tsim/dnode/split_vgroup_replica3.sim
|
||||||
,,y,script,./test.sh -f tsim/import/basic.sim
|
,,y,script,./test.sh -f tsim/import/basic.sim
|
||||||
,,y,script,./test.sh -f tsim/import/commit.sim
|
,,y,script,./test.sh -f tsim/import/commit.sim
|
||||||
,,y,script,./test.sh -f tsim/import/large.sim
|
,,y,script,./test.sh -f tsim/import/large.sim
|
||||||
|
@ -113,7 +113,7 @@
|
||||||
,,y,script,./test.sh -f tsim/parser/first_last.sim
|
,,y,script,./test.sh -f tsim/parser/first_last.sim
|
||||||
,,y,script,./test.sh -f tsim/parser/fill_stb.sim
|
,,y,script,./test.sh -f tsim/parser/fill_stb.sim
|
||||||
,,y,script,./test.sh -f tsim/parser/interp.sim
|
,,y,script,./test.sh -f tsim/parser/interp.sim
|
||||||
#,,y,script,./test.sh -f tsim/parser/limit2.sim
|
,,y,script,./test.sh -f tsim/parser/limit2.sim
|
||||||
,,y,script,./test.sh -f tsim/parser/fourArithmetic-basic.sim
|
,,y,script,./test.sh -f tsim/parser/fourArithmetic-basic.sim
|
||||||
,,y,script,./test.sh -f tsim/parser/function.sim
|
,,y,script,./test.sh -f tsim/parser/function.sim
|
||||||
,,y,script,./test.sh -f tsim/parser/groupby-basic.sim
|
,,y,script,./test.sh -f tsim/parser/groupby-basic.sim
|
||||||
|
@ -136,8 +136,8 @@
|
||||||
,,y,script,./test.sh -f tsim/parser/lastrow.sim
|
,,y,script,./test.sh -f tsim/parser/lastrow.sim
|
||||||
,,y,script,./test.sh -f tsim/parser/lastrow2.sim
|
,,y,script,./test.sh -f tsim/parser/lastrow2.sim
|
||||||
,,y,script,./test.sh -f tsim/parser/like.sim
|
,,y,script,./test.sh -f tsim/parser/like.sim
|
||||||
,,,script,./test.sh -f tsim/parser/limit.sim
|
,,y,script,./test.sh -f tsim/parser/limit.sim
|
||||||
,,,script,./test.sh -f tsim/parser/limit1.sim
|
,,y,script,./test.sh -f tsim/parser/limit1.sim
|
||||||
,,y,script,./test.sh -f tsim/parser/mixed_blocks.sim
|
,,y,script,./test.sh -f tsim/parser/mixed_blocks.sim
|
||||||
,,y,script,./test.sh -f tsim/parser/nchar.sim
|
,,y,script,./test.sh -f tsim/parser/nchar.sim
|
||||||
,,y,script,./test.sh -f tsim/parser/nestquery.sim
|
,,y,script,./test.sh -f tsim/parser/nestquery.sim
|
||||||
|
@ -163,7 +163,7 @@
|
||||||
,,y,script,./test.sh -f tsim/parser/timestamp.sim
|
,,y,script,./test.sh -f tsim/parser/timestamp.sim
|
||||||
,,y,script,./test.sh -f tsim/parser/top_groupby.sim
|
,,y,script,./test.sh -f tsim/parser/top_groupby.sim
|
||||||
,,y,script,./test.sh -f tsim/parser/topbot.sim
|
,,y,script,./test.sh -f tsim/parser/topbot.sim
|
||||||
,,,script,./test.sh -f tsim/parser/union.sim
|
,,y,script,./test.sh -f tsim/parser/union.sim
|
||||||
,,y,script,./test.sh -f tsim/parser/union_sysinfo.sim
|
,,y,script,./test.sh -f tsim/parser/union_sysinfo.sim
|
||||||
,,y,script,./test.sh -f tsim/parser/where.sim
|
,,y,script,./test.sh -f tsim/parser/where.sim
|
||||||
,,y,script,./test.sh -f tsim/query/charScalarFunction.sim
|
,,y,script,./test.sh -f tsim/query/charScalarFunction.sim
|
||||||
|
@ -176,11 +176,11 @@
|
||||||
,,y,script,./test.sh -f tsim/query/udf.sim
|
,,y,script,./test.sh -f tsim/query/udf.sim
|
||||||
,,y,script,./test.sh -f tsim/qnode/basic1.sim
|
,,y,script,./test.sh -f tsim/qnode/basic1.sim
|
||||||
,,y,script,./test.sh -f tsim/snode/basic1.sim
|
,,y,script,./test.sh -f tsim/snode/basic1.sim
|
||||||
,,,script,./test.sh -f tsim/mnode/basic1.sim
|
,,y,script,./test.sh -f tsim/mnode/basic1.sim
|
||||||
,,,script,./test.sh -f tsim/mnode/basic2.sim
|
,,y,script,./test.sh -f tsim/mnode/basic2.sim
|
||||||
,,,script,./test.sh -f tsim/mnode/basic3.sim
|
,,y,script,./test.sh -f tsim/mnode/basic3.sim
|
||||||
,,,script,./test.sh -f tsim/mnode/basic4.sim
|
,,y,script,./test.sh -f tsim/mnode/basic4.sim
|
||||||
,,,script,./test.sh -f tsim/mnode/basic5.sim
|
,,y,script,./test.sh -f tsim/mnode/basic5.sim
|
||||||
,,y,script,./test.sh -f tsim/show/basic.sim
|
,,y,script,./test.sh -f tsim/show/basic.sim
|
||||||
,,y,script,./test.sh -f tsim/table/autocreate.sim
|
,,y,script,./test.sh -f tsim/table/autocreate.sim
|
||||||
,,y,script,./test.sh -f tsim/table/basic1.sim
|
,,y,script,./test.sh -f tsim/table/basic1.sim
|
||||||
|
@ -213,10 +213,10 @@
|
||||||
,,n,script,./test.sh -f tsim/stream/basic0.sim -g
|
,,n,script,./test.sh -f tsim/stream/basic0.sim -g
|
||||||
,,y,script,./test.sh -f tsim/stream/basic1.sim
|
,,y,script,./test.sh -f tsim/stream/basic1.sim
|
||||||
,,y,script,./test.sh -f tsim/stream/basic2.sim
|
,,y,script,./test.sh -f tsim/stream/basic2.sim
|
||||||
,,,script,./test.sh -f tsim/stream/drop_stream.sim
|
,,y,script,./test.sh -f tsim/stream/drop_stream.sim
|
||||||
,,y,script,./test.sh -f tsim/stream/fillHistoryBasic1.sim
|
,,y,script,./test.sh -f tsim/stream/fillHistoryBasic1.sim
|
||||||
,,y,script,./test.sh -f tsim/stream/fillHistoryBasic2.sim
|
,,y,script,./test.sh -f tsim/stream/fillHistoryBasic2.sim
|
||||||
,,y,script,./test.sh -f tsim/stream/fillHistoryBasic3.sim
|
,,n,script,./test.sh -f tsim/stream/fillHistoryBasic3.sim
|
||||||
,,y,script,./test.sh -f tsim/stream/distributeInterval0.sim
|
,,y,script,./test.sh -f tsim/stream/distributeInterval0.sim
|
||||||
,,y,script,./test.sh -f tsim/stream/distributeIntervalRetrive0.sim
|
,,y,script,./test.sh -f tsim/stream/distributeIntervalRetrive0.sim
|
||||||
,,y,script,./test.sh -f tsim/stream/distributeSession0.sim
|
,,y,script,./test.sh -f tsim/stream/distributeSession0.sim
|
||||||
|
@ -227,11 +227,11 @@
|
||||||
,,y,script,./test.sh -f tsim/stream/triggerSession0.sim
|
,,y,script,./test.sh -f tsim/stream/triggerSession0.sim
|
||||||
,,y,script,./test.sh -f tsim/stream/partitionby.sim
|
,,y,script,./test.sh -f tsim/stream/partitionby.sim
|
||||||
,,y,script,./test.sh -f tsim/stream/partitionby1.sim
|
,,y,script,./test.sh -f tsim/stream/partitionby1.sim
|
||||||
,,y,script,./test.sh -f tsim/stream/schedSnode.sim
|
,,n,script,./test.sh -f tsim/stream/schedSnode.sim
|
||||||
,,,script,./test.sh -f tsim/stream/windowClose.sim
|
,,y,script,./test.sh -f tsim/stream/windowClose.sim
|
||||||
,,y,script,./test.sh -f tsim/stream/ignoreExpiredData.sim
|
,,y,script,./test.sh -f tsim/stream/ignoreExpiredData.sim
|
||||||
,,y,script,./test.sh -f tsim/stream/sliding.sim
|
,,y,script,./test.sh -f tsim/stream/sliding.sim
|
||||||
,,y,script,./test.sh -f tsim/stream/partitionbyColumnInterval.sim
|
,,n,script,./test.sh -f tsim/stream/partitionbyColumnInterval.sim
|
||||||
,,y,script,./test.sh -f tsim/stream/partitionbyColumnSession.sim
|
,,y,script,./test.sh -f tsim/stream/partitionbyColumnSession.sim
|
||||||
,,y,script,./test.sh -f tsim/stream/partitionbyColumnState.sim
|
,,y,script,./test.sh -f tsim/stream/partitionbyColumnState.sim
|
||||||
,,y,script,./test.sh -f tsim/stream/deleteInterval.sim
|
,,y,script,./test.sh -f tsim/stream/deleteInterval.sim
|
||||||
|
@ -278,8 +278,9 @@
|
||||||
,,y,script,./test.sh -f tsim/stable/values.sim
|
,,y,script,./test.sh -f tsim/stable/values.sim
|
||||||
,,y,script,./test.sh -f tsim/stable/vnode3.sim
|
,,y,script,./test.sh -f tsim/stable/vnode3.sim
|
||||||
,,y,script,./test.sh -f tsim/stable/metrics_idx.sim
|
,,y,script,./test.sh -f tsim/stable/metrics_idx.sim
|
||||||
,,,script,./test.sh -f tsim/sma/drop_sma.sim
|
,,n,script,./test.sh -f tsim/sma/drop_sma.sim
|
||||||
,,,script,./test.sh -f tsim/sma/tsmaCreateInsertQuery.sim
|
,,n,script,./test.sh -f tsim/sma/sma_leak.sim
|
||||||
|
,,y,script,./test.sh -f tsim/sma/tsmaCreateInsertQuery.sim
|
||||||
,,y,script,./test.sh -f tsim/sma/rsmaCreateInsertQuery.sim
|
,,y,script,./test.sh -f tsim/sma/rsmaCreateInsertQuery.sim
|
||||||
,,y,script,./test.sh -f tsim/sma/rsmaPersistenceRecovery.sim
|
,,y,script,./test.sh -f tsim/sma/rsmaPersistenceRecovery.sim
|
||||||
,,n,script,./test.sh -f tsim/valgrind/checkError1.sim
|
,,n,script,./test.sh -f tsim/valgrind/checkError1.sim
|
||||||
|
@ -291,12 +292,12 @@
|
||||||
,,n,script,./test.sh -f tsim/valgrind/checkError7.sim
|
,,n,script,./test.sh -f tsim/valgrind/checkError7.sim
|
||||||
,,n,script,./test.sh -f tsim/valgrind/checkError8.sim
|
,,n,script,./test.sh -f tsim/valgrind/checkError8.sim
|
||||||
,,n,script,./test.sh -f tsim/valgrind/checkUdf.sim
|
,,n,script,./test.sh -f tsim/valgrind/checkUdf.sim
|
||||||
,,,script,./test.sh -f tsim/vnode/replica3_basic.sim
|
,,y,script,./test.sh -f tsim/vnode/replica3_basic.sim
|
||||||
,,y,script,./test.sh -f tsim/vnode/replica3_repeat.sim
|
,,y,script,./test.sh -f tsim/vnode/replica3_repeat.sim
|
||||||
,,y,script,./test.sh -f tsim/vnode/replica3_vgroup.sim
|
,,y,script,./test.sh -f tsim/vnode/replica3_vgroup.sim
|
||||||
,,y,script,./test.sh -f tsim/vnode/replica3_many.sim
|
,,y,script,./test.sh -f tsim/vnode/replica3_many.sim
|
||||||
,,y,script,./test.sh -f tsim/vnode/replica3_import.sim
|
,,y,script,./test.sh -f tsim/vnode/replica3_import.sim
|
||||||
,,,script,./test.sh -f tsim/vnode/stable_balance_replica1.sim
|
,,y,script,./test.sh -f tsim/vnode/stable_balance_replica1.sim
|
||||||
,,y,script,./test.sh -f tsim/vnode/stable_dnode2_stop.sim
|
,,y,script,./test.sh -f tsim/vnode/stable_dnode2_stop.sim
|
||||||
,,y,script,./test.sh -f tsim/vnode/stable_dnode2.sim
|
,,y,script,./test.sh -f tsim/vnode/stable_dnode2.sim
|
||||||
,,y,script,./test.sh -f tsim/vnode/stable_dnode3.sim
|
,,y,script,./test.sh -f tsim/vnode/stable_dnode3.sim
|
||||||
|
@ -424,6 +425,7 @@
|
||||||
,,,system-test,python3 ./test.py -f 1-insert/test_stmt_set_tbname_tag.py
|
,,,system-test,python3 ./test.py -f 1-insert/test_stmt_set_tbname_tag.py
|
||||||
,,,system-test,python3 ./test.py -f 1-insert/alter_stable.py
|
,,,system-test,python3 ./test.py -f 1-insert/alter_stable.py
|
||||||
,,,system-test,python3 ./test.py -f 1-insert/alter_table.py
|
,,,system-test,python3 ./test.py -f 1-insert/alter_table.py
|
||||||
|
,,,system-test,python3 ./test.py -f 1-insert/boundary.py
|
||||||
,,,system-test,python3 ./test.py -f 1-insert/insertWithMoreVgroup.py
|
,,,system-test,python3 ./test.py -f 1-insert/insertWithMoreVgroup.py
|
||||||
,,,system-test,python3 ./test.py -f 1-insert/table_comment.py
|
,,,system-test,python3 ./test.py -f 1-insert/table_comment.py
|
||||||
,,,system-test,python3 ./test.py -f 1-insert/time_range_wise.py
|
,,,system-test,python3 ./test.py -f 1-insert/time_range_wise.py
|
||||||
|
@ -437,11 +439,11 @@
|
||||||
,,,system-test,python3 ./test.py -f 1-insert/database_pre_suf.py
|
,,,system-test,python3 ./test.py -f 1-insert/database_pre_suf.py
|
||||||
,,,system-test,python3 ./test.py -f 1-insert/InsertFuturets.py
|
,,,system-test,python3 ./test.py -f 1-insert/InsertFuturets.py
|
||||||
,,,system-test,python3 ./test.py -f 0-others/show.py
|
,,,system-test,python3 ./test.py -f 0-others/show.py
|
||||||
,,,system-test,python3 ./test.py -f 2-query/abs.py
|
,,,system-test,./pytest.sh python3 ./test.py -f 2-query/abs.py
|
||||||
,,,system-test,python3 ./test.py -f 2-query/abs.py -R
|
,,,system-test,python3 ./test.py -f 2-query/abs.py -R
|
||||||
,,,system-test,python3 ./test.py -f 2-query/and_or_for_byte.py
|
,,,system-test,python3 ./test.py -f 2-query/and_or_for_byte.py
|
||||||
,,,system-test,python3 ./test.py -f 2-query/and_or_for_byte.py -R
|
,,,system-test,python3 ./test.py -f 2-query/and_or_for_byte.py -R
|
||||||
,,,system-test,python3 ./test.py -f 2-query/apercentile.py
|
,,,system-test,./pytest.sh python3 ./test.py -f 2-query/apercentile.py
|
||||||
,,,system-test,python3 ./test.py -f 2-query/apercentile.py -R
|
,,,system-test,python3 ./test.py -f 2-query/apercentile.py -R
|
||||||
,,,system-test,python3 ./test.py -f 2-query/arccos.py
|
,,,system-test,python3 ./test.py -f 2-query/arccos.py
|
||||||
,,,system-test,python3 ./test.py -f 2-query/arccos.py -R
|
,,,system-test,python3 ./test.py -f 2-query/arccos.py -R
|
||||||
|
@ -607,6 +609,8 @@
|
||||||
,,,system-test,python3 ./test.py -f 2-query/upper.py -R
|
,,,system-test,python3 ./test.py -f 2-query/upper.py -R
|
||||||
,,,system-test,python3 ./test.py -f 2-query/varchar.py
|
,,,system-test,python3 ./test.py -f 2-query/varchar.py
|
||||||
,,,system-test,python3 ./test.py -f 2-query/varchar.py -R
|
,,,system-test,python3 ./test.py -f 2-query/varchar.py -R
|
||||||
|
,,,system-test,python3 ./test.py -f 2-query/case_when.py
|
||||||
|
,,,system-test,python3 ./test.py -f 2-query/case_when.py -R
|
||||||
,,,system-test,python3 ./test.py -f 1-insert/update_data.py
|
,,,system-test,python3 ./test.py -f 1-insert/update_data.py
|
||||||
,,,system-test,python3 ./test.py -f 1-insert/tb_100w_data_order.py
|
,,,system-test,python3 ./test.py -f 1-insert/tb_100w_data_order.py
|
||||||
,,,system-test,python3 ./test.py -f 1-insert/delete_stable.py
|
,,,system-test,python3 ./test.py -f 1-insert/delete_stable.py
|
||||||
|
@ -813,6 +817,7 @@
|
||||||
,,,system-test,python3 ./test.py -f 2-query/last_row.py -Q 2
|
,,,system-test,python3 ./test.py -f 2-query/last_row.py -Q 2
|
||||||
,,,system-test,python3 ./test.py -f 2-query/tsbsQuery.py -Q 2
|
,,,system-test,python3 ./test.py -f 2-query/tsbsQuery.py -Q 2
|
||||||
,,,system-test,python3 ./test.py -f 2-query/sml.py -Q 2
|
,,,system-test,python3 ./test.py -f 2-query/sml.py -Q 2
|
||||||
|
,,,system-test,python3 ./test.py -f 2-query/case_when.py -Q 2
|
||||||
,,,system-test,python3 ./test.py -f 2-query/between.py -Q 3
|
,,,system-test,python3 ./test.py -f 2-query/between.py -Q 3
|
||||||
,,,system-test,python3 ./test.py -f 2-query/distinct.py -Q 3
|
,,,system-test,python3 ./test.py -f 2-query/distinct.py -Q 3
|
||||||
,,,system-test,python3 ./test.py -f 2-query/varchar.py -Q 3
|
,,,system-test,python3 ./test.py -f 2-query/varchar.py -Q 3
|
||||||
|
@ -906,6 +911,7 @@
|
||||||
,,,system-test,python3 ./test.py -f 2-query/tsbsQuery.py -Q 3
|
,,,system-test,python3 ./test.py -f 2-query/tsbsQuery.py -Q 3
|
||||||
,,,system-test,python3 ./test.py -f 2-query/sml.py -Q 3
|
,,,system-test,python3 ./test.py -f 2-query/sml.py -Q 3
|
||||||
,,,system-test,python3 ./test.py -f 2-query/interp.py -Q 3
|
,,,system-test,python3 ./test.py -f 2-query/interp.py -Q 3
|
||||||
|
,,,system-test,python3 ./test.py -f 2-query/case_when.py -Q 3
|
||||||
,,,system-test,python3 ./test.py -f 2-query/between.py -Q 4
|
,,,system-test,python3 ./test.py -f 2-query/between.py -Q 4
|
||||||
,,,system-test,python3 ./test.py -f 2-query/distinct.py -Q 4
|
,,,system-test,python3 ./test.py -f 2-query/distinct.py -Q 4
|
||||||
,,,system-test,python3 ./test.py -f 2-query/varchar.py -Q 4
|
,,,system-test,python3 ./test.py -f 2-query/varchar.py -Q 4
|
||||||
|
@ -998,6 +1004,7 @@
|
||||||
,,,system-test,python3 ./test.py -f 2-query/tsbsQuery.py -Q 4
|
,,,system-test,python3 ./test.py -f 2-query/tsbsQuery.py -Q 4
|
||||||
,,,system-test,python3 ./test.py -f 2-query/sml.py -Q 4
|
,,,system-test,python3 ./test.py -f 2-query/sml.py -Q 4
|
||||||
,,,system-test,python3 ./test.py -f 2-query/interp.py -Q 4
|
,,,system-test,python3 ./test.py -f 2-query/interp.py -Q 4
|
||||||
|
,,,system-test,python3 ./test.py -f 2-query/case_when.py -Q 4
|
||||||
|
|
||||||
#develop test
|
#develop test
|
||||||
,,,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/auto_create_table_json.py
|
,,,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/auto_create_table_json.py
|
||||||
|
|
|
@ -45,7 +45,7 @@ fi
|
||||||
|
|
||||||
# Now getting ready to execute Python
|
# Now getting ready to execute Python
|
||||||
# The following is the default of our standard dev env (Ubuntu 20.04), modify/adjust at your own risk
|
# The following is the default of our standard dev env (Ubuntu 20.04), modify/adjust at your own risk
|
||||||
PYTHON_EXEC=python3.8
|
PYTHON_EXEC=python3
|
||||||
|
|
||||||
# First we need to set up a path for Python to find our own TAOS modules, so that "import" can work.
|
# First we need to set up a path for Python to find our own TAOS modules, so that "import" can work.
|
||||||
# export PYTHONPATH=$(pwd)/../../src/connector/python:$(pwd)
|
# export PYTHONPATH=$(pwd)/../../src/connector/python:$(pwd)
|
||||||
|
|
|
@ -37,6 +37,7 @@ import requests
|
||||||
# from guppy import hpy
|
# from guppy import hpy
|
||||||
import gc
|
import gc
|
||||||
import taos
|
import taos
|
||||||
|
from taos.tmq import *
|
||||||
|
|
||||||
|
|
||||||
from .shared.types import TdColumns, TdTags
|
from .shared.types import TdColumns, TdTags
|
||||||
|
@ -419,10 +420,12 @@ class ThreadCoordinator:
|
||||||
except threading.BrokenBarrierError as err:
|
except threading.BrokenBarrierError as err:
|
||||||
self._execStats.registerFailure("Aborted due to worker thread timeout")
|
self._execStats.registerFailure("Aborted due to worker thread timeout")
|
||||||
Logging.error("\n")
|
Logging.error("\n")
|
||||||
|
|
||||||
Logging.error("Main loop aborted, caused by worker thread(s) time-out of {} seconds".format(
|
Logging.error("Main loop aborted, caused by worker thread(s) time-out of {} seconds".format(
|
||||||
ThreadCoordinator.WORKER_THREAD_TIMEOUT))
|
ThreadCoordinator.WORKER_THREAD_TIMEOUT))
|
||||||
Logging.error("TAOS related threads blocked at (stack frames top-to-bottom):")
|
Logging.error("TAOS related threads blocked at (stack frames top-to-bottom):")
|
||||||
ts = ThreadStacks()
|
ts = ThreadStacks()
|
||||||
|
ts.record_current_time(time.time()) # record thread exit time at current moment
|
||||||
ts.print(filterInternal=True)
|
ts.print(filterInternal=True)
|
||||||
workerTimeout = True
|
workerTimeout = True
|
||||||
|
|
||||||
|
@ -546,7 +549,12 @@ class ThreadCoordinator:
|
||||||
|
|
||||||
# pick a task type for current state
|
# pick a task type for current state
|
||||||
db = self.pickDatabase()
|
db = self.pickDatabase()
|
||||||
taskType = db.getStateMachine().pickTaskType() # dynamic name of class
|
if Dice.throw(2)==1:
|
||||||
|
taskType = db.getStateMachine().pickTaskType() # dynamic name of class
|
||||||
|
else:
|
||||||
|
taskType = db.getStateMachine().balance_pickTaskType() # and an method can get balance task types
|
||||||
|
pass
|
||||||
|
|
||||||
return taskType(self._execStats, db) # create a task from it
|
return taskType(self._execStats, db) # create a task from it
|
||||||
|
|
||||||
def resetExecutedTasks(self):
|
def resetExecutedTasks(self):
|
||||||
|
@ -674,9 +682,15 @@ class AnyState:
|
||||||
# only "under normal circumstances", as we may override it with the -b option
|
# only "under normal circumstances", as we may override it with the -b option
|
||||||
CAN_DROP_DB = 2
|
CAN_DROP_DB = 2
|
||||||
CAN_CREATE_FIXED_SUPER_TABLE = 3
|
CAN_CREATE_FIXED_SUPER_TABLE = 3
|
||||||
|
CAN_CREATE_STREAM = 3 # super table must exists
|
||||||
|
CAN_CREATE_TOPIC = 3 # super table must exists
|
||||||
|
CAN_CREATE_CONSUMERS = 3
|
||||||
CAN_DROP_FIXED_SUPER_TABLE = 4
|
CAN_DROP_FIXED_SUPER_TABLE = 4
|
||||||
|
CAN_DROP_TOPIC = 4
|
||||||
|
CAN_DROP_STREAM = 4
|
||||||
CAN_ADD_DATA = 5
|
CAN_ADD_DATA = 5
|
||||||
CAN_READ_DATA = 6
|
CAN_READ_DATA = 6
|
||||||
|
CAN_DELETE_DATA = 6
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._info = self.getInfo()
|
self._info = self.getInfo()
|
||||||
|
@ -727,12 +741,30 @@ class AnyState:
|
||||||
return False
|
return False
|
||||||
return self._info[self.CAN_DROP_FIXED_SUPER_TABLE]
|
return self._info[self.CAN_DROP_FIXED_SUPER_TABLE]
|
||||||
|
|
||||||
|
def canCreateTopic(self):
|
||||||
|
return self._info[self.CAN_CREATE_TOPIC]
|
||||||
|
|
||||||
|
def canDropTopic(self):
|
||||||
|
return self._info[self.CAN_DROP_TOPIC]
|
||||||
|
|
||||||
|
def canCreateConsumers(self):
|
||||||
|
return self._info[self.CAN_CREATE_CONSUMERS]
|
||||||
|
|
||||||
|
def canCreateStreams(self):
|
||||||
|
return self._info[self.CAN_CREATE_STREAM]
|
||||||
|
|
||||||
|
def canDropStream(self):
|
||||||
|
return self._info[self.CAN_DROP_STREAM]
|
||||||
|
|
||||||
def canAddData(self):
|
def canAddData(self):
|
||||||
return self._info[self.CAN_ADD_DATA]
|
return self._info[self.CAN_ADD_DATA]
|
||||||
|
|
||||||
def canReadData(self):
|
def canReadData(self):
|
||||||
return self._info[self.CAN_READ_DATA]
|
return self._info[self.CAN_READ_DATA]
|
||||||
|
|
||||||
|
def canDeleteData(self):
|
||||||
|
return self._info[self.CAN_DELETE_DATA]
|
||||||
|
|
||||||
def assertAtMostOneSuccess(self, tasks, cls):
|
def assertAtMostOneSuccess(self, tasks, cls):
|
||||||
sCnt = 0
|
sCnt = 0
|
||||||
for task in tasks:
|
for task in tasks:
|
||||||
|
@ -902,7 +934,7 @@ class StateHasData(AnyState):
|
||||||
): # only if we didn't create one
|
): # only if we didn't create one
|
||||||
# we shouldn't have dropped it
|
# we shouldn't have dropped it
|
||||||
self.assertNoTask(tasks, TaskDropDb)
|
self.assertNoTask(tasks, TaskDropDb)
|
||||||
if (not self.hasTask(tasks, TaskCreateSuperTable)
|
if not( self.hasTask(tasks, TaskCreateSuperTable)
|
||||||
): # if we didn't create the table
|
): # if we didn't create the table
|
||||||
# we should not have a task that drops it
|
# we should not have a task that drops it
|
||||||
self.assertNoTask(tasks, TaskDropSuperTable)
|
self.assertNoTask(tasks, TaskDropSuperTable)
|
||||||
|
@ -974,14 +1006,21 @@ class StateMechine:
|
||||||
# did not do this when openning connection, and this is NOT the worker
|
# did not do this when openning connection, and this is NOT the worker
|
||||||
# thread, which does this on their own
|
# thread, which does this on their own
|
||||||
dbc.use(dbName)
|
dbc.use(dbName)
|
||||||
|
|
||||||
if not dbc.hasTables(): # no tables
|
if not dbc.hasTables(): # no tables
|
||||||
|
|
||||||
Logging.debug("[STT] DB_ONLY found, between {} and {}".format(ts, time.time()))
|
Logging.debug("[STT] DB_ONLY found, between {} and {}".format(ts, time.time()))
|
||||||
return StateDbOnly()
|
return StateDbOnly()
|
||||||
|
|
||||||
# For sure we have tables, which means we must have the super table. # TODO: are we sure?
|
# For sure we have tables, which means we must have the super table. # TODO: are we sure?
|
||||||
|
|
||||||
sTable = self._db.getFixedSuperTable()
|
sTable = self._db.getFixedSuperTable()
|
||||||
if sTable.hasRegTables(dbc): # no regular tables
|
|
||||||
|
|
||||||
|
if sTable.hasRegTables(dbc): # no regular tables
|
||||||
|
# print("debug=====*\n"*100)
|
||||||
Logging.debug("[STT] SUPER_TABLE_ONLY found, between {} and {}".format(ts, time.time()))
|
Logging.debug("[STT] SUPER_TABLE_ONLY found, between {} and {}".format(ts, time.time()))
|
||||||
|
|
||||||
return StateSuperTableOnly()
|
return StateSuperTableOnly()
|
||||||
else: # has actual tables
|
else: # has actual tables
|
||||||
Logging.debug("[STT] HAS_DATA found, between {} and {}".format(ts, time.time()))
|
Logging.debug("[STT] HAS_DATA found, between {} and {}".format(ts, time.time()))
|
||||||
|
@ -1051,6 +1090,28 @@ class StateMechine:
|
||||||
# Logging.debug(" (weighted random:{}/{}) ".format(i, len(taskTypes)))
|
# Logging.debug(" (weighted random:{}/{}) ".format(i, len(taskTypes)))
|
||||||
return taskTypes[i]
|
return taskTypes[i]
|
||||||
|
|
||||||
|
def balance_pickTaskType(self):
|
||||||
|
# all the task types we can choose from at curent state
|
||||||
|
BasicTypes = self.getTaskTypes()
|
||||||
|
weightsTypes = BasicTypes.copy()
|
||||||
|
|
||||||
|
# this matrixs can balance the Frequency of TaskTypes
|
||||||
|
balance_TaskType_matrixs = {'TaskDropDb': 5 , 'TaskDropTopics': 20 , 'TaskDropStreams':10 , 'TaskDropStreamTables':10 ,
|
||||||
|
'TaskReadData':50 , 'TaskDropSuperTable':5 , 'TaskAlterTags':3 , 'TaskAddData':10,
|
||||||
|
'TaskDeleteData':10 , 'TaskCreateDb':10 , 'TaskCreateStream': 3, 'TaskCreateTopic' :3,
|
||||||
|
'TaskCreateConsumers':10, 'TaskCreateSuperTable': 10 } # TaskType : balance_matrixs of task
|
||||||
|
|
||||||
|
for task , weights in balance_TaskType_matrixs.items():
|
||||||
|
|
||||||
|
for basicType in BasicTypes:
|
||||||
|
if basicType.__name__ == task:
|
||||||
|
for _ in range(weights):
|
||||||
|
weightsTypes.append(basicType)
|
||||||
|
|
||||||
|
task = random.sample(weightsTypes,1)
|
||||||
|
return task[0]
|
||||||
|
|
||||||
|
|
||||||
# ref:
|
# ref:
|
||||||
# https://eli.thegreenplace.net/2010/01/22/weighted-random-generation-in-python/
|
# https://eli.thegreenplace.net/2010/01/22/weighted-random-generation-in-python/
|
||||||
def _weighted_choice_sub(self, weights) -> int:
|
def _weighted_choice_sub(self, weights) -> int:
|
||||||
|
@ -1109,6 +1170,7 @@ class Database:
|
||||||
return "fs_table"
|
return "fs_table"
|
||||||
|
|
||||||
def getFixedSuperTable(self) -> TdSuperTable:
|
def getFixedSuperTable(self) -> TdSuperTable:
|
||||||
|
|
||||||
return TdSuperTable(self.getFixedSuperTableName(), self.getName())
|
return TdSuperTable(self.getFixedSuperTableName(), self.getName())
|
||||||
|
|
||||||
# We aim to create a starting time tick, such that, whenever we run our test here once
|
# We aim to create a starting time tick, such that, whenever we run our test here once
|
||||||
|
@ -1342,6 +1404,19 @@ class Task():
|
||||||
0x2603, # Table does not exist, replaced by 2662 below
|
0x2603, # Table does not exist, replaced by 2662 below
|
||||||
0x260d, # Tags number not matched
|
0x260d, # Tags number not matched
|
||||||
0x2662, # Table does not exist #TODO: what about 2603 above?
|
0x2662, # Table does not exist #TODO: what about 2603 above?
|
||||||
|
0x2600, # database not specified, SQL: show stables , database droped , and show tables
|
||||||
|
0x032C, # Object is creating
|
||||||
|
0x032D, # Object is dropping
|
||||||
|
0x03D3, # Conflict transaction not completed
|
||||||
|
0x0707, # Query not ready , it always occur at replica 3
|
||||||
|
0x707, # Query not ready
|
||||||
|
0x396, # Database in creating status
|
||||||
|
0x386, # Database in droping status
|
||||||
|
0x03E1, # failed on tmq_subscribe ,topic not exist
|
||||||
|
0x03ed , # Topic must be dropped first, SQL: drop database db_0
|
||||||
|
0x0203 , # Invalid value
|
||||||
|
0x03f0 , # Stream already exist , topic already exists
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1638,9 +1713,12 @@ class TaskCreateDb(StateTransitionTask):
|
||||||
# numReplica = Dice.throw(Settings.getConfig().max_replicas) + 1 # 1,2 ... N
|
# numReplica = Dice.throw(Settings.getConfig().max_replicas) + 1 # 1,2 ... N
|
||||||
numReplica = Config.getConfig().num_replicas # fixed, always
|
numReplica = Config.getConfig().num_replicas # fixed, always
|
||||||
repStr = "replica {}".format(numReplica)
|
repStr = "replica {}".format(numReplica)
|
||||||
updatePostfix = "update 1" if Config.getConfig().verify_data else "" # allow update only when "verify data" is active
|
updatePostfix = "" if Config.getConfig().verify_data else "" # allow update only when "verify data" is active , 3.0 version default is update 1
|
||||||
|
vg_nums = random.randint(1,8)
|
||||||
|
cache_model = Dice.choice(['none' , 'last_row' , 'last_value' , 'both'])
|
||||||
|
buffer = random.randint(3,128)
|
||||||
dbName = self._db.getName()
|
dbName = self._db.getName()
|
||||||
self.execWtSql(wt, "create database {} {} {} ".format(dbName, repStr, updatePostfix ) )
|
self.execWtSql(wt, "create database {} {} {} vgroups {} cachemodel '{}' buffer {} ".format(dbName, repStr, updatePostfix, vg_nums, cache_model,buffer ) )
|
||||||
if dbName == "db_0" and Config.getConfig().use_shadow_db:
|
if dbName == "db_0" and Config.getConfig().use_shadow_db:
|
||||||
self.execWtSql(wt, "create database {} {} {} ".format("db_s", repStr, updatePostfix ) )
|
self.execWtSql(wt, "create database {} {} {} ".format("db_s", repStr, updatePostfix ) )
|
||||||
|
|
||||||
|
@ -1654,9 +1732,211 @@ class TaskDropDb(StateTransitionTask):
|
||||||
return state.canDropDb()
|
return state.canDropDb()
|
||||||
|
|
||||||
def _executeInternal(self, te: TaskExecutor, wt: WorkerThread):
|
def _executeInternal(self, te: TaskExecutor, wt: WorkerThread):
|
||||||
self.execWtSql(wt, "drop database {}".format(self._db.getName()))
|
|
||||||
|
try:
|
||||||
|
self.queryWtSql(wt, "drop database {}".format(self._db.getName())) # drop database maybe failed ,because topic exists
|
||||||
|
except taos.error.ProgrammingError as err:
|
||||||
|
errno = Helper.convertErrno(err.errno)
|
||||||
|
if errno in [0x0203]: # drop maybe failed
|
||||||
|
pass
|
||||||
|
|
||||||
Logging.debug("[OPS] database dropped at {}".format(time.time()))
|
Logging.debug("[OPS] database dropped at {}".format(time.time()))
|
||||||
|
|
||||||
|
|
||||||
|
class TaskCreateStream(StateTransitionTask):
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def getEndState(cls):
|
||||||
|
return StateHasData()
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def canBeginFrom(cls, state: AnyState):
|
||||||
|
return state.canCreateStreams()
|
||||||
|
|
||||||
|
def _executeInternal(self, te: TaskExecutor, wt: WorkerThread):
|
||||||
|
dbname = self._db.getName()
|
||||||
|
|
||||||
|
sub_stream_name = dbname+ '_sub_stream'
|
||||||
|
sub_stream_tb_name = 'stream_tb_sub'
|
||||||
|
super_stream_name = dbname+ '_super_stream'
|
||||||
|
super_stream_tb_name = 'stream_tb_super'
|
||||||
|
if not self._db.exists(wt.getDbConn()):
|
||||||
|
Logging.debug("Skipping task, no DB yet")
|
||||||
|
return
|
||||||
|
|
||||||
|
sTable = self._db.getFixedSuperTable() # type: TdSuperTable
|
||||||
|
# wt.execSql("use db") # should always be in place
|
||||||
|
stbname =sTable.getName()
|
||||||
|
sub_tables = sTable.getRegTables(wt.getDbConn())
|
||||||
|
aggExpr = Dice.choice([
|
||||||
|
'count(*)', 'avg(speed)', 'sum(speed)', 'stddev(speed)','min(speed)', 'max(speed)', 'first(speed)', 'last(speed)',
|
||||||
|
'apercentile(speed, 10)', 'last_row(*)', 'twa(speed)'])
|
||||||
|
|
||||||
|
stream_sql = '' # set default value
|
||||||
|
|
||||||
|
if sub_tables:
|
||||||
|
sub_tbname = sub_tables[0]
|
||||||
|
# create stream with query above sub_table
|
||||||
|
stream_sql = 'create stream {} into {}.{} as select {}, avg(speed) FROM {}.{} PARTITION BY tbname INTERVAL(5s) SLIDING(3s) '.\
|
||||||
|
format(sub_stream_name,dbname,sub_stream_tb_name ,aggExpr,dbname,sub_tbname)
|
||||||
|
else:
|
||||||
|
stream_sql = 'create stream {} into {}.{} as select {}, avg(speed) FROM {}.{} PARTITION BY tbname INTERVAL(5s) SLIDING(3s) '.\
|
||||||
|
format(super_stream_name,dbname,super_stream_tb_name,aggExpr, dbname,stbname)
|
||||||
|
self.execWtSql(wt, stream_sql)
|
||||||
|
Logging.debug("[OPS] stream is creating at {}".format(time.time()))
|
||||||
|
|
||||||
|
|
||||||
|
class TaskCreateTopic(StateTransitionTask):
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def getEndState(cls):
|
||||||
|
return StateHasData()
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def canBeginFrom(cls, state: AnyState):
|
||||||
|
return state.canCreateTopic()
|
||||||
|
|
||||||
|
def _executeInternal(self, te: TaskExecutor, wt: WorkerThread):
|
||||||
|
dbname = self._db.getName()
|
||||||
|
|
||||||
|
sub_topic_name = dbname+ '_sub_topic'
|
||||||
|
super_topic_name = dbname+ '_super_topic'
|
||||||
|
stable_topic = dbname+ '_stable_topic'
|
||||||
|
db_topic = 'database_' + dbname+ '_topics'
|
||||||
|
if not self._db.exists(wt.getDbConn()):
|
||||||
|
Logging.debug("Skipping task, no DB yet")
|
||||||
|
return
|
||||||
|
|
||||||
|
sTable = self._db.getFixedSuperTable() # type: TdSuperTable
|
||||||
|
# wt.execSql("use db") # should always be in place
|
||||||
|
# create topic if not exists topic_ctb_column as select ts, c1, c2, c3 from stb1;
|
||||||
|
|
||||||
|
stbname =sTable.getName()
|
||||||
|
sub_tables = sTable.getRegTables(wt.getDbConn())
|
||||||
|
|
||||||
|
scalarExpr = Dice.choice([ '*','speed','color','abs(speed)','acos(speed)','asin(speed)','atan(speed)','ceil(speed)','cos(speed)','cos(speed)',
|
||||||
|
'floor(speed)','log(speed,2)','pow(speed,2)','round(speed)','sin(speed)','sqrt(speed)','char_length(color)','concat(color,color)',
|
||||||
|
'concat_ws(" ", color,color," ")','length(color)', 'lower(color)', 'ltrim(color)','substr(color , 2)','upper(color)','cast(speed as double)',
|
||||||
|
'cast(ts as bigint)'])
|
||||||
|
topic_sql = '' # set default value
|
||||||
|
if Dice.throw(3)==0: # create topic : source data from sub query
|
||||||
|
if sub_tables: # if not empty
|
||||||
|
sub_tbname = sub_tables[0]
|
||||||
|
# create topic : source data from sub query of sub stable
|
||||||
|
topic_sql = 'create topic {} as select {} FROM {}.{} ; '.format(sub_topic_name,scalarExpr,dbname,sub_tbname)
|
||||||
|
|
||||||
|
else: # create topic : source data from sub query of stable
|
||||||
|
topic_sql = 'create topic {} as select {} FROM {}.{} '.format(super_topic_name,scalarExpr, dbname,stbname)
|
||||||
|
elif Dice.throw(3)==1: # create topic : source data from super table
|
||||||
|
topic_sql = 'create topic {} AS STABLE {}.{} '.format(stable_topic,dbname,stbname)
|
||||||
|
|
||||||
|
elif Dice.throw(3)==2: # create topic : source data from whole database
|
||||||
|
topic_sql = 'create topic {} AS DATABASE {} '.format(db_topic,dbname)
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
|
||||||
|
# exec create topics
|
||||||
|
self.execWtSql(wt, "use {}".format(dbname))
|
||||||
|
self.execWtSql(wt, topic_sql)
|
||||||
|
Logging.debug("[OPS] db topic is creating at {}".format(time.time()))
|
||||||
|
|
||||||
|
class TaskDropTopics(StateTransitionTask):
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def getEndState(cls):
|
||||||
|
return StateHasData()
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def canBeginFrom(cls, state: AnyState):
|
||||||
|
return state.canDropTopic()
|
||||||
|
|
||||||
|
def _executeInternal(self, te: TaskExecutor, wt: WorkerThread):
|
||||||
|
dbname = self._db.getName()
|
||||||
|
|
||||||
|
|
||||||
|
if not self._db.exists(wt.getDbConn()):
|
||||||
|
Logging.debug("Skipping task, no DB yet")
|
||||||
|
return
|
||||||
|
|
||||||
|
sTable = self._db.getFixedSuperTable() # type: TdSuperTable
|
||||||
|
# wt.execSql("use db") # should always be in place
|
||||||
|
tblName = sTable.getName()
|
||||||
|
if sTable.hasTopics(wt.getDbConn()):
|
||||||
|
sTable.dropTopics(wt.getDbConn(),dbname,None) # drop topics of database
|
||||||
|
sTable.dropTopics(wt.getDbConn(),dbname,tblName) # drop topics of stable
|
||||||
|
|
||||||
|
class TaskDropStreams(StateTransitionTask):
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def getEndState(cls):
|
||||||
|
return StateHasData()
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def canBeginFrom(cls, state: AnyState):
|
||||||
|
return state.canDropStream()
|
||||||
|
|
||||||
|
def _executeInternal(self, te: TaskExecutor, wt: WorkerThread):
|
||||||
|
# dbname = self._db.getName()
|
||||||
|
|
||||||
|
|
||||||
|
if not self._db.exists(wt.getDbConn()):
|
||||||
|
Logging.debug("Skipping task, no DB yet")
|
||||||
|
return
|
||||||
|
|
||||||
|
sTable = self._db.getFixedSuperTable() # type: TdSuperTable
|
||||||
|
# wt.execSql("use db") # should always be in place
|
||||||
|
# tblName = sTable.getName()
|
||||||
|
if sTable.hasStreams(wt.getDbConn()):
|
||||||
|
sTable.dropStreams(wt.getDbConn()) # drop stream of database
|
||||||
|
|
||||||
|
class TaskDropStreamTables(StateTransitionTask):
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def getEndState(cls):
|
||||||
|
return StateHasData()
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def canBeginFrom(cls, state: AnyState):
|
||||||
|
return state.canDropStream()
|
||||||
|
|
||||||
|
def _executeInternal(self, te: TaskExecutor, wt: WorkerThread):
|
||||||
|
# dbname = self._db.getName()
|
||||||
|
|
||||||
|
|
||||||
|
if not self._db.exists(wt.getDbConn()):
|
||||||
|
Logging.debug("Skipping task, no DB yet")
|
||||||
|
return
|
||||||
|
|
||||||
|
sTable = self._db.getFixedSuperTable() # type: TdSuperTable
|
||||||
|
wt.execSql("use db") # should always be in place
|
||||||
|
# tblName = sTable.getName()
|
||||||
|
if sTable.hasStreamTables(wt.getDbConn()):
|
||||||
|
sTable.dropStreamTables(wt.getDbConn()) # drop stream tables
|
||||||
|
|
||||||
|
class TaskCreateConsumers(StateTransitionTask):
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def getEndState(cls):
|
||||||
|
return StateHasData()
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def canBeginFrom(cls, state: AnyState):
|
||||||
|
return state.canCreateConsumers()
|
||||||
|
|
||||||
|
def _executeInternal(self, te: TaskExecutor, wt: WorkerThread):
|
||||||
|
|
||||||
|
if Config.getConfig().connector_type == 'native':
|
||||||
|
|
||||||
|
sTable = self._db.getFixedSuperTable() # type: TdSuperTable
|
||||||
|
# wt.execSql("use db") # should always be in place
|
||||||
|
if sTable.hasTopics(wt.getDbConn()):
|
||||||
|
sTable.createConsumer(wt.getDbConn(),random.randint(1,10))
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
print(" restful not support tmq consumers")
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
class TaskCreateSuperTable(StateTransitionTask):
|
class TaskCreateSuperTable(StateTransitionTask):
|
||||||
@classmethod
|
@classmethod
|
||||||
def getEndState(cls):
|
def getEndState(cls):
|
||||||
|
@ -1673,7 +1953,7 @@ class TaskCreateSuperTable(StateTransitionTask):
|
||||||
|
|
||||||
sTable = self._db.getFixedSuperTable() # type: TdSuperTable
|
sTable = self._db.getFixedSuperTable() # type: TdSuperTable
|
||||||
# wt.execSql("use db") # should always be in place
|
# wt.execSql("use db") # should always be in place
|
||||||
|
|
||||||
sTable.create(wt.getDbConn(),
|
sTable.create(wt.getDbConn(),
|
||||||
{'ts': TdDataType.TIMESTAMP, 'speed': TdDataType.INT, 'color': TdDataType.BINARY16}, {
|
{'ts': TdDataType.TIMESTAMP, 'speed': TdDataType.INT, 'color': TdDataType.BINARY16}, {
|
||||||
'b': TdDataType.BINARY200, 'f': TdDataType.FLOAT},
|
'b': TdDataType.BINARY200, 'f': TdDataType.FLOAT},
|
||||||
|
@ -1688,14 +1968,17 @@ class TdSuperTable:
|
||||||
def __init__(self, stName, dbName):
|
def __init__(self, stName, dbName):
|
||||||
self._stName = stName
|
self._stName = stName
|
||||||
self._dbName = dbName
|
self._dbName = dbName
|
||||||
|
self._consumerLists = {}
|
||||||
|
self._ConsumerInsts = []
|
||||||
|
|
||||||
def getName(self):
|
def getName(self):
|
||||||
return self._stName
|
return self._stName
|
||||||
|
|
||||||
|
|
||||||
def drop(self, dbc, skipCheck = False):
|
def drop(self, dbc, skipCheck = False):
|
||||||
dbName = self._dbName
|
dbName = self._dbName
|
||||||
if self.exists(dbc) : # if myself exists
|
if self.exists(dbc) : # if myself exists
|
||||||
fullTableName = dbName + '.' + self._stName
|
fullTableName = dbName + '.' + self._stName
|
||||||
dbc.execute("DROP TABLE {}".format(fullTableName))
|
dbc.execute("DROP TABLE {}".format(fullTableName))
|
||||||
else:
|
else:
|
||||||
if not skipCheck:
|
if not skipCheck:
|
||||||
|
@ -1711,10 +1994,12 @@ class TdSuperTable:
|
||||||
|
|
||||||
dbName = self._dbName
|
dbName = self._dbName
|
||||||
dbc.execute("USE " + dbName)
|
dbc.execute("USE " + dbName)
|
||||||
fullTableName = dbName + '.' + self._stName
|
fullTableName = dbName + '.' + self._stName
|
||||||
|
|
||||||
if dbc.existsSuperTable(self._stName):
|
if dbc.existsSuperTable(self._stName):
|
||||||
if dropIfExists:
|
if dropIfExists:
|
||||||
dbc.execute("DROP TABLE {}".format(fullTableName))
|
dbc.execute("DROP TABLE {}".format(fullTableName))
|
||||||
|
|
||||||
else: # error
|
else: # error
|
||||||
raise CrashGenError("Cannot create super table, already exists: {}".format(self._stName))
|
raise CrashGenError("Cannot create super table, already exists: {}".format(self._stName))
|
||||||
|
|
||||||
|
@ -1728,12 +2013,61 @@ class TdSuperTable:
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
sql += " TAGS (dummy int) "
|
sql += " TAGS (dummy int) "
|
||||||
dbc.execute(sql)
|
dbc.execute(sql)
|
||||||
|
|
||||||
|
def createConsumer(self, dbc,Consumer_nums):
|
||||||
|
|
||||||
|
def generateConsumer(current_topic_list):
|
||||||
|
conf = TaosTmqConf()
|
||||||
|
conf.set("group.id", "tg2")
|
||||||
|
conf.set("td.connect.user", "root")
|
||||||
|
conf.set("td.connect.pass", "taosdata")
|
||||||
|
conf.set("enable.auto.commit", "true")
|
||||||
|
def tmq_commit_cb_print(tmq, resp, offset, param=None):
|
||||||
|
print(f"commit: {resp}, tmq: {tmq}, offset: {offset}, param: {param}")
|
||||||
|
conf.set_auto_commit_cb(tmq_commit_cb_print, None)
|
||||||
|
consumer = conf.new_consumer()
|
||||||
|
topic_list = TaosTmqList()
|
||||||
|
for topic in current_topic_list:
|
||||||
|
topic_list.append(topic)
|
||||||
|
try:
|
||||||
|
consumer.subscribe(topic_list)
|
||||||
|
except TmqError as e :
|
||||||
|
pass
|
||||||
|
|
||||||
|
# consumer with random work life
|
||||||
|
time_start = time.time()
|
||||||
|
while 1:
|
||||||
|
res = consumer.poll(1000)
|
||||||
|
if time.time() - time_start >random.randint(5,50) :
|
||||||
|
break
|
||||||
|
try:
|
||||||
|
consumer.unsubscribe()
|
||||||
|
except TmqError as e :
|
||||||
|
pass
|
||||||
|
return
|
||||||
|
|
||||||
|
# mulit Consumer
|
||||||
|
current_topic_list = self.getTopicLists(dbc)
|
||||||
|
for i in range(Consumer_nums):
|
||||||
|
consumer_inst = threading.Thread(target=generateConsumer, args=(current_topic_list,))
|
||||||
|
self._ConsumerInsts.append(consumer_inst)
|
||||||
|
|
||||||
|
for ConsumerInst in self._ConsumerInsts:
|
||||||
|
ConsumerInst.start()
|
||||||
|
for ConsumerInst in self._ConsumerInsts:
|
||||||
|
ConsumerInst.join()
|
||||||
|
|
||||||
|
def getTopicLists(self, dbc: DbConn):
|
||||||
|
dbc.query("show topics ")
|
||||||
|
topics = dbc.getQueryResult()
|
||||||
|
topicLists = [v[0] for v in topics]
|
||||||
|
return topicLists
|
||||||
|
|
||||||
def getRegTables(self, dbc: DbConn):
|
def getRegTables(self, dbc: DbConn):
|
||||||
dbName = self._dbName
|
dbName = self._dbName
|
||||||
try:
|
try:
|
||||||
dbc.query("select TBNAME from {}.{}".format(dbName, self._stName)) # TODO: analyze result set later
|
dbc.query("select distinct TBNAME from {}.{}".format(dbName, self._stName)) # TODO: analyze result set later
|
||||||
except taos.error.ProgrammingError as err:
|
except taos.error.ProgrammingError as err:
|
||||||
errno2 = Helper.convertErrno(err.errno)
|
errno2 = Helper.convertErrno(err.errno)
|
||||||
Logging.debug("[=] Failed to get tables from super table: errno=0x{:X}, msg: {}".format(errno2, err))
|
Logging.debug("[=] Failed to get tables from super table: errno=0x{:X}, msg: {}".format(errno2, err))
|
||||||
|
@ -1743,7 +2077,75 @@ class TdSuperTable:
|
||||||
return [v[0] for v in qr] # list transformation, ref: https://stackoverflow.com/questions/643823/python-list-transformation
|
return [v[0] for v in qr] # list transformation, ref: https://stackoverflow.com/questions/643823/python-list-transformation
|
||||||
|
|
||||||
def hasRegTables(self, dbc: DbConn):
|
def hasRegTables(self, dbc: DbConn):
|
||||||
return dbc.query("SELECT * FROM {}.{}".format(self._dbName, self._stName)) > 0
|
|
||||||
|
if dbc.existsSuperTable(self._stName):
|
||||||
|
|
||||||
|
return dbc.query("SELECT * FROM {}.{}".format(self._dbName, self._stName)) > 0
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
|
def hasStreamTables(self,dbc: DbConn):
|
||||||
|
|
||||||
|
return dbc.query("show {}.stables like 'stream_tb%'".format(self._dbName)) > 0
|
||||||
|
|
||||||
|
def hasStreams(self,dbc: DbConn):
|
||||||
|
return dbc.query("show streams") > 0
|
||||||
|
|
||||||
|
def hasTopics(self,dbc: DbConn):
|
||||||
|
|
||||||
|
return dbc.query("show topics") > 0
|
||||||
|
|
||||||
|
def dropTopics(self,dbc: DbConn , dbname=None,stb_name=None):
|
||||||
|
dbc.query("show topics ")
|
||||||
|
topics = dbc.getQueryResult()
|
||||||
|
|
||||||
|
if dbname !=None and stb_name == None :
|
||||||
|
|
||||||
|
for topic in topics:
|
||||||
|
if dbname in topic[0] and topic[0].startswith("database"):
|
||||||
|
try:
|
||||||
|
dbc.execute('drop topic {}'.format(topic[0]))
|
||||||
|
Logging.debug("[OPS] topic {} is droping at {}".format(topic,time.time()))
|
||||||
|
except taos.error.ProgrammingError as err:
|
||||||
|
errno = Helper.convertErrno(err.errno)
|
||||||
|
if errno in [0x03EB]: # Topic subscribed cannot be dropped
|
||||||
|
pass
|
||||||
|
# for subsript in subscriptions:
|
||||||
|
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
|
||||||
|
pass
|
||||||
|
return True
|
||||||
|
elif dbname !=None and stb_name!= None:
|
||||||
|
for topic in topics:
|
||||||
|
if topic[0].startswith(self._dbName) and topic[0].endswith('topic'):
|
||||||
|
dbc.execute('drop topic {}'.format(topic[0]))
|
||||||
|
Logging.debug("[OPS] topic {} is droping at {}".format(topic,time.time()))
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return True
|
||||||
|
pass
|
||||||
|
|
||||||
|
def dropStreams(self,dbc:DbConn):
|
||||||
|
dbc.query("show streams ")
|
||||||
|
Streams = dbc.getQueryResult()
|
||||||
|
for Stream in Streams:
|
||||||
|
if Stream[0].startswith(self._dbName):
|
||||||
|
dbc.execute('drop stream {}'.format(Stream[0]))
|
||||||
|
|
||||||
|
return not dbc.query("show streams ") > 0
|
||||||
|
|
||||||
|
def dropStreamTables(self, dbc: DbConn):
|
||||||
|
dbc.query("show {}.stables like 'stream_tb%'".format(self._dbName))
|
||||||
|
|
||||||
|
StreamTables = dbc.getQueryResult()
|
||||||
|
|
||||||
|
for StreamTable in StreamTables:
|
||||||
|
if self.dropStreams(dbc):
|
||||||
|
dbc.execute('drop table {}.{}'.format(self._dbName,StreamTable[0]))
|
||||||
|
|
||||||
|
return not dbc.query("show {}.stables like 'stream_tb%'".format(self._dbName))
|
||||||
|
|
||||||
def ensureRegTable(self, task: Optional[Task], dbc: DbConn, regTableName: str):
|
def ensureRegTable(self, task: Optional[Task], dbc: DbConn, regTableName: str):
|
||||||
'''
|
'''
|
||||||
|
@ -1838,10 +2240,46 @@ class TdSuperTable:
|
||||||
# Run the query against the regular table first
|
# Run the query against the regular table first
|
||||||
doAggr = (Dice.throw(2) == 0) # 1 in 2 chance
|
doAggr = (Dice.throw(2) == 0) # 1 in 2 chance
|
||||||
if not doAggr: # don't do aggregate query, just simple one
|
if not doAggr: # don't do aggregate query, just simple one
|
||||||
|
commonExpr = Dice.choice([
|
||||||
|
'*',
|
||||||
|
'abs(speed)',
|
||||||
|
'acos(speed)',
|
||||||
|
'asin(speed)',
|
||||||
|
'atan(speed)',
|
||||||
|
'ceil(speed)',
|
||||||
|
'cos(speed)',
|
||||||
|
'cos(speed)',
|
||||||
|
'floor(speed)',
|
||||||
|
'log(speed,2)',
|
||||||
|
'pow(speed,2)',
|
||||||
|
'round(speed)',
|
||||||
|
'sin(speed)',
|
||||||
|
'sqrt(speed)',
|
||||||
|
'char_length(color)',
|
||||||
|
'concat(color,color)',
|
||||||
|
'concat_ws(" ", color,color," ")',
|
||||||
|
'length(color)',
|
||||||
|
'lower(color)',
|
||||||
|
'ltrim(color)',
|
||||||
|
'substr(color , 2)',
|
||||||
|
'upper(color)',
|
||||||
|
'cast(speed as double)',
|
||||||
|
'cast(ts as bigint)',
|
||||||
|
# 'TO_ISO8601(color)',
|
||||||
|
# 'TO_UNIXTIMESTAMP(ts)',
|
||||||
|
'now()',
|
||||||
|
'timediff(ts,now)',
|
||||||
|
'timezone()',
|
||||||
|
'TIMETRUNCATE(ts,1s)',
|
||||||
|
'TIMEZONE()',
|
||||||
|
'TODAY()',
|
||||||
|
'distinct(color)'
|
||||||
|
]
|
||||||
|
)
|
||||||
ret.append(SqlQuery( # reg table
|
ret.append(SqlQuery( # reg table
|
||||||
"select {} from {}.{}".format('*', self._dbName, rTbName)))
|
"select {} from {}.{}".format(commonExpr, self._dbName, rTbName)))
|
||||||
ret.append(SqlQuery( # super table
|
ret.append(SqlQuery( # super table
|
||||||
"select {} from {}.{}".format('*', self._dbName, self.getName())))
|
"select {} from {}.{}".format(commonExpr, self._dbName, self.getName())))
|
||||||
else: # Aggregate query
|
else: # Aggregate query
|
||||||
aggExpr = Dice.choice([
|
aggExpr = Dice.choice([
|
||||||
'count(*)',
|
'count(*)',
|
||||||
|
@ -1857,17 +2295,34 @@ class TdSuperTable:
|
||||||
'top(speed, 50)', # TODO: not supported?
|
'top(speed, 50)', # TODO: not supported?
|
||||||
'bottom(speed, 50)', # TODO: not supported?
|
'bottom(speed, 50)', # TODO: not supported?
|
||||||
'apercentile(speed, 10)', # TODO: TD-1316
|
'apercentile(speed, 10)', # TODO: TD-1316
|
||||||
# 'last_row(speed)', # TODO: commented out per TD-3231, we should re-create
|
'last_row(*)', # TODO: commented out per TD-3231, we should re-create
|
||||||
# Transformation Functions
|
# Transformation Functions
|
||||||
# 'diff(speed)', # TODO: no supported?!
|
# 'diff(speed)', # TODO: no supported?!
|
||||||
'spread(speed)'
|
'spread(speed)',
|
||||||
|
'elapsed(ts)',
|
||||||
|
'mode(speed)',
|
||||||
|
'bottom(speed,1)',
|
||||||
|
'top(speed,1)',
|
||||||
|
'tail(speed,1)',
|
||||||
|
'unique(color)',
|
||||||
|
'csum(speed)',
|
||||||
|
'DERIVATIVE(speed,1s,1)',
|
||||||
|
'diff(speed,1)',
|
||||||
|
'irate(speed)',
|
||||||
|
'mavg(speed,3)',
|
||||||
|
'sample(speed,5)',
|
||||||
|
'STATECOUNT(speed,"LT",1)',
|
||||||
|
'STATEDURATION(speed,"LT",1)',
|
||||||
|
'twa(speed)'
|
||||||
|
|
||||||
]) # TODO: add more from 'top'
|
]) # TODO: add more from 'top'
|
||||||
|
|
||||||
|
|
||||||
# if aggExpr not in ['stddev(speed)']: # STDDEV not valid for super tables?! (Done in TD-1049)
|
# if aggExpr not in ['stddev(speed)']: # STDDEV not valid for super tables?! (Done in TD-1049)
|
||||||
sql = "select {} from {}.{}".format(aggExpr, self._dbName, self.getName())
|
sql = "select {} from {}.{}".format(aggExpr, self._dbName, self.getName())
|
||||||
if Dice.throw(3) == 0: # 1 in X chance
|
if Dice.throw(3) == 0: # 1 in X chance
|
||||||
sql = sql + ' GROUP BY color'
|
partion_expr = Dice.choice(['color','tbname'])
|
||||||
|
sql = sql + ' partition BY ' + partion_expr + ' order by ' + partion_expr
|
||||||
Progress.emit(Progress.QUERY_GROUP_BY)
|
Progress.emit(Progress.QUERY_GROUP_BY)
|
||||||
# Logging.info("Executing GROUP-BY query: " + sql)
|
# Logging.info("Executing GROUP-BY query: " + sql)
|
||||||
ret.append(SqlQuery(sql))
|
ret.append(SqlQuery(sql))
|
||||||
|
@ -1974,6 +2429,7 @@ class TaskDropSuperTable(StateTransitionTask):
|
||||||
isSuccess = False
|
isSuccess = False
|
||||||
Logging.debug("[DB] Acceptable error when dropping a table")
|
Logging.debug("[DB] Acceptable error when dropping a table")
|
||||||
continue # try to delete next regular table
|
continue # try to delete next regular table
|
||||||
|
|
||||||
|
|
||||||
if (not tickOutput):
|
if (not tickOutput):
|
||||||
tickOutput = True # Print only one time
|
tickOutput = True # Print only one time
|
||||||
|
@ -1985,6 +2441,8 @@ class TaskDropSuperTable(StateTransitionTask):
|
||||||
# Drop the super table itself
|
# Drop the super table itself
|
||||||
tblName = self._db.getFixedSuperTableName()
|
tblName = self._db.getFixedSuperTableName()
|
||||||
self.execWtSql(wt, "drop table {}.{}".format(self._db.getName(), tblName))
|
self.execWtSql(wt, "drop table {}.{}".format(self._db.getName(), tblName))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class TaskAlterTags(StateTransitionTask):
|
class TaskAlterTags(StateTransitionTask):
|
||||||
|
@ -2234,6 +2692,220 @@ class TaskAddData(StateTransitionTask):
|
||||||
|
|
||||||
self.activeTable.discard(i) # not raising an error, unlike remove
|
self.activeTable.discard(i) # not raising an error, unlike remove
|
||||||
|
|
||||||
|
class TaskDeleteData(StateTransitionTask):
|
||||||
|
# Track which table is being actively worked on
|
||||||
|
activeTable: Set[int] = set()
|
||||||
|
|
||||||
|
# We use these two files to record operations to DB, useful for power-off tests
|
||||||
|
fAddLogReady = None # type: Optional[io.TextIOWrapper]
|
||||||
|
fAddLogDone = None # type: Optional[io.TextIOWrapper]
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def prepToRecordOps(cls):
|
||||||
|
if Config.getConfig().record_ops:
|
||||||
|
if (cls.fAddLogReady is None):
|
||||||
|
Logging.info(
|
||||||
|
"Recording in a file operations to be performed...")
|
||||||
|
cls.fAddLogReady = open("add_log_ready.txt", "w")
|
||||||
|
if (cls.fAddLogDone is None):
|
||||||
|
Logging.info("Recording in a file operations completed...")
|
||||||
|
cls.fAddLogDone = open("add_log_done.txt", "w")
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def getEndState(cls):
|
||||||
|
return StateHasData()
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def canBeginFrom(cls, state: AnyState):
|
||||||
|
return state.canDeleteData()
|
||||||
|
|
||||||
|
def _lockTableIfNeeded(self, fullTableName, extraMsg = ''):
|
||||||
|
if Config.getConfig().verify_data:
|
||||||
|
# Logging.info("Locking table: {}".format(fullTableName))
|
||||||
|
self.lockTable(fullTableName)
|
||||||
|
# Logging.info("Table locked {}: {}".format(extraMsg, fullTableName))
|
||||||
|
# print("_w" + str(nextInt % 100), end="", flush=True) # Trace what was written
|
||||||
|
else:
|
||||||
|
# Logging.info("Skipping locking table")
|
||||||
|
pass
|
||||||
|
|
||||||
|
def _unlockTableIfNeeded(self, fullTableName):
|
||||||
|
if Config.getConfig().verify_data:
|
||||||
|
# Logging.info("Unlocking table: {}".format(fullTableName))
|
||||||
|
self.unlockTable(fullTableName)
|
||||||
|
# Logging.info("Table unlocked: {}".format(fullTableName))
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
# Logging.info("Skipping unlocking table")
|
||||||
|
|
||||||
|
def _deleteData(self, db: Database, dbc, regTableName, te: TaskExecutor): # implied: NOT in batches
|
||||||
|
numRecords = self.LARGE_NUMBER_OF_RECORDS if Config.getConfig().larger_data else self.SMALL_NUMBER_OF_RECORDS
|
||||||
|
del_Records = int(numRecords/5)
|
||||||
|
if Dice.throw(2) == 0:
|
||||||
|
for j in range(del_Records): # number of records per table
|
||||||
|
intToWrite = db.getNextInt()
|
||||||
|
nextTick = db.getNextTick()
|
||||||
|
# nextColor = db.getNextColor()
|
||||||
|
if Config.getConfig().record_ops:
|
||||||
|
self.prepToRecordOps()
|
||||||
|
if self.fAddLogReady is None:
|
||||||
|
raise CrashGenError("Unexpected empty fAddLogReady")
|
||||||
|
self.fAddLogReady.write("Ready to delete {} to {}\n".format(intToWrite, regTableName))
|
||||||
|
self.fAddLogReady.flush()
|
||||||
|
os.fsync(self.fAddLogReady.fileno())
|
||||||
|
|
||||||
|
# TODO: too ugly trying to lock the table reliably, refactor...
|
||||||
|
fullTableName = db.getName() + '.' + regTableName
|
||||||
|
self._lockTableIfNeeded(fullTableName) # so that we are verify read-back. TODO: deal with exceptions before unlock
|
||||||
|
|
||||||
|
try:
|
||||||
|
sql = "delete from {} where ts = '{}' ;".format( # removed: tags ('{}', {})
|
||||||
|
fullTableName,
|
||||||
|
# ds.getFixedSuperTableName(),
|
||||||
|
# ds.getNextBinary(), ds.getNextFloat(),
|
||||||
|
nextTick)
|
||||||
|
|
||||||
|
# print(sql)
|
||||||
|
# Logging.info("Adding data: {}".format(sql))
|
||||||
|
dbc.execute(sql)
|
||||||
|
# Logging.info("Data added: {}".format(sql))
|
||||||
|
intWrote = intToWrite
|
||||||
|
|
||||||
|
# Quick hack, attach an update statement here. TODO: create an "update" task
|
||||||
|
if (not Config.getConfig().use_shadow_db) and Dice.throw(5) == 0: # 1 in N chance, plus not using shaddow DB
|
||||||
|
intToUpdate = db.getNextInt() # Updated, but should not succeed
|
||||||
|
# nextColor = db.getNextColor()
|
||||||
|
sql = "delete from {} where ts = '{}' ;".format( # "INSERt" means "update" here
|
||||||
|
fullTableName,
|
||||||
|
nextTick)
|
||||||
|
# sql = "UPDATE {} set speed={}, color='{}' WHERE ts='{}'".format(
|
||||||
|
# fullTableName, db.getNextInt(), db.getNextColor(), nextTick)
|
||||||
|
dbc.execute(sql)
|
||||||
|
intWrote = intToUpdate # We updated, seems TDengine non-cluster accepts this.
|
||||||
|
|
||||||
|
except: # Any exception at all
|
||||||
|
self._unlockTableIfNeeded(fullTableName)
|
||||||
|
raise
|
||||||
|
|
||||||
|
# Now read it back and verify, we might encounter an error if table is dropped
|
||||||
|
if Config.getConfig().verify_data: # only if command line asks for it
|
||||||
|
try:
|
||||||
|
dbc.query("SELECT * from {}.{} WHERE ts='{}'".
|
||||||
|
format(db.getName(), regTableName, nextTick))
|
||||||
|
result = dbc.getQueryResult()
|
||||||
|
if len(result)==0:
|
||||||
|
# means data has been delete
|
||||||
|
print("D1",end="") # DF means delete failed
|
||||||
|
else:
|
||||||
|
print("DF",end="") # DF means delete failed
|
||||||
|
except taos.error.ProgrammingError as err:
|
||||||
|
errno = Helper.convertErrno(err.errno)
|
||||||
|
# if errno == CrashGenError.INVALID_EMPTY_RESULT: # empty result
|
||||||
|
# print("D1",end="") # D1 means delete data success and only 1 record
|
||||||
|
|
||||||
|
if errno in [0x218, 0x362,0x2662]: # table doesn't exist
|
||||||
|
# do nothing
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
# Re-throw otherwise
|
||||||
|
raise
|
||||||
|
finally:
|
||||||
|
self._unlockTableIfNeeded(fullTableName) # Quite ugly, refactor lock/unlock
|
||||||
|
# Done with read-back verification, unlock the table now
|
||||||
|
# Successfully wrote the data into the DB, let's record it somehow
|
||||||
|
te.recordDataMark(intWrote)
|
||||||
|
else:
|
||||||
|
|
||||||
|
# delete all datas and verify datas ,expected table is empty
|
||||||
|
if Config.getConfig().record_ops:
|
||||||
|
self.prepToRecordOps()
|
||||||
|
if self.fAddLogReady is None:
|
||||||
|
raise CrashGenError("Unexpected empty fAddLogReady")
|
||||||
|
self.fAddLogReady.write("Ready to delete {} to {}\n".format(intToWrite, regTableName))
|
||||||
|
self.fAddLogReady.flush()
|
||||||
|
os.fsync(self.fAddLogReady.fileno())
|
||||||
|
|
||||||
|
# TODO: too ugly trying to lock the table reliably, refactor...
|
||||||
|
fullTableName = db.getName() + '.' + regTableName
|
||||||
|
self._lockTableIfNeeded(fullTableName) # so that we are verify read-back. TODO: deal with exceptions before unlock
|
||||||
|
|
||||||
|
try:
|
||||||
|
sql = "delete from {} ;".format( # removed: tags ('{}', {})
|
||||||
|
fullTableName)
|
||||||
|
# Logging.info("Adding data: {}".format(sql))
|
||||||
|
dbc.execute(sql)
|
||||||
|
# Logging.info("Data added: {}".format(sql))
|
||||||
|
|
||||||
|
# Quick hack, attach an update statement here. TODO: create an "update" task
|
||||||
|
if (not Config.getConfig().use_shadow_db) and Dice.throw(5) == 0: # 1 in N chance, plus not using shaddow DB
|
||||||
|
sql = "delete from {} ;".format( # "INSERt" means "update" here
|
||||||
|
fullTableName)
|
||||||
|
dbc.execute(sql)
|
||||||
|
|
||||||
|
except: # Any exception at all
|
||||||
|
self._unlockTableIfNeeded(fullTableName)
|
||||||
|
raise
|
||||||
|
|
||||||
|
# Now read it back and verify, we might encounter an error if table is dropped
|
||||||
|
if Config.getConfig().verify_data: # only if command line asks for it
|
||||||
|
try:
|
||||||
|
dbc.query("SELECT * from {}.{} WHERE ts='{}'".
|
||||||
|
format(db.getName(), regTableName, nextTick))
|
||||||
|
result = dbc.getQueryResult()
|
||||||
|
if len(result)==0:
|
||||||
|
# means data has been delete
|
||||||
|
print("DA",end="")
|
||||||
|
else:
|
||||||
|
print("DF",end="") # DF means delete failed
|
||||||
|
except taos.error.ProgrammingError as err:
|
||||||
|
errno = Helper.convertErrno(err.errno)
|
||||||
|
# if errno == CrashGenError.INVALID_EMPTY_RESULT: # empty result
|
||||||
|
# print("Da",end="") # Da means delete data success and for all datas
|
||||||
|
|
||||||
|
if errno in [0x218, 0x362,0x2662]: # table doesn't exist
|
||||||
|
# do nothing
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
# Re-throw otherwise
|
||||||
|
raise
|
||||||
|
finally:
|
||||||
|
self._unlockTableIfNeeded(fullTableName) # Quite ugly, refactor lock/unlock
|
||||||
|
# Done with read-back verification, unlock the table now
|
||||||
|
|
||||||
|
if Config.getConfig().record_ops:
|
||||||
|
if self.fAddLogDone is None:
|
||||||
|
raise CrashGenError("Unexpected empty fAddLogDone")
|
||||||
|
self.fAddLogDone.write("Wrote {} to {}\n".format(intWrote, regTableName))
|
||||||
|
self.fAddLogDone.flush()
|
||||||
|
os.fsync(self.fAddLogDone.fileno())
|
||||||
|
|
||||||
|
def _executeInternal(self, te: TaskExecutor, wt: WorkerThread):
|
||||||
|
# ds = self._dbManager # Quite DANGEROUS here, may result in multi-thread client access
|
||||||
|
db = self._db
|
||||||
|
dbc = wt.getDbConn()
|
||||||
|
numTables = self.LARGE_NUMBER_OF_TABLES if Config.getConfig().larger_data else self.SMALL_NUMBER_OF_TABLES
|
||||||
|
numRecords = self.LARGE_NUMBER_OF_RECORDS if Config.getConfig().larger_data else self.SMALL_NUMBER_OF_RECORDS
|
||||||
|
tblSeq = list(range(numTables ))
|
||||||
|
random.shuffle(tblSeq) # now we have random sequence
|
||||||
|
for i in tblSeq:
|
||||||
|
if (i in self.activeTable): # wow already active
|
||||||
|
# print("x", end="", flush=True) # concurrent insertion
|
||||||
|
Progress.emit(Progress.CONCURRENT_INSERTION)
|
||||||
|
else:
|
||||||
|
self.activeTable.add(i) # marking it active
|
||||||
|
|
||||||
|
dbName = db.getName()
|
||||||
|
sTable = db.getFixedSuperTable()
|
||||||
|
regTableName = self.getRegTableName(i) # "db.reg_table_{}".format(i)
|
||||||
|
fullTableName = dbName + '.' + regTableName
|
||||||
|
# self._lockTable(fullTableName) # "create table" below. Stop it if the table is "locked"
|
||||||
|
sTable.ensureRegTable(self, wt.getDbConn(), regTableName) # Ensure the table exists
|
||||||
|
# self._unlockTable(fullTableName)
|
||||||
|
|
||||||
|
self._deleteData(db, dbc, regTableName, te)
|
||||||
|
|
||||||
|
self.activeTable.discard(i) # not raising an error, unlike remove
|
||||||
|
|
||||||
|
|
||||||
class ThreadStacks: # stack info for all threads
|
class ThreadStacks: # stack info for all threads
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -2244,6 +2916,9 @@ class ThreadStacks: # stack info for all threads
|
||||||
shortTid = th.native_id % 10000 #type: ignore
|
shortTid = th.native_id % 10000 #type: ignore
|
||||||
self._allStacks[shortTid] = stack # Was using th.native_id
|
self._allStacks[shortTid] = stack # Was using th.native_id
|
||||||
|
|
||||||
|
def record_current_time(self,current_time):
|
||||||
|
self.current_time = current_time
|
||||||
|
|
||||||
def print(self, filteredEndName = None, filterInternal = False):
|
def print(self, filteredEndName = None, filterInternal = False):
|
||||||
for shortTid, stack in self._allStacks.items(): # for each thread, stack frames top to bottom
|
for shortTid, stack in self._allStacks.items(): # for each thread, stack frames top to bottom
|
||||||
lastFrame = stack[-1]
|
lastFrame = stack[-1]
|
||||||
|
@ -2258,8 +2933,11 @@ class ThreadStacks: # stack info for all threads
|
||||||
continue # ignore
|
continue # ignore
|
||||||
# Now print
|
# Now print
|
||||||
print("\n<----- Thread Info for LWP/ID: {} (most recent call last) <-----".format(shortTid))
|
print("\n<----- Thread Info for LWP/ID: {} (most recent call last) <-----".format(shortTid))
|
||||||
|
|
||||||
lastSqlForThread = DbConn.fetchSqlForThread(shortTid)
|
lastSqlForThread = DbConn.fetchSqlForThread(shortTid)
|
||||||
print("Last SQL statement attempted from thread {} is: {}".format(shortTid, lastSqlForThread))
|
last_sql_commit_time = DbConn.get_save_sql_time(shortTid)
|
||||||
|
# time_cost = DbConn.get_time_cost()
|
||||||
|
print("Last SQL statement attempted from thread {} ({:.4f} sec ago) is: {}".format(shortTid, self.current_time-last_sql_commit_time ,lastSqlForThread))
|
||||||
stackFrame = 0
|
stackFrame = 0
|
||||||
for frame in stack: # was using: reversed(stack)
|
for frame in stack: # was using: reversed(stack)
|
||||||
# print(frame)
|
# print(frame)
|
||||||
|
@ -2268,6 +2946,8 @@ class ThreadStacks: # stack info for all threads
|
||||||
print(" {}".format(frame.line))
|
print(" {}".format(frame.line))
|
||||||
stackFrame += 1
|
stackFrame += 1
|
||||||
print("-----> End of Thread Info ----->\n")
|
print("-----> End of Thread Info ----->\n")
|
||||||
|
if self.current_time-last_sql_commit_time >100: # dead lock occured
|
||||||
|
print("maybe dead locked of thread {} ".format(shortTid))
|
||||||
|
|
||||||
class ClientManager:
|
class ClientManager:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -2631,4 +3311,3 @@ class Container():
|
||||||
return
|
return
|
||||||
self._verifyValidProperty(name)
|
self._verifyValidProperty(name)
|
||||||
self._cargo[name] = value
|
self._cargo[name] = value
|
||||||
|
|
||||||
|
|
|
@ -26,10 +26,13 @@ class DbConn:
|
||||||
TYPE_NATIVE = "native-c"
|
TYPE_NATIVE = "native-c"
|
||||||
TYPE_REST = "rest-api"
|
TYPE_REST = "rest-api"
|
||||||
TYPE_INVALID = "invalid"
|
TYPE_INVALID = "invalid"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# class variables
|
# class variables
|
||||||
lastSqlFromThreads : dict[int, str] = {} # stored by thread id, obtained from threading.current_thread().ident%10000
|
lastSqlFromThreads : dict[int, str] = {} # stored by thread id, obtained from threading.current_thread().ident%10000
|
||||||
|
spendThreads : dict[int, float] = {} # stored by thread id, obtained from threading.current_thread().ident%10000
|
||||||
|
current_time : dict[int, float] = {} # save current time
|
||||||
@classmethod
|
@classmethod
|
||||||
def saveSqlForCurrentThread(cls, sql: str):
|
def saveSqlForCurrentThread(cls, sql: str):
|
||||||
'''
|
'''
|
||||||
|
@ -37,15 +40,56 @@ class DbConn:
|
||||||
run into a dead-lock situation, we can pick out the deadlocked thread, and use
|
run into a dead-lock situation, we can pick out the deadlocked thread, and use
|
||||||
that information to find what what SQL statement is stuck.
|
that information to find what what SQL statement is stuck.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
th = threading.current_thread()
|
th = threading.current_thread()
|
||||||
shortTid = th.native_id % 10000 #type: ignore
|
shortTid = th.native_id % 10000 #type: ignore
|
||||||
cls.lastSqlFromThreads[shortTid] = sql # Save this for later
|
cls.lastSqlFromThreads[shortTid] = sql # Save this for later
|
||||||
|
cls.record_save_sql_time()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def fetchSqlForThread(cls, shortTid : int) -> str :
|
def fetchSqlForThread(cls, shortTid : int) -> str :
|
||||||
|
|
||||||
|
print("=======================")
|
||||||
if shortTid not in cls.lastSqlFromThreads:
|
if shortTid not in cls.lastSqlFromThreads:
|
||||||
raise CrashGenError("No last-attempted-SQL found for thread id: {}".format(shortTid))
|
raise CrashGenError("No last-attempted-SQL found for thread id: {}".format(shortTid))
|
||||||
return cls.lastSqlFromThreads[shortTid]
|
return cls.lastSqlFromThreads[shortTid]
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_save_sql_time(cls, shortTid : int):
|
||||||
|
'''
|
||||||
|
Let us save the last SQL statement on a per-thread basis, so that when later we
|
||||||
|
run into a dead-lock situation, we can pick out the deadlocked thread, and use
|
||||||
|
that information to find what what SQL statement is stuck.
|
||||||
|
'''
|
||||||
|
return cls.current_time[shortTid]
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def record_save_sql_time(cls):
|
||||||
|
'''
|
||||||
|
Let us save the last SQL statement on a per-thread basis, so that when later we
|
||||||
|
run into a dead-lock situation, we can pick out the deadlocked thread, and use
|
||||||
|
that information to find what what SQL statement is stuck.
|
||||||
|
'''
|
||||||
|
th = threading.current_thread()
|
||||||
|
shortTid = th.native_id % 10000 #type: ignore
|
||||||
|
cls.current_time[shortTid] = float(time.time()) # Save this for later
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def sql_exec_spend(cls, cost: float):
|
||||||
|
'''
|
||||||
|
Let us save the last SQL statement on a per-thread basis, so that when later we
|
||||||
|
run into a dead-lock situation, we can pick out the deadlocked thread, and use
|
||||||
|
that information to find what what SQL statement is stuck.
|
||||||
|
'''
|
||||||
|
th = threading.current_thread()
|
||||||
|
shortTid = th.native_id % 10000 #type: ignore
|
||||||
|
cls.spendThreads[shortTid] = cost # Save this for later
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_time_cost(cls) ->float:
|
||||||
|
th = threading.current_thread()
|
||||||
|
shortTid = th.native_id % 10000 #type: ignore
|
||||||
|
return cls.spendThreads.get(shortTid)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create(cls, connType, dbTarget):
|
def create(cls, connType, dbTarget):
|
||||||
|
@ -61,6 +105,7 @@ class DbConn:
|
||||||
def createNative(cls, dbTarget) -> DbConn:
|
def createNative(cls, dbTarget) -> DbConn:
|
||||||
return cls.create(cls.TYPE_NATIVE, dbTarget)
|
return cls.create(cls.TYPE_NATIVE, dbTarget)
|
||||||
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def createRest(cls, dbTarget) -> DbConn:
|
def createRest(cls, dbTarget) -> DbConn:
|
||||||
return cls.create(cls.TYPE_REST, dbTarget)
|
return cls.create(cls.TYPE_REST, dbTarget)
|
||||||
|
@ -75,6 +120,7 @@ class DbConn:
|
||||||
return "[DbConn: type={}, target={}]".format(self._type, self._dbTarget)
|
return "[DbConn: type={}, target={}]".format(self._type, self._dbTarget)
|
||||||
|
|
||||||
def getLastSql(self):
|
def getLastSql(self):
|
||||||
|
|
||||||
return self._lastSql
|
return self._lastSql
|
||||||
|
|
||||||
def open(self):
|
def open(self):
|
||||||
|
@ -184,13 +230,19 @@ class DbConnRest(DbConn):
|
||||||
def _doSql(self, sql):
|
def _doSql(self, sql):
|
||||||
self._lastSql = sql # remember this, last SQL attempted
|
self._lastSql = sql # remember this, last SQL attempted
|
||||||
self.saveSqlForCurrentThread(sql) # Save in global structure too. #TODO: combine with above
|
self.saveSqlForCurrentThread(sql) # Save in global structure too. #TODO: combine with above
|
||||||
try:
|
time_cost = -1
|
||||||
|
time_start = time.time()
|
||||||
|
try:
|
||||||
r = requests.post(self._url,
|
r = requests.post(self._url,
|
||||||
data = sql,
|
data = sql,
|
||||||
auth = HTTPBasicAuth('root', 'taosdata'))
|
auth = HTTPBasicAuth('root', 'taosdata'))
|
||||||
except:
|
except:
|
||||||
print("REST API Failure (TODO: more info here)")
|
print("REST API Failure (TODO: more info here)")
|
||||||
|
self.sql_exec_spend(-2)
|
||||||
raise
|
raise
|
||||||
|
finally:
|
||||||
|
time_cost = time.time()- time_start
|
||||||
|
self.sql_exec_spend(time_cost)
|
||||||
rj = r.json()
|
rj = r.json()
|
||||||
# Sanity check for the "Json Result"
|
# Sanity check for the "Json Result"
|
||||||
if ('status' not in rj):
|
if ('status' not in rj):
|
||||||
|
@ -223,6 +275,8 @@ class DbConnRest(DbConn):
|
||||||
"[SQL-REST] Execution Result, nRows = {}, SQL = {}".format(nRows, sql))
|
"[SQL-REST] Execution Result, nRows = {}, SQL = {}".format(nRows, sql))
|
||||||
return nRows
|
return nRows
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def query(self, sql): # return rows affected
|
def query(self, sql): # return rows affected
|
||||||
return self.execute(sql)
|
return self.execute(sql)
|
||||||
|
|
||||||
|
@ -336,6 +390,7 @@ class MyTDSql:
|
||||||
raise
|
raise
|
||||||
return self.affectedRows
|
return self.affectedRows
|
||||||
|
|
||||||
|
|
||||||
class DbTarget:
|
class DbTarget:
|
||||||
def __init__(self, cfgPath, hostAddr, port):
|
def __init__(self, cfgPath, hostAddr, port):
|
||||||
self.cfgPath = cfgPath
|
self.cfgPath = cfgPath
|
||||||
|
@ -355,6 +410,7 @@ class DbConnNative(DbConn):
|
||||||
# _connInfoDisplayed = False # TODO: find another way to display this
|
# _connInfoDisplayed = False # TODO: find another way to display this
|
||||||
totalConnections = 0 # Not private
|
totalConnections = 0 # Not private
|
||||||
totalRequests = 0
|
totalRequests = 0
|
||||||
|
time_cost = -1
|
||||||
|
|
||||||
def __init__(self, dbTarget):
|
def __init__(self, dbTarget):
|
||||||
super().__init__(dbTarget)
|
super().__init__(dbTarget)
|
||||||
|
@ -413,8 +469,18 @@ class DbConnNative(DbConn):
|
||||||
"Cannot exec SQL unless db connection is open", CrashGenError.DB_CONNECTION_NOT_OPEN)
|
"Cannot exec SQL unless db connection is open", CrashGenError.DB_CONNECTION_NOT_OPEN)
|
||||||
Logging.debug("[SQL] Executing SQL: {}".format(sql))
|
Logging.debug("[SQL] Executing SQL: {}".format(sql))
|
||||||
self._lastSql = sql
|
self._lastSql = sql
|
||||||
|
time_cost = -1
|
||||||
|
nRows = 0
|
||||||
|
time_start = time.time()
|
||||||
self.saveSqlForCurrentThread(sql) # Save in global structure too. #TODO: combine with above
|
self.saveSqlForCurrentThread(sql) # Save in global structure too. #TODO: combine with above
|
||||||
nRows = self._tdSql.execute(sql)
|
try:
|
||||||
|
nRows= self._tdSql.execute(sql)
|
||||||
|
except Exception as e:
|
||||||
|
self.sql_exec_spend(-2)
|
||||||
|
finally:
|
||||||
|
time_cost = time.time() - time_start
|
||||||
|
self.sql_exec_spend(time_cost)
|
||||||
|
|
||||||
cls = self.__class__
|
cls = self.__class__
|
||||||
cls.totalRequests += 1
|
cls.totalRequests += 1
|
||||||
Logging.debug(
|
Logging.debug(
|
||||||
|
@ -494,4 +560,3 @@ class DbManager():
|
||||||
self._dbConn.close()
|
self._dbConn.close()
|
||||||
self._dbConn = None
|
self._dbConn = None
|
||||||
Logging.debug("DbManager closed DB connection...")
|
Logging.debug("DbManager closed DB connection...")
|
||||||
|
|
||||||
|
|
|
@ -116,6 +116,7 @@ class TDDnode:
|
||||||
self.deployed = 0
|
self.deployed = 0
|
||||||
self.testCluster = False
|
self.testCluster = False
|
||||||
self.valgrind = 0
|
self.valgrind = 0
|
||||||
|
self.asan = False
|
||||||
self.remoteIP = ""
|
self.remoteIP = ""
|
||||||
self.cfgDict = {
|
self.cfgDict = {
|
||||||
"monitor": "0",
|
"monitor": "0",
|
||||||
|
@ -158,6 +159,15 @@ class TDDnode:
|
||||||
def setValgrind(self, value):
|
def setValgrind(self, value):
|
||||||
self.valgrind = value
|
self.valgrind = value
|
||||||
|
|
||||||
|
def setAsan(self, value):
|
||||||
|
self.asan = value
|
||||||
|
if value:
|
||||||
|
selfPath = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
if ("community" in selfPath):
|
||||||
|
self.execPath = os.path.abspath(self.path + "/community/tests/script/sh/exec.sh")
|
||||||
|
else:
|
||||||
|
self.execPath = os.path.abspath(self.path + "/tests/script/sh/exec.sh")
|
||||||
|
|
||||||
def getDataSize(self):
|
def getDataSize(self):
|
||||||
totalSize = 0
|
totalSize = 0
|
||||||
|
|
||||||
|
@ -383,8 +393,14 @@ class TDDnode:
|
||||||
cmd = "mintty -h never %s -c %s" % (
|
cmd = "mintty -h never %s -c %s" % (
|
||||||
binPath, self.cfgDir)
|
binPath, self.cfgDir)
|
||||||
else:
|
else:
|
||||||
cmd = "nohup %s -c %s > /dev/null 2>&1 & " % (
|
if self.asan:
|
||||||
binPath, self.cfgDir)
|
asanDir = "%s/sim/asan/dnode%d.asan" % (
|
||||||
|
self.path, self.index)
|
||||||
|
cmd = "nohup %s -c %s > /dev/null 2> %s & " % (
|
||||||
|
binPath, self.cfgDir, asanDir)
|
||||||
|
else:
|
||||||
|
cmd = "nohup %s -c %s > /dev/null 2>&1 & " % (
|
||||||
|
binPath, self.cfgDir)
|
||||||
else:
|
else:
|
||||||
valgrindCmdline = "valgrind --log-file=\"%s/../log/valgrind.log\" --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes"%self.cfgDir
|
valgrindCmdline = "valgrind --log-file=\"%s/../log/valgrind.log\" --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes"%self.cfgDir
|
||||||
|
|
||||||
|
@ -444,8 +460,14 @@ class TDDnode:
|
||||||
tdLog.exit("dnode:%d is not deployed" % (self.index))
|
tdLog.exit("dnode:%d is not deployed" % (self.index))
|
||||||
|
|
||||||
if self.valgrind == 0:
|
if self.valgrind == 0:
|
||||||
cmd = "nohup %s -c %s > /dev/null 2>&1 & " % (
|
if self.asan:
|
||||||
binPath, self.cfgDir)
|
asanDir = "%s/sim/asan/dnode%d.asan" % (
|
||||||
|
self.path, self.index)
|
||||||
|
cmd = "nohup %s -c %s > /dev/null 2> %s & " % (
|
||||||
|
binPath, self.cfgDir, asanDir)
|
||||||
|
else:
|
||||||
|
cmd = "nohup %s -c %s > /dev/null 2>&1 & " % (
|
||||||
|
binPath, self.cfgDir)
|
||||||
else:
|
else:
|
||||||
valgrindCmdline = "valgrind --log-file=\"%s/../log/valgrind.log\" --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes"%self.cfgDir
|
valgrindCmdline = "valgrind --log-file=\"%s/../log/valgrind.log\" --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes"%self.cfgDir
|
||||||
|
|
||||||
|
@ -464,6 +486,12 @@ class TDDnode:
|
||||||
tdLog.debug("dnode:%d is running with %s " % (self.index, cmd))
|
tdLog.debug("dnode:%d is running with %s " % (self.index, cmd))
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
|
if self.asan:
|
||||||
|
stopCmd = "%s -s stop -n dnode%d" % (self.execPath, self.index)
|
||||||
|
tdLog.info("execute script: " + stopCmd)
|
||||||
|
os.system(stopCmd)
|
||||||
|
return
|
||||||
|
|
||||||
if (not self.remoteIP == ""):
|
if (not self.remoteIP == ""):
|
||||||
self.remoteExec(self.cfgDict, "tdDnodes.dnodes[%d].running=1\ntdDnodes.dnodes[%d].stop()"%(self.index-1,self.index-1))
|
self.remoteExec(self.cfgDict, "tdDnodes.dnodes[%d].running=1\ntdDnodes.dnodes[%d].stop()"%(self.index-1,self.index-1))
|
||||||
tdLog.info("stop dnode%d"%self.index)
|
tdLog.info("stop dnode%d"%self.index)
|
||||||
|
@ -501,6 +529,12 @@ class TDDnode:
|
||||||
|
|
||||||
|
|
||||||
def stoptaosd(self):
|
def stoptaosd(self):
|
||||||
|
if self.asan:
|
||||||
|
stopCmd = "%s -s stop -n dnode%d" % (self.execPath, self.index)
|
||||||
|
tdLog.info("execute script: " + stopCmd)
|
||||||
|
os.system(stopCmd)
|
||||||
|
return
|
||||||
|
|
||||||
if (not self.remoteIP == ""):
|
if (not self.remoteIP == ""):
|
||||||
self.remoteExec(self.cfgDict, "tdDnodes.dnodes[%d].running=1\ntdDnodes.dnodes[%d].stop()"%(self.index-1,self.index-1))
|
self.remoteExec(self.cfgDict, "tdDnodes.dnodes[%d].running=1\ntdDnodes.dnodes[%d].stop()"%(self.index-1,self.index-1))
|
||||||
tdLog.info("stop dnode%d"%self.index)
|
tdLog.info("stop dnode%d"%self.index)
|
||||||
|
@ -534,6 +568,13 @@ class TDDnode:
|
||||||
tdLog.debug("dnode:%d is stopped by kill -INT" % (self.index))
|
tdLog.debug("dnode:%d is stopped by kill -INT" % (self.index))
|
||||||
|
|
||||||
def forcestop(self):
|
def forcestop(self):
|
||||||
|
if self.asan:
|
||||||
|
stopCmd = "%s -s stop -n dnode%d -x SIGKILL" + \
|
||||||
|
(self.execPath, self.index)
|
||||||
|
tdLog.info("execute script: " + stopCmd)
|
||||||
|
os.system(stopCmd)
|
||||||
|
return
|
||||||
|
|
||||||
if (not self.remoteIP == ""):
|
if (not self.remoteIP == ""):
|
||||||
self.remoteExec(self.cfgDict, "tdDnodes.dnodes[%d].running=1\ntdDnodes.dnodes[%d].forcestop()"%(self.index-1,self.index-1))
|
self.remoteExec(self.cfgDict, "tdDnodes.dnodes[%d].running=1\ntdDnodes.dnodes[%d].forcestop()"%(self.index-1,self.index-1))
|
||||||
return
|
return
|
||||||
|
@ -606,6 +647,7 @@ class TDDnodes:
|
||||||
self.simDeployed = False
|
self.simDeployed = False
|
||||||
self.testCluster = False
|
self.testCluster = False
|
||||||
self.valgrind = 0
|
self.valgrind = 0
|
||||||
|
self.asan = False
|
||||||
self.killValgrind = 1
|
self.killValgrind = 1
|
||||||
|
|
||||||
def init(self, path, remoteIP = ""):
|
def init(self, path, remoteIP = ""):
|
||||||
|
@ -629,6 +671,18 @@ class TDDnodes:
|
||||||
def setValgrind(self, value):
|
def setValgrind(self, value):
|
||||||
self.valgrind = value
|
self.valgrind = value
|
||||||
|
|
||||||
|
def setAsan(self, value):
|
||||||
|
self.asan = value
|
||||||
|
if value:
|
||||||
|
selfPath = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
if ("community" in selfPath):
|
||||||
|
self.stopDnodesPath = os.path.abspath(self.path + "/community/tests/script/sh/stop_dnodes.sh")
|
||||||
|
self.stopDnodesSigintPath = os.path.abspath(self.path + "/community/tests/script/sh/sigint_stop_dnodes.sh")
|
||||||
|
else:
|
||||||
|
self.stopDnodesPath = os.path.abspath(self.path + "/tests/script/sh/stop_dnodes.sh")
|
||||||
|
self.stopDnodesSigintPath = os.path.abspath(self.path + "/tests/script/sh/sigint_stop_dnodes.sh")
|
||||||
|
tdLog.info("run in address sanitizer mode")
|
||||||
|
|
||||||
def setKillValgrind(self, value):
|
def setKillValgrind(self, value):
|
||||||
self.killValgrind = value
|
self.killValgrind = value
|
||||||
|
|
||||||
|
@ -642,6 +696,7 @@ class TDDnodes:
|
||||||
self.check(index)
|
self.check(index)
|
||||||
self.dnodes[index - 1].setTestCluster(self.testCluster)
|
self.dnodes[index - 1].setTestCluster(self.testCluster)
|
||||||
self.dnodes[index - 1].setValgrind(self.valgrind)
|
self.dnodes[index - 1].setValgrind(self.valgrind)
|
||||||
|
self.dnodes[index - 1].setAsan(self.asan)
|
||||||
self.dnodes[index - 1].deploy(updatecfgDict)
|
self.dnodes[index - 1].deploy(updatecfgDict)
|
||||||
|
|
||||||
def cfg(self, index, option, value):
|
def cfg(self, index, option, value):
|
||||||
|
@ -692,8 +747,22 @@ class TDDnodes:
|
||||||
if index < 1 or index > 10:
|
if index < 1 or index > 10:
|
||||||
tdLog.exit("index:%d should on a scale of [1, 10]" % (index))
|
tdLog.exit("index:%d should on a scale of [1, 10]" % (index))
|
||||||
|
|
||||||
|
def StopAllSigint(self):
|
||||||
|
tdLog.info("stop all dnodes sigint")
|
||||||
|
if self.asan:
|
||||||
|
tdLog.info("execute script: %s" % self.stopDnodesSigintPath)
|
||||||
|
os.system(self.stopDnodesSigintPath)
|
||||||
|
tdLog.info("execute finished")
|
||||||
|
return
|
||||||
|
|
||||||
def stopAll(self):
|
def stopAll(self):
|
||||||
tdLog.info("stop all dnodes")
|
tdLog.info("stop all dnodes")
|
||||||
|
if self.asan:
|
||||||
|
tdLog.info("execute script: %s" % self.stopDnodesPath)
|
||||||
|
os.system(self.stopDnodesPath)
|
||||||
|
tdLog.info("execute finished")
|
||||||
|
return
|
||||||
|
|
||||||
if (not self.dnodes[0].remoteIP == ""):
|
if (not self.dnodes[0].remoteIP == ""):
|
||||||
self.dnodes[0].remoteExec(self.dnodes[0].cfgDict, "for i in range(len(tdDnodes.dnodes)):\n tdDnodes.dnodes[i].running=1\ntdDnodes.stopAll()")
|
self.dnodes[0].remoteExec(self.dnodes[0].cfgDict, "for i in range(len(tdDnodes.dnodes)):\n tdDnodes.dnodes[i].running=1\ntdDnodes.stopAll()")
|
||||||
return
|
return
|
||||||
|
|
|
@ -36,10 +36,10 @@ class TDLog:
|
||||||
printf("\033[1;32m%s %s\033[0m" % (datetime.datetime.now(), info))
|
printf("\033[1;32m%s %s\033[0m" % (datetime.datetime.now(), info))
|
||||||
|
|
||||||
def notice(self, err):
|
def notice(self, err):
|
||||||
printf("\033[1;33m%s %s\033[0m" % (datetime.datetime.now(), err))
|
print("\033[1;33m%s %s\033[0m" % (datetime.datetime.now(), err))
|
||||||
|
|
||||||
def exit(self, err):
|
def exit(self, err):
|
||||||
printf("\033[1;31m%s %s\033[0m" % (datetime.datetime.now(), err))
|
print("\033[1;31m%s %s\033[0m" % (datetime.datetime.now(), err))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
def printNoPrefix(self, info):
|
def printNoPrefix(self, info):
|
||||||
|
|
|
@ -73,8 +73,15 @@ class TDSql:
|
||||||
expectErrNotOccured = True
|
expectErrNotOccured = True
|
||||||
try:
|
try:
|
||||||
self.cursor.execute(sql)
|
self.cursor.execute(sql)
|
||||||
except BaseException:
|
except BaseException as e:
|
||||||
expectErrNotOccured = False
|
expectErrNotOccured = False
|
||||||
|
caller = inspect.getframeinfo(inspect.stack()[1][0])
|
||||||
|
self.error_info = repr(e)
|
||||||
|
# print(error_info)
|
||||||
|
# self.error_info = error_info[error_info.index('(')+1:-1].split(",")[0].replace("'","")
|
||||||
|
# self.error_info = (','.join(error_info.split(",")[:-1]).split("(",1)[1:][0]).replace("'","")
|
||||||
|
# print("!!!!!!!!!!!!!!",self.error_info)
|
||||||
|
|
||||||
if expectErrNotOccured:
|
if expectErrNotOccured:
|
||||||
caller = inspect.getframeinfo(inspect.stack()[1][0])
|
caller = inspect.getframeinfo(inspect.stack()[1][0])
|
||||||
tdLog.exit("%s(%d) failed: sql:%s, expect error not occured" % (caller.filename, caller.lineno, sql))
|
tdLog.exit("%s(%d) failed: sql:%s, expect error not occured" % (caller.filename, caller.lineno, sql))
|
||||||
|
@ -83,6 +90,8 @@ class TDSql:
|
||||||
self.queryCols = 0
|
self.queryCols = 0
|
||||||
self.queryResult = None
|
self.queryResult = None
|
||||||
tdLog.info("sql:%s, expect error occured" % (sql))
|
tdLog.info("sql:%s, expect error occured" % (sql))
|
||||||
|
return self.error_info
|
||||||
|
|
||||||
|
|
||||||
def query(self, sql, row_tag=None,queryTimes=10):
|
def query(self, sql, row_tag=None,queryTimes=10):
|
||||||
self.sql = sql
|
self.sql = sql
|
||||||
|
|
|
@ -10,7 +10,8 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
today=`date +"%Y%m%d"`
|
today=`date +"%Y%m%d"`
|
||||||
TDENGINE_DIR=/root/pxiao/TDengine
|
TDENGINE_DIR=/root/TDengine
|
||||||
|
JDBC_DIR=/root/taos-connector-jdbc
|
||||||
TDENGINE_COVERAGE_REPORT=$TDENGINE_DIR/tests/coverage-report-$today.log
|
TDENGINE_COVERAGE_REPORT=$TDENGINE_DIR/tests/coverage-report-$today.log
|
||||||
|
|
||||||
# Color setting
|
# Color setting
|
||||||
|
@ -20,7 +21,7 @@ GREEN_DARK='\033[0;32m'
|
||||||
GREEN_UNDERLINE='\033[4;32m'
|
GREEN_UNDERLINE='\033[4;32m'
|
||||||
NC='\033[0m'
|
NC='\033[0m'
|
||||||
|
|
||||||
function buildTDengine {
|
function buildTDengine() {
|
||||||
echo "check if TDengine need build"
|
echo "check if TDengine need build"
|
||||||
cd $TDENGINE_DIR
|
cd $TDENGINE_DIR
|
||||||
git remote prune origin > /dev/null
|
git remote prune origin > /dev/null
|
||||||
|
@ -33,159 +34,145 @@ function buildTDengine {
|
||||||
# reset counter
|
# reset counter
|
||||||
lcov -d . --zerocounters
|
lcov -d . --zerocounters
|
||||||
|
|
||||||
|
|
||||||
if [ "$LOCAL_COMMIT" == "$REMOTE_COMMIT" ]; then
|
if [ "$LOCAL_COMMIT" == "$REMOTE_COMMIT" ]; then
|
||||||
echo "repo up-to-date"
|
echo "repo up-to-date"
|
||||||
else
|
else
|
||||||
echo "repo need to pull"
|
echo "repo need to pull"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
git reset --hard
|
git reset --hard
|
||||||
git checkout -- .
|
git checkout -- .
|
||||||
git checkout $branch
|
git checkout $branch
|
||||||
|
git checkout -- .
|
||||||
git clean -dfx
|
git clean -dfx
|
||||||
git pull
|
git pull
|
||||||
git submodule update --init --recursive -f
|
|
||||||
|
|
||||||
[ -d $TDENGINE_DIR/debug ] || mkdir $TDENGINE_DIR/debug
|
[ -d $TDENGINE_DIR/debug ] || mkdir $TDENGINE_DIR/debug
|
||||||
cd $TDENGINE_DIR/debug
|
cd $TDENGINE_DIR/debug
|
||||||
|
|
||||||
echo "rebuild.."
|
echo "rebuild.."
|
||||||
LOCAL_COMMIT=`git rev-parse --short @`
|
LOCAL_COMMIT=`git rev-parse --short @`
|
||||||
|
|
||||||
rm -rf *
|
rm -rf *
|
||||||
if [ "$branch" == "3.0" ]; then
|
if [ "$branch" == "3.0" ]; then
|
||||||
echo "3.0 ============="
|
echo "3.0 ============="
|
||||||
cmake -DCOVER=true -DBUILD_TEST=true ..
|
cmake -DCOVER=true -DBUILD_TEST=true -DBUILD_HTTP=false -DBUILD_TOOLS=true ..
|
||||||
else
|
else
|
||||||
cmake -DCOVER=true -DBUILD_TOOLS=true -DBUILD_HTTP=false .. > /dev/null
|
cmake -DCOVER=true -DBUILD_TOOLS=true -DBUILD_HTTP=false .. > /dev/null
|
||||||
fi
|
fi
|
||||||
make -j4
|
make -j
|
||||||
make install
|
make install
|
||||||
}
|
}
|
||||||
|
|
||||||
function runGeneralCaseOneByOne {
|
function runCasesOneByOne () {
|
||||||
while read -r line; do
|
while read -r line; do
|
||||||
if [[ $line =~ ^./test.sh* ]]; then
|
cmd=`echo $line | cut -d',' -f 5`
|
||||||
case=`echo $line | grep sim$ | awk '{print $NF}'`
|
if [[ "$2" == "sim" ]] && [[ $cmd == *"test.sh"* ]]; then
|
||||||
|
case=`echo $cmd | cut -d' ' -f 3`
|
||||||
if [ -n "$case" ]; then
|
start_time=`date +%s`
|
||||||
date +%F\ %T | tee -a $TDENGINE_COVERAGE_REPORT && ./test.sh -f $case > /dev/null 2>&1 && \
|
date +%F\ %T | tee -a $TDENGINE_COVERAGE_REPORT && $cmd > /dev/null 2>&1 && \
|
||||||
echo -e "${GREEN}$case success${NC}" | tee -a $TDENGINE_COVERAGE_REPORT \
|
echo -e "${GREEN}$case success${NC}" | tee -a $TDENGINE_COVERAGE_REPORT \
|
||||||
|| echo -e "${RED}$case failed${NC}" | tee -a $TDENGINE_COVERAGE_REPORT
|
|| echo -e "${RED}$case failed${NC}" | tee -a $TDENGINE_COVERAGE_REPORT
|
||||||
fi
|
end_time=`date +%s`
|
||||||
|
echo execution time of $case was `expr $end_time - $start_time`s. | tee -a $TDENGINE_COVERAGE_REPORT
|
||||||
|
elif [[ "$2" == "system-test" ]] && [[ $line == *"system-test"* ]]; then
|
||||||
|
case=`echo $cmd | cut -d' ' -f 4`
|
||||||
|
start_time=`date +%s`
|
||||||
|
date +%F\ %T | tee -a $TDENGINE_COVERAGE_REPORT && $cmd > /dev/null 2>&1 && \
|
||||||
|
echo -e "${GREEN}$case success${NC}" | tee -a $TDENGINE_COVERAGE_REPORT || \
|
||||||
|
echo -e "${RED}$case failed${NC}" | tee -a $TDENGINE_COVERAGE_REPORT
|
||||||
|
end_time=`date +%s`
|
||||||
|
echo execution time of $case was `expr $end_time - $start_time`s. | tee -a $TDENGINE_COVERAGE_REPORT
|
||||||
|
elif [[ "$2" == "develop-test" ]] && [[ $line == *"develop-test"* ]]; then
|
||||||
|
case=`echo $cmd | cut -d' ' -f 4`
|
||||||
|
start_time=`date +%s`
|
||||||
|
date +%F\ %T | tee -a $TDENGINE_COVERAGE_REPORT && $cmd > /dev/null 2>&1 && \
|
||||||
|
echo -e "${GREEN}$case success${NC}" | tee -a $TDENGINE_COVERAGE_REPORT || \
|
||||||
|
echo -e "${RED}$case failed${NC}" | tee -a $TDENGINE_COVERAGE_REPORT
|
||||||
|
end_time=`date +%s`
|
||||||
|
echo execution time of $case was `expr $end_time - $start_time`s. | tee -a $TDENGINE_COVERAGE_REPORT
|
||||||
fi
|
fi
|
||||||
done < $1
|
done < $1
|
||||||
}
|
}
|
||||||
|
|
||||||
function runTestNGCaseOneByOne {
|
function runUnitTest() {
|
||||||
while read -r line; do
|
echo "=== Run unit test case ==="
|
||||||
if [[ $line =~ ^taostest* ]]; then
|
echo " $TDENGINE_DIR/debug"
|
||||||
case=`echo $line | cut -d' ' -f 3 | cut -d'=' -f 2`
|
cd $TDENGINE_DIR/debug
|
||||||
yaml=`echo $line | cut -d' ' -f 2`
|
ctest -j12
|
||||||
|
echo "3.0 unit test done"
|
||||||
if [ -n "$case" ]; then
|
|
||||||
date +%F\ %T | tee -a $TDENGINE_COVERAGE_REPORT && taostest $yaml --case=$case --keep --disable_collection > /dev/null 2>&1 && \
|
|
||||||
echo -e "${GREEN}$case success${NC}" | tee -a $TDENGINE_COVERAGE_REPORT \
|
|
||||||
|| echo -e "${RED}$case failed${NC}" | tee -a $TDENGINE_COVERAGE_REPORT
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done < $1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function runTest {
|
function runSimCases() {
|
||||||
echo "run Test"
|
echo "=== Run sim cases ==="
|
||||||
|
|
||||||
if [ "$branch" == "3.0" ]; then
|
|
||||||
echo "start run unit test case ................"
|
|
||||||
echo " $TDENGINE_DIR/debug "
|
|
||||||
cd $TDENGINE_DIR/debug
|
|
||||||
ctest -j12
|
|
||||||
echo "3.0 unit test done"
|
|
||||||
fi
|
|
||||||
|
|
||||||
cd $TDENGINE_DIR/tests/script
|
cd $TDENGINE_DIR/tests/script
|
||||||
|
runCasesOneByOne ../parallel_test/cases.task sim
|
||||||
[ -d ../../sim ] && rm -rf ../../sim
|
|
||||||
[ -f $TDENGINE_COVERAGE_REPORT ] && rm $TDENGINE_COVERAGE_REPORT
|
totalSuccess=`grep 'sim success' $TDENGINE_COVERAGE_REPORT | wc -l`
|
||||||
|
|
||||||
runGeneralCaseOneByOne jenkins/basic.txt
|
|
||||||
|
|
||||||
sed -i "1i\SIM cases test result" $TDENGINE_COVERAGE_REPORT
|
|
||||||
|
|
||||||
totalSuccess=`grep 'success' $TDENGINE_COVERAGE_REPORT | wc -l`
|
|
||||||
if [ "$totalSuccess" -gt "0" ]; then
|
if [ "$totalSuccess" -gt "0" ]; then
|
||||||
sed -i -e "2i\ ### Total $totalSuccess SIM test case(s) succeed! ###" $TDENGINE_COVERAGE_REPORT
|
echo "### Total $totalSuccess SIM test case(s) succeed! ###" | tee -a $TDENGINE_COVERAGE_REPORT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
totalFailed=`grep 'failed\|fault' $TDENGINE_COVERAGE_REPORT | wc -l`
|
totalFailed=`grep 'sim failed\|fault' $TDENGINE_COVERAGE_REPORT | wc -l`
|
||||||
if [ "$totalFailed" -ne "0" ]; then
|
if [ "$totalFailed" -ne "0" ]; then
|
||||||
sed -i "3i\### Total $totalFailed SIM test case(s) failed! ###" $TDENGINE_COVERAGE_REPORT
|
echo "### Total $totalFailed SIM test case(s) failed! ###" | tee -a $TDENGINE_COVERAGE_REPORT
|
||||||
fi
|
fi
|
||||||
sed "3G" $TDENGINE_COVERAGE_REPORT
|
}
|
||||||
|
|
||||||
stopTaosd
|
function runPythonCases() {
|
||||||
echo "run TestNG cases"
|
echo "=== Run python cases ==="
|
||||||
rm -rf /var/lib/taos/*
|
|
||||||
rm -rf /var/log/taos/*
|
cd $TDENGINE_DIR/tests/system-test
|
||||||
nohup $TDENGINE_DIR/debug/build/bin/taosd -c /etc/taos > /dev/null 2>&1 &
|
runCasesOneByOne ../parallel_test/cases.task system-test
|
||||||
sleep 10
|
|
||||||
cd $TDENGINE_DIR/../TestNG/cases
|
|
||||||
runTestNGCaseOneByOne ../scripts/cases.txt
|
|
||||||
echo "TestNG cases done"
|
|
||||||
|
|
||||||
cd $TDENGINE_DIR/tests
|
cd $TDENGINE_DIR/tests/develop-test
|
||||||
rm -rf ../sim
|
runCasesOneByOne ../parallel_test/cases.task develop-test
|
||||||
/root/pxiao/test-all-coverage.sh full python $branch | tee -a $TDENGINE_COVERAGE_REPORT
|
|
||||||
|
|
||||||
|
|
||||||
sed -i "4i\Python cases test result" $TDENGINE_COVERAGE_REPORT
|
|
||||||
totalPySuccess=`grep 'python case(s) succeed!' $TDENGINE_COVERAGE_REPORT | awk '{print $4}'`
|
|
||||||
if [ "$totalPySuccess" -gt "0" ]; then
|
|
||||||
sed -i -e "5i\ ### Total $totalPySuccess Python test case(s) succeed! ###" $TDENGINE_COVERAGE_REPORT
|
|
||||||
fi
|
|
||||||
|
|
||||||
totalPyFailed=`grep 'python case(s) failed!' $TDENGINE_COVERAGE_REPORT | awk '{print $4}'`
|
totalSuccess=`grep 'py success' $TDENGINE_COVERAGE_REPORT | wc -l`
|
||||||
if [ -z $totalPyFailed ]; then
|
if [ "$totalSuccess" -gt "0" ]; then
|
||||||
sed -i "6i\\n" $TDENGINE_COVERAGE_REPORT
|
echo "### Total $totalSuccess python test case(s) succeed! ###" | tee -a $TDENGINE_COVERAGE_REPORT
|
||||||
else
|
|
||||||
sed -i "6i\### Total $totalPyFailed Python test case(s) failed! ###" $TDENGINE_COVERAGE_REPORT
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "### run JDBC test cases ###" | tee -a $TDENGINE_COVERAGE_REPORT
|
|
||||||
# Test Connector
|
|
||||||
stopTaosd
|
|
||||||
nohup $TDENGINE_DIR/debug/build/bin/taosd -c /etc/taos > /dev/null 2>&1 &
|
|
||||||
sleep 10
|
|
||||||
|
|
||||||
cd $TDENGINE_DIR/src/connector/jdbc
|
|
||||||
mvn clean package > /dev/null 2>&1
|
|
||||||
mvn test > jdbc-out.log 2>&1
|
|
||||||
tail -n 20 jdbc-out.log 2>&1 | tee -a $TDENGINE_COVERAGE_REPORT
|
|
||||||
|
|
||||||
# Test C Demo
|
|
||||||
stopTaosd
|
|
||||||
$TDENGINE_DIR/debug/build/bin/taosd -c $TDENGINE_DIR/debug/test/cfg > /dev/null &
|
|
||||||
sleep 10
|
|
||||||
yes | $TDENGINE_DIR/debug/build/bin/demo 127.0.0.1 > /dev/null 2>&1 | tee -a $TDENGINE_COVERAGE_REPORT
|
|
||||||
|
|
||||||
# Test waltest
|
|
||||||
dataDir=`grep dataDir $TDENGINE_DIR/debug/test/cfg/taos.cfg|awk '{print $2}'`
|
|
||||||
walDir=`find $dataDir -name "wal"|head -n1`
|
|
||||||
echo "dataDir: $dataDir" | tee -a $TDENGINE_COVERAGE_REPORT
|
|
||||||
echo "walDir: $walDir" | tee -a $TDENGINE_COVERAGE_REPORT
|
|
||||||
if [ -n "$walDir" ]; then
|
|
||||||
yes | $TDENGINE_DIR/debug/build/bin/waltest -p $walDir > /dev/null 2>&1 | tee -a $TDENGINE_COVERAGE_REPORT
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# run Unit Test
|
totalFailed=`grep 'py failed\|fault' $TDENGINE_COVERAGE_REPORT | wc -l`
|
||||||
echo "Run Unit Test: utilTest, queryTest and cliTest"
|
if [ "$totalFailed" -ne "0" ]; then
|
||||||
#$TDENGINE_DIR/debug/build/bin/utilTest > /dev/null 2>&1 && echo "utilTest pass!" || echo "utilTest failed!"
|
echo "### Total $totalFailed python test case(s) failed! ###" | tee -a $TDENGINE_COVERAGE_REPORT
|
||||||
#$TDENGINE_DIR/debug/build/bin/queryTest > /dev/null 2>&1 && echo "queryTest pass!" || echo "queryTest failed!"
|
fi
|
||||||
#$TDENGINE_DIR/debug/build/bin/cliTest > /dev/null 2>&1 && echo "cliTest pass!" || echo "cliTest failed!"
|
}
|
||||||
|
|
||||||
|
function runJDBCCases() {
|
||||||
|
echo "=== Run JDBC cases ==="
|
||||||
|
|
||||||
|
cd $JDBC_DIR
|
||||||
|
git checkout -- .
|
||||||
|
git reset --hard HEAD
|
||||||
|
git checkout main
|
||||||
|
git pull
|
||||||
|
|
||||||
stopTaosd
|
stopTaosd
|
||||||
|
stopTaosadapter
|
||||||
|
|
||||||
|
taosd -c /etc/taos >> /dev/null 2>&1 &
|
||||||
|
taosadapter >> /dev/null 2>&1 &
|
||||||
|
|
||||||
|
mvn clean test > result.txt 2>&1
|
||||||
|
summary=`grep "Tests run:" result.txt | tail -n 1`
|
||||||
|
echo -e "### JDBC test result: $summary ###" | tee -a $TDENGINE_COVERAGE_REPORT
|
||||||
|
}
|
||||||
|
|
||||||
|
function runTest() {
|
||||||
|
echo "run Test"
|
||||||
|
|
||||||
|
cd $TDENGINE_DIR
|
||||||
|
[ -d sim ] && rm -rf sim
|
||||||
|
[ -f $TDENGINE_COVERAGE_REPORT ] && rm $TDENGINE_COVERAGE_REPORT
|
||||||
|
|
||||||
|
runUnitTest
|
||||||
|
runSimCases
|
||||||
|
runPythonCases
|
||||||
|
runJDBCCases
|
||||||
|
|
||||||
|
stopTaosd
|
||||||
cd $TDENGINE_DIR/tests/script
|
cd $TDENGINE_DIR/tests/script
|
||||||
find . -name '*.sql' | xargs rm -f
|
find . -name '*.sql' | xargs rm -f
|
||||||
|
|
||||||
|
@ -203,15 +190,18 @@ function lcovFunc {
|
||||||
# remove exclude paths
|
# remove exclude paths
|
||||||
if [ "$branch" == "3.0" ]; then
|
if [ "$branch" == "3.0" ]; then
|
||||||
lcov --remove coverage.info \
|
lcov --remove coverage.info \
|
||||||
'*/contrib/*' '*/tests/*' '*/test/*'\
|
'*/contrib/*' '*/tests/*' '*/test/*' '*/tools/*' '*/libs/sync/*'\
|
||||||
'*/AccessBridgeCalls.c' '*/ttszip.c' '*/dataInserter.c' '*/tlinearhash.c' '*/tsimplehash.c'\
|
'*/AccessBridgeCalls.c' '*/ttszip.c' '*/dataInserter.c' '*/tlinearhash.c' '*/tsimplehash.c' '*/tsdbDiskData.c'\
|
||||||
'*/texpr.c' '*/runUdf.c' '*/schDbg.c' '*/syncIO.c' '*/tdbOs.c' '*/pushServer.c' '*/osLz4.c'\
|
'*/texpr.c' '*/runUdf.c' '*/schDbg.c' '*/syncIO.c' '*/tdbOs.c' '*/pushServer.c' '*/osLz4.c'\
|
||||||
'*/tbase64.c' '*/tbuffer.c' '*/tdes.c' '*/texception.c' '*/tidpool.c' '*/tmempool.c'\
|
'*/tbase64.c' '*/tbuffer.c' '*/tdes.c' '*/texception.c' '*/tidpool.c' '*/tmempool.c'\
|
||||||
'*/tthread.c' '*/tversion.c'\
|
'*/clientJniConnector.c' '*/clientTmqConnector.c' '*/version.c' '*/shellAuto.c' '*/shellTire.c'\
|
||||||
|
'*/tthread.c' '*/tversion.c' '*/ctgDbg.c' '*/schDbg.c' '*/qwDbg.c' '*/tencode.h' '*/catalog.c'\
|
||||||
|
'*/tqSnapshot.c' '*/tsdbSnapshot.c''*/metaSnapshot.c' '*/smaSnapshot.c' '*/tqOffsetSnapshot.c'\
|
||||||
|
'*/vnodeSnapshot.c' '*/metaSnapshot.c' '*/tsdbSnapshot.c' '*/mndGrant.c' '*/mndSnode.c' '*/streamRecover.c'\
|
||||||
--rc lcov_branch_coverage=1 -o coverage.info
|
--rc lcov_branch_coverage=1 -o coverage.info
|
||||||
else
|
else
|
||||||
lcov --remove coverage.info \
|
lcov --remove coverage.info \
|
||||||
'*/tests/*' '*/test/*' '*/deps/*' '*/plugins/*' '*/taosdef.h' '*/ttype.h' '*/tarithoperator.c' '*/TSDBJNIConnector.c' '*/taosdemo.c'\
|
'*/tests/*' '*/test/*' '*/deps/*' '*/plugins/*' '*/taosdef.h' '*/ttype.h' '*/tarithoperator.c' '*/TSDBJNIConnector.c' '*/taosdemo.c' '*/clientJniConnector.c'\
|
||||||
--rc lcov_branch_coverage=1 -o coverage.info
|
--rc lcov_branch_coverage=1 -o coverage.info
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -257,35 +247,33 @@ function stopTaosd {
|
||||||
echo "Stop tasod end"
|
echo "Stop tasod end"
|
||||||
}
|
}
|
||||||
|
|
||||||
function runTestRandomFail {
|
function stopTaosadapter {
|
||||||
exec_random_fail_sh=$1
|
echo "Stop taosadapter"
|
||||||
default_exec_sh=$TDENGINE_DIR/tests/script/sh/exec.sh
|
systemctl stop taosadapter.service
|
||||||
[ -f $exec_random_fail_sh ] && cp $exec_random_fail_sh $default_exec_sh || exit 1
|
PID=`ps -ef|grep -w taosadapter | grep -v grep | awk '{print $2}'`
|
||||||
|
while [ -n "$PID" ]
|
||||||
|
do
|
||||||
|
pkill -TERM -x taosadapter
|
||||||
|
sleep 1
|
||||||
|
PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'`
|
||||||
|
done
|
||||||
|
echo "Stop tasoadapter end"
|
||||||
|
|
||||||
dnodes_random_fail_py=$TDENGINE_DIR/tests/pytest/util/dnodes-no-random-fail.py
|
|
||||||
default_dnodes_py=$TDENGINE_DIR/tests/pytest/util/dnodes.py
|
|
||||||
[ -f $dnodes_random_fail_py ] && cp $dnodes_random_fail_py $default_dnodes_py || exit 1
|
|
||||||
|
|
||||||
runTest NoRandomFail
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WORK_DIR=/root/pxiao
|
WORK_DIR=/root/
|
||||||
|
|
||||||
date >> $WORK_DIR/cron.log
|
date >> $WORK_DIR/cron.log
|
||||||
echo "Run Coverage Test" | tee -a $WORK_DIR/cron.log
|
echo "Run Coverage Test" | tee -a $WORK_DIR/cron.log
|
||||||
|
|
||||||
stopTaosd
|
stopTaosd
|
||||||
|
|
||||||
buildTDengine
|
buildTDengine
|
||||||
|
|
||||||
#runTestRandomFail $TDENGINE_DIR/tests/script/sh/exec-random-fail.sh
|
|
||||||
#runTestRandomFail $TDENGINE_DIR/tests/script/sh/exec-default.sh
|
|
||||||
#runTestRandomFail $TDENGINE_DIR/tests/script/sh/exec-no-random-fail.sh
|
|
||||||
|
|
||||||
runTest
|
runTest
|
||||||
|
|
||||||
lcovFunc
|
lcovFunc
|
||||||
#sendReport
|
|
||||||
|
sendReport
|
||||||
stopTaosd
|
stopTaosd
|
||||||
|
|
||||||
date >> $WORK_DIR/cron.log
|
date >> $WORK_DIR/cron.log
|
||||||
echo "End of Coverage Test" | tee -a $WORK_DIR/cron.log
|
echo "End of Coverage Test" | tee -a $WORK_DIR/cron.log
|
|
@ -3,6 +3,7 @@
|
||||||
set +e
|
set +e
|
||||||
#set -x
|
#set -x
|
||||||
|
|
||||||
|
unset LD_PRELOAD
|
||||||
SCRIPT_DIR=`dirname $0`
|
SCRIPT_DIR=`dirname $0`
|
||||||
cd $SCRIPT_DIR/../
|
cd $SCRIPT_DIR/../
|
||||||
SCRIPT_DIR=`pwd`
|
SCRIPT_DIR=`pwd`
|
||||||
|
@ -15,25 +16,30 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
TAOS_DIR=`pwd`
|
TAOS_DIR=`pwd`
|
||||||
LOG_DIR=$TAOS_DIR/sim/tsim/asan
|
LOG_DIR=$TAOS_DIR/sim/asan
|
||||||
|
|
||||||
error_num=`cat ${LOG_DIR}/*.asan | grep "ERROR" | wc -l`
|
error_num=`cat ${LOG_DIR}/*.asan | grep "ERROR" | wc -l`
|
||||||
memory_leak=`cat ${LOG_DIR}/*.asan | grep "Direct leak" | wc -l`
|
memory_leak=`cat ${LOG_DIR}/*.asan | grep "Direct leak" | wc -l`
|
||||||
indirect_leak=`cat ${LOG_DIR}/*.asan | grep "Indirect leak" | wc -l`
|
indirect_leak=`cat ${LOG_DIR}/*.asan | grep "Indirect leak" | wc -l`
|
||||||
runtime_error=`cat ${LOG_DIR}/*.asan | grep "runtime error" | grep -v "trees.c:873" | wc -l`
|
runtime_error=`cat ${LOG_DIR}/*.asan | grep "runtime error" | grep -v "trees.c:873" | wc -l`
|
||||||
|
python_error=`cat ${LOG_DIR}/*.info | grep -w "stack" | wc -l`
|
||||||
|
|
||||||
echo -e "\033[44;32;1m"asan error_num: $error_num"\033[0m"
|
echo -e "\033[44;32;1m"asan error_num: $error_num"\033[0m"
|
||||||
echo -e "\033[44;32;1m"asan memory_leak: $memory_leak"\033[0m"
|
echo -e "\033[44;32;1m"asan memory_leak: $memory_leak"\033[0m"
|
||||||
echo -e "\033[44;32;1m"asan indirect_leak: $indirect_leak"\033[0m"
|
echo -e "\033[44;32;1m"asan indirect_leak: $indirect_leak"\033[0m"
|
||||||
echo -e "\033[44;32;1m"asan runtime error: $runtime_error"\033[0m"
|
echo -e "\033[44;32;1m"asan runtime error: $runtime_error"\033[0m"
|
||||||
|
echo -e "\033[44;32;1m"asan python error: $python_error"\033[0m"
|
||||||
|
|
||||||
let "errors=$error_num+$memory_leak+$indirect_leak+$runtime_error"
|
let "errors=$error_num+$memory_leak+$indirect_leak+$runtime_error+$python_error"
|
||||||
|
|
||||||
if [ $errors -eq 0 ]; then
|
if [ $errors -eq 0 ]; then
|
||||||
echo -e "\033[44;32;1m"no asan errors"\033[0m"
|
echo -e "\033[44;32;1m"no asan errors"\033[0m"
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
echo -e "\033[44;31;1m"asan total errors: $errors"\033[0m"
|
echo -e "\033[44;31;1m"asan total errors: $errors"\033[0m"
|
||||||
|
if [ $python_error -ne 0 ]; then
|
||||||
|
cat ${LOG_DIR}/*.info
|
||||||
|
fi
|
||||||
cat ${LOG_DIR}/*.asan
|
cat ${LOG_DIR}/*.asan
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
|
@ -11,6 +11,7 @@
|
||||||
set +e
|
set +e
|
||||||
#set -x
|
#set -x
|
||||||
|
|
||||||
|
unset LD_PRELOAD
|
||||||
UNAME_BIN=`which uname`
|
UNAME_BIN=`which uname`
|
||||||
OS_TYPE=`$UNAME_BIN`
|
OS_TYPE=`$UNAME_BIN`
|
||||||
|
|
||||||
|
@ -80,7 +81,7 @@ LOG_DIR=$NODE_DIR/log
|
||||||
DATA_DIR=$NODE_DIR/data
|
DATA_DIR=$NODE_DIR/data
|
||||||
MGMT_DIR=$NODE_DIR/data/mgmt
|
MGMT_DIR=$NODE_DIR/data/mgmt
|
||||||
TSDB_DIR=$NODE_DIR/data/tsdb
|
TSDB_DIR=$NODE_DIR/data/tsdb
|
||||||
ASAN_DIR=$SIM_DIR/tsim/asan
|
ASAN_DIR=$SIM_DIR/asan
|
||||||
TAOS_CFG=$NODE_DIR/cfg/taos.cfg
|
TAOS_CFG=$NODE_DIR/cfg/taos.cfg
|
||||||
|
|
||||||
echo ------------ $EXEC_OPTON $NODE_NAME
|
echo ------------ $EXEC_OPTON $NODE_NAME
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set +e
|
||||||
|
#set -x
|
||||||
|
|
||||||
|
unset LD_PRELOAD
|
||||||
|
UNAME_BIN=`which uname`
|
||||||
|
OS_TYPE=`$UNAME_BIN`
|
||||||
|
|
||||||
|
PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'`
|
||||||
|
echo "Killing taosd processes " $PID
|
||||||
|
while [ -n "$PID" ]; do
|
||||||
|
#echo "Killing taosd processes " $PID
|
||||||
|
kill $PID
|
||||||
|
PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'`
|
||||||
|
done
|
|
@ -1,5 +1,9 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
set +e
|
||||||
|
#set -x
|
||||||
|
|
||||||
|
unset LD_PRELOAD
|
||||||
UNAME_BIN=`which uname`
|
UNAME_BIN=`which uname`
|
||||||
OS_TYPE=`$UNAME_BIN`
|
OS_TYPE=`$UNAME_BIN`
|
||||||
|
|
||||||
|
@ -22,16 +26,3 @@ while [ -n "$PID" ]; do
|
||||||
fi
|
fi
|
||||||
PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'`
|
PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'`
|
||||||
done
|
done
|
||||||
|
|
||||||
PID=`ps -ef|grep -w tarbitrator | grep -v grep | awk '{print $2}'`
|
|
||||||
while [ -n "$PID" ]; do
|
|
||||||
echo kill -9 $PID
|
|
||||||
pkill -9 tarbitrator
|
|
||||||
if [ "$OS_TYPE" != "Darwin" ]; then
|
|
||||||
fuser -k -n tcp 6040
|
|
||||||
else
|
|
||||||
lsof -nti:6040 | xargs kill -9
|
|
||||||
fi
|
|
||||||
PID=`ps -ef|grep -w tarbitrator | grep -v grep | awk '{print $2}'`
|
|
||||||
done
|
|
||||||
|
|
||||||
|
|
|
@ -66,16 +66,13 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
declare -x BUILD_DIR=$TOP_DIR/$BIN_DIR
|
declare -x BUILD_DIR=$TOP_DIR/$BIN_DIR
|
||||||
|
|
||||||
declare -x SIM_DIR=$TOP_DIR/sim
|
declare -x SIM_DIR=$TOP_DIR/sim
|
||||||
|
|
||||||
PROGRAM=$BUILD_DIR/build/bin/tsim
|
PROGRAM=$BUILD_DIR/build/bin/tsim
|
||||||
|
|
||||||
PRG_DIR=$SIM_DIR/tsim
|
PRG_DIR=$SIM_DIR/tsim
|
||||||
CFG_DIR=$PRG_DIR/cfg
|
CFG_DIR=$PRG_DIR/cfg
|
||||||
LOG_DIR=$PRG_DIR/log
|
LOG_DIR=$PRG_DIR/log
|
||||||
DATA_DIR=$PRG_DIR/data
|
DATA_DIR=$PRG_DIR/data
|
||||||
ASAN_DIR=$PRG_DIR/asan
|
ASAN_DIR=$SIM_DIR/asan
|
||||||
|
|
||||||
chmod -R 777 $PRG_DIR
|
chmod -R 777 $PRG_DIR
|
||||||
echo "------------------------------------------------------------------------"
|
echo "------------------------------------------------------------------------"
|
||||||
|
@ -141,11 +138,15 @@ if [ -n "$FILE_NAME" ]; then
|
||||||
echo "AsanDir:" $ASAN_DIR/tsim.asan
|
echo "AsanDir:" $ASAN_DIR/tsim.asan
|
||||||
eval $PROGRAM -c $CFG_DIR -f $FILE_NAME 2> $ASAN_DIR/tsim.asan
|
eval $PROGRAM -c $CFG_DIR -f $FILE_NAME 2> $ASAN_DIR/tsim.asan
|
||||||
result=$?
|
result=$?
|
||||||
echo "Execute result: " $result
|
echo "Execute result:" $result
|
||||||
|
|
||||||
if [ $result -eq 0 ]; then
|
if [ $result -eq 0 ]; then
|
||||||
|
$CODE_DIR/sh/sigint_stop_dnodes.sh
|
||||||
$CODE_DIR/sh/checkAsan.sh
|
$CODE_DIR/sh/checkAsan.sh
|
||||||
else
|
else
|
||||||
|
echo "TSIM has asan errors"
|
||||||
|
sleep 1
|
||||||
|
$CODE_DIR/sh/checkAsan.sh
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -138,10 +138,10 @@ while $i < 10
|
||||||
if $data[0][4] != leader then
|
if $data[0][4] != leader then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data[0][6] != follower then
|
if $data[0][6] == leader then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data[0][8] != follower then
|
if $data[0][8] == leader then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
endw
|
endw
|
||||||
|
|
|
@ -192,7 +192,7 @@ if $data(5)[4] != ready then
|
||||||
goto step5
|
goto step5
|
||||||
endi
|
endi
|
||||||
|
|
||||||
print =============== step5: drop dnode 2
|
print =============== step5a: drop dnode 2
|
||||||
sql_error drop dnode 2
|
sql_error drop dnode 2
|
||||||
sql drop dnode 2 force
|
sql drop dnode 2 force
|
||||||
|
|
||||||
|
@ -204,15 +204,23 @@ if $rows != 4 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
$x = 0
|
||||||
|
step5a:
|
||||||
|
$ = $x + 1
|
||||||
|
sleep 1000
|
||||||
|
if $x == 10 then
|
||||||
|
print ====> dnode not online!
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
print select * from information_schema.ins_mnodes;
|
print select * from information_schema.ins_mnodes;
|
||||||
sql select * from information_schema.ins_mnodes
|
sql select * from information_schema.ins_mnodes
|
||||||
print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4]
|
print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4]
|
||||||
print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4]
|
print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4]
|
||||||
if $rows != 2 then
|
if $rows != 2 then
|
||||||
return -1
|
goto step5a
|
||||||
endi
|
endi
|
||||||
if $data(1)[2] != leader then
|
if $data(1)[2] != leader then
|
||||||
return -1
|
goto step5a
|
||||||
endi
|
endi
|
||||||
|
|
||||||
sql select * from information_schema.ins_qnodes
|
sql select * from information_schema.ins_qnodes
|
||||||
|
|
|
@ -96,7 +96,7 @@ sql_error drop mnode on dnode 4
|
||||||
sql_error drop mnode on dnode 5
|
sql_error drop mnode on dnode 5
|
||||||
sql_error drop mnode on dnode 6
|
sql_error drop mnode on dnode 6
|
||||||
|
|
||||||
system sh/exec.sh -n dnode2 -s stop -x SIGKILL
|
system sh/exec.sh -n dnode2 -s stop
|
||||||
$x = 0
|
$x = 0
|
||||||
step5:
|
step5:
|
||||||
$x = $x + 1
|
$x = $x + 1
|
||||||
|
@ -151,7 +151,7 @@ if $data(4)[4] != ready then
|
||||||
endi
|
endi
|
||||||
|
|
||||||
print =============== step6: stop mnode1
|
print =============== step6: stop mnode1
|
||||||
system sh/exec.sh -n dnode1 -s stop -x SIGKILL
|
system sh/exec.sh -n dnode1 -s stop
|
||||||
# sql_error drop mnode on dnode 1
|
# sql_error drop mnode on dnode 1
|
||||||
|
|
||||||
$x = 0
|
$x = 0
|
||||||
|
@ -205,8 +205,7 @@ if $data(4)[4] != ready then
|
||||||
endi
|
endi
|
||||||
|
|
||||||
print =============== step8: stop mnode1 and drop it
|
print =============== step8: stop mnode1 and drop it
|
||||||
system sh/exec.sh -n dnode1 -s stop -x SIGKILL
|
system sh/exec.sh -n dnode1 -s stop
|
||||||
sql_error drop mnode on dnode 1
|
|
||||||
|
|
||||||
$x = 0
|
$x = 0
|
||||||
step81:
|
step81:
|
||||||
|
@ -234,42 +233,15 @@ if $leaderNum != 1 then
|
||||||
endi
|
endi
|
||||||
|
|
||||||
print =============== step9: start mnode1 and wait it dropped
|
print =============== step9: start mnode1 and wait it dropped
|
||||||
system sh/exec.sh -n dnode1 -s start
|
print check mnode has leader step9a
|
||||||
sql drop mnode on dnode 1 -x step90
|
|
||||||
step90:
|
|
||||||
|
|
||||||
$x = 0
|
$x = 0
|
||||||
step91:
|
step9a:
|
||||||
$x = $x + 1
|
$x = $x + 1
|
||||||
sleep 1000
|
sleep 1000
|
||||||
if $x == 10 then
|
if $x == 10 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
sql select * from information_schema.ins_dnodes
|
print check mnode leader
|
||||||
print ===> $data00 $data01 $data02 $data03 $data04 $data05
|
|
||||||
print ===> $data10 $data11 $data12 $data13 $data14 $data15
|
|
||||||
print ===> $data20 $data21 $data22 $data23 $data24 $data25
|
|
||||||
print ===> $data30 $data31 $data32 $data33 $data34 $data35
|
|
||||||
if $data(1)[4] != ready then
|
|
||||||
goto step91
|
|
||||||
endi
|
|
||||||
if $data(2)[4] != ready then
|
|
||||||
goto step91
|
|
||||||
endi
|
|
||||||
if $data(3)[4] != ready then
|
|
||||||
goto step91
|
|
||||||
endi
|
|
||||||
if $data(4)[4] != ready then
|
|
||||||
goto step91
|
|
||||||
endi
|
|
||||||
|
|
||||||
$x = 0
|
|
||||||
step92:
|
|
||||||
$x = $x + 1
|
|
||||||
sleep 1000
|
|
||||||
if $x == 20 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
sql select * from information_schema.ins_mnodes
|
sql select * from information_schema.ins_mnodes
|
||||||
print ===> $data00 $data01 $data02 $data03 $data04 $data05
|
print ===> $data00 $data01 $data02 $data03 $data04 $data05
|
||||||
print ===> $data10 $data11 $data12 $data13 $data14 $data15
|
print ===> $data10 $data11 $data12 $data13 $data14 $data15
|
||||||
|
@ -285,10 +257,95 @@ if $data(3)[2] == leader then
|
||||||
$leaderNum = 1
|
$leaderNum = 1
|
||||||
endi
|
endi
|
||||||
if $leaderNum != 1 then
|
if $leaderNum != 1 then
|
||||||
goto step92
|
goto step9a
|
||||||
|
endi
|
||||||
|
|
||||||
|
print start dnode1 step9b
|
||||||
|
system sh/exec.sh -n dnode1 -s start
|
||||||
|
$x = 0
|
||||||
|
step9b:
|
||||||
|
$x = $x + 1
|
||||||
|
sleep 1000
|
||||||
|
if $x == 10 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
print check dnode1 ready
|
||||||
|
sql select * from information_schema.ins_dnodes
|
||||||
|
print ===> $data00 $data01 $data02 $data03 $data04 $data05
|
||||||
|
print ===> $data10 $data11 $data12 $data13 $data14 $data15
|
||||||
|
print ===> $data20 $data21 $data22 $data23 $data24 $data25
|
||||||
|
print ===> $data30 $data31 $data32 $data33 $data34 $data35
|
||||||
|
if $data(1)[4] != ready then
|
||||||
|
goto step9b
|
||||||
|
endi
|
||||||
|
if $data(2)[4] != ready then
|
||||||
|
goto step9b
|
||||||
|
endi
|
||||||
|
if $data(3)[4] != ready then
|
||||||
|
goto step9b
|
||||||
|
endi
|
||||||
|
if $data(4)[4] != ready then
|
||||||
|
goto step9b
|
||||||
|
endi
|
||||||
|
|
||||||
|
sleep 4000
|
||||||
|
print check mnode has leader step9c
|
||||||
|
$x = 0
|
||||||
|
step9c:
|
||||||
|
$x = $x + 1
|
||||||
|
sleep 1000
|
||||||
|
if $x == 10 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
print check mnode leader
|
||||||
|
sql select * from information_schema.ins_mnodes
|
||||||
|
print ===> $data00 $data01 $data02 $data03 $data04 $data05
|
||||||
|
print ===> $data10 $data11 $data12 $data13 $data14 $data15
|
||||||
|
print ===> $data20 $data21 $data22 $data23 $data24 $data25
|
||||||
|
$leaderNum = 0
|
||||||
|
if $data(1)[2] == leader then
|
||||||
|
$leaderNum = 1
|
||||||
|
endi
|
||||||
|
if $data(2)[2] == leader then
|
||||||
|
$leaderNum = 1
|
||||||
|
endi
|
||||||
|
if $data(3)[2] == leader then
|
||||||
|
$leaderNum = 1
|
||||||
|
endi
|
||||||
|
if $leaderNum != 1 then
|
||||||
|
goto step9c
|
||||||
|
endi
|
||||||
|
|
||||||
|
print drop mnode step9d
|
||||||
|
sql drop mnode on dnode 1
|
||||||
|
|
||||||
|
$x = 0
|
||||||
|
step9d:
|
||||||
|
$x = $x + 1
|
||||||
|
sleep 1000
|
||||||
|
if $x == 20 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
print check mnode leader
|
||||||
|
sql select * from information_schema.ins_mnodes
|
||||||
|
print ===> $data00 $data01 $data02 $data03 $data04 $data05
|
||||||
|
print ===> $data10 $data11 $data12 $data13 $data14 $data15
|
||||||
|
print ===> $data20 $data21 $data22 $data23 $data24 $data25
|
||||||
|
$leaderNum = 0
|
||||||
|
if $data(1)[2] == leader then
|
||||||
|
$leaderNum = 1
|
||||||
|
endi
|
||||||
|
if $data(2)[2] == leader then
|
||||||
|
$leaderNum = 1
|
||||||
|
endi
|
||||||
|
if $data(3)[2] == leader then
|
||||||
|
$leaderNum = 1
|
||||||
|
endi
|
||||||
|
if $leaderNum != 1 then
|
||||||
|
goto step9d
|
||||||
endi
|
endi
|
||||||
if $rows != 2 then
|
if $rows != 2 then
|
||||||
goto step92
|
goto step9d
|
||||||
endi
|
endi
|
||||||
|
|
||||||
print =============== stepa: create mnode1 again
|
print =============== stepa: create mnode1 again
|
||||||
|
|
|
@ -330,7 +330,7 @@ if $data11 != -1 then
|
||||||
endi
|
endi
|
||||||
|
|
||||||
# fill_char_values_to_arithmetic_fields
|
# fill_char_values_to_arithmetic_fields
|
||||||
sql_error select sum(c1), avg(c2), max(c3), min(c4), avg(c4), count(c6), last(c7), last(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'c', 'c', 'c', 'c', 'c', 'c', 'c', 'c')
|
sql select sum(c1), avg(c2), max(c3), min(c4), avg(c4), count(c6), last(c7), last(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'c', 'c', 'c', 'c', 'c', 'c', 'c', 'c')
|
||||||
|
|
||||||
# fill_multiple_columns
|
# fill_multiple_columns
|
||||||
sql_error select sum(c1), avg(c2), min(c3), max(c4), count(c6), first(c7), last(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 99, 99, 99, 99, 99, abc, abc)
|
sql_error select sum(c1), avg(c2), min(c3), max(c4), count(c6), first(c7), last(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 99, 99, 99, 99, 99, abc, abc)
|
||||||
|
@ -355,25 +355,25 @@ endi
|
||||||
|
|
||||||
# fill_into_nonarithmetic_fieds
|
# fill_into_nonarithmetic_fieds
|
||||||
print select _wstart, first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 20000000, 20000000, 20000000)
|
print select _wstart, first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 20000000, 20000000, 20000000)
|
||||||
sql_error select _wstart, first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 20000000, 20000000, 20000000)
|
sql select _wstart, first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 20000000, 20000000, 20000000)
|
||||||
|
|
||||||
sql_error select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 1, 1, 1)
|
sql select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 1, 1, 1)
|
||||||
sql_error select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 1.1, 1.1, 1.1)
|
sql select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 1.1, 1.1, 1.1)
|
||||||
sql_error select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 1e1, 1e1, 1e1)
|
sql select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 1e1, 1e1, 1e1)
|
||||||
sql select first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1e', '1e1')
|
sql select first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1e', '1e1')
|
||||||
# fill quoted values into bool column will throw error unless the value is 'true' or 'false' Note:2018-10-24
|
# fill quoted values into bool column will throw error unless the value is 'true' or 'false' Note:2018-10-24
|
||||||
# fill values into binary or nchar columns will be set to NULL automatically Note:2018-10-24
|
# fill values into binary or nchar columns will be set to NULL automatically Note:2018-10-24
|
||||||
sql select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1e', '1e1','1e1')
|
sql select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1e', '1e1','1e1')
|
||||||
sql_error select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, true, true, true)
|
sql select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, true, true, true)
|
||||||
sql select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'true', 'true','true')
|
sql select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'true', 'true','true')
|
||||||
|
|
||||||
|
|
||||||
# fill nonarithmetic values into arithmetic fields
|
# fill nonarithmetic values into arithmetic fields
|
||||||
sql_error select count(*) where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, abc);
|
sql_error select count(*) where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, abc);
|
||||||
sql_error select count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'true');
|
sql select count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'true');
|
||||||
|
|
||||||
print select _wstart, count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1e1');
|
print select _wstart, count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1e1');
|
||||||
sql_error select _wstart, count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1e1');
|
sql select _wstart, count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1e1');
|
||||||
|
|
||||||
sql select _wstart, count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 1e1);
|
sql select _wstart, count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 1e1);
|
||||||
if $rows != 9 then
|
if $rows != 9 then
|
||||||
|
@ -383,7 +383,7 @@ if $data01 != 1 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
sql_error select _wstart, count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '10');
|
sql select _wstart, count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '10');
|
||||||
|
|
||||||
## linear fill
|
## linear fill
|
||||||
# feature currently switched off 2018/09/29
|
# feature currently switched off 2018/09/29
|
||||||
|
@ -1049,4 +1049,103 @@ print =============== clear
|
||||||
# return -1
|
# return -1
|
||||||
#endi
|
#endi
|
||||||
|
|
||||||
|
|
||||||
|
print ============== fill
|
||||||
|
|
||||||
|
sql drop database if exists test;
|
||||||
|
sql create database test vgroups 4;
|
||||||
|
sql use test;
|
||||||
|
sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int);
|
||||||
|
sql create table t1 using st tags(1,1,1);
|
||||||
|
sql create table t2 using st tags(2,2,2);
|
||||||
|
sql insert into t1 values(1648712211000,1,2,3);
|
||||||
|
sql insert into t1 values(1648712225000,2,2,3);
|
||||||
|
sql insert into t2 values(1648712212000,1,2,3);
|
||||||
|
sql insert into t2 values(1648712226000,2,2,3);
|
||||||
|
|
||||||
|
$loop_count = 0
|
||||||
|
|
||||||
|
loop0:
|
||||||
|
sleep 200
|
||||||
|
|
||||||
|
sql select count(*) from(select count(a) from st where ts >= 1648712201000 and ts <= 1648732226000 partition by tbname interval(1s) fill(value, -1));
|
||||||
|
|
||||||
|
$loop_count = $loop_count + 1
|
||||||
|
if $loop_count == 20 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data00 != 20026 then
|
||||||
|
print =====data00=$data00
|
||||||
|
goto loop0
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data10 != 20026 then
|
||||||
|
print =====data10=$data10
|
||||||
|
goto loop0
|
||||||
|
endi
|
||||||
|
|
||||||
|
sql select _wstart, count(a) from st where ts >= 1648712201000 and ts <= 1648732226000 partition by tbname interval(1s) fill(prev);
|
||||||
|
|
||||||
|
if $rows != 40052 then
|
||||||
|
print =====rows=$rows
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
sql select _wstart, count(a) from st where ts >= 1648712201000 and ts <= 1648732226000 partition by tbname interval(1s) fill(next);
|
||||||
|
|
||||||
|
if $rows != 40052 then
|
||||||
|
print =====rows=$rows
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
sql select _wstart, count(a) from st where ts >= 1648712201000 and ts <= 1648732226000 partition by tbname interval(1s) fill(linear);
|
||||||
|
|
||||||
|
if $rows != 40052 then
|
||||||
|
print =====rows=$rows
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
sql select _wstart, count(a) from st where ts >= 1648712201000 and ts <= 1648732226000 partition by tbname interval(1s) fill(NULL);
|
||||||
|
|
||||||
|
if $rows != 40052 then
|
||||||
|
print =====rows=$rows
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
sql select _wstart, count(a) from t1 where ts >= 1648712201000 and ts <= 1648732226000 partition by tbname interval(1s) fill(value, -1);
|
||||||
|
|
||||||
|
if $rows != 20026 then
|
||||||
|
print =====rows=$rows
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
sql select _wstart, count(a) from t1 where ts >= 1648712201000 and ts <= 1648732226000 partition by tbname interval(1s) fill(NULL);
|
||||||
|
|
||||||
|
if $rows != 20026 then
|
||||||
|
print =====rows=$rows
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
sql select _wstart, count(a) from t1 where ts >= 1648712201000 and ts <= 1648732226000 partition by tbname interval(1s) fill(prev);
|
||||||
|
|
||||||
|
if $rows != 20026 then
|
||||||
|
print =====rows=$rows
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
sql select _wstart, count(a) from t1 where ts >= 1648712201000 and ts <= 1648732226000 partition by tbname interval(1s) fill(next);
|
||||||
|
|
||||||
|
if $rows != 20026 then
|
||||||
|
print =====rows=$rows
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
sql select _wstart, count(a) from t1 where ts >= 1648712201000 and ts <= 1648732226000 partition by tbname interval(1s) fill(linear);
|
||||||
|
|
||||||
|
if $rows != 20026 then
|
||||||
|
print =====rows=$rows
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||||
|
|
|
@ -170,7 +170,7 @@ endi
|
||||||
sql_error select max(c1), max(c2), max(c3), max(c4), max(c5) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill (6, 6, 6, 6, 6)
|
sql_error select max(c1), max(c2), max(c3), max(c4), max(c5) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill (6, 6, 6, 6, 6)
|
||||||
|
|
||||||
# fill_char_values_to_arithmetic_fields
|
# fill_char_values_to_arithmetic_fields
|
||||||
sql_error select sum(c1), avg(c2), max(c3), min(c4), avg(c4), count(c6), last(c7), last(c8) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'c', 'c', 'c', 'c', 'c', 'c', 'c', 'c')
|
sql select sum(c1), avg(c2), max(c3), min(c4), avg(c4), count(c6), last(c7), last(c8) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'c', 'c', 'c', 'c', 'c', 'c', 'c', 'c')
|
||||||
|
|
||||||
# fill_multiple_columns
|
# fill_multiple_columns
|
||||||
sql_error select sum(c1), avg(c2), min(c3), max(c4), count(c6), first(c7), last(c8) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 99, 99, 99, 99, 99, abc, abc)
|
sql_error select sum(c1), avg(c2), min(c3), max(c4), count(c6), first(c7), last(c8) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 99, 99, 99, 99, 99, abc, abc)
|
||||||
|
@ -240,10 +240,10 @@ sql select first(c7), first(c8), first(c9) from $stb where ts >= $ts0 and ts <=
|
||||||
sql select first(c7), first(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'true', 'true','true')
|
sql select first(c7), first(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'true', 'true','true')
|
||||||
|
|
||||||
# fill nonarithmetic values into arithmetic fields
|
# fill nonarithmetic values into arithmetic fields
|
||||||
sql_error select count(*) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'abc');
|
sql select count(*) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'abc');
|
||||||
sql_error select count(*) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'true');
|
sql select count(*) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'true');
|
||||||
|
|
||||||
sql_error select _wstart, count(*) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '2e1');
|
sql select _wstart, count(*) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '2e1');
|
||||||
|
|
||||||
sql select _wstart, count(*) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 20);
|
sql select _wstart, count(*) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 20);
|
||||||
if $rows != $val then
|
if $rows != $val then
|
||||||
|
@ -354,7 +354,7 @@ endi
|
||||||
|
|
||||||
## NULL fill
|
## NULL fill
|
||||||
print fill(NULL)
|
print fill(NULL)
|
||||||
print select _wstart, max(c1), min(c2), avg(c3), sum(c4), count(c5), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 4 partition by t1 interval(5m) fill(value, NULL) limit 5
|
print select _wstart, max(c1), min(c2), avg(c3), sum(c4), count(c5), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 4 partition by t1 interval(5m) fill(value, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) limit 5
|
||||||
sql select _wstart, max(c1), min(c2), avg(c3), sum(c4), count(c5), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 4 partition by t1 interval(5m) fill(NULL) limit 5
|
sql select _wstart, max(c1), min(c2), avg(c3), sum(c4), count(c5), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 4 partition by t1 interval(5m) fill(NULL) limit 5
|
||||||
if $rows != 25 then
|
if $rows != 25 then
|
||||||
return -1
|
return -1
|
||||||
|
|
|
@ -332,7 +332,7 @@ if $data11 != -1 then
|
||||||
endi
|
endi
|
||||||
|
|
||||||
# fill_char_values_to_arithmetic_fields
|
# fill_char_values_to_arithmetic_fields
|
||||||
sql_error select sum(c1), avg(c2), max(c3), min(c4), avg(c4), count(c6), last(c7), last(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'c', 'c', 'c', 'c', 'c', 'c', 'c', 'c')
|
sql select sum(c1), avg(c2), max(c3), min(c4), avg(c4), count(c6), last(c7), last(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'c', 'c', 'c', 'c', 'c', 'c', 'c', 'c')
|
||||||
|
|
||||||
# fill_multiple_columns
|
# fill_multiple_columns
|
||||||
sql_error select _wstart, sum(c1), avg(c2), min(c3), max(c4), count(c6), first(c7), last(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 99, 99, 99, 99, 99, abc, abc)
|
sql_error select _wstart, sum(c1), avg(c2), min(c3), max(c4), count(c6), first(c7), last(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 99, 99, 99, 99, 99, abc, abc)
|
||||||
|
@ -358,24 +358,24 @@ endi
|
||||||
|
|
||||||
|
|
||||||
# fill_into_nonarithmetic_fieds
|
# fill_into_nonarithmetic_fieds
|
||||||
sql_error select _wstart, first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 20000000, 20000000, 20000000)
|
sql select _wstart, first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 20000000, 20000000, 20000000)
|
||||||
|
|
||||||
sql_error select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 1, 1, 1)
|
sql select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 1, 1, 1)
|
||||||
sql_error select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 1.1, 1.1, 1.1)
|
sql select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 1.1, 1.1, 1.1)
|
||||||
sql_error select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 1e1, 1e1, 1e1)
|
sql select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 1e1, 1e1, 1e1)
|
||||||
sql select first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1e', '1e1')
|
sql select first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1e', '1e1')
|
||||||
# fill quoted values into bool column will throw error unless the value is 'true' or 'false' Note:2018-10-24
|
# fill quoted values into bool column will throw error unless the value is 'true' or 'false' Note:2018-10-24
|
||||||
# fill values into binary or nchar columns will be set to null automatically Note:2018-10-24
|
# fill values into binary or nchar columns will be set to null automatically Note:2018-10-24
|
||||||
sql select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1e', '1e1','1e1')
|
sql select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1e', '1e1','1e1')
|
||||||
sql_error select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, true, true, true)
|
sql select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, true, true, true)
|
||||||
sql select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'true', 'true','true')
|
sql select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'true', 'true','true')
|
||||||
|
|
||||||
|
|
||||||
# fill nonarithmetic values into arithmetic fields
|
# fill nonarithmetic values into arithmetic fields
|
||||||
sql_error select count(*) where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, abc);
|
sql_error select count(*) where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, abc);
|
||||||
sql_error select count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'true');
|
sql select count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'true');
|
||||||
|
|
||||||
sql_error select _wstart, count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1e1');
|
sql select _wstart, count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1e1');
|
||||||
|
|
||||||
sql select _wstart, count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 1e1);
|
sql select _wstart, count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 1e1);
|
||||||
if $rows != 9 then
|
if $rows != 9 then
|
||||||
|
@ -385,7 +385,7 @@ if $data01 != 1 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
sql_error select _wstart, count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '10');
|
sql select _wstart, count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '10');
|
||||||
|
|
||||||
## linear fill
|
## linear fill
|
||||||
# feature currently switched off 2018/09/29
|
# feature currently switched off 2018/09/29
|
||||||
|
|
|
@ -821,10 +821,10 @@ sql insert into tm0 values('2015-08-18T00:18:00Z', 2.126) ('2015-08-18T00:24:00Z
|
||||||
|
|
||||||
sql_error select derivative(ts) from tm0;
|
sql_error select derivative(ts) from tm0;
|
||||||
sql_error select derivative(k) from tm0;
|
sql_error select derivative(k) from tm0;
|
||||||
sql select derivative(k, 0, 0) from tm0;
|
sql_error select derivative(k, 0, 0) from tm0;
|
||||||
sql_error select derivative(k, 1, 911) from tm0;
|
sql_error select derivative(k, 1, 911) from tm0;
|
||||||
sql_error select derivative(kx, 1s, 1) from tm0;
|
sql_error select derivative(kx, 1s, 1) from tm0;
|
||||||
sql select derivative(k, -20s, 1) from tm0;
|
sql_error select derivative(k, -20s, 1) from tm0;
|
||||||
sql select derivative(k, 20a, 0) from tm0;
|
sql select derivative(k, 20a, 0) from tm0;
|
||||||
sql select derivative(k, 200a, 0) from tm0;
|
sql select derivative(k, 200a, 0) from tm0;
|
||||||
sql select derivative(k, 999a, 0) from tm0;
|
sql select derivative(k, 999a, 0) from tm0;
|
||||||
|
@ -932,10 +932,10 @@ sql insert into t0 values('2020-1-1 1:4:10', 10);
|
||||||
|
|
||||||
sql insert into t1 values('2020-1-1 1:1:2', 2);
|
sql insert into t1 values('2020-1-1 1:1:2', 2);
|
||||||
print ===========================>td-4739
|
print ===========================>td-4739
|
||||||
#sql select diff(val) from (select derivative(k, 1s, 0) val from t1);
|
sql select diff(val) from (select ts, derivative(k, 1s, 0) val from t1);
|
||||||
#if $rows != 0 then
|
if $rows != 0 then
|
||||||
# return -1
|
return -1
|
||||||
#endi
|
endi
|
||||||
|
|
||||||
sql insert into t1 values('2020-1-1 1:1:4', 20);
|
sql insert into t1 values('2020-1-1 1:1:4', 20);
|
||||||
sql insert into t1 values('2020-1-1 1:1:6', 200);
|
sql insert into t1 values('2020-1-1 1:1:6', 200);
|
||||||
|
@ -1077,4 +1077,4 @@ endi
|
||||||
if $data11 != NULL then
|
if $data11 != NULL then
|
||||||
print ======data11=$data11
|
print ======data11=$data11
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
|
@ -321,55 +321,41 @@ endi
|
||||||
|
|
||||||
### [TBASE-350]
|
### [TBASE-350]
|
||||||
## stb + interval + fill + group by + limit offset
|
## stb + interval + fill + group by + limit offset
|
||||||
sql select max(c1), min(c2), sum(c3), avg(c4), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu partition by t1 interval(5m) fill(value, -1, -2, -3, -4 ,-7 ,'-8', '-9') limit 2 offset 10
|
sql select max(c1), min(c2), sum(c3), avg(c4), first(c7), last(c8), first(c9) from lm2_tb0 where ts >= 1537146000000 and ts <= 1543145400000 partition by t1 interval(5m) fill(value, -1, -2, -3, -4 ,-7 ,'-8', '-9') limit 2 offset 10
|
||||||
if $rows != 2 then
|
if $rows != 2 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
#add one more test case
|
|
||||||
sql select max(c1), last(c8) from lm2_db0.lm2_tb0 where ts >= 1537146000000 and ts <= 1543145400000 interval(5m) fill(linear) limit 10 offset 4089;"
|
|
||||||
|
|
||||||
|
|
||||||
$limit = 5
|
$limit = 5
|
||||||
$offset = $rowNum * 2
|
$offset = $rowNum * 2
|
||||||
$offset = $offset - 2
|
$offset = $offset - 2
|
||||||
sql select max(c1), min(c2), sum(c3), avg(c4), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu partition by t1 interval(5m) fill(value, -1, -2, -3, -4 ,-7 ,'-8', '-9') order by t1 limit $limit offset $offset
|
sql select max(c1), min(c2), sum(c3), avg(c4), first(c7), last(c8), first(c9) from lm2_tb0 where ts >= 1537146000000 and ts <= 1543145400000 partition by t1 interval(5m) fill(value, -1, -2, -3, -4 ,-7 ,'-8', '-9') order by t1 limit $limit offset $offset
|
||||||
if $rows != $tbNum then
|
if $rows != 1 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data00 != @18-11-25 19:30:00.000@ then
|
if $data00 != 9 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data01 != 9 then
|
if $data01 != 9 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data12 != 9 then
|
if $data02 != 9.000000000 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data23 != 9.000000000 then
|
if $data03 != 9.000000000 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data34 != 9.000000000 then
|
if $data04 != 1 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data45 != 1 then
|
if $data05 != binary9 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data56 != binary9 then
|
if $data06 != nchar9 then
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
if $data68 != 6 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
if $data72 != -2 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
if $data84 != -2.000000000 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
if $data98 != 9 then
|
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
|
||||||
#add one more test case
|
#add one more test case
|
||||||
sql select max(c1), last(c8) from lm2_db0.lm2_tb0 where ts >= 1537146000000 and ts <= 1543145400000 interval(5m) fill(linear) limit 10 offset 4089;"
|
sql select max(c1), last(c8) from lm2_db0.lm2_tb0 where ts >= 1537146000000 and ts <= 1543145400000 interval(5m) fill(linear) limit 10 offset 4089;"
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,154 @@
|
||||||
|
system sh/stop_dnodes.sh
|
||||||
|
system sh/deploy.sh -n dnode1 -i 1
|
||||||
|
system sh/deploy.sh -n dnode2 -i 2
|
||||||
|
system sh/deploy.sh -n dnode3 -i 3
|
||||||
|
system sh/cfg.sh -n dnode1 -c supportVnodes -v 0
|
||||||
|
system sh/cfg.sh -n dnode2 -c supportVnodes -v 4
|
||||||
|
system sh/cfg.sh -n dnode3 -c supportVnodes -v 4
|
||||||
|
|
||||||
|
print ========== step1
|
||||||
|
system sh/exec.sh -n dnode1 -s start
|
||||||
|
sql connect
|
||||||
|
|
||||||
|
print ========== step2
|
||||||
|
sql create dnode $hostname port 7200
|
||||||
|
sql create dnode $hostname port 7300
|
||||||
|
system sh/exec.sh -n dnode2 -s start
|
||||||
|
system sh/exec.sh -n dnode3 -s start
|
||||||
|
|
||||||
|
$x = 0
|
||||||
|
step2:
|
||||||
|
$x = $x + 1
|
||||||
|
sleep 1000
|
||||||
|
if $x == 10 then
|
||||||
|
print ====> dnode not ready!
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql select * from information_schema.ins_dnodes
|
||||||
|
print ===> $data00 $data01 $data02 $data03 $data04 $data05
|
||||||
|
print ===> $data10 $data11 $data12 $data13 $data14 $data15
|
||||||
|
if $rows != 3 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data(1)[4] != ready then
|
||||||
|
goto step2
|
||||||
|
endi
|
||||||
|
if $data(2)[4] != ready then
|
||||||
|
goto step2
|
||||||
|
endi
|
||||||
|
if $data(3)[4] != ready then
|
||||||
|
goto step2
|
||||||
|
endi
|
||||||
|
|
||||||
|
print ========== step3
|
||||||
|
sql create database d1 vgroups 1
|
||||||
|
sql use d1;
|
||||||
|
|
||||||
|
print --> create stb
|
||||||
|
sql create table if not exists stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int unsigned);
|
||||||
|
|
||||||
|
print --> create sma
|
||||||
|
sql create sma index sma_index_name1 on stb function(max(c1),max(c2),min(c1)) interval(6m,10s) sliding(6m);
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
print --> show sma
|
||||||
|
sql show indexes from stb from d1;
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data[0][0] != sma_index_name1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data[0][1] != d1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data[0][2] != stb then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print --> drop stb
|
||||||
|
sql drop table stb;
|
||||||
|
|
||||||
|
print ========== step4 repeat
|
||||||
|
|
||||||
|
print --> create stb
|
||||||
|
sql create table if not exists stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int unsigned);
|
||||||
|
|
||||||
|
print --> create sma
|
||||||
|
sql create sma index sma_index_name1 on stb function(max(c1),max(c2),min(c1)) interval(6m,10s) sliding(6m);
|
||||||
|
|
||||||
|
print --> show sma
|
||||||
|
sql show indexes from stb from d1;
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data[0][0] != sma_index_name1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data[0][1] != d1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data[0][2] != stb then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print --> drop stb
|
||||||
|
sql drop table stb;
|
||||||
|
|
||||||
|
print ========== step5
|
||||||
|
sql drop database if exists db;
|
||||||
|
sql create database db duration 300;
|
||||||
|
sql use db;
|
||||||
|
sql create table stb1(ts timestamp, c_int int, c_bint bigint, c_sint smallint, c_tint tinyint, c_float float, c_double double, c_bool bool, c_binary binary(16), c_nchar nchar(32), c_ts timestamp, c_tint_un tinyint unsigned, c_sint_un smallint unsigned, c_int_un int unsigned, c_bint_un bigint unsigned) tags (t_int int);
|
||||||
|
sql CREATE SMA INDEX sma_index_1 ON stb1 function(min(c_int), max(c_int)) interval(6m, 10s) sliding(6m) watermark 5s;
|
||||||
|
|
||||||
|
print ========== step6 repeat
|
||||||
|
sql drop database if exists db;
|
||||||
|
sql create database db duration 300;
|
||||||
|
sql use db;
|
||||||
|
sql create table stb1(ts timestamp, c_int int, c_bint bigint ) tags (t_int int);
|
||||||
|
sql CREATE SMA INDEX sma_index_1 ON stb1 function(min(c_int), max(c_int)) interval(6m, 10s) sliding(6m) watermark 5s;
|
||||||
|
|
||||||
|
print ========== step7
|
||||||
|
sql drop database if exists db;
|
||||||
|
sql create database db duration 300;
|
||||||
|
sql use db;
|
||||||
|
sql create table stb1(ts timestamp, c_int int, c_bint bigint, c_sint smallint, c_tint tinyint,c_float float, c_double double, c_bool bool,c_binary binary(16), c_nchar nchar(32), c_ts timestamp,c_tint_un tinyint unsigned, c_sint_un smallint unsigned,c_int_un int unsigned, c_bint_un bigint unsigned) tags (t_int int);
|
||||||
|
|
||||||
|
sql create table ct1 using stb1 tags ( 1 );
|
||||||
|
sql create table ct2 using stb1 tags ( 2 );
|
||||||
|
sql create table ct3 using stb1 tags ( 3 );
|
||||||
|
sql create table ct4 using stb1 tags ( 4 );
|
||||||
|
|
||||||
|
sql CREATE SMA INDEX sma_index_1 ON stb1 function(min(c_int), max(c_int)) interval(6m, 10s) sliding(6m) watermark 5s;
|
||||||
|
sql CREATE SMA INDEX sma_index_2 ON stb1 function(min(c_int), max(c_int)) interval(6m, 10s) sliding(6m) max_delay 6m;
|
||||||
|
sql CREATE SMA INDEX sma_index_3 ON stb1 function(min(c_int), max(c_int)) interval(6m, 10s) watermark 5s max_delay 6m;
|
||||||
|
|
||||||
|
sql DROP INDEX sma_index_1 ;
|
||||||
|
sql DROP INDEX sma_index_2 ;
|
||||||
|
sql DROP INDEX sma_index_3 ;
|
||||||
|
|
||||||
|
print ========== step8
|
||||||
|
sql drop database if exists db;
|
||||||
|
sql create database db duration 300;
|
||||||
|
sql use db;
|
||||||
|
sql create table stb1(ts timestamp, c_int int, c_bint bigint, c_sint smallint, c_tint tinyint,c_float float, c_double double, c_bool bool,c_binary binary(16), c_nchar nchar(32), c_ts timestamp,c_tint_un tinyint unsigned, c_sint_un smallint unsigned,c_int_un int unsigned, c_bint_un bigint unsigned) tags (t_int int);
|
||||||
|
|
||||||
|
sql create table ct1 using stb1 tags ( 1 );
|
||||||
|
sql create table ct2 using stb1 tags ( 2 );
|
||||||
|
sql create table ct3 using stb1 tags ( 3 );
|
||||||
|
sql create table ct4 using stb1 tags ( 4 );
|
||||||
|
|
||||||
|
sql CREATE SMA INDEX sma_index_1 ON stb1 function(min(c_int), max(c_int)) interval(6m, 10s) sliding(6m) watermark 5s;
|
||||||
|
sql CREATE SMA INDEX sma_index_2 ON stb1 function(min(c_int), max(c_int)) interval(6m, 10s) sliding(6m) max_delay 6m;
|
||||||
|
sql CREATE SMA INDEX sma_index_3 ON stb1 function(min(c_int), max(c_int)) interval(6m, 10s) watermark 5s max_delay 6m;
|
||||||
|
|
||||||
|
sql DROP INDEX sma_index_1 ;
|
||||||
|
sql DROP INDEX sma_index_2 ;
|
||||||
|
sql DROP INDEX sma_index_3 ;
|
||||||
|
|
||||||
|
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||||
|
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
||||||
|
system sh/exec.sh -n dnode3 -s stop -x SIGINT
|
||||||
|
system sh/exec.sh -n dnode4 -s stop -x SIGINT
|
|
@ -710,6 +710,11 @@ sleep 200
|
||||||
|
|
||||||
sql select * from streamt4;
|
sql select * from streamt4;
|
||||||
|
|
||||||
|
$loop_count = $loop_count + 1
|
||||||
|
if $loop_count == 10 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
# row 0
|
# row 0
|
||||||
if $rows != 0 then
|
if $rows != 0 then
|
||||||
print =====rows=$rows
|
print =====rows=$rows
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
system sh/stop_dnodes.sh
|
||||||
|
system sh/deploy.sh -n dnode1 -i 1
|
||||||
|
system sh/cfg.sh -n dnode1 -c debugflag -v 131
|
||||||
|
system sh/exec.sh -n dnode1 -s start -v
|
||||||
|
|
||||||
|
sleep 5000
|
||||||
|
|
||||||
|
sql connect
|
||||||
|
|
||||||
|
print ========== interval\session\state window
|
||||||
|
|
||||||
|
sql CREATE DATABASE test1 BUFFER 96 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 STRICT 'off' WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0;
|
||||||
|
sql use test1;
|
||||||
|
sql CREATE STABLE st (time TIMESTAMP, ca DOUBLE, cb DOUBLE, cc int) TAGS (ta VARCHAR(10) );
|
||||||
|
|
||||||
|
print ========== create table before stream
|
||||||
|
|
||||||
|
sql CREATE TABLE t1 using st TAGS ('aaa');
|
||||||
|
sql CREATE TABLE t2 using st TAGS ('bbb');
|
||||||
|
sql CREATE TABLE t3 using st TAGS ('ccc');
|
||||||
|
sql CREATE TABLE t4 using st TAGS ('ddd');
|
||||||
|
|
||||||
|
sql create stream streamd1 into streamt1 as select ca, _wstart,_wend, count(*) from st where time > "2022-01-01 00:00:00" and time < "2032-01-01 00:00:00" partition by ca interval(60m) fill(linear);
|
||||||
|
sql create stream streamd2 into streamt2 as select tbname, _wstart,_wend, count(*) from st where time > "2022-01-01 00:00:00" and time < "2032-01-01 00:00:00" partition by tbname interval(60m) fill(linear);
|
||||||
|
|
||||||
|
sql create stream streamd3 into streamt3 as select ca, _wstart,_wend, count(*), max(ca), min(cb), APERCENTILE(cc, 20) from st where time > "2022-01-01 00:00:00" and time < "2032-01-01 00:00:00" partition by ca session(time, 60m);
|
||||||
|
sql create stream streamd4 into streamt4 as select tbname, _wstart,_wend, count(*), max(ca), min(cb), APERCENTILE(cc, 20) from st where time > "2022-01-01 00:00:00" and time < "2032-01-01 00:00:00" partition by tbname session(time, 60m);
|
||||||
|
|
||||||
|
sql create stream streamd5 into streamt5 as select tbname, _wstart,_wend, count(*), max(ca), min(cb) from st where time > "2022-01-01 00:00:00" and time < "2032-01-01 00:00:00" partition by tbname state_window(cc);
|
||||||
|
sql create stream streamd6 into streamt6 as select ca, _wstart,_wend, count(*), max(ca), min(cb) from t1 where time > "2022-01-01 00:00:00" and time < "2032-01-01 00:00:00" partition by ca state_window(cc);
|
||||||
|
|
||||||
|
sleep 3000
|
||||||
|
|
||||||
|
sql drop stream if exists streamd1;
|
||||||
|
sql drop stream if exists streamd2;
|
||||||
|
sql drop stream if exists streamd3;
|
||||||
|
sql drop stream if exists streamd4;
|
||||||
|
sql drop stream if exists streamd5;
|
||||||
|
sql drop stream if exists streamd6;
|
||||||
|
|
||||||
|
|
||||||
|
_OVER:
|
||||||
|
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||||
|
print =============== check
|
||||||
|
$null=
|
||||||
|
|
||||||
|
system_content sh/checkValgrind.sh -n dnode1
|
||||||
|
print cmd return result ----> [ $system_content ]
|
||||||
|
if $system_content > 0 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $system_content == $null then
|
||||||
|
return -1
|
||||||
|
endi
|
|
@ -4,7 +4,7 @@ looptest:
|
||||||
system sh/stop_dnodes.sh
|
system sh/stop_dnodes.sh
|
||||||
system sh/deploy.sh -n dnode1 -i 1
|
system sh/deploy.sh -n dnode1 -i 1
|
||||||
system sh/exec.sh -n dnode1 -s start
|
system sh/exec.sh -n dnode1 -s start
|
||||||
#==system sh/exec.sh -n dnode1 -s start -v
|
|
||||||
sleep 200
|
sleep 200
|
||||||
sql connect
|
sql connect
|
||||||
|
|
||||||
|
|
|
@ -201,31 +201,39 @@ system sh/exec.sh -n dnode2 -s start
|
||||||
sleep 3000
|
sleep 3000
|
||||||
|
|
||||||
print ======== step6
|
print ======== step6
|
||||||
sql select count(*) from db1.tb1
|
$y = 0
|
||||||
|
step6:
|
||||||
|
$y = $y + 1
|
||||||
|
sleep 1000
|
||||||
|
if $y == 50 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
sql select count(*) from db1.tb1 -x step6
|
||||||
print select count(*) from db1.tb1 ==> $data00 $lastRows1
|
print select count(*) from db1.tb1 ==> $data00 $lastRows1
|
||||||
if $data00 <= $lastRows1 then
|
if $data00 <= $lastRows1 then
|
||||||
return -1
|
goto step6
|
||||||
endi
|
endi
|
||||||
$lastRows1 = $data00
|
$lastRows1 = $data00
|
||||||
|
|
||||||
sql select count(*) from db2.tb2
|
sql select count(*) from db2.tb2 -x step6
|
||||||
print select count(*) from db2.tb2 ==> $data00 $lastRows2
|
print select count(*) from db2.tb2 ==> $data00 $lastRows2
|
||||||
if $data00 <= $lastRows2 then
|
if $data00 <= $lastRows2 then
|
||||||
return -1
|
goto step6
|
||||||
endi
|
endi
|
||||||
$lastRows2 = $data00
|
$lastRows2 = $data00
|
||||||
|
|
||||||
sql select count(*) from db3.tb3
|
sql select count(*) from db3.tb3 -x step6
|
||||||
print select count(*) from db3.tb3 ==> $data00 $lastRows3
|
print select count(*) from db3.tb3 ==> $data00 $lastRows3
|
||||||
if $data00 <= $lastRows3 then
|
if $data00 <= $lastRows3 then
|
||||||
return -1
|
goto step6
|
||||||
endi
|
endi
|
||||||
$lastRows3 = $data00
|
$lastRows3 = $data00
|
||||||
|
|
||||||
sql select count(*) from db4.tb4
|
sql select count(*) from db4.tb4 -x step6
|
||||||
print select count(*) from db4.tb4 ==> $data00 $lastRows4
|
print select count(*) from db4.tb4 ==> $data00 $lastRows4
|
||||||
if $data00 <= $lastRows4 then
|
if $data00 <= $lastRows4 then
|
||||||
return -1
|
goto step6
|
||||||
endi
|
endi
|
||||||
$lastRows4 = $data00
|
$lastRows4 = $data00
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,183 @@
|
||||||
|
###################################################################
|
||||||
|
# Copyright (c) 2016 by TAOS Technologies, Inc.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# This file is proprietary and confidential to TAOS Technologies.
|
||||||
|
# No part of this file may be reproduced, stored, transmitted,
|
||||||
|
# disclosed or used in any form or by any means other than as
|
||||||
|
# expressly provided by the written permission from Jianhui Tao
|
||||||
|
#
|
||||||
|
###################################################################
|
||||||
|
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
|
||||||
|
import math
|
||||||
|
from random import randint
|
||||||
|
from util.log import *
|
||||||
|
from util.cases import *
|
||||||
|
from util.sql import *
|
||||||
|
from util.common import *
|
||||||
|
from util.sqlset import *
|
||||||
|
from util.boundary import *
|
||||||
|
|
||||||
|
class TDTestCase:
|
||||||
|
def init(self, conn, logSql, replicaVar=1):
|
||||||
|
self.replicaVar = int(replicaVar)
|
||||||
|
tdLog.debug("start to execute %s" % __file__)
|
||||||
|
tdSql.init(conn.cursor())
|
||||||
|
self.boundary = DataBoundary()
|
||||||
|
self.dbname_length_boundary = self.boundary.DBNAME_MAX_LENGTH
|
||||||
|
self.tbname_length_boundary = self.boundary.TBNAME_MAX_LENGTH
|
||||||
|
self.stbname_length_boundary = self.boundary.STBNAME_MAX_LENGTH
|
||||||
|
self.colname_length_boundary = self.boundary.COL_KEY_MAX_LENGTH
|
||||||
|
self.tagname_length_boundary = self.boundary.TAG_KEY_MAX_LENGTH
|
||||||
|
self.username_length_boundary = 23
|
||||||
|
self.password_length_boundary = 128
|
||||||
|
def dbname_length_check(self):
|
||||||
|
dbname_length = randint(1,self.dbname_length_boundary-1)
|
||||||
|
for dbname in [tdCom.get_long_name(self.dbname_length_boundary),tdCom.get_long_name(dbname_length)]:
|
||||||
|
tdSql.execute(f'create database if not exists {dbname}')
|
||||||
|
tdSql.query(f'select name from information_schema.ins_databases where name = "{dbname}"')
|
||||||
|
tdSql.checkEqual(tdSql.queryResult[0][0],dbname)
|
||||||
|
tdSql.execute(f'drop database if exists {dbname}')
|
||||||
|
dbname = tdCom.get_long_name(self.dbname_length_boundary+1)
|
||||||
|
tdSql.error(f'create database if not exists {dbname}')
|
||||||
|
if "Invalid identifier name" in tdSql.error_info:
|
||||||
|
tdLog.info("error info is true!")
|
||||||
|
else:
|
||||||
|
tdLog.exit("error info is not true")
|
||||||
|
|
||||||
|
def tbname_length_check(self):
|
||||||
|
tdSql.prepare()
|
||||||
|
tdSql.execute('use db')
|
||||||
|
tbname_length = randint(1,self.tbname_length_boundary-1)
|
||||||
|
tdSql.execute(f'create table stb (ts timestamp,c0 int) tags(t0 int)')
|
||||||
|
for tbname in [tdCom.get_long_name(self.tbname_length_boundary),tdCom.get_long_name(tbname_length)]:
|
||||||
|
tdSql.execute(f'create table {tbname} using stb tags(1)')
|
||||||
|
tdSql.query(f'select table_name from information_schema.ins_tables where table_name = "{tbname}"')
|
||||||
|
tdSql.checkEqual(tdSql.queryResult[0][0],tbname)
|
||||||
|
tdSql.execute(f'drop table {tbname}')
|
||||||
|
tbname = tdCom.get_long_name(self.tbname_length_boundary+1)
|
||||||
|
tdSql.error(f'create table {tbname} using stb tags(1)')
|
||||||
|
if "Invalid identifier name" in tdSql.error_info:
|
||||||
|
tdLog.info("error info is true!")
|
||||||
|
else:
|
||||||
|
tdLog.exit("error info is not true")
|
||||||
|
stbname_length = randint(1,self.stbname_length_boundary-1)
|
||||||
|
for stbname in [tdCom.get_long_name(self.stbname_length_boundary),tdCom.get_long_name(stbname_length)]:
|
||||||
|
tdSql.execute(f'create table {stbname} (ts timestamp,c0 int) tags(t0 int)')
|
||||||
|
tdSql.query(f'select stable_name from information_schema.ins_stables where stable_name = "{stbname}"')
|
||||||
|
tdSql.checkEqual(tdSql.queryResult[0][0],stbname)
|
||||||
|
tdSql.execute(f'drop table {stbname}')
|
||||||
|
stbname = tdCom.get_long_name(self.stbname_length_boundary+1)
|
||||||
|
tdSql.error(f'create table {stbname} (ts timestamp,c0 int) tags(t0 int)')
|
||||||
|
print(tdSql.error_info)
|
||||||
|
if "Invalid identifier name" in tdSql.error_info:
|
||||||
|
tdLog.info("error info is true!")
|
||||||
|
else:
|
||||||
|
tdLog.exit("error info is not true")
|
||||||
|
tdSql.execute('drop database db')
|
||||||
|
|
||||||
|
def colname_length_check(self):
|
||||||
|
tdSql.prepare()
|
||||||
|
tdSql.execute('use db')
|
||||||
|
column_name_length = randint(1,self.colname_length_boundary-1)
|
||||||
|
for colname in [tdCom.get_long_name(column_name_length),tdCom.get_long_name(self.colname_length_boundary)]:
|
||||||
|
stbname = tdCom.get_long_name(3)
|
||||||
|
ntbname = tdCom.get_long_name(4)
|
||||||
|
tdSql.execute(f'create table {stbname} (ts timestamp,{colname} int) tags(t0 int)')
|
||||||
|
tdSql.query(f'describe {stbname}')
|
||||||
|
tdSql.checkEqual(tdSql.queryResult[1][0],colname)
|
||||||
|
tdSql.execute(f'create table {ntbname} (ts timestamp,{colname} int)')
|
||||||
|
tdSql.query(f'describe {ntbname}')
|
||||||
|
tdSql.checkEqual(tdSql.queryResult[1][0],colname)
|
||||||
|
colname = tdCom.get_long_name(self.colname_length_boundary+1)
|
||||||
|
tdSql.error(f'create table stb (ts timestamp,{colname} int) tags(t0 int)')
|
||||||
|
if "Invalid identifier name" in tdSql.error_info:
|
||||||
|
tdLog.info("error info is true!")
|
||||||
|
else:
|
||||||
|
tdLog.exit("error info is not true")
|
||||||
|
tdSql.execute('drop database db')
|
||||||
|
|
||||||
|
def tagname_length_check(self):
|
||||||
|
tdSql.prepare()
|
||||||
|
tdSql.execute('use db')
|
||||||
|
tag_name_length = randint(1,self.tagname_length_boundary-1)
|
||||||
|
for tagname in (tdCom.get_long_name(tag_name_length),tdCom.get_long_name(self.tagname_length_boundary)):
|
||||||
|
stbname = tdCom.get_long_name(3)
|
||||||
|
tdSql.execute(f'create table {stbname} (ts timestamp,c0 int) tags({tagname} int)')
|
||||||
|
tdSql.query(f'describe {stbname}')
|
||||||
|
tdSql.checkEqual(tdSql.queryResult[-1][0],tagname)
|
||||||
|
tagname = tdCom.get_long_name(self.tagname_length_boundary+1)
|
||||||
|
tdSql.error(f'create table {stbname} (ts timestamp,c0 int) tags({tagname} int)')
|
||||||
|
if "Invalid identifier name" in tdSql.error_info:
|
||||||
|
tdLog.info("error info is true!")
|
||||||
|
else:
|
||||||
|
tdLog.exit("error info is not true")
|
||||||
|
tdSql.execute('drop database db')
|
||||||
|
|
||||||
|
def username_length_check(self):
|
||||||
|
username_length = randint(1,self.username_length_boundary-1)
|
||||||
|
for username in [tdCom.get_long_name(username_length),tdCom.get_long_name(self.username_length_boundary)]:
|
||||||
|
tdSql.execute(f'create user {username} pass "123"')
|
||||||
|
tdSql.query('show users')
|
||||||
|
for user in tdSql.queryResult:
|
||||||
|
if user[0].lower() != 'root':
|
||||||
|
tdSql.checkEqual(user[0],username)
|
||||||
|
tdSql.execute(f'drop user {username}')
|
||||||
|
username = tdCom.get_long_name(self.username_length_boundary+1)
|
||||||
|
tdSql.error(f'create user {username} pass "123"')
|
||||||
|
if "Name or password too long" in tdSql.error_info:
|
||||||
|
tdLog.info("error info is true!")
|
||||||
|
else:
|
||||||
|
tdLog.exit("error info is not true")
|
||||||
|
|
||||||
|
def password_length_check(self):
|
||||||
|
password_length = randint(1,self.password_length_boundary-1)
|
||||||
|
for password in [tdCom.get_long_name(password_length),tdCom.get_long_name(self.password_length_boundary)]:
|
||||||
|
username = tdCom.get_long_name(3)
|
||||||
|
tdSql.execute(f'create user {username} pass "{password}"')
|
||||||
|
password = tdCom.get_long_name(self.password_length_boundary+1)
|
||||||
|
tdSql.error(f'create user {username} pass "{password}"')
|
||||||
|
if "Name or password too long" in tdSql.error_info:
|
||||||
|
tdLog.info("error info is true!")
|
||||||
|
else:
|
||||||
|
tdLog.exit("error info is not true")
|
||||||
|
def sql_length_check(self):
|
||||||
|
insert_rows = 1021
|
||||||
|
tdSql.prepare()
|
||||||
|
tdSql.execute('use db')
|
||||||
|
tdSql.execute('create table ntb (ts timestamp,c0 binary(1013))')
|
||||||
|
values_sql = ''
|
||||||
|
value = tdCom.get_long_name(1013)
|
||||||
|
for num in range(insert_rows):
|
||||||
|
values_sql += f' (now+{num}s,"{value}")'
|
||||||
|
value = tdCom.get_long_name(65)
|
||||||
|
values_sql += f"(now-1s,'{value}')"
|
||||||
|
tdSql.execute(f'insert into ntb values{values_sql}')
|
||||||
|
tdSql.query('select * from ntb')
|
||||||
|
tdSql.checkRows(insert_rows+1)
|
||||||
|
tdSql.execute('create table ntb1 (ts timestamp,c0 binary(1013))')
|
||||||
|
tdSql.error(f'insert into ntb1 values{values_sql};')
|
||||||
|
print(tdSql.error_info)
|
||||||
|
if "SQL statement too long" in tdSql.error_info:
|
||||||
|
tdLog.info("error info is true!")
|
||||||
|
else:
|
||||||
|
tdLog.exit("error info is not true")
|
||||||
|
tdSql.execute('drop database db')
|
||||||
|
def run(self):
|
||||||
|
self.dbname_length_check()
|
||||||
|
self.tbname_length_check()
|
||||||
|
self.colname_length_check()
|
||||||
|
self.tagname_length_check()
|
||||||
|
self.username_length_check()
|
||||||
|
self.password_length_check()
|
||||||
|
self.sql_length_check()
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
tdSql.close()
|
||||||
|
tdLog.success("%s successfully executed" % __file__)
|
||||||
|
|
||||||
|
tdCases.addWindows(__file__, TDTestCase())
|
||||||
|
tdCases.addLinux(__file__, TDTestCase())
|
|
@ -23,7 +23,7 @@ class TDTestCase:
|
||||||
def init(self, conn, logSql, replicaVar=1):
|
def init(self, conn, logSql, replicaVar=1):
|
||||||
self.replicaVar = int(replicaVar)
|
self.replicaVar = int(replicaVar)
|
||||||
tdLog.debug("start to execute %s" % __file__)
|
tdLog.debug("start to execute %s" % __file__)
|
||||||
tdSql.init(conn.cursor(),logSql)
|
tdSql.init(conn.cursor())
|
||||||
self.setsql = TDSetSql()
|
self.setsql = TDSetSql()
|
||||||
self.dbname = 'db_test'
|
self.dbname = 'db_test'
|
||||||
self.ntbname = 'ntb'
|
self.ntbname = 'ntb'
|
||||||
|
|
|
@ -204,18 +204,12 @@ class TDTestCase:
|
||||||
row_check.append(elem)
|
row_check.append(elem)
|
||||||
auto_result.append(row_check)
|
auto_result.append(row_check)
|
||||||
|
|
||||||
check_status = True
|
|
||||||
|
tdSql.query(abs_query)
|
||||||
for row_index, row in enumerate(abs_result):
|
for row_index, row in enumerate(abs_result):
|
||||||
for col_index, elem in enumerate(row):
|
for col_index, elem in enumerate(row):
|
||||||
if auto_result[row_index][col_index] != elem:
|
tdSql.checkData(row_index,col_index,auto_result[row_index][col_index])
|
||||||
check_status = False
|
|
||||||
if not check_status:
|
|
||||||
tdLog.notice(
|
|
||||||
"abs function value has not as expected , sql is \"%s\" " % abs_query)
|
|
||||||
sys.exit(1)
|
|
||||||
else:
|
|
||||||
tdLog.info(
|
|
||||||
"abs value check pass , it work as expected ,sql is \"%s\" " % abs_query)
|
|
||||||
|
|
||||||
def test_errors(self):
|
def test_errors(self):
|
||||||
dbname = "testdb"
|
dbname = "testdb"
|
||||||
|
@ -466,19 +460,19 @@ class TDTestCase:
|
||||||
)
|
)
|
||||||
tdSql.execute(f'create table {dbname}.sub1_bound using {dbname}.stb_bound tags ( 1 )')
|
tdSql.execute(f'create table {dbname}.sub1_bound using {dbname}.stb_bound tags ( 1 )')
|
||||||
tdSql.execute(
|
tdSql.execute(
|
||||||
f"insert into {dbname}.sub1_bound values ( now()-1s, 2147483647, 9223372036854775807, 32767, 127, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
|
f"insert into {dbname}.sub1_bound values ( now()-10s, 2147483647, 9223372036854775807, 32767, 127, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
|
||||||
)
|
)
|
||||||
tdSql.execute(
|
tdSql.execute(
|
||||||
f"insert into {dbname}.sub1_bound values ( now()-1s, -2147483647, -9223372036854775807, -32767, -127, -3.40E+38, -1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
|
f"insert into {dbname}.sub1_bound values ( now()-5s, -2147483647, -9223372036854775807, -32767, -127, -3.40E+38, -1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
|
||||||
)
|
)
|
||||||
tdSql.execute(
|
tdSql.execute(
|
||||||
f"insert into {dbname}.sub1_bound values ( now(), 2147483646, 9223372036854775806, 32766, 126, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
|
f"insert into {dbname}.sub1_bound values ( now(), 2147483646, 9223372036854775806, 32766, 126, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
|
||||||
)
|
)
|
||||||
tdSql.execute(
|
tdSql.execute(
|
||||||
f"insert into {dbname}.sub1_bound values ( now(), -2147483646, -9223372036854775806, -32766, -126, -3.40E+38, -1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
|
f"insert into {dbname}.sub1_bound values ( now()+5s, -2147483646, -9223372036854775806, -32766, -126, -3.40E+38, -1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
|
||||||
)
|
)
|
||||||
tdSql.error(
|
tdSql.error(
|
||||||
f"insert into {dbname}.sub1_bound values ( now()+1s, 2147483648, 9223372036854775808, 32768, 128, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
|
f"insert into {dbname}.sub1_bound values ( now()+10s, 2147483648, 9223372036854775808, 32768, 128, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
|
||||||
)
|
)
|
||||||
self.check_result_auto(f"select c1, c2, c3 , c4, c5 ,c6 from {dbname}.sub1_bound ",
|
self.check_result_auto(f"select c1, c2, c3 , c4, c5 ,c6 from {dbname}.sub1_bound ",
|
||||||
f"select abs(c1), abs(c2) ,abs(c3), abs(c4), abs(c5) ,abs(c6) from {dbname}.sub1_bound")
|
f"select abs(c1), abs(c2) ,abs(c3), abs(c4), abs(c5) ,abs(c6) from {dbname}.sub1_bound")
|
||||||
|
|
|
@ -426,19 +426,19 @@ class TDTestCase:
|
||||||
)
|
)
|
||||||
tdSql.execute(f'create table {dbname}.sub1_bound using {dbname}.stb_bound tags ( 1 )')
|
tdSql.execute(f'create table {dbname}.sub1_bound using {dbname}.stb_bound tags ( 1 )')
|
||||||
tdSql.execute(
|
tdSql.execute(
|
||||||
f"insert into {dbname}.sub1_bound values ( now()-1s, 2147483647, 9223372036854775807, 32767, 127, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
|
f"insert into {dbname}.sub1_bound values ( now()-10s, 2147483647, 9223372036854775807, 32767, 127, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
|
||||||
)
|
)
|
||||||
tdSql.execute(
|
tdSql.execute(
|
||||||
f"insert into {dbname}.sub1_bound values ( now()-1s, -2147483647, -9223372036854775807, -32767, -127, -3.40E+38, -1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
|
f"insert into {dbname}.sub1_bound values ( now()-5s, -2147483647, -9223372036854775807, -32767, -127, -3.40E+38, -1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
|
||||||
)
|
)
|
||||||
tdSql.execute(
|
tdSql.execute(
|
||||||
f"insert into {dbname}.sub1_bound values ( now(), 2147483646, 9223372036854775806, 32766, 126, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
|
f"insert into {dbname}.sub1_bound values ( now(), 2147483646, 9223372036854775806, 32766, 126, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
|
||||||
)
|
)
|
||||||
tdSql.execute(
|
tdSql.execute(
|
||||||
f"insert into {dbname}.sub1_bound values ( now(), -2147483646, -9223372036854775806, -32766, -126, -3.40E+38, -1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
|
f"insert into {dbname}.sub1_bound values ( now()+5s, -2147483646, -9223372036854775806, -32766, -126, -3.40E+38, -1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
|
||||||
)
|
)
|
||||||
tdSql.error(
|
tdSql.error(
|
||||||
f"insert into {dbname}.sub1_bound values ( now()+1s, 2147483648, 9223372036854775808, 32768, 128, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
|
f"insert into {dbname}.sub1_bound values ( now()+10s, 2147483648, 9223372036854775808, 32768, 128, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
|
||||||
)
|
)
|
||||||
self.check_function("&", False , f"{dbname}.sub1_bound" ,"c1","c2","c3","c4","c5","c6" )
|
self.check_function("&", False , f"{dbname}.sub1_bound" ,"c1","c2","c3","c4","c5","c6" )
|
||||||
self.check_function("&", False , f"{dbname}.sub1_bound","abs(c1)","abs(c2)","abs(c3)","abs(c4)","abs(c5)","abs(c6)" )
|
self.check_function("&", False , f"{dbname}.sub1_bound","abs(c1)","abs(c2)","abs(c3)","abs(c4)","abs(c5)","abs(c6)" )
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue