diff --git a/CMakeLists.txt b/CMakeLists.txt
index be97e679d1..e0d6e82923 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -17,6 +17,7 @@ SET(TD_MQTT FALSE)
SET(TD_TSDB_PLUGINS FALSE)
SET(TD_STORAGE FALSE)
SET(TD_TOPIC FALSE)
+SET(TD_MODULE FALSE)
SET(TD_COVER FALSE)
SET(TD_MEM_CHECK FALSE)
diff --git a/Jenkinsfile b/Jenkinsfile
index d96eeaa724..433b46067a 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -6,6 +6,7 @@ node {
}
def skipstage=0
+
def abortPreviousBuilds() {
def currentJobName = env.JOB_NAME
def currentBuildNumber = env.BUILD_NUMBER.toInteger()
@@ -24,7 +25,7 @@ def abortPreviousBuilds() {
build.doKill() //doTerm(),doKill(),doTerm()
}
}
-//abort previous build
+// abort previous build
abortPreviousBuilds()
def abort_previous(){
def buildNumber = env.BUILD_NUMBER as int
@@ -32,19 +33,20 @@ def abort_previous(){
milestone(buildNumber)
}
def pre_test(){
-
+
+
sh '''
sudo rmtaos || echo "taosd has not installed"
'''
sh '''
-
+ killall -9 taosd ||echo "no taosd running"
+ killall -9 gdb || echo "no gdb running"
cd ${WKC}
git checkout develop
git reset --hard HEAD~10 >/dev/null
git pull >/dev/null
git fetch origin +refs/pull/${CHANGE_ID}/merge
git checkout -qf FETCH_HEAD
- git --no-pager diff --name-only FETCH_HEAD $(git merge-base FETCH_HEAD develop)|grep -v -E '.*md|//src//connector|Jenkinsfile'
find ${WKC}/tests/pytest -name \'*\'.sql -exec rm -rf {} \\;
cd ${WK}
git reset --hard HEAD~10
@@ -79,6 +81,10 @@ pipeline {
changeRequest()
}
steps {
+ script{
+ abort_previous()
+ abortPreviousBuilds()
+ }
sh'''
cp -r ${WORKSPACE} ${WORKSPACE}.tes
cd ${WORKSPACE}.tes
@@ -179,6 +185,14 @@ pipeline {
rm -rf /var/log/taos/*
./handle_crash_gen_val_log.sh
'''
+ catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
+ sh '''
+ cd ${WKC}/tests/pytest
+ rm -rf /var/lib/taos/*
+ rm -rf /var/log/taos/*
+ ./handle_taosd_val_log.sh
+ '''
+ }
timeout(time: 45, unit: 'MINUTES'){
sh '''
date
@@ -209,6 +223,11 @@ pipeline {
cd ${WKC}/tests
./test-all.sh b3fq
date'''
+ sh '''
+ date
+ cd ${WKC}/tests
+ ./test-all.sh full example
+ date'''
}
}
}
@@ -266,7 +285,7 @@ pipeline {
date
cd ${WKC}/tests
./test-all.sh b7fq
- date'''
+ date'''
}
}
}
diff --git a/README-CN.md b/README-CN.md
index 9601cde3af..d4c10e71d6 100644
--- a/README-CN.md
+++ b/README-CN.md
@@ -258,10 +258,16 @@ TDengine 社区生态中也有一些非常友好的第三方连接器,可以
TDengine 的测试框架和所有测试例全部开源。
-点击[这里](tests/How-To-Run-Test-And-How-To-Add-New-Test-Case.md),了解如何运行测试例和添加新的测试例。
+点击 [这里](tests/How-To-Run-Test-And-How-To-Add-New-Test-Case.md),了解如何运行测试例和添加新的测试例。
# 成为社区贡献者
-点击[这里](https://www.taosdata.com/cn/contributor/),了解如何成为 TDengine 的贡献者。
-#加入技术交流群
-TDengine官方社群「物联网大数据群」对外开放,欢迎您加入讨论。搜索微信号 "tdengine",加小T为好友,即可入群。
+点击 [这里](https://www.taosdata.com/cn/contributor/),了解如何成为 TDengine 的贡献者。
+
+# 加入技术交流群
+
+TDengine 官方社群「物联网大数据群」对外开放,欢迎您加入讨论。搜索微信号 "tdengine",加小T为好友,即可入群。
+
+# [谁在使用TDengine](https://github.com/taosdata/TDengine/issues/2432)
+
+欢迎所有 TDengine 用户及贡献者在 [这里](https://github.com/taosdata/TDengine/issues/2432) 分享您在当前工作中开发/使用 TDengine 的故事。
diff --git a/README.md b/README.md
index 79c140c741..45a955f458 100644
--- a/README.md
+++ b/README.md
@@ -250,3 +250,6 @@ Please follow the [contribution guidelines](CONTRIBUTING.md) to contribute to th
Add WeChat “tdengine” to join the group,you can communicate with other users.
+# [User List](https://github.com/taosdata/TDengine/issues/2432)
+
+If you are using TDengine and feel it helps or you'd like to do some contributions, please add your company to [user list](https://github.com/taosdata/TDengine/issues/2432) and let us know your needs.
diff --git a/cmake/define.inc b/cmake/define.inc
index ff4583d02b..6f49630d5c 100755
--- a/cmake/define.inc
+++ b/cmake/define.inc
@@ -29,6 +29,10 @@ IF (TD_TOPIC)
ADD_DEFINITIONS(-D_TOPIC)
ENDIF ()
+IF (TD_MODULE)
+ ADD_DEFINITIONS(-D_MODULE)
+ENDIF ()
+
IF (TD_GODLL)
ADD_DEFINITIONS(-D_TD_GO_DLL_)
ENDIF ()
diff --git a/cmake/input.inc b/cmake/input.inc
index b1a993c996..00e0e1bc0f 100755
--- a/cmake/input.inc
+++ b/cmake/input.inc
@@ -17,6 +17,14 @@ ELSEIF (${TOPIC} MATCHES "false")
MESSAGE(STATUS "Build without topic plugins")
ENDIF ()
+IF (${TD_MODULE} MATCHES "true")
+ SET(TD_MODULE TRUE)
+ MESSAGE(STATUS "Build with module plugins")
+ELSEIF (${TOPIC} MATCHES "false")
+ SET(TD_MODULE FALSE)
+ MESSAGE(STATUS "Build without module plugins")
+ENDIF ()
+
IF (${COVER} MATCHES "true")
SET(TD_COVER TRUE)
MESSAGE(STATUS "Build with test coverage")
diff --git a/documentation20/cn/00.index/docs.md b/documentation20/cn/00.index/docs.md
index c16673cba5..aba10a14e3 100644
--- a/documentation20/cn/00.index/docs.md
+++ b/documentation20/cn/00.index/docs.md
@@ -120,7 +120,7 @@ TDengine是一个高效的存储、查询、分析时序大数据的平台,专
* [TDengine性能对比测试工具](https://www.taosdata.com/blog/2020/01/18/1166.html)
* [IDEA数据库管理工具可视化使用TDengine](https://www.taosdata.com/blog/2020/08/27/1767.html)
* [基于eletron开发的跨平台TDengine图形化管理工具](https://github.com/skye0207/TDengineGUI)
-* [DataX,支持TDengine的离线数据采集/同步工具](https://github.com/alibaba/DataX)
+* [DataX,支持TDengine的离线数据采集/同步工具](https://github.com/wgzhao/DataX)(文档:[读取插件](https://github.com/wgzhao/DataX/blob/master/docs/src/main/sphinx/reader/tdenginereader.md)、[写入插件](https://github.com/wgzhao/DataX/blob/master/docs/src/main/sphinx/writer/tdenginewriter.md))
## TDengine与其他数据库的对比测试
diff --git a/documentation20/cn/02.getting-started/docs.md b/documentation20/cn/02.getting-started/docs.md
index c9c82942f3..f86e616c42 100644
--- a/documentation20/cn/02.getting-started/docs.md
+++ b/documentation20/cn/02.getting-started/docs.md
@@ -179,18 +179,18 @@ taos> select avg(f1), max(f2), min(f3) from test.t10 interval(10s);
### TDengine服务器支持的平台列表
-| | **CentOS** **6/7/8** | **Ubuntu** **16/18/20** | **Other Linux** | **统信****UOS** | **银河****/****中标麒麟** | **凝思** **V60/V80** |
+| | **CentOS 6/7/8** | **Ubuntu 16/18/20** | **Other Linux** | **统信 UOS** | **银河/中标麒麟** | **凝思 V60/V80** |
| -------------- | --------------------- | ------------------------ | --------------- | --------------- | ------------------------- | --------------------- |
| X64 | ● | ● | | ○ | ● | ● |
-| 树莓派ARM32 | | ● | ● | | | |
-| 龙芯MIPS64 | | | ● | | | |
-| 鲲鹏 ARM64 | | ○ | ○ | | ● | |
-| 申威 Alpha64 | | | ○ | ● | | |
-| 飞腾ARM64 | | ○优麒麟 | | | | |
-| 海光X64 | ● | ● | ● | ○ | ● | ● |
-| 瑞芯微ARM64/32 | | | ○ | | | |
-| 全志ARM64/32 | | | ○ | | | |
-| 炬力ARM64/32 | | | ○ | | | |
+| 树莓派 ARM32 | | ● | ● | | | |
+| 龙芯 MIPS64 | | | ● | | | |
+| 鲲鹏 ARM64 | | ○ | ○ | | ● | |
+| 申威 Alpha64 | | | ○ | ● | | |
+| 飞腾 ARM64 | | ○ 优麒麟 | | | | |
+| 海光 X64 | ● | ● | ● | ○ | ● | ● |
+| 瑞芯微 ARM64/32 | | | ○ | | | |
+| 全志 ARM64/32 | | | ○ | | | |
+| 炬力 ARM64/32 | | | ○ | | | |
| TI ARM32 | | | ○ | | | |
注: ● 表示经过官方测试验证, ○ 表示非官方测试验证。
@@ -203,7 +203,7 @@ taos> select avg(f1), max(f2), min(f3) from test.t10 interval(10s);
对照矩阵如下:
-| **CPU** | **X64 64bit** | | | **X86 32bit** | **ARM64** | **ARM32** | **MIPS ** **龙芯** | **Alpha ** **申威** | **X64 ** **海光** |
+| **CPU** | **X64 64bit** | | | **X86 32bit** | **ARM64** | **ARM32** | **MIPS 龙芯** | **Alpha 申威** | **X64 海光** |
| ----------- | --------------- | --------- | --------- | --------------- | --------- | --------- | ------------------- | -------------------- | ------------------ |
| **OS** | **Linux** | **Win64** | **Win32** | **Win32** | **Linux** | **Linux** | **Linux** | **Linux** | **Linux** |
| **C/C++** | ● | ● | ● | ○ | ● | ● | ● | ● | ● |
diff --git a/documentation20/cn/08.connector/01.java/docs.md b/documentation20/cn/08.connector/01.java/docs.md
index 3ed7343579..30b485f9b6 100644
--- a/documentation20/cn/08.connector/01.java/docs.md
+++ b/documentation20/cn/08.connector/01.java/docs.md
@@ -471,9 +471,11 @@ TDengine 目前支持时间戳、数字、字符、布尔类型,与 Java 对
| BIGINT | java.lang.Long |
| FLOAT | java.lang.Float |
| DOUBLE | java.lang.Double |
-| SMALLINT, TINYINT | java.lang.Short |
+| SMALLINT | java.lang.Short |
+| TINYINT | java.lang.Byte |
| BOOL | java.lang.Boolean |
-| BINARY, NCHAR | java.lang.String |
+| BINARY | byte array |
+| NCHAR | java.lang.String |
diff --git a/documentation20/cn/10.cluster/docs.md b/documentation20/cn/10.cluster/docs.md
index 7b4073a883..a430ce8277 100644
--- a/documentation20/cn/10.cluster/docs.md
+++ b/documentation20/cn/10.cluster/docs.md
@@ -111,9 +111,10 @@ taos>
**提示:**
-- 任何已经加入集群在线的数据节点,都可以作为后续待加入节点的firstEP。
-- firstEp这个参数仅仅在该数据节点首次加入集群时有作用,加入集群后,该数据节点会保存最新的mnode的End Point列表,不再依赖这个参数。
-- 两个没有配置firstEp参数的数据节点dnode启动后,会独立运行起来。这个时候,无法将其中一个数据节点加入到另外一个数据节点,形成集群。**无法将两个独立的集群合并成为新的集群**。
+- 任何已经加入集群在线的数据节点,都可以作为后续待加入节点的 firstEP。
+- firstEp 这个参数仅仅在该数据节点首次加入集群时有作用,加入集群后,该数据节点会保存最新的 mnode 的 End Point 列表,不再依赖这个参数。
+ - 接下来,配置文件中的 firstEp 参数就主要在客户端连接的时候使用了,例如 taos shell 如果不加参数,会默认连接由 firstEp 指定的节点。
+- 两个没有配置 firstEp 参数的数据节点 dnode 启动后,会独立运行起来。这个时候,无法将其中一个数据节点加入到另外一个数据节点,形成集群。**无法将两个独立的集群合并成为新的集群**。
## 数据节点管理
diff --git a/documentation20/cn/11.administrator/docs.md b/documentation20/cn/11.administrator/docs.md
index 027828d903..c2c2927387 100644
--- a/documentation20/cn/11.administrator/docs.md
+++ b/documentation20/cn/11.administrator/docs.md
@@ -6,19 +6,27 @@
### 内存需求
-每个 DB 可以创建固定数目的 vgroup,默认与 CPU 核数相同,可通过 maxVgroupsPerDb 配置;vgroup 中的每个副本会是一个 vnode;每个 vnode 会占用固定大小的内存(大小与数据库的配置参数 blocks 和 cache 有关);每个 Table 会占用与标签总长度有关的内存;此外,系统会有一些固定的内存开销。因此,每个 DB 需要的系统内存可通过如下公式计算:
+每个 Database 可以创建固定数目的 vgroup,默认与 CPU 核数相同,可通过 maxVgroupsPerDb 配置;vgroup 中的每个副本会是一个 vnode;每个 vnode 会占用固定大小的内存(大小与数据库的配置参数 blocks 和 cache 有关);每个 Table 会占用与标签总长度有关的内存;此外,系统会有一些固定的内存开销。因此,每个 DB 需要的系统内存可通过如下公式计算:
```
-Memory Size = maxVgroupsPerDb * (blocks * cache + 10MB) + numOfTables * (tagSizePerTable + 0.5KB)
+Database Memory Size = maxVgroupsPerDb * (blocks * cache + 10MB) + numOfTables * (tagSizePerTable + 0.5KB)
```
-示例:假设是 4 核机器,cache 是缺省大小 16M, blocks 是缺省值 6,假设有 10 万张表,标签总长度是 256 字节,则总的内存需求为:4 \* (16 \* 6 + 10) + 100000 \* (0.25 + 0.5) / 1000 = 499M。
+示例:假设是 4 核机器,cache 是缺省大小 16M, blocks 是缺省值 6,并且一个 DB 中有 10 万张表,标签总长度是 256 字节,则这个 DB 总的内存需求为:4 \* (16 \* 6 + 10) + 100000 \* (0.25 + 0.5) / 1000 = 499M。
-注意:从这个公式计算得到的内存容量,应理解为系统的“必要需求”,而不是“内存总数”。在实际运行的生产系统中,由于操作系统缓存、资源管理调度等方面的需要,内存规划应当在计算结果的基础上保留一定冗余,以维持系统状态和系统性能的稳定性。
+在实际的系统运维中,我们通常会更关心 TDengine 服务进程(taosd)会占用的内存量。
+```
+taosd 内存总量 = vnode 内存 + mnode 内存 + 查询内存
+```
-实际运行的系统往往会根据数据特点的不同,将数据存放在不同的 DB 里。因此做规划时,也需要考虑。
+其中:
+1. “vnode 内存”指的是集群中所有的 Database 存储分摊到当前 taosd 节点上所占用的内存资源。可以按上文“Database Memory Size”计算公式估算每个 DB 的内存占用量进行加总,再按集群中总共的 TDengine 节点数做平均(如果设置为多副本,则还需要乘以对应的副本倍数)。
+2. “mnode 内存”指的是集群中管理节点所占用的资源。如果一个 taosd 节点上分布有 mnode 管理节点,则内存消耗还需要增加“0.2KB * 集群中数据表总数”。
+3. “查询内存”指的是服务端处理查询请求时所需要占用的内存。单条查询语句至少会占用“0.2KB * 查询涉及的数据表总数”的内存量。
-如果内存充裕,可以加大 Blocks 的配置,这样更多数据将保存在内存里,提高查询速度。
+注意:以上内存估算方法,主要讲解了系统的“必须内存需求”,而不是“内存总数上限”。在实际运行的生产环境中,由于操作系统缓存、资源管理调度等方面的原因,内存规划应当在估算结果的基础上保留一定冗余,以维持系统状态和系统性能的稳定性。并且,生产环境通常会配置系统资源的监控工具,以便及时发现硬件资源的紧缺情况。
+
+最后,如果内存充裕,可以考虑加大 Blocks 的配置,这样更多数据将保存在内存里,提高查询速度。
### CPU 需求
diff --git a/src/client/inc/tscUtil.h b/src/client/inc/tscUtil.h
index 3059290690..738ebd07dc 100644
--- a/src/client/inc/tscUtil.h
+++ b/src/client/inc/tscUtil.h
@@ -83,6 +83,22 @@ typedef struct SJoinSupporter {
SArray* pVgroupTables;
} SJoinSupporter;
+
+typedef struct SMergeCtx {
+ SJoinSupporter* p;
+ int32_t idx;
+ SArray* res;
+ int8_t compared;
+}SMergeCtx;
+
+typedef struct SMergeTsCtx {
+ SJoinSupporter* p;
+ STSBuf* res;
+ int64_t numOfInput;
+ int8_t compared;
+}SMergeTsCtx;
+
+
typedef struct SVgroupTableInfo {
SVgroupInfo vgInfo;
SArray* itemList; //SArray
@@ -183,6 +199,7 @@ int32_t tscSqlExprCopy(SArray* dst, const SArray* src, uint64_t uid, bool deep
void tscSqlExprInfoDestroy(SArray* pExprInfo);
SColumn* tscColumnClone(const SColumn* src);
+bool tscColumnExists(SArray* pColumnList, SColumnIndex* pColIndex);
SColumn* tscColumnListInsert(SArray* pColList, SColumnIndex* colIndex);
SArray* tscColumnListClone(const SArray* src, int16_t tableIndex);
void tscColumnListDestroy(SArray* pColList);
diff --git a/src/client/inc/tsclient.h b/src/client/inc/tsclient.h
index 013733bfe3..36ea12170b 100644
--- a/src/client/inc/tsclient.h
+++ b/src/client/inc/tsclient.h
@@ -142,15 +142,15 @@ typedef struct SCond {
} SCond;
typedef struct SJoinNode {
- char tableName[TSDB_TABLE_FNAME_LEN];
uint64_t uid;
int16_t tagColId;
+ SArray* tsJoin;
+ SArray* tagJoin;
} SJoinNode;
typedef struct SJoinInfo {
- bool hasJoin;
- SJoinNode left;
- SJoinNode right;
+ bool hasJoin;
+ SJoinNode* joinTables[TSDB_MAX_JOIN_TABLE_NUM];
} SJoinInfo;
typedef struct STagCond {
@@ -285,7 +285,7 @@ typedef struct {
char * pRsp;
int32_t rspType;
int32_t rspLen;
- uint64_t qhandle;
+ uint64_t qId;
int64_t useconds;
int64_t offset; // offset value from vnode during projection query of stable
int32_t row;
@@ -368,7 +368,7 @@ typedef struct SSqlObj {
int64_t svgroupRid;
int64_t squeryLock;
-
+ int32_t retryReason; // previous error code
struct SSqlObj *prev, *next;
int64_t self;
} SSqlObj;
diff --git a/src/client/src/tscAsync.c b/src/client/src/tscAsync.c
index 87f6058cec..3249529b34 100644
--- a/src/client/src/tscAsync.c
+++ b/src/client/src/tscAsync.c
@@ -160,8 +160,8 @@ static void tscProcessAsyncRetrieveImpl(void *param, TAOS_RES *tres, int numOfRo
SSqlCmd *pCmd = &pSql->cmd;
SSqlRes *pRes = &pSql->res;
- if ((pRes->qhandle == 0 || numOfRows != 0) && pCmd->command < TSDB_SQL_LOCAL) {
- if (pRes->qhandle == 0 && numOfRows != 0) {
+ if ((pRes->qId == 0 || numOfRows != 0) && pCmd->command < TSDB_SQL_LOCAL) {
+ if (pRes->qId == 0 && numOfRows != 0) {
tscError("qhandle is NULL");
} else {
pRes->code = numOfRows;
@@ -208,7 +208,7 @@ void taos_fetch_rows_a(TAOS_RES *taosa, __async_cb_func_t fp, void *param) {
pSql->fetchFp = fp;
pSql->fp = tscAsyncFetchRowsProxy;
- if (pRes->qhandle == 0) {
+ if (pRes->qId == 0) {
tscError("qhandle is NULL");
pRes->code = TSDB_CODE_TSC_INVALID_QHANDLE;
pSql->param = param;
@@ -310,10 +310,51 @@ void tscAsyncResultOnError(SSqlObj* pSql) {
taosScheduleTask(tscQhandle, &schedMsg);
}
-
-
int tscSendMsgToServer(SSqlObj *pSql);
+static int32_t updateMetaBeforeRetryQuery(SSqlObj* pSql, STableMetaInfo* pTableMetaInfo, SQueryInfo* pQueryInfo) {
+ // handle the invalid table error code for super table.
+ // update the pExpr info, colList info, number of table columns
+ // TODO Re-parse this sql and issue the corresponding subquery as an alternative for this case.
+ if (pSql->retryReason == TSDB_CODE_TDB_INVALID_TABLE_ID) {
+ int32_t numOfExprs = (int32_t) tscSqlExprNumOfExprs(pQueryInfo);
+ int32_t numOfCols = tscGetNumOfColumns(pTableMetaInfo->pTableMeta);
+ int32_t numOfTags = tscGetNumOfTags(pTableMetaInfo->pTableMeta);
+
+ SSchema *pSchema = tscGetTableSchema(pTableMetaInfo->pTableMeta);
+ for (int32_t i = 0; i < numOfExprs; ++i) {
+ SSqlExpr *pExpr = tscSqlExprGet(pQueryInfo, i);
+ pExpr->uid = pTableMetaInfo->pTableMeta->id.uid;
+
+ if (pExpr->colInfo.colIndex >= 0) {
+ int32_t index = pExpr->colInfo.colIndex;
+
+ if ((TSDB_COL_IS_NORMAL_COL(pExpr->colInfo.flag) && index >= numOfCols) ||
+ (TSDB_COL_IS_TAG(pExpr->colInfo.flag) && (index < numOfCols || index >= (numOfCols + numOfTags)))) {
+ return pSql->retryReason;
+ }
+
+ if ((pSchema[pExpr->colInfo.colIndex].colId != pExpr->colInfo.colId) &&
+ strcasecmp(pExpr->colInfo.name, pSchema[pExpr->colInfo.colIndex].name) != 0) {
+ return pSql->retryReason;
+ }
+ }
+ }
+
+ // validate the table columns information
+ for (int32_t i = 0; i < taosArrayGetSize(pQueryInfo->colList); ++i) {
+ SColumn *pCol = taosArrayGetP(pQueryInfo->colList, i);
+ if (pCol->colIndex.columnIndex >= numOfCols) {
+ return pSql->retryReason;
+ }
+ }
+ } else {
+ // do nothing
+ }
+
+ return TSDB_CODE_SUCCESS;
+}
+
void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) {
SSqlObj* pSql = (SSqlObj*)taosAcquireRef(tscObjRef, (int64_t)param);
if (pSql == NULL) return;
@@ -339,7 +380,8 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) {
if (TSDB_QUERY_HAS_TYPE(pQueryInfo->type, (TSDB_QUERY_TYPE_STABLE_SUBQUERY|TSDB_QUERY_TYPE_SUBQUERY|TSDB_QUERY_TYPE_TAG_FILTER_QUERY))) {
tscDebug("%p update local table meta, continue to process sql and send the corresponding query", pSql);
- STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0);
+ STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0);
+
code = tscGetTableMeta(pSql, pTableMetaInfo);
assert(code == TSDB_CODE_TSC_ACTION_IN_PROGRESS || code == TSDB_CODE_SUCCESS);
@@ -349,6 +391,10 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) {
}
assert((tscGetNumOfTags(pTableMetaInfo->pTableMeta) != 0));
+ code = updateMetaBeforeRetryQuery(pSql, pTableMetaInfo, pQueryInfo);
+ if (code != TSDB_CODE_SUCCESS) {
+ goto _error;
+ }
// tscProcessSql can add error into async res
tscProcessSql(pSql);
diff --git a/src/client/src/tscLocal.c b/src/client/src/tscLocal.c
index 820572859e..188ba29a97 100644
--- a/src/client/src/tscLocal.c
+++ b/src/client/src/tscLocal.c
@@ -309,7 +309,7 @@ TAOS_ROW tscFetchRow(void *param) {
SSqlCmd *pCmd = &pSql->cmd;
SSqlRes *pRes = &pSql->res;
- if (pRes->qhandle == 0 ||
+ if (pRes->qId == 0 ||
pCmd->command == TSDB_SQL_RETRIEVE_EMPTY_RESULT ||
pCmd->command == TSDB_SQL_INSERT) {
return NULL;
@@ -905,7 +905,7 @@ int tscProcessLocalCmd(SSqlObj *pSql) {
* set the qhandle to be 1 in order to pass the qhandle check, and to call partial release function to
* free allocated resources and remove the SqlObj from sql query linked list
*/
- pRes->qhandle = 0x1;
+ pRes->qId = 0x1;
pRes->numOfRows = 0;
} else if (pCmd->command == TSDB_SQL_SHOW_CREATE_TABLE) {
pRes->code = tscProcessShowCreateTable(pSql);
diff --git a/src/client/src/tscLocalMerge.c b/src/client/src/tscLocalMerge.c
index 779240dac0..baff0c46af 100644
--- a/src/client/src/tscLocalMerge.c
+++ b/src/client/src/tscLocalMerge.c
@@ -1606,7 +1606,7 @@ void tscInitResObjForLocalQuery(SSqlObj *pObj, int32_t numOfRes, int32_t rowLen)
tscDestroyLocalMerger(pObj);
}
- pRes->qhandle = 1; // hack to pass the safety check in fetch_row function
+ pRes->qId = 1; // hack to pass the safety check in fetch_row function
pRes->numOfRows = 0;
pRes->row = 0;
diff --git a/src/client/src/tscPrepare.c b/src/client/src/tscPrepare.c
index 0669d6aeb0..4efaf7c2b5 100644
--- a/src/client/src/tscPrepare.c
+++ b/src/client/src/tscPrepare.c
@@ -903,7 +903,7 @@ int taos_stmt_prepare(TAOS_STMT* stmt, const char* sql, unsigned long length) {
return TSDB_CODE_TSC_OUT_OF_MEMORY;
}
- pRes->qhandle = 0;
+ pRes->qId = 0;
pRes->numOfRows = 1;
strtolower(pSql->sqlstr, sql);
diff --git a/src/client/src/tscProfile.c b/src/client/src/tscProfile.c
index 9203dcfbba..3b0e1b5775 100644
--- a/src/client/src/tscProfile.c
+++ b/src/client/src/tscProfile.c
@@ -249,8 +249,8 @@ int tscBuildQueryStreamDesc(void *pMsg, STscObj *pObj) {
pQdesc->stime = htobe64(pSql->stime);
pQdesc->queryId = htonl(pSql->queryId);
//pQdesc->useconds = htobe64(pSql->res.useconds);
- pQdesc->useconds = htobe64(now - pSql->stime);
- pQdesc->qHandle = htobe64(pSql->res.qhandle);
+ pQdesc->useconds = htobe64(now - pSql->stime); // use local time instead of sever rsp elapsed time
+ pQdesc->qHandle = htobe64(pSql->res.qId);
pHeartbeat->numOfQueries++;
pQdesc++;
diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c
index a83e3d86b4..47775e6530 100644
--- a/src/client/src/tscSQLParser.c
+++ b/src/client/src/tscSQLParser.c
@@ -807,7 +807,18 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) {
if ((code = setKillInfo(pSql, pInfo, pInfo->type)) != TSDB_CODE_SUCCESS) {
return code;
}
+ break;
+ }
+ case TSDB_SQL_SYNC_DB_REPLICA: {
+ const char* msg1 = "invalid db name";
+ SStrToken* pzName = taosArrayGet(pInfo->pMiscInfo->a, 0);
+
+ assert(taosArrayGetSize(pInfo->pMiscInfo->a) == 1);
+ code = tNameSetDbName(&pTableMetaInfo->name, getAccountId(pSql), pzName);
+ if (code != TSDB_CODE_SUCCESS) {
+ return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1);
+ }
break;
}
@@ -1103,12 +1114,18 @@ int32_t parseSlidingClause(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SStrToken* pSl
int32_t tscSetTableFullName(STableMetaInfo* pTableMetaInfo, SStrToken* pTableName, SSqlObj* pSql) {
const char* msg1 = "name too long";
const char* msg2 = "acctId too long";
+ const char* msg3 = "no acctId";
SSqlCmd* pCmd = &pSql->cmd;
int32_t code = TSDB_CODE_SUCCESS;
if (hasSpecifyDB(pTableName)) { // db has been specified in sql string so we ignore current db path
- code = tNameSetAcctId(&pTableMetaInfo->name, getAccountId(pSql));
+ char* acctId = getAccountId(pSql);
+ if (acctId == NULL || strlen(acctId) <= 0) {
+ return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg3);
+ }
+
+ code = tNameSetAcctId(&pTableMetaInfo->name, acctId);
if (code != 0) {
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg2);
}
@@ -3613,24 +3630,26 @@ static int32_t getColumnQueryCondInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSq
}
}
-static int32_t getJoinCondInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSqlExpr* pExpr) {
- const char* msg1 = "invalid join query condition";
- const char* msg2 = "invalid table name in join query";
+static int32_t checkAndSetJoinCondInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSqlExpr* pExpr) {
+ int32_t code = 0;
+ const char* msg1 = "timestamp required for join tables";
const char* msg3 = "type of join columns must be identical";
const char* msg4 = "invalid column name in join condition";
+ const char* msg5 = "only support one join tag for each table";
if (pExpr == NULL) {
return TSDB_CODE_SUCCESS;
}
if (!tSqlExprIsParentOfLeaf(pExpr)) {
- return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1);
+ code = checkAndSetJoinCondInfo(pCmd, pQueryInfo, pExpr->pLeft);
+ if (code) {
+ return code;
+ }
+
+ return checkAndSetJoinCondInfo(pCmd, pQueryInfo, pExpr->pRight);
}
- STagCond* pTagCond = &pQueryInfo->tagCond;
- SJoinNode* pLeft = &pTagCond->joinInfo.left;
- SJoinNode* pRight = &pTagCond->joinInfo.right;
-
SColumnIndex index = COLUMN_INDEX_INITIALIZER;
if (getColumnIndexByName(pCmd, &pExpr->pLeft->colInfo, pQueryInfo, &index) != TSDB_CODE_SUCCESS) {
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg4);
@@ -3639,13 +3658,28 @@ static int32_t getJoinCondInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSqlExpr*
STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, index.tableIndex);
SSchema* pTagSchema1 = tscGetTableColumnSchema(pTableMetaInfo->pTableMeta, index.columnIndex);
- pLeft->uid = pTableMetaInfo->pTableMeta->id.uid;
- pLeft->tagColId = pTagSchema1->colId;
+ assert(index.tableIndex >= 0 && index.tableIndex < TSDB_MAX_JOIN_TABLE_NUM);
- int32_t code = tNameExtractFullName(&pTableMetaInfo->name, pLeft->tableName);
- if (code != TSDB_CODE_SUCCESS) {
- return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg2);
+ SJoinNode **leftNode = &pQueryInfo->tagCond.joinInfo.joinTables[index.tableIndex];
+ if (*leftNode == NULL) {
+ return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1);
}
+
+ (*leftNode)->uid = pTableMetaInfo->pTableMeta->id.uid;
+ (*leftNode)->tagColId = pTagSchema1->colId;
+
+ if (UTIL_TABLE_IS_SUPER_TABLE(pTableMetaInfo)) {
+ index.columnIndex = index.columnIndex - tscGetNumOfColumns(pTableMetaInfo->pTableMeta);
+ if (!tscColumnExists(pTableMetaInfo->tagColList, &index)) {
+ tscColumnListInsert(pTableMetaInfo->tagColList, &index);
+ if (taosArrayGetSize(pTableMetaInfo->tagColList) > 1) {
+ return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg5);
+ }
+ }
+ }
+
+ int16_t leftIdx = index.tableIndex;
+
index = (SColumnIndex)COLUMN_INDEX_INITIALIZER;
if (getColumnIndexByName(pCmd, &pExpr->pRight->colInfo, pQueryInfo, &index) != TSDB_CODE_SUCCESS) {
@@ -3655,20 +3689,55 @@ static int32_t getJoinCondInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSqlExpr*
pTableMetaInfo = tscGetMetaInfo(pQueryInfo, index.tableIndex);
SSchema* pTagSchema2 = tscGetTableColumnSchema(pTableMetaInfo->pTableMeta, index.columnIndex);
- pRight->uid = pTableMetaInfo->pTableMeta->id.uid;
- pRight->tagColId = pTagSchema2->colId;
+ assert(index.tableIndex >= 0 && index.tableIndex < TSDB_MAX_JOIN_TABLE_NUM);
- code = tNameExtractFullName(&pTableMetaInfo->name, pRight->tableName);
- if (code != TSDB_CODE_SUCCESS) {
- return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg2);
+ SJoinNode **rightNode = &pQueryInfo->tagCond.joinInfo.joinTables[index.tableIndex];
+ if (*rightNode == NULL) {
+ return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1);
}
+ (*rightNode)->uid = pTableMetaInfo->pTableMeta->id.uid;
+ (*rightNode)->tagColId = pTagSchema2->colId;
+
+ if (UTIL_TABLE_IS_SUPER_TABLE(pTableMetaInfo)) {
+ index.columnIndex = index.columnIndex - tscGetNumOfColumns(pTableMetaInfo->pTableMeta);
+ if (!tscColumnExists(pTableMetaInfo->tagColList, &index)) {
+ tscColumnListInsert(pTableMetaInfo->tagColList, &index);
+ if (taosArrayGetSize(pTableMetaInfo->tagColList) > 1) {
+ return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg5);
+ }
+ }
+ }
+
+ int16_t rightIdx = index.tableIndex;
+
if (pTagSchema1->type != pTagSchema2->type) {
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg3);
}
- pTagCond->joinInfo.hasJoin = true;
+ if ((*leftNode)->tagJoin == NULL) {
+ (*leftNode)->tagJoin = taosArrayInit(2, sizeof(int16_t));
+ }
+
+ if ((*rightNode)->tagJoin == NULL) {
+ (*rightNode)->tagJoin = taosArrayInit(2, sizeof(int16_t));
+ }
+
+ taosArrayPush((*leftNode)->tagJoin, &rightIdx);
+ taosArrayPush((*rightNode)->tagJoin, &leftIdx);
+
+ pQueryInfo->tagCond.joinInfo.hasJoin = true;
+
return TSDB_CODE_SUCCESS;
+
+}
+
+static int32_t getJoinCondInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSqlExpr* pExpr) {
+ if (pExpr == NULL) {
+ return TSDB_CODE_SUCCESS;
+ }
+
+ return checkAndSetJoinCondInfo(pCmd, pQueryInfo, pExpr);
}
static int32_t validateSQLExpr(SSqlCmd* pCmd, tSqlExpr* pExpr, SQueryInfo* pQueryInfo, SColumnList* pList,
@@ -3932,7 +4001,7 @@ static int32_t handleExprInQueryCond(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSql
const char* msg1 = "table query cannot use tags filter";
const char* msg2 = "illegal column name";
const char* msg3 = "only one query time range allowed";
- const char* msg4 = "only one join condition allowed";
+ const char* msg4 = "too many join tables";
const char* msg5 = "not support ordinary column join";
const char* msg6 = "only one query condition on tbname allowed";
const char* msg7 = "only in/like allowed in filter table name";
@@ -3963,6 +4032,47 @@ static int32_t handleExprInQueryCond(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSql
TSDB_QUERY_SET_TYPE(pQueryInfo->type, TSDB_QUERY_TYPE_JOIN_QUERY);
pCondExpr->tsJoin = true;
+ assert(index.tableIndex >= 0 && index.tableIndex < TSDB_MAX_JOIN_TABLE_NUM);
+ SJoinNode **leftNode = &pQueryInfo->tagCond.joinInfo.joinTables[index.tableIndex];
+ if (*leftNode == NULL) {
+ *leftNode = calloc(1, sizeof(SJoinNode));
+ if (*leftNode == NULL) {
+ return TSDB_CODE_TSC_OUT_OF_MEMORY;
+ }
+ }
+
+ int16_t leftIdx = index.tableIndex;
+
+ SColumnIndex index = COLUMN_INDEX_INITIALIZER;
+ if (getColumnIndexByName(pCmd, &pRight->colInfo, pQueryInfo, &index) != TSDB_CODE_SUCCESS) {
+ return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg2);
+ }
+
+ if (index.tableIndex < 0 || index.tableIndex >= TSDB_MAX_JOIN_TABLE_NUM) {
+ return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg4);
+ }
+
+ SJoinNode **rightNode = &pQueryInfo->tagCond.joinInfo.joinTables[index.tableIndex];
+ if (*rightNode == NULL) {
+ *rightNode = calloc(1, sizeof(SJoinNode));
+ if (*rightNode == NULL) {
+ return TSDB_CODE_TSC_OUT_OF_MEMORY;
+ }
+ }
+
+ int16_t rightIdx = index.tableIndex;
+
+ if ((*leftNode)->tsJoin == NULL) {
+ (*leftNode)->tsJoin = taosArrayInit(2, sizeof(int16_t));
+ }
+
+ if ((*rightNode)->tsJoin == NULL) {
+ (*rightNode)->tsJoin = taosArrayInit(2, sizeof(int16_t));
+ }
+
+ taosArrayPush((*leftNode)->tsJoin, &rightIdx);
+ taosArrayPush((*rightNode)->tsJoin, &leftIdx);
+
/*
* to release expression, e.g., m1.ts = m2.ts,
* since this expression is used to set the join query type
@@ -4020,10 +4130,6 @@ static int32_t handleExprInQueryCond(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSql
return TSDB_CODE_TSC_INVALID_SQL;
}
- if (pCondExpr->pJoinExpr != NULL) {
- return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg4);
- }
-
pQueryInfo->type |= TSDB_QUERY_TYPE_JOIN_QUERY;
ret = setExprToCond(&pCondExpr->pJoinExpr, *pExpr, NULL, parentOptr, pQueryInfo->msg);
*pExpr = NULL;
@@ -4251,7 +4357,8 @@ static bool validateFilterExpr(SQueryInfo* pQueryInfo) {
static int32_t getTimeRangeFromExpr(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSqlExpr* pExpr) {
const char* msg0 = "invalid timestamp";
const char* msg1 = "only one time stamp window allowed";
-
+ int32_t code = 0;
+
if (pExpr == NULL) {
return TSDB_CODE_SUCCESS;
}
@@ -4261,8 +4368,11 @@ static int32_t getTimeRangeFromExpr(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSqlE
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1);
}
- getTimeRangeFromExpr(pCmd, pQueryInfo, pExpr->pLeft);
-
+ code = getTimeRangeFromExpr(pCmd, pQueryInfo, pExpr->pLeft);
+ if (code) {
+ return code;
+ }
+
return getTimeRangeFromExpr(pCmd, pQueryInfo, pExpr->pRight);
} else {
SColumnIndex index = COLUMN_INDEX_INITIALIZER;
@@ -4343,6 +4453,7 @@ static void cleanQueryExpr(SCondExpr* pCondExpr) {
}
}
+/*
static void doAddJoinTagsColumnsIntoTagList(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SCondExpr* pCondExpr) {
STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0);
if (QUERY_IS_JOIN_QUERY(pQueryInfo->type) && UTIL_TABLE_IS_SUPER_TABLE(pTableMetaInfo)) {
@@ -4365,6 +4476,7 @@ static void doAddJoinTagsColumnsIntoTagList(SSqlCmd* pCmd, SQueryInfo* pQueryInf
tscColumnListInsert(pTableMetaInfo->tagColList, &index);
}
}
+*/
static int32_t validateTagCondExpr(SSqlCmd* pCmd, tExprNode *p) {
const char *msg1 = "invalid tag operator";
@@ -4508,6 +4620,102 @@ static int32_t getTagQueryCondExpr(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SCondE
return ret;
}
+int32_t validateJoinNodes(SQueryInfo* pQueryInfo, SSqlObj* pSql) {
+ const char* msg1 = "timestamp required for join tables";
+ const char* msg2 = "tag required for join stables";
+
+ for (int32_t i = 0; i < pQueryInfo->numOfTables; ++i) {
+ SJoinNode *node = pQueryInfo->tagCond.joinInfo.joinTables[i];
+
+ if (node == NULL || node->tsJoin == NULL || taosArrayGetSize(node->tsJoin) <= 0) {
+ return invalidSqlErrMsg(tscGetErrorMsgPayload(&pSql->cmd), msg1);
+ }
+ }
+
+ STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0);
+ if (UTIL_TABLE_IS_SUPER_TABLE(pTableMetaInfo)) {
+ for (int32_t i = 0; i < pQueryInfo->numOfTables; ++i) {
+ SJoinNode *node = pQueryInfo->tagCond.joinInfo.joinTables[i];
+
+ if (node == NULL || node->tagJoin == NULL || taosArrayGetSize(node->tagJoin) <= 0) {
+ return invalidSqlErrMsg(tscGetErrorMsgPayload(&pSql->cmd), msg2);
+ }
+ }
+ }
+
+ return TSDB_CODE_SUCCESS;
+}
+
+
+void mergeJoinNodesImpl(int8_t* r, int8_t* p, int16_t* tidx, SJoinNode** nodes, int32_t type) {
+ SJoinNode *node = nodes[*tidx];
+ SArray* arr = (type == 0) ? node->tsJoin : node->tagJoin;
+ size_t size = taosArrayGetSize(arr);
+
+ p[*tidx] = 1;
+
+ for (int32_t j = 0; j < size; j++) {
+ int16_t* idx = taosArrayGet(arr, j);
+ r[*idx] = 1;
+ if (p[*idx] == 0) {
+ mergeJoinNodesImpl(r, p, idx, nodes, type);
+ }
+ }
+}
+
+int32_t mergeJoinNodes(SQueryInfo* pQueryInfo, SSqlObj* pSql) {
+ const char* msg1 = "not all join tables have same timestamp";
+ const char* msg2 = "not all join tables have same tag";
+
+ int8_t r[TSDB_MAX_JOIN_TABLE_NUM] = {0};
+ int8_t p[TSDB_MAX_JOIN_TABLE_NUM] = {0};
+
+ for (int16_t i = 0; i < pQueryInfo->numOfTables; ++i) {
+ mergeJoinNodesImpl(r, p, &i, pQueryInfo->tagCond.joinInfo.joinTables, 0);
+
+ taosArrayClear(pQueryInfo->tagCond.joinInfo.joinTables[i]->tsJoin);
+
+ for (int32_t j = 0; j < TSDB_MAX_JOIN_TABLE_NUM; ++j) {
+ if (r[j]) {
+ taosArrayPush(pQueryInfo->tagCond.joinInfo.joinTables[i]->tsJoin, &j);
+ }
+ }
+
+ memset(r, 0, sizeof(r));
+ memset(p, 0, sizeof(p));
+ }
+
+ if (taosArrayGetSize(pQueryInfo->tagCond.joinInfo.joinTables[0]->tsJoin) != pQueryInfo->numOfTables) {
+ return invalidSqlErrMsg(tscGetErrorMsgPayload(&pSql->cmd), msg1);
+ }
+
+ STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0);
+ if (UTIL_TABLE_IS_SUPER_TABLE(pTableMetaInfo)) {
+ for (int16_t i = 0; i < pQueryInfo->numOfTables; ++i) {
+ mergeJoinNodesImpl(r, p, &i, pQueryInfo->tagCond.joinInfo.joinTables, 1);
+
+ taosArrayClear(pQueryInfo->tagCond.joinInfo.joinTables[i]->tagJoin);
+
+ for (int32_t j = 0; j < TSDB_MAX_JOIN_TABLE_NUM; ++j) {
+ if (r[j]) {
+ taosArrayPush(pQueryInfo->tagCond.joinInfo.joinTables[i]->tagJoin, &j);
+ }
+ }
+
+ memset(r, 0, sizeof(r));
+ memset(p, 0, sizeof(p));
+ }
+
+ if (taosArrayGetSize(pQueryInfo->tagCond.joinInfo.joinTables[0]->tagJoin) != pQueryInfo->numOfTables) {
+ return invalidSqlErrMsg(tscGetErrorMsgPayload(&pSql->cmd), msg2);
+ }
+
+ }
+
+ return TSDB_CODE_SUCCESS;
+}
+
+
int32_t parseWhereClause(SQueryInfo* pQueryInfo, tSqlExpr** pExpr, SSqlObj* pSql) {
if (pExpr == NULL) {
return TSDB_CODE_SUCCESS;
@@ -4553,17 +4761,17 @@ int32_t parseWhereClause(SQueryInfo* pQueryInfo, tSqlExpr** pExpr, SSqlObj* pSql
// 4. get the table name query condition
if ((ret = getTablenameCond(&pSql->cmd, pQueryInfo, condExpr.pTableCond, &sb)) != TSDB_CODE_SUCCESS) {
- return ret;
+ goto PARSE_WHERE_EXIT;
}
// 5. other column query condition
if ((ret = getColumnQueryCondInfo(&pSql->cmd, pQueryInfo, condExpr.pColumnCond, TK_AND)) != TSDB_CODE_SUCCESS) {
- return ret;
+ goto PARSE_WHERE_EXIT;
}
// 6. join condition
if ((ret = getJoinCondInfo(&pSql->cmd, pQueryInfo, condExpr.pJoinExpr)) != TSDB_CODE_SUCCESS) {
- return ret;
+ goto PARSE_WHERE_EXIT;
}
// 7. query condition for table name
@@ -4571,12 +4779,29 @@ int32_t parseWhereClause(SQueryInfo* pQueryInfo, tSqlExpr** pExpr, SSqlObj* pSql
ret = setTableCondForSTableQuery(&pSql->cmd, pQueryInfo, getAccountId(pSql), condExpr.pTableCond, condExpr.tableCondIndex, &sb);
taosStringBuilderDestroy(&sb);
-
- if (!validateFilterExpr(pQueryInfo)) {
- return invalidSqlErrMsg(tscGetErrorMsgPayload(&pSql->cmd), msg2);
+ if (ret) {
+ goto PARSE_WHERE_EXIT;
}
- doAddJoinTagsColumnsIntoTagList(&pSql->cmd, pQueryInfo, &condExpr);
+ if (!validateFilterExpr(pQueryInfo)) {
+ ret = invalidSqlErrMsg(tscGetErrorMsgPayload(&pSql->cmd), msg2);
+ goto PARSE_WHERE_EXIT;
+ }
+
+ //doAddJoinTagsColumnsIntoTagList(&pSql->cmd, pQueryInfo, &condExpr);
+ if (condExpr.tsJoin) {
+ ret = validateJoinNodes(pQueryInfo, pSql);
+ if (ret) {
+ goto PARSE_WHERE_EXIT;
+ }
+
+ ret = mergeJoinNodes(pQueryInfo, pSql);
+ if (ret) {
+ goto PARSE_WHERE_EXIT;
+ }
+ }
+
+PARSE_WHERE_EXIT:
cleanQueryExpr(&condExpr);
return ret;
@@ -6818,7 +7043,6 @@ int32_t doValidateSqlNode(SSqlObj* pSql, SQuerySqlNode* pQuerySqlNode, int32_t i
const char* msg1 = "point interpolation query needs timestamp";
const char* msg2 = "fill only available for interval query";
const char* msg3 = "start(end) time of query range required or time range too large";
- const char* msg4 = "illegal number of tables in from clause";
const char* msg5 = "too many columns in selection clause";
const char* msg6 = "too many tables in from clause";
const char* msg7 = "invalid table alias name";
@@ -6855,14 +7079,11 @@ int32_t doValidateSqlNode(SSqlObj* pSql, SQuerySqlNode* pQuerySqlNode, int32_t i
}
size_t fromSize = taosArrayGetSize(pQuerySqlNode->from->tableList);
- if (fromSize > TSDB_MAX_JOIN_TABLE_NUM) {
- return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg4);
+ if (fromSize > TSDB_MAX_JOIN_TABLE_NUM * 2) {
+ return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg6);
}
pQueryInfo->command = TSDB_SQL_SELECT;
- if (fromSize > 2) {
- return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg6);
- }
// set all query tables, which are maybe more than one.
for (int32_t i = 0; i < fromSize; ++i) {
diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c
index 55455c7dcb..27b8e57f33 100644
--- a/src/client/src/tscServer.c
+++ b/src/client/src/tscServer.c
@@ -350,8 +350,8 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
taosMsleep(duration);
}
+ pSql->retryReason = rpcMsg->code;
rpcMsg->code = tscRenewTableMeta(pSql, 0);
-
// if there is an error occurring, proceed to the following error handling procedure.
if (rpcMsg->code == TSDB_CODE_TSC_ACTION_IN_PROGRESS) {
taosReleaseRef(tscObjRef, handle);
@@ -509,7 +509,7 @@ int tscBuildFetchMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(&pSql->cmd, pSql->cmd.clauseIndex);
pRetrieveMsg->free = htons(pQueryInfo->type);
- pRetrieveMsg->qhandle = htobe64(pSql->res.qhandle);
+ pRetrieveMsg->qId = htobe64(pSql->res.qId);
// todo valid the vgroupId at the client side
STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0);
@@ -521,7 +521,7 @@ int tscBuildFetchMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
assert(pVgroupInfo->vgroups[vgIndex].vgId > 0 && vgIndex < pTableMetaInfo->vgroupList->numOfVgroups);
pRetrieveMsg->header.vgId = htonl(pVgroupInfo->vgroups[vgIndex].vgId);
- tscDebug("%p build fetch msg from vgId:%d, vgIndex:%d, qhandle:%" PRIX64, pSql, pVgroupInfo->vgroups[vgIndex].vgId, vgIndex, pSql->res.qhandle);
+ tscDebug("%p build fetch msg from vgId:%d, vgIndex:%d, qhandle:%" PRIX64, pSql, pVgroupInfo->vgroups[vgIndex].vgId, vgIndex, pSql->res.qId);
} else {
int32_t numOfVgroups = (int32_t)taosArrayGetSize(pTableMetaInfo->pVgroupTables);
assert(vgIndex >= 0 && vgIndex < numOfVgroups);
@@ -529,12 +529,12 @@ int tscBuildFetchMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
SVgroupTableInfo* pTableIdList = taosArrayGet(pTableMetaInfo->pVgroupTables, vgIndex);
pRetrieveMsg->header.vgId = htonl(pTableIdList->vgInfo.vgId);
- tscDebug("%p build fetch msg from vgId:%d, vgIndex:%d, qhandle:%" PRIX64, pSql, pTableIdList->vgInfo.vgId, vgIndex, pSql->res.qhandle);
+ tscDebug("%p build fetch msg from vgId:%d, vgIndex:%d, qId:%" PRIu64, pSql, pTableIdList->vgInfo.vgId, vgIndex, pSql->res.qId);
}
} else {
STableMeta* pTableMeta = pTableMetaInfo->pTableMeta;
pRetrieveMsg->header.vgId = htonl(pTableMeta->vgId);
- tscDebug("%p build fetch msg from only one vgroup, vgId:%d, qhandle:%" PRIX64, pSql, pTableMeta->vgId, pSql->res.qhandle);
+ tscDebug("%p build fetch msg from only one vgroup, vgId:%d, qId:%" PRIu64, pSql, pTableMeta->vgId, pSql->res.qId);
}
pSql->cmd.payloadLen = sizeof(SRetrieveTableMsg);
@@ -614,7 +614,7 @@ static int32_t tscEstimateQueryMsgSize(SSqlObj *pSql, int32_t clauseIndex) {
tableSerialize + sqlLen + 4096 + pQueryInfo->bufLen;
}
-static char *doSerializeTableInfo(SQueryTableMsg* pQueryMsg, SSqlObj *pSql, char *pMsg) {
+static char *doSerializeTableInfo(SQueryTableMsg* pQueryMsg, SSqlObj *pSql, char *pMsg, int32_t *succeed) {
STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(&pSql->cmd, pSql->cmd.clauseIndex, 0);
TSKEY dfltKey = htobe64(pQueryMsg->window.skey);
@@ -627,9 +627,14 @@ static char *doSerializeTableInfo(SQueryTableMsg* pQueryMsg, SSqlObj *pSql, char
assert(index >= 0);
SVgroupInfo* pVgroupInfo = NULL;
- if (pTableMetaInfo->vgroupList->numOfVgroups > 0) {
+ if (pTableMetaInfo->vgroupList && pTableMetaInfo->vgroupList->numOfVgroups > 0) {
assert(index < pTableMetaInfo->vgroupList->numOfVgroups);
pVgroupInfo = &pTableMetaInfo->vgroupList->vgroups[index];
+ } else {
+ tscError("%p No vgroup info found", pSql);
+
+ *succeed = 0;
+ return pMsg;
}
vgId = pVgroupInfo->vgId;
@@ -955,8 +960,13 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
pQueryMsg->secondStageOutput = 0;
}
+ int32_t succeed = 1;
+
// serialize the table info (sid, uid, tags)
- pMsg = doSerializeTableInfo(pQueryMsg, pSql, pMsg);
+ pMsg = doSerializeTableInfo(pQueryMsg, pSql, pMsg, &succeed);
+ if (succeed == 0) {
+ return TSDB_CODE_TSC_APP_ERROR;
+ }
SSqlGroupbyExpr *pGroupbyExpr = &pQueryInfo->groupbyExpr;
if (pGroupbyExpr->numOfGroupCols > 0) {
@@ -1339,6 +1349,23 @@ int32_t tscBuildUseDbMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
return TSDB_CODE_SUCCESS;
}
+int32_t tscBuildSyncDbReplicaMsg(SSqlObj* pSql, SSqlInfo *pInfo) {
+ SSqlCmd *pCmd = &pSql->cmd;
+ pCmd->payloadLen = sizeof(SSyncDbMsg);
+
+ if (TSDB_CODE_SUCCESS != tscAllocPayload(pCmd, pCmd->payloadLen)) {
+ tscError("%p failed to malloc for query msg", pSql);
+ return TSDB_CODE_TSC_OUT_OF_MEMORY;
+ }
+
+ SSyncDbMsg *pSyncMsg = (SSyncDbMsg *)pCmd->payload;
+ STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(pCmd, pCmd->clauseIndex, 0);
+ tNameExtractFullName(&pTableMetaInfo->name, pSyncMsg->db);
+ pCmd->msgType = TSDB_MSG_TYPE_CM_SYNC_DB;
+
+ return TSDB_CODE_SUCCESS;
+}
+
int32_t tscBuildShowMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
STscObj *pObj = pSql->pTscObj;
SSqlCmd *pCmd = &pSql->cmd;
@@ -1619,7 +1646,7 @@ int tscBuildRetrieveFromMgmtMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(pCmd, 0);
SRetrieveTableMsg *pRetrieveMsg = (SRetrieveTableMsg*)pCmd->payload;
- pRetrieveMsg->qhandle = htobe64(pSql->res.qhandle);
+ pRetrieveMsg->qId = htobe64(pSql->res.qId);
pRetrieveMsg->free = htons(pQueryInfo->type);
return TSDB_CODE_SUCCESS;
@@ -2195,19 +2222,24 @@ int tscProcessSTableVgroupRsp(SSqlObj *pSql) {
assert(pInfo->vgroupList != NULL);
pInfo->vgroupList->numOfVgroups = pVgroupMsg->numOfVgroups;
- for (int32_t j = 0; j < pInfo->vgroupList->numOfVgroups; ++j) {
- //just init, no need to lock
- SVgroupInfo *pVgroups = &pInfo->vgroupList->vgroups[j];
+ if (pInfo->vgroupList->numOfVgroups <= 0) {
+ //tfree(pInfo->vgroupList);
+ tscError("%p empty vgroup info", pSql);
+ } else {
+ for (int32_t j = 0; j < pInfo->vgroupList->numOfVgroups; ++j) {
+ //just init, no need to lock
+ SVgroupInfo *pVgroups = &pInfo->vgroupList->vgroups[j];
- SVgroupMsg *vmsg = &pVgroupMsg->vgroups[j];
- pVgroups->vgId = htonl(vmsg->vgId);
- pVgroups->numOfEps = vmsg->numOfEps;
+ SVgroupMsg *vmsg = &pVgroupMsg->vgroups[j];
+ pVgroups->vgId = htonl(vmsg->vgId);
+ pVgroups->numOfEps = vmsg->numOfEps;
- assert(pVgroups->numOfEps >= 1 && pVgroups->vgId >= 1);
+ assert(pVgroups->numOfEps >= 1 && pVgroups->vgId >= 1);
- for (int32_t k = 0; k < pVgroups->numOfEps; ++k) {
- pVgroups->epAddr[k].port = htons(vmsg->epAddr[k].port);
- pVgroups->epAddr[k].fqdn = strndup(vmsg->epAddr[k].fqdn, tListLen(vmsg->epAddr[k].fqdn));
+ for (int32_t k = 0; k < pVgroups->numOfEps; ++k) {
+ pVgroups->epAddr[k].port = htons(vmsg->epAddr[k].port);
+ pVgroups->epAddr[k].fqdn = strndup(vmsg->epAddr[k].fqdn, tListLen(vmsg->epAddr[k].fqdn));
+ }
}
}
@@ -2233,7 +2265,7 @@ int tscProcessShowRsp(SSqlObj *pSql) {
pShow = (SShowRsp *)pRes->pRsp;
pShow->qhandle = htobe64(pShow->qhandle);
- pRes->qhandle = pShow->qhandle;
+ pRes->qId = pShow->qhandle;
tscResetForNextRetrieve(pRes);
pMetaMsg = &(pShow->tableMeta);
@@ -2415,11 +2447,12 @@ int tscProcessQueryRsp(SSqlObj *pSql) {
SSqlRes *pRes = &pSql->res;
SQueryTableRsp *pQuery = (SQueryTableRsp *)pRes->pRsp;
- pQuery->qhandle = htobe64(pQuery->qhandle);
- pRes->qhandle = pQuery->qhandle;
+ pQuery->qId = htobe64(pQuery->qId);
+ pRes->qId = pQuery->qId;
pRes->data = NULL;
tscResetForNextRetrieve(pRes);
+ tscDebug("%p query rsp received, qId:%"PRIu64, pSql, pRes->qId);
return 0;
}
@@ -2477,7 +2510,8 @@ int tscProcessRetrieveRspFromNode(SSqlObj *pSql) {
}
pRes->row = 0;
- tscDebug("%p numOfRows:%d, offset:%" PRId64 ", complete:%d", pSql, pRes->numOfRows, pRes->offset, pRes->completed);
+ tscDebug("%p numOfRows:%d, offset:%" PRId64 ", complete:%d, qId:%"PRIu64, pSql, pRes->numOfRows, pRes->offset,
+ pRes->completed, pRes->qId);
return 0;
}
@@ -2736,6 +2770,7 @@ void tscInitMsgsFp() {
tscBuildMsg[TSDB_SQL_DROP_ACCT] = tscBuildDropUserAcctMsg;
tscBuildMsg[TSDB_SQL_DROP_DB] = tscBuildDropDbMsg;
tscBuildMsg[TSDB_SQL_DROP_FUNCTION] = tscBuildDropFuncMsg;
+ tscBuildMsg[TSDB_SQL_SYNC_DB_REPLICA] = tscBuildSyncDbReplicaMsg;
tscBuildMsg[TSDB_SQL_DROP_TABLE] = tscBuildDropTableMsg;
tscBuildMsg[TSDB_SQL_ALTER_USER] = tscBuildUserMsg;
tscBuildMsg[TSDB_SQL_CREATE_DNODE] = tscBuildCreateDnodeMsg;
diff --git a/src/client/src/tscSql.c b/src/client/src/tscSql.c
index 13539a9b19..93d0e9fd09 100644
--- a/src/client/src/tscSql.c
+++ b/src/client/src/tscSql.c
@@ -476,7 +476,7 @@ TAOS_ROW taos_fetch_row(TAOS_RES *res) {
SSqlCmd *pCmd = &pSql->cmd;
SSqlRes *pRes = &pSql->res;
- if (pRes->qhandle == 0 ||
+ if (pRes->qId == 0 ||
pRes->code == TSDB_CODE_TSC_QUERY_CANCELLED ||
pCmd->command == TSDB_SQL_RETRIEVE_EMPTY_RESULT ||
pCmd->command == TSDB_SQL_INSERT) {
@@ -508,7 +508,7 @@ int taos_fetch_block(TAOS_RES *res, TAOS_ROW *rows) {
SSqlCmd *pCmd = &pSql->cmd;
SSqlRes *pRes = &pSql->res;
- if (pRes->qhandle == 0 ||
+ if (pRes->qId == 0 ||
pRes->code == TSDB_CODE_TSC_QUERY_CANCELLED ||
pCmd->command == TSDB_SQL_RETRIEVE_EMPTY_RESULT ||
pCmd->command == TSDB_SQL_INSERT) {
@@ -554,7 +554,7 @@ static bool tscKillQueryInDnode(SSqlObj* pSql) {
SSqlCmd* pCmd = &pSql->cmd;
SSqlRes* pRes = &pSql->res;
- if (pRes == NULL || pRes->qhandle == 0) {
+ if (pRes == NULL || pRes->qId == 0) {
return true;
}
@@ -1050,7 +1050,7 @@ int taos_load_table_info(TAOS *taos, const char *tableNameList) {
* If qhandle is NOT set 0, the function of taos_free_result() will send message to server by calling tscProcessSql()
* to free connection, which may cause segment fault, when the parse phrase is not even successfully executed.
*/
- pRes->qhandle = 0;
+ pRes->qId = 0;
free(str);
if (code != TSDB_CODE_SUCCESS) {
diff --git a/src/client/src/tscSub.c b/src/client/src/tscSub.c
index 32257f5a7c..1277a436a1 100644
--- a/src/client/src/tscSub.c
+++ b/src/client/src/tscSub.c
@@ -149,7 +149,7 @@ static SSub* tscCreateSubscription(STscObj* pObj, const char* topic, const char*
}
strtolower(pSql->sqlstr, pSql->sqlstr);
- pRes->qhandle = 0;
+ pRes->qId = 0;
pRes->numOfRows = 1;
code = tscAllocPayload(pCmd, TSDB_DEFAULT_PAYLOAD_SIZE);
@@ -448,7 +448,7 @@ SSqlObj* recreateSqlObj(SSub* pSub) {
return NULL;
}
- pRes->qhandle = 0;
+ pRes->qId = 0;
pRes->numOfRows = 1;
int code = tscAllocPayload(pCmd, TSDB_DEFAULT_PAYLOAD_SIZE);
@@ -546,7 +546,7 @@ TAOS_RES *taos_consume(TAOS_SUB *tsub) {
uint32_t type = pQueryInfo->type;
tscFreeSqlResult(pSql);
pRes->numOfRows = 1;
- pRes->qhandle = 0;
+ pRes->qId = 0;
pSql->cmd.command = TSDB_SQL_SELECT;
pQueryInfo->type = type;
diff --git a/src/client/src/tscSubquery.c b/src/client/src/tscSubquery.c
index 22cb580951..299cf03805 100644
--- a/src/client/src/tscSubquery.c
+++ b/src/client/src/tscSubquery.c
@@ -46,6 +46,13 @@ static int32_t tsCompare(int32_t order, int64_t left, int64_t right) {
}
static void skipRemainValue(STSBuf* pTSBuf, tVariant* tag1) {
+ STSElem el1 = tsBufGetElem(pTSBuf);
+
+ int32_t res = tVariantCompare(el1.tag, tag1);
+ if (res != 0) { // it is a record with new tag
+ return;
+ }
+
while (tsBufNextPos(pTSBuf)) {
STSElem el1 = tsBufGetElem(pTSBuf);
@@ -118,123 +125,233 @@ static bool subAndCheckDone(SSqlObj *pSql, SSqlObj *pParentSql, int idx) {
-static int64_t doTSBlockIntersect(SSqlObj* pSql, SJoinSupporter* pSupporter1, SJoinSupporter* pSupporter2, STimeWindow * win) {
+static int64_t doTSBlockIntersect(SSqlObj* pSql, STimeWindow * win) {
SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(&pSql->cmd, pSql->cmd.clauseIndex);
- STSBuf* output1 = tsBufCreate(true, pQueryInfo->order.order);
- STSBuf* output2 = tsBufCreate(true, pQueryInfo->order.order);
-
win->skey = INT64_MAX;
win->ekey = INT64_MIN;
SLimitVal* pLimit = &pQueryInfo->limit;
int32_t order = pQueryInfo->order.order;
+ int32_t joinNum = pSql->subState.numOfSub;
+ SMergeTsCtx ctxlist[TSDB_MAX_JOIN_TABLE_NUM] = {{0}};
+ SMergeTsCtx* ctxStack[TSDB_MAX_JOIN_TABLE_NUM] = {0};
+ int32_t slot = 0;
+ size_t tableNum = 0;
+ int16_t* tableMIdx = 0;
+ int32_t equalNum = 0;
+ int32_t stackidx = 0;
+ SMergeTsCtx* ctx = NULL;
+ SMergeTsCtx* pctx = NULL;
+ SMergeTsCtx* mainCtx = NULL;
+ STSElem cur;
+ STSElem prev;
+ SArray* tsCond = NULL;
+ int32_t mergeDone = 0;
- SQueryInfo* pSubQueryInfo1 = tscGetQueryInfoDetail(&pSql->pSubs[0]->cmd, 0);
- SQueryInfo* pSubQueryInfo2 = tscGetQueryInfoDetail(&pSql->pSubs[1]->cmd, 0);
+ for (int32_t i = 0; i < joinNum; ++i) {
+ STSBuf* output = tsBufCreate(true, pQueryInfo->order.order);
+ SQueryInfo* pSubQueryInfo = tscGetQueryInfoDetail(&pSql->pSubs[i]->cmd, 0);
- pSubQueryInfo1->tsBuf = output1;
- pSubQueryInfo2->tsBuf = output2;
+ pSubQueryInfo->tsBuf = output;
+
+ SJoinSupporter* pSupporter = pSql->pSubs[i]->param;
+
+ if (pSupporter->pTSBuf == NULL) {
+ tscDebug("%p at least one ts-comp is empty, 0 for secondary query after ts blocks intersecting", pSql);
+ return 0;
+ }
+
+ tsBufResetPos(pSupporter->pTSBuf);
+
+ if (!tsBufNextPos(pSupporter->pTSBuf)) {
+ tscDebug("%p input1 is empty, 0 for secondary query after ts blocks intersecting", pSql);
+ return 0;
+ }
+
+ tscDebug("%p sub:%p table idx:%d, input group number:%d", pSql, pSql->pSubs[i], i, pSupporter->pTSBuf->numOfGroups);
+
+ ctxlist[i].p = pSupporter;
+ ctxlist[i].res = output;
+ }
TSKEY st = taosGetTimestampUs();
- // no result generated, return directly
- if (pSupporter1->pTSBuf == NULL || pSupporter2->pTSBuf == NULL) {
- tscDebug("%p at least one ts-comp is empty, 0 for secondary query after ts blocks intersecting", pSql);
- return 0;
- }
-
- tsBufResetPos(pSupporter1->pTSBuf);
- tsBufResetPos(pSupporter2->pTSBuf);
-
- if (!tsBufNextPos(pSupporter1->pTSBuf)) {
- tsBufFlush(output1);
- tsBufFlush(output2);
-
- tscDebug("%p input1 is empty, 0 for secondary query after ts blocks intersecting", pSql);
- return 0;
- }
-
- if (!tsBufNextPos(pSupporter2->pTSBuf)) {
- tsBufFlush(output1);
- tsBufFlush(output2);
-
- tscDebug("%p input2 is empty, 0 for secondary query after ts blocks intersecting", pSql);
- return 0;
- }
-
- int64_t numOfInput1 = 1;
- int64_t numOfInput2 = 1;
-
- while(1) {
- STSElem elem = tsBufGetElem(pSupporter1->pTSBuf);
-
- // no data in pSupporter1 anymore, jump out of loop
- if (!tsBufIsValidElem(&elem)) {
- break;
+ for (int16_t tidx = 0; tidx < joinNum; tidx++) {
+ pctx = &ctxlist[tidx];
+ if (pctx->compared) {
+ continue;
}
- // find the data in supporter2 with the same tag value
- STSElem e2 = tsBufFindElemStartPosByTag(pSupporter2->pTSBuf, elem.tag);
+ assert(pctx->numOfInput == 0);
- /**
- * there are elements in pSupporter2 with the same tag, continue
- */
- tVariant tag1 = {0};
- tVariantAssign(&tag1, elem.tag);
+ tsCond = pQueryInfo->tagCond.joinInfo.joinTables[tidx]->tsJoin;
+
+ tableNum = taosArrayGetSize(tsCond);
+ assert(tableNum >= 2);
+
+ for (int32_t i = 0; i < tableNum; ++i) {
+ tableMIdx = taosArrayGet(tsCond, i);
+ SMergeTsCtx* tctx = &ctxlist[*tableMIdx];
+ tctx->compared = 1;
+ }
+
+ tableMIdx = taosArrayGet(tsCond, 0);
+ pctx = &ctxlist[*tableMIdx];
+
+ mainCtx = pctx;
+
+ while (1) {
+ pctx = mainCtx;
+
+ prev = tsBufGetElem(pctx->p->pTSBuf);
+
+ ctxStack[stackidx++] = pctx;
+
+ if (!tsBufIsValidElem(&prev)) {
+ break;
+ }
+
+ tVariant tag = {0};
+ tVariantAssign(&tag, prev.tag);
+
+ int32_t skipped = 0;
+
+ for (int32_t i = 1; i < tableNum; ++i) {
+ SMergeTsCtx* tctx = &ctxlist[i];
+
+ // find the data in supporter2 with the same tag value
+ STSElem e2 = tsBufFindElemStartPosByTag(tctx->p->pTSBuf, &tag);
+
+ if (!tsBufIsValidElem(&e2)) {
+ skipRemainValue(pctx->p->pTSBuf, &tag);
+ skipped = 1;
+ break;
+ }
+ }
+
+ if (skipped) {
+ slot = 0;
+ stackidx = 0;
+ continue;
+ }
+
+ tableMIdx = taosArrayGet(tsCond, ++slot);
+ equalNum = 1;
- if (tsBufIsValidElem(&e2)) {
while (1) {
- STSElem elem1 = tsBufGetElem(pSupporter1->pTSBuf);
- STSElem elem2 = tsBufGetElem(pSupporter2->pTSBuf);
+ ctx = &ctxlist[*tableMIdx];
+
+ prev = tsBufGetElem(pctx->p->pTSBuf);
+ cur = tsBufGetElem(ctx->p->pTSBuf);
// data with current are exhausted
- if (!tsBufIsValidElem(&elem1) || tVariantCompare(elem1.tag, &tag1) != 0) {
+ if (!tsBufIsValidElem(&prev) || tVariantCompare(prev.tag, &tag) != 0) {
break;
}
- if (!tsBufIsValidElem(&elem2) || tVariantCompare(elem2.tag, &tag1) != 0) { // ignore all records with the same tag
- skipRemainValue(pSupporter1->pTSBuf, &tag1);
+ if (!tsBufIsValidElem(&cur) || tVariantCompare(cur.tag, &tag) != 0) { // ignore all records with the same tag
break;
}
- /*
- * in case of stable query, limit/offset is not applied here. the limit/offset is applied to the
- * final results which is acquired after the secondary merge of in the client.
- */
- int32_t re = tsCompare(order, elem1.ts, elem2.ts);
- if (re < 0) {
- tsBufNextPos(pSupporter1->pTSBuf);
- numOfInput1++;
- } else if (re > 0) {
- tsBufNextPos(pSupporter2->pTSBuf);
- numOfInput2++;
- } else {
+ ctxStack[stackidx++] = ctx;
+
+ int32_t ret = tsCompare(order, prev.ts, cur.ts);
+ if (ret == 0) {
+ if (++equalNum < tableNum) {
+ pctx = ctx;
+
+ if (++slot >= tableNum) {
+ slot = 0;
+ }
+
+ tableMIdx = taosArrayGet(tsCond, slot);
+ continue;
+ }
+
+ assert(stackidx == tableNum);
+
if (pLimit->offset == 0 || pQueryInfo->interval.interval > 0 || QUERY_IS_STABLE_QUERY(pQueryInfo->type)) {
- if (win->skey > elem1.ts) {
- win->skey = elem1.ts;
+ if (win->skey > prev.ts) {
+ win->skey = prev.ts;
+ }
+
+ if (win->ekey < prev.ts) {
+ win->ekey = prev.ts;
}
- if (win->ekey < elem1.ts) {
- win->ekey = elem1.ts;
+ for (int32_t i = 0; i < stackidx; ++i) {
+ SMergeTsCtx* tctx = ctxStack[i];
+ prev = tsBufGetElem(tctx->p->pTSBuf);
+
+ tsBufAppend(tctx->res, prev.id, prev.tag, (const char*)&prev.ts, sizeof(prev.ts));
}
-
- tsBufAppend(output1, elem1.id, elem1.tag, (const char*)&elem1.ts, sizeof(elem1.ts));
- tsBufAppend(output2, elem2.id, elem2.tag, (const char*)&elem2.ts, sizeof(elem2.ts));
} else {
pLimit->offset -= 1;//offset apply to projection?
}
- tsBufNextPos(pSupporter1->pTSBuf);
- numOfInput1++;
+ for (int32_t i = 0; i < stackidx; ++i) {
+ SMergeTsCtx* tctx = ctxStack[i];
+
+ if (!tsBufNextPos(tctx->p->pTSBuf) && tctx == mainCtx) {
+ mergeDone = 1;
+ }
+ tctx->numOfInput++;
+ }
- tsBufNextPos(pSupporter2->pTSBuf);
- numOfInput2++;
+ if (mergeDone) {
+ break;
+ }
+
+ stackidx = 0;
+ equalNum = 1;
+
+ ctxStack[stackidx++] = pctx;
+ } else if (ret > 0) {
+ if (!tsBufNextPos(ctx->p->pTSBuf) && ctx == mainCtx) {
+ mergeDone = 1;
+ break;
+ }
+
+ ctx->numOfInput++;
+ stackidx--;
+ } else {
+ stackidx--;
+
+ for (int32_t i = 0; i < stackidx; ++i) {
+ SMergeTsCtx* tctx = ctxStack[i];
+
+ if (!tsBufNextPos(tctx->p->pTSBuf) && tctx == mainCtx) {
+ mergeDone = 1;
+ }
+ tctx->numOfInput++;
+ }
+
+ if (mergeDone) {
+ break;
+ }
+
+ stackidx = 0;
+ equalNum = 1;
+
+ ctxStack[stackidx++] = pctx;
}
+
}
- } else { // no data in pSupporter2, ignore current data in pSupporter2
- skipRemainValue(pSupporter1->pTSBuf, &tag1);
+
+ if (mergeDone) {
+ break;
+ }
+
+ slot = 0;
+ stackidx = 0;
+
+ skipRemainValue(mainCtx->p->pTSBuf, &tag);
}
+
+ stackidx = 0;
+ slot = 0;
+ mergeDone = 0;
}
/*
@@ -242,28 +359,32 @@ static int64_t doTSBlockIntersect(SSqlObj* pSql, SJoinSupporter* pSupporter1, SJ
* 1. only one element
* 2. only one element for each tag.
*/
- if (output1->tsOrder == -1) {
- output1->tsOrder = TSDB_ORDER_ASC;
- output2->tsOrder = TSDB_ORDER_ASC;
+ if (ctxlist[0].res->tsOrder == -1) {
+ for (int32_t i = 0; i < joinNum; ++i) {
+ ctxlist[i].res->tsOrder = TSDB_ORDER_ASC;
+ }
}
- tsBufFlush(output1);
- tsBufFlush(output2);
-
- tsBufDestroy(pSupporter1->pTSBuf);
- pSupporter1->pTSBuf = NULL;
- tsBufDestroy(pSupporter2->pTSBuf);
- pSupporter2->pTSBuf = NULL;
+ for (int32_t i = 0; i < joinNum; ++i) {
+ tsBufFlush(ctxlist[i].res);
+
+ tsBufDestroy(ctxlist[i].p->pTSBuf);
+ ctxlist[i].p->pTSBuf = NULL;
+ }
TSKEY et = taosGetTimestampUs();
- tscDebug("%p input1:%" PRId64 ", input2:%" PRId64 ", final:%" PRId64 " in %d vnodes for secondary query after ts blocks "
- "intersecting, skey:%" PRId64 ", ekey:%" PRId64 ", numOfVnode:%d, elapsed time:%" PRId64 " us",
- pSql, numOfInput1, numOfInput2, output1->numOfTotal, output1->numOfGroups, win->skey, win->ekey,
- tsBufGetNumOfGroup(output1), et - st);
- return output1->numOfTotal;
+ for (int32_t i = 0; i < joinNum; ++i) {
+ tscDebug("%p sub:%p tblidx:%d, input:%" PRId64 ", final:%" PRId64 " in %d vnodes for secondary query after ts blocks "
+ "intersecting, skey:%" PRId64 ", ekey:%" PRId64 ", numOfVnode:%d, elapsed time:%" PRId64 " us",
+ pSql, pSql->pSubs[i], i, ctxlist[i].numOfInput, ctxlist[i].res->numOfTotal, ctxlist[i].res->numOfGroups, win->skey, win->ekey,
+ tsBufGetNumOfGroup(ctxlist[i].res), et - st);
+ }
+
+ return ctxlist[0].res->numOfTotal;
}
+
// todo handle failed to create sub query
SJoinSupporter* tscCreateJoinSupporter(SSqlObj* pSql, int32_t index) {
SJoinSupporter* pSupporter = calloc(1, sizeof(SJoinSupporter));
@@ -768,76 +889,218 @@ static bool checkForDuplicateTagVal(SSchema* pColSchema, SJoinSupporter* p1, SSq
return true;
}
-static int32_t getIntersectionOfTableTuple(SQueryInfo* pQueryInfo, SSqlObj* pParentSql, SArray** s1, SArray** s2) {
- SJoinSupporter* p1 = pParentSql->pSubs[0]->param;
- SJoinSupporter* p2 = pParentSql->pSubs[1]->param;
-
- tscDebug("%p all subquery retrieve complete, do tags match, %d, %d", pParentSql, p1->num, p2->num);
-
- // sort according to the tag value
- qsort(p1->pIdTagList, p1->num, p1->tagSize, tagValCompar);
- qsort(p2->pIdTagList, p2->num, p2->tagSize, tagValCompar);
+static int32_t getIntersectionOfTableTuple(SQueryInfo* pQueryInfo, SSqlObj* pParentSql, SArray* resList) {
+ int16_t joinNum = pParentSql->subState.numOfSub;
STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0);
int16_t tagColId = tscGetJoinTagColIdByUid(&pQueryInfo->tagCond, pTableMetaInfo->pTableMeta->id.uid);
-
- SSchema* pColSchema = tscGetColumnSchemaById(pTableMetaInfo->pTableMeta, tagColId);
+ SJoinSupporter* p0 = pParentSql->pSubs[0]->param;
+ SMergeCtx ctxlist[TSDB_MAX_JOIN_TABLE_NUM] = {{0}};
+ SMergeCtx* ctxStack[TSDB_MAX_JOIN_TABLE_NUM] = {0};
// int16_t for padding
- int32_t size = p1->tagSize - sizeof(int16_t);
- *s1 = taosArrayInit(p1->num, size);
- *s2 = taosArrayInit(p2->num, size);
+ int32_t size = p0->tagSize - sizeof(int16_t);
- if (!(checkForDuplicateTagVal(pColSchema, p1, pParentSql) && checkForDuplicateTagVal(pColSchema, p2, pParentSql))) {
- return TSDB_CODE_QRY_DUP_JOIN_KEY;
- }
+ SSchema* pColSchema = tscGetColumnSchemaById(pTableMetaInfo->pTableMeta, tagColId);
+
+ tscDebug("%p all subquery retrieve complete, do tags match", pParentSql);
- int32_t i = 0, j = 0;
- while(i < p1->num && j < p2->num) {
- STidTags* pp1 = (STidTags*) varDataVal(p1->pIdTagList + i * p1->tagSize);
- STidTags* pp2 = (STidTags*) varDataVal(p2->pIdTagList + j * p2->tagSize);
- assert(pp1->tid != 0 && pp2->tid != 0);
+ for (int32_t i = 0; i < joinNum; i++) {
+ SJoinSupporter* p = pParentSql->pSubs[i]->param;
- int32_t ret = doCompare(pp1->tag, pp2->tag, pColSchema->type, pColSchema->bytes);
- if (ret == 0) {
- tscDebug("%p tag matched, vgId:%d, val:%d, tid:%d, uid:%"PRIu64", tid:%d, uid:%"PRIu64, pParentSql, pp1->vgId,
- *(int*) pp1->tag, pp1->tid, pp1->uid, pp2->tid, pp2->uid);
-
- taosArrayPush(*s1, pp1);
- taosArrayPush(*s2, pp2);
- j++;
- i++;
- } else if (ret > 0) {
- j++;
- } else {
- i++;
+ ctxlist[i].p = p;
+ ctxlist[i].res = taosArrayInit(p->num, size);
+
+ tscDebug("Join %d - num:%d", i, p->num);
+
+ // sort according to the tag valu
+ qsort(p->pIdTagList, p->num, p->tagSize, tagValCompar);
+
+ if (!checkForDuplicateTagVal(pColSchema, p, pParentSql)) {
+ for (int32_t j = 0; j <= i; j++) {
+ taosArrayDestroy(ctxlist[j].res);
+ }
+ return TSDB_CODE_QRY_DUP_JOIN_KEY;
}
}
- // reorganize the tid-tag value according to both the vgroup id and tag values
- // sort according to the tag value
- size_t t1 = taosArrayGetSize(*s1);
- size_t t2 = taosArrayGetSize(*s2);
+ int32_t slot = 0;
+ size_t tableNum = 0;
+ int16_t* tableMIdx = 0;
+ int32_t equalNum = 0;
+ int32_t stackidx = 0;
+ int32_t mergeDone = 0;
+ SMergeCtx* ctx = NULL;
+ SMergeCtx* pctx = NULL;
+ STidTags* cur = NULL;
+ STidTags* prev = NULL;
+ SArray* tagCond = NULL;
- qsort((*s1)->pData, t1, size, tidTagsCompar);
- qsort((*s2)->pData, t2, size, tidTagsCompar);
+ for (int16_t tidx = 0; tidx < joinNum; tidx++) {
+ pctx = &ctxlist[tidx];
+ if (pctx->compared) {
+ continue;
+ }
-#if 0
- for(int32_t k = 0; k < t1; ++k) {
- STidTags* p = (*s1)->pData + size * k;
- printf("%d, tag:%s\n", p->vgId, ((tstr*)(p->tag))->data);
+ assert(pctx->idx == 0 && taosArrayGetSize(pctx->res) == 0);
+
+ tagCond = pQueryInfo->tagCond.joinInfo.joinTables[tidx]->tagJoin;
+
+ tableNum = taosArrayGetSize(tagCond);
+ assert(tableNum >= 2);
+
+ for (int32_t i = 0; i < tableNum; ++i) {
+ tableMIdx = taosArrayGet(tagCond, i);
+ SMergeCtx* tctx = &ctxlist[*tableMIdx];
+ tctx->compared = 1;
+ }
+
+ for (int32_t i = 0; i < tableNum; ++i) {
+ tableMIdx = taosArrayGet(tagCond, i);
+ SMergeCtx* tctx = &ctxlist[*tableMIdx];
+ if (tctx->p->num <= 0 || tctx->p->pIdTagList == NULL) {
+ mergeDone = 1;
+ break;
+ }
+ }
+
+ if (mergeDone) {
+ mergeDone = 0;
+ continue;
+ }
+
+ tableMIdx = taosArrayGet(tagCond, slot);
+
+ pctx = &ctxlist[*tableMIdx];
+
+ prev = (STidTags*) varDataVal(pctx->p->pIdTagList + pctx->idx * pctx->p->tagSize);
+
+ ctxStack[stackidx++] = pctx;
+
+ tableMIdx = taosArrayGet(tagCond, ++slot);
+
+ equalNum = 1;
+
+ while (1) {
+ ctx = &ctxlist[*tableMIdx];
+
+ cur = (STidTags*) varDataVal(ctx->p->pIdTagList + ctx->idx * ctx->p->tagSize);
+
+ assert(cur->tid != 0 && prev->tid != 0);
+
+ ctxStack[stackidx++] = ctx;
+
+ int32_t ret = doCompare(prev->tag, cur->tag, pColSchema->type, pColSchema->bytes);
+ if (ret == 0) {
+ if (++equalNum < tableNum) {
+ prev = cur;
+ pctx = ctx;
+
+ if (++slot >= tableNum) {
+ slot = 0;
+ }
+
+ tableMIdx = taosArrayGet(tagCond, slot);
+ continue;
+ }
+
+ tscDebug("%p tag matched, vgId:%d, val:%d, tid:%d, uid:%"PRIu64", tid:%d, uid:%"PRIu64, pParentSql, prev->vgId,
+ *(int*) prev->tag, prev->tid, prev->uid, cur->tid, cur->uid);
+
+ assert(stackidx == tableNum);
+
+ for (int32_t i = 0; i < stackidx; ++i) {
+ SMergeCtx* tctx = ctxStack[i];
+ prev = (STidTags*) varDataVal(tctx->p->pIdTagList + tctx->idx * tctx->p->tagSize);
+
+ taosArrayPush(tctx->res, prev);
+ }
+
+ for (int32_t i = 0; i < stackidx; ++i) {
+ SMergeCtx* tctx = ctxStack[i];
+
+ if (++tctx->idx >= tctx->p->num) {
+ mergeDone = 1;
+ break;
+ }
+ }
+
+ if (mergeDone) {
+ break;
+ }
+
+ stackidx = 0;
+ equalNum = 1;
+
+ prev = (STidTags*) varDataVal(pctx->p->pIdTagList + pctx->idx * pctx->p->tagSize);
+
+ ctxStack[stackidx++] = pctx;
+ } else if (ret > 0) {
+ stackidx--;
+
+ if (++ctx->idx >= ctx->p->num) {
+ break;
+ }
+ } else {
+ stackidx--;
+
+ for (int32_t i = 0; i < stackidx; ++i) {
+ SMergeCtx* tctx = ctxStack[i];
+ if (++tctx->idx >= tctx->p->num) {
+ mergeDone = 1;
+ break;
+ }
+ }
+
+ if (mergeDone) {
+ break;
+ }
+
+ stackidx = 0;
+ equalNum = 1;
+
+ prev = (STidTags*) varDataVal(pctx->p->pIdTagList + pctx->idx * pctx->p->tagSize);
+ ctxStack[stackidx++] = pctx;
+ }
+
+ }
+
+ slot = 0;
+ mergeDone = 0;
+ stackidx = 0;
}
- for(int32_t k = 0; k < t1; ++k) {
- STidTags* p = (*s2)->pData + size * k;
- printf("%d, tag:%s\n", p->vgId, ((tstr*)(p->tag))->data);
- }
-#endif
+ for (int32_t i = 0; i < joinNum; ++i) {
+ // reorganize the tid-tag value according to both the vgroup id and tag values
+ // sort according to the tag value
+ size_t num = taosArrayGetSize(ctxlist[i].res);
+
+ qsort((ctxlist[i].res)->pData, num, size, tidTagsCompar);
- tscDebug("%p tags match complete, result: %"PRIzu", %"PRIzu, pParentSql, t1, t2);
+ taosArrayPush(resList, &ctxlist[i].res);
+
+ tscDebug("%p tags match complete, result num: %"PRIzu, pParentSql, num);
+ }
+
return TSDB_CODE_SUCCESS;
}
+bool emptyTagList(SArray* resList, int32_t size) {
+ size_t rsize = taosArrayGetSize(resList);
+ if (rsize != size) {
+ return true;
+ }
+
+ for (int32_t i = 0; i < size; ++i) {
+ SArray** s = taosArrayGet(resList, i);
+ if (taosArrayGetSize(*s) <= 0) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
static void tidTagRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRows) {
SJoinSupporter* pSupporter = (SJoinSupporter*)param;
@@ -939,19 +1202,19 @@ static void tidTagRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
return;
}
- SArray *s1 = NULL, *s2 = NULL;
- int32_t code = getIntersectionOfTableTuple(pQueryInfo, pParentSql, &s1, &s2);
+ SArray* resList = taosArrayInit(pParentSql->subState.numOfSub, sizeof(SArray *));
+
+ int32_t code = getIntersectionOfTableTuple(pQueryInfo, pParentSql, resList);
if (code != TSDB_CODE_SUCCESS) {
freeJoinSubqueryObj(pParentSql);
pParentSql->res.code = code;
tscAsyncResultOnError(pParentSql);
- taosArrayDestroy(s1);
- taosArrayDestroy(s2);
+ taosArrayDestroy(resList);
return;
}
- if (taosArrayGetSize(s1) == 0 || taosArrayGetSize(s2) == 0) { // no results,return.
+ if (emptyTagList(resList, pParentSql->subState.numOfSub)) { // no results,return.
assert(pParentSql->fp != tscJoinQueryCallback);
tscDebug("%p tag intersect does not generated qualified tables for join, free all sub SqlObj and quit", pParentSql);
@@ -963,37 +1226,34 @@ static void tidTagRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
(*pParentSql->fp)(pParentSql->param, pParentSql, 0);
} else {
- // proceed to for ts_comp query
- SSqlCmd* pSubCmd1 = &pParentSql->pSubs[0]->cmd;
- SSqlCmd* pSubCmd2 = &pParentSql->pSubs[1]->cmd;
-
- SQueryInfo* pQueryInfo1 = tscGetQueryInfoDetail(pSubCmd1, 0);
- STableMetaInfo* pTableMetaInfo1 = tscGetMetaInfo(pQueryInfo1, 0);
- tscBuildVgroupTableInfo(pParentSql, pTableMetaInfo1, s1);
-
- SQueryInfo* pQueryInfo2 = tscGetQueryInfoDetail(pSubCmd2, 0);
- STableMetaInfo* pTableMetaInfo2 = tscGetMetaInfo(pQueryInfo2, 0);
- tscBuildVgroupTableInfo(pParentSql, pTableMetaInfo2, s2);
-
- SSqlObj* psub1 = pParentSql->pSubs[0];
- ((SJoinSupporter*)psub1->param)->pVgroupTables = tscVgroupTableInfoDup(pTableMetaInfo1->pVgroupTables);
-
- SSqlObj* psub2 = pParentSql->pSubs[1];
- ((SJoinSupporter*)psub2->param)->pVgroupTables = tscVgroupTableInfoDup(pTableMetaInfo2->pVgroupTables);
-
- pParentSql->subState.numOfSub = 2;
-
- memset(pParentSql->subState.states, 0, sizeof(pParentSql->subState.states[0]) * pParentSql->subState.numOfSub);
- tscDebug("%p reset all sub states to 0", pParentSql);
-
for (int32_t m = 0; m < pParentSql->subState.numOfSub; ++m) {
- SSqlObj* sub = pParentSql->pSubs[m];
- issueTsCompQuery(sub, sub->param, pParentSql);
+ // proceed to for ts_comp query
+ SSqlCmd* pSubCmd = &pParentSql->pSubs[m]->cmd;
+ SArray** s = taosArrayGet(resList, m);
+
+ SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(pSubCmd, 0);
+ STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0);
+ tscBuildVgroupTableInfo(pParentSql, pTableMetaInfo, *s);
+
+ SSqlObj* psub = pParentSql->pSubs[m];
+ ((SJoinSupporter*)psub->param)->pVgroupTables = tscVgroupTableInfoDup(pTableMetaInfo->pVgroupTables);
+
+ memset(pParentSql->subState.states, 0, sizeof(pParentSql->subState.states[0]) * pParentSql->subState.numOfSub);
+ tscDebug("%p reset all sub states to 0", pParentSql);
+
+ issueTsCompQuery(psub, psub->param, pParentSql);
}
}
- taosArrayDestroy(s1);
- taosArrayDestroy(s2);
+ size_t rsize = taosArrayGetSize(resList);
+ for (int32_t i = 0; i < rsize; ++i) {
+ SArray** s = taosArrayGet(resList, i);
+ if (*s) {
+ taosArrayDestroy(*s);
+ }
+ }
+
+ taosArrayDestroy(resList);
}
static void tsCompRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRows) {
@@ -1124,12 +1384,8 @@ static void tsCompRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
tscDebug("%p all subquery retrieve ts complete, do ts block intersect", pParentSql);
- // proceeds to launched secondary query to retrieve final data
- SJoinSupporter* p1 = pParentSql->pSubs[0]->param;
- SJoinSupporter* p2 = pParentSql->pSubs[1]->param;
-
STimeWindow win = TSWINDOW_INITIALIZER;
- int64_t num = doTSBlockIntersect(pParentSql, p1, p2, &win);
+ int64_t num = doTSBlockIntersect(pParentSql, &win);
if (num <= 0) { // no result during ts intersect
tscDebug("%p no results generated in ts intersection, free all sub SqlObj and quit", pParentSql);
freeJoinSubqueryObj(pParentSql);
@@ -1584,7 +1840,7 @@ int32_t tscCreateJoinSubquery(SSqlObj *pSql, int16_t tableIndex, SJoinSupporter
SSqlCmd * pCmd = &pSql->cmd;
SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex);
- pSql->res.qhandle = 0x1;
+ pSql->res.qId = 0x1;
assert(pSql->res.numOfRows == 0);
if (pSql->pSubs == NULL) {
@@ -1639,6 +1895,8 @@ int32_t tscCreateJoinSubquery(SSqlObj *pSql, int16_t tableIndex, SJoinSupporter
pNewQueryInfo->limit.limit = -1;
pNewQueryInfo->limit.offset = 0;
+ pNewQueryInfo->order.orderColId = INT32_MIN;
+
// backup the data and clear it in the sqlcmd object
memset(&pNewQueryInfo->groupbyExpr, 0, sizeof(SSqlGroupbyExpr));
@@ -2182,7 +2440,7 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) {
SColumnModel *pModel = NULL;
SColumnModel *pFinalModel = NULL;
- pRes->qhandle = 0x1; // hack the qhandle check
+ pRes->qId = 0x1; // hack the qhandle check
const uint32_t nBufferSize = (1u << 16u); // 64KB
@@ -2730,7 +2988,7 @@ void tscRetrieveDataRes(void *param, TAOS_RES *tres, int code) {
tscDebug("%p sub:%p query complete, ep:%s, vgId:%d, orderOfSub:%d, retrieve data", trsupport->pParentSql, pSql,
pVgroup->epAddr[0].fqdn, pVgroup->vgId, trsupport->subqueryIndex);
- if (pSql->res.qhandle == 0) { // qhandle is NULL, code is TSDB_CODE_SUCCESS means no results generated from this vnode
+ if (pSql->res.qId == 0) { // qhandle is NULL, code is TSDB_CODE_SUCCESS means no results generated from this vnode
tscRetrieveFromDnodeCallBack(param, pSql, 0);
} else {
taos_fetch_rows_a(tres, tscRetrieveFromDnodeCallBack, param);
diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c
index e899450261..8d320c9a83 100644
--- a/src/client/src/tscUtil.c
+++ b/src/client/src/tscUtil.c
@@ -1279,6 +1279,34 @@ int32_t tscSqlExprCopy(SArray* dst, const SArray* src, uint64_t uid, bool deepco
return 0;
}
+bool tscColumnExists(SArray* pColumnList, SColumnIndex* pColIndex) {
+ // ignore the tbname columnIndex to be inserted into source list
+ if (pColIndex->columnIndex < 0) {
+ return false;
+ }
+
+ size_t numOfCols = taosArrayGetSize(pColumnList);
+ int16_t col = pColIndex->columnIndex;
+
+ int32_t i = 0;
+ while (i < numOfCols) {
+ SColumn* pCol = taosArrayGetP(pColumnList, i);
+ if ((pCol->colIndex.columnIndex != col) || (pCol->colIndex.tableIndex != pColIndex->tableIndex)) {
+ ++i;
+ continue;
+ } else {
+ break;
+ }
+ }
+
+ if (i >= numOfCols || numOfCols == 0) {
+ return false;
+ }
+
+ return true;
+}
+
+
SColumn* tscColumnListInsert(SArray* pColumnList, SColumnIndex* pColIndex) {
// ignore the tbname columnIndex to be inserted into source list
if (pColIndex->columnIndex < 0) {
@@ -1583,7 +1611,25 @@ int32_t tscTagCondCopy(STagCond* dest, const STagCond* src) {
dest->tbnameCond.uid = src->tbnameCond.uid;
dest->tbnameCond.len = src->tbnameCond.len;
- memcpy(&dest->joinInfo, &src->joinInfo, sizeof(SJoinInfo));
+ dest->joinInfo.hasJoin = src->joinInfo.hasJoin;
+
+ for (int32_t i = 0; i < TSDB_MAX_JOIN_TABLE_NUM; ++i) {
+ if (src->joinInfo.joinTables[i]) {
+ dest->joinInfo.joinTables[i] = calloc(1, sizeof(SJoinNode));
+
+ memcpy(dest->joinInfo.joinTables[i], src->joinInfo.joinTables[i], sizeof(SJoinNode));
+
+ if (src->joinInfo.joinTables[i]->tsJoin) {
+ dest->joinInfo.joinTables[i]->tsJoin = taosArrayDup(src->joinInfo.joinTables[i]->tsJoin);
+ }
+
+ if (src->joinInfo.joinTables[i]->tagJoin) {
+ dest->joinInfo.joinTables[i]->tagJoin = taosArrayDup(src->joinInfo.joinTables[i]->tagJoin);
+ }
+ }
+ }
+
+
dest->relType = src->relType;
if (src->pCond == NULL) {
@@ -1629,6 +1675,23 @@ void tscTagCondRelease(STagCond* pTagCond) {
taosArrayDestroy(pTagCond->pCond);
}
+ for (int32_t i = 0; i < TSDB_MAX_JOIN_TABLE_NUM; ++i) {
+ SJoinNode *node = pTagCond->joinInfo.joinTables[i];
+ if (node == NULL) {
+ continue;
+ }
+
+ if (node->tsJoin != NULL) {
+ taosArrayDestroy(node->tsJoin);
+ }
+
+ if (node->tagJoin != NULL) {
+ taosArrayDestroy(node->tagJoin);
+ }
+
+ tfree(node);
+ }
+
memset(pTagCond, 0, sizeof(STagCond));
}
@@ -2318,16 +2381,21 @@ void tscDoQuery(SSqlObj* pSql) {
}
int16_t tscGetJoinTagColIdByUid(STagCond* pTagCond, uint64_t uid) {
- if (pTagCond->joinInfo.left.uid == uid) {
- return pTagCond->joinInfo.left.tagColId;
- } else if (pTagCond->joinInfo.right.uid == uid) {
- return pTagCond->joinInfo.right.tagColId;
- } else {
- assert(0);
- return -1;
+ int32_t i = 0;
+ while (i < TSDB_MAX_JOIN_TABLE_NUM) {
+ SJoinNode* node = pTagCond->joinInfo.joinTables[i];
+ if (node && node->uid == uid) {
+ return node->tagColId;
+ }
+
+ i++;
}
+
+ assert(0);
+ return -1;
}
+
int16_t tscGetTagColIndexById(STableMeta* pTableMeta, int16_t colId) {
int32_t numOfTags = tscGetNumOfTags(pTableMeta);
diff --git a/src/common/inc/tcmdtype.h b/src/common/inc/tcmdtype.h
index 8da81f8a9c..1e362f5546 100644
--- a/src/common/inc/tcmdtype.h
+++ b/src/common/inc/tcmdtype.h
@@ -53,6 +53,7 @@ enum {
TSDB_DEFINE_SQL_TYPE( TSDB_SQL_ALTER_ACCT, "alter-acct" )
TSDB_DEFINE_SQL_TYPE( TSDB_SQL_ALTER_TABLE, "alter-table" )
TSDB_DEFINE_SQL_TYPE( TSDB_SQL_ALTER_DB, "alter-db" )
+ TSDB_DEFINE_SQL_TYPE(TSDB_SQL_SYNC_DB_REPLICA, "sync db-replica")
TSDB_DEFINE_SQL_TYPE( TSDB_SQL_CREATE_MNODE, "create-mnode" )
TSDB_DEFINE_SQL_TYPE( TSDB_SQL_DROP_MNODE, "drop-mnode" )
TSDB_DEFINE_SQL_TYPE( TSDB_SQL_CREATE_DNODE, "create-dnode" )
@@ -90,13 +91,13 @@ enum {
*/
TSDB_DEFINE_SQL_TYPE( TSDB_SQL_RETRIEVE_EMPTY_RESULT, "retrieve-empty-result" )
- TSDB_DEFINE_SQL_TYPE( TSDB_SQL_RESET_CACHE, "reset-cache" )
- TSDB_DEFINE_SQL_TYPE( TSDB_SQL_SERV_STATUS, "serv-status" )
- TSDB_DEFINE_SQL_TYPE( TSDB_SQL_CURRENT_DB, "current-db" )
+ TSDB_DEFINE_SQL_TYPE( TSDB_SQL_RESET_CACHE, "reset-cache" )
+ TSDB_DEFINE_SQL_TYPE( TSDB_SQL_SERV_STATUS, "serv-status" )
+ TSDB_DEFINE_SQL_TYPE( TSDB_SQL_CURRENT_DB, "current-db" )
TSDB_DEFINE_SQL_TYPE( TSDB_SQL_SERV_VERSION, "serv-version" )
- TSDB_DEFINE_SQL_TYPE( TSDB_SQL_CLI_VERSION, "cli-version" )
+ TSDB_DEFINE_SQL_TYPE( TSDB_SQL_CLI_VERSION, "cli-version" )
TSDB_DEFINE_SQL_TYPE( TSDB_SQL_CURRENT_USER, "current-user ")
- TSDB_DEFINE_SQL_TYPE( TSDB_SQL_CFG_LOCAL, "cfg-local" )
+ TSDB_DEFINE_SQL_TYPE( TSDB_SQL_CFG_LOCAL, "cfg-local" )
TSDB_DEFINE_SQL_TYPE( TSDB_SQL_MAX, "max" )
};
diff --git a/src/common/src/tglobal.c b/src/common/src/tglobal.c
index 4a5df9361b..4fef3844c4 100644
--- a/src/common/src/tglobal.c
+++ b/src/common/src/tglobal.c
@@ -71,7 +71,7 @@ int32_t tsMaxBinaryDisplayWidth = 30;
int32_t tsCompressMsgSize = -1;
// client
-int32_t tsMaxSQLStringLen = TSDB_MAX_SQL_LEN;
+int32_t tsMaxSQLStringLen = TSDB_MAX_ALLOWED_SQL_LEN;
int8_t tsTscEnableRecordSql = 0;
// the maximum number of results for projection query on super table that are returned from
diff --git a/src/dnode/CMakeLists.txt b/src/dnode/CMakeLists.txt
index 516e5b4d1f..dd18f00920 100644
--- a/src/dnode/CMakeLists.txt
+++ b/src/dnode/CMakeLists.txt
@@ -35,6 +35,10 @@ IF (TD_TOPIC)
TARGET_LINK_LIBRARIES(taosd topic)
ENDIF ()
+IF (TD_MODULE AND TD_LINUX)
+ TARGET_LINK_LIBRARIES(taosd module dl)
+ENDIF ()
+
SET(PREPARE_ENV_CMD "prepare_env_cmd")
SET(PREPARE_ENV_TARGET "prepare_env_target")
ADD_CUSTOM_COMMAND(OUTPUT ${PREPARE_ENV_CMD}
diff --git a/src/dnode/src/dnodeMain.c b/src/dnode/src/dnodeMain.c
index c24eac84cf..fb46709440 100644
--- a/src/dnode/src/dnodeMain.c
+++ b/src/dnode/src/dnodeMain.c
@@ -39,6 +39,13 @@
#include "dnodeMPeer.h"
#include "dnodeShell.h"
#include "dnodeTelemetry.h"
+#include "module.h"
+
+#if !defined(_MODULE) || !defined(_TD_LINUX)
+int32_t moduleStart() { return 0; }
+void moduleStop() {}
+#endif
+
void *tsDnodeTmr = NULL;
static SRunStatus tsRunStatus = TSDB_RUN_STATUS_STOPPED;
@@ -146,6 +153,7 @@ int32_t dnodeInitSystem() {
}
dnodeSetRunStatus(TSDB_RUN_STATUS_RUNING);
+ moduleStart();
dnodeReportStep("TDengine", "initialized successfully", 1);
dInfo("TDengine is initialized successfully");
@@ -155,6 +163,7 @@ int32_t dnodeInitSystem() {
void dnodeCleanUpSystem() {
if (dnodeGetRunStatus() != TSDB_RUN_STATUS_STOPPED) {
+ moduleStop();
dnodeSetRunStatus(TSDB_RUN_STATUS_STOPPED);
dnodeCleanupTmr();
dnodeCleanupComponents();
diff --git a/src/dnode/src/dnodePeer.c b/src/dnode/src/dnodePeer.c
index 79c60874f9..b8ce1c802b 100644
--- a/src/dnode/src/dnodePeer.c
+++ b/src/dnode/src/dnodePeer.c
@@ -43,6 +43,7 @@ int32_t dnodeInitServer() {
dnodeProcessReqMsgFp[TSDB_MSG_TYPE_MD_CREATE_VNODE] = dnodeDispatchToVMgmtQueue;
dnodeProcessReqMsgFp[TSDB_MSG_TYPE_MD_ALTER_VNODE] = dnodeDispatchToVMgmtQueue;
+ dnodeProcessReqMsgFp[TSDB_MSG_TYPE_MD_SYNC_VNODE] = dnodeDispatchToVMgmtQueue;
dnodeProcessReqMsgFp[TSDB_MSG_TYPE_MD_DROP_VNODE] = dnodeDispatchToVMgmtQueue;
dnodeProcessReqMsgFp[TSDB_MSG_TYPE_MD_ALTER_STREAM] = dnodeDispatchToVMgmtQueue;
dnodeProcessReqMsgFp[TSDB_MSG_TYPE_MD_CONFIG_DNODE] = dnodeDispatchToVMgmtQueue;
diff --git a/src/dnode/src/dnodeShell.c b/src/dnode/src/dnodeShell.c
index e41821a0ec..8da5f0e941 100644
--- a/src/dnode/src/dnodeShell.c
+++ b/src/dnode/src/dnodeShell.c
@@ -50,6 +50,7 @@ int32_t dnodeInitShell() {
dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_CREATE_TP] = dnodeDispatchToMWriteQueue;
dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_CREATE_FUNCTION] = dnodeDispatchToMWriteQueue;
dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_DROP_DB] = dnodeDispatchToMWriteQueue;
+ dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_SYNC_DB] = dnodeDispatchToMWriteQueue;
dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_DROP_TP] = dnodeDispatchToMWriteQueue;
dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_DROP_FUNCTION] = dnodeDispatchToMWriteQueue;
dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_ALTER_DB] = dnodeDispatchToMWriteQueue;
diff --git a/src/dnode/src/dnodeVMgmt.c b/src/dnode/src/dnodeVMgmt.c
index 1e428fc8b1..66c94bf675 100644
--- a/src/dnode/src/dnodeVMgmt.c
+++ b/src/dnode/src/dnodeVMgmt.c
@@ -30,6 +30,7 @@ static taos_queue tsVMgmtQueue = NULL;
static void * dnodeProcessMgmtQueue(void *param);
static int32_t dnodeProcessCreateVnodeMsg(SRpcMsg *pMsg);
static int32_t dnodeProcessAlterVnodeMsg(SRpcMsg *pMsg);
+static int32_t dnodeProcessSyncVnodeMsg(SRpcMsg *pMsg);
static int32_t dnodeProcessDropVnodeMsg(SRpcMsg *pMsg);
static int32_t dnodeProcessAlterStreamMsg(SRpcMsg *pMsg);
static int32_t dnodeProcessConfigDnodeMsg(SRpcMsg *pMsg);
@@ -39,6 +40,7 @@ static int32_t (*dnodeProcessMgmtMsgFp[TSDB_MSG_TYPE_MAX])(SRpcMsg *pMsg);
int32_t dnodeInitVMgmt() {
dnodeProcessMgmtMsgFp[TSDB_MSG_TYPE_MD_CREATE_VNODE] = dnodeProcessCreateVnodeMsg;
dnodeProcessMgmtMsgFp[TSDB_MSG_TYPE_MD_ALTER_VNODE] = dnodeProcessAlterVnodeMsg;
+ dnodeProcessMgmtMsgFp[TSDB_MSG_TYPE_MD_SYNC_VNODE] = dnodeProcessSyncVnodeMsg;
dnodeProcessMgmtMsgFp[TSDB_MSG_TYPE_MD_DROP_VNODE] = dnodeProcessDropVnodeMsg;
dnodeProcessMgmtMsgFp[TSDB_MSG_TYPE_MD_ALTER_STREAM] = dnodeProcessAlterStreamMsg;
dnodeProcessMgmtMsgFp[TSDB_MSG_TYPE_MD_CONFIG_DNODE] = dnodeProcessConfigDnodeMsg;
@@ -179,6 +181,13 @@ static int32_t dnodeProcessAlterVnodeMsg(SRpcMsg *rpcMsg) {
}
}
+static int32_t dnodeProcessSyncVnodeMsg(SRpcMsg *rpcMsg) {
+ SSyncVnodeMsg *pSyncVnode = rpcMsg->pCont;
+ pSyncVnode->vgId = htonl(pSyncVnode->vgId);
+
+ return vnodeSync(pSyncVnode->vgId);
+}
+
static int32_t dnodeProcessDropVnodeMsg(SRpcMsg *rpcMsg) {
SDropVnodeMsg *pDrop = rpcMsg->pCont;
pDrop->vgId = htonl(pDrop->vgId);
diff --git a/src/dnode/src/dnodeVnodes.c b/src/dnode/src/dnodeVnodes.c
index d00314fcbc..d96251cebe 100644
--- a/src/dnode/src/dnodeVnodes.c
+++ b/src/dnode/src/dnodeVnodes.c
@@ -202,10 +202,11 @@ static void dnodeProcessStatusRsp(SRpcMsg *pMsg) {
char clusterId[TSDB_CLUSTER_ID_LEN];
dnodeGetClusterId(clusterId);
if (clusterId[0] != '\0') {
- dError("exit zombie dropped dnode");
- exit(EXIT_FAILURE);
+ dError("exit zombie dropped dnode");
+ exit(EXIT_FAILURE);
}
}
+
taosTmrReset(dnodeSendStatusMsg, tsStatusInterval * 1000, NULL, tsDnodeTmr, &tsStatusTimer);
return;
}
diff --git a/src/inc/module.h b/src/inc/module.h
new file mode 100644
index 0000000000..b9b64c493e
--- /dev/null
+++ b/src/inc/module.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2019 TAOS Data, Inc.
+ *
+ * This program is free software: you can use, redistribute, and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3
+ * or later ("AGPL"), as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef TDENGINE_MODULE
+#define TDENGINE_MODULE
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int32_t moduleStart();
+void moduleStop();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/src/inc/query.h b/src/inc/query.h
index 77a12ebfc5..c9dabcef54 100644
--- a/src/inc/query.h
+++ b/src/inc/query.h
@@ -38,7 +38,7 @@ int32_t qCreateQueryInfo(void* tsdb, int32_t vgId, SQueryTableMsg* pQueryTableMs
* @param qinfo
* @return
*/
-bool qTableQuery(qinfo_t qinfo);
+bool qTableQuery(qinfo_t qinfo, uint64_t *qId);
/**
* Retrieve the produced results information, if current query is not paused or completed,
diff --git a/src/inc/taosdef.h b/src/inc/taosdef.h
index 9276b2291a..85708e1382 100644
--- a/src/inc/taosdef.h
+++ b/src/inc/taosdef.h
@@ -262,7 +262,7 @@ do { \
#define TSDB_MIN_TABLES 4
#define TSDB_MAX_TABLES 10000000
#define TSDB_DEFAULT_TABLES 1000000
-#define TSDB_TABLES_STEP 1000
+#define TSDB_TABLES_STEP 100
#define TSDB_MIN_DAYS_PER_FILE 1
#define TSDB_MAX_DAYS_PER_FILE 3650
@@ -320,7 +320,7 @@ do { \
#define TSDB_MAX_DB_QUORUM_OPTION 2
#define TSDB_DEFAULT_DB_QUORUM_OPTION 1
-#define TSDB_MAX_JOIN_TABLE_NUM 5
+#define TSDB_MAX_JOIN_TABLE_NUM 10
#define TSDB_MAX_UNION_CLAUSE 5
#define TSDB_MAX_BINARY_LEN (TSDB_MAX_BYTES_PER_ROW-TSDB_KEYSIZE)
diff --git a/src/inc/taosmsg.h b/src/inc/taosmsg.h
index 201b7865a2..7dca0f2dc1 100644
--- a/src/inc/taosmsg.h
+++ b/src/inc/taosmsg.h
@@ -59,6 +59,7 @@ TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_MD_DROP_STABLE, "drop-stable" )
TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_MD_ALTER_STREAM, "alter-stream" )
TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_MD_CONFIG_DNODE, "config-dnode" )
TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_MD_ALTER_VNODE, "alter-vnode" )
+TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_MD_SYNC_VNODE, "sync-vnode" )
TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_MD_CREATE_MNODE, "create-mnode" )
TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_DUMMY6, "dummy6" )
TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_DUMMY7, "dummy7" )
@@ -79,6 +80,7 @@ TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_DROP_DB, "drop-db" )
TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_DROP_FUNCTION, "drop-function" )
TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_USE_DB, "use-db" )
TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_ALTER_DB, "alter-db" )
+TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_SYNC_DB, "sync-db-replica" )
TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_CREATE_TABLE, "create-table" )
TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_DROP_TABLE, "drop-table" )
TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_ALTER_TABLE, "alter-table" )
@@ -391,7 +393,7 @@ typedef struct {
typedef struct {
int32_t vgId;
-} SDropVnodeMsg;
+} SDropVnodeMsg, SSyncVnodeMsg;
typedef struct SColIndex {
int16_t colId; // column id
@@ -519,12 +521,13 @@ typedef struct {
typedef struct {
int32_t code;
- uint64_t qhandle; // query handle
+ union{uint64_t qhandle; uint64_t qId;}; // query handle
} SQueryTableRsp;
+// todo: the show handle should be replaced with id
typedef struct {
SMsgHead header;
- uint64_t qhandle;
+ union{uint64_t qhandle; uint64_t qId;}; // query handle
uint16_t free;
} SRetrieveTableMsg;
@@ -613,7 +616,7 @@ typedef struct {
typedef struct {
char db[TSDB_TABLE_FNAME_LEN];
uint8_t ignoreNotExists;
-} SDropDbMsg, SUseDbMsg;
+} SDropDbMsg, SUseDbMsg, SSyncDbMsg;
// IMPORTANT: sizeof(SVnodeStatisticInfo) should not exceed
// TSDB_FILE_HEADER_LEN/4 - TSDB_FILE_HEADER_VERSION_SIZE
diff --git a/src/inc/tsdb.h b/src/inc/tsdb.h
index 493bdbe5de..495bfa2384 100644
--- a/src/inc/tsdb.h
+++ b/src/inc/tsdb.h
@@ -245,7 +245,7 @@ typedef struct {
* @param qinfo query info handle from query processor
* @return
*/
-TsdbQueryHandleT *tsdbQueryTables(STsdbRepo *tsdb, STsdbQueryCond *pCond, STableGroupInfo *tableInfoGroup, void *qinfo,
+TsdbQueryHandleT *tsdbQueryTables(STsdbRepo *tsdb, STsdbQueryCond *pCond, STableGroupInfo *tableInfoGroup, uint64_t qId,
SMemRef *pRef);
/**
@@ -258,7 +258,7 @@ TsdbQueryHandleT *tsdbQueryTables(STsdbRepo *tsdb, STsdbQueryCond *pCond, STable
* @param tableInfo table list.
* @return
*/
-TsdbQueryHandleT tsdbQueryLastRow(STsdbRepo *tsdb, STsdbQueryCond *pCond, STableGroupInfo *tableInfo, void *qinfo,
+TsdbQueryHandleT tsdbQueryLastRow(STsdbRepo *tsdb, STsdbQueryCond *pCond, STableGroupInfo *tableInfo, uint64_t qId,
SMemRef *pRef);
/**
@@ -277,7 +277,7 @@ SArray *tsdbGetQueriedTableList(TsdbQueryHandleT *pHandle);
* @return
*/
TsdbQueryHandleT tsdbQueryRowsInExternalWindow(STsdbRepo *tsdb, STsdbQueryCond *pCond, STableGroupInfo *groupList,
- void *qinfo, SMemRef *pRef);
+ uint64_t qId, SMemRef *pRef);
/**
diff --git a/src/inc/ttokendef.h b/src/inc/ttokendef.h
index 6e845124b1..81be7e1984 100644
--- a/src/inc/ttokendef.h
+++ b/src/inc/ttokendef.h
@@ -156,56 +156,58 @@
#define TK_NOW 137
#define TK_RESET 138
#define TK_QUERY 139
-#define TK_ADD 140
-#define TK_COLUMN 141
-#define TK_TAG 142
-#define TK_CHANGE 143
-#define TK_SET 144
-#define TK_KILL 145
-#define TK_CONNECTION 146
-#define TK_STREAM 147
-#define TK_COLON 148
-#define TK_ABORT 149
-#define TK_AFTER 150
-#define TK_ATTACH 151
-#define TK_BEFORE 152
-#define TK_BEGIN 153
-#define TK_CASCADE 154
-#define TK_CLUSTER 155
-#define TK_CONFLICT 156
-#define TK_COPY 157
-#define TK_DEFERRED 158
-#define TK_DELIMITERS 159
-#define TK_DETACH 160
-#define TK_EACH 161
-#define TK_END 162
-#define TK_EXPLAIN 163
-#define TK_FAIL 164
-#define TK_FOR 165
-#define TK_IGNORE 166
-#define TK_IMMEDIATE 167
-#define TK_INITIALLY 168
-#define TK_INSTEAD 169
-#define TK_MATCH 170
-#define TK_KEY 171
-#define TK_OF 172
-#define TK_RAISE 173
-#define TK_REPLACE 174
-#define TK_RESTRICT 175
-#define TK_ROW 176
-#define TK_STATEMENT 177
-#define TK_TRIGGER 178
-#define TK_VIEW 179
-#define TK_SEMI 180
-#define TK_NONE 181
-#define TK_PREV 182
-#define TK_LINEAR 183
-#define TK_IMPORT 184
-#define TK_TBNAME 185
-#define TK_JOIN 186
-#define TK_INSERT 187
-#define TK_INTO 188
-#define TK_VALUES 189
+#define TK_SYNCDB 140
+#define TK_ADD 141
+#define TK_COLUMN 142
+#define TK_TAG 143
+#define TK_CHANGE 144
+#define TK_SET 145
+#define TK_KILL 146
+#define TK_CONNECTION 147
+#define TK_STREAM 148
+#define TK_COLON 149
+#define TK_ABORT 150
+#define TK_AFTER 151
+#define TK_ATTACH 152
+#define TK_BEFORE 153
+#define TK_BEGIN 154
+#define TK_CASCADE 155
+#define TK_CLUSTER 156
+#define TK_CONFLICT 157
+#define TK_COPY 158
+#define TK_DEFERRED 159
+#define TK_DELIMITERS 160
+#define TK_DETACH 161
+#define TK_EACH 162
+#define TK_END 163
+#define TK_EXPLAIN 164
+#define TK_FAIL 165
+#define TK_FOR 166
+#define TK_IGNORE 167
+#define TK_IMMEDIATE 168
+#define TK_INITIALLY 169
+#define TK_INSTEAD 170
+#define TK_MATCH 171
+#define TK_KEY 172
+#define TK_OF 173
+#define TK_RAISE 174
+#define TK_REPLACE 175
+#define TK_RESTRICT 176
+#define TK_ROW 177
+#define TK_STATEMENT 178
+#define TK_TRIGGER 179
+#define TK_VIEW 180
+#define TK_SEMI 181
+#define TK_NONE 182
+#define TK_PREV 183
+#define TK_LINEAR 184
+#define TK_IMPORT 185
+#define TK_TBNAME 186
+#define TK_JOIN 187
+#define TK_INSERT 188
+#define TK_INTO 189
+#define TK_VALUES 190
+
diff --git a/src/inc/vnode.h b/src/inc/vnode.h
index dddec83da8..39bd2f46c3 100644
--- a/src/inc/vnode.h
+++ b/src/inc/vnode.h
@@ -60,6 +60,7 @@ int32_t vnodeCreate(SCreateVnodeMsg *pVnodeCfg);
int32_t vnodeDrop(int32_t vgId);
int32_t vnodeOpen(int32_t vgId);
int32_t vnodeAlter(void *pVnode, SCreateVnodeMsg *pVnodeCfg);
+int32_t vnodeSync(int32_t vgId);
int32_t vnodeClose(int32_t vgId);
// vnodeMgmt
@@ -89,4 +90,4 @@ int32_t vnodeProcessRead(void *pVnode, SVReadMsg *pRead);
}
#endif
-#endif
\ No newline at end of file
+#endif
diff --git a/src/kit/shell/inc/shell.h b/src/kit/shell/inc/shell.h
index 019f3e5d92..d0b7149541 100644
--- a/src/kit/shell/inc/shell.h
+++ b/src/kit/shell/inc/shell.h
@@ -74,6 +74,7 @@ void source_file(TAOS* con, char* fptr);
void source_dir(TAOS* con, SShellArguments* args);
void shellCheck(TAOS* con, SShellArguments* args);
void get_history_path(char* history);
+void shellCheck(TAOS* con, SShellArguments* args);
void cleanup_handler(void* arg);
void exitShell();
int shellDumpResult(TAOS_RES* con, char* fname, int* error_no, bool printMode);
diff --git a/src/kit/shell/src/shellEngine.c b/src/kit/shell/src/shellEngine.c
index b9529aac8e..0eb1248fad 100644
--- a/src/kit/shell/src/shellEngine.c
+++ b/src/kit/shell/src/shellEngine.c
@@ -132,7 +132,6 @@ TAOS *shellInit(SShellArguments *args) {
return con;
}
-
static bool isEmptyCommand(const char* cmd) {
for (char c = *cmd++; c != 0; c = *cmd++) {
if (c != ' ' && c != '\t' && c != ';') {
diff --git a/src/kit/taosdemo/CMakeLists.txt b/src/kit/taosdemo/CMakeLists.txt
index a75157b94c..ba27044a87 100644
--- a/src/kit/taosdemo/CMakeLists.txt
+++ b/src/kit/taosdemo/CMakeLists.txt
@@ -3,6 +3,55 @@ PROJECT(TDengine)
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/client/inc)
+FIND_PACKAGE(Git)
+IF (GIT_FOUND)
+ MESSAGE("Git found")
+ EXECUTE_PROCESS(
+ COMMAND ${GIT_EXECUTABLE} log --pretty=oneline -n 1 ${CMAKE_CURRENT_LIST_DIR}/taosdemo.c
+ RESULT_VARIABLE RESULT
+ OUTPUT_VARIABLE TAOSDEMO_COMMIT)
+ EXECUTE_PROCESS(
+ COMMAND bash "-c" "echo '${TAOSDEMO_COMMIT}' | awk '{print $1}' | cut -c -9"
+ RESULT_VARIABLE RESULT
+ OUTPUT_VARIABLE TAOSDEMO_COMMIT_SHA1)
+ EXECUTE_PROCESS(
+ COMMAND ${GIT_EXECUTABLE} status -z -s ${CMAKE_CURRENT_LIST_DIR}/taosdemo.c
+ RESULT_VARIABLE RESULT
+ OUTPUT_VARIABLE TAOSDEMO_STATUS)
+ EXECUTE_PROCESS(
+ COMMAND bash "-c" "echo '${TAOSDEMO_STATUS}' | awk '{print $1}'"
+ RESULT_VARIABLE RESULT
+ OUTPUT_VARIABLE TAOSDEMO_STATUS)
+ MESSAGE("taosdemo.c status: " ${TAOSDEMO_STATUS})
+ELSE()
+ MESSAGE("Git not found")
+ SET(TAOSDEMO_COMMIT_SHA1 "unknown")
+ SET(TAOSDEMO_STATUS "unknown")
+ENDIF (GIT_FOUND)
+
+STRING(STRIP ${TAOSDEMO_COMMIT_SHA1} TAOSDEMO_COMMIT_SHA1)
+MESSAGE("taosdemo's latest commit in short is:" ${TAOSDEMO_COMMIT_SHA1})
+STRING(STRIP ${TAOSDEMO_STATUS} TAOSDEMO_STATUS)
+
+IF (TAOSDEMO_STATUS MATCHES "M")
+ SET(TAOSDEMO_STATUS "modified")
+ELSE()
+ SET(TAOSDEMO_STATUS "")
+ENDIF ()
+MESSAGE("taosdemo's status is:" ${TAOSDEMO_STATUS})
+
+ADD_DEFINITIONS(-DTAOSDEMO_COMMIT_SHA1="${TAOSDEMO_COMMIT_SHA1}")
+ADD_DEFINITIONS(-DTAOSDEMO_STATUS="${TAOSDEMO_STATUS}")
+
+MESSAGE("VERNUMBER is:" ${VERNUMBER})
+IF ("${VERNUMBER}" STREQUAL "")
+ SET(TD_VERSION_NUMBER "TDengine-version-unknown")
+ELSE()
+ SET(TD_VERSION_NUMBER ${VERNUMBER})
+ENDIF ()
+MESSAGE("TD_VERSION_NUMBER is:" ${TD_VERSION_NUMBER})
+ADD_DEFINITIONS(-DTD_VERNUMBER="${TD_VERSION_NUMBER}")
+
IF (TD_LINUX)
AUX_SOURCE_DIRECTORY(. SRC)
ADD_EXECUTABLE(taosdemo ${SRC})
diff --git a/src/kit/taosdemo/insert-interlace.json b/src/kit/taosdemo/insert-interlace.json
index 0f54f008fb..344db4fd00 100644
--- a/src/kit/taosdemo/insert-interlace.json
+++ b/src/kit/taosdemo/insert-interlace.json
@@ -41,7 +41,7 @@
"insert_mode": "taosc",
"insert_rows": 1000,
"multi_thread_write_one_tbl": "no",
- "rows_per_tbl": 20,
+ "interlace_rows": 20,
"max_sql_len": 1024000,
"disorder_ratio": 0,
"disorder_range": 1000,
diff --git a/src/kit/taosdemo/insert.json b/src/kit/taosdemo/insert.json
index e6b1895043..f0e3ab1d50 100644
--- a/src/kit/taosdemo/insert.json
+++ b/src/kit/taosdemo/insert.json
@@ -41,7 +41,7 @@
"insert_mode": "taosc",
"insert_rows": 100000,
"multi_thread_write_one_tbl": "no",
- "rows_per_tbl": 0,
+ "interlace_rows": 0,
"max_sql_len": 1024000,
"disorder_ratio": 0,
"disorder_range": 1000,
diff --git a/src/kit/taosdemo/taosdemo.c b/src/kit/taosdemo/taosdemo.c
index b390ee76cd..ff69c9f81a 100644
--- a/src/kit/taosdemo/taosdemo.c
+++ b/src/kit/taosdemo/taosdemo.c
@@ -37,10 +37,10 @@
#include
#include
#include
-#else
+#else
#include
#include
-#endif
+#endif
#include
#include
@@ -69,7 +69,10 @@ enum TEST_MODE {
#define MAX_SQL_SIZE 65536
#define BUFFER_SIZE (65536*2)
+#define MAX_USERNAME_SIZE 64
+#define MAX_PASSWORD_SIZE 64
#define MAX_DB_NAME_SIZE 64
+#define MAX_HOSTNAME_SIZE 64
#define MAX_TB_NAME_SIZE 64
#define MAX_DATA_SIZE 16000
#define MAX_NUM_DATATYPE 10
@@ -86,7 +89,7 @@ enum TEST_MODE {
#define MAX_COLUMN_COUNT 1024
#define MAX_TAG_COUNT 128
-#define MAX_QUERY_SQL_COUNT 10
+#define MAX_QUERY_SQL_COUNT 100
#define MAX_QUERY_SQL_LENGTH 256
#define MAX_DATABASE_COUNT 256
@@ -94,12 +97,13 @@ enum TEST_MODE {
#define DEFAULT_TIMESTAMP_STEP 1
+
typedef enum CREATE_SUB_TALBE_MOD_EN {
PRE_CREATE_SUBTBL,
AUTO_CREATE_SUBTBL,
NO_CREATE_SUBTBL
} CREATE_SUB_TALBE_MOD_EN;
-
+
typedef enum TALBE_EXISTS_EN {
TBL_NO_EXISTS,
TBL_ALREADY_EXISTS,
@@ -107,7 +111,7 @@ typedef enum TALBE_EXISTS_EN {
} TALBE_EXISTS_EN;
enum MODE {
- SYNC,
+ SYNC,
ASYNC,
MODE_BUT
};
@@ -118,11 +122,11 @@ typedef enum enum_INSERT_MODE {
INVALID_INSERT_MODE
} INSERT_MODE;
-enum QUERY_TYPE {
+typedef enum enumQUERY_TYPE {
NO_INSERT_TYPE,
INSERT_TYPE,
QUERY_TYPE_BUT
-} ;
+} QUERY_TYPE;
enum _show_db_index {
TSDB_SHOW_DB_NAME_INDEX,
@@ -130,7 +134,7 @@ enum _show_db_index {
TSDB_SHOW_DB_NTABLES_INDEX,
TSDB_SHOW_DB_VGROUPS_INDEX,
TSDB_SHOW_DB_REPLICA_INDEX,
- TSDB_SHOW_DB_QUORUM_INDEX,
+ TSDB_SHOW_DB_QUORUM_INDEX,
TSDB_SHOW_DB_DAYS_INDEX,
TSDB_SHOW_DB_KEEP_INDEX,
TSDB_SHOW_DB_CACHE_INDEX,
@@ -141,7 +145,7 @@ enum _show_db_index {
TSDB_SHOW_DB_FSYNC_INDEX,
TSDB_SHOW_DB_COMP_INDEX,
TSDB_SHOW_DB_CACHELAST_INDEX,
- TSDB_SHOW_DB_PRECISION_INDEX,
+ TSDB_SHOW_DB_PRECISION_INDEX,
TSDB_SHOW_DB_UPDATE_INDEX,
TSDB_SHOW_DB_STATUS_INDEX,
TSDB_MAX_SHOW_DB
@@ -152,10 +156,10 @@ enum _show_stables_index {
TSDB_SHOW_STABLES_NAME_INDEX,
TSDB_SHOW_STABLES_CREATED_TIME_INDEX,
TSDB_SHOW_STABLES_COLUMNS_INDEX,
- TSDB_SHOW_STABLES_METRIC_INDEX,
- TSDB_SHOW_STABLES_UID_INDEX,
+ TSDB_SHOW_STABLES_METRIC_INDEX,
+ TSDB_SHOW_STABLES_UID_INDEX,
TSDB_SHOW_STABLES_TID_INDEX,
- TSDB_SHOW_STABLES_VGID_INDEX,
+ TSDB_SHOW_STABLES_VGID_INDEX,
TSDB_MAX_SHOW_STABLES
};
@@ -187,6 +191,7 @@ typedef struct SArguments_S {
char * tb_prefix;
char * sqlFile;
bool use_metric;
+ bool drop_database;
bool insert_only;
bool answer_yes;
bool debug_print;
@@ -199,7 +204,8 @@ typedef struct SArguments_S {
int num_of_CPR;
int num_of_threads;
int insert_interval;
- int rows_per_tbl;
+ int query_times;
+ int interlace_rows;
int num_of_RPR;
int max_sql_len;
int num_of_tables;
@@ -217,13 +223,12 @@ typedef struct SColumn_S {
char field[TSDB_COL_NAME_LEN + 1];
char dataType[MAX_TB_NAME_SIZE];
int dataLen;
- char note[128];
+ char note[128];
} StrColumn;
typedef struct SSuperTable_S {
char sTblName[MAX_TB_NAME_SIZE+1];
int childTblCount;
- bool superTblExists; // 0: no, 1: yes
bool childTblExists; // 0: no, 1: yes
int batchCreateTableNum; // 0: no batch, > 0: batch table number in one sql
int8_t autoCreateTable; // 0: create sub table, 1: auto create sub table
@@ -234,7 +239,7 @@ typedef struct SSuperTable_S {
int childTblOffset;
int multiThreadWriteOneTbl; // 0: no, 1: yes
- int rowsPerTbl; //
+ int interlaceRows; //
int disorderRatio; // 0: no disorder, >0: x%
int disorderRange; // ms or us by database precision
int maxSqlLen; //
@@ -267,7 +272,7 @@ typedef struct SSuperTable_S {
int tagSampleCount;
int tagUsePos;
- // statistics
+ // statistics
int64_t totalInsertRows;
int64_t totalAffectedRows;
} SSuperTable;
@@ -276,10 +281,10 @@ typedef struct {
char name[TSDB_DB_NAME_LEN + 1];
char create_time[32];
int32_t ntables;
- int32_t vgroups;
+ int32_t vgroups;
int16_t replica;
int16_t quorum;
- int16_t days;
+ int16_t days;
char keeplist[32];
int32_t cache; //MB
int32_t blocks;
@@ -294,14 +299,14 @@ typedef struct {
char status[16];
} SDbInfo;
-typedef struct SDbCfg_S {
+typedef struct SDbCfg_S {
// int maxtablesPerVnode;
- int minRows;
+ int minRows;
int maxRows;
int comp;
int walLevel;
int cacheLast;
- int fsync;
+ int fsync;
int replica;
int update;
int keep;
@@ -309,12 +314,12 @@ typedef struct SDbCfg_S {
int cache;
int blocks;
int quorum;
- char precision[MAX_TB_NAME_SIZE];
+ char precision[MAX_TB_NAME_SIZE];
} SDbCfg;
typedef struct SDataBase_S {
char dbName[MAX_DB_NAME_SIZE];
- int drop; // 0: use exists, 1: if exists, drop then new create
+ bool drop; // 0: use exists, 1: if exists, drop then new create
SDbCfg dbCfg;
int superTblCount;
SSuperTable superTbls[MAX_SUPER_TABLE_COUNT];
@@ -322,16 +327,16 @@ typedef struct SDataBase_S {
typedef struct SDbs_S {
char cfgDir[MAX_FILE_NAME_LEN+1];
- char host[MAX_DB_NAME_SIZE];
+ char host[MAX_HOSTNAME_SIZE];
uint16_t port;
- char user[MAX_DB_NAME_SIZE];
- char password[MAX_DB_NAME_SIZE];
+ char user[MAX_USERNAME_SIZE];
+ char password[MAX_PASSWORD_SIZE];
char resultFile[MAX_FILE_NAME_LEN+1];
bool use_metric;
bool insert_only;
bool do_aggreFunc;
bool queryMode;
-
+
int threadCount;
int threadCountByCreateTbl;
int dbCount;
@@ -351,7 +356,7 @@ typedef struct SuperQueryInfo_S {
int subscribeInterval; // ms
int subscribeRestart;
int subscribeKeepProgress;
- char sql[MAX_QUERY_SQL_COUNT][MAX_QUERY_SQL_LENGTH+1];
+ char sql[MAX_QUERY_SQL_COUNT][MAX_QUERY_SQL_LENGTH+1];
char result[MAX_QUERY_SQL_COUNT][MAX_FILE_NAME_LEN+1];
TAOS_SUB* tsub[MAX_QUERY_SQL_COUNT];
} SuperQueryInfo;
@@ -359,7 +364,7 @@ typedef struct SuperQueryInfo_S {
typedef struct SubQueryInfo_S {
char sTblName[MAX_TB_NAME_SIZE+1];
int rate; // 0: unlimit > 0 loop/s
- int threadCnt;
+ int threadCnt;
int subscribeMode; // 0: sync, 1: async
int subscribeInterval; // ms
int subscribeRestart;
@@ -367,44 +372,45 @@ typedef struct SubQueryInfo_S {
int childTblCount;
char childTblPrefix[MAX_TB_NAME_SIZE];
int sqlCount;
- char sql[MAX_QUERY_SQL_COUNT][MAX_QUERY_SQL_LENGTH+1];
+ char sql[MAX_QUERY_SQL_COUNT][MAX_QUERY_SQL_LENGTH+1];
char result[MAX_QUERY_SQL_COUNT][MAX_FILE_NAME_LEN+1];
TAOS_SUB* tsub[MAX_QUERY_SQL_COUNT];
-
+
char* childTblName;
} SubQueryInfo;
typedef struct SQueryMetaInfo_S {
char cfgDir[MAX_FILE_NAME_LEN+1];
- char host[MAX_DB_NAME_SIZE];
+ char host[MAX_HOSTNAME_SIZE];
uint16_t port;
- char user[MAX_DB_NAME_SIZE];
- char password[MAX_DB_NAME_SIZE];
+ char user[MAX_USERNAME_SIZE];
+ char password[MAX_PASSWORD_SIZE];
char dbName[MAX_DB_NAME_SIZE+1];
char queryMode[MAX_TB_NAME_SIZE]; // taosc, restful
SuperQueryInfo superQueryInfo;
- SubQueryInfo subQueryInfo;
+ SubQueryInfo subQueryInfo;
} SQueryMetaInfo;
typedef struct SThreadInfo_S {
TAOS *taos;
int threadID;
char db_name[MAX_DB_NAME_SIZE+1];
+ uint32_t time_precision;
char fp[4096];
char tb_prefix[MAX_TB_NAME_SIZE];
int start_table_from;
int end_table_to;
int ntables;
int data_of_rate;
- uint64_t start_time;
- char* cols;
- bool use_metric;
+ uint64_t start_time;
+ char* cols;
+ bool use_metric;
SSuperTable* superTblInfo;
// for async insert
tsem_t lock_sem;
- int64_t counter;
+ int64_t counter;
uint64_t st;
uint64_t et;
int64_t lastTs;
@@ -421,7 +427,7 @@ typedef struct SThreadInfo_S {
int64_t avgDelay;
int64_t maxDelay;
int64_t minDelay;
-
+
} threadInfo;
#ifdef WINDOWS
@@ -460,12 +466,12 @@ static void setupForAnsiEscape(void) {
if(!SetConsoleMode(g_stdoutHandle, mode)) {
exit(GetLastError());
- }
+ }
}
static void resetAfterAnsiEscape(void) {
// Reset colors
- printf("\x1b[0m");
+ printf("\x1b[0m");
// Reset console mode
if(!SetConsoleMode(g_stdoutHandle, g_consoleMode)) {
@@ -488,16 +494,19 @@ static void resetAfterAnsiEscape(void) {
printf("\x1b[0m");
}
+#include
+
static int taosRandom()
{
- return random();
+ srand(time(NULL));
+ return rand();
}
#endif
static int createDatabases();
static void createChildTables();
-static int queryDbExec(TAOS *taos, char *command, int type);
+static int queryDbExec(TAOS *taos, char *command, QUERY_TYPE type, bool quiet);
/* ************ Global variables ************ */
@@ -505,7 +514,7 @@ int32_t randint[MAX_PREPARED_RAND];
int64_t randbigint[MAX_PREPARED_RAND];
float randfloat[MAX_PREPARED_RAND];
double randdouble[MAX_PREPARED_RAND];
-char *aggreFunc[] = {"*", "count(*)", "avg(col0)", "sum(col0)",
+char *aggreFunc[] = {"*", "count(*)", "avg(col0)", "sum(col0)",
"max(col0)", "min(col0)", "first(col0)", "last(col0)"};
SArguments g_args = {
@@ -514,7 +523,7 @@ SArguments g_args = {
"127.0.0.1", // host
6030, // port
"root", // user
- #ifdef _TD_POWER_
+ #ifdef _TD_POWER_
"powerdb", // password
#else
"taosdata", // password
@@ -523,8 +532,9 @@ SArguments g_args = {
1, // replica
"t", // tb_prefix
NULL, // sqlFile
- false, // use_metric
- false, // insert_only
+ true, // use_metric
+ true, // drop_database
+ true, // insert_only
false, // debug_print
false, // verbose_print
false, // performance statistic print
@@ -547,7 +557,8 @@ SArguments g_args = {
10, // num_of_CPR
10, // num_of_connections/thread
0, // insert_interval
- 0, // rows_per_tbl;
+ 1, // query_times
+ 0, // interlace_rows;
100, // num_of_RPR
TSDB_PAYLOAD_SIZE, // max_sql_len
10000, // num_of_tables
@@ -586,63 +597,91 @@ static FILE * g_fpOfInsertResult = NULL;
static void ERROR_EXIT(const char *msg) { perror(msg); exit(-1); }
+#ifndef TAOSDEMO_COMMIT_SHA1
+#define TAOSDEMO_COMMIT_SHA1 "unknown"
+#endif
+
+#ifndef TD_VERNUMBER
+#define TD_VERNUMBER "unknown"
+#endif
+
+#ifndef TAOSDEMO_STATUS
+#define TAOSDEMO_STATUS "unknown"
+#endif
+
+static void printVersion() {
+ char tdengine_ver[] = TD_VERNUMBER;
+ char taosdemo_ver[] = TAOSDEMO_COMMIT_SHA1;
+ char taosdemo_status[] = TAOSDEMO_STATUS;
+
+ if (strlen(taosdemo_status) == 0) {
+ printf("taosdemo verison %s-%s\n",
+ tdengine_ver, taosdemo_ver);
+ } else {
+ printf("taosdemo verison %s-%s, status:%s\n",
+ tdengine_ver, taosdemo_ver, taosdemo_status);
+ }
+}
+
static void printHelp() {
char indent[10] = " ";
- printf("%s%s%s%s\n", indent, "-f", indent,
+ printf("%s%s%s%s\n", indent, "-f", indent,
"The meta file to the execution procedure. Default is './meta.json'.");
- printf("%s%s%s%s\n", indent, "-u", indent,
+ printf("%s%s%s%s\n", indent, "-u", indent,
"The TDengine user name to use when connecting to the server. Default is 'root'.");
#ifdef _TD_POWER_
- printf("%s%s%s%s\n", indent, "-P", indent,
+ printf("%s%s%s%s\n", indent, "-P", indent,
"The password to use when connecting to the server. Default is 'powerdb'.");
- printf("%s%s%s%s\n", indent, "-c", indent,
+ printf("%s%s%s%s\n", indent, "-c", indent,
"Configuration directory. Default is '/etc/power/'.");
#else
- printf("%s%s%s%s\n", indent, "-P", indent,
+ printf("%s%s%s%s\n", indent, "-P", indent,
"The password to use when connecting to the server. Default is 'taosdata'.");
- printf("%s%s%s%s\n", indent, "-c", indent,
+ printf("%s%s%s%s\n", indent, "-c", indent,
"Configuration directory. Default is '/etc/taos/'.");
#endif
- printf("%s%s%s%s\n", indent, "-h", indent,
+ printf("%s%s%s%s\n", indent, "-h", indent,
"The host to connect to TDengine. Default is localhost.");
- printf("%s%s%s%s\n", indent, "-p", indent,
+ printf("%s%s%s%s\n", indent, "-p", indent,
"The TCP/IP port number to use for the connection. Default is 0.");
- printf("%s%s%s%s\n", indent, "-d", indent,
+ printf("%s%s%s%s\n", indent, "-d", indent,
"Destination database. Default is 'test'.");
- printf("%s%s%s%s\n", indent, "-a", indent,
+ printf("%s%s%s%s\n", indent, "-a", indent,
"Set the replica parameters of the database, Default 1, min: 1, max: 3.");
- printf("%s%s%s%s\n", indent, "-m", indent,
+ printf("%s%s%s%s\n", indent, "-m", indent,
"Table prefix name. Default is 't'.");
printf("%s%s%s%s\n", indent, "-s", indent, "The select sql file.");
- printf("%s%s%s%s\n", indent, "-M", indent, "Use metric flag.");
- printf("%s%s%s%s\n", indent, "-o", indent,
+ printf("%s%s%s%s\n", indent, "-N", indent, "Use normal table flag.");
+ printf("%s%s%s%s\n", indent, "-o", indent,
"Direct output to the named file. Default is './output.txt'.");
- printf("%s%s%s%s\n", indent, "-q", indent,
+ printf("%s%s%s%s\n", indent, "-q", indent,
"Query mode--0: SYNC, 1: ASYNC. Default is SYNC.");
- printf("%s%s%s%s\n", indent, "-b", indent,
+ printf("%s%s%s%s\n", indent, "-b", indent,
"The data_type of columns, default: TINYINT,SMALLINT,INT,BIGINT,FLOAT,DOUBLE,BINARY,NCHAR,BOOL,TIMESTAMP.");
- printf("%s%s%s%s\n", indent, "-w", indent,
+ printf("%s%s%s%s\n", indent, "-w", indent,
"The length of data_type 'BINARY' or 'NCHAR'. Default is 16");
- printf("%s%s%s%s\n", indent, "-l", indent,
+ printf("%s%s%s%s\n", indent, "-l", indent,
"The number of columns per record. Default is 10.");
- printf("%s%s%s%s\n", indent, "-T", indent,
+ printf("%s%s%s%s\n", indent, "-T", indent,
"The number of threads. Default is 10.");
- printf("%s%s%s%s\n", indent, "-i", indent,
+ printf("%s%s%s%s\n", indent, "-i", indent,
"The sleep time (ms) between insertion. Default is 0.");
- printf("%s%s%s%s\n", indent, "-r", indent,
+ printf("%s%s%s%s\n", indent, "-r", indent,
"The number of records per request. Default is 100.");
- printf("%s%s%s%s\n", indent, "-t", indent,
+ printf("%s%s%s%s\n", indent, "-t", indent,
"The number of tables. Default is 10000.");
- printf("%s%s%s%s\n", indent, "-n", indent,
+ printf("%s%s%s%s\n", indent, "-n", indent,
"The number of records per table. Default is 10000.");
printf("%s%s%s%s\n", indent, "-x", indent, "Not insert only flag.");
printf("%s%s%s%s\n", indent, "-y", indent, "Default input yes for prompt.");
- printf("%s%s%s%s\n", indent, "-O", indent,
+ printf("%s%s%s%s\n", indent, "-O", indent,
"Insert mode--0: In order, > 0: disorder ratio. Default is in order.");
- printf("%s%s%s%s\n", indent, "-R", indent,
+ printf("%s%s%s%s\n", indent, "-R", indent,
"Out of order data's range, ms, default is 1000.");
- printf("%s%s%s%s\n", indent, "-g", indent,
+ printf("%s%s%s%s\n", indent, "-g", indent,
"Print debug info.");
+ printf("%s%s%s%s\n", indent, "-V, --version", indent,
+ "Print version info.");
/* printf("%s%s%s%s\n", indent, "-D", indent,
"if elete database if exists. 0: no, 1: yes, default is 1");
*/
@@ -663,6 +702,7 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
}
taos_options(TSDB_OPTION_CONFIGDIR, full_path.we_wordv[0]);
wordfree(&full_path);
+
} else if (strcmp(argv[i], "-h") == 0) {
arguments->host = argv[++i];
} else if (strcmp(argv[i], "-p") == 0) {
@@ -681,8 +721,10 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
arguments->num_of_threads = atoi(argv[++i]);
} else if (strcmp(argv[i], "-i") == 0) {
arguments->insert_interval = atoi(argv[++i]);
+ } else if (strcmp(argv[i], "-qt") == 0) {
+ arguments->query_times = atoi(argv[++i]);
} else if (strcmp(argv[i], "-B") == 0) {
- arguments->rows_per_tbl = atoi(argv[++i]);
+ arguments->interlace_rows = atoi(argv[++i]);
} else if (strcmp(argv[i], "-r") == 0) {
arguments->num_of_RPR = atoi(argv[++i]);
} else if (strcmp(argv[i], "-t") == 0) {
@@ -742,10 +784,10 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
arguments->len_of_binary = atoi(argv[++i]);
} else if (strcmp(argv[i], "-m") == 0) {
arguments->tb_prefix = argv[++i];
- } else if (strcmp(argv[i], "-M") == 0) {
- arguments->use_metric = true;
+ } else if (strcmp(argv[i], "-N") == 0) {
+ arguments->use_metric = false;
} else if (strcmp(argv[i], "-x") == 0) {
- arguments->insert_only = true;
+ arguments->insert_only = false;
} else if (strcmp(argv[i], "-y") == 0) {
arguments->answer_yes = true;
} else if (strcmp(argv[i], "-g") == 0) {
@@ -758,7 +800,7 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
strcpy(configDir, argv[++i]);
} else if (strcmp(argv[i], "-O") == 0) {
arguments->disorderRatio = atoi(argv[++i]);
- if (arguments->disorderRatio > 1
+ if (arguments->disorderRatio > 1
|| arguments->disorderRatio < 0) {
arguments->disorderRatio = 0;
} else if (arguments->disorderRatio == 1) {
@@ -766,8 +808,8 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
}
} else if (strcmp(argv[i], "-R") == 0) {
arguments->disorderRange = atoi(argv[++i]);
- if (arguments->disorderRange == 1
- && (arguments->disorderRange > 50
+ if (arguments->disorderRange == 1
+ && (arguments->disorderRange > 50
|| arguments->disorderRange <= 0)) {
arguments->disorderRange = 10;
}
@@ -782,6 +824,10 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
|| arguments->method_of_delete > 3) {
arguments->method_of_delete = 0;
}
+ } else if ((strcmp(argv[i], "--version") == 0) ||
+ (strcmp(argv[i], "-V") == 0)){
+ printVersion();
+ exit(0);
} else if (strcmp(argv[i], "--help") == 0) {
printHelp();
exit(0);
@@ -796,7 +842,7 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
|| arguments->verbose_print) {
printf("###################################################################\n");
printf("# meta file: %s\n", arguments->metaFile);
- printf("# Server IP: %s:%hu\n",
+ printf("# Server IP: %s:%hu\n",
arguments->host == NULL ? "localhost" : arguments->host,
arguments->port );
printf("# User: %s\n", arguments->user);
@@ -823,7 +869,7 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
if (arguments->disorderRatio) {
printf("# Data order: %d\n", arguments->disorderRatio);
printf("# Data out of order rate: %d\n", arguments->disorderRange);
-
+
}
printf("# Delete method: %d\n", arguments->method_of_delete);
printf("# Answer yes when prompt: %d\n", arguments->answer_yes);
@@ -853,7 +899,7 @@ static void tmfree(char *buf) {
}
}
-static int queryDbExec(TAOS *taos, char *command, int type) {
+static int queryDbExec(TAOS *taos, char *command, QUERY_TYPE type, bool quiet) {
int i;
TAOS_RES *res = NULL;
int32_t code = -1;
@@ -868,12 +914,14 @@ static int queryDbExec(TAOS *taos, char *command, int type) {
code = taos_errno(res);
if (0 == code) {
break;
- }
+ }
}
if (code != 0) {
- debugPrint("%s() LN%d - command: %s\n", __func__, __LINE__, command);
- errorPrint( "Failed to run %s, reason: %s\n", command, taos_errstr(res));
+ if (!quiet) {
+ debugPrint("%s() LN%d - command: %s\n", __func__, __LINE__, command);
+ errorPrint("Failed to run %s, reason: %s\n", command, taos_errstr(res));
+ }
taos_free_result(res);
//taos_close(taos);
return -1;
@@ -884,12 +932,12 @@ static int queryDbExec(TAOS *taos, char *command, int type) {
taos_free_result(res);
return affectedRows;
}
-
+
taos_free_result(res);
return 0;
}
-static void getResult(TAOS_RES *res, char* resultFileName) {
+static void getResult(TAOS_RES *res, char* resultFileName) {
TAOS_ROW row = NULL;
int num_rows = 0;
int num_fields = taos_field_count(res);
@@ -899,13 +947,15 @@ static void getResult(TAOS_RES *res, char* resultFileName) {
if (resultFileName[0] != 0) {
fp = fopen(resultFileName, "at");
if (fp == NULL) {
- errorPrint("%s() LN%d, failed to open result file: %s, result will not save to file\n", __func__, __LINE__, resultFileName);
+ errorPrint("%s() LN%d, failed to open result file: %s, result will not save to file\n",
+ __func__, __LINE__, resultFileName);
}
}
-
+
char* databuf = (char*) calloc(1, 100*1024*1024);
if (databuf == NULL) {
- errorPrint("%s() LN%d, failed to malloc, warning: save result to file slowly!\n", __func__, __LINE__);
+ errorPrint("%s() LN%d, failed to malloc, warning: save result to file slowly!\n",
+ __func__, __LINE__);
if (fp)
fclose(fp);
return ;
@@ -941,7 +991,7 @@ static void selectAndGetResult(TAOS *taos, char *command, char* resultFileName)
taos_free_result(res);
return;
}
-
+
getResult(res, resultFileName);
taos_free_result(res);
}
@@ -989,14 +1039,13 @@ static int64_t rand_bigint(){
cursor++;
cursor = cursor % MAX_PREPARED_RAND;
return randbigint[cursor];
-
}
static float rand_float(){
static int cursor;
cursor++;
cursor = cursor % MAX_PREPARED_RAND;
- return randfloat[cursor];
+ return randfloat[cursor];
}
static const char charset[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
@@ -1064,13 +1113,14 @@ static int printfInsertMeta() {
printf("max sql length: \033[33m%d\033[0m\n", g_args.max_sql_len);
printf("database count: \033[33m%d\033[0m\n", g_Dbs.dbCount);
+
for (int i = 0; i < g_Dbs.dbCount; i++) {
printf("database[\033[33m%d\033[0m]:\n", i);
printf(" database[%d] name: \033[33m%s\033[0m\n", i, g_Dbs.db[i].dbName);
if (0 == g_Dbs.db[i].drop) {
- printf(" drop: \033[33mno\033[0m\n");
- }else {
- printf(" drop: \033[33myes\033[0m\n");
+ printf(" drop: \033[33mno\033[0m\n");
+ } else {
+ printf(" drop: \033[33myes\033[0m\n");
}
if (g_Dbs.db[i].dbCfg.blocks > 0) {
@@ -1123,8 +1173,8 @@ static int printfInsertMeta() {
printf(" super table count: \033[33m%d\033[0m\n", g_Dbs.db[i].superTblCount);
for (int j = 0; j < g_Dbs.db[i].superTblCount; j++) {
printf(" super table[\033[33m%d\033[0m]:\n", j);
-
- printf(" stbName: \033[33m%s\033[0m\n", g_Dbs.db[i].superTbls[j].sTblName);
+
+ printf(" stbName: \033[33m%s\033[0m\n", g_Dbs.db[i].superTbls[j].sTblName);
if (PRE_CREATE_SUBTBL == g_Dbs.db[i].superTbls[j].autoCreateTable) {
printf(" autoCreateTable: \033[33m%s\033[0m\n", "no");
@@ -1133,7 +1183,7 @@ static int printfInsertMeta() {
} else {
printf(" autoCreateTable: \033[33m%s\033[0m\n", "error");
}
-
+
if (TBL_NO_EXISTS == g_Dbs.db[i].superTbls[j].childTblExists) {
printf(" childTblExists: \033[33m%s\033[0m\n", "no");
} else if (TBL_ALREADY_EXISTS == g_Dbs.db[i].superTbls[j].childTblExists) {
@@ -1159,8 +1209,8 @@ static int printfInsertMeta() {
}else {
printf(" multiThreadWriteOneTbl: \033[33myes\033[0m\n");
}
- printf(" rowsPerTbl: \033[33m%d\033[0m\n",
- g_Dbs.db[i].superTbls[j].rowsPerTbl);
+ printf(" interlaceRows: \033[33m%d\033[0m\n",
+ g_Dbs.db[i].superTbls[j].interlaceRows);
printf(" disorderRange: \033[33m%d\033[0m\n",
g_Dbs.db[i].superTbls[j].disorderRange);
printf(" disorderRatio: \033[33m%d\033[0m\n",
@@ -1220,23 +1270,25 @@ static int printfInsertMeta() {
}
static void printfInsertMetaToFile(FILE* fp) {
- SHOW_PARSE_RESULT_START_TO_FILE(fp);
+
+ SHOW_PARSE_RESULT_START_TO_FILE(fp);
fprintf(fp, "host: %s:%u\n", g_Dbs.host, g_Dbs.port);
fprintf(fp, "user: %s\n", g_Dbs.user);
- fprintf(fp, "password: %s\n", g_Dbs.password);
fprintf(fp, "resultFile: %s\n", g_Dbs.resultFile);
fprintf(fp, "thread num of insert data: %d\n", g_Dbs.threadCount);
fprintf(fp, "thread num of create table: %d\n", g_Dbs.threadCountByCreateTbl);
-
+ fprintf(fp, "number of records per req: %d\n", g_args.num_of_RPR);
+ fprintf(fp, "max sql length: %d\n", g_args.max_sql_len);
fprintf(fp, "database count: %d\n", g_Dbs.dbCount);
+
for (int i = 0; i < g_Dbs.dbCount; i++) {
fprintf(fp, "database[%d]:\n", i);
fprintf(fp, " database[%d] name: %s\n", i, g_Dbs.db[i].dbName);
if (0 == g_Dbs.db[i].drop) {
- fprintf(fp, " drop: no\n");
+ fprintf(fp, " drop: no\n");
}else {
- fprintf(fp, " drop: yes\n");
+ fprintf(fp, " drop: yes\n");
}
if (g_Dbs.db[i].dbCfg.blocks > 0) {
@@ -1287,8 +1339,8 @@ static void printfInsertMetaToFile(FILE* fp) {
fprintf(fp, " super table count: %d\n", g_Dbs.db[i].superTblCount);
for (int j = 0; j < g_Dbs.db[i].superTblCount; j++) {
fprintf(fp, " super table[%d]:\n", j);
-
- fprintf(fp, " stbName: %s\n", g_Dbs.db[i].superTbls[j].sTblName);
+
+ fprintf(fp, " stbName: %s\n", g_Dbs.db[i].superTbls[j].sTblName);
if (PRE_CREATE_SUBTBL == g_Dbs.db[i].superTbls[j].autoCreateTable) {
fprintf(fp, " autoCreateTable: %s\n", "no");
@@ -1297,7 +1349,7 @@ static void printfInsertMetaToFile(FILE* fp) {
} else {
fprintf(fp, " autoCreateTable: %s\n", "error");
}
-
+
if (TBL_NO_EXISTS == g_Dbs.db[i].superTbls[j].childTblExists) {
fprintf(fp, " childTblExists: %s\n", "no");
} else if (TBL_ALREADY_EXISTS == g_Dbs.db[i].superTbls[j].childTblExists) {
@@ -1305,30 +1357,33 @@ static void printfInsertMetaToFile(FILE* fp) {
} else {
fprintf(fp, " childTblExists: %s\n", "error");
}
-
- fprintf(fp, " childTblCount: %d\n", g_Dbs.db[i].superTbls[j].childTblCount);
- fprintf(fp, " childTblPrefix: %s\n", g_Dbs.db[i].superTbls[j].childTblPrefix);
- fprintf(fp, " dataSource: %s\n", g_Dbs.db[i].superTbls[j].dataSource);
- fprintf(fp, " insertMode: %s\n", g_Dbs.db[i].superTbls[j].insertMode);
- fprintf(fp, " insertRows: %"PRId64"\n", g_Dbs.db[i].superTbls[j].insertRows);
- fprintf(fp, " insert interval: %d\n", g_Dbs.db[i].superTbls[j].insertInterval);
+
+ fprintf(fp, " childTblCount: %d\n", g_Dbs.db[i].superTbls[j].childTblCount);
+ fprintf(fp, " childTblPrefix: %s\n", g_Dbs.db[i].superTbls[j].childTblPrefix);
+ fprintf(fp, " dataSource: %s\n", g_Dbs.db[i].superTbls[j].dataSource);
+ fprintf(fp, " insertMode: %s\n", g_Dbs.db[i].superTbls[j].insertMode);
+ fprintf(fp, " insertRows: %"PRId64"\n", g_Dbs.db[i].superTbls[j].insertRows);
+ fprintf(fp, " interlace rows: %d\n", g_Dbs.db[i].superTbls[j].interlaceRows);
+ if (g_Dbs.db[i].superTbls[j].interlaceRows > 0) {
+ fprintf(fp, " insert interval: %d\n", g_Dbs.db[i].superTbls[j].insertInterval);
+ }
if (0 == g_Dbs.db[i].superTbls[j].multiThreadWriteOneTbl) {
- fprintf(fp, " multiThreadWriteOneTbl: no\n");
+ fprintf(fp, " multiThreadWriteOneTbl: no\n");
}else {
- fprintf(fp, " multiThreadWriteOneTbl: yes\n");
+ fprintf(fp, " multiThreadWriteOneTbl: yes\n");
}
- fprintf(fp, " rowsPerTbl: %d\n", g_Dbs.db[i].superTbls[j].rowsPerTbl);
- fprintf(fp, " disorderRange: %d\n", g_Dbs.db[i].superTbls[j].disorderRange);
+ fprintf(fp, " interlaceRows: %d\n", g_Dbs.db[i].superTbls[j].interlaceRows);
+ fprintf(fp, " disorderRange: %d\n", g_Dbs.db[i].superTbls[j].disorderRange);
fprintf(fp, " disorderRatio: %d\n", g_Dbs.db[i].superTbls[j].disorderRatio);
- fprintf(fp, " maxSqlLen: %d\n", g_Dbs.db[i].superTbls[j].maxSqlLen);
-
- fprintf(fp, " timeStampStep: %d\n", g_Dbs.db[i].superTbls[j].timeStampStep);
- fprintf(fp, " startTimestamp: %s\n", g_Dbs.db[i].superTbls[j].startTimestamp);
+ fprintf(fp, " maxSqlLen: %d\n", g_Dbs.db[i].superTbls[j].maxSqlLen);
+
+ fprintf(fp, " timeStampStep: %d\n", g_Dbs.db[i].superTbls[j].timeStampStep);
+ fprintf(fp, " startTimestamp: %s\n", g_Dbs.db[i].superTbls[j].startTimestamp);
fprintf(fp, " sampleFormat: %s\n", g_Dbs.db[i].superTbls[j].sampleFormat);
- fprintf(fp, " sampleFile: %s\n", g_Dbs.db[i].superTbls[j].sampleFile);
- fprintf(fp, " tagsFile: %s\n", g_Dbs.db[i].superTbls[j].tagsFile);
-
+ fprintf(fp, " sampleFile: %s\n", g_Dbs.db[i].superTbls[j].sampleFile);
+ fprintf(fp, " tagsFile: %s\n", g_Dbs.db[i].superTbls[j].tagsFile);
+
fprintf(fp, " columnCount: %d\n ", g_Dbs.db[i].superTbls[j].columnCount);
for (int k = 0; k < g_Dbs.db[i].superTbls[j].columnCount; k++) {
//printf("dataType:%s, dataLen:%d\t", g_Dbs.db[i].superTbls[j].columns[k].dataType, g_Dbs.db[i].superTbls[j].columns[k].dataLen);
@@ -1364,22 +1419,25 @@ static void printfInsertMetaToFile(FILE* fp) {
}
fprintf(fp, "\n");
}
+
SHOW_PARSE_RESULT_END_TO_FILE(fp);
}
static void printfQueryMeta() {
+
SHOW_PARSE_RESULT_START();
+
printf("host: \033[33m%s:%u\033[0m\n",
g_queryInfo.host, g_queryInfo.port);
printf("user: \033[33m%s\033[0m\n", g_queryInfo.user);
- printf("password: \033[33m%s\033[0m\n", g_queryInfo.password);
printf("database name: \033[33m%s\033[0m\n", g_queryInfo.dbName);
printf("\n");
- printf("specified table query info: \n");
+ printf("specified table query info: \n");
printf("query interval: \033[33m%d\033[0m\n", g_queryInfo.superQueryInfo.rate);
+ printf("query times: \033[33m%d\033[0m\n", g_args.query_times);
printf("concurrent: \033[33m%d\033[0m\n", g_queryInfo.superQueryInfo.concurrent);
- printf("sqlCount: \033[33m%d\033[0m\n", g_queryInfo.superQueryInfo.sqlCount);
+ printf("sqlCount: \033[33m%d\033[0m\n", g_queryInfo.superQueryInfo.sqlCount);
if (SUBSCRIBE_TEST == g_args.test_mode) {
printf("mod: \033[33m%d\033[0m\n", g_queryInfo.superQueryInfo.subscribeMode);
@@ -1392,7 +1450,7 @@ static void printfQueryMeta() {
printf(" sql[%d]: \033[33m%s\033[0m\n", i, g_queryInfo.superQueryInfo.sql[i]);
}
printf("\n");
- printf("super table query info: \n");
+ printf("super table query info: \n");
printf("query interval: \033[33m%d\033[0m\n", g_queryInfo.subQueryInfo.rate);
printf("threadCnt: \033[33m%d\033[0m\n", g_queryInfo.subQueryInfo.threadCnt);
printf("childTblCount: \033[33m%d\033[0m\n", g_queryInfo.subQueryInfo.childTblCount);
@@ -1404,18 +1462,17 @@ static void printfQueryMeta() {
printf("restart: \033[33m%d\033[0m\n", g_queryInfo.subQueryInfo.subscribeRestart);
printf("keepProgress: \033[33m%d\033[0m\n", g_queryInfo.subQueryInfo.subscribeKeepProgress);
}
-
- printf("sqlCount: \033[33m%d\033[0m\n", g_queryInfo.subQueryInfo.sqlCount);
+
+ printf("sqlCount: \033[33m%d\033[0m\n", g_queryInfo.subQueryInfo.sqlCount);
for (int i = 0; i < g_queryInfo.subQueryInfo.sqlCount; i++) {
printf(" sql[%d]: \033[33m%s\033[0m\n", i, g_queryInfo.subQueryInfo.sql[i]);
- }
+ }
printf("\n");
- SHOW_PARSE_RESULT_END();
+ SHOW_PARSE_RESULT_END();
}
-
-static char* xFormatTimestamp(char* buf, int64_t val, int precision) {
+static char* formatTimestamp(char* buf, int64_t val, int precision) {
time_t tt;
if (precision == TSDB_TIME_PRECISION_MICRO) {
tt = (time_t)(val / 1000000);
@@ -1447,7 +1504,9 @@ static char* xFormatTimestamp(char* buf, int64_t val, int precision) {
return buf;
}
-static void xDumpFieldToFile(FILE* fp, const char* val, TAOS_FIELD* field, int32_t length, int precision) {
+static void xDumpFieldToFile(FILE* fp, const char* val,
+ TAOS_FIELD* field, int32_t length, int precision) {
+
if (val == NULL) {
fprintf(fp, "%s", TSDB_DATA_NULL_STR);
return;
@@ -1483,7 +1542,7 @@ static void xDumpFieldToFile(FILE* fp, const char* val, TAOS_FIELD* field, int32
fprintf(fp, "\'%s\'", buf);
break;
case TSDB_DATA_TYPE_TIMESTAMP:
- xFormatTimestamp(buf, *(int64_t*)val, precision);
+ formatTimestamp(buf, *(int64_t*)val, precision);
fprintf(fp, "'%s'", buf);
break;
default:
@@ -1514,7 +1573,7 @@ static int xDumpResultToFile(const char* fname, TAOS_RES* tres) {
fprintf(fp, "%s", fields[col].name);
}
fputc('\n', fp);
-
+
int numOfRows = 0;
do {
int32_t* length = taos_fetch_lengths(tres);
@@ -1535,14 +1594,14 @@ static int xDumpResultToFile(const char* fname, TAOS_RES* tres) {
return numOfRows;
}
-static int getDbFromServer(TAOS * taos, SDbInfo** dbInfos) {
- TAOS_RES * res;
+static int getDbFromServer(TAOS * taos, SDbInfo** dbInfos) {
+ TAOS_RES * res;
TAOS_ROW row = NULL;
int count = 0;
-
- res = taos_query(taos, "show databases;");
+
+ res = taos_query(taos, "show databases;");
int32_t code = taos_errno(res);
-
+
if (code != 0) {
errorPrint( "failed to run , reason: %s\n", taos_errstr(res));
return -1;
@@ -1562,17 +1621,17 @@ static int getDbFromServer(TAOS * taos, SDbInfo** dbInfos) {
tstrncpy(dbInfos[count]->name, (char *)row[TSDB_SHOW_DB_NAME_INDEX],
fields[TSDB_SHOW_DB_NAME_INDEX].bytes);
- xFormatTimestamp(dbInfos[count]->create_time,
+ formatTimestamp(dbInfos[count]->create_time,
*(int64_t*)row[TSDB_SHOW_DB_CREATED_TIME_INDEX],
TSDB_TIME_PRECISION_MILLI);
dbInfos[count]->ntables = *((int32_t *)row[TSDB_SHOW_DB_NTABLES_INDEX]);
- dbInfos[count]->vgroups = *((int32_t *)row[TSDB_SHOW_DB_VGROUPS_INDEX]);
+ dbInfos[count]->vgroups = *((int32_t *)row[TSDB_SHOW_DB_VGROUPS_INDEX]);
dbInfos[count]->replica = *((int16_t *)row[TSDB_SHOW_DB_REPLICA_INDEX]);
dbInfos[count]->quorum = *((int16_t *)row[TSDB_SHOW_DB_QUORUM_INDEX]);
- dbInfos[count]->days = *((int16_t *)row[TSDB_SHOW_DB_DAYS_INDEX]);
+ dbInfos[count]->days = *((int16_t *)row[TSDB_SHOW_DB_DAYS_INDEX]);
tstrncpy(dbInfos[count]->keeplist, (char *)row[TSDB_SHOW_DB_KEEP_INDEX],
- fields[TSDB_SHOW_DB_KEEP_INDEX].bytes);
+ fields[TSDB_SHOW_DB_KEEP_INDEX].bytes);
dbInfos[count]->cache = *((int32_t *)row[TSDB_SHOW_DB_CACHE_INDEX]);
dbInfos[count]->blocks = *((int32_t *)row[TSDB_SHOW_DB_BLOCKS_INDEX]);
dbInfos[count]->minrows = *((int32_t *)row[TSDB_SHOW_DB_MINROWS_INDEX]);
@@ -1582,16 +1641,16 @@ static int getDbFromServer(TAOS * taos, SDbInfo** dbInfos) {
dbInfos[count]->comp = (int8_t)(*((int8_t *)row[TSDB_SHOW_DB_COMP_INDEX]));
dbInfos[count]->cachelast = (int8_t)(*((int8_t *)row[TSDB_SHOW_DB_CACHELAST_INDEX]));
- tstrncpy(dbInfos[count]->precision,
+ tstrncpy(dbInfos[count]->precision,
(char *)row[TSDB_SHOW_DB_PRECISION_INDEX],
- fields[TSDB_SHOW_DB_PRECISION_INDEX].bytes);
+ fields[TSDB_SHOW_DB_PRECISION_INDEX].bytes);
dbInfos[count]->update = *((int8_t *)row[TSDB_SHOW_DB_UPDATE_INDEX]);
tstrncpy(dbInfos[count]->status, (char *)row[TSDB_SHOW_DB_STATUS_INDEX],
- fields[TSDB_SHOW_DB_STATUS_INDEX].bytes);
+ fields[TSDB_SHOW_DB_STATUS_INDEX].bytes);
count++;
if (count > MAX_DATABASE_COUNT) {
- errorPrint( "The database count overflow than %d\n", MAX_DATABASE_COUNT);
+ errorPrint( "The database count overflow than %d\n", MAX_DATABASE_COUNT);
break;
}
}
@@ -1613,11 +1672,11 @@ static void printfDbInfoForQueryToFile(char* filename, SDbInfo* dbInfos, int ind
fprintf(fp, "name: %s\n", dbInfos->name);
fprintf(fp, "created_time: %s\n", dbInfos->create_time);
fprintf(fp, "ntables: %d\n", dbInfos->ntables);
- fprintf(fp, "vgroups: %d\n", dbInfos->vgroups);
+ fprintf(fp, "vgroups: %d\n", dbInfos->vgroups);
fprintf(fp, "replica: %d\n", dbInfos->replica);
fprintf(fp, "quorum: %d\n", dbInfos->quorum);
- fprintf(fp, "days: %d\n", dbInfos->days);
- fprintf(fp, "keep0,keep1,keep(D): %s\n", dbInfos->keeplist);
+ fprintf(fp, "days: %d\n", dbInfos->days);
+ fprintf(fp, "keep0,keep1,keep(D): %s\n", dbInfos->keeplist);
fprintf(fp, "cache(MB): %d\n", dbInfos->cache);
fprintf(fp, "blocks: %d\n", dbInfos->blocks);
fprintf(fp, "minrows: %d\n", dbInfos->minrows);
@@ -1625,10 +1684,10 @@ static void printfDbInfoForQueryToFile(char* filename, SDbInfo* dbInfos, int ind
fprintf(fp, "wallevel: %d\n", dbInfos->wallevel);
fprintf(fp, "fsync: %d\n", dbInfos->fsync);
fprintf(fp, "comp: %d\n", dbInfos->comp);
- fprintf(fp, "cachelast: %d\n", dbInfos->cachelast);
- fprintf(fp, "precision: %s\n", dbInfos->precision);
+ fprintf(fp, "cachelast: %d\n", dbInfos->cachelast);
+ fprintf(fp, "precision: %s\n", dbInfos->precision);
fprintf(fp, "update: %d\n", dbInfos->update);
- fprintf(fp, "status: %s\n", dbInfos->status);
+ fprintf(fp, "status: %s\n", dbInfos->status);
fprintf(fp, "\n");
fclose(fp);
@@ -1678,7 +1737,7 @@ static void printfQuerySystemInfo(TAOS * taos) {
snprintf(buffer, MAX_QUERY_SQL_LENGTH, "show %s.vgroups;", dbInfos[i]->name);
res = taos_query(taos, buffer);
xDumpResultToFile(filename, res);
-
+
// show db.stables
snprintf(buffer, MAX_QUERY_SQL_LENGTH, "show %s.stables;", dbInfos[i]->name);
res = taos_query(taos, buffer);
@@ -1688,7 +1747,6 @@ static void printfQuerySystemInfo(TAOS * taos) {
}
free(dbInfos);
-
}
static int postProceSql(char* host, uint16_t port, char* sqlstr)
@@ -1940,17 +1998,17 @@ static char* generateTagVaulesForStb(SSuperTable* stbInfo) {
}
dataLen -= 2;
- dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen, ")");
+ dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen, ")");
return dataBuf;
}
-static int calcRowLen(SSuperTable* superTbls) {
+static int calcRowLen(SSuperTable* superTbls) {
int colIndex;
int lenOfOneRow = 0;
-
+
for (colIndex = 0; colIndex < superTbls->columnCount; colIndex++) {
char* dataType = superTbls->columns[colIndex].dataType;
-
+
if (strcasecmp(dataType, "BINARY") == 0) {
lenOfOneRow += superTbls->columns[colIndex].dataLen + 3;
} else if (strcasecmp(dataType, "NCHAR") == 0) {
@@ -1967,9 +2025,9 @@ static int calcRowLen(SSuperTable* superTbls) {
lenOfOneRow += 6;
} else if (strcasecmp(dataType, "FLOAT") == 0) {
lenOfOneRow += 22;
- } else if (strcasecmp(dataType, "DOUBLE") == 0) {
+ } else if (strcasecmp(dataType, "DOUBLE") == 0) {
lenOfOneRow += 42;
- } else if (strcasecmp(dataType, "TIMESTAMP") == 0) {
+ } else if (strcasecmp(dataType, "TIMESTAMP") == 0) {
lenOfOneRow += 21;
} else {
printf("get error data type : %s\n", dataType);
@@ -2009,7 +2067,7 @@ static int calcRowLen(SSuperTable* superTbls) {
}
superTbls->lenOfTagOfOneRow = lenOfTagOfOneRow;
-
+
return 0;
}
@@ -2021,7 +2079,7 @@ static int getChildNameOfSuperTableWithLimitAndOffset(TAOS * taos,
char command[BUFFER_SIZE] = "\0";
char limitBuf[100] = "\0";
- TAOS_RES * res;
+ TAOS_RES * res;
TAOS_ROW row = NULL;
char* childTblName = *childTblNameOfSuperTbl;
@@ -2030,21 +2088,31 @@ static int getChildNameOfSuperTableWithLimitAndOffset(TAOS * taos,
snprintf(limitBuf, 100, " limit %d offset %d", limit, offset);
}
- //get all child table name use cmd: select tbname from superTblName;
+ //get all child table name use cmd: select tbname from superTblName;
snprintf(command, BUFFER_SIZE, "select tbname from %s.%s %s", dbName, sTblName, limitBuf);
- res = taos_query(taos, command);
+ res = taos_query(taos, command);
int32_t code = taos_errno(res);
if (code != 0) {
- printf("failed to run command %s\n", command);
taos_free_result(res);
taos_close(taos);
+ errorPrint("%s() LN%d, failed to run command %s\n",
+ __func__, __LINE__, command);
exit(-1);
}
int childTblCount = (limit < 0)?10000:limit;
int count = 0;
-// childTblName = (char*)calloc(1, childTblCount * TSDB_TABLE_NAME_LEN);
+ if (childTblName == NULL) {
+ childTblName = (char*)calloc(1, childTblCount * TSDB_TABLE_NAME_LEN);
+ if (NULL == childTblName) {
+ taos_free_result(res);
+ taos_close(taos);
+ errorPrint("%s() LN%d, failed to allocate memory!\n", __func__, __LINE__);
+ exit(-1);
+ }
+ }
+
char* pTblName = childTblName;
while ((row = taos_fetch_row(res)) != NULL) {
int32_t* len = taos_fetch_lengths(res);
@@ -2090,8 +2158,9 @@ static int getAllChildNameOfSuperTable(TAOS * taos, char* dbName,
static int getSuperTableFromServer(TAOS * taos, char* dbName,
SSuperTable* superTbls) {
+
char command[BUFFER_SIZE] = "\0";
- TAOS_RES * res;
+ TAOS_RES * res;
TAOS_ROW row = NULL;
int count = 0;
@@ -2295,7 +2364,7 @@ static int createSuperTable(TAOS * taos, char* dbName, SSuperTable* superTbls,
dbName, superTbls->sTblName, cols, tags);
verbosePrint("%s() LN%d: %s\n", __func__, __LINE__, command);
- if (0 != queryDbExec(taos, command, NO_INSERT_TYPE)) {
+ if (0 != queryDbExec(taos, command, NO_INSERT_TYPE, false)) {
errorPrint( "create supertable %s failed!\n\n",
superTbls->sTblName);
return -1;
@@ -2315,18 +2384,18 @@ static int createDatabases() {
}
char command[BUFFER_SIZE] = "\0";
- for (int i = 0; i < g_Dbs.dbCount; i++) {
+ for (int i = 0; i < g_Dbs.dbCount; i++) {
if (g_Dbs.db[i].drop) {
sprintf(command, "drop database if exists %s;", g_Dbs.db[i].dbName);
verbosePrint("%s() %d command: %s\n", __func__, __LINE__, command);
- if (0 != queryDbExec(taos, command, NO_INSERT_TYPE)) {
+ if (0 != queryDbExec(taos, command, NO_INSERT_TYPE, false)) {
taos_close(taos);
return -1;
}
}
int dataLen = 0;
- dataLen += snprintf(command + dataLen,
+ dataLen += snprintf(command + dataLen,
BUFFER_SIZE - dataLen, "create database if not exists %s", g_Dbs.db[i].dbName);
if (g_Dbs.db[i].dbCfg.blocks > 0) {
@@ -2393,7 +2462,7 @@ static int createDatabases() {
}
debugPrint("%s() %d command: %s\n", __func__, __LINE__, command);
- if (0 != queryDbExec(taos, command, NO_INSERT_TYPE)) {
+ if (0 != queryDbExec(taos, command, NO_INSERT_TYPE, false)) {
taos_close(taos);
errorPrint( "\ncreate database %s failed!\n\n", g_Dbs.db[i].dbName);
return -1;
@@ -2403,38 +2472,41 @@ static int createDatabases() {
debugPrint("%s() %d supertbl count:%d\n",
__func__, __LINE__, g_Dbs.db[i].superTblCount);
for (int j = 0; j < g_Dbs.db[i].superTblCount; j++) {
- // describe super table, if exists
sprintf(command, "describe %s.%s;", g_Dbs.db[i].dbName,
g_Dbs.db[i].superTbls[j].sTblName);
verbosePrint("%s() %d command: %s\n", __func__, __LINE__, command);
- if (0 != queryDbExec(taos, command, NO_INSERT_TYPE)) {
- g_Dbs.db[i].superTbls[j].superTblExists = TBL_NO_EXISTS;
+
+ ret = queryDbExec(taos, command, NO_INSERT_TYPE, true);
+
+ if ((ret != 0) || (g_Dbs.db[i].drop)) {
ret = createSuperTable(taos, g_Dbs.db[i].dbName,
&g_Dbs.db[i].superTbls[j], g_Dbs.use_metric);
- } else {
- g_Dbs.db[i].superTbls[j].superTblExists = TBL_ALREADY_EXISTS;
- if (g_Dbs.db[i].superTbls[j].childTblExists != TBL_ALREADY_EXISTS) {
- ret = getSuperTableFromServer(taos, g_Dbs.db[i].dbName,
- &g_Dbs.db[i].superTbls[j]);
+ if (0 != ret) {
+ errorPrint("\ncreate super table %d failed!\n\n", j);
+ taos_close(taos);
+ return -1;
}
}
+ ret = getSuperTableFromServer(taos, g_Dbs.db[i].dbName,
+ &g_Dbs.db[i].superTbls[j]);
if (0 != ret) {
- printf("\ncreate super table %d failed!\n\n", j);
+ errorPrint("\nget super table %s.%s info failed!\n\n",
+ g_Dbs.db[i].dbName, g_Dbs.db[i].superTbls[j].sTblName);
taos_close(taos);
return -1;
}
- }
+ }
}
taos_close(taos);
return 0;
}
-static void* createTable(void *sarg)
-{
- threadInfo *winfo = (threadInfo *)sarg;
+static void* createTable(void *sarg)
+{
+ threadInfo *winfo = (threadInfo *)sarg;
SSuperTable* superTblInfo = winfo->superTblInfo;
int64_t lastPrintTime = taosGetTimestampMs();
@@ -2454,57 +2526,64 @@ static void* createTable(void *sarg)
int len = 0;
int batchNum = 0;
- verbosePrint("%s() LN%d: Creating table from %d to %d\n",
+ verbosePrint("%s() LN%d: Creating table from %d to %d\n",
__func__, __LINE__,
winfo->start_table_from, winfo->end_table_to);
for (int i = winfo->start_table_from; i <= winfo->end_table_to; i++) {
if (0 == g_Dbs.use_metric) {
- snprintf(buffer, buff_len,
+ snprintf(buffer, buff_len,
"create table if not exists %s.%s%d %s;",
winfo->db_name,
g_args.tb_prefix, i,
winfo->cols);
} else {
- if (0 == len) {
- batchNum = 0;
- memset(buffer, 0, buff_len);
- len += snprintf(buffer + len,
- buff_len - len, "create table ");
- }
-
- char* tagsValBuf = NULL;
- if (0 == superTblInfo->tagSource) {
- tagsValBuf = generateTagVaulesForStb(superTblInfo);
- } else {
- tagsValBuf = getTagValueFromTagSample(
- superTblInfo,
- i % superTblInfo->tagSampleCount);
- }
- if (NULL == tagsValBuf) {
+ if (superTblInfo == NULL) {
+ errorPrint("%s() LN%d, use metric, but super table info is NULL\n",
+ __func__, __LINE__);
free(buffer);
- return NULL;
- }
-
- len += snprintf(buffer + len,
- superTblInfo->maxSqlLen - len,
- "if not exists %s.%s%d using %s.%s tags %s ",
- winfo->db_name, superTblInfo->childTblPrefix,
- i, winfo->db_name,
- superTblInfo->sTblName, tagsValBuf);
- free(tagsValBuf);
- batchNum++;
-
- if ((batchNum < superTblInfo->batchCreateTableNum)
- && ((superTblInfo->maxSqlLen - len)
- >= (superTblInfo->lenOfTagOfOneRow + 256))) {
- continue;
+ exit(-1);
+ } else {
+ if (0 == len) {
+ batchNum = 0;
+ memset(buffer, 0, buff_len);
+ len += snprintf(buffer + len,
+ buff_len - len, "create table ");
+ }
+
+ char* tagsValBuf = NULL;
+ if (0 == superTblInfo->tagSource) {
+ tagsValBuf = generateTagVaulesForStb(superTblInfo);
+ } else {
+ tagsValBuf = getTagValueFromTagSample(
+ superTblInfo,
+ i % superTblInfo->tagSampleCount);
+ }
+ if (NULL == tagsValBuf) {
+ free(buffer);
+ return NULL;
+ }
+
+ len += snprintf(buffer + len,
+ superTblInfo->maxSqlLen - len,
+ "if not exists %s.%s%d using %s.%s tags %s ",
+ winfo->db_name, superTblInfo->childTblPrefix,
+ i, winfo->db_name,
+ superTblInfo->sTblName, tagsValBuf);
+ free(tagsValBuf);
+ batchNum++;
+
+ if ((batchNum < superTblInfo->batchCreateTableNum)
+ && ((superTblInfo->maxSqlLen - len)
+ >= (superTblInfo->lenOfTagOfOneRow + 256))) {
+ continue;
+ }
}
}
len = 0;
verbosePrint("%s() LN%d %s\n", __func__, __LINE__, buffer);
- if (0 != queryDbExec(winfo->taos, buffer, NO_INSERT_TYPE)){
+ if (0 != queryDbExec(winfo->taos, buffer, NO_INSERT_TYPE, false)){
errorPrint( "queryDbExec() failed. buffer:\n%s\n", buffer);
free(buffer);
return NULL;
@@ -2520,7 +2599,7 @@ static void* createTable(void *sarg)
if (0 != len) {
verbosePrint("%s() %d buffer: %s\n", __func__, __LINE__, buffer);
- if (0 != queryDbExec(winfo->taos, buffer, NO_INSERT_TYPE)) {
+ if (0 != queryDbExec(winfo->taos, buffer, NO_INSERT_TYPE, false)) {
errorPrint( "queryDbExec() failed. buffer:\n%s\n", buffer);
}
}
@@ -2532,6 +2611,7 @@ static void* createTable(void *sarg)
static int startMultiThreadCreateChildTable(
char* cols, int threads, int startFrom, int ntables,
char* db_name, SSuperTable* superTblInfo) {
+
pthread_t *pids = malloc(threads * sizeof(pthread_t));
threadInfo *infos = malloc(threads * sizeof(threadInfo));
@@ -2552,7 +2632,7 @@ static int startMultiThreadCreateChildTable(
int b = 0;
b = ntables % threads;
-
+
for (int i = 0; i < threads; i++) {
threadInfo *t_info = infos + i;
t_info->threadID = i;
@@ -2568,7 +2648,7 @@ static int startMultiThreadCreateChildTable(
if (t_info->taos == NULL) {
errorPrint( "Failed to connect to TDengine, reason:%s\n", taos_errstr(NULL));
free(pids);
- free(infos);
+ free(infos);
return -1;
}
@@ -2576,12 +2656,12 @@ static int startMultiThreadCreateChildTable(
t_info->ntables = iend_table_to = i < b ? startFrom + a : startFrom + a - 1;
startFrom = t_info->end_table_to + 1;
- t_info->use_metric = 1;
+ t_info->use_metric = true;
t_info->cols = cols;
t_info->minDelay = INT16_MAX;
pthread_create(pids + i, NULL, createTable, t_info);
}
-
+
for (int i = 0; i < threads; i++) {
pthread_join(pids[i], NULL);
}
@@ -2592,12 +2672,11 @@ static int startMultiThreadCreateChildTable(
}
free(pids);
- free(infos);
+ free(infos);
return 0;
}
-
static void createChildTables() {
char tblColsBuf[MAX_SQL_SIZE];
int len;
@@ -2616,13 +2695,13 @@ static void createChildTables() {
int startFrom = 0;
g_totalChildTables += g_Dbs.db[i].superTbls[j].childTblCount;
- verbosePrint("%s() LN%d: create %d child tables from %d\n", __func__, __LINE__,
- g_totalChildTables, startFrom);
+ verbosePrint("%s() LN%d: create %d child tables from %d\n",
+ __func__, __LINE__, g_totalChildTables, startFrom);
startMultiThreadCreateChildTable(
g_Dbs.db[i].superTbls[j].colsOfCreateChildTable,
g_Dbs.threadCountByCreateTbl,
startFrom,
- g_totalChildTables,
+ g_Dbs.db[i].superTbls[j].childTblCount,
g_Dbs.db[i].dbName, &(g_Dbs.db[i].superTbls[j]));
}
} else {
@@ -2633,10 +2712,10 @@ static void createChildTables() {
if ((strncasecmp(g_args.datatype[j], "BINARY", strlen("BINARY")) == 0)
|| (strncasecmp(g_args.datatype[j],
"NCHAR", strlen("NCHAR")) == 0)) {
- len = snprintf(tblColsBuf + len, MAX_SQL_SIZE - len,
+ snprintf(tblColsBuf + len, MAX_SQL_SIZE - len,
", COL%d %s(60)", j, g_args.datatype[j]);
} else {
- len = snprintf(tblColsBuf + len, MAX_SQL_SIZE - len,
+ snprintf(tblColsBuf + len, MAX_SQL_SIZE - len,
", COL%d %s", j, g_args.datatype[j]);
}
len = strlen(tblColsBuf);
@@ -2741,7 +2820,7 @@ static int readSampleFromCsvFileToMem(
ssize_t readLen = 0;
char * line = NULL;
int getRows = 0;
-
+
FILE* fp = fopen(superTblInfo->sampleFile, "r");
if (fp == NULL) {
errorPrint( "Failed to open sample file: %s, reason:%s\n",
@@ -2763,7 +2842,7 @@ static int readSampleFromCsvFileToMem(
}
continue;
}
-
+
if (('\r' == line[readLen - 1]) || ('\n' == line[readLen - 1])) {
line[--readLen] = 0;
}
@@ -2874,7 +2953,7 @@ static bool getColumnAndTagTypeFromInsertJsonFile(
debugPrint("%s() LN%d, failed to read json, tags not found\n", __func__, __LINE__);
goto PARSE_OVER;
}
-
+
int tagSize = cJSON_GetArraySize(tags);
if (tagSize > MAX_TAG_COUNT) {
debugPrint("%s() LN%d, failed to read json, tags size overflow, max tag size is %d\n", __func__, __LINE__, MAX_TAG_COUNT);
@@ -2943,9 +3022,9 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
cJSON* host = cJSON_GetObjectItem(root, "host");
if (host && host->type == cJSON_String && host->valuestring != NULL) {
- tstrncpy(g_Dbs.host, host->valuestring, MAX_DB_NAME_SIZE);
+ tstrncpy(g_Dbs.host, host->valuestring, MAX_HOSTNAME_SIZE);
} else if (!host) {
- tstrncpy(g_Dbs.host, "127.0.0.1", MAX_DB_NAME_SIZE);
+ tstrncpy(g_Dbs.host, "127.0.0.1", MAX_HOSTNAME_SIZE);
} else {
printf("ERROR: failed to read json, host not found\n");
goto PARSE_OVER;
@@ -2960,16 +3039,16 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
cJSON* user = cJSON_GetObjectItem(root, "user");
if (user && user->type == cJSON_String && user->valuestring != NULL) {
- tstrncpy(g_Dbs.user, user->valuestring, MAX_DB_NAME_SIZE);
+ tstrncpy(g_Dbs.user, user->valuestring, MAX_USERNAME_SIZE);
} else if (!user) {
- tstrncpy(g_Dbs.user, "root", MAX_DB_NAME_SIZE);
+ tstrncpy(g_Dbs.user, "root", MAX_USERNAME_SIZE);
}
cJSON* password = cJSON_GetObjectItem(root, "password");
if (password && password->type == cJSON_String && password->valuestring != NULL) {
- tstrncpy(g_Dbs.password, password->valuestring, MAX_DB_NAME_SIZE);
+ tstrncpy(g_Dbs.password, password->valuestring, MAX_PASSWORD_SIZE);
} else if (!password) {
- tstrncpy(g_Dbs.password, "taosdata", MAX_DB_NAME_SIZE);
+ tstrncpy(g_Dbs.password, "taosdata", MAX_PASSWORD_SIZE);
}
cJSON* resultfile = cJSON_GetObjectItem(root, "result_file");
@@ -2987,17 +3066,18 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
} else {
printf("ERROR: failed to read json, threads not found\n");
goto PARSE_OVER;
- }
-
+ }
+
cJSON* threads2 = cJSON_GetObjectItem(root, "thread_count_create_tbl");
if (threads2 && threads2->type == cJSON_Number) {
g_Dbs.threadCountByCreateTbl = threads2->valueint;
} else if (!threads2) {
- g_Dbs.threadCountByCreateTbl = 1;
+ g_Dbs.threadCountByCreateTbl = g_args.num_of_threads;
} else {
- printf("ERROR: failed to read json, threads2 not found\n");
+ errorPrint("%s() LN%d, failed to read json, threads2 not found\n",
+ __func__, __LINE__);
goto PARSE_OVER;
- }
+ }
cJSON* gInsertInterval = cJSON_GetObjectItem(root, "insert_interval");
if (gInsertInterval && gInsertInterval->type == cJSON_Number) {
@@ -3009,15 +3089,26 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
goto PARSE_OVER;
}
- cJSON* rowsPerTbl = cJSON_GetObjectItem(root, "rows_per_tbl");
- if (rowsPerTbl && rowsPerTbl->type == cJSON_Number) {
- g_args.rows_per_tbl = rowsPerTbl->valueint;
- } else if (!rowsPerTbl) {
- g_args.rows_per_tbl = 0; // 0 means progressive mode, > 0 mean interlace mode. max value is less or equ num_of_records_per_req
+ cJSON* interlaceRows = cJSON_GetObjectItem(root, "interlace_rows");
+ if (interlaceRows && interlaceRows->type == cJSON_Number) {
+ g_args.interlace_rows = interlaceRows->valueint;
+
+ // rows per table need be less than insert batch
+ if (g_args.interlace_rows > g_args.num_of_RPR) {
+ printf("NOTICE: interlace rows value %d > num_of_records_per_request %d\n\n",
+ g_args.interlace_rows, g_args.num_of_RPR);
+ printf(" interlace rows value will be set to num_of_records_per_request %d\n\n",
+ g_args.num_of_RPR);
+ printf(" press Enter key to continue or Ctrl+C to stop.");
+ (void)getchar();
+ g_args.interlace_rows = g_args.num_of_RPR;
+ }
+ } else if (!interlaceRows) {
+ g_args.interlace_rows = 0; // 0 means progressive mode, > 0 mean interlace mode. max value is less or equ num_of_records_per_req
} else {
- errorPrint("%s() LN%d, failed to read json, rows_per_tbl input mistake\n", __func__, __LINE__);
+ errorPrint("%s() LN%d, failed to read json, interlace_rows input mistake\n", __func__, __LINE__);
goto PARSE_OVER;
- }
+ }
cJSON* maxSqlLen = cJSON_GetObjectItem(root, "max_sql_len");
if (maxSqlLen && maxSqlLen->type == cJSON_Number) {
@@ -3028,7 +3119,6 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
errorPrint("%s() LN%d, failed to read json, max_sql_len input mistake\n", __func__, __LINE__);
goto PARSE_OVER;
}
-
cJSON* numRecPerReq = cJSON_GetObjectItem(root, "num_of_records_per_req");
if (numRecPerReq && numRecPerReq->type == cJSON_Number) {
@@ -3041,7 +3131,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
}
cJSON *answerPrompt = cJSON_GetObjectItem(root, "confirm_parameter_prompt"); // yes, no,
- if (answerPrompt
+ if (answerPrompt
&& answerPrompt->type == cJSON_String
&& answerPrompt->valuestring != NULL) {
if (0 == strncasecmp(answerPrompt->valuestring, "yes", 3)) {
@@ -3056,7 +3146,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
} else {
printf("ERROR: failed to read json, confirm_parameter_prompt not found\n");
goto PARSE_OVER;
- }
+ }
cJSON* dbs = cJSON_GetObjectItem(root, "databases");
if (!dbs || dbs->type != cJSON_Array) {
@@ -3083,7 +3173,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
printf("ERROR: failed to read json, dbinfo not found\n");
goto PARSE_OVER;
}
-
+
cJSON *dbName = cJSON_GetObjectItem(dbinfo, "name");
if (!dbName || dbName->type != cJSON_String || dbName->valuestring == NULL) {
printf("ERROR: failed to read json, db name not found\n");
@@ -3093,15 +3183,16 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
cJSON *drop = cJSON_GetObjectItem(dbinfo, "drop");
if (drop && drop->type == cJSON_String && drop->valuestring != NULL) {
- if (0 == strncasecmp(drop->valuestring, "yes", 3)) {
- g_Dbs.db[i].drop = 1;
+ if (0 == strncasecmp(drop->valuestring, "yes", strlen("yes"))) {
+ g_Dbs.db[i].drop = true;
} else {
- g_Dbs.db[i].drop = 0;
- }
+ g_Dbs.db[i].drop = false;
+ }
} else if (!drop) {
- g_Dbs.db[i].drop = 0;
+ g_Dbs.db[i].drop = g_args.drop_database;
} else {
- printf("ERROR: failed to read json, drop not found\n");
+ errorPrint("%s() LN%d, failed to read json, drop input mistake\n",
+ __func__, __LINE__);
goto PARSE_OVER;
}
@@ -3147,7 +3238,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
printf("ERROR: failed to read json, keep not found\n");
goto PARSE_OVER;
}
-
+
cJSON* days = cJSON_GetObjectItem(dbinfo, "days");
if (days && days->type == cJSON_Number) {
g_Dbs.db[i].dbCfg.days = days->valueint;
@@ -3157,7 +3248,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
printf("ERROR: failed to read json, days not found\n");
goto PARSE_OVER;
}
-
+
cJSON* cache = cJSON_GetObjectItem(dbinfo, "cache");
if (cache && cache->type == cJSON_Number) {
g_Dbs.db[i].dbCfg.cache = cache->valueint;
@@ -3167,7 +3258,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
printf("ERROR: failed to read json, cache not found\n");
goto PARSE_OVER;
}
-
+
cJSON* blocks= cJSON_GetObjectItem(dbinfo, "blocks");
if (blocks && blocks->type == cJSON_Number) {
g_Dbs.db[i].dbCfg.blocks = blocks->valueint;
@@ -3256,15 +3347,15 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
} else {
printf("ERROR: failed to read json, fsync not found\n");
goto PARSE_OVER;
- }
+ }
- // super_talbes
+ // super_talbes
cJSON *stables = cJSON_GetObjectItem(dbinfos, "super_tables");
if (!stables || stables->type != cJSON_Array) {
printf("ERROR: failed to read json, super_tables not found\n");
goto PARSE_OVER;
- }
-
+ }
+
int stbSize = cJSON_GetArraySize(stables);
if (stbSize > MAX_SUPER_TABLE_COUNT) {
errorPrint(
@@ -3277,15 +3368,15 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
for (int j = 0; j < stbSize; ++j) {
cJSON* stbInfo = cJSON_GetArrayItem(stables, j);
if (stbInfo == NULL) continue;
-
- // dbinfo
+
+ // dbinfo
cJSON *stbName = cJSON_GetObjectItem(stbInfo, "name");
if (!stbName || stbName->type != cJSON_String || stbName->valuestring == NULL) {
printf("ERROR: failed to read json, stb name not found\n");
goto PARSE_OVER;
}
tstrncpy(g_Dbs.db[i].superTbls[j].sTblName, stbName->valuestring, MAX_TB_NAME_SIZE);
-
+
cJSON *prefix = cJSON_GetObjectItem(stbInfo, "childtable_prefix");
if (!prefix || prefix->type != cJSON_String || prefix->valuestring == NULL) {
printf("ERROR: failed to read json, childtable_prefix not found\n");
@@ -3310,7 +3401,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
printf("ERROR: failed to read json, auto_create_table not found\n");
goto PARSE_OVER;
}
-
+
cJSON* batchCreateTbl = cJSON_GetObjectItem(stbInfo, "batch_create_tbl_num");
if (batchCreateTbl && batchCreateTbl->type == cJSON_Number) {
g_Dbs.db[i].superTbls[j].batchCreateTableNum = batchCreateTbl->valueint;
@@ -3319,7 +3410,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
} else {
printf("ERROR: failed to read json, batch_create_tbl_num not found\n");
goto PARSE_OVER;
- }
+ }
cJSON *childTblExists = cJSON_GetObjectItem(stbInfo, "child_table_exists"); // yes, no
if (childTblExists
@@ -3335,13 +3426,15 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
} else if (!childTblExists) {
g_Dbs.db[i].superTbls[j].childTblExists = TBL_NO_EXISTS;
} else {
- errorPrint("%s() LN%d, failed to read json, child_table_exists not found\n", __func__, __LINE__);
+ errorPrint("%s() LN%d, failed to read json, child_table_exists not found\n",
+ __func__, __LINE__);
goto PARSE_OVER;
}
-
+
cJSON* count = cJSON_GetObjectItem(stbInfo, "childtable_count");
if (!count || count->type != cJSON_Number || 0 >= count->valueint) {
- errorPrint("%s() LN%d, failed to read json, childtable_count not found\n", __func__, __LINE__);
+ errorPrint("%s() LN%d, failed to read json, childtable_count not found\n",
+ __func__, __LINE__);
goto PARSE_OVER;
}
g_Dbs.db[i].superTbls[j].childTblCount = count->valueint;
@@ -3425,10 +3518,11 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
} else {
printf("ERROR: failed to read json, sample_buf_size not found\n");
goto PARSE_OVER;
- }
+ }
cJSON *sampleFormat = cJSON_GetObjectItem(stbInfo, "sample_format");
- if (sampleFormat && sampleFormat->type == cJSON_String && sampleFormat->valuestring != NULL) {
+ if (sampleFormat && sampleFormat->type
+ == cJSON_String && sampleFormat->valuestring != NULL) {
tstrncpy(g_Dbs.db[i].superTbls[j].sampleFormat,
sampleFormat->valuestring, MAX_DB_NAME_SIZE);
} else if (!sampleFormat) {
@@ -3436,7 +3530,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
} else {
printf("ERROR: failed to read json, sample_format not found\n");
goto PARSE_OVER;
- }
+ }
cJSON *sampleFile = cJSON_GetObjectItem(stbInfo, "sample_file");
if (sampleFile && sampleFile->type == cJSON_String && sampleFile->valuestring != NULL) {
@@ -3447,7 +3541,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
} else {
printf("ERROR: failed to read json, sample_file not found\n");
goto PARSE_OVER;
- }
+ }
cJSON *tagsFile = cJSON_GetObjectItem(stbInfo, "tags_file");
if (tagsFile && tagsFile->type == cJSON_String && tagsFile->valuestring != NULL) {
@@ -3473,14 +3567,14 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
len = TSDB_MAX_ALLOWED_SQL_LEN;
} else if (len < TSDB_MAX_SQL_LEN) {
len = TSDB_MAX_SQL_LEN;
- }
+ }
g_Dbs.db[i].superTbls[j].maxSqlLen = len;
} else if (!maxSqlLen) {
g_Dbs.db[i].superTbls[j].maxSqlLen = TSDB_MAX_SQL_LEN;
} else {
printf("ERROR: failed to read json, maxSqlLen not found\n");
goto PARSE_OVER;
- }
+ }
cJSON *multiThreadWriteOneTbl =
cJSON_GetObjectItem(stbInfo, "multi_thread_write_one_tbl"); // no , yes
@@ -3491,7 +3585,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
g_Dbs.db[i].superTbls[j].multiThreadWriteOneTbl = 1;
} else {
g_Dbs.db[i].superTbls[j].multiThreadWriteOneTbl = 0;
- }
+ }
} else if (!multiThreadWriteOneTbl) {
g_Dbs.db[i].superTbls[j].multiThreadWriteOneTbl = 0;
} else {
@@ -3499,15 +3593,27 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
goto PARSE_OVER;
}
- cJSON* rowsPerTbl = cJSON_GetObjectItem(stbInfo, "rows_per_tbl");
- if (rowsPerTbl && rowsPerTbl->type == cJSON_Number) {
- g_Dbs.db[i].superTbls[j].rowsPerTbl = rowsPerTbl->valueint;
- } else if (!rowsPerTbl) {
- g_Dbs.db[i].superTbls[j].rowsPerTbl = 0; // 0 means progressive mode, > 0 mean interlace mode. max value is less or equ num_of_records_per_req
+ cJSON* interlaceRows = cJSON_GetObjectItem(stbInfo, "interlace_rows");
+ if (interlaceRows && interlaceRows->type == cJSON_Number) {
+ g_Dbs.db[i].superTbls[j].interlaceRows = interlaceRows->valueint;
+ // rows per table need be less than insert batch
+ if (g_Dbs.db[i].superTbls[j].interlaceRows > g_args.num_of_RPR) {
+ printf("NOTICE: db[%d].superTbl[%d]'s interlace rows value %d > num_of_records_per_request %d\n\n",
+ i, j, g_Dbs.db[i].superTbls[j].interlaceRows, g_args.num_of_RPR);
+ printf(" interlace rows value will be set to num_of_records_per_request %d\n\n",
+ g_args.num_of_RPR);
+ printf(" press Enter key to continue or Ctrl+C to stop.");
+ (void)getchar();
+ g_Dbs.db[i].superTbls[j].interlaceRows = g_args.num_of_RPR;
+ }
+ } else if (!interlaceRows) {
+ g_Dbs.db[i].superTbls[j].interlaceRows = 0; // 0 means progressive mode, > 0 mean interlace mode. max value is less or equ num_of_records_per_req
} else {
- errorPrint("%s() LN%d, failed to read json, rowsPerTbl input mistake\n", __func__, __LINE__);
+ errorPrint(
+ "%s() LN%d, failed to read json, interlace rows input mistake\n",
+ __func__, __LINE__);
goto PARSE_OVER;
- }
+ }
cJSON* disorderRatio = cJSON_GetObjectItem(stbInfo, "disorder_ratio");
if (disorderRatio && disorderRatio->type == cJSON_Number) {
@@ -3517,7 +3623,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
} else {
printf("ERROR: failed to read json, disorderRatio not found\n");
goto PARSE_OVER;
- }
+ }
cJSON* disorderRange = cJSON_GetObjectItem(stbInfo, "disorder_range");
if (disorderRange && disorderRange->type == cJSON_Number) {
@@ -3535,7 +3641,8 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
} else if (!insertRows) {
g_Dbs.db[i].superTbls[j].insertRows = 0x7FFFFFFFFFFFFFFF;
} else {
- errorPrint("%s() LN%d, failed to read json, insert_rows input mistake\n", __func__, __LINE__);
+ errorPrint("%s() LN%d, failed to read json, insert_rows input mistake\n",
+ __func__, __LINE__);
goto PARSE_OVER;
}
@@ -3547,22 +3654,17 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
__func__, __LINE__, g_args.insert_interval);
g_Dbs.db[i].superTbls[j].insertInterval = g_args.insert_interval;
} else {
- errorPrint("%s() LN%d, failed to read json, insert_interval input mistake\n", __func__, __LINE__);
+ errorPrint("%s() LN%d, failed to read json, insert_interval input mistake\n",
+ __func__, __LINE__);
goto PARSE_OVER;
}
-/* CBD if (NO_CREATE_SUBTBL == g_Dbs.db[i].superTbls[j].autoCreateTable
- || (TBL_ALREADY_EXISTS == g_Dbs.db[i].superTbls[j].childTblExists)) {
- continue;
- }
- */
-
int retVal = getColumnAndTagTypeFromInsertJsonFile(
stbInfo, &g_Dbs.db[i].superTbls[j]);
if (false == retVal) {
goto PARSE_OVER;
- }
- }
+ }
+ }
}
ret = true;
@@ -3584,9 +3686,9 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
cJSON* host = cJSON_GetObjectItem(root, "host");
if (host && host->type == cJSON_String && host->valuestring != NULL) {
- tstrncpy(g_queryInfo.host, host->valuestring, MAX_DB_NAME_SIZE);
+ tstrncpy(g_queryInfo.host, host->valuestring, MAX_HOSTNAME_SIZE);
} else if (!host) {
- tstrncpy(g_queryInfo.host, "127.0.0.1", MAX_DB_NAME_SIZE);
+ tstrncpy(g_queryInfo.host, "127.0.0.1", MAX_HOSTNAME_SIZE);
} else {
printf("ERROR: failed to read json, host not found\n");
goto PARSE_OVER;
@@ -3601,16 +3703,16 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
cJSON* user = cJSON_GetObjectItem(root, "user");
if (user && user->type == cJSON_String && user->valuestring != NULL) {
- tstrncpy(g_queryInfo.user, user->valuestring, MAX_DB_NAME_SIZE);
+ tstrncpy(g_queryInfo.user, user->valuestring, MAX_USERNAME_SIZE);
} else if (!user) {
- tstrncpy(g_queryInfo.user, "root", MAX_DB_NAME_SIZE); ;
+ tstrncpy(g_queryInfo.user, "root", MAX_USERNAME_SIZE); ;
}
cJSON* password = cJSON_GetObjectItem(root, "password");
if (password && password->type == cJSON_String && password->valuestring != NULL) {
- tstrncpy(g_queryInfo.password, password->valuestring, MAX_DB_NAME_SIZE);
+ tstrncpy(g_queryInfo.password, password->valuestring, MAX_PASSWORD_SIZE);
} else if (!password) {
- tstrncpy(g_queryInfo.password, "taosdata", MAX_DB_NAME_SIZE);;
+ tstrncpy(g_queryInfo.password, "taosdata", MAX_PASSWORD_SIZE);;
}
cJSON *answerPrompt = cJSON_GetObjectItem(root, "confirm_parameter_prompt"); // yes, no,
@@ -3628,7 +3730,17 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
} else {
printf("ERROR: failed to read json, confirm_parameter_prompt not found\n");
goto PARSE_OVER;
- }
+ }
+
+ cJSON* gQueryTimes = cJSON_GetObjectItem(root, "query_times");
+ if (gQueryTimes && gQueryTimes->type == cJSON_Number) {
+ g_args.query_times = gQueryTimes->valueint;
+ } else if (!gQueryTimes) {
+ g_args.query_times = 1;
+ } else {
+ errorPrint("%s() LN%d, failed to read json, query_times input mistake\n", __func__, __LINE__);
+ goto PARSE_OVER;
+ }
cJSON* dbs = cJSON_GetObjectItem(root, "databases");
if (dbs && dbs->type == cJSON_String && dbs->valuestring != NULL) {
@@ -3647,7 +3759,7 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
printf("ERROR: failed to read json, query_mode not found\n");
goto PARSE_OVER;
}
-
+
// super_table_query
cJSON *superQuery = cJSON_GetObjectItem(root, "specified_table_query");
if (!superQuery) {
@@ -3656,26 +3768,26 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
} else if (superQuery->type != cJSON_Object) {
printf("ERROR: failed to read json, super_table_query not found\n");
goto PARSE_OVER;
- } else {
+ } else {
cJSON* rate = cJSON_GetObjectItem(superQuery, "query_interval");
if (rate && rate->type == cJSON_Number) {
g_queryInfo.superQueryInfo.rate = rate->valueint;
} else if (!rate) {
g_queryInfo.superQueryInfo.rate = 0;
}
-
+
cJSON* concurrent = cJSON_GetObjectItem(superQuery, "concurrent");
if (concurrent && concurrent->type == cJSON_Number) {
g_queryInfo.superQueryInfo.concurrent = concurrent->valueint;
} else if (!concurrent) {
g_queryInfo.superQueryInfo.concurrent = 1;
}
-
+
cJSON* mode = cJSON_GetObjectItem(superQuery, "mode");
if (mode && mode->type == cJSON_String && mode->valuestring != NULL) {
- if (0 == strcmp("sync", mode->valuestring)) {
+ if (0 == strcmp("sync", mode->valuestring)) {
g_queryInfo.superQueryInfo.subscribeMode = 0;
- } else if (0 == strcmp("async", mode->valuestring)) {
+ } else if (0 == strcmp("async", mode->valuestring)) {
g_queryInfo.superQueryInfo.subscribeMode = 1;
} else {
printf("ERROR: failed to read json, subscribe mod error\n");
@@ -3684,21 +3796,21 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
} else {
g_queryInfo.superQueryInfo.subscribeMode = 0;
}
-
+
cJSON* interval = cJSON_GetObjectItem(superQuery, "interval");
if (interval && interval->type == cJSON_Number) {
g_queryInfo.superQueryInfo.subscribeInterval = interval->valueint;
- } else if (!interval) {
+ } else if (!interval) {
//printf("failed to read json, subscribe interval no found\n");
//goto PARSE_OVER;
g_queryInfo.superQueryInfo.subscribeInterval = 10000;
}
-
+
cJSON* restart = cJSON_GetObjectItem(superQuery, "restart");
if (restart && restart->type == cJSON_String && restart->valuestring != NULL) {
- if (0 == strcmp("yes", restart->valuestring)) {
+ if (0 == strcmp("yes", restart->valuestring)) {
g_queryInfo.superQueryInfo.subscribeRestart = 1;
- } else if (0 == strcmp("no", restart->valuestring)) {
+ } else if (0 == strcmp("no", restart->valuestring)) {
g_queryInfo.superQueryInfo.subscribeRestart = 0;
} else {
printf("ERROR: failed to read json, subscribe restart error\n");
@@ -3707,14 +3819,14 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
} else {
g_queryInfo.superQueryInfo.subscribeRestart = 1;
}
-
+
cJSON* keepProgress = cJSON_GetObjectItem(superQuery, "keepProgress");
if (keepProgress
&& keepProgress->type == cJSON_String
&& keepProgress->valuestring != NULL) {
- if (0 == strcmp("yes", keepProgress->valuestring)) {
+ if (0 == strcmp("yes", keepProgress->valuestring)) {
g_queryInfo.superQueryInfo.subscribeKeepProgress = 1;
- } else if (0 == strcmp("no", keepProgress->valuestring)) {
+ } else if (0 == strcmp("no", keepProgress->valuestring)) {
g_queryInfo.superQueryInfo.subscribeKeepProgress = 0;
} else {
printf("ERROR: failed to read json, subscribe keepProgress error\n");
@@ -3724,14 +3836,14 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
g_queryInfo.superQueryInfo.subscribeKeepProgress = 0;
}
- // sqls
+ // sqls
cJSON* superSqls = cJSON_GetObjectItem(superQuery, "sqls");
if (!superSqls) {
g_queryInfo.superQueryInfo.sqlCount = 0;
} else if (superSqls->type != cJSON_Array) {
printf("ERROR: failed to read json, super sqls not found\n");
goto PARSE_OVER;
- } else {
+ } else {
int superSqlSize = cJSON_GetArraySize(superSqls);
if (superSqlSize > MAX_QUERY_SQL_COUNT) {
printf("ERROR: failed to read json, query sql size overflow, max is %d\n", MAX_QUERY_SQL_COUNT);
@@ -3742,7 +3854,7 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
for (int j = 0; j < superSqlSize; ++j) {
cJSON* sql = cJSON_GetArrayItem(superSqls, j);
if (sql == NULL) continue;
-
+
cJSON *sqlStr = cJSON_GetObjectItem(sql, "sql");
if (!sqlStr || sqlStr->type != cJSON_String || sqlStr->valuestring == NULL) {
printf("ERROR: failed to read json, sql not found\n");
@@ -3758,7 +3870,7 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
} else {
printf("ERROR: failed to read json, super query result file not found\n");
goto PARSE_OVER;
- }
+ }
}
}
}
@@ -3804,9 +3916,9 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
cJSON* submode = cJSON_GetObjectItem(subQuery, "mode");
if (submode && submode->type == cJSON_String && submode->valuestring != NULL) {
- if (0 == strcmp("sync", submode->valuestring)) {
+ if (0 == strcmp("sync", submode->valuestring)) {
g_queryInfo.subQueryInfo.subscribeMode = 0;
- } else if (0 == strcmp("async", submode->valuestring)) {
+ } else if (0 == strcmp("async", submode->valuestring)) {
g_queryInfo.subQueryInfo.subscribeMode = 1;
} else {
printf("ERROR: failed to read json, subscribe mod error\n");
@@ -3824,12 +3936,12 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
//goto PARSE_OVER;
g_queryInfo.subQueryInfo.subscribeInterval = 10000;
}
-
+
cJSON* subrestart = cJSON_GetObjectItem(subQuery, "restart");
if (subrestart && subrestart->type == cJSON_String && subrestart->valuestring != NULL) {
- if (0 == strcmp("yes", subrestart->valuestring)) {
+ if (0 == strcmp("yes", subrestart->valuestring)) {
g_queryInfo.subQueryInfo.subscribeRestart = 1;
- } else if (0 == strcmp("no", subrestart->valuestring)) {
+ } else if (0 == strcmp("no", subrestart->valuestring)) {
g_queryInfo.subQueryInfo.subscribeRestart = 0;
} else {
printf("ERROR: failed to read json, subscribe restart error\n");
@@ -3838,14 +3950,14 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
} else {
g_queryInfo.subQueryInfo.subscribeRestart = 1;
}
-
+
cJSON* subkeepProgress = cJSON_GetObjectItem(subQuery, "keepProgress");
if (subkeepProgress &&
subkeepProgress->type == cJSON_String
&& subkeepProgress->valuestring != NULL) {
- if (0 == strcmp("yes", subkeepProgress->valuestring)) {
+ if (0 == strcmp("yes", subkeepProgress->valuestring)) {
g_queryInfo.subQueryInfo.subscribeKeepProgress = 1;
- } else if (0 == strcmp("no", subkeepProgress->valuestring)) {
+ } else if (0 == strcmp("no", subkeepProgress->valuestring)) {
g_queryInfo.subQueryInfo.subscribeKeepProgress = 0;
} else {
printf("ERROR: failed to read json, subscribe keepProgress error\n");
@@ -3853,27 +3965,27 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
}
} else {
g_queryInfo.subQueryInfo.subscribeKeepProgress = 0;
- }
+ }
- // sqls
+ // sqls
cJSON* subsqls = cJSON_GetObjectItem(subQuery, "sqls");
if (!subsqls) {
g_queryInfo.subQueryInfo.sqlCount = 0;
} else if (subsqls->type != cJSON_Array) {
printf("ERROR: failed to read json, super sqls not found\n");
goto PARSE_OVER;
- } else {
+ } else {
int superSqlSize = cJSON_GetArraySize(subsqls);
if (superSqlSize > MAX_QUERY_SQL_COUNT) {
printf("ERROR: failed to read json, query sql size overflow, max is %d\n", MAX_QUERY_SQL_COUNT);
goto PARSE_OVER;
}
-
+
g_queryInfo.subQueryInfo.sqlCount = superSqlSize;
- for (int j = 0; j < superSqlSize; ++j) {
+ for (int j = 0; j < superSqlSize; ++j) {
cJSON* sql = cJSON_GetArrayItem(subsqls, j);
if (sql == NULL) continue;
-
+
cJSON *sqlStr = cJSON_GetObjectItem(sql, "sql");
if (!sqlStr || sqlStr->type != cJSON_String || sqlStr->valuestring == NULL) {
printf("ERROR: failed to read json, sql not found\n");
@@ -3889,7 +4001,7 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
} else {
printf("ERROR: failed to read json, sub query result file not found\n");
goto PARSE_OVER;
- }
+ }
}
}
}
@@ -3951,14 +4063,14 @@ static bool getInfoFromJsonFile(char* file) {
if (INSERT_TEST == g_args.test_mode) {
ret = getMetaFromInsertJsonFile(root);
- } else if (QUERY_TEST == g_args.test_mode) {
- ret = getMetaFromQueryJsonFile(root);
- } else if (SUBSCRIBE_TEST == g_args.test_mode) {
+ } else if ((QUERY_TEST == g_args.test_mode)
+ || (SUBSCRIBE_TEST == g_args.test_mode)) {
ret = getMetaFromQueryJsonFile(root);
} else {
- errorPrint("%s() LN%d, input json file type error! please input correct file type: insert or query or subscribe\n", __func__, __LINE__);
+ errorPrint("%s() LN%d, input json file type error! please input correct file type: insert or query or subscribe\n",
+ __func__, __LINE__);
goto PARSE_OVER;
- }
+ }
PARSE_OVER:
free(content);
@@ -3968,7 +4080,7 @@ PARSE_OVER:
}
static void prepareSampleData() {
- for (int i = 0; i < g_Dbs.dbCount; i++) {
+ for (int i = 0; i < g_Dbs.dbCount; i++) {
for (int j = 0; j < g_Dbs.db[i].superTblCount; j++) {
if (g_Dbs.db[i].superTbls[j].tagsFile[0] != 0) {
(void)readTagFromCsvFileToMem(&g_Dbs.db[i].superTbls[j]);
@@ -3979,7 +4091,7 @@ static void prepareSampleData() {
static void postFreeResource() {
tmfclose(g_fpOfInsertResult);
- for (int i = 0; i < g_Dbs.dbCount; i++) {
+ for (int i = 0; i < g_Dbs.dbCount; i++) {
for (int j = 0; j < g_Dbs.db[i].superTblCount; j++) {
if (0 != g_Dbs.db[i].superTbls[j].colsOfCreateChildTable) {
free(g_Dbs.db[i].superTbls[j].colsOfCreateChildTable);
@@ -4030,7 +4142,7 @@ static int getRowDataFromSample(char* dataBuf, int maxLen, int64_t timestamp,
static int generateRowData(char* dataBuf, int maxLen, int64_t timestamp, SSuperTable* stbInfo) {
int dataLen = 0;
dataLen += snprintf(dataBuf + dataLen, maxLen - dataLen, "(%" PRId64 ", ", timestamp);
- for (int i = 0; i < stbInfo->columnCount; i++) {
+ for (int i = 0; i < stbInfo->columnCount; i++) {
if ((0 == strncasecmp(stbInfo->columns[i].dataType, "binary", 6))
|| (0 == strncasecmp(stbInfo->columns[i].dataType, "nchar", 5))) {
if (stbInfo->columns[i].dataLen > TSDB_MAX_BINARY_LEN) {
@@ -4177,7 +4289,7 @@ static int execInsert(threadInfo *pThreadInfo, char *buffer, int k)
__func__, __LINE__, buffer);
if (superTblInfo) {
if (0 == strncasecmp(superTblInfo->insertMode, "taosc", strlen("taosc"))) {
- affectedRows = queryDbExec(pThreadInfo->taos, buffer, INSERT_TYPE);
+ affectedRows = queryDbExec(pThreadInfo->taos, buffer, INSERT_TYPE, false);
} else {
if (0 != postProceSql(g_Dbs.host, g_Dbs.port, buffer)) {
affectedRows = -1;
@@ -4187,7 +4299,7 @@ static int execInsert(threadInfo *pThreadInfo, char *buffer, int k)
}
}
} else {
- affectedRows = queryDbExec(pThreadInfo->taos, buffer, 1);
+ affectedRows = queryDbExec(pThreadInfo->taos, buffer, INSERT_TYPE, false);
}
return affectedRows;
@@ -4241,28 +4353,28 @@ static int generateDataTail(char *tableName, int32_t tableSeq,
if (0 == strncasecmp(superTblInfo->dataSource,
"sample", strlen("sample"))) {
retLen = getRowDataFromSample(
- buffer + len,
- superTblInfo->maxSqlLen - len,
+ buffer + len,
+ superTblInfo->maxSqlLen - len,
startTime + superTblInfo->timeStampStep * k,
- superTblInfo,
+ superTblInfo,
pSamplePos);
} else if (0 == strncasecmp(superTblInfo->dataSource,
"rand", strlen("rand"))) {
int rand_num = rand_tinyint() % 100;
- if (0 != superTblInfo->disorderRatio
+ if (0 != superTblInfo->disorderRatio
&& rand_num < superTblInfo->disorderRatio) {
int64_t d = startTime
+ superTblInfo->timeStampStep * k
- taosRandom() % superTblInfo->disorderRange;
retLen = generateRowData(
- buffer + len,
+ buffer + len,
superTblInfo->maxSqlLen - len,
- d,
+ d,
superTblInfo);
} else {
retLen = generateRowData(
- buffer + len,
- superTblInfo->maxSqlLen - len,
+ buffer + len,
+ superTblInfo->maxSqlLen - len,
startTime + superTblInfo->timeStampStep * k,
superTblInfo);
}
@@ -4286,7 +4398,7 @@ static int generateDataTail(char *tableName, int32_t tableSeq,
if ((g_args.disorderRatio != 0)
&& (rand_num < g_args.disorderRange)) {
-
+
int64_t d = startTime + DEFAULT_TIMESTAMP_STEP * k
- taosRandom() % 1000000 + rand_num;
len = generateData(data, data_type,
@@ -4372,7 +4484,7 @@ static int generateSQLHead(char *tableName, int32_t tableSeq,
return len;
}
-static int generateDataBuffer(char *pTblName,
+static int generateProgressiveDataBuffer(char *pTblName,
int32_t tableSeq,
threadInfo *pThreadInfo, char *buffer,
int64_t insertRows,
@@ -4414,6 +4526,18 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
pThreadInfo->threadID, __func__, __LINE__);
SSuperTable* superTblInfo = pThreadInfo->superTblInfo;
+ int interlaceRows = superTblInfo?superTblInfo->interlaceRows:g_args.interlace_rows;
+
+ int insertMode;
+
+ if (interlaceRows > 0) {
+ insertMode = INTERLACE_INSERT_MODE;
+ } else {
+ insertMode = PROGRESSIVE_INSERT_MODE;
+ }
+
+ // TODO: prompt tbl count multple interlace rows and batch
+ //
char* buffer = calloc(superTblInfo?superTblInfo->maxSqlLen:g_args.max_sql_len, 1);
if (NULL == buffer) {
@@ -4422,27 +4546,16 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
strerror(errno));
return NULL;
}
-
- int insertMode;
+
+
char tableName[TSDB_TABLE_NAME_LEN];
- int rowsPerTbl = superTblInfo?superTblInfo->rowsPerTbl:g_args.rows_per_tbl;
-
- if (rowsPerTbl > 0) {
- insertMode = INTERLACE_INSERT_MODE;
- } else {
- insertMode = PROGRESSIVE_INSERT_MODE;
- }
-
- // rows per table need be less than insert batch
- if (rowsPerTbl > g_args.num_of_RPR)
- rowsPerTbl = g_args.num_of_RPR;
-
pThreadInfo->totalInsertRows = 0;
pThreadInfo->totalAffectedRows = 0;
int64_t insertRows = (superTblInfo)?superTblInfo->insertRows:g_args.num_of_DPT;
- int insert_interval = superTblInfo?superTblInfo->insertInterval:g_args.insert_interval;
+ int insert_interval =
+ superTblInfo?superTblInfo->insertInterval:g_args.insert_interval;
uint64_t st = 0;
uint64_t et = 0xffffffff;
@@ -4463,13 +4576,13 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
assert(pThreadInfo->ntables > 0);
- if (rowsPerTbl > g_args.num_of_RPR)
- rowsPerTbl = g_args.num_of_RPR;
+ if (interlaceRows > g_args.num_of_RPR)
+ interlaceRows = g_args.num_of_RPR;
- batchPerTbl = rowsPerTbl;
- if ((rowsPerTbl > 0) && (pThreadInfo->ntables > 1)) {
+ batchPerTbl = interlaceRows;
+ if ((interlaceRows > 0) && (pThreadInfo->ntables > 1)) {
batchPerTblTimes =
- (g_args.num_of_RPR / (rowsPerTbl * pThreadInfo->ntables)) + 1;
+ (g_args.num_of_RPR / (interlaceRows * pThreadInfo->ntables)) + 1;
} else {
batchPerTblTimes = 1;
}
@@ -4511,6 +4624,14 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
verbosePrint("[%d] %s() LN%d i=%d batchPerTblTimes=%d batchPerTbl = %d\n",
pThreadInfo->threadID, __func__, __LINE__,
i, batchPerTblTimes, batchPerTbl);
+
+ if (superTblInfo) {
+ if (0 == strncasecmp(superTblInfo->startTimestamp, "now", 3)) {
+ startTime = taosGetTimestamp(pThreadInfo->time_precision);
+ }
+ } else {
+ startTime = 1500000000000;
+ }
generateDataTail(
tableName, tableSeq, pThreadInfo, superTblInfo,
batchPerTbl, pstr, insertRows, 0,
@@ -4519,8 +4640,8 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
pstr += dataLen;
recOfBatch += batchPerTbl;
+ startTime += batchPerTbl * superTblInfo->timeStampStep;
pThreadInfo->totalInsertRows += batchPerTbl;
-
verbosePrint("[%d] %s() LN%d batchPerTbl=%d recOfBatch=%d\n",
pThreadInfo->threadID, __func__, __LINE__,
batchPerTbl, recOfBatch);
@@ -4636,22 +4757,26 @@ static void* syncWriteProgressive(threadInfo *pThreadInfo) {
strerror(errno));
return NULL;
}
-
+
int64_t lastPrintTime = taosGetTimestampMs();
int64_t startTs = taosGetTimestampUs();
int64_t endTs;
- int timeStampStep = superTblInfo?superTblInfo->timeStampStep:DEFAULT_TIMESTAMP_STEP;
- int insert_interval = superTblInfo?superTblInfo->insertInterval:g_args.insert_interval;
+ int timeStampStep =
+ superTblInfo?superTblInfo->timeStampStep:DEFAULT_TIMESTAMP_STEP;
+/* int insert_interval =
+ superTblInfo?superTblInfo->insertInterval:g_args.insert_interval;
uint64_t st = 0;
uint64_t et = 0xffffffff;
+ */
pThreadInfo->totalInsertRows = 0;
pThreadInfo->totalAffectedRows = 0;
pThreadInfo->samplePos = 0;
- for (uint32_t tableSeq = pThreadInfo->start_table_from; tableSeq <= pThreadInfo->end_table_to;
+ for (uint32_t tableSeq =
+ pThreadInfo->start_table_from; tableSeq <= pThreadInfo->end_table_to;
tableSeq ++) {
int64_t start_time = pThreadInfo->start_time;
@@ -4659,9 +4784,11 @@ static void* syncWriteProgressive(threadInfo *pThreadInfo) {
verbosePrint("%s() LN%d insertRows=%"PRId64"\n", __func__, __LINE__, insertRows);
for (int64_t i = 0; i < insertRows;) {
+ /*
if (insert_interval) {
st = taosGetTimestampUs();
}
+ */
char tableName[TSDB_TABLE_NAME_LEN];
getTableName(tableName, pThreadInfo, tableSeq);
@@ -4669,7 +4796,7 @@ static void* syncWriteProgressive(threadInfo *pThreadInfo) {
__func__, __LINE__,
pThreadInfo->threadID, tableSeq, tableName);
- int generated = generateDataBuffer(
+ int generated = generateProgressiveDataBuffer(
tableName, tableSeq, pThreadInfo, buffer, insertRows,
i, start_time,
&(pThreadInfo->samplePos));
@@ -4711,7 +4838,7 @@ static void* syncWriteProgressive(threadInfo *pThreadInfo) {
if (i >= insertRows)
break;
-
+/*
if (insert_interval) {
et = taosGetTimestampUs();
@@ -4722,6 +4849,7 @@ static void* syncWriteProgressive(threadInfo *pThreadInfo) {
taosMsleep(sleep_time); // ms
}
}
+ */
} // num_of_DPT
if ((tableSeq == pThreadInfo->ntables - 1) && superTblInfo &&
@@ -4747,9 +4875,9 @@ static void* syncWrite(void *sarg) {
threadInfo *winfo = (threadInfo *)sarg;
SSuperTable* superTblInfo = winfo->superTblInfo;
- int rowsPerTbl = superTblInfo?superTblInfo->rowsPerTbl:g_args.rows_per_tbl;
+ int interlaceRows = superTblInfo?superTblInfo->interlaceRows:g_args.interlace_rows;
- if (rowsPerTbl > 0) {
+ if (interlaceRows > 0) {
// interlace mode
return syncWriteInterlace(winfo);
} else {
@@ -4762,14 +4890,15 @@ static void callBack(void *param, TAOS_RES *res, int code) {
threadInfo* winfo = (threadInfo*)param;
SSuperTable* superTblInfo = winfo->superTblInfo;
- int insert_interval = superTblInfo?superTblInfo->insertInterval:g_args.insert_interval;
+ int insert_interval =
+ superTblInfo?superTblInfo->insertInterval:g_args.insert_interval;
if (insert_interval) {
winfo->et = taosGetTimestampUs();
if (((winfo->et - winfo->st)/1000) < insert_interval) {
taosMsleep(insert_interval - (winfo->et - winfo->st)/1000); // ms
}
}
-
+
char *buffer = calloc(1, winfo->superTblInfo->maxSqlLen);
char *data = calloc(1, MAX_DATA_SIZE);
char *pstr = buffer;
@@ -4787,17 +4916,17 @@ static void callBack(void *param, TAOS_RES *res, int code) {
taos_free_result(res);
return;
}
-
+
for (int i = 0; i < g_args.num_of_RPR; i++) {
int rand_num = taosRandom() % 100;
- if (0 != winfo->superTblInfo->disorderRatio && rand_num < winfo->superTblInfo->disorderRatio)
- {
+ if (0 != winfo->superTblInfo->disorderRatio
+ && rand_num < winfo->superTblInfo->disorderRatio) {
int64_t d = winfo->lastTs - taosRandom() % 1000000 + rand_num;
//generateData(data, datatype, ncols_per_record, d, len_of_binary);
- (void)generateRowData(data, MAX_DATA_SIZE, d, winfo->superTblInfo);
+ generateRowData(data, MAX_DATA_SIZE, d, winfo->superTblInfo);
} else {
//generateData(data, datatype, ncols_per_record, start_time += 1000, len_of_binary);
- (void)generateRowData(data, MAX_DATA_SIZE, winfo->lastTs += 1000, winfo->superTblInfo);
+ generateRowData(data, MAX_DATA_SIZE, winfo->lastTs += 1000, winfo->superTblInfo);
}
pstr += sprintf(pstr, "%s", data);
winfo->counter++;
@@ -4824,8 +4953,9 @@ static void *asyncWrite(void *sarg) {
winfo->st = 0;
winfo->et = 0;
winfo->lastTs = winfo->start_time;
-
- int insert_interval = superTblInfo?superTblInfo->insertInterval:g_args.insert_interval;
+
+ int insert_interval =
+ superTblInfo?superTblInfo->insertInterval:g_args.insert_interval;
if (insert_interval) {
winfo->st = taosGetTimestampUs();
}
@@ -4851,7 +4981,7 @@ static void startMultiThreadInsertData(int threads, char* db_name,
int ntables = 0;
if (superTblInfo) {
- if ((superTblInfo->childTblOffset >= 0)
+ if ((superTblInfo->childTblOffset >= 0)
&& (superTblInfo->childTblLimit > 0)) {
ntables = superTblInfo->childTblLimit;
@@ -4889,12 +5019,12 @@ static void startMultiThreadInsertData(int threads, char* db_name,
} else if (0 == strncasecmp(precision, "us", 2)) {
timePrec = TSDB_TIME_PRECISION_MICRO;
} else {
- errorPrint( "No support precision: %s\n", precision);
+ errorPrint("Not support precision: %s\n", precision);
exit(-1);
}
}
- int64_t start_time;
+ int64_t start_time;
if (superTblInfo) {
if (0 == strncasecmp(superTblInfo->startTimestamp, "now", 3)) {
start_time = taosGetTimestamp(timePrec);
@@ -4912,7 +5042,7 @@ static void startMultiThreadInsertData(int threads, char* db_name,
}
double start = getCurrentTime();
-
+
int startFrom;
if ((superTblInfo) && (superTblInfo->childTblOffset >= 0))
@@ -4921,19 +5051,21 @@ static void startMultiThreadInsertData(int threads, char* db_name,
startFrom = 0;
// read sample data from file first
- if ((superTblInfo) && (0 == strncasecmp(superTblInfo->dataSource,
+ if ((superTblInfo) && (0 == strncasecmp(superTblInfo->dataSource,
"sample", strlen("sample")))) {
if (0 != prepareSampleDataForSTable(superTblInfo)) {
- errorPrint("%s() LN%d, prepare sample data for stable failed!\n", __func__, __LINE__);
+ errorPrint("%s() LN%d, prepare sample data for stable failed!\n",
+ __func__, __LINE__);
exit(-1);
}
}
// read sample data from file first
- if ((superTblInfo) && (0 == strncasecmp(superTblInfo->dataSource,
+ if ((superTblInfo) && (0 == strncasecmp(superTblInfo->dataSource,
"sample", strlen("sample")))) {
if (0 != prepareSampleDataForSTable(superTblInfo)) {
- errorPrint("%s() LN%d, prepare sample data for stable failed!\n", __func__, __LINE__);
+ errorPrint("%s() LN%d, prepare sample data for stable failed!\n",
+ __func__, __LINE__);
exit(-1);
}
}
@@ -4981,6 +5113,7 @@ static void startMultiThreadInsertData(int threads, char* db_name,
threadInfo *t_info = infos + i;
t_info->threadID = i;
tstrncpy(t_info->db_name, db_name, MAX_DB_NAME_SIZE);
+ t_info->time_precision = timePrec;
t_info->superTblInfo = superTblInfo;
t_info->start_time = start_time;
@@ -4993,7 +5126,8 @@ static void startMultiThreadInsertData(int threads, char* db_name,
g_Dbs.host, g_Dbs.user,
g_Dbs.password, db_name, g_Dbs.port);
if (NULL == t_info->taos) {
- errorPrint( "connect to server fail from insert sub thread, reason: %s\n",
+ errorPrint(
+ "connect to server fail from insert sub thread, reason: %s\n",
taos_errstr(NULL));
exit(-1);
}
@@ -5092,7 +5226,7 @@ static void startMultiThreadInsertData(int threads, char* db_name,
avgDelay/1000.0, (double)maxDelay/1000.0, (double)minDelay/1000.0);
fprintf(g_fpOfInsertResult, "insert delay, avg:%10.6fms, max: %10.6fms, min: %10.6fms\n\n",
avgDelay/1000.0, (double)maxDelay/1000.0, (double)minDelay/1000.0);
-
+
//taos_close(taos);
free(pids);
@@ -5100,7 +5234,7 @@ static void startMultiThreadInsertData(int threads, char* db_name,
}
static void *readTable(void *sarg) {
-#if 1
+#if 1
threadInfo *rinfo = (threadInfo *)sarg;
TAOS *taos = rinfo->taos;
char command[BUFFER_SIZE] = "\0";
@@ -5135,7 +5269,8 @@ static void *readTable(void *sarg) {
double totalT = 0;
int count = 0;
for (int i = 0; i < num_of_tables; i++) {
- sprintf(command, "select %s from %s%d where ts>= %" PRId64, aggreFunc[j], tb_prefix, i, sTime);
+ sprintf(command, "select %s from %s%d where ts>= %" PRId64,
+ aggreFunc[j], tb_prefix, i, sTime);
double t = getCurrentTime();
TAOS_RES *pSql = taos_query(taos, command);
@@ -5266,7 +5401,7 @@ static int insertTestProcess() {
printf("Press enter key to continue\n\n");
(void)getchar();
}
-
+
init_rand_data();
// create database and super tables
@@ -5288,10 +5423,10 @@ static int insertTestProcess() {
if (g_totalChildTables > 0) {
printf("Spent %.4f seconds to create %d tables with %d thread(s)\n\n",
- end - start, g_totalChildTables, g_Dbs.threadCount);
+ end - start, g_totalChildTables, g_Dbs.threadCountByCreateTbl);
fprintf(g_fpOfInsertResult,
"Spent %.4f seconds to create %d tables with %d thread(s)\n\n",
- end - start, g_totalChildTables, g_Dbs.threadCount);
+ end - start, g_totalChildTables, g_Dbs.threadCountByCreateTbl);
}
taosMsleep(1000);
@@ -5305,16 +5440,16 @@ static int insertTestProcess() {
continue;
}
startMultiThreadInsertData(
- g_Dbs.threadCount,
- g_Dbs.db[i].dbName,
- g_Dbs.db[i].dbCfg.precision,
+ g_Dbs.threadCount,
+ g_Dbs.db[i].dbName,
+ g_Dbs.db[i].dbCfg.precision,
superTblInfo);
}
} else {
startMultiThreadInsertData(
- g_Dbs.threadCount,
- g_Dbs.db[i].dbName,
- g_Dbs.db[i].dbCfg.precision,
+ g_Dbs.threadCount,
+ g_Dbs.db[i].dbName,
+ g_Dbs.db[i].dbCfg.precision,
NULL);
}
}
@@ -5334,48 +5469,69 @@ static int insertTestProcess() {
}
static void *superQueryProcess(void *sarg) {
- threadInfo *winfo = (threadInfo *)sarg;
+ threadInfo *winfo = (threadInfo *)sarg;
+
+ if (winfo->taos == NULL) {
+ TAOS * taos = NULL;
+ taos = taos_connect(g_queryInfo.host,
+ g_queryInfo.user,
+ g_queryInfo.password,
+ NULL,
+ g_queryInfo.port);
+ if (taos == NULL) {
+ errorPrint("[%d] Failed to connect to TDengine, reason:%s\n",
+ winfo->threadID, taos_errstr(NULL));
+ return NULL;
+ } else {
+ winfo->taos = taos;
+ }
+ }
//char sqlStr[MAX_TB_NAME_SIZE*2];
//sprintf(sqlStr, "use %s", g_queryInfo.dbName);
//queryDB(winfo->taos, sqlStr);
-
+
int64_t st = 0;
int64_t et = 0;
- while (1) {
- if (g_queryInfo.superQueryInfo.rate && (et - st) < (int64_t)g_queryInfo.superQueryInfo.rate*1000) {
+
+ int queryTimes = g_args.query_times;
+
+ while(queryTimes --) {
+ if (g_queryInfo.superQueryInfo.rate && (et - st) <
+ (int64_t)g_queryInfo.superQueryInfo.rate*1000) {
taosMsleep(g_queryInfo.superQueryInfo.rate*1000 - (et - st)); // ms
//printf("========sleep duration:%"PRId64 "========inserted rows:%d, table range:%d - %d\n", (1000 - (et - st)), i, winfo->start_table_from, winfo->end_table_to);
}
st = taosGetTimestampUs();
for (int i = 0; i < g_queryInfo.superQueryInfo.sqlCount; i++) {
- if (0 == strncasecmp(g_queryInfo.queryMode, "taosc", 5)) {
+ if (0 == strncasecmp(g_queryInfo.queryMode, "taosc", 5)) {
int64_t t1 = taosGetTimestampUs();
char tmpFile[MAX_FILE_NAME_LEN*2] = {0};
if (g_queryInfo.superQueryInfo.result[i][0] != 0) {
- sprintf(tmpFile, "%s-%d", g_queryInfo.superQueryInfo.result[i], winfo->threadID);
+ sprintf(tmpFile, "%s-%d",
+ g_queryInfo.superQueryInfo.result[i], winfo->threadID);
}
- selectAndGetResult(winfo->taos, g_queryInfo.superQueryInfo.sql[i], tmpFile);
- int64_t t2 = taosGetTimestampUs();
- printf("=[taosc] thread[%"PRId64"] complete one sql, Spent %f s\n",
+ selectAndGetResult(winfo->taos, g_queryInfo.superQueryInfo.sql[i], tmpFile);
+ int64_t t2 = taosGetTimestampUs();
+ printf("=[taosc] thread[%"PRId64"] complete one sql, Spent %f s\n",
taosGetSelfPthreadId(), (t2 - t1)/1000000.0);
} else {
int64_t t1 = taosGetTimestampUs();
- int retCode = postProceSql(g_queryInfo.host,
+ int retCode = postProceSql(g_queryInfo.host,
g_queryInfo.port, g_queryInfo.superQueryInfo.sql[i]);
- int64_t t2 = taosGetTimestampUs();
- printf("=[restful] thread[%"PRId64"] complete one sql, Spent %f s\n",
+ int64_t t2 = taosGetTimestampUs();
+ printf("=[restful] thread[%"PRId64"] complete one sql, Spent %f s\n",
taosGetSelfPthreadId(), (t2 - t1)/1000000.0);
-
+
if (0 != retCode) {
printf("====restful return fail, threadID[%d]\n", winfo->threadID);
return NULL;
}
- }
+ }
}
et = taosGetTimestampUs();
- printf("==thread[%"PRId64"] complete all sqls to specify tables once queries duration:%.6fs\n\n",
+ printf("==thread[%"PRId64"] complete all sqls to specify tables once queries duration:%.6fs\n\n",
taosGetSelfPthreadId(), (double)(et - st)/1000.0);
}
return NULL;
@@ -5384,31 +5540,50 @@ static void *superQueryProcess(void *sarg) {
static void replaceSubTblName(char* inSql, char* outSql, int tblIndex) {
char sourceString[32] = "xxxx";
char subTblName[MAX_TB_NAME_SIZE*3];
- sprintf(subTblName, "%s.%s",
- g_queryInfo.dbName,
+ sprintf(subTblName, "%s.%s",
+ g_queryInfo.dbName,
g_queryInfo.subQueryInfo.childTblName + tblIndex*TSDB_TABLE_NAME_LEN);
//printf("inSql: %s\n", inSql);
-
+
char* pos = strstr(inSql, sourceString);
if (0 == pos) {
- return;
+ return;
}
-
+
tstrncpy(outSql, inSql, pos - inSql + 1);
//printf("1: %s\n", outSql);
- strcat(outSql, subTblName);
- //printf("2: %s\n", outSql);
- strcat(outSql, pos+strlen(sourceString));
- //printf("3: %s\n", outSql);
+ strcat(outSql, subTblName);
+ //printf("2: %s\n", outSql);
+ strcat(outSql, pos+strlen(sourceString));
+ //printf("3: %s\n", outSql);
}
static void *subQueryProcess(void *sarg) {
char sqlstr[1024];
- threadInfo *winfo = (threadInfo *)sarg;
+ threadInfo *winfo = (threadInfo *)sarg;
+
+ if (winfo->taos == NULL) {
+ TAOS * taos = NULL;
+ taos = taos_connect(g_queryInfo.host,
+ g_queryInfo.user,
+ g_queryInfo.password,
+ NULL,
+ g_queryInfo.port);
+ if (taos == NULL) {
+ errorPrint("[%d] Failed to connect to TDengine, reason:%s\n",
+ winfo->threadID, taos_errstr(NULL));
+ return NULL;
+ } else {
+ winfo->taos = taos;
+ }
+ }
+
int64_t st = 0;
int64_t et = (int64_t)g_queryInfo.subQueryInfo.rate*1000;
- while (1) {
+ int queryTimes = g_args.query_times;
+
+ while(queryTimes --) {
if (g_queryInfo.subQueryInfo.rate
&& (et - st) < (int64_t)g_queryInfo.subQueryInfo.rate*1000) {
taosMsleep(g_queryInfo.subQueryInfo.rate*1000 - (et - st)); // ms
@@ -5421,33 +5596,40 @@ static void *subQueryProcess(void *sarg) {
memset(sqlstr,0,sizeof(sqlstr));
replaceSubTblName(g_queryInfo.subQueryInfo.sql[j], sqlstr, i);
char tmpFile[MAX_FILE_NAME_LEN*2] = {0};
- if (g_queryInfo.subQueryInfo.result[i][0] != 0) {
- sprintf(tmpFile, "%s-%d",
- g_queryInfo.subQueryInfo.result[i],
+ if (g_queryInfo.subQueryInfo.result[j][0] != 0) {
+ sprintf(tmpFile, "%s-%d",
+ g_queryInfo.subQueryInfo.result[j],
winfo->threadID);
}
- selectAndGetResult(winfo->taos, sqlstr, tmpFile);
+ selectAndGetResult(winfo->taos, sqlstr, tmpFile);
}
}
et = taosGetTimestampUs();
- printf("####thread[%"PRId64"] complete all sqls to allocate all sub-tables[%d - %d] once queries duration:%.4fs\n\n",
- taosGetSelfPthreadId(),
- winfo->start_table_from,
- winfo->end_table_to,
+ printf("####thread[%"PRId64"] complete all sqls to allocate all sub-tables[%d - %d] once queries duration:%.4fs\n\n",
+ taosGetSelfPthreadId(),
+ winfo->start_table_from,
+ winfo->end_table_to,
(double)(et - st)/1000000.0);
}
+
return NULL;
}
static int queryTestProcess() {
- TAOS * taos = NULL;
- taos = taos_connect(g_queryInfo.host,
- g_queryInfo.user,
- g_queryInfo.password,
- NULL,
+
+ setupForAnsiEscape();
+ printfQueryMeta();
+ resetAfterAnsiEscape();
+
+ TAOS * taos = NULL;
+ taos = taos_connect(g_queryInfo.host,
+ g_queryInfo.user,
+ g_queryInfo.password,
+ NULL,
g_queryInfo.port);
if (taos == NULL) {
- errorPrint( "Failed to connect to TDengine, reason:%s\n", taos_errstr(NULL));
+ errorPrint( "Failed to connect to TDengine, reason:%s\n",
+ taos_errstr(NULL));
exit(-1);
}
@@ -5457,17 +5639,15 @@ static int queryTestProcess() {
g_queryInfo.subQueryInfo.sTblName,
&g_queryInfo.subQueryInfo.childTblName,
&g_queryInfo.subQueryInfo.childTblCount);
- }
-
- printfQueryMeta();
-
+ }
+
if (!g_args.answer_yes) {
printf("Press enter key to continue\n\n");
(void)getchar();
}
-
+
printfQuerySystemInfo(taos);
-
+
pthread_t *pids = NULL;
threadInfo *infos = NULL;
//==== create sub threads for query from specify table
@@ -5491,28 +5671,30 @@ static int queryTestProcess() {
t_info->threadID = i;
if (0 == strncasecmp(g_queryInfo.queryMode, "taosc", 5)) {
- t_info->taos = taos;
char sqlStr[MAX_TB_NAME_SIZE*2];
sprintf(sqlStr, "use %s", g_queryInfo.dbName);
verbosePrint("%s() %d sqlStr: %s\n", __func__, __LINE__, sqlStr);
- if (0 != queryDbExec(t_info->taos, sqlStr, NO_INSERT_TYPE)) {
+ if (0 != queryDbExec(taos, sqlStr, NO_INSERT_TYPE, false)) {
+ taos_close(taos);
free(infos);
free(pids);
errorPrint( "use database %s failed!\n\n",
g_queryInfo.dbName);
return -1;
}
- } else {
- t_info->taos = NULL;
}
+ t_info->taos = NULL;// TODO: workaround to use separate taos connection;
+
pthread_create(pids + i, NULL, superQueryProcess, t_info);
}
- }else {
+ } else {
g_queryInfo.superQueryInfo.concurrent = 0;
}
+ taos_close(taos);
+
pthread_t *pidsOfSub = NULL;
threadInfo *infosOfSub = NULL;
//==== create sub threads for query from all sub table of the super table
@@ -5520,7 +5702,6 @@ static int queryTestProcess() {
&& (g_queryInfo.subQueryInfo.threadCnt > 0)) {
pidsOfSub = malloc(g_queryInfo.subQueryInfo.threadCnt * sizeof(pthread_t));
if (NULL == pidsOfSub) {
- taos_close(taos);
free(infos);
free(pids);
@@ -5529,7 +5710,6 @@ static int queryTestProcess() {
infosOfSub = malloc(g_queryInfo.subQueryInfo.threadCnt * sizeof(threadInfo));
if (NULL == infosOfSub) {
- taos_close(taos);
free(pidsOfSub);
free(infos);
free(pids);
@@ -5538,51 +5718,51 @@ static int queryTestProcess() {
int ntables = g_queryInfo.subQueryInfo.childTblCount;
int threads = g_queryInfo.subQueryInfo.threadCnt;
-
+
int a = ntables / threads;
if (a < 1) {
threads = ntables;
a = 1;
}
-
+
int b = 0;
if (threads != 0) {
b = ntables % threads;
}
int startFrom = 0;
- for (int i = 0; i < threads; i++) {
+ for (int i = 0; i < threads; i++) {
threadInfo *t_info = infosOfSub + i;
t_info->threadID = i;
-
+
t_info->start_table_from = startFrom;
t_info->ntables = iend_table_to = i < b ? startFrom + a : startFrom + a - 1;
startFrom = t_info->end_table_to + 1;
- t_info->taos = taos;
+ t_info->taos = NULL; // TODO: workaround to use separate taos connection;
pthread_create(pidsOfSub + i, NULL, subQueryProcess, t_info);
}
g_queryInfo.subQueryInfo.threadCnt = threads;
} else {
g_queryInfo.subQueryInfo.threadCnt = 0;
- }
-
+ }
+
for (int i = 0; i < g_queryInfo.superQueryInfo.concurrent; i++) {
pthread_join(pids[i], NULL);
}
tmfree((char*)pids);
tmfree((char*)infos);
-
+
for (int i = 0; i < g_queryInfo.subQueryInfo.threadCnt; i++) {
pthread_join(pidsOfSub[i], NULL);
}
tmfree((char*)pidsOfSub);
tmfree((char*)infosOfSub);
-
- taos_close(taos);
+
+// taos_close(taos);// TODO: workaround to use separate taos connection;
return 0;
}
@@ -5623,13 +5803,30 @@ static void *subSubscribeProcess(void *sarg) {
threadInfo *winfo = (threadInfo *)sarg;
char subSqlstr[1024];
+ if (winfo->taos == NULL) {
+ TAOS * taos = NULL;
+ taos = taos_connect(g_queryInfo.host,
+ g_queryInfo.user,
+ g_queryInfo.password,
+ g_queryInfo.dbName,
+ g_queryInfo.port);
+ if (taos == NULL) {
+ errorPrint("[%d] Failed to connect to TDengine, reason:%s\n",
+ winfo->threadID, taos_errstr(NULL));
+ return NULL;
+ } else {
+ winfo->taos = taos;
+ }
+ }
+
char sqlStr[MAX_TB_NAME_SIZE*2];
sprintf(sqlStr, "use %s", g_queryInfo.dbName);
debugPrint("%s() %d sqlStr: %s\n", __func__, __LINE__, sqlStr);
- if (0 != queryDbExec(winfo->taos, sqlStr, NO_INSERT_TYPE)){
+ if (0 != queryDbExec(winfo->taos, sqlStr, NO_INSERT_TYPE, false)) {
+ taos_close(winfo->taos);
return NULL;
}
-
+
//int64_t st = 0;
//int64_t et = 0;
do {
@@ -5646,10 +5843,13 @@ static void *subSubscribeProcess(void *sarg) {
replaceSubTblName(g_queryInfo.subQueryInfo.sql[i], subSqlstr, i);
char tmpFile[MAX_FILE_NAME_LEN*2] = {0};
if (g_queryInfo.subQueryInfo.result[i][0] != 0) {
- sprintf(tmpFile, "%s-%d", g_queryInfo.subQueryInfo.result[i], winfo->threadID);
+ sprintf(tmpFile, "%s-%d",
+ g_queryInfo.subQueryInfo.result[i], winfo->threadID);
}
- g_queryInfo.subQueryInfo.tsub[i] = subscribeImpl(winfo->taos, subSqlstr, topic, tmpFile);
+ g_queryInfo.subQueryInfo.tsub[i] = subscribeImpl(
+ winfo->taos, subSqlstr, topic, tmpFile);
if (NULL == g_queryInfo.subQueryInfo.tsub[i]) {
+ taos_close(winfo->taos);
return NULL;
}
}
@@ -5683,19 +5883,38 @@ static void *subSubscribeProcess(void *sarg) {
taos_unsubscribe(g_queryInfo.subQueryInfo.tsub[i],
g_queryInfo.subQueryInfo.subscribeKeepProgress);
}
+
+ taos_close(winfo->taos);
return NULL;
}
static void *superSubscribeProcess(void *sarg) {
threadInfo *winfo = (threadInfo *)sarg;
+ if (winfo->taos == NULL) {
+ TAOS * taos = NULL;
+ taos = taos_connect(g_queryInfo.host,
+ g_queryInfo.user,
+ g_queryInfo.password,
+ g_queryInfo.dbName,
+ g_queryInfo.port);
+ if (taos == NULL) {
+ errorPrint("[%d] Failed to connect to TDengine, reason:%s\n",
+ winfo->threadID, taos_errstr(NULL));
+ return NULL;
+ } else {
+ winfo->taos = taos;
+ }
+ }
+
char sqlStr[MAX_TB_NAME_SIZE*2];
sprintf(sqlStr, "use %s", g_queryInfo.dbName);
debugPrint("%s() %d sqlStr: %s\n", __func__, __LINE__, sqlStr);
- if (0 != queryDbExec(winfo->taos, sqlStr, NO_INSERT_TYPE)) {
+ if (0 != queryDbExec(winfo->taos, sqlStr, NO_INSERT_TYPE, false)) {
+ taos_close(winfo->taos);
return NULL;
}
-
+
//int64_t st = 0;
//int64_t et = 0;
do {
@@ -5718,6 +5937,7 @@ static void *superSubscribeProcess(void *sarg) {
g_queryInfo.superQueryInfo.sql[i],
topic, tmpFile);
if (NULL == g_queryInfo.superQueryInfo.tsub[i]) {
+ taos_close(winfo->taos);
return NULL;
}
}
@@ -5750,36 +5970,43 @@ static void *superSubscribeProcess(void *sarg) {
taos_unsubscribe(g_queryInfo.superQueryInfo.tsub[i],
g_queryInfo.superQueryInfo.subscribeKeepProgress);
}
+
+ taos_close(winfo->taos);
return NULL;
}
static int subscribeTestProcess() {
+ setupForAnsiEscape();
printfQueryMeta();
+ resetAfterAnsiEscape();
if (!g_args.answer_yes) {
printf("Press enter key to continue\n\n");
- (void)getchar();
+ (void) getchar();
}
- TAOS * taos = NULL;
- taos = taos_connect(g_queryInfo.host,
- g_queryInfo.user,
- g_queryInfo.password,
- g_queryInfo.dbName,
+ TAOS * taos = NULL;
+ taos = taos_connect(g_queryInfo.host,
+ g_queryInfo.user,
+ g_queryInfo.password,
+ g_queryInfo.dbName,
g_queryInfo.port);
if (taos == NULL) {
- errorPrint( "Failed to connect to TDengine, reason:%s\n", taos_errstr(NULL));
+ errorPrint( "Failed to connect to TDengine, reason:%s\n",
+ taos_errstr(NULL));
exit(-1);
}
if (0 != g_queryInfo.subQueryInfo.sqlCount) {
- getAllChildNameOfSuperTable(taos,
- g_queryInfo.dbName,
- g_queryInfo.subQueryInfo.sTblName,
- &g_queryInfo.subQueryInfo.childTblName,
+ getAllChildNameOfSuperTable(taos,
+ g_queryInfo.dbName,
+ g_queryInfo.subQueryInfo.sTblName,
+ &g_queryInfo.subQueryInfo.childTblName,
&g_queryInfo.subQueryInfo.childTblCount);
}
+ taos_close(taos); // TODO: workaround to use separate taos connection;
+
pthread_t *pids = NULL;
threadInfo *infos = NULL;
//==== create sub threads for query from super table
@@ -5794,19 +6021,18 @@ static int subscribeTestProcess() {
pids = malloc(g_queryInfo.superQueryInfo.concurrent * sizeof(pthread_t));
infos = malloc(g_queryInfo.superQueryInfo.concurrent * sizeof(threadInfo));
if ((NULL == pids) || (NULL == infos)) {
- printf("malloc failed for create threads\n");
- taos_close(taos);
+ errorPrint("%s() LN%d, malloc failed for create threads\n", __func__, __LINE__);
exit(-1);
}
for (int i = 0; i < g_queryInfo.superQueryInfo.concurrent; i++) {
threadInfo *t_info = infos + i;
t_info->threadID = i;
- t_info->taos = taos;
+ t_info->taos = NULL; // TODO: workaround to use separate taos connection;
pthread_create(pids + i, NULL, superSubscribeProcess, t_info);
}
-
- //==== create sub threads for query from sub table
+
+ //==== create sub threads for query from sub table
pthread_t *pidsOfSub = NULL;
threadInfo *infosOfSub = NULL;
if ((g_queryInfo.subQueryInfo.sqlCount > 0)
@@ -5816,25 +6042,26 @@ static int subscribeTestProcess() {
infosOfSub = malloc(g_queryInfo.subQueryInfo.threadCnt *
sizeof(threadInfo));
if ((NULL == pidsOfSub) || (NULL == infosOfSub)) {
- printf("malloc failed for create threads\n");
- taos_close(taos);
+ errorPrint("%s() LN%d, malloc failed for create threads\n",
+ __func__, __LINE__);
+ // taos_close(taos);
exit(-1);
}
int ntables = g_queryInfo.subQueryInfo.childTblCount;
int threads = g_queryInfo.subQueryInfo.threadCnt;
-
+
int a = ntables / threads;
if (a < 1) {
threads = ntables;
a = 1;
}
-
+
int b = 0;
if (threads != 0) {
b = ntables % threads;
}
-
+
int startFrom = 0;
for (int i = 0; i < threads; i++) {
threadInfo *t_info = infosOfSub + i;
@@ -5844,69 +6071,71 @@ static int subscribeTestProcess() {
t_info->ntables = iend_table_to = i < b ? startFrom + a : startFrom + a - 1;
startFrom = t_info->end_table_to + 1;
- t_info->taos = taos;
+ t_info->taos = NULL; // TODO: workaround to use separate taos connection;
pthread_create(pidsOfSub + i, NULL, subSubscribeProcess, t_info);
}
+
g_queryInfo.subQueryInfo.threadCnt = threads;
+
+ for (int i = 0; i < g_queryInfo.subQueryInfo.threadCnt; i++) {
+ pthread_join(pidsOfSub[i], NULL);
+ }
}
-
+
for (int i = 0; i < g_queryInfo.superQueryInfo.concurrent; i++) {
pthread_join(pids[i], NULL);
- }
+ }
tmfree((char*)pids);
tmfree((char*)infos);
- for (int i = 0; i < g_queryInfo.subQueryInfo.threadCnt; i++) {
- pthread_join(pidsOfSub[i], NULL);
- }
-
tmfree((char*)pidsOfSub);
tmfree((char*)infosOfSub);
- taos_close(taos);
+// taos_close(taos);
return 0;
}
static void initOfInsertMeta() {
memset(&g_Dbs, 0, sizeof(SDbs));
-
+
// set default values
- tstrncpy(g_Dbs.host, "127.0.0.1", MAX_DB_NAME_SIZE);
+ tstrncpy(g_Dbs.host, "127.0.0.1", MAX_HOSTNAME_SIZE);
g_Dbs.port = 6030;
- tstrncpy(g_Dbs.user, TSDB_DEFAULT_USER, MAX_DB_NAME_SIZE);
- tstrncpy(g_Dbs.password, TSDB_DEFAULT_PASS, MAX_DB_NAME_SIZE);
+ tstrncpy(g_Dbs.user, TSDB_DEFAULT_USER, MAX_USERNAME_SIZE);
+ tstrncpy(g_Dbs.password, TSDB_DEFAULT_PASS, MAX_PASSWORD_SIZE);
g_Dbs.threadCount = 2;
- g_Dbs.use_metric = true;
+
+ g_Dbs.use_metric = g_args.use_metric;
}
static void initOfQueryMeta() {
memset(&g_queryInfo, 0, sizeof(SQueryMetaInfo));
-
+
// set default values
- tstrncpy(g_queryInfo.host, "127.0.0.1", MAX_DB_NAME_SIZE);
+ tstrncpy(g_queryInfo.host, "127.0.0.1", MAX_HOSTNAME_SIZE);
g_queryInfo.port = 6030;
- tstrncpy(g_queryInfo.user, TSDB_DEFAULT_USER, MAX_DB_NAME_SIZE);
- tstrncpy(g_queryInfo.password, TSDB_DEFAULT_PASS, MAX_DB_NAME_SIZE);
+ tstrncpy(g_queryInfo.user, TSDB_DEFAULT_USER, MAX_USERNAME_SIZE);
+ tstrncpy(g_queryInfo.password, TSDB_DEFAULT_PASS, MAX_PASSWORD_SIZE);
}
static void setParaFromArg(){
if (g_args.host) {
- strcpy(g_Dbs.host, g_args.host);
+ tstrncpy(g_Dbs.host, g_args.host, MAX_HOSTNAME_SIZE);
} else {
- tstrncpy(g_Dbs.host, "127.0.0.1", MAX_DB_NAME_SIZE);
+ tstrncpy(g_Dbs.host, "127.0.0.1", MAX_HOSTNAME_SIZE);
}
if (g_args.user) {
- strcpy(g_Dbs.user, g_args.user);
- }
+ tstrncpy(g_Dbs.user, g_args.user, MAX_USERNAME_SIZE);
+ }
if (g_args.password) {
- strcpy(g_Dbs.password, g_args.password);
- }
-
+ tstrncpy(g_Dbs.password, g_args.password, MAX_PASSWORD_SIZE);
+ }
+
if (g_args.port) {
g_Dbs.port = g_args.port;
- }
+ }
g_Dbs.threadCount = g_args.num_of_threads;
g_Dbs.threadCountByCreateTbl = g_args.num_of_threads;
@@ -5927,11 +6156,11 @@ static void setParaFromArg(){
char dataString[STRING_LEN];
char **data_type = g_args.datatype;
-
+
memset(dataString, 0, STRING_LEN);
- if (strcasecmp(data_type[0], "BINARY") == 0
- || strcasecmp(data_type[0], "BOOL") == 0
+ if (strcasecmp(data_type[0], "BINARY") == 0
+ || strcasecmp(data_type[0], "BOOL") == 0
|| strcasecmp(data_type[0], "NCHAR") == 0 ) {
g_Dbs.do_aggreFunc = false;
}
@@ -5941,22 +6170,21 @@ static void setParaFromArg(){
tstrncpy(g_Dbs.db[0].superTbls[0].sTblName, "meters", MAX_TB_NAME_SIZE);
g_Dbs.db[0].superTbls[0].childTblCount = g_args.num_of_tables;
g_Dbs.threadCount = g_args.num_of_threads;
- g_Dbs.threadCountByCreateTbl = 1;
+ g_Dbs.threadCountByCreateTbl = g_args.num_of_threads;
g_Dbs.queryMode = g_args.mode;
-
+
g_Dbs.db[0].superTbls[0].autoCreateTable = PRE_CREATE_SUBTBL;
- g_Dbs.db[0].superTbls[0].superTblExists = TBL_NO_EXISTS;
g_Dbs.db[0].superTbls[0].childTblExists = TBL_NO_EXISTS;
g_Dbs.db[0].superTbls[0].disorderRange = g_args.disorderRange;
g_Dbs.db[0].superTbls[0].disorderRatio = g_args.disorderRatio;
- tstrncpy(g_Dbs.db[0].superTbls[0].childTblPrefix,
+ tstrncpy(g_Dbs.db[0].superTbls[0].childTblPrefix,
g_args.tb_prefix, MAX_TB_NAME_SIZE);
tstrncpy(g_Dbs.db[0].superTbls[0].dataSource, "rand", MAX_TB_NAME_SIZE);
tstrncpy(g_Dbs.db[0].superTbls[0].insertMode, "taosc", MAX_TB_NAME_SIZE);
- tstrncpy(g_Dbs.db[0].superTbls[0].startTimestamp,
+ tstrncpy(g_Dbs.db[0].superTbls[0].startTimestamp,
"2017-07-14 10:40:00.000", MAX_TB_NAME_SIZE);
g_Dbs.db[0].superTbls[0].timeStampStep = DEFAULT_TIMESTAMP_STEP;
-
+
g_Dbs.db[0].superTbls[0].insertRows = g_args.num_of_DPT;
g_Dbs.db[0].superTbls[0].maxSqlLen = TSDB_PAYLOAD_SIZE;
@@ -5965,34 +6193,33 @@ static void setParaFromArg(){
if (data_type[i] == NULL) {
break;
}
-
- tstrncpy(g_Dbs.db[0].superTbls[0].columns[i].dataType,
+
+ tstrncpy(g_Dbs.db[0].superTbls[0].columns[i].dataType,
data_type[i], MAX_TB_NAME_SIZE);
- g_Dbs.db[0].superTbls[0].columns[i].dataLen = g_args.len_of_binary;
+ g_Dbs.db[0].superTbls[0].columns[i].dataLen = g_args.len_of_binary;
g_Dbs.db[0].superTbls[0].columnCount++;
}
-
+
if (g_Dbs.db[0].superTbls[0].columnCount > g_args.num_of_CPR) {
g_Dbs.db[0].superTbls[0].columnCount = g_args.num_of_CPR;
} else {
for (int i = g_Dbs.db[0].superTbls[0].columnCount; i < g_args.num_of_CPR; i++) {
tstrncpy(g_Dbs.db[0].superTbls[0].columns[i].dataType, "INT", MAX_TB_NAME_SIZE);
- g_Dbs.db[0].superTbls[0].columns[i].dataLen = 0;
+ g_Dbs.db[0].superTbls[0].columns[i].dataLen = 0;
g_Dbs.db[0].superTbls[0].columnCount++;
}
}
tstrncpy(g_Dbs.db[0].superTbls[0].tags[0].dataType, "INT", MAX_TB_NAME_SIZE);
- g_Dbs.db[0].superTbls[0].tags[0].dataLen = 0;
-
- tstrncpy(g_Dbs.db[0].superTbls[0].tags[1].dataType, "BINARY", MAX_TB_NAME_SIZE);
- g_Dbs.db[0].superTbls[0].tags[1].dataLen = g_args.len_of_binary;
- g_Dbs.db[0].superTbls[0].tagCount = 2;
- } else {
- g_Dbs.threadCountByCreateTbl = 1;
- g_Dbs.db[0].superTbls[0].tagCount = 0;
- }
+ g_Dbs.db[0].superTbls[0].tags[0].dataLen = 0;
+ tstrncpy(g_Dbs.db[0].superTbls[0].tags[1].dataType, "BINARY", MAX_TB_NAME_SIZE);
+ g_Dbs.db[0].superTbls[0].tags[1].dataLen = g_args.len_of_binary;
+ g_Dbs.db[0].superTbls[0].tagCount = 2;
+ } else {
+ g_Dbs.threadCountByCreateTbl = g_args.num_of_threads;
+ g_Dbs.db[0].superTbls[0].tagCount = 0;
+ }
}
/* Function to do regular expression check */
@@ -6063,8 +6290,9 @@ static void querySqlFile(TAOS* taos, char* sqlFile)
memcpy(cmd + cmd_len, line, read_len);
verbosePrint("%s() LN%d cmd: %s\n", __func__, __LINE__, cmd);
- if (0 != queryDbExec(taos, cmd, NO_INSERT_TYPE)) {
- printf("queryDbExec %s failed!\n", cmd);
+ if (0 != queryDbExec(taos, cmd, NO_INSERT_TYPE, false)) {
+ errorPrint("%s() LN%d, queryDbExec %s failed!\n",
+ __func__, __LINE__, cmd);
tmfree(cmd);
tmfree(line);
tmfclose(fp);
@@ -6085,16 +6313,23 @@ static void querySqlFile(TAOS* taos, char* sqlFile)
static void testMetaFile() {
if (INSERT_TEST == g_args.test_mode) {
- if (g_Dbs.cfgDir[0]) taos_options(TSDB_OPTION_CONFIGDIR, g_Dbs.cfgDir);
+ if (g_Dbs.cfgDir[0])
+ taos_options(TSDB_OPTION_CONFIGDIR, g_Dbs.cfgDir);
+
insertTestProcess();
+
} else if (QUERY_TEST == g_args.test_mode) {
if (g_queryInfo.cfgDir[0])
taos_options(TSDB_OPTION_CONFIGDIR, g_queryInfo.cfgDir);
+
queryTestProcess();
+
} else if (SUBSCRIBE_TEST == g_args.test_mode) {
if (g_queryInfo.cfgDir[0])
taos_options(TSDB_OPTION_CONFIGDIR, g_queryInfo.cfgDir);
+
subscribeTestProcess();
+
} else {
;
}
@@ -6115,27 +6350,28 @@ static void queryResult() {
rInfo->ntables = g_Dbs.db[0].superTbls[0].childTblCount;
rInfo->end_table_to = g_Dbs.db[0].superTbls[0].childTblCount - 1;
rInfo->superTblInfo = &g_Dbs.db[0].superTbls[0];
- strcpy(rInfo->tb_prefix,
- g_Dbs.db[0].superTbls[0].childTblPrefix);
+ tstrncpy(rInfo->tb_prefix,
+ g_Dbs.db[0].superTbls[0].childTblPrefix, MAX_TB_NAME_SIZE);
} else {
rInfo->ntables = g_args.num_of_tables;
rInfo->end_table_to = g_args.num_of_tables -1;
- strcpy(rInfo->tb_prefix, g_args.tb_prefix);
+ tstrncpy(rInfo->tb_prefix, g_args.tb_prefix, MAX_TB_NAME_SIZE);
}
rInfo->taos = taos_connect(
- g_Dbs.host,
- g_Dbs.user,
- g_Dbs.password,
- g_Dbs.db[0].dbName,
+ g_Dbs.host,
+ g_Dbs.user,
+ g_Dbs.password,
+ g_Dbs.db[0].dbName,
g_Dbs.port);
if (rInfo->taos == NULL) {
- errorPrint( "Failed to connect to TDengine, reason:%s\n", taos_errstr(NULL));
+ errorPrint( "Failed to connect to TDengine, reason:%s\n",
+ taos_errstr(NULL));
free(rInfo);
exit(-1);
}
- strcpy(rInfo->fp, g_Dbs.resultFile);
+ tstrncpy(rInfo->fp, g_Dbs.resultFile, MAX_FILE_NAME_LEN);
if (!g_Dbs.use_metric) {
pthread_create(&read_id, NULL, readTable, rInfo);
@@ -6150,13 +6386,13 @@ static void queryResult() {
static void testCmdLine() {
- g_args.test_mode = INSERT_TEST;
- insertTestProcess();
+ g_args.test_mode = INSERT_TEST;
+ insertTestProcess();
- if (g_Dbs.insert_only)
- return;
- else
- queryResult();
+ if (g_Dbs.insert_only)
+ return;
+ else
+ queryResult();
}
int main(int argc, char *argv[]) {
@@ -6166,7 +6402,7 @@ int main(int argc, char *argv[]) {
if (g_args.metaFile) {
initOfInsertMeta();
- initOfQueryMeta();
+ initOfQueryMeta();
if (false == getInfoFromJsonFile(g_args.metaFile)) {
printf("Failed to read %s\n", g_args.metaFile);
@@ -6180,12 +6416,12 @@ int main(int argc, char *argv[]) {
if (NULL != g_args.sqlFile) {
TAOS* qtaos = taos_connect(
- g_Dbs.host,
- g_Dbs.user,
- g_Dbs.password,
- g_Dbs.db[0].dbName,
+ g_Dbs.host,
+ g_Dbs.user,
+ g_Dbs.password,
+ g_Dbs.db[0].dbName,
g_Dbs.port);
- querySqlFile(qtaos, g_args.sqlFile);
+ querySqlFile(qtaos, g_args.sqlFile);
taos_close(qtaos);
} else {
diff --git a/src/mnode/inc/mnodeVgroup.h b/src/mnode/inc/mnodeVgroup.h
index e052cdb83c..7b798c23f8 100644
--- a/src/mnode/inc/mnodeVgroup.h
+++ b/src/mnode/inc/mnodeVgroup.h
@@ -49,6 +49,7 @@ void mnodeRemoveTableFromVgroup(SVgObj *pVgroup, SCTableObj *pTable);
void mnodeSendDropVnodeMsg(int32_t vgId, SRpcEpSet *epSet, void *ahandle);
void mnodeSendCreateVgroupMsg(SVgObj *pVgroup, void *ahandle);
void mnodeSendAlterVgroupMsg(SVgObj *pVgroup);
+void mnodeSendSyncVgroupMsg(SVgObj *pVgroup);
SRpcEpSet mnodeGetEpSetFromVgroup(SVgObj *pVgroup);
SRpcEpSet mnodeGetEpSetFromIp(char *ep);
diff --git a/src/mnode/src/mnodeDb.c b/src/mnode/src/mnodeDb.c
index 2ca038a5a2..bf5b6f8c5c 100644
--- a/src/mnode/src/mnodeDb.c
+++ b/src/mnode/src/mnodeDb.c
@@ -50,7 +50,7 @@ static int32_t mnodeGetDbMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn
static int32_t mnodeRetrieveDbs(SShowObj *pShow, char *data, int32_t rows, void *pConn);
static int32_t mnodeProcessCreateDbMsg(SMnodeMsg *pMsg);
static int32_t mnodeProcessDropDbMsg(SMnodeMsg *pMsg);
-
+static int32_t mnodeProcessSyncDbMsg(SMnodeMsg *pMsg);
int32_t mnodeProcessAlterDbMsg(SMnodeMsg *pMsg);
#ifndef _TOPIC
@@ -179,6 +179,7 @@ int32_t mnodeInitDbs() {
mnodeAddWriteMsgHandle(TSDB_MSG_TYPE_CM_CREATE_DB, mnodeProcessCreateDbMsg);
mnodeAddWriteMsgHandle(TSDB_MSG_TYPE_CM_ALTER_DB, mnodeProcessAlterDbMsg);
mnodeAddWriteMsgHandle(TSDB_MSG_TYPE_CM_DROP_DB, mnodeProcessDropDbMsg);
+ mnodeAddWriteMsgHandle(TSDB_MSG_TYPE_CM_SYNC_DB, mnodeProcessSyncDbMsg);
mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_DB, mnodeGetDbMeta);
mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_DB, mnodeRetrieveDbs);
mnodeAddShowFreeIterHandle(TSDB_MGMT_TABLE_DB, mnodeCancelGetNextDb);
@@ -1188,6 +1189,46 @@ static int32_t mnodeProcessDropDbMsg(SMnodeMsg *pMsg) {
return mnodeDropDb(pMsg);
}
+static int32_t mnodeSyncDb(SDbObj *pDb, SMnodeMsg *pMsg) {
+ void *pIter = NULL;
+ SVgObj *pVgroup = NULL;
+ while (1) {
+ pIter = mnodeGetNextVgroup(pIter, &pVgroup);
+ if (pVgroup == NULL) break;
+ if (pVgroup->pDb == pDb) {
+ mnodeSendSyncVgroupMsg(pVgroup);
+ }
+ mnodeDecVgroupRef(pVgroup);
+ }
+
+ mLInfo("db:%s, is synced by %s", pDb->name, mnodeGetUserFromMsg(pMsg));
+
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t mnodeProcessSyncDbMsg(SMnodeMsg *pMsg) {
+ SSyncDbMsg *pSyncDb = pMsg->rpcMsg.pCont;
+ mDebug("db:%s, syncdb is received from thandle:%p, ignore:%d", pSyncDb->db, pMsg->rpcMsg.handle, pSyncDb->ignoreNotExists);
+
+ if (pMsg->pDb == NULL) pMsg->pDb = mnodeGetDb(pSyncDb->db);
+ if (pMsg->pDb == NULL) {
+ if (pSyncDb->ignoreNotExists) {
+ mDebug("db:%s, db is not exist, treat as success", pSyncDb->db);
+ return TSDB_CODE_SUCCESS;
+ } else {
+ mError("db:%s, failed to sync, invalid db", pSyncDb->db);
+ return TSDB_CODE_MND_INVALID_DB;
+ }
+ }
+
+ if (pMsg->pDb->status != TSDB_DB_STATUS_READY) {
+ mError("db:%s, status:%d, in dropping", pSyncDb->db, pMsg->pDb->status);
+ return TSDB_CODE_MND_DB_IN_DROPPING;
+ }
+
+ return mnodeSyncDb(pMsg->pDb, pMsg);
+}
+
void mnodeDropAllDbs(SAcctObj *pAcct) {
int32_t numOfDbs = 0;
SDbObj *pDb = NULL;
diff --git a/src/mnode/src/mnodeVgroup.c b/src/mnode/src/mnodeVgroup.c
index fdbf7ae398..7eb3122d83 100644
--- a/src/mnode/src/mnodeVgroup.c
+++ b/src/mnode/src/mnodeVgroup.c
@@ -60,6 +60,7 @@ static int32_t mnodeGetVgroupMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *p
static int32_t mnodeRetrieveVgroups(SShowObj *pShow, char *data, int32_t rows, void *pConn);
static void mnodeProcessCreateVnodeRsp(SRpcMsg *rpcMsg);
static void mnodeProcessAlterVnodeRsp(SRpcMsg *rpcMsg);
+static void mnodeProcessSyncVnodeRsp(SRpcMsg *rpcMsg);
static void mnodeProcessDropVnodeRsp(SRpcMsg *rpcMsg);
static int32_t mnodeProcessVnodeCfgMsg(SMnodeMsg *pMsg) ;
static void mnodeSendDropVgroupMsg(SVgObj *pVgroup, void *ahandle);
@@ -236,6 +237,7 @@ int32_t mnodeInitVgroups() {
mnodeAddShowFreeIterHandle(TSDB_MGMT_TABLE_VGROUP, mnodeCancelGetNextVgroup);
mnodeAddPeerRspHandle(TSDB_MSG_TYPE_MD_CREATE_VNODE_RSP, mnodeProcessCreateVnodeRsp);
mnodeAddPeerRspHandle(TSDB_MSG_TYPE_MD_ALTER_VNODE_RSP, mnodeProcessAlterVnodeRsp);
+ mnodeAddPeerRspHandle(TSDB_MSG_TYPE_MD_ALTER_VNODE_RSP, mnodeProcessSyncVnodeRsp);
mnodeAddPeerRspHandle(TSDB_MSG_TYPE_MD_DROP_VNODE_RSP, mnodeProcessDropVnodeRsp);
mnodeAddPeerMsgHandle(TSDB_MSG_TYPE_DM_CONFIG_VNODE, mnodeProcessVnodeCfgMsg);
@@ -967,6 +969,38 @@ void mnodeSendAlterVgroupMsg(SVgObj *pVgroup) {
}
}
+static SSyncVnodeMsg *mnodeBuildSyncVnodeMsg(int32_t vgId) {
+ SSyncVnodeMsg *pSyncVnode = rpcMallocCont(sizeof(SSyncVnodeMsg));
+ if (pSyncVnode == NULL) return NULL;
+
+ pSyncVnode->vgId = htonl(vgId);
+ return pSyncVnode;
+}
+
+static void mnodeSendSyncVnodeMsg(SVgObj *pVgroup, SRpcEpSet *epSet) {
+ SSyncVnodeMsg *pSyncVnode = mnodeBuildSyncVnodeMsg(pVgroup->vgId);
+ SRpcMsg rpcMsg = {
+ .ahandle = NULL,
+ .pCont = pSyncVnode,
+ .contLen = pSyncVnode ? sizeof(SSyncVnodeMsg) : 0,
+ .code = 0,
+ .msgType = TSDB_MSG_TYPE_MD_SYNC_VNODE
+ };
+
+ dnodeSendMsgToDnode(epSet, &rpcMsg);
+}
+
+void mnodeSendSyncVgroupMsg(SVgObj *pVgroup) {
+ mDebug("vgId:%d, send sync all vnodes msg, numOfVnodes:%d db:%s", pVgroup->vgId, pVgroup->numOfVnodes,
+ pVgroup->dbName);
+ for (int32_t i = 0; i < pVgroup->numOfVnodes; ++i) {
+ SRpcEpSet epSet = mnodeGetEpSetFromIp(pVgroup->vnodeGid[i].pDnode->dnodeEp);
+ mDebug("vgId:%d, index:%d, send sync vnode msg to dnode %s", pVgroup->vgId, i,
+ pVgroup->vnodeGid[i].pDnode->dnodeEp);
+ mnodeSendSyncVnodeMsg(pVgroup, &epSet);
+ }
+}
+
static void mnodeSendCreateVnodeMsg(SVgObj *pVgroup, SRpcEpSet *epSet, void *ahandle) {
SCreateVnodeMsg *pCreate = mnodeBuildVnodeMsg(pVgroup);
SRpcMsg rpcMsg = {
@@ -994,6 +1028,10 @@ static void mnodeProcessAlterVnodeRsp(SRpcMsg *rpcMsg) {
mDebug("alter vnode rsp received");
}
+static void mnodeProcessSyncVnodeRsp(SRpcMsg *rpcMsg) {
+ mDebug("sync vnode rsp received");
+}
+
static void mnodeProcessCreateVnodeRsp(SRpcMsg *rpcMsg) {
if (rpcMsg->ahandle == NULL) return;
diff --git a/src/query/inc/qResultbuf.h b/src/query/inc/qResultbuf.h
index e46af8c298..ef43a9621a 100644
--- a/src/query/inc/qResultbuf.h
+++ b/src/query/inc/qResultbuf.h
@@ -72,7 +72,7 @@ typedef struct SDiskbasedResultBuf {
bool comp; // compressed before flushed to disk
int32_t nextPos; // next page flush position
- const void* handle; // for debug purpose
+ uint64_t qId; // for debug purpose
SResultBufStatis statis;
} SDiskbasedResultBuf;
@@ -88,7 +88,7 @@ typedef struct SDiskbasedResultBuf {
* @param handle
* @return
*/
-int32_t createDiskbasedResultBuffer(SDiskbasedResultBuf** pResultBuf, int32_t pagesize, int32_t inMemBufSize, const void* handle);
+int32_t createDiskbasedResultBuffer(SDiskbasedResultBuf** pResultBuf, int32_t pagesize, int32_t inMemBufSize, uint64_t qId);
/**
*
diff --git a/src/query/inc/qUtil.h b/src/query/inc/qUtil.h
index 31dfc350a3..cdd8b0707a 100644
--- a/src/query/inc/qUtil.h
+++ b/src/query/inc/qUtil.h
@@ -25,6 +25,7 @@
} while (0)
#define GET_RES_WINDOW_KEY_LEN(_l) ((_l) + sizeof(uint64_t))
+#define GET_QID(_r) (((SQInfo*)((_r)->qinfo))->qId)
#define curTimeWindowIndex(_winres) ((_winres)->curIndex)
#define GET_ROW_PARAM_FOR_MULTIOUTPUT(_q, tbq, sq) (((tbq) && (!(sq)))? (_q)->pExpr1[1].base.arg->argValue.i64:1)
diff --git a/src/query/inc/sql.y b/src/query/inc/sql.y
index 71ca1f2970..7991a50255 100644
--- a/src/query/inc/sql.y
+++ b/src/query/inc/sql.y
@@ -730,6 +730,9 @@ expritem(A) ::= . {A = 0;}
///////////////////////////////////reset query cache//////////////////////////////////////
cmd ::= RESET QUERY CACHE. { setDCLSqlElems(pInfo, TSDB_SQL_RESET_CACHE, 0);}
+///////////////////////////////////sync replica database//////////////////////////////////
+cmd ::= SYNCDB ids(X) REPLICA.{ setDCLSqlElems(pInfo, TSDB_SQL_SYNC_DB_REPLICA, 1, &X);}
+
///////////////////////////////////ALTER TABLE statement//////////////////////////////////
cmd ::= ALTER TABLE ids(X) cpxName(F) ADD COLUMN columnlist(A). {
X.n += F.n;
diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c
index b80559c74d..44039ab428 100644
--- a/src/query/src/qExecutor.c
+++ b/src/query/src/qExecutor.c
@@ -1364,7 +1364,7 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SGroupbyOperatorInfo *pIn
int16_t type = pColInfoData->info.type;
if (type == TSDB_DATA_TYPE_FLOAT || type == TSDB_DATA_TYPE_DOUBLE) {
- qError("QInfo:%p group by not supported on double/float columns, abort", pRuntimeEnv->qinfo);
+ qError("QInfo:%"PRIu64" group by not supported on double/float columns, abort", GET_QID(pRuntimeEnv));
return;
}
@@ -1749,7 +1749,7 @@ static void* destroySQLFunctionCtx(SQLFunctionCtx* pCtx, int32_t numOfOutput) {
}
static int32_t setupQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv, int32_t numOfTables) {
- qDebug("QInfo:%p setup runtime env", pRuntimeEnv->qinfo);
+ qDebug("QInfo:%"PRIu64" setup runtime env", GET_QID(pRuntimeEnv));
SQuery *pQuery = pRuntimeEnv->pQuery;
pRuntimeEnv->prevGroupId = INT32_MIN;
@@ -1782,7 +1782,7 @@ static int32_t setupQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv, int32_t numOf
*(int64_t*) pRuntimeEnv->prevRow[0] = INT64_MIN;
}
- qDebug("QInfo:%p init runtime environment completed", pRuntimeEnv->qinfo);
+ qDebug("QInfo:%"PRIu64" init runtime environment completed", GET_QID(pRuntimeEnv));
// group by normal column, sliding window query, interval query are handled by interval query processor
// interval (down sampling operation)
@@ -1886,7 +1886,7 @@ static void teardownQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv) {
SQuery *pQuery = pRuntimeEnv->pQuery;
SQInfo* pQInfo = (SQInfo*) pRuntimeEnv->qinfo;
- qDebug("QInfo:%p teardown runtime env", pQInfo);
+ qDebug("QInfo:%"PRIu64" teardown runtime env", pQInfo->qId);
if (pRuntimeEnv->sasArray != NULL) {
for(int32_t i = 0; i < pQuery->numOfOutput; ++i) {
@@ -1936,8 +1936,8 @@ bool isQueryKilled(SQInfo *pQInfo) {
(!needBuildResAfterQueryComplete(pQInfo))) {
assert(pQInfo->startExecTs != 0);
- qDebug("QInfo:%p retrieve not arrive beyond %d sec, abort current query execution, start:%"PRId64", current:%d", pQInfo, 1,
- pQInfo->startExecTs, taosGetTimestampSec());
+ qDebug("QInfo:%" PRIu64 " retrieve not arrive beyond %d sec, abort current query execution, start:%" PRId64
+ ", current:%d", pQInfo->qId, 1, pQInfo->startExecTs, taosGetTimestampSec());
return true;
}
@@ -2113,11 +2113,11 @@ static void setScanLimitationByResultBuffer(SQuery *pQuery) {
/*
* todo add more parameters to check soon..
*/
-bool colIdCheck(SQuery *pQuery, void* qinfo) {
+bool colIdCheck(SQuery *pQuery, uint64_t qId) {
// load data column information is incorrect
for (int32_t i = 0; i < pQuery->numOfCols - 1; ++i) {
if (pQuery->colList[i].colId == pQuery->colList[i + 1].colId) {
- qError("QInfo:%p invalid data load column for query", qinfo);
+ qError("QInfo:%"PRIu64" invalid data load column for query", qId);
return false;
}
}
@@ -2170,13 +2170,13 @@ static void changeExecuteScanOrder(SQInfo *pQInfo, SQueryTableMsg* pQueryMsg, bo
SQuery* pQuery = pQInfo->runtimeEnv.pQuery;
// in case of point-interpolation query, use asc order scan
- char msg[] = "QInfo:%p scan order changed for %s query, old:%d, new:%d, qrange exchanged, old qrange:%" PRId64
+ char msg[] = "QInfo:%"PRIu64" scan order changed for %s query, old:%d, new:%d, qrange exchanged, old qrange:%" PRId64
"-%" PRId64 ", new qrange:%" PRId64 "-%" PRId64;
// todo handle the case the the order irrelevant query type mixed up with order critical query type
// descending order query for last_row query
if (isFirstLastRowQuery(pQuery)) {
- qDebug("QInfo:%p scan order changed for last_row query, old:%d, new:%d", pQInfo, pQuery->order.order, TSDB_ORDER_ASC);
+ qDebug("QInfo:%"PRIu64" scan order changed for last_row query, old:%d, new:%d", pQInfo->qId, pQuery->order.order, TSDB_ORDER_ASC);
pQuery->order.order = TSDB_ORDER_ASC;
if (pQuery->window.skey > pQuery->window.ekey) {
@@ -2198,7 +2198,7 @@ static void changeExecuteScanOrder(SQInfo *pQInfo, SQueryTableMsg* pQueryMsg, bo
if (isPointInterpoQuery(pQuery) && pQuery->interval.interval == 0) {
if (!QUERY_IS_ASC_QUERY(pQuery)) {
- qDebug(msg, pQInfo, "interp", pQuery->order.order, TSDB_ORDER_ASC, pQuery->window.skey, pQuery->window.ekey, pQuery->window.ekey, pQuery->window.skey);
+ qDebug(msg, pQInfo->qId, "interp", pQuery->order.order, TSDB_ORDER_ASC, pQuery->window.skey, pQuery->window.ekey, pQuery->window.ekey, pQuery->window.skey);
SWAP(pQuery->window.skey, pQuery->window.ekey, TSKEY);
}
@@ -2209,7 +2209,7 @@ static void changeExecuteScanOrder(SQInfo *pQInfo, SQueryTableMsg* pQueryMsg, bo
if (pQuery->interval.interval == 0) {
if (onlyFirstQuery(pQuery)) {
if (!QUERY_IS_ASC_QUERY(pQuery)) {
- qDebug(msg, pQInfo, "only-first", pQuery->order.order, TSDB_ORDER_ASC, pQuery->window.skey,
+ qDebug(msg, pQInfo->qId, "only-first", pQuery->order.order, TSDB_ORDER_ASC, pQuery->window.skey,
pQuery->window.ekey, pQuery->window.ekey, pQuery->window.skey);
SWAP(pQuery->window.skey, pQuery->window.ekey, TSKEY);
@@ -2219,7 +2219,7 @@ static void changeExecuteScanOrder(SQInfo *pQInfo, SQueryTableMsg* pQueryMsg, bo
pQuery->order.order = TSDB_ORDER_ASC;
} else if (onlyLastQuery(pQuery)) {
if (QUERY_IS_ASC_QUERY(pQuery)) {
- qDebug(msg, pQInfo, "only-last", pQuery->order.order, TSDB_ORDER_DESC, pQuery->window.skey,
+ qDebug(msg, pQInfo->qId, "only-last", pQuery->order.order, TSDB_ORDER_DESC, pQuery->window.skey,
pQuery->window.ekey, pQuery->window.ekey, pQuery->window.skey);
SWAP(pQuery->window.skey, pQuery->window.ekey, TSKEY);
@@ -2233,7 +2233,7 @@ static void changeExecuteScanOrder(SQInfo *pQInfo, SQueryTableMsg* pQueryMsg, bo
if (stableQuery) {
if (onlyFirstQuery(pQuery)) {
if (!QUERY_IS_ASC_QUERY(pQuery)) {
- qDebug(msg, pQInfo, "only-first stable", pQuery->order.order, TSDB_ORDER_ASC,
+ qDebug(msg, pQInfo->qId, "only-first stable", pQuery->order.order, TSDB_ORDER_ASC,
pQuery->window.skey, pQuery->window.ekey, pQuery->window.ekey, pQuery->window.skey);
SWAP(pQuery->window.skey, pQuery->window.ekey, TSKEY);
@@ -2243,7 +2243,7 @@ static void changeExecuteScanOrder(SQInfo *pQInfo, SQueryTableMsg* pQueryMsg, bo
pQuery->order.order = TSDB_ORDER_ASC;
} else if (onlyLastQuery(pQuery)) {
if (QUERY_IS_ASC_QUERY(pQuery)) {
- qDebug(msg, pQInfo, "only-last stable", pQuery->order.order, TSDB_ORDER_DESC,
+ qDebug(msg, pQInfo->qId, "only-last stable", pQuery->order.order, TSDB_ORDER_DESC,
pQuery->window.skey, pQuery->window.ekey, pQuery->window.ekey, pQuery->window.skey);
SWAP(pQuery->window.skey, pQuery->window.ekey, TSKEY);
@@ -2656,7 +2656,7 @@ int32_t loadDataBlockOnDemand(SQueryRuntimeEnv* pRuntimeEnv, STableScanInfo* pTa
SDataBlockInfo* pBlockInfo = &pBlock->info;
if ((*status) == BLK_DATA_NO_NEEDED) {
- qDebug("QInfo:%p data block discard, brange:%" PRId64 "-%" PRId64 ", rows:%d", pQInfo, pBlockInfo->window.skey,
+ qDebug("QInfo:%"PRIu64" data block discard, brange:%" PRId64 "-%" PRId64 ", rows:%d", pQInfo->qId, pBlockInfo->window.skey,
pBlockInfo->window.ekey, pBlockInfo->rows);
pCost->discardBlocks += 1;
} else if ((*status) == BLK_DATA_STATIS_NEEDED) {
@@ -2684,7 +2684,7 @@ int32_t loadDataBlockOnDemand(SQueryRuntimeEnv* pRuntimeEnv, STableScanInfo* pTa
(char*)&(pBlock->pBlockStatis[i].max));
if (!load) { // current block has been discard due to filter applied
pCost->discardBlocks += 1;
- qDebug("QInfo:%p data block discard, brange:%" PRId64 "-%" PRId64 ", rows:%d", pQInfo,
+ qDebug("QInfo:%"PRIu64" data block discard, brange:%" PRId64 "-%" PRId64 ", rows:%d", pQInfo->qId,
pBlockInfo->window.skey, pBlockInfo->window.ekey, pBlockInfo->rows);
(*status) = BLK_DATA_DISCARD;
return TSDB_CODE_SUCCESS;
@@ -2696,7 +2696,7 @@ int32_t loadDataBlockOnDemand(SQueryRuntimeEnv* pRuntimeEnv, STableScanInfo* pTa
// current block has been discard due to filter applied
if (!doFilterByBlockStatistics(pRuntimeEnv, pBlock->pBlockStatis, pTableScanInfo->pCtx, pBlockInfo->rows)) {
pCost->discardBlocks += 1;
- qDebug("QInfo:%p data block discard, brange:%" PRId64 "-%" PRId64 ", rows:%d", pQInfo, pBlockInfo->window.skey,
+ qDebug("QInfo:%"PRIu64" data block discard, brange:%" PRId64 "-%" PRId64 ", rows:%d", pQInfo->qId, pBlockInfo->window.skey,
pBlockInfo->window.ekey, pBlockInfo->rows);
(*status) = BLK_DATA_DISCARD;
return TSDB_CODE_SUCCESS;
@@ -3400,10 +3400,10 @@ void setCtxTagForJoin(SQueryRuntimeEnv* pRuntimeEnv, SQLFunctionCtx* pCtx, SExpr
int16_t tagType = pCtx[0].tag.nType;
if (tagType == TSDB_DATA_TYPE_BINARY || tagType == TSDB_DATA_TYPE_NCHAR) {
- qDebug("QInfo:%p set tag value for join comparison, colId:%" PRId64 ", val:%s", pRuntimeEnv->qinfo,
+ qDebug("QInfo:%"PRIu64" set tag value for join comparison, colId:%" PRId64 ", val:%s", GET_QID(pRuntimeEnv),
pExprInfo->base.arg->argValue.i64, pCtx[0].tag.pz);
} else {
- qDebug("QInfo:%p set tag value for join comparison, colId:%" PRId64 ", val:%" PRId64, pRuntimeEnv->qinfo,
+ qDebug("QInfo:%"PRIu64" set tag value for join comparison, colId:%" PRId64 ", val:%" PRId64, GET_QID(pRuntimeEnv),
pExprInfo->base.arg->argValue.i64, pCtx[0].tag.i64);
}
}
@@ -3423,9 +3423,9 @@ int32_t setTimestampListJoinInfo(SQueryRuntimeEnv* pRuntimeEnv, tVariant* pTag,
// failed to find data with the specified tag value and vnodeId
if (!tsBufIsValidElem(&elem)) {
if (pTag->nType == TSDB_DATA_TYPE_BINARY || pTag->nType == TSDB_DATA_TYPE_NCHAR) {
- qError("QInfo:%p failed to find tag:%s in ts_comp", pRuntimeEnv->qinfo, pTag->pz);
+ qError("QInfo:%"PRIu64" failed to find tag:%s in ts_comp", GET_QID(pRuntimeEnv), pTag->pz);
} else {
- qError("QInfo:%p failed to find tag:%" PRId64 " in ts_comp", pRuntimeEnv->qinfo, pTag->i64);
+ qError("QInfo:%"PRIu64" failed to find tag:%" PRId64 " in ts_comp", GET_QID(pRuntimeEnv), pTag->i64);
}
return -1;
@@ -3434,17 +3434,17 @@ int32_t setTimestampListJoinInfo(SQueryRuntimeEnv* pRuntimeEnv, tVariant* pTag,
// Keep the cursor info of current table
pTableQueryInfo->cur = tsBufGetCursor(pRuntimeEnv->pTsBuf);
if (pTag->nType == TSDB_DATA_TYPE_BINARY || pTag->nType == TSDB_DATA_TYPE_NCHAR) {
- qDebug("QInfo:%p find tag:%s start pos in ts_comp, blockIndex:%d, tsIndex:%d", pRuntimeEnv->qinfo, pTag->pz, pTableQueryInfo->cur.blockIndex, pTableQueryInfo->cur.tsIndex);
+ qDebug("QInfo:%"PRIu64" find tag:%s start pos in ts_comp, blockIndex:%d, tsIndex:%d", GET_QID(pRuntimeEnv), pTag->pz, pTableQueryInfo->cur.blockIndex, pTableQueryInfo->cur.tsIndex);
} else {
- qDebug("QInfo:%p find tag:%"PRId64" start pos in ts_comp, blockIndex:%d, tsIndex:%d", pRuntimeEnv->qinfo, pTag->i64, pTableQueryInfo->cur.blockIndex, pTableQueryInfo->cur.tsIndex);
+ qDebug("QInfo:%"PRIu64" find tag:%"PRId64" start pos in ts_comp, blockIndex:%d, tsIndex:%d", GET_QID(pRuntimeEnv), pTag->i64, pTableQueryInfo->cur.blockIndex, pTableQueryInfo->cur.tsIndex);
}
} else {
tsBufSetCursor(pRuntimeEnv->pTsBuf, &pTableQueryInfo->cur);
if (pTag->nType == TSDB_DATA_TYPE_BINARY || pTag->nType == TSDB_DATA_TYPE_NCHAR) {
- qDebug("QInfo:%p find tag:%s start pos in ts_comp, blockIndex:%d, tsIndex:%d", pRuntimeEnv->qinfo, pTag->pz, pTableQueryInfo->cur.blockIndex, pTableQueryInfo->cur.tsIndex);
+ qDebug("QInfo:%"PRIu64" find tag:%s start pos in ts_comp, blockIndex:%d, tsIndex:%d", GET_QID(pRuntimeEnv), pTag->pz, pTableQueryInfo->cur.blockIndex, pTableQueryInfo->cur.tsIndex);
} else {
- qDebug("QInfo:%p find tag:%"PRId64" start pos in ts_comp, blockIndex:%d, tsIndex:%d", pRuntimeEnv->qinfo, pTag->i64, pTableQueryInfo->cur.blockIndex, pTableQueryInfo->cur.tsIndex);
+ qDebug("QInfo:%"PRIu64" find tag:%"PRId64" start pos in ts_comp, blockIndex:%d, tsIndex:%d", GET_QID(pRuntimeEnv), pTag->i64, pTableQueryInfo->cur.blockIndex, pTableQueryInfo->cur.tsIndex);
}
}
@@ -3548,7 +3548,7 @@ static int32_t doCopyToSDataBlock(SQueryRuntimeEnv* pRuntimeEnv, SGroupResInfo*
int32_t start = 0;
int32_t step = -1;
- qDebug("QInfo:%p start to copy data from windowResInfo to output buf", pRuntimeEnv->qinfo);
+ qDebug("QInfo:%"PRIu64" start to copy data from windowResInfo to output buf", GET_QID(pRuntimeEnv));
if (orderType == TSDB_ORDER_ASC) {
start = pGroupResInfo->index;
step = 1;
@@ -3588,7 +3588,7 @@ static int32_t doCopyToSDataBlock(SQueryRuntimeEnv* pRuntimeEnv, SGroupResInfo*
}
}
- qDebug("QInfo:%p copy data to query buf completed", pRuntimeEnv->qinfo);
+ qDebug("QInfo:%"PRIu64" copy data to query buf completed", GET_QID(pRuntimeEnv));
pBlock->info.rows = numOfResult;
return 0;
}
@@ -3674,11 +3674,11 @@ static void doCopyQueryResultToMsg(SQInfo *pQInfo, int32_t numOfRows, char *data
data += sizeof(STableIdInfo);
total++;
- qDebug("QInfo:%p set subscribe info, tid:%d, uid:%"PRIu64", skey:%"PRId64, pQInfo, item->tid, item->uid, item->key);
+ qDebug("QInfo:%"PRIu64" set subscribe info, tid:%d, uid:%"PRIu64", skey:%"PRId64, pQInfo->qId, item->tid, item->uid, item->key);
item = taosHashIterate(pRuntimeEnv->pTableRetrieveTsMap, item);
}
- qDebug("QInfo:%p set %d subscribe info", pQInfo, total);
+ qDebug("QInfo:%"PRIu64" set %d subscribe info", pQInfo->qId, total);
// Check if query is completed or not for stable query or normal table query respectively.
if (Q_STATUS_EQUAL(pRuntimeEnv->status, QUERY_COMPLETED) && pRuntimeEnv->proot->status == OP_EXEC_DONE) {
setQueryStatus(pRuntimeEnv, QUERY_OVER);
@@ -3717,12 +3717,12 @@ void queryCostStatis(SQInfo *pQInfo) {
pSummary->numOfTimeWindows = 0;
}
- qDebug("QInfo:%p :cost summary: elapsed time:%"PRId64" us, first merge:%"PRId64" us, total blocks:%d, "
+ qDebug("QInfo:%"PRIu64" :cost summary: elapsed time:%"PRId64" us, first merge:%"PRId64" us, total blocks:%d, "
"load block statis:%d, load data block:%d, total rows:%"PRId64 ", check rows:%"PRId64,
- pQInfo, pSummary->elapsedTime, pSummary->firstStageMergeTime, pSummary->totalBlocks, pSummary->loadBlockStatis,
+ pQInfo->qId, pSummary->elapsedTime, pSummary->firstStageMergeTime, pSummary->totalBlocks, pSummary->loadBlockStatis,
pSummary->loadBlocks, pSummary->totalRows, pSummary->totalCheckedRows);
- qDebug("QInfo:%p :cost summary: winResPool size:%.2f Kb, numOfWin:%"PRId64", tableInfoSize:%.2f Kb, hashTable:%.2f Kb", pQInfo, pSummary->winInfoSize/1024.0,
+ qDebug("QInfo:%"PRIu64" :cost summary: winResPool size:%.2f Kb, numOfWin:%"PRId64", tableInfoSize:%.2f Kb, hashTable:%.2f Kb", pQInfo->qId, pSummary->winInfoSize/1024.0,
pSummary->numOfTimeWindows, pSummary->tableInfoSize/1024.0, pSummary->hashSize/1024.0);
}
@@ -3758,7 +3758,7 @@ void queryCostStatis(SQInfo *pQInfo) {
//
// int32_t numOfRes = tableApplyFunctionsOnBlock(pRuntimeEnv, pBlockInfo, NULL, binarySearchForKey, pDataBlock);
//
-// qDebug("QInfo:%p check data block, brange:%" PRId64 "-%" PRId64 ", numOfRows:%d, numOfRes:%d, lastKey:%"PRId64, pRuntimeEnv->qinfo,
+// qDebug("QInfo:%"PRIu64" check data block, brange:%" PRId64 "-%" PRId64 ", numOfRows:%d, numOfRes:%d, lastKey:%"PRId64, GET_QID(pRuntimeEnv),
// pBlockInfo->window.skey, pBlockInfo->window.ekey, pBlockInfo->rows, numOfRes, pQuery->current->lastKey);
//}
@@ -3788,7 +3788,7 @@ void queryCostStatis(SQInfo *pQInfo) {
// pTableQueryInfo->lastKey = (QUERY_IS_ASC_QUERY(pQuery)) ? blockInfo.window.ekey : blockInfo.window.skey;
// pTableQueryInfo->lastKey += step;
//
-// qDebug("QInfo:%p skip rows:%d, offset:%" PRId64, pRuntimeEnv->qinfo, blockInfo.rows,
+// qDebug("QInfo:%"PRIu64" skip rows:%d, offset:%" PRId64, GET_QID(pRuntimeEnv), blockInfo.rows,
// pQuery->limit.offset);
// } else { // find the appropriated start position in current block
// updateOffsetVal(pRuntimeEnv, &blockInfo);
@@ -3836,8 +3836,8 @@ void queryCostStatis(SQInfo *pQInfo) {
// int32_t numOfRes = tableApplyFunctionsOnBlock(pRuntimeEnv, pBlockInfo, NULL, binarySearchForKey, pDataBlock);
// pRuntimeEnv->resultRowInfo.curIndex = index; // restore the window index
//
-// qDebug("QInfo:%p check data block, brange:%" PRId64 "-%" PRId64 ", numOfRows:%d, numOfRes:%d, lastKey:%" PRId64,
-// pRuntimeEnv->qinfo, pBlockInfo->window.skey, pBlockInfo->window.ekey, pBlockInfo->rows, numOfRes,
+// qDebug("QInfo:%"PRIu64" check data block, brange:%" PRId64 "-%" PRId64 ", numOfRows:%d, numOfRes:%d, lastKey:%" PRId64,
+// GET_QID(pRuntimeEnv), pBlockInfo->window.skey, pBlockInfo->window.ekey, pBlockInfo->rows, numOfRes,
// pQuery->current->lastKey);
//
// return key;
@@ -3992,7 +3992,7 @@ static int32_t setupQueryHandle(void* tsdb, SQInfo* pQInfo, bool isSTableQuery)
terrno = TSDB_CODE_SUCCESS;
if (isFirstLastRowQuery(pQuery)) {
- pRuntimeEnv->pQueryHandle = tsdbQueryLastRow(tsdb, &cond, &pQuery->tableGroupInfo, pQInfo, &pQuery->memRef);
+ pRuntimeEnv->pQueryHandle = tsdbQueryLastRow(tsdb, &cond, &pQuery->tableGroupInfo, pQInfo->qId, &pQuery->memRef);
// update the query time window
pQuery->window = cond.twindow;
@@ -4013,9 +4013,9 @@ static int32_t setupQueryHandle(void* tsdb, SQInfo* pQInfo, bool isSTableQuery)
}
}
} else if (isPointInterpoQuery(pQuery)) {
- pRuntimeEnv->pQueryHandle = tsdbQueryRowsInExternalWindow(tsdb, &cond, &pQuery->tableGroupInfo, pQInfo, &pQuery->memRef);
+ pRuntimeEnv->pQueryHandle = tsdbQueryRowsInExternalWindow(tsdb, &cond, &pQuery->tableGroupInfo, pQInfo->qId, &pQuery->memRef);
} else {
- pRuntimeEnv->pQueryHandle = tsdbQueryTables(tsdb, &cond, &pQuery->tableGroupInfo, pQInfo, &pQuery->memRef);
+ pRuntimeEnv->pQueryHandle = tsdbQueryTables(tsdb, &cond, &pQuery->tableGroupInfo, pQInfo->qId, &pQuery->memRef);
}
return terrno;
@@ -4058,7 +4058,6 @@ int32_t doInitQInfo(SQInfo *pQInfo, STSBuf *pTsBuf, SArray* prevResult, void *ts
pQuery->stabledev = isStabledev(pQuery);
pRuntimeEnv->prevResult = prevResult;
- pRuntimeEnv->qinfo = pQInfo;
setScanLimitationByResultBuffer(pQuery);
@@ -4102,7 +4101,7 @@ int32_t doInitQInfo(SQInfo *pQInfo, STSBuf *pTsBuf, SArray* prevResult, void *ts
getIntermediateBufInfo(pRuntimeEnv, &ps, &pQuery->intermediateResultRowSize);
int32_t TENMB = 1024*1024*10;
- code = createDiskbasedResultBuffer(&pRuntimeEnv->pResultBuf, ps, TENMB, pQInfo);
+ code = createDiskbasedResultBuffer(&pRuntimeEnv->pResultBuf, ps, TENMB, pQInfo->qId);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
@@ -4270,8 +4269,8 @@ static SSDataBlock* doTableScan(void* param) {
pResultRowInfo->prevSKey = pResultRowInfo->pResult[0]->win.skey;
}
- qDebug("QInfo:%p start to repeat scan data blocks due to query func required, qrange:%" PRId64 "-%" PRId64,
- pRuntimeEnv->qinfo, cond.twindow.skey, cond.twindow.ekey);
+ qDebug("QInfo:%"PRIu64" start to repeat scan data blocks due to query func required, qrange:%" PRId64 "-%" PRId64,
+ GET_QID(pRuntimeEnv), cond.twindow.skey, cond.twindow.ekey);
}
if (pTableScanInfo->reverseTimes > 0) {
@@ -4280,8 +4279,8 @@ static SSDataBlock* doTableScan(void* param) {
STsdbQueryCond cond = createTsdbQueryCond(pQuery, &pQuery->window);
tsdbResetQueryHandle(pTableScanInfo->pQueryHandle, &cond);
- qDebug("QInfo:%p start to reverse scan data blocks due to query func required, qrange:%" PRId64 "-%" PRId64,
- pRuntimeEnv->qinfo, cond.twindow.skey, cond.twindow.ekey);
+ qDebug("QInfo:%"PRIu64" start to reverse scan data blocks due to query func required, qrange:%" PRId64 "-%" PRId64,
+ GET_QID(pRuntimeEnv), cond.twindow.skey, cond.twindow.ekey);
pRuntimeEnv->scanFlag = REVERSE_SCAN;
@@ -5350,14 +5349,14 @@ static SSDataBlock* doTagScan(void* param) {
count += 1;
}
- qDebug("QInfo:%p create (tableId, tag) info completed, rows:%d", pRuntimeEnv->qinfo, count);
+ qDebug("QInfo:%"PRIu64" create (tableId, tag) info completed, rows:%d", GET_QID(pRuntimeEnv), count);
} else if (functionId == TSDB_FUNC_COUNT) {// handle the "count(tbname)" query
SColumnInfoData* pColInfo = taosArrayGet(pRes->pDataBlock, 0);
*(int64_t*)pColInfo->pData = pInfo->totalTables;
count = 1;
pOperator->status = OP_EXEC_DONE;
- qDebug("QInfo:%p create count(tbname) query, res:%d rows:1", pRuntimeEnv->qinfo, count);
+ qDebug("QInfo:%"PRIu64" create count(tbname) query, res:%d rows:1", GET_QID(pRuntimeEnv), count);
} else { // return only the tags|table name etc.
SExprInfo* pExprInfo = pOperator->pExpr; // todo use the column list instead of exprinfo
@@ -5396,7 +5395,7 @@ static SSDataBlock* doTagScan(void* param) {
pOperator->status = OP_EXEC_DONE;
}
- qDebug("QInfo:%p create tag values results completed, rows:%d", pRuntimeEnv->qinfo, count);
+ qDebug("QInfo:%"PRIu64" create tag values results completed, rows:%d", GET_QID(pRuntimeEnv), count);
}
pRes->info.rows = count;
@@ -6209,7 +6208,7 @@ SSqlGroupbyExpr *createGroupbyExprFromMsg(SQueryTableMsg *pQueryMsg, SColIndex *
return pGroupbyExpr;
}
-static int32_t createFilterInfo(void *pQInfo, SQuery *pQuery) {
+static int32_t createFilterInfo(SQuery *pQuery, uint64_t qId) {
for (int32_t i = 0; i < pQuery->numOfCols; ++i) {
if (pQuery->colList[i].numOfFilters > 0) {
pQuery->numOfFilterCols++;
@@ -6245,13 +6244,13 @@ static int32_t createFilterInfo(void *pQInfo, SQuery *pQuery) {
int32_t lower = pSingleColFilter->filterInfo.lowerRelOptr;
int32_t upper = pSingleColFilter->filterInfo.upperRelOptr;
if (lower == TSDB_RELATION_INVALID && upper == TSDB_RELATION_INVALID) {
- qError("QInfo:%p invalid filter info", pQInfo);
+ qError("QInfo:%"PRIu64" invalid filter info", qId);
return TSDB_CODE_QRY_INVALID_MSG;
}
pSingleColFilter->fp = getFilterOperator(lower, upper);
if (pSingleColFilter->fp == NULL) {
- qError("QInfo:%p invalid filter info", pQInfo);
+ qError("QInfo:%"PRIu64" invalid filter info", qId);
return TSDB_CODE_QRY_INVALID_MSG;
}
@@ -6411,7 +6410,7 @@ SQInfo* createQInfoImpl(SQueryTableMsg* pQueryMsg, SSqlGroupbyExpr* pGroupbyExpr
}
doUpdateExprColumnIndex(pQuery);
- int32_t ret = createFilterInfo(pQInfo, pQuery);
+ int32_t ret = createFilterInfo(pQuery, pQInfo->qId);
if (ret != TSDB_CODE_SUCCESS) {
goto _cleanup;
}
@@ -6486,7 +6485,7 @@ SQInfo* createQInfoImpl(SQueryTableMsg* pQueryMsg, SSqlGroupbyExpr* pGroupbyExpr
}
}
- colIdCheck(pQuery, pQInfo);
+ colIdCheck(pQuery, pQInfo->qId);
// todo refactor
pQInfo->query.queryBlockDist = (numOfOutput == 1 && pExprs[0].base.colInfo.colId == TSDB_BLOCK_DIST_COLUMN_INDEX);
@@ -6538,7 +6537,9 @@ int32_t initQInfo(SQueryTableMsg *pQueryMsg, void *tsdb, int32_t vgId, SQInfo *p
int32_t code = TSDB_CODE_SUCCESS;
SQueryRuntimeEnv* pRuntimeEnv = &pQInfo->runtimeEnv;
- SQuery *pQuery = pQInfo->runtimeEnv.pQuery;
+ pRuntimeEnv->qinfo = pQInfo;
+
+ SQuery *pQuery = pRuntimeEnv->pQuery;
STSBuf *pTsBuf = NULL;
if (pQueryMsg->tsLen > 0) { // open new file to save the result
@@ -6560,7 +6561,7 @@ int32_t initQInfo(SQueryTableMsg *pQueryMsg, void *tsdb, int32_t vgId, SQInfo *p
if ((QUERY_IS_ASC_QUERY(pQuery) && (pQuery->window.skey > pQuery->window.ekey)) ||
(!QUERY_IS_ASC_QUERY(pQuery) && (pQuery->window.ekey > pQuery->window.skey))) {
- qDebug("QInfo:%p no result in time range %" PRId64 "-%" PRId64 ", order %d", pQInfo, pQuery->window.skey,
+ qDebug("QInfo:%"PRIu64" no result in time range %" PRId64 "-%" PRId64 ", order %d", pQInfo->qId, pQuery->window.skey,
pQuery->window.ekey, pQuery->order.order);
setQueryStatus(pRuntimeEnv, QUERY_COMPLETED);
pRuntimeEnv->tableqinfoGroupInfo.numOfTables = 0;
@@ -6569,7 +6570,7 @@ int32_t initQInfo(SQueryTableMsg *pQueryMsg, void *tsdb, int32_t vgId, SQInfo *p
}
if (pRuntimeEnv->tableqinfoGroupInfo.numOfTables == 0) {
- qDebug("QInfo:%p no table qualified for tag filter, abort query", pQInfo);
+ qDebug("QInfo:%"PRIu64" no table qualified for tag filter, abort query", pQInfo->qId);
setQueryStatus(pRuntimeEnv, QUERY_COMPLETED);
return TSDB_CODE_SUCCESS;
}
@@ -6646,7 +6647,7 @@ void freeQInfo(SQInfo *pQInfo) {
return;
}
- qDebug("QInfo:%p start to free QInfo", pQInfo);
+ qDebug("QInfo:%"PRIu64" start to free QInfo", pQInfo->qId);
SQueryRuntimeEnv* pRuntimeEnv = &pQInfo->runtimeEnv;
releaseQueryBuf(pRuntimeEnv->tableqinfoGroupInfo.numOfTables);
@@ -6695,7 +6696,7 @@ void freeQInfo(SQInfo *pQInfo) {
taosArrayDestroy(pRuntimeEnv->groupResInfo.pRows);
pQInfo->signature = 0;
- qDebug("QInfo:%p QInfo is freed", pQInfo);
+ qDebug("QInfo:%"PRIu64" QInfo is freed", pQInfo->qId);
tfree(pQInfo);
}
@@ -6715,7 +6716,7 @@ int32_t doDumpQueryResult(SQInfo *pQInfo, char *data) {
off_t s = lseek(fileno(f), 0, SEEK_END);
assert(s == pRuntimeEnv->outputBuf->info.rows);
- qDebug("QInfo:%p ts comp data return, file:%p, size:%"PRId64, pQInfo, f, (uint64_t)s);
+ qDebug("QInfo:%"PRIu64" ts comp data return, file:%p, size:%"PRId64, pQInfo->qId, f, (uint64_t)s);
if (fseek(f, 0, SEEK_SET) >= 0) {
size_t sz = fread(data, 1, s, f);
if(sz < s) { // todo handle error
@@ -6746,11 +6747,11 @@ int32_t doDumpQueryResult(SQInfo *pQInfo, char *data) {
}
pRuntimeEnv->resultInfo.total += pRuntimeEnv->outputBuf->info.rows;
- qDebug("QInfo:%p current numOfRes rows:%d, total:%" PRId64, pQInfo,
+ qDebug("QInfo:%"PRIu64" current numOfRes rows:%d, total:%" PRId64, pQInfo->qId,
pRuntimeEnv->outputBuf->info.rows, pRuntimeEnv->resultInfo.total);
if (pQuery->limit.limit > 0 && pQuery->limit.limit == pRuntimeEnv->resultInfo.total) {
- qDebug("QInfo:%p results limitation reached, limitation:%"PRId64, pQInfo, pQuery->limit.limit);
+ qDebug("QInfo:%"PRIu64" results limitation reached, limitation:%"PRId64, pQInfo->qId, pQuery->limit.limit);
setQueryStatus(pRuntimeEnv, QUERY_OVER);
}
diff --git a/src/query/src/qPercentile.c b/src/query/src/qPercentile.c
index d366646172..e3326cc26b 100644
--- a/src/query/src/qPercentile.c
+++ b/src/query/src/qPercentile.c
@@ -254,7 +254,7 @@ tMemBucket *tMemBucketCreate(int16_t nElemSize, int16_t dataType, double minval,
resetSlotInfo(pBucket);
- int32_t ret = createDiskbasedResultBuffer(&pBucket->pBuffer, pBucket->bufPageSize, pBucket->bufPageSize * 512, NULL);
+ int32_t ret = createDiskbasedResultBuffer(&pBucket->pBuffer, pBucket->bufPageSize, pBucket->bufPageSize * 512, 1);
if (ret != TSDB_CODE_SUCCESS) {
tMemBucketDestroy(pBucket);
return NULL;
diff --git a/src/query/src/qResultbuf.c b/src/query/src/qResultbuf.c
index ed7f8c6719..c5dd6b3cac 100644
--- a/src/query/src/qResultbuf.c
+++ b/src/query/src/qResultbuf.c
@@ -9,7 +9,7 @@
#define GET_DATA_PAYLOAD(_p) ((char *)(_p)->pData + POINTER_BYTES)
#define NO_IN_MEM_AVAILABLE_PAGES(_b) (listNEles((_b)->lruList) >= (_b)->inMemPages)
-int32_t createDiskbasedResultBuffer(SDiskbasedResultBuf** pResultBuf, int32_t pagesize, int32_t inMemBufSize, const void* handle) {
+int32_t createDiskbasedResultBuffer(SDiskbasedResultBuf** pResultBuf, int32_t pagesize, int32_t inMemBufSize, uint64_t qId) {
*pResultBuf = calloc(1, sizeof(SDiskbasedResultBuf));
SDiskbasedResultBuf* pResBuf = *pResultBuf;
@@ -24,7 +24,7 @@ int32_t createDiskbasedResultBuffer(SDiskbasedResultBuf** pResultBuf, int32_t pa
pResBuf->allocateId = -1;
pResBuf->comp = true;
pResBuf->file = NULL;
- pResBuf->handle = handle;
+ pResBuf->qId = qId;
pResBuf->fileSize = 0;
// at least more than 2 pages must be in memory
@@ -43,7 +43,7 @@ int32_t createDiskbasedResultBuffer(SDiskbasedResultBuf** pResultBuf, int32_t pa
pResBuf->emptyDummyIdList = taosArrayInit(1, sizeof(int32_t));
- qDebug("QInfo:%p create resBuf for output, page size:%d, inmem buf pages:%d, file:%s", handle, pResBuf->pageSize,
+ qDebug("QInfo:%"PRIu64" create resBuf for output, page size:%d, inmem buf pages:%d, file:%s", qId, pResBuf->pageSize,
pResBuf->inMemPages, pResBuf->path);
return TSDB_CODE_SUCCESS;
@@ -406,13 +406,13 @@ void destroyResultBuf(SDiskbasedResultBuf* pResultBuf) {
}
if (pResultBuf->file != NULL) {
- qDebug("QInfo:%p res output buffer closed, total:%.2f Kb, inmem size:%.2f Kb, file size:%.2f Kb",
- pResultBuf->handle, pResultBuf->totalBufSize/1024.0, listNEles(pResultBuf->lruList) * pResultBuf->pageSize / 1024.0,
+ qDebug("QInfo:%"PRIu64" res output buffer closed, total:%.2f Kb, inmem size:%.2f Kb, file size:%.2f Kb",
+ pResultBuf->qId, pResultBuf->totalBufSize/1024.0, listNEles(pResultBuf->lruList) * pResultBuf->pageSize / 1024.0,
pResultBuf->fileSize/1024.0);
fclose(pResultBuf->file);
} else {
- qDebug("QInfo:%p res output buffer closed, total:%.2f Kb, no file created", pResultBuf->handle,
+ qDebug("QInfo:%"PRIu64" res output buffer closed, total:%.2f Kb, no file created", pResultBuf->qId,
pResultBuf->totalBufSize/1024.0);
}
diff --git a/src/query/src/qSqlParser.c b/src/query/src/qSqlParser.c
index ff2b3272af..6211116194 100644
--- a/src/query/src/qSqlParser.c
+++ b/src/query/src/qSqlParser.c
@@ -911,6 +911,7 @@ void setDCLSqlElems(SSqlInfo *pInfo, int32_t type, int32_t nParam, ...) {
SStrToken *pToken = va_arg(va, SStrToken *);
taosArrayPush(pInfo->pMiscInfo->a, pToken);
}
+
va_end(va);
}
diff --git a/src/query/src/qTokenizer.c b/src/query/src/qTokenizer.c
index eaaffec4de..d5d1cdc8d6 100644
--- a/src/query/src/qTokenizer.c
+++ b/src/query/src/qTokenizer.c
@@ -100,6 +100,7 @@ static SKeyword keywordTable[] = {
{"ACCOUNT", TK_ACCOUNT},
{"USE", TK_USE},
{"DESCRIBE", TK_DESCRIBE},
+ {"SYNCDB", TK_SYNCDB},
{"ALTER", TK_ALTER},
{"PASS", TK_PASS},
{"PRIVILEGE", TK_PRIVILEGE},
diff --git a/src/query/src/qUtil.c b/src/query/src/qUtil.c
index 1e7d3c9b58..da7dbcd501 100644
--- a/src/query/src/qUtil.c
+++ b/src/query/src/qUtil.c
@@ -468,7 +468,7 @@ static int32_t mergeIntoGroupResultImpl(SQueryRuntimeEnv *pRuntimeEnv, SGroupRes
pTableQueryInfoList = malloc(POINTER_BYTES * size);
if (pTableQueryInfoList == NULL || posList == NULL || pGroupResInfo->pRows == NULL || pGroupResInfo->pRows == NULL) {
- qError("QInfo:%p failed alloc memory", pRuntimeEnv->qinfo);
+ qError("QInfo:%"PRIu64" failed alloc memory", GET_QID(pRuntimeEnv));
code = TSDB_CODE_QRY_OUT_OF_MEMORY;
goto _end;
}
@@ -540,7 +540,7 @@ static int32_t mergeIntoGroupResultImpl(SQueryRuntimeEnv *pRuntimeEnv, SGroupRes
int64_t endt = taosGetTimestampMs();
- qDebug("QInfo:%p result merge completed for group:%d, elapsed time:%" PRId64 " ms", pRuntimeEnv->qinfo,
+ qDebug("QInfo:%"PRIu64" result merge completed for group:%d, elapsed time:%" PRId64 " ms", GET_QID(pRuntimeEnv),
pGroupResInfo->currentGroup, endt - startt);
_end:
@@ -567,13 +567,13 @@ int32_t mergeIntoGroupResult(SGroupResInfo* pGroupResInfo, SQueryRuntimeEnv* pRu
break;
}
- qDebug("QInfo:%p no result in group %d, continue", pRuntimeEnv->qinfo, pGroupResInfo->currentGroup);
+ qDebug("QInfo:%"PRIu64" no result in group %d, continue", GET_QID(pRuntimeEnv), pGroupResInfo->currentGroup);
cleanupGroupResInfo(pGroupResInfo);
incNextGroup(pGroupResInfo);
}
int64_t elapsedTime = taosGetTimestampUs() - st;
- qDebug("QInfo:%p merge res data into group, index:%d, total group:%d, elapsed time:%" PRId64 "us", pRuntimeEnv->qinfo,
+ qDebug("QInfo:%"PRIu64" merge res data into group, index:%d, total group:%d, elapsed time:%" PRId64 "us", GET_QID(pRuntimeEnv),
pGroupResInfo->currentGroup, pGroupResInfo->totalGroup, elapsedTime);
// pQInfo->summary.firstStageMergeTime += elapsedTime;
diff --git a/src/query/src/queryMain.c b/src/query/src/queryMain.c
index 337af94c21..06070ca6d1 100644
--- a/src/query/src/queryMain.c
+++ b/src/query/src/queryMain.c
@@ -200,29 +200,30 @@ int32_t qCreateQueryInfo(void* tsdb, int32_t vgId, SQueryTableMsg* pQueryMsg, qi
return code;
}
-bool qTableQuery(qinfo_t qinfo) {
+bool qTableQuery(qinfo_t qinfo, uint64_t *qId) {
SQInfo *pQInfo = (SQInfo *)qinfo;
assert(pQInfo && pQInfo->signature == pQInfo);
int64_t threadId = taosGetSelfPthreadId();
int64_t curOwner = 0;
if ((curOwner = atomic_val_compare_exchange_64(&pQInfo->owner, 0, threadId)) != 0) {
- qError("QInfo:%p qhandle is now executed by thread:%p", pQInfo, (void*) curOwner);
+ qError("QInfo:%"PRIu64"-%p qhandle is now executed by thread:%p", pQInfo->qId, pQInfo, (void*) curOwner);
pQInfo->code = TSDB_CODE_QRY_IN_EXEC;
return false;
}
+ *qId = pQInfo->qId;
pQInfo->startExecTs = taosGetTimestampSec();
if (isQueryKilled(pQInfo)) {
- qDebug("QInfo:%p it is already killed, abort", pQInfo);
+ qDebug("QInfo:%"PRIu64" it is already killed, abort", pQInfo->qId);
return doBuildResCheck(pQInfo);
}
SQueryRuntimeEnv* pRuntimeEnv = &pQInfo->runtimeEnv;
if (pRuntimeEnv->tableqinfoGroupInfo.numOfTables == 0) {
- qDebug("QInfo:%p no table exists for query, abort", pQInfo);
+ qDebug("QInfo:%"PRIu64" no table exists for query, abort", pQInfo->qId);
setQueryStatus(pRuntimeEnv, QUERY_COMPLETED);
return doBuildResCheck(pQInfo);
}
@@ -231,22 +232,22 @@ bool qTableQuery(qinfo_t qinfo) {
int32_t ret = setjmp(pQInfo->runtimeEnv.env);
if (ret != TSDB_CODE_SUCCESS) {
pQInfo->code = ret;
- qDebug("QInfo:%p query abort due to error/cancel occurs, code:%s", pQInfo, tstrerror(pQInfo->code));
+ qDebug("QInfo:%"PRIu64" query abort due to error/cancel occurs, code:%s", pQInfo->qId, tstrerror(pQInfo->code));
return doBuildResCheck(pQInfo);
}
- qDebug("QInfo:%p query task is launched", pQInfo);
+ qDebug("QInfo:%"PRIu64" query task is launched", pQInfo->qId);
pRuntimeEnv->outputBuf = pRuntimeEnv->proot->exec(pRuntimeEnv->proot);
if (isQueryKilled(pQInfo)) {
- qDebug("QInfo:%p query is killed", pQInfo);
+ qDebug("QInfo:%"PRIu64" query is killed", pQInfo->qId);
} else if (GET_NUM_OF_RESULTS(pRuntimeEnv) == 0) {
- qDebug("QInfo:%p over, %u tables queried, %"PRId64" rows are returned", pQInfo, pRuntimeEnv->tableqinfoGroupInfo.numOfTables,
+ qDebug("QInfo:%"PRIu64" over, %u tables queried, %"PRId64" rows are returned", pQInfo->qId, pRuntimeEnv->tableqinfoGroupInfo.numOfTables,
pRuntimeEnv->resultInfo.total);
} else {
- qDebug("QInfo:%p query paused, %d rows returned, numOfTotal:%" PRId64 " rows",
- pQInfo, GET_NUM_OF_RESULTS(pRuntimeEnv), pRuntimeEnv->resultInfo.total + GET_NUM_OF_RESULTS(pRuntimeEnv));
+ qDebug("QInfo:%"PRIu64" query paused, %d rows returned, numOfTotal:%" PRId64 " rows",
+ pQInfo->qId, GET_NUM_OF_RESULTS(pRuntimeEnv), pRuntimeEnv->resultInfo.total + GET_NUM_OF_RESULTS(pRuntimeEnv));
}
return doBuildResCheck(pQInfo);
@@ -256,13 +257,13 @@ int32_t qRetrieveQueryResultInfo(qinfo_t qinfo, bool* buildRes, void* pRspContex
SQInfo *pQInfo = (SQInfo *)qinfo;
if (pQInfo == NULL || !isValidQInfo(pQInfo)) {
- qError("QInfo:%p invalid qhandle", pQInfo);
+ qError("QInfo:%"PRIu64" invalid qhandle", pQInfo->qId);
return TSDB_CODE_QRY_INVALID_QHANDLE;
}
*buildRes = false;
if (IS_QUERY_KILLED(pQInfo)) {
- qDebug("QInfo:%p query is killed, code:0x%08x", pQInfo, pQInfo->code);
+ qDebug("QInfo:%"PRIu64" query is killed, code:0x%08x", pQInfo->qId, pQInfo->code);
return pQInfo->code;
}
@@ -282,11 +283,11 @@ int32_t qRetrieveQueryResultInfo(qinfo_t qinfo, bool* buildRes, void* pRspContex
assert(pQInfo->rspContext == NULL);
if (pQInfo->dataReady == QUERY_RESULT_READY) {
*buildRes = true;
- qDebug("QInfo:%p retrieve result info, rowsize:%d, rows:%d, code:%s", pQInfo, pQuery->resultRowSize,
+ qDebug("QInfo:%"PRIu64" retrieve result info, rowsize:%d, rows:%d, code:%s", pQInfo->qId, pQuery->resultRowSize,
GET_NUM_OF_RESULTS(pRuntimeEnv), tstrerror(pQInfo->code));
} else {
*buildRes = false;
- qDebug("QInfo:%p retrieve req set query return result after paused", pQInfo);
+ qDebug("QInfo:%"PRIu64" retrieve req set query return result after paused", pQInfo->qId);
pQInfo->rspContext = pRspContext;
assert(pQInfo->rspContext != NULL);
}
@@ -345,9 +346,10 @@ int32_t qDumpRetrieveResult(qinfo_t qinfo, SRetrieveTableRsp **pRsp, int32_t *co
// here current thread hold the refcount, so it is safe to free tsdbQueryHandle.
*continueExec = false;
(*pRsp)->completed = 1; // notify no more result to client
+ qDebug("QInfo:%"PRIu64" no more results to retrieve", pQInfo->qId);
} else {
*continueExec = true;
- qDebug("QInfo:%p has more results to retrieve", pQInfo);
+ qDebug("QInfo:%"PRIu64" has more results to retrieve", pQInfo->qId);
}
// the memory should be freed if the code of pQInfo is not TSDB_CODE_SUCCESS
@@ -400,7 +402,7 @@ void qDestroyQueryInfo(qinfo_t qHandle) {
return;
}
- qDebug("QInfo:%p query completed", pQInfo);
+ qDebug("QInfo:%"PRIu64" query completed", pQInfo->qId);
queryCostStatis(pQInfo); // print the query cost summary
freeQInfo(pQInfo);
}
@@ -483,7 +485,7 @@ void** qRegisterQInfo(void* pMgmt, uint64_t qId, uint64_t qInfo) {
SQueryMgmt *pQueryMgmt = pMgmt;
if (pQueryMgmt->qinfoPool == NULL) {
- qError("QInfo:%p failed to add qhandle into qMgmt, since qMgmt is closed", (void *)qInfo);
+ qError("QInfo:%"PRIu64"-%p failed to add qhandle into qMgmt, since qMgmt is closed", qId, (void*)qInfo);
terrno = TSDB_CODE_VND_INVALID_VGROUP_ID;
return NULL;
}
@@ -491,7 +493,7 @@ void** qRegisterQInfo(void* pMgmt, uint64_t qId, uint64_t qInfo) {
pthread_mutex_lock(&pQueryMgmt->lock);
if (pQueryMgmt->closed) {
pthread_mutex_unlock(&pQueryMgmt->lock);
- qError("QInfo:%p failed to add qhandle into cache, since qMgmt is colsing", (void *)qInfo);
+ qError("QInfo:%"PRIu64"-%p failed to add qhandle into cache, since qMgmt is colsing", qId, (void*)qInfo);
terrno = TSDB_CODE_VND_INVALID_VGROUP_ID;
return NULL;
} else {
diff --git a/src/query/src/sql.c b/src/query/src/sql.c
index a9258f88ad..6f78272809 100644
--- a/src/query/src/sql.c
+++ b/src/query/src/sql.c
@@ -100,28 +100,28 @@
#endif
/************* Begin control #defines *****************************************/
#define YYCODETYPE unsigned short int
-#define YYNOCODE 265
+#define YYNOCODE 266
#define YYACTIONTYPE unsigned short int
#define ParseTOKENTYPE SStrToken
typedef union {
int yyinit;
ParseTOKENTYPE yy0;
- SLimitVal yy74;
- SQuerySqlNode* yy110;
- SCreateDbInfo yy122;
- SSessionWindowVal yy139;
- TAOS_FIELD yy153;
- SSubclauseInfo* yy154;
- int64_t yy179;
- SCreateAcctInfo yy211;
- tVariant yy216;
- SFromInfo* yy232;
- SArray* yy291;
- int yy382;
- SIntervalVal yy400;
- SCreateTableSql* yy412;
- tSqlExpr* yy436;
- SCreatedTableInfo yy446;
+ SSubclauseInfo* yy21;
+ TAOS_FIELD yy27;
+ SCreateDbInfo yy114;
+ SCreateAcctInfo yy183;
+ SCreatedTableInfo yy192;
+ SArray* yy193;
+ SCreateTableSql* yy270;
+ SQuerySqlNode* yy286;
+ int yy312;
+ SFromInfo* yy370;
+ SIntervalVal yy392;
+ tVariant yy442;
+ SSessionWindowVal yy447;
+ tSqlExpr* yy454;
+ int64_t yy473;
+ SLimitVal yy482;
} YYMINORTYPE;
#ifndef YYSTACKDEPTH
#define YYSTACKDEPTH 100
@@ -137,18 +137,18 @@ typedef union {
#define ParseCTX_FETCH
#define ParseCTX_STORE
#define YYFALLBACK 1
-#define YYNSTATE 325
-#define YYNRULE 269
-#define YYNRULE_WITH_ACTION 269
-#define YYNTOKEN 190
-#define YY_MAX_SHIFT 324
-#define YY_MIN_SHIFTREDUCE 518
-#define YY_MAX_SHIFTREDUCE 786
-#define YY_ERROR_ACTION 787
-#define YY_ACCEPT_ACTION 788
-#define YY_NO_ACTION 789
-#define YY_MIN_REDUCE 790
-#define YY_MAX_REDUCE 1058
+#define YYNSTATE 327
+#define YYNRULE 270
+#define YYNRULE_WITH_ACTION 270
+#define YYNTOKEN 191
+#define YY_MAX_SHIFT 326
+#define YY_MIN_SHIFTREDUCE 521
+#define YY_MAX_SHIFTREDUCE 790
+#define YY_ERROR_ACTION 791
+#define YY_ACCEPT_ACTION 792
+#define YY_NO_ACTION 793
+#define YY_MIN_REDUCE 794
+#define YY_MAX_REDUCE 1063
/************* End control #defines *******************************************/
#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
@@ -215,266 +215,266 @@ typedef union {
** yy_default[] Default action for each state.
**
*********** Begin parsing tables **********************************************/
-#define YY_ACTTAB_COUNT (693)
+#define YY_ACTTAB_COUNT (696)
static const YYACTIONTYPE yy_action[] = {
- /* 0 */ 961, 567, 187, 567, 208, 322, 926, 17, 70, 568,
- /* 10 */ 83, 568, 1040, 49, 50, 146, 53, 54, 139, 185,
- /* 20 */ 220, 43, 187, 52, 267, 57, 55, 59, 56, 191,
- /* 30 */ 32, 215, 1041, 48, 47, 1037, 187, 46, 45, 44,
- /* 40 */ 925, 923, 924, 29, 927, 214, 1041, 519, 520, 521,
- /* 50 */ 522, 523, 524, 525, 526, 527, 528, 529, 530, 531,
- /* 60 */ 532, 323, 958, 212, 237, 49, 50, 32, 53, 54,
- /* 70 */ 146, 209, 220, 43, 937, 52, 267, 57, 55, 59,
- /* 80 */ 56, 252, 993, 71, 262, 48, 47, 288, 940, 46,
- /* 90 */ 45, 44, 49, 50, 288, 53, 54, 32, 82, 220,
- /* 100 */ 43, 567, 52, 267, 57, 55, 59, 56, 223, 568,
- /* 110 */ 32, 937, 48, 47, 75, 308, 46, 45, 44, 49,
- /* 120 */ 51, 38, 53, 54, 12, 225, 220, 43, 85, 52,
- /* 130 */ 267, 57, 55, 59, 56, 264, 227, 79, 224, 48,
- /* 140 */ 47, 937, 318, 46, 45, 44, 50, 1036, 53, 54,
- /* 150 */ 940, 291, 220, 43, 937, 52, 267, 57, 55, 59,
- /* 160 */ 56, 940, 734, 837, 146, 48, 47, 940, 172, 46,
- /* 170 */ 45, 44, 86, 23, 286, 317, 316, 285, 284, 283,
- /* 180 */ 315, 282, 314, 313, 312, 281, 311, 310, 900, 32,
- /* 190 */ 888, 889, 890, 891, 892, 893, 894, 895, 896, 897,
- /* 200 */ 898, 899, 901, 902, 53, 54, 928, 934, 220, 43,
- /* 210 */ 146, 52, 267, 57, 55, 59, 56, 1035, 32, 18,
- /* 220 */ 952, 48, 47, 1, 160, 46, 45, 44, 219, 747,
- /* 230 */ 292, 992, 738, 937, 741, 210, 744, 195, 219, 747,
- /* 240 */ 846, 204, 738, 197, 741, 172, 744, 5, 162, 226,
- /* 250 */ 123, 122, 196, 35, 161, 92, 97, 88, 96, 296,
- /* 260 */ 216, 217, 937, 229, 266, 23, 205, 317, 316, 278,
- /* 270 */ 216, 217, 315, 567, 314, 313, 312, 80, 311, 310,
- /* 280 */ 240, 568, 908, 1050, 75, 906, 907, 244, 243, 81,
- /* 290 */ 909, 38, 911, 912, 910, 232, 913, 914, 57, 55,
- /* 300 */ 59, 56, 72, 231, 850, 687, 48, 47, 108, 113,
- /* 310 */ 46, 45, 44, 246, 102, 112, 32, 118, 121, 111,
- /* 320 */ 203, 180, 176, 788, 324, 115, 268, 178, 175, 127,
- /* 330 */ 126, 125, 124, 648, 672, 230, 58, 669, 290, 670,
- /* 340 */ 189, 671, 321, 320, 132, 32, 58, 232, 746, 48,
- /* 350 */ 47, 3, 173, 46, 45, 44, 849, 300, 746, 232,
- /* 360 */ 937, 298, 297, 218, 745, 234, 235, 684, 938, 952,
- /* 370 */ 46, 45, 44, 24, 745, 233, 248, 110, 295, 294,
- /* 380 */ 33, 25, 736, 838, 247, 308, 694, 691, 172, 936,
- /* 390 */ 715, 716, 700, 250, 63, 706, 141, 707, 767, 62,
- /* 400 */ 748, 20, 19, 740, 19, 743, 739, 190, 742, 66,
- /* 410 */ 658, 6, 192, 270, 33, 64, 660, 33, 737, 272,
- /* 420 */ 62, 28, 186, 84, 273, 659, 750, 193, 67, 62,
- /* 430 */ 101, 100, 14, 13, 107, 106, 69, 194, 647, 16,
- /* 440 */ 15, 676, 674, 677, 675, 120, 119, 673, 137, 135,
- /* 450 */ 200, 201, 199, 184, 198, 188, 939, 1003, 1002, 221,
- /* 460 */ 999, 998, 222, 299, 138, 41, 985, 960, 968, 984,
- /* 470 */ 136, 970, 953, 249, 251, 73, 140, 144, 935, 156,
- /* 480 */ 76, 253, 211, 255, 904, 157, 699, 933, 148, 158,
- /* 490 */ 159, 950, 147, 149, 851, 265, 150, 275, 276, 60,
- /* 500 */ 277, 279, 68, 280, 260, 65, 39, 182, 263, 261,
- /* 510 */ 36, 289, 845, 1055, 98, 1054, 1052, 163, 293, 1049,
- /* 520 */ 259, 254, 104, 1048, 1046, 257, 42, 164, 869, 37,
- /* 530 */ 34, 40, 183, 834, 114, 832, 116, 117, 830, 829,
- /* 540 */ 236, 174, 827, 826, 825, 824, 823, 822, 821, 177,
- /* 550 */ 179, 818, 816, 814, 812, 810, 181, 309, 256, 109,
- /* 560 */ 986, 301, 302, 303, 304, 305, 306, 307, 319, 206,
- /* 570 */ 228, 786, 238, 239, 274, 785, 241, 242, 784, 772,
- /* 580 */ 207, 93, 94, 202, 245, 250, 77, 8, 269, 74,
- /* 590 */ 213, 679, 701, 142, 751, 271, 704, 166, 870, 167,
- /* 600 */ 168, 165, 170, 169, 171, 828, 2, 128, 129, 820,
- /* 610 */ 4, 130, 819, 143, 131, 811, 153, 151, 152, 154,
- /* 620 */ 155, 916, 78, 258, 9, 708, 145, 10, 87, 749,
- /* 630 */ 26, 7, 27, 11, 21, 22, 85, 30, 89, 91,
- /* 640 */ 90, 31, 611, 607, 605, 604, 603, 600, 99, 571,
- /* 650 */ 287, 33, 95, 61, 103, 650, 649, 646, 595, 593,
- /* 660 */ 585, 591, 105, 587, 589, 583, 581, 614, 613, 612,
- /* 670 */ 610, 609, 608, 606, 602, 601, 62, 569, 133, 536,
- /* 680 */ 534, 790, 789, 789, 789, 789, 789, 789, 789, 789,
- /* 690 */ 789, 789, 134,
+ /* 0 */ 965, 570, 188, 570, 209, 324, 930, 17, 71, 571,
+ /* 10 */ 84, 571, 1044, 49, 50, 147, 53, 54, 140, 186,
+ /* 20 */ 221, 43, 188, 52, 269, 57, 55, 59, 56, 192,
+ /* 30 */ 32, 216, 1045, 48, 47, 1041, 188, 46, 45, 44,
+ /* 40 */ 929, 927, 928, 29, 931, 215, 1045, 522, 523, 524,
+ /* 50 */ 525, 526, 527, 528, 529, 530, 531, 532, 533, 534,
+ /* 60 */ 535, 325, 962, 213, 238, 49, 50, 32, 53, 54,
+ /* 70 */ 147, 210, 221, 43, 941, 52, 269, 57, 55, 59,
+ /* 80 */ 56, 254, 997, 72, 264, 48, 47, 290, 944, 46,
+ /* 90 */ 45, 44, 49, 50, 147, 53, 54, 32, 290, 221,
+ /* 100 */ 43, 570, 52, 269, 57, 55, 59, 56, 224, 571,
+ /* 110 */ 32, 941, 48, 47, 76, 233, 46, 45, 44, 49,
+ /* 120 */ 51, 38, 53, 54, 854, 226, 221, 43, 570, 52,
+ /* 130 */ 269, 57, 55, 59, 56, 266, 571, 80, 225, 48,
+ /* 140 */ 47, 941, 83, 46, 45, 44, 50, 310, 53, 54,
+ /* 150 */ 944, 293, 221, 43, 941, 52, 269, 57, 55, 59,
+ /* 160 */ 56, 996, 737, 32, 228, 48, 47, 1040, 12, 46,
+ /* 170 */ 45, 44, 86, 23, 288, 319, 318, 287, 286, 285,
+ /* 180 */ 317, 284, 316, 315, 314, 283, 313, 312, 904, 944,
+ /* 190 */ 892, 893, 894, 895, 896, 897, 898, 899, 900, 901,
+ /* 200 */ 902, 903, 905, 906, 53, 54, 147, 940, 221, 43,
+ /* 210 */ 18, 52, 269, 57, 55, 59, 56, 232, 651, 87,
+ /* 220 */ 1039, 48, 47, 241, 230, 46, 45, 44, 196, 220,
+ /* 230 */ 750, 245, 244, 741, 198, 744, 25, 747, 46, 45,
+ /* 240 */ 44, 124, 123, 197, 220, 750, 300, 299, 741, 320,
+ /* 250 */ 744, 956, 747, 932, 32, 57, 55, 59, 56, 938,
+ /* 260 */ 1055, 217, 218, 48, 47, 268, 211, 46, 45, 44,
+ /* 270 */ 323, 322, 133, 81, 944, 76, 217, 218, 23, 690,
+ /* 280 */ 319, 318, 38, 1, 161, 317, 205, 316, 315, 314,
+ /* 290 */ 234, 313, 312, 297, 296, 294, 233, 231, 941, 912,
+ /* 300 */ 292, 227, 910, 911, 248, 853, 70, 913, 82, 915,
+ /* 310 */ 916, 914, 204, 917, 918, 841, 5, 163, 32, 233,
+ /* 320 */ 173, 73, 35, 162, 93, 98, 89, 97, 942, 270,
+ /* 330 */ 3, 174, 206, 109, 114, 792, 326, 58, 280, 103,
+ /* 340 */ 113, 850, 119, 122, 112, 687, 173, 111, 190, 749,
+ /* 350 */ 116, 24, 58, 675, 32, 310, 672, 943, 673, 298,
+ /* 360 */ 674, 694, 941, 842, 749, 748, 181, 177, 173, 718,
+ /* 370 */ 719, 1007, 179, 176, 128, 127, 126, 125, 250, 219,
+ /* 380 */ 748, 956, 33, 739, 235, 236, 48, 47, 63, 191,
+ /* 390 */ 46, 45, 44, 697, 28, 302, 249, 275, 941, 703,
+ /* 400 */ 252, 709, 710, 142, 770, 62, 20, 751, 19, 64,
+ /* 410 */ 743, 19, 746, 742, 66, 745, 661, 272, 663, 740,
+ /* 420 */ 33, 33, 62, 102, 101, 193, 274, 6, 187, 753,
+ /* 430 */ 85, 662, 69, 67, 650, 62, 194, 14, 13, 195,
+ /* 440 */ 108, 107, 201, 16, 15, 202, 679, 677, 680, 678,
+ /* 450 */ 200, 121, 120, 185, 138, 136, 1006, 199, 189, 222,
+ /* 460 */ 246, 139, 1003, 1002, 223, 301, 676, 964, 41, 972,
+ /* 470 */ 974, 141, 145, 957, 253, 137, 939, 989, 988, 157,
+ /* 480 */ 158, 937, 159, 255, 160, 702, 311, 855, 908, 110,
+ /* 490 */ 277, 954, 153, 278, 150, 148, 279, 149, 281, 282,
+ /* 500 */ 68, 65, 212, 39, 183, 36, 291, 849, 257, 1060,
+ /* 510 */ 262, 99, 60, 1059, 1057, 267, 164, 265, 295, 1054,
+ /* 520 */ 105, 1053, 1051, 165, 873, 37, 34, 40, 184, 838,
+ /* 530 */ 115, 836, 117, 118, 834, 833, 237, 175, 831, 830,
+ /* 540 */ 829, 828, 827, 826, 825, 263, 178, 261, 180, 822,
+ /* 550 */ 820, 818, 816, 814, 182, 259, 251, 74, 77, 256,
+ /* 560 */ 258, 990, 42, 303, 304, 305, 306, 307, 308, 207,
+ /* 570 */ 229, 309, 276, 321, 790, 240, 239, 789, 208, 94,
+ /* 580 */ 95, 203, 242, 243, 788, 776, 247, 775, 252, 8,
+ /* 590 */ 271, 75, 682, 832, 824, 167, 874, 170, 168, 166,
+ /* 600 */ 129, 172, 169, 171, 2, 130, 131, 823, 4, 132,
+ /* 610 */ 815, 78, 704, 143, 154, 155, 151, 152, 156, 707,
+ /* 620 */ 144, 214, 26, 920, 79, 260, 9, 711, 146, 7,
+ /* 630 */ 10, 752, 27, 11, 21, 273, 22, 754, 88, 86,
+ /* 640 */ 30, 90, 91, 31, 92, 614, 610, 608, 607, 606,
+ /* 650 */ 603, 33, 289, 96, 100, 574, 61, 104, 653, 652,
+ /* 660 */ 649, 598, 596, 588, 594, 590, 592, 586, 584, 617,
+ /* 670 */ 616, 106, 615, 613, 612, 611, 609, 605, 604, 62,
+ /* 680 */ 572, 794, 539, 537, 793, 793, 793, 134, 793, 793,
+ /* 690 */ 793, 793, 793, 793, 793, 135,
};
static const YYCODETYPE yy_lookahead[] = {
- /* 0 */ 193, 1, 254, 1, 192, 193, 0, 254, 199, 9,
- /* 10 */ 199, 9, 264, 13, 14, 193, 16, 17, 193, 254,
- /* 20 */ 20, 21, 254, 23, 24, 25, 26, 27, 28, 254,
- /* 30 */ 193, 263, 264, 33, 34, 254, 254, 37, 38, 39,
- /* 40 */ 231, 230, 231, 232, 233, 263, 264, 45, 46, 47,
+ /* 0 */ 194, 1, 255, 1, 193, 194, 0, 255, 200, 9,
+ /* 10 */ 200, 9, 265, 13, 14, 194, 16, 17, 194, 255,
+ /* 20 */ 20, 21, 255, 23, 24, 25, 26, 27, 28, 255,
+ /* 30 */ 194, 264, 265, 33, 34, 255, 255, 37, 38, 39,
+ /* 40 */ 232, 231, 232, 233, 234, 264, 265, 45, 46, 47,
/* 50 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
- /* 60 */ 58, 59, 255, 213, 62, 13, 14, 193, 16, 17,
- /* 70 */ 193, 234, 20, 21, 237, 23, 24, 25, 26, 27,
- /* 80 */ 28, 256, 260, 83, 262, 33, 34, 81, 238, 37,
- /* 90 */ 38, 39, 13, 14, 81, 16, 17, 193, 83, 20,
- /* 100 */ 21, 1, 23, 24, 25, 26, 27, 28, 234, 9,
- /* 110 */ 193, 237, 33, 34, 109, 86, 37, 38, 39, 13,
- /* 120 */ 14, 116, 16, 17, 109, 213, 20, 21, 113, 23,
- /* 130 */ 24, 25, 26, 27, 28, 258, 213, 260, 234, 33,
- /* 140 */ 34, 237, 213, 37, 38, 39, 14, 254, 16, 17,
- /* 150 */ 238, 234, 20, 21, 237, 23, 24, 25, 26, 27,
- /* 160 */ 28, 238, 110, 198, 193, 33, 34, 238, 203, 37,
- /* 170 */ 38, 39, 199, 93, 94, 95, 96, 97, 98, 99,
- /* 180 */ 100, 101, 102, 103, 104, 105, 106, 107, 212, 193,
- /* 190 */ 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
- /* 200 */ 224, 225, 226, 227, 16, 17, 233, 193, 20, 21,
- /* 210 */ 193, 23, 24, 25, 26, 27, 28, 254, 193, 44,
- /* 220 */ 236, 33, 34, 200, 201, 37, 38, 39, 1, 2,
- /* 230 */ 234, 260, 5, 237, 7, 251, 9, 62, 1, 2,
- /* 240 */ 198, 254, 5, 68, 7, 203, 9, 63, 64, 235,
- /* 250 */ 75, 76, 77, 69, 70, 71, 72, 73, 74, 234,
- /* 260 */ 33, 34, 237, 68, 37, 93, 254, 95, 96, 85,
- /* 270 */ 33, 34, 100, 1, 102, 103, 104, 260, 106, 107,
- /* 280 */ 139, 9, 212, 238, 109, 215, 216, 146, 147, 239,
- /* 290 */ 220, 116, 222, 223, 224, 193, 226, 227, 25, 26,
- /* 300 */ 27, 28, 252, 68, 202, 37, 33, 34, 63, 64,
- /* 310 */ 37, 38, 39, 138, 69, 70, 193, 72, 73, 74,
- /* 320 */ 145, 63, 64, 190, 191, 80, 15, 69, 70, 71,
- /* 330 */ 72, 73, 74, 5, 2, 140, 109, 5, 143, 7,
- /* 340 */ 254, 9, 65, 66, 67, 193, 109, 193, 121, 33,
- /* 350 */ 34, 196, 197, 37, 38, 39, 202, 234, 121, 193,
- /* 360 */ 237, 33, 34, 61, 137, 33, 34, 114, 202, 236,
- /* 370 */ 37, 38, 39, 120, 137, 140, 110, 78, 143, 144,
- /* 380 */ 114, 109, 1, 198, 251, 86, 110, 119, 203, 237,
- /* 390 */ 128, 129, 110, 117, 114, 110, 114, 110, 110, 114,
- /* 400 */ 110, 114, 114, 5, 114, 7, 5, 254, 7, 114,
- /* 410 */ 110, 109, 254, 110, 114, 135, 110, 114, 37, 110,
- /* 420 */ 114, 109, 254, 114, 112, 110, 115, 254, 133, 114,
- /* 430 */ 141, 142, 141, 142, 141, 142, 109, 254, 111, 141,
- /* 440 */ 142, 5, 5, 7, 7, 78, 79, 115, 63, 64,
- /* 450 */ 254, 254, 254, 254, 254, 254, 238, 229, 229, 229,
- /* 460 */ 229, 229, 229, 229, 193, 253, 261, 193, 193, 261,
- /* 470 */ 61, 193, 236, 194, 236, 194, 193, 193, 236, 240,
- /* 480 */ 194, 257, 257, 257, 228, 193, 121, 193, 248, 193,
- /* 490 */ 193, 250, 249, 247, 193, 126, 246, 193, 193, 131,
- /* 500 */ 193, 193, 132, 193, 257, 134, 193, 193, 130, 125,
- /* 510 */ 193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
- /* 520 */ 124, 122, 193, 193, 193, 123, 136, 193, 193, 193,
- /* 530 */ 193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
- /* 540 */ 193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
- /* 550 */ 193, 193, 193, 193, 193, 193, 193, 108, 194, 92,
- /* 560 */ 194, 91, 51, 88, 90, 55, 89, 87, 81, 194,
- /* 570 */ 194, 5, 148, 5, 194, 5, 148, 5, 5, 94,
- /* 580 */ 194, 199, 199, 194, 139, 117, 114, 109, 112, 118,
- /* 590 */ 1, 110, 110, 109, 115, 112, 110, 209, 211, 205,
- /* 600 */ 208, 210, 207, 206, 204, 194, 200, 195, 195, 194,
- /* 610 */ 196, 195, 194, 114, 195, 194, 243, 245, 244, 242,
- /* 620 */ 241, 228, 109, 109, 127, 110, 109, 127, 78, 110,
- /* 630 */ 114, 109, 114, 109, 109, 109, 113, 84, 83, 83,
- /* 640 */ 71, 84, 9, 5, 5, 5, 5, 5, 142, 82,
- /* 650 */ 15, 114, 78, 16, 142, 5, 5, 110, 5, 5,
- /* 660 */ 5, 5, 142, 5, 5, 5, 5, 5, 5, 5,
- /* 670 */ 5, 5, 5, 5, 5, 5, 114, 82, 21, 61,
- /* 680 */ 60, 0, 265, 265, 265, 265, 265, 265, 265, 265,
- /* 690 */ 265, 265, 21, 265, 265, 265, 265, 265, 265, 265,
- /* 700 */ 265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
- /* 710 */ 265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
- /* 720 */ 265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
- /* 730 */ 265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
- /* 740 */ 265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
- /* 750 */ 265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
- /* 760 */ 265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
- /* 770 */ 265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
- /* 780 */ 265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
- /* 790 */ 265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
- /* 800 */ 265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
- /* 810 */ 265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
- /* 820 */ 265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
- /* 830 */ 265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
- /* 840 */ 265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
- /* 850 */ 265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
- /* 860 */ 265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
- /* 870 */ 265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
- /* 880 */ 265, 265, 265,
+ /* 60 */ 58, 59, 256, 214, 62, 13, 14, 194, 16, 17,
+ /* 70 */ 194, 235, 20, 21, 238, 23, 24, 25, 26, 27,
+ /* 80 */ 28, 257, 261, 83, 263, 33, 34, 81, 239, 37,
+ /* 90 */ 38, 39, 13, 14, 194, 16, 17, 194, 81, 20,
+ /* 100 */ 21, 1, 23, 24, 25, 26, 27, 28, 235, 9,
+ /* 110 */ 194, 238, 33, 34, 109, 194, 37, 38, 39, 13,
+ /* 120 */ 14, 116, 16, 17, 203, 214, 20, 21, 1, 23,
+ /* 130 */ 24, 25, 26, 27, 28, 259, 9, 261, 235, 33,
+ /* 140 */ 34, 238, 83, 37, 38, 39, 14, 86, 16, 17,
+ /* 150 */ 239, 235, 20, 21, 238, 23, 24, 25, 26, 27,
+ /* 160 */ 28, 261, 110, 194, 214, 33, 34, 255, 109, 37,
+ /* 170 */ 38, 39, 113, 93, 94, 95, 96, 97, 98, 99,
+ /* 180 */ 100, 101, 102, 103, 104, 105, 106, 107, 213, 239,
+ /* 190 */ 215, 216, 217, 218, 219, 220, 221, 222, 223, 224,
+ /* 200 */ 225, 226, 227, 228, 16, 17, 194, 238, 20, 21,
+ /* 210 */ 44, 23, 24, 25, 26, 27, 28, 68, 5, 200,
+ /* 220 */ 255, 33, 34, 139, 68, 37, 38, 39, 62, 1,
+ /* 230 */ 2, 147, 148, 5, 68, 7, 109, 9, 37, 38,
+ /* 240 */ 39, 75, 76, 77, 1, 2, 33, 34, 5, 214,
+ /* 250 */ 7, 237, 9, 234, 194, 25, 26, 27, 28, 194,
+ /* 260 */ 239, 33, 34, 33, 34, 37, 252, 37, 38, 39,
+ /* 270 */ 65, 66, 67, 261, 239, 109, 33, 34, 93, 37,
+ /* 280 */ 95, 96, 116, 201, 202, 100, 255, 102, 103, 104,
+ /* 290 */ 141, 106, 107, 144, 145, 235, 194, 141, 238, 213,
+ /* 300 */ 144, 236, 216, 217, 138, 203, 140, 221, 240, 223,
+ /* 310 */ 224, 225, 146, 227, 228, 199, 63, 64, 194, 194,
+ /* 320 */ 204, 253, 69, 70, 71, 72, 73, 74, 203, 15,
+ /* 330 */ 197, 198, 255, 63, 64, 191, 192, 109, 85, 69,
+ /* 340 */ 70, 199, 72, 73, 74, 114, 204, 78, 255, 121,
+ /* 350 */ 80, 120, 109, 2, 194, 86, 5, 239, 7, 235,
+ /* 360 */ 9, 119, 238, 199, 121, 137, 63, 64, 204, 128,
+ /* 370 */ 129, 230, 69, 70, 71, 72, 73, 74, 110, 61,
+ /* 380 */ 137, 237, 114, 1, 33, 34, 33, 34, 114, 255,
+ /* 390 */ 37, 38, 39, 110, 109, 235, 252, 112, 238, 110,
+ /* 400 */ 117, 110, 110, 114, 110, 114, 114, 110, 114, 135,
+ /* 410 */ 5, 114, 7, 5, 114, 7, 110, 110, 110, 37,
+ /* 420 */ 114, 114, 114, 142, 143, 255, 110, 109, 255, 115,
+ /* 430 */ 114, 110, 109, 133, 111, 114, 255, 142, 143, 255,
+ /* 440 */ 142, 143, 255, 142, 143, 255, 5, 5, 7, 7,
+ /* 450 */ 255, 78, 79, 255, 63, 64, 230, 255, 255, 230,
+ /* 460 */ 194, 194, 230, 230, 230, 230, 115, 194, 254, 194,
+ /* 470 */ 194, 194, 194, 237, 237, 61, 237, 262, 262, 241,
+ /* 480 */ 194, 194, 194, 258, 194, 121, 108, 194, 229, 92,
+ /* 490 */ 194, 251, 245, 194, 248, 250, 194, 249, 194, 194,
+ /* 500 */ 132, 134, 258, 194, 194, 194, 194, 194, 258, 194,
+ /* 510 */ 258, 194, 131, 194, 194, 126, 194, 130, 194, 194,
+ /* 520 */ 194, 194, 194, 194, 194, 194, 194, 194, 194, 194,
+ /* 530 */ 194, 194, 194, 194, 194, 194, 194, 194, 194, 194,
+ /* 540 */ 194, 194, 194, 194, 194, 125, 194, 124, 194, 194,
+ /* 550 */ 194, 194, 194, 194, 194, 123, 195, 195, 195, 122,
+ /* 560 */ 195, 195, 136, 91, 51, 88, 90, 55, 89, 195,
+ /* 570 */ 195, 87, 195, 81, 5, 5, 149, 5, 195, 200,
+ /* 580 */ 200, 195, 149, 5, 5, 95, 139, 94, 117, 109,
+ /* 590 */ 112, 118, 110, 195, 195, 210, 212, 207, 206, 211,
+ /* 600 */ 196, 205, 209, 208, 201, 196, 196, 195, 197, 196,
+ /* 610 */ 195, 114, 110, 109, 244, 243, 247, 246, 242, 110,
+ /* 620 */ 114, 1, 114, 229, 109, 109, 127, 110, 109, 109,
+ /* 630 */ 127, 110, 114, 109, 109, 112, 109, 115, 78, 113,
+ /* 640 */ 84, 83, 71, 84, 83, 9, 5, 5, 5, 5,
+ /* 650 */ 5, 114, 15, 78, 143, 82, 16, 143, 5, 5,
+ /* 660 */ 110, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ /* 670 */ 5, 143, 5, 5, 5, 5, 5, 5, 5, 114,
+ /* 680 */ 82, 0, 61, 60, 266, 266, 266, 21, 266, 266,
+ /* 690 */ 266, 266, 266, 266, 266, 21, 266, 266, 266, 266,
+ /* 700 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266,
+ /* 710 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266,
+ /* 720 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266,
+ /* 730 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266,
+ /* 740 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266,
+ /* 750 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266,
+ /* 760 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266,
+ /* 770 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266,
+ /* 780 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266,
+ /* 790 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266,
+ /* 800 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266,
+ /* 810 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266,
+ /* 820 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266,
+ /* 830 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266,
+ /* 840 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266,
+ /* 850 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266,
+ /* 860 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266,
+ /* 870 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266,
+ /* 880 */ 266, 266, 266, 266, 266, 266, 266,
};
-#define YY_SHIFT_COUNT (324)
+#define YY_SHIFT_COUNT (326)
#define YY_SHIFT_MIN (0)
#define YY_SHIFT_MAX (681)
static const unsigned short int yy_shift_ofst[] = {
- /* 0 */ 175, 80, 80, 172, 172, 13, 227, 237, 100, 100,
- /* 10 */ 100, 100, 100, 100, 100, 100, 100, 0, 2, 237,
- /* 20 */ 332, 332, 332, 332, 272, 5, 100, 100, 100, 6,
- /* 30 */ 100, 100, 100, 100, 299, 13, 29, 29, 693, 693,
- /* 40 */ 693, 237, 237, 237, 237, 237, 237, 237, 237, 237,
- /* 50 */ 237, 237, 237, 237, 237, 237, 237, 237, 237, 237,
- /* 60 */ 237, 332, 332, 328, 328, 328, 328, 328, 328, 328,
- /* 70 */ 100, 100, 268, 100, 5, 5, 100, 100, 100, 262,
- /* 80 */ 262, 253, 5, 100, 100, 100, 100, 100, 100, 100,
+ /* 0 */ 166, 80, 80, 185, 185, 17, 228, 243, 100, 100,
+ /* 10 */ 100, 100, 100, 100, 100, 100, 100, 0, 2, 243,
+ /* 20 */ 351, 351, 351, 351, 127, 5, 100, 100, 100, 6,
+ /* 30 */ 100, 100, 100, 100, 269, 17, 61, 61, 696, 696,
+ /* 40 */ 696, 243, 243, 243, 243, 243, 243, 243, 243, 243,
+ /* 50 */ 243, 243, 243, 243, 243, 243, 243, 243, 243, 243,
+ /* 60 */ 243, 351, 351, 213, 213, 213, 213, 213, 213, 213,
+ /* 70 */ 100, 100, 100, 242, 100, 5, 5, 100, 100, 100,
+ /* 80 */ 241, 241, 231, 5, 100, 100, 100, 100, 100, 100,
/* 90 */ 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
/* 100 */ 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
/* 110 */ 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
/* 120 */ 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
- /* 130 */ 100, 100, 100, 100, 100, 100, 100, 100, 409, 409,
- /* 140 */ 409, 365, 365, 365, 409, 365, 409, 370, 371, 368,
- /* 150 */ 369, 378, 384, 396, 402, 399, 390, 409, 409, 409,
- /* 160 */ 449, 13, 13, 409, 409, 467, 470, 511, 475, 474,
- /* 170 */ 510, 477, 480, 449, 409, 487, 487, 409, 487, 409,
- /* 180 */ 487, 409, 693, 693, 52, 79, 106, 79, 79, 132,
- /* 190 */ 188, 273, 273, 273, 273, 184, 245, 258, 316, 316,
- /* 200 */ 316, 316, 235, 141, 333, 333, 15, 195, 277, 266,
- /* 210 */ 276, 282, 285, 287, 288, 290, 398, 401, 381, 302,
- /* 220 */ 311, 280, 295, 300, 303, 306, 309, 315, 312, 289,
- /* 230 */ 291, 293, 327, 298, 436, 437, 367, 385, 566, 424,
- /* 240 */ 568, 570, 428, 572, 573, 485, 445, 468, 476, 478,
- /* 250 */ 471, 481, 472, 482, 484, 486, 499, 513, 589, 514,
- /* 260 */ 515, 517, 516, 497, 518, 500, 519, 522, 479, 524,
- /* 270 */ 476, 525, 483, 526, 523, 550, 553, 555, 569, 557,
- /* 280 */ 556, 633, 638, 639, 640, 641, 642, 567, 635, 574,
- /* 290 */ 506, 537, 537, 637, 512, 520, 537, 650, 651, 547,
- /* 300 */ 537, 653, 654, 655, 656, 658, 659, 660, 661, 662,
- /* 310 */ 663, 664, 665, 666, 667, 668, 669, 670, 562, 595,
- /* 320 */ 657, 671, 618, 620, 681,
+ /* 130 */ 100, 100, 100, 100, 100, 100, 100, 100, 100, 414,
+ /* 140 */ 414, 414, 364, 364, 364, 414, 364, 414, 368, 367,
+ /* 150 */ 381, 389, 387, 420, 423, 432, 437, 426, 414, 414,
+ /* 160 */ 414, 378, 17, 17, 414, 414, 397, 472, 513, 477,
+ /* 170 */ 476, 512, 479, 484, 378, 414, 492, 492, 414, 492,
+ /* 180 */ 414, 492, 414, 696, 696, 52, 79, 106, 79, 79,
+ /* 190 */ 132, 188, 230, 230, 230, 230, 253, 270, 303, 353,
+ /* 200 */ 353, 353, 353, 149, 84, 201, 201, 59, 156, 205,
+ /* 210 */ 268, 283, 289, 291, 292, 294, 297, 405, 408, 382,
+ /* 220 */ 318, 314, 274, 300, 306, 307, 308, 316, 321, 285,
+ /* 230 */ 281, 295, 298, 323, 301, 441, 442, 373, 391, 569,
+ /* 240 */ 427, 570, 572, 433, 578, 579, 490, 493, 447, 471,
+ /* 250 */ 478, 480, 473, 482, 497, 502, 504, 509, 506, 515,
+ /* 260 */ 620, 516, 517, 519, 508, 499, 518, 503, 521, 520,
+ /* 270 */ 522, 524, 478, 525, 523, 527, 526, 560, 556, 558,
+ /* 280 */ 571, 559, 561, 636, 641, 642, 643, 644, 645, 573,
+ /* 290 */ 637, 575, 511, 537, 537, 640, 514, 528, 537, 653,
+ /* 300 */ 654, 550, 537, 656, 657, 658, 659, 660, 661, 662,
+ /* 310 */ 663, 664, 665, 667, 668, 669, 670, 671, 672, 673,
+ /* 320 */ 565, 598, 666, 674, 621, 623, 681,
};
-#define YY_REDUCE_COUNT (183)
-#define YY_REDUCE_MIN (-252)
-#define YY_REDUCE_MAX (421)
+#define YY_REDUCE_COUNT (184)
+#define YY_REDUCE_MIN (-253)
+#define YY_REDUCE_MAX (415)
static const short yy_reduce_ofst[] = {
- /* 0 */ 133, -24, -24, 70, 70, -189, -232, -218, -163, -178,
- /* 10 */ -123, -126, -96, -83, -4, 25, 123, -193, -188, -252,
- /* 20 */ -150, -88, -77, -71, -175, -16, -29, 17, 14, -27,
- /* 30 */ 102, 154, 166, 152, -35, -191, 42, 185, 50, 23,
- /* 40 */ 155, -247, -235, -225, -219, -107, -37, -13, 12, 86,
- /* 50 */ 153, 158, 168, 173, 183, 196, 197, 198, 199, 200,
- /* 60 */ 201, 45, 218, 228, 229, 230, 231, 232, 233, 234,
- /* 70 */ 271, 274, 212, 275, 236, 238, 278, 283, 284, 205,
- /* 80 */ 208, 239, 242, 292, 294, 296, 297, 301, 304, 305,
- /* 90 */ 307, 308, 310, 313, 314, 317, 318, 319, 320, 321,
- /* 100 */ 322, 323, 324, 325, 326, 329, 330, 331, 334, 335,
- /* 110 */ 336, 337, 338, 339, 340, 341, 342, 343, 344, 345,
- /* 120 */ 346, 347, 348, 349, 350, 351, 352, 353, 354, 355,
- /* 130 */ 356, 357, 358, 359, 360, 361, 362, 363, 279, 281,
- /* 140 */ 286, 224, 225, 226, 364, 247, 366, 241, 243, 240,
- /* 150 */ 246, 250, 372, 374, 373, 377, 379, 375, 376, 380,
- /* 160 */ 256, 382, 383, 386, 389, 387, 391, 388, 394, 392,
- /* 170 */ 397, 395, 400, 393, 411, 412, 413, 415, 416, 418,
- /* 180 */ 419, 421, 406, 414,
+ /* 0 */ 144, -25, -25, 86, 86, -190, -233, -219, -164, -179,
+ /* 10 */ -124, -127, -97, -84, 60, 124, 160, -194, -189, -253,
+ /* 20 */ -151, -89, -50, 35, -176, 14, -100, 12, 65, 19,
+ /* 30 */ -79, 102, 125, -31, 116, -192, 142, 164, 68, 82,
+ /* 40 */ 133, -248, -236, -226, -220, -88, -35, 31, 77, 93,
+ /* 50 */ 134, 170, 173, 181, 184, 187, 190, 195, 198, 202,
+ /* 60 */ 203, 21, 118, 141, 226, 229, 232, 233, 234, 235,
+ /* 70 */ 266, 267, 273, 214, 275, 236, 237, 276, 277, 278,
+ /* 80 */ 215, 216, 238, 239, 286, 287, 288, 290, 293, 296,
+ /* 90 */ 299, 302, 304, 305, 309, 310, 311, 312, 313, 315,
+ /* 100 */ 317, 319, 320, 322, 324, 325, 326, 327, 328, 329,
+ /* 110 */ 330, 331, 332, 333, 334, 335, 336, 337, 338, 339,
+ /* 120 */ 340, 341, 342, 343, 344, 345, 346, 347, 348, 349,
+ /* 130 */ 350, 352, 354, 355, 356, 357, 358, 359, 360, 361,
+ /* 140 */ 362, 363, 225, 244, 250, 365, 252, 366, 240, 245,
+ /* 150 */ 248, 246, 369, 371, 247, 370, 372, 376, 374, 375,
+ /* 160 */ 377, 259, 379, 380, 383, 386, 384, 388, 385, 392,
+ /* 170 */ 393, 390, 395, 396, 394, 398, 404, 409, 399, 410,
+ /* 180 */ 412, 413, 415, 403, 411,
};
static const YYACTIONTYPE yy_default[] = {
- /* 0 */ 787, 903, 847, 915, 835, 844, 1043, 1043, 787, 787,
- /* 10 */ 787, 787, 787, 787, 787, 787, 787, 962, 807, 1043,
- /* 20 */ 787, 787, 787, 787, 787, 787, 787, 787, 787, 844,
- /* 30 */ 787, 787, 787, 787, 852, 844, 852, 852, 957, 887,
- /* 40 */ 905, 787, 787, 787, 787, 787, 787, 787, 787, 787,
- /* 50 */ 787, 787, 787, 787, 787, 787, 787, 787, 787, 787,
- /* 60 */ 787, 787, 787, 787, 787, 787, 787, 787, 787, 787,
- /* 70 */ 787, 787, 964, 967, 787, 787, 969, 787, 787, 989,
- /* 80 */ 989, 955, 787, 787, 787, 787, 787, 787, 787, 787,
- /* 90 */ 787, 787, 787, 787, 787, 787, 787, 787, 787, 787,
- /* 100 */ 787, 787, 787, 787, 787, 787, 787, 787, 787, 787,
- /* 110 */ 787, 787, 787, 787, 833, 787, 831, 787, 787, 787,
- /* 120 */ 787, 787, 787, 787, 787, 787, 787, 787, 787, 787,
- /* 130 */ 787, 787, 817, 787, 787, 787, 787, 787, 809, 809,
- /* 140 */ 809, 787, 787, 787, 809, 787, 809, 996, 1000, 994,
- /* 150 */ 982, 990, 981, 977, 975, 974, 1004, 809, 809, 809,
- /* 160 */ 848, 844, 844, 809, 809, 868, 866, 864, 856, 862,
- /* 170 */ 858, 860, 854, 836, 809, 842, 842, 809, 842, 809,
- /* 180 */ 842, 809, 887, 905, 787, 1005, 787, 1042, 995, 1032,
- /* 190 */ 1031, 1038, 1030, 1029, 1028, 787, 787, 787, 1024, 1025,
- /* 200 */ 1027, 1026, 787, 787, 1034, 1033, 787, 787, 787, 787,
- /* 210 */ 787, 787, 787, 787, 787, 787, 787, 787, 787, 1007,
- /* 220 */ 787, 1001, 997, 787, 787, 787, 787, 787, 787, 787,
- /* 230 */ 787, 787, 917, 787, 787, 787, 787, 787, 787, 787,
- /* 240 */ 787, 787, 787, 787, 787, 787, 787, 954, 787, 787,
- /* 250 */ 787, 787, 965, 787, 787, 787, 787, 787, 787, 787,
- /* 260 */ 787, 787, 991, 787, 983, 787, 787, 787, 787, 787,
- /* 270 */ 929, 787, 787, 787, 787, 787, 787, 787, 787, 787,
- /* 280 */ 787, 787, 787, 787, 787, 787, 787, 787, 787, 787,
- /* 290 */ 787, 1053, 1051, 787, 787, 787, 1047, 787, 787, 787,
- /* 300 */ 1045, 787, 787, 787, 787, 787, 787, 787, 787, 787,
- /* 310 */ 787, 787, 787, 787, 787, 787, 787, 787, 871, 787,
- /* 320 */ 815, 813, 787, 805, 787,
+ /* 0 */ 791, 907, 851, 919, 839, 848, 1047, 1047, 791, 791,
+ /* 10 */ 791, 791, 791, 791, 791, 791, 791, 966, 811, 1047,
+ /* 20 */ 791, 791, 791, 791, 791, 791, 791, 791, 791, 848,
+ /* 30 */ 791, 791, 791, 791, 856, 848, 856, 856, 961, 891,
+ /* 40 */ 909, 791, 791, 791, 791, 791, 791, 791, 791, 791,
+ /* 50 */ 791, 791, 791, 791, 791, 791, 791, 791, 791, 791,
+ /* 60 */ 791, 791, 791, 791, 791, 791, 791, 791, 791, 791,
+ /* 70 */ 791, 791, 791, 968, 971, 791, 791, 973, 791, 791,
+ /* 80 */ 993, 993, 959, 791, 791, 791, 791, 791, 791, 791,
+ /* 90 */ 791, 791, 791, 791, 791, 791, 791, 791, 791, 791,
+ /* 100 */ 791, 791, 791, 791, 791, 791, 791, 791, 791, 791,
+ /* 110 */ 791, 791, 791, 791, 791, 837, 791, 835, 791, 791,
+ /* 120 */ 791, 791, 791, 791, 791, 791, 791, 791, 791, 791,
+ /* 130 */ 791, 791, 791, 821, 791, 791, 791, 791, 791, 813,
+ /* 140 */ 813, 813, 791, 791, 791, 813, 791, 813, 1000, 1004,
+ /* 150 */ 998, 986, 994, 985, 981, 979, 978, 1008, 813, 813,
+ /* 160 */ 813, 852, 848, 848, 813, 813, 872, 870, 868, 860,
+ /* 170 */ 866, 862, 864, 858, 840, 813, 846, 846, 813, 846,
+ /* 180 */ 813, 846, 813, 891, 909, 791, 1009, 791, 1046, 999,
+ /* 190 */ 1036, 1035, 1042, 1034, 1033, 1032, 791, 791, 791, 1028,
+ /* 200 */ 1029, 1031, 1030, 791, 791, 1038, 1037, 791, 791, 791,
+ /* 210 */ 791, 791, 791, 791, 791, 791, 791, 791, 791, 791,
+ /* 220 */ 1011, 791, 1005, 1001, 791, 791, 791, 791, 791, 791,
+ /* 230 */ 791, 791, 791, 921, 791, 791, 791, 791, 791, 791,
+ /* 240 */ 791, 791, 791, 791, 791, 791, 791, 791, 791, 958,
+ /* 250 */ 791, 791, 791, 791, 969, 791, 791, 791, 791, 791,
+ /* 260 */ 791, 791, 791, 791, 995, 791, 987, 791, 791, 791,
+ /* 270 */ 791, 791, 933, 791, 791, 791, 791, 791, 791, 791,
+ /* 280 */ 791, 791, 791, 791, 791, 791, 791, 791, 791, 791,
+ /* 290 */ 791, 791, 791, 1058, 1056, 791, 791, 791, 1052, 791,
+ /* 300 */ 791, 791, 1050, 791, 791, 791, 791, 791, 791, 791,
+ /* 310 */ 791, 791, 791, 791, 791, 791, 791, 791, 791, 791,
+ /* 320 */ 875, 791, 819, 817, 791, 809, 791,
};
/********** End of lemon-generated parsing tables *****************************/
@@ -634,6 +634,7 @@ static const YYCODETYPE yyFallback[] = {
1, /* NOW => ID */
0, /* RESET => nothing */
0, /* QUERY => nothing */
+ 0, /* SYNCDB => nothing */
0, /* ADD => nothing */
0, /* COLUMN => nothing */
0, /* TAG => nothing */
@@ -911,131 +912,132 @@ static const char *const yyTokenName[] = {
/* 137 */ "NOW",
/* 138 */ "RESET",
/* 139 */ "QUERY",
- /* 140 */ "ADD",
- /* 141 */ "COLUMN",
- /* 142 */ "TAG",
- /* 143 */ "CHANGE",
- /* 144 */ "SET",
- /* 145 */ "KILL",
- /* 146 */ "CONNECTION",
- /* 147 */ "STREAM",
- /* 148 */ "COLON",
- /* 149 */ "ABORT",
- /* 150 */ "AFTER",
- /* 151 */ "ATTACH",
- /* 152 */ "BEFORE",
- /* 153 */ "BEGIN",
- /* 154 */ "CASCADE",
- /* 155 */ "CLUSTER",
- /* 156 */ "CONFLICT",
- /* 157 */ "COPY",
- /* 158 */ "DEFERRED",
- /* 159 */ "DELIMITERS",
- /* 160 */ "DETACH",
- /* 161 */ "EACH",
- /* 162 */ "END",
- /* 163 */ "EXPLAIN",
- /* 164 */ "FAIL",
- /* 165 */ "FOR",
- /* 166 */ "IGNORE",
- /* 167 */ "IMMEDIATE",
- /* 168 */ "INITIALLY",
- /* 169 */ "INSTEAD",
- /* 170 */ "MATCH",
- /* 171 */ "KEY",
- /* 172 */ "OF",
- /* 173 */ "RAISE",
- /* 174 */ "REPLACE",
- /* 175 */ "RESTRICT",
- /* 176 */ "ROW",
- /* 177 */ "STATEMENT",
- /* 178 */ "TRIGGER",
- /* 179 */ "VIEW",
- /* 180 */ "SEMI",
- /* 181 */ "NONE",
- /* 182 */ "PREV",
- /* 183 */ "LINEAR",
- /* 184 */ "IMPORT",
- /* 185 */ "TBNAME",
- /* 186 */ "JOIN",
- /* 187 */ "INSERT",
- /* 188 */ "INTO",
- /* 189 */ "VALUES",
- /* 190 */ "program",
- /* 191 */ "cmd",
- /* 192 */ "dbPrefix",
- /* 193 */ "ids",
- /* 194 */ "cpxName",
- /* 195 */ "ifexists",
- /* 196 */ "alter_db_optr",
- /* 197 */ "alter_topic_optr",
- /* 198 */ "acct_optr",
- /* 199 */ "ifnotexists",
- /* 200 */ "db_optr",
- /* 201 */ "topic_optr",
- /* 202 */ "typename",
- /* 203 */ "pps",
- /* 204 */ "tseries",
- /* 205 */ "dbs",
- /* 206 */ "streams",
- /* 207 */ "storage",
- /* 208 */ "qtime",
- /* 209 */ "users",
- /* 210 */ "conns",
- /* 211 */ "state",
- /* 212 */ "keep",
- /* 213 */ "tagitemlist",
- /* 214 */ "cache",
- /* 215 */ "replica",
- /* 216 */ "quorum",
- /* 217 */ "days",
- /* 218 */ "minrows",
- /* 219 */ "maxrows",
- /* 220 */ "blocks",
- /* 221 */ "ctime",
- /* 222 */ "wal",
- /* 223 */ "fsync",
- /* 224 */ "comp",
- /* 225 */ "prec",
- /* 226 */ "update",
- /* 227 */ "cachelast",
- /* 228 */ "partitions",
- /* 229 */ "signed",
- /* 230 */ "create_table_args",
- /* 231 */ "create_stable_args",
- /* 232 */ "create_table_list",
- /* 233 */ "create_from_stable",
- /* 234 */ "columnlist",
- /* 235 */ "tagNamelist",
- /* 236 */ "select",
- /* 237 */ "column",
- /* 238 */ "tagitem",
- /* 239 */ "selcollist",
- /* 240 */ "from",
- /* 241 */ "where_opt",
- /* 242 */ "interval_opt",
- /* 243 */ "session_option",
- /* 244 */ "fill_opt",
- /* 245 */ "sliding_opt",
- /* 246 */ "groupby_opt",
- /* 247 */ "orderby_opt",
- /* 248 */ "having_opt",
- /* 249 */ "slimit_opt",
- /* 250 */ "limit_opt",
- /* 251 */ "union",
- /* 252 */ "sclp",
- /* 253 */ "distinct",
- /* 254 */ "expr",
- /* 255 */ "as",
- /* 256 */ "tablelist",
- /* 257 */ "tmvar",
- /* 258 */ "sortlist",
- /* 259 */ "sortitem",
- /* 260 */ "item",
- /* 261 */ "sortorder",
- /* 262 */ "grouplist",
- /* 263 */ "exprlist",
- /* 264 */ "expritem",
+ /* 140 */ "SYNCDB",
+ /* 141 */ "ADD",
+ /* 142 */ "COLUMN",
+ /* 143 */ "TAG",
+ /* 144 */ "CHANGE",
+ /* 145 */ "SET",
+ /* 146 */ "KILL",
+ /* 147 */ "CONNECTION",
+ /* 148 */ "STREAM",
+ /* 149 */ "COLON",
+ /* 150 */ "ABORT",
+ /* 151 */ "AFTER",
+ /* 152 */ "ATTACH",
+ /* 153 */ "BEFORE",
+ /* 154 */ "BEGIN",
+ /* 155 */ "CASCADE",
+ /* 156 */ "CLUSTER",
+ /* 157 */ "CONFLICT",
+ /* 158 */ "COPY",
+ /* 159 */ "DEFERRED",
+ /* 160 */ "DELIMITERS",
+ /* 161 */ "DETACH",
+ /* 162 */ "EACH",
+ /* 163 */ "END",
+ /* 164 */ "EXPLAIN",
+ /* 165 */ "FAIL",
+ /* 166 */ "FOR",
+ /* 167 */ "IGNORE",
+ /* 168 */ "IMMEDIATE",
+ /* 169 */ "INITIALLY",
+ /* 170 */ "INSTEAD",
+ /* 171 */ "MATCH",
+ /* 172 */ "KEY",
+ /* 173 */ "OF",
+ /* 174 */ "RAISE",
+ /* 175 */ "REPLACE",
+ /* 176 */ "RESTRICT",
+ /* 177 */ "ROW",
+ /* 178 */ "STATEMENT",
+ /* 179 */ "TRIGGER",
+ /* 180 */ "VIEW",
+ /* 181 */ "SEMI",
+ /* 182 */ "NONE",
+ /* 183 */ "PREV",
+ /* 184 */ "LINEAR",
+ /* 185 */ "IMPORT",
+ /* 186 */ "TBNAME",
+ /* 187 */ "JOIN",
+ /* 188 */ "INSERT",
+ /* 189 */ "INTO",
+ /* 190 */ "VALUES",
+ /* 191 */ "program",
+ /* 192 */ "cmd",
+ /* 193 */ "dbPrefix",
+ /* 194 */ "ids",
+ /* 195 */ "cpxName",
+ /* 196 */ "ifexists",
+ /* 197 */ "alter_db_optr",
+ /* 198 */ "alter_topic_optr",
+ /* 199 */ "acct_optr",
+ /* 200 */ "ifnotexists",
+ /* 201 */ "db_optr",
+ /* 202 */ "topic_optr",
+ /* 203 */ "typename",
+ /* 204 */ "pps",
+ /* 205 */ "tseries",
+ /* 206 */ "dbs",
+ /* 207 */ "streams",
+ /* 208 */ "storage",
+ /* 209 */ "qtime",
+ /* 210 */ "users",
+ /* 211 */ "conns",
+ /* 212 */ "state",
+ /* 213 */ "keep",
+ /* 214 */ "tagitemlist",
+ /* 215 */ "cache",
+ /* 216 */ "replica",
+ /* 217 */ "quorum",
+ /* 218 */ "days",
+ /* 219 */ "minrows",
+ /* 220 */ "maxrows",
+ /* 221 */ "blocks",
+ /* 222 */ "ctime",
+ /* 223 */ "wal",
+ /* 224 */ "fsync",
+ /* 225 */ "comp",
+ /* 226 */ "prec",
+ /* 227 */ "update",
+ /* 228 */ "cachelast",
+ /* 229 */ "partitions",
+ /* 230 */ "signed",
+ /* 231 */ "create_table_args",
+ /* 232 */ "create_stable_args",
+ /* 233 */ "create_table_list",
+ /* 234 */ "create_from_stable",
+ /* 235 */ "columnlist",
+ /* 236 */ "tagNamelist",
+ /* 237 */ "select",
+ /* 238 */ "column",
+ /* 239 */ "tagitem",
+ /* 240 */ "selcollist",
+ /* 241 */ "from",
+ /* 242 */ "where_opt",
+ /* 243 */ "interval_opt",
+ /* 244 */ "session_option",
+ /* 245 */ "fill_opt",
+ /* 246 */ "sliding_opt",
+ /* 247 */ "groupby_opt",
+ /* 248 */ "orderby_opt",
+ /* 249 */ "having_opt",
+ /* 250 */ "slimit_opt",
+ /* 251 */ "limit_opt",
+ /* 252 */ "union",
+ /* 253 */ "sclp",
+ /* 254 */ "distinct",
+ /* 255 */ "expr",
+ /* 256 */ "as",
+ /* 257 */ "tablelist",
+ /* 258 */ "tmvar",
+ /* 259 */ "sortlist",
+ /* 260 */ "sortitem",
+ /* 261 */ "item",
+ /* 262 */ "sortorder",
+ /* 263 */ "grouplist",
+ /* 264 */ "exprlist",
+ /* 265 */ "expritem",
};
#endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
@@ -1298,20 +1300,21 @@ static const char *const yyRuleName[] = {
/* 252 */ "expritem ::= expr",
/* 253 */ "expritem ::=",
/* 254 */ "cmd ::= RESET QUERY CACHE",
- /* 255 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist",
- /* 256 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids",
- /* 257 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist",
- /* 258 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids",
- /* 259 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids",
- /* 260 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem",
- /* 261 */ "cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist",
- /* 262 */ "cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids",
- /* 263 */ "cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist",
- /* 264 */ "cmd ::= ALTER STABLE ids cpxName DROP TAG ids",
- /* 265 */ "cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids",
- /* 266 */ "cmd ::= KILL CONNECTION INTEGER",
- /* 267 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER",
- /* 268 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER",
+ /* 255 */ "cmd ::= SYNCDB ids REPLICA",
+ /* 256 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist",
+ /* 257 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids",
+ /* 258 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist",
+ /* 259 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids",
+ /* 260 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids",
+ /* 261 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem",
+ /* 262 */ "cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist",
+ /* 263 */ "cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids",
+ /* 264 */ "cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist",
+ /* 265 */ "cmd ::= ALTER STABLE ids cpxName DROP TAG ids",
+ /* 266 */ "cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids",
+ /* 267 */ "cmd ::= KILL CONNECTION INTEGER",
+ /* 268 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER",
+ /* 269 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER",
};
#endif /* NDEBUG */
@@ -1437,52 +1440,52 @@ static void yy_destructor(
** inside the C code.
*/
/********* Begin destructor definitions ***************************************/
- case 212: /* keep */
- case 213: /* tagitemlist */
- case 234: /* columnlist */
- case 235: /* tagNamelist */
- case 244: /* fill_opt */
- case 246: /* groupby_opt */
- case 247: /* orderby_opt */
- case 258: /* sortlist */
- case 262: /* grouplist */
+ case 213: /* keep */
+ case 214: /* tagitemlist */
+ case 235: /* columnlist */
+ case 236: /* tagNamelist */
+ case 245: /* fill_opt */
+ case 247: /* groupby_opt */
+ case 248: /* orderby_opt */
+ case 259: /* sortlist */
+ case 263: /* grouplist */
{
-taosArrayDestroy((yypminor->yy291));
+taosArrayDestroy((yypminor->yy193));
}
break;
- case 232: /* create_table_list */
+ case 233: /* create_table_list */
{
-destroyCreateTableSql((yypminor->yy412));
+destroyCreateTableSql((yypminor->yy270));
}
break;
- case 236: /* select */
+ case 237: /* select */
{
-destroyQuerySqlNode((yypminor->yy110));
+destroyQuerySqlNode((yypminor->yy286));
}
break;
- case 239: /* selcollist */
- case 252: /* sclp */
- case 263: /* exprlist */
+ case 240: /* selcollist */
+ case 253: /* sclp */
+ case 264: /* exprlist */
{
-tSqlExprListDestroy((yypminor->yy291));
+tSqlExprListDestroy((yypminor->yy193));
}
break;
- case 241: /* where_opt */
- case 248: /* having_opt */
- case 254: /* expr */
- case 264: /* expritem */
+ case 242: /* where_opt */
+ case 249: /* having_opt */
+ case 255: /* expr */
+ case 265: /* expritem */
{
-tSqlExprDestroy((yypminor->yy436));
+tSqlExprDestroy((yypminor->yy454));
}
break;
- case 251: /* union */
+ case 252: /* union */
{
-destroyAllSelectClause((yypminor->yy154));
+destroyAllSelectClause((yypminor->yy21));
}
break;
- case 259: /* sortitem */
+ case 260: /* sortitem */
{
-tVariantDestroy(&(yypminor->yy216));
+tVariantDestroy(&(yypminor->yy442));
}
break;
/********* End destructor definitions *****************************************/
@@ -1771,275 +1774,276 @@ static void yy_shift(
/* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side
** of that rule */
static const YYCODETYPE yyRuleInfoLhs[] = {
- 190, /* (0) program ::= cmd */
- 191, /* (1) cmd ::= SHOW DATABASES */
- 191, /* (2) cmd ::= SHOW TOPICS */
- 191, /* (3) cmd ::= SHOW FUNCTIONS */
- 191, /* (4) cmd ::= SHOW MNODES */
- 191, /* (5) cmd ::= SHOW DNODES */
- 191, /* (6) cmd ::= SHOW ACCOUNTS */
- 191, /* (7) cmd ::= SHOW USERS */
- 191, /* (8) cmd ::= SHOW MODULES */
- 191, /* (9) cmd ::= SHOW QUERIES */
- 191, /* (10) cmd ::= SHOW CONNECTIONS */
- 191, /* (11) cmd ::= SHOW STREAMS */
- 191, /* (12) cmd ::= SHOW VARIABLES */
- 191, /* (13) cmd ::= SHOW SCORES */
- 191, /* (14) cmd ::= SHOW GRANTS */
- 191, /* (15) cmd ::= SHOW VNODES */
- 191, /* (16) cmd ::= SHOW VNODES IPTOKEN */
- 192, /* (17) dbPrefix ::= */
- 192, /* (18) dbPrefix ::= ids DOT */
- 194, /* (19) cpxName ::= */
- 194, /* (20) cpxName ::= DOT ids */
- 191, /* (21) cmd ::= SHOW CREATE TABLE ids cpxName */
- 191, /* (22) cmd ::= SHOW CREATE DATABASE ids */
- 191, /* (23) cmd ::= SHOW dbPrefix TABLES */
- 191, /* (24) cmd ::= SHOW dbPrefix TABLES LIKE ids */
- 191, /* (25) cmd ::= SHOW dbPrefix STABLES */
- 191, /* (26) cmd ::= SHOW dbPrefix STABLES LIKE ids */
- 191, /* (27) cmd ::= SHOW dbPrefix VGROUPS */
- 191, /* (28) cmd ::= SHOW dbPrefix VGROUPS ids */
- 191, /* (29) cmd ::= DROP TABLE ifexists ids cpxName */
- 191, /* (30) cmd ::= DROP STABLE ifexists ids cpxName */
- 191, /* (31) cmd ::= DROP DATABASE ifexists ids */
- 191, /* (32) cmd ::= DROP TOPIC ifexists ids */
- 191, /* (33) cmd ::= DROP FUNCTION ids */
- 191, /* (34) cmd ::= DROP DNODE ids */
- 191, /* (35) cmd ::= DROP USER ids */
- 191, /* (36) cmd ::= DROP ACCOUNT ids */
- 191, /* (37) cmd ::= USE ids */
- 191, /* (38) cmd ::= DESCRIBE ids cpxName */
- 191, /* (39) cmd ::= ALTER USER ids PASS ids */
- 191, /* (40) cmd ::= ALTER USER ids PRIVILEGE ids */
- 191, /* (41) cmd ::= ALTER DNODE ids ids */
- 191, /* (42) cmd ::= ALTER DNODE ids ids ids */
- 191, /* (43) cmd ::= ALTER LOCAL ids */
- 191, /* (44) cmd ::= ALTER LOCAL ids ids */
- 191, /* (45) cmd ::= ALTER DATABASE ids alter_db_optr */
- 191, /* (46) cmd ::= ALTER TOPIC ids alter_topic_optr */
- 191, /* (47) cmd ::= ALTER ACCOUNT ids acct_optr */
- 191, /* (48) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */
- 193, /* (49) ids ::= ID */
- 193, /* (50) ids ::= STRING */
- 195, /* (51) ifexists ::= IF EXISTS */
- 195, /* (52) ifexists ::= */
- 199, /* (53) ifnotexists ::= IF NOT EXISTS */
- 199, /* (54) ifnotexists ::= */
- 191, /* (55) cmd ::= CREATE DNODE ids */
- 191, /* (56) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */
- 191, /* (57) cmd ::= CREATE DATABASE ifnotexists ids db_optr */
- 191, /* (58) cmd ::= CREATE TOPIC ifnotexists ids topic_optr */
- 191, /* (59) cmd ::= CREATE FUNCTION ids AS ids OUTPUTTYPE typename */
- 191, /* (60) cmd ::= CREATE AGGREGATE FUNCTION ids AS ids OUTPUTTYPE typename */
- 191, /* (61) cmd ::= CREATE USER ids PASS ids */
- 203, /* (62) pps ::= */
- 203, /* (63) pps ::= PPS INTEGER */
- 204, /* (64) tseries ::= */
- 204, /* (65) tseries ::= TSERIES INTEGER */
- 205, /* (66) dbs ::= */
- 205, /* (67) dbs ::= DBS INTEGER */
- 206, /* (68) streams ::= */
- 206, /* (69) streams ::= STREAMS INTEGER */
- 207, /* (70) storage ::= */
- 207, /* (71) storage ::= STORAGE INTEGER */
- 208, /* (72) qtime ::= */
- 208, /* (73) qtime ::= QTIME INTEGER */
- 209, /* (74) users ::= */
- 209, /* (75) users ::= USERS INTEGER */
- 210, /* (76) conns ::= */
- 210, /* (77) conns ::= CONNS INTEGER */
- 211, /* (78) state ::= */
- 211, /* (79) state ::= STATE ids */
- 198, /* (80) acct_optr ::= pps tseries storage streams qtime dbs users conns state */
- 212, /* (81) keep ::= KEEP tagitemlist */
- 214, /* (82) cache ::= CACHE INTEGER */
- 215, /* (83) replica ::= REPLICA INTEGER */
- 216, /* (84) quorum ::= QUORUM INTEGER */
- 217, /* (85) days ::= DAYS INTEGER */
- 218, /* (86) minrows ::= MINROWS INTEGER */
- 219, /* (87) maxrows ::= MAXROWS INTEGER */
- 220, /* (88) blocks ::= BLOCKS INTEGER */
- 221, /* (89) ctime ::= CTIME INTEGER */
- 222, /* (90) wal ::= WAL INTEGER */
- 223, /* (91) fsync ::= FSYNC INTEGER */
- 224, /* (92) comp ::= COMP INTEGER */
- 225, /* (93) prec ::= PRECISION STRING */
- 226, /* (94) update ::= UPDATE INTEGER */
- 227, /* (95) cachelast ::= CACHELAST INTEGER */
- 228, /* (96) partitions ::= PARTITIONS INTEGER */
- 200, /* (97) db_optr ::= */
- 200, /* (98) db_optr ::= db_optr cache */
- 200, /* (99) db_optr ::= db_optr replica */
- 200, /* (100) db_optr ::= db_optr quorum */
- 200, /* (101) db_optr ::= db_optr days */
- 200, /* (102) db_optr ::= db_optr minrows */
- 200, /* (103) db_optr ::= db_optr maxrows */
- 200, /* (104) db_optr ::= db_optr blocks */
- 200, /* (105) db_optr ::= db_optr ctime */
- 200, /* (106) db_optr ::= db_optr wal */
- 200, /* (107) db_optr ::= db_optr fsync */
- 200, /* (108) db_optr ::= db_optr comp */
- 200, /* (109) db_optr ::= db_optr prec */
- 200, /* (110) db_optr ::= db_optr keep */
- 200, /* (111) db_optr ::= db_optr update */
- 200, /* (112) db_optr ::= db_optr cachelast */
- 201, /* (113) topic_optr ::= db_optr */
- 201, /* (114) topic_optr ::= topic_optr partitions */
- 196, /* (115) alter_db_optr ::= */
- 196, /* (116) alter_db_optr ::= alter_db_optr replica */
- 196, /* (117) alter_db_optr ::= alter_db_optr quorum */
- 196, /* (118) alter_db_optr ::= alter_db_optr keep */
- 196, /* (119) alter_db_optr ::= alter_db_optr blocks */
- 196, /* (120) alter_db_optr ::= alter_db_optr comp */
- 196, /* (121) alter_db_optr ::= alter_db_optr wal */
- 196, /* (122) alter_db_optr ::= alter_db_optr fsync */
- 196, /* (123) alter_db_optr ::= alter_db_optr update */
- 196, /* (124) alter_db_optr ::= alter_db_optr cachelast */
- 197, /* (125) alter_topic_optr ::= alter_db_optr */
- 197, /* (126) alter_topic_optr ::= alter_topic_optr partitions */
- 202, /* (127) typename ::= ids */
- 202, /* (128) typename ::= ids LP signed RP */
- 202, /* (129) typename ::= ids UNSIGNED */
- 229, /* (130) signed ::= INTEGER */
- 229, /* (131) signed ::= PLUS INTEGER */
- 229, /* (132) signed ::= MINUS INTEGER */
- 191, /* (133) cmd ::= CREATE TABLE create_table_args */
- 191, /* (134) cmd ::= CREATE TABLE create_stable_args */
- 191, /* (135) cmd ::= CREATE STABLE create_stable_args */
- 191, /* (136) cmd ::= CREATE TABLE create_table_list */
- 232, /* (137) create_table_list ::= create_from_stable */
- 232, /* (138) create_table_list ::= create_table_list create_from_stable */
- 230, /* (139) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */
- 231, /* (140) create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */
- 233, /* (141) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */
- 233, /* (142) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */
- 235, /* (143) tagNamelist ::= tagNamelist COMMA ids */
- 235, /* (144) tagNamelist ::= ids */
- 230, /* (145) create_table_args ::= ifnotexists ids cpxName AS select */
- 234, /* (146) columnlist ::= columnlist COMMA column */
- 234, /* (147) columnlist ::= column */
- 237, /* (148) column ::= ids typename */
- 213, /* (149) tagitemlist ::= tagitemlist COMMA tagitem */
- 213, /* (150) tagitemlist ::= tagitem */
- 238, /* (151) tagitem ::= INTEGER */
- 238, /* (152) tagitem ::= FLOAT */
- 238, /* (153) tagitem ::= STRING */
- 238, /* (154) tagitem ::= BOOL */
- 238, /* (155) tagitem ::= NULL */
- 238, /* (156) tagitem ::= MINUS INTEGER */
- 238, /* (157) tagitem ::= MINUS FLOAT */
- 238, /* (158) tagitem ::= PLUS INTEGER */
- 238, /* (159) tagitem ::= PLUS FLOAT */
- 236, /* (160) select ::= SELECT selcollist from where_opt interval_opt session_option fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */
- 236, /* (161) select ::= LP select RP */
- 251, /* (162) union ::= select */
- 251, /* (163) union ::= union UNION ALL select */
- 191, /* (164) cmd ::= union */
- 236, /* (165) select ::= SELECT selcollist */
- 252, /* (166) sclp ::= selcollist COMMA */
- 252, /* (167) sclp ::= */
- 239, /* (168) selcollist ::= sclp distinct expr as */
- 239, /* (169) selcollist ::= sclp STAR */
- 255, /* (170) as ::= AS ids */
- 255, /* (171) as ::= ids */
- 255, /* (172) as ::= */
- 253, /* (173) distinct ::= DISTINCT */
- 253, /* (174) distinct ::= */
- 240, /* (175) from ::= FROM tablelist */
- 240, /* (176) from ::= FROM LP union RP */
- 256, /* (177) tablelist ::= ids cpxName */
- 256, /* (178) tablelist ::= ids cpxName ids */
- 256, /* (179) tablelist ::= tablelist COMMA ids cpxName */
- 256, /* (180) tablelist ::= tablelist COMMA ids cpxName ids */
- 257, /* (181) tmvar ::= VARIABLE */
- 242, /* (182) interval_opt ::= INTERVAL LP tmvar RP */
- 242, /* (183) interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */
- 242, /* (184) interval_opt ::= */
- 243, /* (185) session_option ::= */
- 243, /* (186) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */
- 244, /* (187) fill_opt ::= */
- 244, /* (188) fill_opt ::= FILL LP ID COMMA tagitemlist RP */
- 244, /* (189) fill_opt ::= FILL LP ID RP */
- 245, /* (190) sliding_opt ::= SLIDING LP tmvar RP */
- 245, /* (191) sliding_opt ::= */
- 247, /* (192) orderby_opt ::= */
- 247, /* (193) orderby_opt ::= ORDER BY sortlist */
- 258, /* (194) sortlist ::= sortlist COMMA item sortorder */
- 258, /* (195) sortlist ::= item sortorder */
- 260, /* (196) item ::= ids cpxName */
- 261, /* (197) sortorder ::= ASC */
- 261, /* (198) sortorder ::= DESC */
- 261, /* (199) sortorder ::= */
- 246, /* (200) groupby_opt ::= */
- 246, /* (201) groupby_opt ::= GROUP BY grouplist */
- 262, /* (202) grouplist ::= grouplist COMMA item */
- 262, /* (203) grouplist ::= item */
- 248, /* (204) having_opt ::= */
- 248, /* (205) having_opt ::= HAVING expr */
- 250, /* (206) limit_opt ::= */
- 250, /* (207) limit_opt ::= LIMIT signed */
- 250, /* (208) limit_opt ::= LIMIT signed OFFSET signed */
- 250, /* (209) limit_opt ::= LIMIT signed COMMA signed */
- 249, /* (210) slimit_opt ::= */
- 249, /* (211) slimit_opt ::= SLIMIT signed */
- 249, /* (212) slimit_opt ::= SLIMIT signed SOFFSET signed */
- 249, /* (213) slimit_opt ::= SLIMIT signed COMMA signed */
- 241, /* (214) where_opt ::= */
- 241, /* (215) where_opt ::= WHERE expr */
- 254, /* (216) expr ::= LP expr RP */
- 254, /* (217) expr ::= ID */
- 254, /* (218) expr ::= ID DOT ID */
- 254, /* (219) expr ::= ID DOT STAR */
- 254, /* (220) expr ::= INTEGER */
- 254, /* (221) expr ::= MINUS INTEGER */
- 254, /* (222) expr ::= PLUS INTEGER */
- 254, /* (223) expr ::= FLOAT */
- 254, /* (224) expr ::= MINUS FLOAT */
- 254, /* (225) expr ::= PLUS FLOAT */
- 254, /* (226) expr ::= STRING */
- 254, /* (227) expr ::= NOW */
- 254, /* (228) expr ::= VARIABLE */
- 254, /* (229) expr ::= BOOL */
- 254, /* (230) expr ::= ID LP exprlist RP */
- 254, /* (231) expr ::= ID LP STAR RP */
- 254, /* (232) expr ::= expr IS NULL */
- 254, /* (233) expr ::= expr IS NOT NULL */
- 254, /* (234) expr ::= expr LT expr */
- 254, /* (235) expr ::= expr GT expr */
- 254, /* (236) expr ::= expr LE expr */
- 254, /* (237) expr ::= expr GE expr */
- 254, /* (238) expr ::= expr NE expr */
- 254, /* (239) expr ::= expr EQ expr */
- 254, /* (240) expr ::= expr BETWEEN expr AND expr */
- 254, /* (241) expr ::= expr AND expr */
- 254, /* (242) expr ::= expr OR expr */
- 254, /* (243) expr ::= expr PLUS expr */
- 254, /* (244) expr ::= expr MINUS expr */
- 254, /* (245) expr ::= expr STAR expr */
- 254, /* (246) expr ::= expr SLASH expr */
- 254, /* (247) expr ::= expr REM expr */
- 254, /* (248) expr ::= expr LIKE expr */
- 254, /* (249) expr ::= expr IN LP exprlist RP */
- 263, /* (250) exprlist ::= exprlist COMMA expritem */
- 263, /* (251) exprlist ::= expritem */
- 264, /* (252) expritem ::= expr */
- 264, /* (253) expritem ::= */
- 191, /* (254) cmd ::= RESET QUERY CACHE */
- 191, /* (255) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
- 191, /* (256) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
- 191, /* (257) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
- 191, /* (258) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
- 191, /* (259) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
- 191, /* (260) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
- 191, /* (261) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */
- 191, /* (262) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */
- 191, /* (263) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */
- 191, /* (264) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */
- 191, /* (265) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */
- 191, /* (266) cmd ::= KILL CONNECTION INTEGER */
- 191, /* (267) cmd ::= KILL STREAM INTEGER COLON INTEGER */
- 191, /* (268) cmd ::= KILL QUERY INTEGER COLON INTEGER */
+ 191, /* (0) program ::= cmd */
+ 192, /* (1) cmd ::= SHOW DATABASES */
+ 192, /* (2) cmd ::= SHOW TOPICS */
+ 192, /* (3) cmd ::= SHOW FUNCTIONS */
+ 192, /* (4) cmd ::= SHOW MNODES */
+ 192, /* (5) cmd ::= SHOW DNODES */
+ 192, /* (6) cmd ::= SHOW ACCOUNTS */
+ 192, /* (7) cmd ::= SHOW USERS */
+ 192, /* (8) cmd ::= SHOW MODULES */
+ 192, /* (9) cmd ::= SHOW QUERIES */
+ 192, /* (10) cmd ::= SHOW CONNECTIONS */
+ 192, /* (11) cmd ::= SHOW STREAMS */
+ 192, /* (12) cmd ::= SHOW VARIABLES */
+ 192, /* (13) cmd ::= SHOW SCORES */
+ 192, /* (14) cmd ::= SHOW GRANTS */
+ 192, /* (15) cmd ::= SHOW VNODES */
+ 192, /* (16) cmd ::= SHOW VNODES IPTOKEN */
+ 193, /* (17) dbPrefix ::= */
+ 193, /* (18) dbPrefix ::= ids DOT */
+ 195, /* (19) cpxName ::= */
+ 195, /* (20) cpxName ::= DOT ids */
+ 192, /* (21) cmd ::= SHOW CREATE TABLE ids cpxName */
+ 192, /* (22) cmd ::= SHOW CREATE DATABASE ids */
+ 192, /* (23) cmd ::= SHOW dbPrefix TABLES */
+ 192, /* (24) cmd ::= SHOW dbPrefix TABLES LIKE ids */
+ 192, /* (25) cmd ::= SHOW dbPrefix STABLES */
+ 192, /* (26) cmd ::= SHOW dbPrefix STABLES LIKE ids */
+ 192, /* (27) cmd ::= SHOW dbPrefix VGROUPS */
+ 192, /* (28) cmd ::= SHOW dbPrefix VGROUPS ids */
+ 192, /* (29) cmd ::= DROP TABLE ifexists ids cpxName */
+ 192, /* (30) cmd ::= DROP STABLE ifexists ids cpxName */
+ 192, /* (31) cmd ::= DROP DATABASE ifexists ids */
+ 192, /* (32) cmd ::= DROP TOPIC ifexists ids */
+ 192, /* (33) cmd ::= DROP FUNCTION ids */
+ 192, /* (34) cmd ::= DROP DNODE ids */
+ 192, /* (35) cmd ::= DROP USER ids */
+ 192, /* (36) cmd ::= DROP ACCOUNT ids */
+ 192, /* (37) cmd ::= USE ids */
+ 192, /* (38) cmd ::= DESCRIBE ids cpxName */
+ 192, /* (39) cmd ::= ALTER USER ids PASS ids */
+ 192, /* (40) cmd ::= ALTER USER ids PRIVILEGE ids */
+ 192, /* (41) cmd ::= ALTER DNODE ids ids */
+ 192, /* (42) cmd ::= ALTER DNODE ids ids ids */
+ 192, /* (43) cmd ::= ALTER LOCAL ids */
+ 192, /* (44) cmd ::= ALTER LOCAL ids ids */
+ 192, /* (45) cmd ::= ALTER DATABASE ids alter_db_optr */
+ 192, /* (46) cmd ::= ALTER TOPIC ids alter_topic_optr */
+ 192, /* (47) cmd ::= ALTER ACCOUNT ids acct_optr */
+ 192, /* (48) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */
+ 194, /* (49) ids ::= ID */
+ 194, /* (50) ids ::= STRING */
+ 196, /* (51) ifexists ::= IF EXISTS */
+ 196, /* (52) ifexists ::= */
+ 200, /* (53) ifnotexists ::= IF NOT EXISTS */
+ 200, /* (54) ifnotexists ::= */
+ 192, /* (55) cmd ::= CREATE DNODE ids */
+ 192, /* (56) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */
+ 192, /* (57) cmd ::= CREATE DATABASE ifnotexists ids db_optr */
+ 192, /* (58) cmd ::= CREATE TOPIC ifnotexists ids topic_optr */
+ 192, /* (59) cmd ::= CREATE FUNCTION ids AS ids OUTPUTTYPE typename */
+ 192, /* (60) cmd ::= CREATE AGGREGATE FUNCTION ids AS ids OUTPUTTYPE typename */
+ 192, /* (61) cmd ::= CREATE USER ids PASS ids */
+ 204, /* (62) pps ::= */
+ 204, /* (63) pps ::= PPS INTEGER */
+ 205, /* (64) tseries ::= */
+ 205, /* (65) tseries ::= TSERIES INTEGER */
+ 206, /* (66) dbs ::= */
+ 206, /* (67) dbs ::= DBS INTEGER */
+ 207, /* (68) streams ::= */
+ 207, /* (69) streams ::= STREAMS INTEGER */
+ 208, /* (70) storage ::= */
+ 208, /* (71) storage ::= STORAGE INTEGER */
+ 209, /* (72) qtime ::= */
+ 209, /* (73) qtime ::= QTIME INTEGER */
+ 210, /* (74) users ::= */
+ 210, /* (75) users ::= USERS INTEGER */
+ 211, /* (76) conns ::= */
+ 211, /* (77) conns ::= CONNS INTEGER */
+ 212, /* (78) state ::= */
+ 212, /* (79) state ::= STATE ids */
+ 199, /* (80) acct_optr ::= pps tseries storage streams qtime dbs users conns state */
+ 213, /* (81) keep ::= KEEP tagitemlist */
+ 215, /* (82) cache ::= CACHE INTEGER */
+ 216, /* (83) replica ::= REPLICA INTEGER */
+ 217, /* (84) quorum ::= QUORUM INTEGER */
+ 218, /* (85) days ::= DAYS INTEGER */
+ 219, /* (86) minrows ::= MINROWS INTEGER */
+ 220, /* (87) maxrows ::= MAXROWS INTEGER */
+ 221, /* (88) blocks ::= BLOCKS INTEGER */
+ 222, /* (89) ctime ::= CTIME INTEGER */
+ 223, /* (90) wal ::= WAL INTEGER */
+ 224, /* (91) fsync ::= FSYNC INTEGER */
+ 225, /* (92) comp ::= COMP INTEGER */
+ 226, /* (93) prec ::= PRECISION STRING */
+ 227, /* (94) update ::= UPDATE INTEGER */
+ 228, /* (95) cachelast ::= CACHELAST INTEGER */
+ 229, /* (96) partitions ::= PARTITIONS INTEGER */
+ 201, /* (97) db_optr ::= */
+ 201, /* (98) db_optr ::= db_optr cache */
+ 201, /* (99) db_optr ::= db_optr replica */
+ 201, /* (100) db_optr ::= db_optr quorum */
+ 201, /* (101) db_optr ::= db_optr days */
+ 201, /* (102) db_optr ::= db_optr minrows */
+ 201, /* (103) db_optr ::= db_optr maxrows */
+ 201, /* (104) db_optr ::= db_optr blocks */
+ 201, /* (105) db_optr ::= db_optr ctime */
+ 201, /* (106) db_optr ::= db_optr wal */
+ 201, /* (107) db_optr ::= db_optr fsync */
+ 201, /* (108) db_optr ::= db_optr comp */
+ 201, /* (109) db_optr ::= db_optr prec */
+ 201, /* (110) db_optr ::= db_optr keep */
+ 201, /* (111) db_optr ::= db_optr update */
+ 201, /* (112) db_optr ::= db_optr cachelast */
+ 202, /* (113) topic_optr ::= db_optr */
+ 202, /* (114) topic_optr ::= topic_optr partitions */
+ 197, /* (115) alter_db_optr ::= */
+ 197, /* (116) alter_db_optr ::= alter_db_optr replica */
+ 197, /* (117) alter_db_optr ::= alter_db_optr quorum */
+ 197, /* (118) alter_db_optr ::= alter_db_optr keep */
+ 197, /* (119) alter_db_optr ::= alter_db_optr blocks */
+ 197, /* (120) alter_db_optr ::= alter_db_optr comp */
+ 197, /* (121) alter_db_optr ::= alter_db_optr wal */
+ 197, /* (122) alter_db_optr ::= alter_db_optr fsync */
+ 197, /* (123) alter_db_optr ::= alter_db_optr update */
+ 197, /* (124) alter_db_optr ::= alter_db_optr cachelast */
+ 198, /* (125) alter_topic_optr ::= alter_db_optr */
+ 198, /* (126) alter_topic_optr ::= alter_topic_optr partitions */
+ 203, /* (127) typename ::= ids */
+ 203, /* (128) typename ::= ids LP signed RP */
+ 203, /* (129) typename ::= ids UNSIGNED */
+ 230, /* (130) signed ::= INTEGER */
+ 230, /* (131) signed ::= PLUS INTEGER */
+ 230, /* (132) signed ::= MINUS INTEGER */
+ 192, /* (133) cmd ::= CREATE TABLE create_table_args */
+ 192, /* (134) cmd ::= CREATE TABLE create_stable_args */
+ 192, /* (135) cmd ::= CREATE STABLE create_stable_args */
+ 192, /* (136) cmd ::= CREATE TABLE create_table_list */
+ 233, /* (137) create_table_list ::= create_from_stable */
+ 233, /* (138) create_table_list ::= create_table_list create_from_stable */
+ 231, /* (139) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */
+ 232, /* (140) create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */
+ 234, /* (141) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */
+ 234, /* (142) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */
+ 236, /* (143) tagNamelist ::= tagNamelist COMMA ids */
+ 236, /* (144) tagNamelist ::= ids */
+ 231, /* (145) create_table_args ::= ifnotexists ids cpxName AS select */
+ 235, /* (146) columnlist ::= columnlist COMMA column */
+ 235, /* (147) columnlist ::= column */
+ 238, /* (148) column ::= ids typename */
+ 214, /* (149) tagitemlist ::= tagitemlist COMMA tagitem */
+ 214, /* (150) tagitemlist ::= tagitem */
+ 239, /* (151) tagitem ::= INTEGER */
+ 239, /* (152) tagitem ::= FLOAT */
+ 239, /* (153) tagitem ::= STRING */
+ 239, /* (154) tagitem ::= BOOL */
+ 239, /* (155) tagitem ::= NULL */
+ 239, /* (156) tagitem ::= MINUS INTEGER */
+ 239, /* (157) tagitem ::= MINUS FLOAT */
+ 239, /* (158) tagitem ::= PLUS INTEGER */
+ 239, /* (159) tagitem ::= PLUS FLOAT */
+ 237, /* (160) select ::= SELECT selcollist from where_opt interval_opt session_option fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */
+ 237, /* (161) select ::= LP select RP */
+ 252, /* (162) union ::= select */
+ 252, /* (163) union ::= union UNION ALL select */
+ 192, /* (164) cmd ::= union */
+ 237, /* (165) select ::= SELECT selcollist */
+ 253, /* (166) sclp ::= selcollist COMMA */
+ 253, /* (167) sclp ::= */
+ 240, /* (168) selcollist ::= sclp distinct expr as */
+ 240, /* (169) selcollist ::= sclp STAR */
+ 256, /* (170) as ::= AS ids */
+ 256, /* (171) as ::= ids */
+ 256, /* (172) as ::= */
+ 254, /* (173) distinct ::= DISTINCT */
+ 254, /* (174) distinct ::= */
+ 241, /* (175) from ::= FROM tablelist */
+ 241, /* (176) from ::= FROM LP union RP */
+ 257, /* (177) tablelist ::= ids cpxName */
+ 257, /* (178) tablelist ::= ids cpxName ids */
+ 257, /* (179) tablelist ::= tablelist COMMA ids cpxName */
+ 257, /* (180) tablelist ::= tablelist COMMA ids cpxName ids */
+ 258, /* (181) tmvar ::= VARIABLE */
+ 243, /* (182) interval_opt ::= INTERVAL LP tmvar RP */
+ 243, /* (183) interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */
+ 243, /* (184) interval_opt ::= */
+ 244, /* (185) session_option ::= */
+ 244, /* (186) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */
+ 245, /* (187) fill_opt ::= */
+ 245, /* (188) fill_opt ::= FILL LP ID COMMA tagitemlist RP */
+ 245, /* (189) fill_opt ::= FILL LP ID RP */
+ 246, /* (190) sliding_opt ::= SLIDING LP tmvar RP */
+ 246, /* (191) sliding_opt ::= */
+ 248, /* (192) orderby_opt ::= */
+ 248, /* (193) orderby_opt ::= ORDER BY sortlist */
+ 259, /* (194) sortlist ::= sortlist COMMA item sortorder */
+ 259, /* (195) sortlist ::= item sortorder */
+ 261, /* (196) item ::= ids cpxName */
+ 262, /* (197) sortorder ::= ASC */
+ 262, /* (198) sortorder ::= DESC */
+ 262, /* (199) sortorder ::= */
+ 247, /* (200) groupby_opt ::= */
+ 247, /* (201) groupby_opt ::= GROUP BY grouplist */
+ 263, /* (202) grouplist ::= grouplist COMMA item */
+ 263, /* (203) grouplist ::= item */
+ 249, /* (204) having_opt ::= */
+ 249, /* (205) having_opt ::= HAVING expr */
+ 251, /* (206) limit_opt ::= */
+ 251, /* (207) limit_opt ::= LIMIT signed */
+ 251, /* (208) limit_opt ::= LIMIT signed OFFSET signed */
+ 251, /* (209) limit_opt ::= LIMIT signed COMMA signed */
+ 250, /* (210) slimit_opt ::= */
+ 250, /* (211) slimit_opt ::= SLIMIT signed */
+ 250, /* (212) slimit_opt ::= SLIMIT signed SOFFSET signed */
+ 250, /* (213) slimit_opt ::= SLIMIT signed COMMA signed */
+ 242, /* (214) where_opt ::= */
+ 242, /* (215) where_opt ::= WHERE expr */
+ 255, /* (216) expr ::= LP expr RP */
+ 255, /* (217) expr ::= ID */
+ 255, /* (218) expr ::= ID DOT ID */
+ 255, /* (219) expr ::= ID DOT STAR */
+ 255, /* (220) expr ::= INTEGER */
+ 255, /* (221) expr ::= MINUS INTEGER */
+ 255, /* (222) expr ::= PLUS INTEGER */
+ 255, /* (223) expr ::= FLOAT */
+ 255, /* (224) expr ::= MINUS FLOAT */
+ 255, /* (225) expr ::= PLUS FLOAT */
+ 255, /* (226) expr ::= STRING */
+ 255, /* (227) expr ::= NOW */
+ 255, /* (228) expr ::= VARIABLE */
+ 255, /* (229) expr ::= BOOL */
+ 255, /* (230) expr ::= ID LP exprlist RP */
+ 255, /* (231) expr ::= ID LP STAR RP */
+ 255, /* (232) expr ::= expr IS NULL */
+ 255, /* (233) expr ::= expr IS NOT NULL */
+ 255, /* (234) expr ::= expr LT expr */
+ 255, /* (235) expr ::= expr GT expr */
+ 255, /* (236) expr ::= expr LE expr */
+ 255, /* (237) expr ::= expr GE expr */
+ 255, /* (238) expr ::= expr NE expr */
+ 255, /* (239) expr ::= expr EQ expr */
+ 255, /* (240) expr ::= expr BETWEEN expr AND expr */
+ 255, /* (241) expr ::= expr AND expr */
+ 255, /* (242) expr ::= expr OR expr */
+ 255, /* (243) expr ::= expr PLUS expr */
+ 255, /* (244) expr ::= expr MINUS expr */
+ 255, /* (245) expr ::= expr STAR expr */
+ 255, /* (246) expr ::= expr SLASH expr */
+ 255, /* (247) expr ::= expr REM expr */
+ 255, /* (248) expr ::= expr LIKE expr */
+ 255, /* (249) expr ::= expr IN LP exprlist RP */
+ 264, /* (250) exprlist ::= exprlist COMMA expritem */
+ 264, /* (251) exprlist ::= expritem */
+ 265, /* (252) expritem ::= expr */
+ 265, /* (253) expritem ::= */
+ 192, /* (254) cmd ::= RESET QUERY CACHE */
+ 192, /* (255) cmd ::= SYNCDB ids REPLICA */
+ 192, /* (256) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
+ 192, /* (257) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
+ 192, /* (258) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
+ 192, /* (259) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
+ 192, /* (260) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
+ 192, /* (261) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
+ 192, /* (262) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */
+ 192, /* (263) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */
+ 192, /* (264) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */
+ 192, /* (265) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */
+ 192, /* (266) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */
+ 192, /* (267) cmd ::= KILL CONNECTION INTEGER */
+ 192, /* (268) cmd ::= KILL STREAM INTEGER COLON INTEGER */
+ 192, /* (269) cmd ::= KILL QUERY INTEGER COLON INTEGER */
};
/* For rule J, yyRuleInfoNRhs[J] contains the negative of the number
@@ -2300,20 +2304,21 @@ static const signed char yyRuleInfoNRhs[] = {
-1, /* (252) expritem ::= expr */
0, /* (253) expritem ::= */
-3, /* (254) cmd ::= RESET QUERY CACHE */
- -7, /* (255) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
- -7, /* (256) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
- -7, /* (257) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
- -7, /* (258) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
- -8, /* (259) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
- -9, /* (260) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
- -7, /* (261) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */
- -7, /* (262) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */
- -7, /* (263) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */
- -7, /* (264) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */
- -8, /* (265) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */
- -3, /* (266) cmd ::= KILL CONNECTION INTEGER */
- -5, /* (267) cmd ::= KILL STREAM INTEGER COLON INTEGER */
- -5, /* (268) cmd ::= KILL QUERY INTEGER COLON INTEGER */
+ -3, /* (255) cmd ::= SYNCDB ids REPLICA */
+ -7, /* (256) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
+ -7, /* (257) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
+ -7, /* (258) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
+ -7, /* (259) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
+ -8, /* (260) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
+ -9, /* (261) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
+ -7, /* (262) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */
+ -7, /* (263) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */
+ -7, /* (264) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */
+ -7, /* (265) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */
+ -8, /* (266) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */
+ -3, /* (267) cmd ::= KILL CONNECTION INTEGER */
+ -5, /* (268) cmd ::= KILL STREAM INTEGER COLON INTEGER */
+ -5, /* (269) cmd ::= KILL QUERY INTEGER COLON INTEGER */
};
static void yy_accept(yyParser*); /* Forward Declaration */
@@ -2576,13 +2581,13 @@ static YYACTIONTYPE yy_reduce(
break;
case 45: /* cmd ::= ALTER DATABASE ids alter_db_optr */
case 46: /* cmd ::= ALTER TOPIC ids alter_topic_optr */ yytestcase(yyruleno==46);
-{ SStrToken t = {0}; setCreateDbInfo(pInfo, TSDB_SQL_ALTER_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy122, &t);}
+{ SStrToken t = {0}; setCreateDbInfo(pInfo, TSDB_SQL_ALTER_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy114, &t);}
break;
case 47: /* cmd ::= ALTER ACCOUNT ids acct_optr */
-{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-1].minor.yy0, NULL, &yymsp[0].minor.yy211);}
+{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-1].minor.yy0, NULL, &yymsp[0].minor.yy183);}
break;
case 48: /* cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */
-{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy211);}
+{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy183);}
break;
case 49: /* ids ::= ID */
case 50: /* ids ::= STRING */ yytestcase(yyruleno==50);
@@ -2604,17 +2609,17 @@ static YYACTIONTYPE yy_reduce(
{ setDCLSqlElems(pInfo, TSDB_SQL_CREATE_DNODE, 1, &yymsp[0].minor.yy0);}
break;
case 56: /* cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */
-{ setCreateAcctSql(pInfo, TSDB_SQL_CREATE_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy211);}
+{ setCreateAcctSql(pInfo, TSDB_SQL_CREATE_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy183);}
break;
case 57: /* cmd ::= CREATE DATABASE ifnotexists ids db_optr */
case 58: /* cmd ::= CREATE TOPIC ifnotexists ids topic_optr */ yytestcase(yyruleno==58);
-{ setCreateDbInfo(pInfo, TSDB_SQL_CREATE_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy122, &yymsp[-2].minor.yy0);}
+{ setCreateDbInfo(pInfo, TSDB_SQL_CREATE_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy114, &yymsp[-2].minor.yy0);}
break;
case 59: /* cmd ::= CREATE FUNCTION ids AS ids OUTPUTTYPE typename */
-{ setCreateFuncInfo(pInfo, TSDB_SQL_CREATE_FUNCTION, &yymsp[-4].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy153, 1);}
+{ setCreateFuncInfo(pInfo, TSDB_SQL_CREATE_FUNCTION, &yymsp[-4].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy27, 1);}
break;
case 60: /* cmd ::= CREATE AGGREGATE FUNCTION ids AS ids OUTPUTTYPE typename */
-{ setCreateFuncInfo(pInfo, TSDB_SQL_CREATE_FUNCTION, &yymsp[-4].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy153, 2);}
+{ setCreateFuncInfo(pInfo, TSDB_SQL_CREATE_FUNCTION, &yymsp[-4].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy27, 2);}
break;
case 61: /* cmd ::= CREATE USER ids PASS ids */
{ setCreateUserSql(pInfo, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);}
@@ -2643,20 +2648,20 @@ static YYACTIONTYPE yy_reduce(
break;
case 80: /* acct_optr ::= pps tseries storage streams qtime dbs users conns state */
{
- yylhsminor.yy211.maxUsers = (yymsp[-2].minor.yy0.n>0)?atoi(yymsp[-2].minor.yy0.z):-1;
- yylhsminor.yy211.maxDbs = (yymsp[-3].minor.yy0.n>0)?atoi(yymsp[-3].minor.yy0.z):-1;
- yylhsminor.yy211.maxTimeSeries = (yymsp[-7].minor.yy0.n>0)?atoi(yymsp[-7].minor.yy0.z):-1;
- yylhsminor.yy211.maxStreams = (yymsp[-5].minor.yy0.n>0)?atoi(yymsp[-5].minor.yy0.z):-1;
- yylhsminor.yy211.maxPointsPerSecond = (yymsp[-8].minor.yy0.n>0)?atoi(yymsp[-8].minor.yy0.z):-1;
- yylhsminor.yy211.maxStorage = (yymsp[-6].minor.yy0.n>0)?strtoll(yymsp[-6].minor.yy0.z, NULL, 10):-1;
- yylhsminor.yy211.maxQueryTime = (yymsp[-4].minor.yy0.n>0)?strtoll(yymsp[-4].minor.yy0.z, NULL, 10):-1;
- yylhsminor.yy211.maxConnections = (yymsp[-1].minor.yy0.n>0)?atoi(yymsp[-1].minor.yy0.z):-1;
- yylhsminor.yy211.stat = yymsp[0].minor.yy0;
+ yylhsminor.yy183.maxUsers = (yymsp[-2].minor.yy0.n>0)?atoi(yymsp[-2].minor.yy0.z):-1;
+ yylhsminor.yy183.maxDbs = (yymsp[-3].minor.yy0.n>0)?atoi(yymsp[-3].minor.yy0.z):-1;
+ yylhsminor.yy183.maxTimeSeries = (yymsp[-7].minor.yy0.n>0)?atoi(yymsp[-7].minor.yy0.z):-1;
+ yylhsminor.yy183.maxStreams = (yymsp[-5].minor.yy0.n>0)?atoi(yymsp[-5].minor.yy0.z):-1;
+ yylhsminor.yy183.maxPointsPerSecond = (yymsp[-8].minor.yy0.n>0)?atoi(yymsp[-8].minor.yy0.z):-1;
+ yylhsminor.yy183.maxStorage = (yymsp[-6].minor.yy0.n>0)?strtoll(yymsp[-6].minor.yy0.z, NULL, 10):-1;
+ yylhsminor.yy183.maxQueryTime = (yymsp[-4].minor.yy0.n>0)?strtoll(yymsp[-4].minor.yy0.z, NULL, 10):-1;
+ yylhsminor.yy183.maxConnections = (yymsp[-1].minor.yy0.n>0)?atoi(yymsp[-1].minor.yy0.z):-1;
+ yylhsminor.yy183.stat = yymsp[0].minor.yy0;
}
- yymsp[-8].minor.yy211 = yylhsminor.yy211;
+ yymsp[-8].minor.yy183 = yylhsminor.yy183;
break;
case 81: /* keep ::= KEEP tagitemlist */
-{ yymsp[-1].minor.yy291 = yymsp[0].minor.yy291; }
+{ yymsp[-1].minor.yy193 = yymsp[0].minor.yy193; }
break;
case 82: /* cache ::= CACHE INTEGER */
case 83: /* replica ::= REPLICA INTEGER */ yytestcase(yyruleno==83);
@@ -2676,234 +2681,234 @@ static YYACTIONTYPE yy_reduce(
{ yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; }
break;
case 97: /* db_optr ::= */
-{setDefaultCreateDbOption(&yymsp[1].minor.yy122); yymsp[1].minor.yy122.dbType = TSDB_DB_TYPE_DEFAULT;}
+{setDefaultCreateDbOption(&yymsp[1].minor.yy114); yymsp[1].minor.yy114.dbType = TSDB_DB_TYPE_DEFAULT;}
break;
case 98: /* db_optr ::= db_optr cache */
-{ yylhsminor.yy122 = yymsp[-1].minor.yy122; yylhsminor.yy122.cacheBlockSize = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
- yymsp[-1].minor.yy122 = yylhsminor.yy122;
+{ yylhsminor.yy114 = yymsp[-1].minor.yy114; yylhsminor.yy114.cacheBlockSize = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+ yymsp[-1].minor.yy114 = yylhsminor.yy114;
break;
case 99: /* db_optr ::= db_optr replica */
case 116: /* alter_db_optr ::= alter_db_optr replica */ yytestcase(yyruleno==116);
-{ yylhsminor.yy122 = yymsp[-1].minor.yy122; yylhsminor.yy122.replica = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
- yymsp[-1].minor.yy122 = yylhsminor.yy122;
+{ yylhsminor.yy114 = yymsp[-1].minor.yy114; yylhsminor.yy114.replica = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+ yymsp[-1].minor.yy114 = yylhsminor.yy114;
break;
case 100: /* db_optr ::= db_optr quorum */
case 117: /* alter_db_optr ::= alter_db_optr quorum */ yytestcase(yyruleno==117);
-{ yylhsminor.yy122 = yymsp[-1].minor.yy122; yylhsminor.yy122.quorum = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
- yymsp[-1].minor.yy122 = yylhsminor.yy122;
+{ yylhsminor.yy114 = yymsp[-1].minor.yy114; yylhsminor.yy114.quorum = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+ yymsp[-1].minor.yy114 = yylhsminor.yy114;
break;
case 101: /* db_optr ::= db_optr days */
-{ yylhsminor.yy122 = yymsp[-1].minor.yy122; yylhsminor.yy122.daysPerFile = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
- yymsp[-1].minor.yy122 = yylhsminor.yy122;
+{ yylhsminor.yy114 = yymsp[-1].minor.yy114; yylhsminor.yy114.daysPerFile = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+ yymsp[-1].minor.yy114 = yylhsminor.yy114;
break;
case 102: /* db_optr ::= db_optr minrows */
-{ yylhsminor.yy122 = yymsp[-1].minor.yy122; yylhsminor.yy122.minRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); }
- yymsp[-1].minor.yy122 = yylhsminor.yy122;
+{ yylhsminor.yy114 = yymsp[-1].minor.yy114; yylhsminor.yy114.minRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); }
+ yymsp[-1].minor.yy114 = yylhsminor.yy114;
break;
case 103: /* db_optr ::= db_optr maxrows */
-{ yylhsminor.yy122 = yymsp[-1].minor.yy122; yylhsminor.yy122.maxRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); }
- yymsp[-1].minor.yy122 = yylhsminor.yy122;
+{ yylhsminor.yy114 = yymsp[-1].minor.yy114; yylhsminor.yy114.maxRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); }
+ yymsp[-1].minor.yy114 = yylhsminor.yy114;
break;
case 104: /* db_optr ::= db_optr blocks */
case 119: /* alter_db_optr ::= alter_db_optr blocks */ yytestcase(yyruleno==119);
-{ yylhsminor.yy122 = yymsp[-1].minor.yy122; yylhsminor.yy122.numOfBlocks = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
- yymsp[-1].minor.yy122 = yylhsminor.yy122;
+{ yylhsminor.yy114 = yymsp[-1].minor.yy114; yylhsminor.yy114.numOfBlocks = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+ yymsp[-1].minor.yy114 = yylhsminor.yy114;
break;
case 105: /* db_optr ::= db_optr ctime */
-{ yylhsminor.yy122 = yymsp[-1].minor.yy122; yylhsminor.yy122.commitTime = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
- yymsp[-1].minor.yy122 = yylhsminor.yy122;
+{ yylhsminor.yy114 = yymsp[-1].minor.yy114; yylhsminor.yy114.commitTime = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+ yymsp[-1].minor.yy114 = yylhsminor.yy114;
break;
case 106: /* db_optr ::= db_optr wal */
case 121: /* alter_db_optr ::= alter_db_optr wal */ yytestcase(yyruleno==121);
-{ yylhsminor.yy122 = yymsp[-1].minor.yy122; yylhsminor.yy122.walLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
- yymsp[-1].minor.yy122 = yylhsminor.yy122;
+{ yylhsminor.yy114 = yymsp[-1].minor.yy114; yylhsminor.yy114.walLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+ yymsp[-1].minor.yy114 = yylhsminor.yy114;
break;
case 107: /* db_optr ::= db_optr fsync */
case 122: /* alter_db_optr ::= alter_db_optr fsync */ yytestcase(yyruleno==122);
-{ yylhsminor.yy122 = yymsp[-1].minor.yy122; yylhsminor.yy122.fsyncPeriod = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
- yymsp[-1].minor.yy122 = yylhsminor.yy122;
+{ yylhsminor.yy114 = yymsp[-1].minor.yy114; yylhsminor.yy114.fsyncPeriod = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+ yymsp[-1].minor.yy114 = yylhsminor.yy114;
break;
case 108: /* db_optr ::= db_optr comp */
case 120: /* alter_db_optr ::= alter_db_optr comp */ yytestcase(yyruleno==120);
-{ yylhsminor.yy122 = yymsp[-1].minor.yy122; yylhsminor.yy122.compressionLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
- yymsp[-1].minor.yy122 = yylhsminor.yy122;
+{ yylhsminor.yy114 = yymsp[-1].minor.yy114; yylhsminor.yy114.compressionLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+ yymsp[-1].minor.yy114 = yylhsminor.yy114;
break;
case 109: /* db_optr ::= db_optr prec */
-{ yylhsminor.yy122 = yymsp[-1].minor.yy122; yylhsminor.yy122.precision = yymsp[0].minor.yy0; }
- yymsp[-1].minor.yy122 = yylhsminor.yy122;
+{ yylhsminor.yy114 = yymsp[-1].minor.yy114; yylhsminor.yy114.precision = yymsp[0].minor.yy0; }
+ yymsp[-1].minor.yy114 = yylhsminor.yy114;
break;
case 110: /* db_optr ::= db_optr keep */
case 118: /* alter_db_optr ::= alter_db_optr keep */ yytestcase(yyruleno==118);
-{ yylhsminor.yy122 = yymsp[-1].minor.yy122; yylhsminor.yy122.keep = yymsp[0].minor.yy291; }
- yymsp[-1].minor.yy122 = yylhsminor.yy122;
+{ yylhsminor.yy114 = yymsp[-1].minor.yy114; yylhsminor.yy114.keep = yymsp[0].minor.yy193; }
+ yymsp[-1].minor.yy114 = yylhsminor.yy114;
break;
case 111: /* db_optr ::= db_optr update */
case 123: /* alter_db_optr ::= alter_db_optr update */ yytestcase(yyruleno==123);
-{ yylhsminor.yy122 = yymsp[-1].minor.yy122; yylhsminor.yy122.update = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
- yymsp[-1].minor.yy122 = yylhsminor.yy122;
+{ yylhsminor.yy114 = yymsp[-1].minor.yy114; yylhsminor.yy114.update = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+ yymsp[-1].minor.yy114 = yylhsminor.yy114;
break;
case 112: /* db_optr ::= db_optr cachelast */
case 124: /* alter_db_optr ::= alter_db_optr cachelast */ yytestcase(yyruleno==124);
-{ yylhsminor.yy122 = yymsp[-1].minor.yy122; yylhsminor.yy122.cachelast = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
- yymsp[-1].minor.yy122 = yylhsminor.yy122;
+{ yylhsminor.yy114 = yymsp[-1].minor.yy114; yylhsminor.yy114.cachelast = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+ yymsp[-1].minor.yy114 = yylhsminor.yy114;
break;
case 113: /* topic_optr ::= db_optr */
case 125: /* alter_topic_optr ::= alter_db_optr */ yytestcase(yyruleno==125);
-{ yylhsminor.yy122 = yymsp[0].minor.yy122; yylhsminor.yy122.dbType = TSDB_DB_TYPE_TOPIC; }
- yymsp[0].minor.yy122 = yylhsminor.yy122;
+{ yylhsminor.yy114 = yymsp[0].minor.yy114; yylhsminor.yy114.dbType = TSDB_DB_TYPE_TOPIC; }
+ yymsp[0].minor.yy114 = yylhsminor.yy114;
break;
case 114: /* topic_optr ::= topic_optr partitions */
case 126: /* alter_topic_optr ::= alter_topic_optr partitions */ yytestcase(yyruleno==126);
-{ yylhsminor.yy122 = yymsp[-1].minor.yy122; yylhsminor.yy122.partitions = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
- yymsp[-1].minor.yy122 = yylhsminor.yy122;
+{ yylhsminor.yy114 = yymsp[-1].minor.yy114; yylhsminor.yy114.partitions = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+ yymsp[-1].minor.yy114 = yylhsminor.yy114;
break;
case 115: /* alter_db_optr ::= */
-{ setDefaultCreateDbOption(&yymsp[1].minor.yy122); yymsp[1].minor.yy122.dbType = TSDB_DB_TYPE_DEFAULT;}
+{ setDefaultCreateDbOption(&yymsp[1].minor.yy114); yymsp[1].minor.yy114.dbType = TSDB_DB_TYPE_DEFAULT;}
break;
case 127: /* typename ::= ids */
{
yymsp[0].minor.yy0.type = 0;
- tSetColumnType (&yylhsminor.yy153, &yymsp[0].minor.yy0);
+ tSetColumnType (&yylhsminor.yy27, &yymsp[0].minor.yy0);
}
- yymsp[0].minor.yy153 = yylhsminor.yy153;
+ yymsp[0].minor.yy27 = yylhsminor.yy27;
break;
case 128: /* typename ::= ids LP signed RP */
{
- if (yymsp[-1].minor.yy179 <= 0) {
+ if (yymsp[-1].minor.yy473 <= 0) {
yymsp[-3].minor.yy0.type = 0;
- tSetColumnType(&yylhsminor.yy153, &yymsp[-3].minor.yy0);
+ tSetColumnType(&yylhsminor.yy27, &yymsp[-3].minor.yy0);
} else {
- yymsp[-3].minor.yy0.type = -yymsp[-1].minor.yy179; // negative value of name length
- tSetColumnType(&yylhsminor.yy153, &yymsp[-3].minor.yy0);
+ yymsp[-3].minor.yy0.type = -yymsp[-1].minor.yy473; // negative value of name length
+ tSetColumnType(&yylhsminor.yy27, &yymsp[-3].minor.yy0);
}
}
- yymsp[-3].minor.yy153 = yylhsminor.yy153;
+ yymsp[-3].minor.yy27 = yylhsminor.yy27;
break;
case 129: /* typename ::= ids UNSIGNED */
{
yymsp[-1].minor.yy0.type = 0;
yymsp[-1].minor.yy0.n = ((yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z);
- tSetColumnType (&yylhsminor.yy153, &yymsp[-1].minor.yy0);
+ tSetColumnType (&yylhsminor.yy27, &yymsp[-1].minor.yy0);
}
- yymsp[-1].minor.yy153 = yylhsminor.yy153;
+ yymsp[-1].minor.yy27 = yylhsminor.yy27;
break;
case 130: /* signed ::= INTEGER */
-{ yylhsminor.yy179 = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
- yymsp[0].minor.yy179 = yylhsminor.yy179;
+{ yylhsminor.yy473 = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+ yymsp[0].minor.yy473 = yylhsminor.yy473;
break;
case 131: /* signed ::= PLUS INTEGER */
-{ yymsp[-1].minor.yy179 = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+{ yymsp[-1].minor.yy473 = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
break;
case 132: /* signed ::= MINUS INTEGER */
-{ yymsp[-1].minor.yy179 = -strtol(yymsp[0].minor.yy0.z, NULL, 10);}
+{ yymsp[-1].minor.yy473 = -strtol(yymsp[0].minor.yy0.z, NULL, 10);}
break;
case 136: /* cmd ::= CREATE TABLE create_table_list */
-{ pInfo->type = TSDB_SQL_CREATE_TABLE; pInfo->pCreateTableInfo = yymsp[0].minor.yy412;}
+{ pInfo->type = TSDB_SQL_CREATE_TABLE; pInfo->pCreateTableInfo = yymsp[0].minor.yy270;}
break;
case 137: /* create_table_list ::= create_from_stable */
{
SCreateTableSql* pCreateTable = calloc(1, sizeof(SCreateTableSql));
pCreateTable->childTableInfo = taosArrayInit(4, sizeof(SCreatedTableInfo));
- taosArrayPush(pCreateTable->childTableInfo, &yymsp[0].minor.yy446);
+ taosArrayPush(pCreateTable->childTableInfo, &yymsp[0].minor.yy192);
pCreateTable->type = TSQL_CREATE_TABLE_FROM_STABLE;
- yylhsminor.yy412 = pCreateTable;
+ yylhsminor.yy270 = pCreateTable;
}
- yymsp[0].minor.yy412 = yylhsminor.yy412;
+ yymsp[0].minor.yy270 = yylhsminor.yy270;
break;
case 138: /* create_table_list ::= create_table_list create_from_stable */
{
- taosArrayPush(yymsp[-1].minor.yy412->childTableInfo, &yymsp[0].minor.yy446);
- yylhsminor.yy412 = yymsp[-1].minor.yy412;
+ taosArrayPush(yymsp[-1].minor.yy270->childTableInfo, &yymsp[0].minor.yy192);
+ yylhsminor.yy270 = yymsp[-1].minor.yy270;
}
- yymsp[-1].minor.yy412 = yylhsminor.yy412;
+ yymsp[-1].minor.yy270 = yylhsminor.yy270;
break;
case 139: /* create_table_args ::= ifnotexists ids cpxName LP columnlist RP */
{
- yylhsminor.yy412 = tSetCreateTableInfo(yymsp[-1].minor.yy291, NULL, NULL, TSQL_CREATE_TABLE);
- setSqlInfo(pInfo, yylhsminor.yy412, NULL, TSDB_SQL_CREATE_TABLE);
+ yylhsminor.yy270 = tSetCreateTableInfo(yymsp[-1].minor.yy193, NULL, NULL, TSQL_CREATE_TABLE);
+ setSqlInfo(pInfo, yylhsminor.yy270, NULL, TSDB_SQL_CREATE_TABLE);
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
setCreatedTableName(pInfo, &yymsp[-4].minor.yy0, &yymsp[-5].minor.yy0);
}
- yymsp[-5].minor.yy412 = yylhsminor.yy412;
+ yymsp[-5].minor.yy270 = yylhsminor.yy270;
break;
case 140: /* create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */
{
- yylhsminor.yy412 = tSetCreateTableInfo(yymsp[-5].minor.yy291, yymsp[-1].minor.yy291, NULL, TSQL_CREATE_STABLE);
- setSqlInfo(pInfo, yylhsminor.yy412, NULL, TSDB_SQL_CREATE_TABLE);
+ yylhsminor.yy270 = tSetCreateTableInfo(yymsp[-5].minor.yy193, yymsp[-1].minor.yy193, NULL, TSQL_CREATE_STABLE);
+ setSqlInfo(pInfo, yylhsminor.yy270, NULL, TSDB_SQL_CREATE_TABLE);
yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n;
setCreatedTableName(pInfo, &yymsp[-8].minor.yy0, &yymsp[-9].minor.yy0);
}
- yymsp[-9].minor.yy412 = yylhsminor.yy412;
+ yymsp[-9].minor.yy270 = yylhsminor.yy270;
break;
case 141: /* create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */
{
yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n;
yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n;
- yylhsminor.yy446 = createNewChildTableInfo(&yymsp[-5].minor.yy0, NULL, yymsp[-1].minor.yy291, &yymsp[-8].minor.yy0, &yymsp[-9].minor.yy0);
+ yylhsminor.yy192 = createNewChildTableInfo(&yymsp[-5].minor.yy0, NULL, yymsp[-1].minor.yy193, &yymsp[-8].minor.yy0, &yymsp[-9].minor.yy0);
}
- yymsp[-9].minor.yy446 = yylhsminor.yy446;
+ yymsp[-9].minor.yy192 = yylhsminor.yy192;
break;
case 142: /* create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */
{
yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n;
yymsp[-11].minor.yy0.n += yymsp[-10].minor.yy0.n;
- yylhsminor.yy446 = createNewChildTableInfo(&yymsp[-8].minor.yy0, yymsp[-5].minor.yy291, yymsp[-1].minor.yy291, &yymsp[-11].minor.yy0, &yymsp[-12].minor.yy0);
+ yylhsminor.yy192 = createNewChildTableInfo(&yymsp[-8].minor.yy0, yymsp[-5].minor.yy193, yymsp[-1].minor.yy193, &yymsp[-11].minor.yy0, &yymsp[-12].minor.yy0);
}
- yymsp[-12].minor.yy446 = yylhsminor.yy446;
+ yymsp[-12].minor.yy192 = yylhsminor.yy192;
break;
case 143: /* tagNamelist ::= tagNamelist COMMA ids */
-{taosArrayPush(yymsp[-2].minor.yy291, &yymsp[0].minor.yy0); yylhsminor.yy291 = yymsp[-2].minor.yy291; }
- yymsp[-2].minor.yy291 = yylhsminor.yy291;
+{taosArrayPush(yymsp[-2].minor.yy193, &yymsp[0].minor.yy0); yylhsminor.yy193 = yymsp[-2].minor.yy193; }
+ yymsp[-2].minor.yy193 = yylhsminor.yy193;
break;
case 144: /* tagNamelist ::= ids */
-{yylhsminor.yy291 = taosArrayInit(4, sizeof(SStrToken)); taosArrayPush(yylhsminor.yy291, &yymsp[0].minor.yy0);}
- yymsp[0].minor.yy291 = yylhsminor.yy291;
+{yylhsminor.yy193 = taosArrayInit(4, sizeof(SStrToken)); taosArrayPush(yylhsminor.yy193, &yymsp[0].minor.yy0);}
+ yymsp[0].minor.yy193 = yylhsminor.yy193;
break;
case 145: /* create_table_args ::= ifnotexists ids cpxName AS select */
{
- yylhsminor.yy412 = tSetCreateTableInfo(NULL, NULL, yymsp[0].minor.yy110, TSQL_CREATE_STREAM);
- setSqlInfo(pInfo, yylhsminor.yy412, NULL, TSDB_SQL_CREATE_TABLE);
+ yylhsminor.yy270 = tSetCreateTableInfo(NULL, NULL, yymsp[0].minor.yy286, TSQL_CREATE_STREAM);
+ setSqlInfo(pInfo, yylhsminor.yy270, NULL, TSDB_SQL_CREATE_TABLE);
yymsp[-3].minor.yy0.n += yymsp[-2].minor.yy0.n;
setCreatedTableName(pInfo, &yymsp[-3].minor.yy0, &yymsp[-4].minor.yy0);
}
- yymsp[-4].minor.yy412 = yylhsminor.yy412;
+ yymsp[-4].minor.yy270 = yylhsminor.yy270;
break;
case 146: /* columnlist ::= columnlist COMMA column */
-{taosArrayPush(yymsp[-2].minor.yy291, &yymsp[0].minor.yy153); yylhsminor.yy291 = yymsp[-2].minor.yy291; }
- yymsp[-2].minor.yy291 = yylhsminor.yy291;
+{taosArrayPush(yymsp[-2].minor.yy193, &yymsp[0].minor.yy27); yylhsminor.yy193 = yymsp[-2].minor.yy193; }
+ yymsp[-2].minor.yy193 = yylhsminor.yy193;
break;
case 147: /* columnlist ::= column */
-{yylhsminor.yy291 = taosArrayInit(4, sizeof(TAOS_FIELD)); taosArrayPush(yylhsminor.yy291, &yymsp[0].minor.yy153);}
- yymsp[0].minor.yy291 = yylhsminor.yy291;
+{yylhsminor.yy193 = taosArrayInit(4, sizeof(TAOS_FIELD)); taosArrayPush(yylhsminor.yy193, &yymsp[0].minor.yy27);}
+ yymsp[0].minor.yy193 = yylhsminor.yy193;
break;
case 148: /* column ::= ids typename */
{
- tSetColumnInfo(&yylhsminor.yy153, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy153);
+ tSetColumnInfo(&yylhsminor.yy27, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy27);
}
- yymsp[-1].minor.yy153 = yylhsminor.yy153;
+ yymsp[-1].minor.yy27 = yylhsminor.yy27;
break;
case 149: /* tagitemlist ::= tagitemlist COMMA tagitem */
-{ yylhsminor.yy291 = tVariantListAppend(yymsp[-2].minor.yy291, &yymsp[0].minor.yy216, -1); }
- yymsp[-2].minor.yy291 = yylhsminor.yy291;
+{ yylhsminor.yy193 = tVariantListAppend(yymsp[-2].minor.yy193, &yymsp[0].minor.yy442, -1); }
+ yymsp[-2].minor.yy193 = yylhsminor.yy193;
break;
case 150: /* tagitemlist ::= tagitem */
-{ yylhsminor.yy291 = tVariantListAppend(NULL, &yymsp[0].minor.yy216, -1); }
- yymsp[0].minor.yy291 = yylhsminor.yy291;
+{ yylhsminor.yy193 = tVariantListAppend(NULL, &yymsp[0].minor.yy442, -1); }
+ yymsp[0].minor.yy193 = yylhsminor.yy193;
break;
case 151: /* tagitem ::= INTEGER */
case 152: /* tagitem ::= FLOAT */ yytestcase(yyruleno==152);
case 153: /* tagitem ::= STRING */ yytestcase(yyruleno==153);
case 154: /* tagitem ::= BOOL */ yytestcase(yyruleno==154);
-{ toTSDBType(yymsp[0].minor.yy0.type); tVariantCreate(&yylhsminor.yy216, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy216 = yylhsminor.yy216;
+{ toTSDBType(yymsp[0].minor.yy0.type); tVariantCreate(&yylhsminor.yy442, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy442 = yylhsminor.yy442;
break;
case 155: /* tagitem ::= NULL */
-{ yymsp[0].minor.yy0.type = 0; tVariantCreate(&yylhsminor.yy216, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy216 = yylhsminor.yy216;
+{ yymsp[0].minor.yy0.type = 0; tVariantCreate(&yylhsminor.yy442, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy442 = yylhsminor.yy442;
break;
case 156: /* tagitem ::= MINUS INTEGER */
case 157: /* tagitem ::= MINUS FLOAT */ yytestcase(yyruleno==157);
@@ -2913,56 +2918,56 @@ static YYACTIONTYPE yy_reduce(
yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
yymsp[-1].minor.yy0.type = yymsp[0].minor.yy0.type;
toTSDBType(yymsp[-1].minor.yy0.type);
- tVariantCreate(&yylhsminor.yy216, &yymsp[-1].minor.yy0);
+ tVariantCreate(&yylhsminor.yy442, &yymsp[-1].minor.yy0);
}
- yymsp[-1].minor.yy216 = yylhsminor.yy216;
+ yymsp[-1].minor.yy442 = yylhsminor.yy442;
break;
case 160: /* select ::= SELECT selcollist from where_opt interval_opt session_option fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */
{
- yylhsminor.yy110 = tSetQuerySqlNode(&yymsp[-12].minor.yy0, yymsp[-11].minor.yy291, yymsp[-10].minor.yy232, yymsp[-9].minor.yy436, yymsp[-4].minor.yy291, yymsp[-3].minor.yy291, &yymsp[-8].minor.yy400, &yymsp[-7].minor.yy139, &yymsp[-5].minor.yy0, yymsp[-6].minor.yy291, &yymsp[0].minor.yy74, &yymsp[-1].minor.yy74);
+ yylhsminor.yy286 = tSetQuerySqlNode(&yymsp[-12].minor.yy0, yymsp[-11].minor.yy193, yymsp[-10].minor.yy370, yymsp[-9].minor.yy454, yymsp[-4].minor.yy193, yymsp[-3].minor.yy193, &yymsp[-8].minor.yy392, &yymsp[-7].minor.yy447, &yymsp[-5].minor.yy0, yymsp[-6].minor.yy193, &yymsp[0].minor.yy482, &yymsp[-1].minor.yy482);
}
- yymsp[-12].minor.yy110 = yylhsminor.yy110;
+ yymsp[-12].minor.yy286 = yylhsminor.yy286;
break;
case 161: /* select ::= LP select RP */
-{yymsp[-2].minor.yy110 = yymsp[-1].minor.yy110;}
+{yymsp[-2].minor.yy286 = yymsp[-1].minor.yy286;}
break;
case 162: /* union ::= select */
-{ yylhsminor.yy154 = setSubclause(NULL, yymsp[0].minor.yy110); }
- yymsp[0].minor.yy154 = yylhsminor.yy154;
+{ yylhsminor.yy21 = setSubclause(NULL, yymsp[0].minor.yy286); }
+ yymsp[0].minor.yy21 = yylhsminor.yy21;
break;
case 163: /* union ::= union UNION ALL select */
-{ yylhsminor.yy154 = appendSelectClause(yymsp[-3].minor.yy154, yymsp[0].minor.yy110); }
- yymsp[-3].minor.yy154 = yylhsminor.yy154;
+{ yylhsminor.yy21 = appendSelectClause(yymsp[-3].minor.yy21, yymsp[0].minor.yy286); }
+ yymsp[-3].minor.yy21 = yylhsminor.yy21;
break;
case 164: /* cmd ::= union */
-{ setSqlInfo(pInfo, yymsp[0].minor.yy154, NULL, TSDB_SQL_SELECT); }
+{ setSqlInfo(pInfo, yymsp[0].minor.yy21, NULL, TSDB_SQL_SELECT); }
break;
case 165: /* select ::= SELECT selcollist */
{
- yylhsminor.yy110 = tSetQuerySqlNode(&yymsp[-1].minor.yy0, yymsp[0].minor.yy291, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ yylhsminor.yy286 = tSetQuerySqlNode(&yymsp[-1].minor.yy0, yymsp[0].minor.yy193, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
}
- yymsp[-1].minor.yy110 = yylhsminor.yy110;
+ yymsp[-1].minor.yy286 = yylhsminor.yy286;
break;
case 166: /* sclp ::= selcollist COMMA */
-{yylhsminor.yy291 = yymsp[-1].minor.yy291;}
- yymsp[-1].minor.yy291 = yylhsminor.yy291;
+{yylhsminor.yy193 = yymsp[-1].minor.yy193;}
+ yymsp[-1].minor.yy193 = yylhsminor.yy193;
break;
case 167: /* sclp ::= */
case 192: /* orderby_opt ::= */ yytestcase(yyruleno==192);
-{yymsp[1].minor.yy291 = 0;}
+{yymsp[1].minor.yy193 = 0;}
break;
case 168: /* selcollist ::= sclp distinct expr as */
{
- yylhsminor.yy291 = tSqlExprListAppend(yymsp[-3].minor.yy291, yymsp[-1].minor.yy436, yymsp[-2].minor.yy0.n? &yymsp[-2].minor.yy0:0, yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0);
+ yylhsminor.yy193 = tSqlExprListAppend(yymsp[-3].minor.yy193, yymsp[-1].minor.yy454, yymsp[-2].minor.yy0.n? &yymsp[-2].minor.yy0:0, yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0);
}
- yymsp[-3].minor.yy291 = yylhsminor.yy291;
+ yymsp[-3].minor.yy193 = yylhsminor.yy193;
break;
case 169: /* selcollist ::= sclp STAR */
{
tSqlExpr *pNode = tSqlExprCreateIdValue(NULL, TK_ALL);
- yylhsminor.yy291 = tSqlExprListAppend(yymsp[-1].minor.yy291, pNode, 0, 0);
+ yylhsminor.yy193 = tSqlExprListAppend(yymsp[-1].minor.yy193, pNode, 0, 0);
}
- yymsp[-1].minor.yy291 = yylhsminor.yy291;
+ yymsp[-1].minor.yy193 = yylhsminor.yy193;
break;
case 170: /* as ::= AS ids */
{ yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; }
@@ -2979,35 +2984,35 @@ static YYACTIONTYPE yy_reduce(
yymsp[0].minor.yy0 = yylhsminor.yy0;
break;
case 175: /* from ::= FROM tablelist */
-{yymsp[-1].minor.yy232 = yymsp[0].minor.yy291;}
+{yymsp[-1].minor.yy370 = yymsp[0].minor.yy193;}
break;
case 176: /* from ::= FROM LP union RP */
-{yymsp[-3].minor.yy232 = yymsp[-1].minor.yy154;}
+{yymsp[-3].minor.yy370 = yymsp[-1].minor.yy21;}
break;
case 177: /* tablelist ::= ids cpxName */
{
toTSDBType(yymsp[-1].minor.yy0.type);
yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
- yylhsminor.yy291 = setTableNameList(NULL, &yymsp[-1].minor.yy0, NULL);
+ yylhsminor.yy193 = setTableNameList(NULL, &yymsp[-1].minor.yy0, NULL);
}
- yymsp[-1].minor.yy291 = yylhsminor.yy291;
+ yymsp[-1].minor.yy193 = yylhsminor.yy193;
break;
case 178: /* tablelist ::= ids cpxName ids */
{
toTSDBType(yymsp[-2].minor.yy0.type);
toTSDBType(yymsp[0].minor.yy0.type);
yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n;
- yylhsminor.yy291 = setTableNameList(NULL, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
+ yylhsminor.yy193 = setTableNameList(NULL, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
}
- yymsp[-2].minor.yy291 = yylhsminor.yy291;
+ yymsp[-2].minor.yy193 = yylhsminor.yy193;
break;
case 179: /* tablelist ::= tablelist COMMA ids cpxName */
{
toTSDBType(yymsp[-1].minor.yy0.type);
yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
- yylhsminor.yy291 = setTableNameList(yymsp[-3].minor.yy291, &yymsp[-1].minor.yy0, NULL);
+ yylhsminor.yy193 = setTableNameList(yymsp[-3].minor.yy193, &yymsp[-1].minor.yy0, NULL);
}
- yymsp[-3].minor.yy291 = yylhsminor.yy291;
+ yymsp[-3].minor.yy193 = yylhsminor.yy193;
break;
case 180: /* tablelist ::= tablelist COMMA ids cpxName ids */
{
@@ -3015,35 +3020,35 @@ static YYACTIONTYPE yy_reduce(
toTSDBType(yymsp[0].minor.yy0.type);
yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n;
- yylhsminor.yy291 = setTableNameList(yymsp[-4].minor.yy291, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
+ yylhsminor.yy193 = setTableNameList(yymsp[-4].minor.yy193, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
}
- yymsp[-4].minor.yy291 = yylhsminor.yy291;
+ yymsp[-4].minor.yy193 = yylhsminor.yy193;
break;
case 181: /* tmvar ::= VARIABLE */
{yylhsminor.yy0 = yymsp[0].minor.yy0;}
yymsp[0].minor.yy0 = yylhsminor.yy0;
break;
case 182: /* interval_opt ::= INTERVAL LP tmvar RP */
-{yymsp[-3].minor.yy400.interval = yymsp[-1].minor.yy0; yymsp[-3].minor.yy400.offset.n = 0;}
+{yymsp[-3].minor.yy392.interval = yymsp[-1].minor.yy0; yymsp[-3].minor.yy392.offset.n = 0;}
break;
case 183: /* interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */
-{yymsp[-5].minor.yy400.interval = yymsp[-3].minor.yy0; yymsp[-5].minor.yy400.offset = yymsp[-1].minor.yy0;}
+{yymsp[-5].minor.yy392.interval = yymsp[-3].minor.yy0; yymsp[-5].minor.yy392.offset = yymsp[-1].minor.yy0;}
break;
case 184: /* interval_opt ::= */
-{memset(&yymsp[1].minor.yy400, 0, sizeof(yymsp[1].minor.yy400));}
+{memset(&yymsp[1].minor.yy392, 0, sizeof(yymsp[1].minor.yy392));}
break;
case 185: /* session_option ::= */
-{yymsp[1].minor.yy139.col.n = 0; yymsp[1].minor.yy139.gap.n = 0;}
+{yymsp[1].minor.yy447.col.n = 0; yymsp[1].minor.yy447.gap.n = 0;}
break;
case 186: /* session_option ::= SESSION LP ids cpxName COMMA tmvar RP */
{
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
- yymsp[-6].minor.yy139.col = yymsp[-4].minor.yy0;
- yymsp[-6].minor.yy139.gap = yymsp[-1].minor.yy0;
+ yymsp[-6].minor.yy447.col = yymsp[-4].minor.yy0;
+ yymsp[-6].minor.yy447.gap = yymsp[-1].minor.yy0;
}
break;
case 187: /* fill_opt ::= */
-{ yymsp[1].minor.yy291 = 0; }
+{ yymsp[1].minor.yy193 = 0; }
break;
case 188: /* fill_opt ::= FILL LP ID COMMA tagitemlist RP */
{
@@ -3051,14 +3056,14 @@ static YYACTIONTYPE yy_reduce(
toTSDBType(yymsp[-3].minor.yy0.type);
tVariantCreate(&A, &yymsp[-3].minor.yy0);
- tVariantListInsert(yymsp[-1].minor.yy291, &A, -1, 0);
- yymsp[-5].minor.yy291 = yymsp[-1].minor.yy291;
+ tVariantListInsert(yymsp[-1].minor.yy193, &A, -1, 0);
+ yymsp[-5].minor.yy193 = yymsp[-1].minor.yy193;
}
break;
case 189: /* fill_opt ::= FILL LP ID RP */
{
toTSDBType(yymsp[-1].minor.yy0.type);
- yymsp[-3].minor.yy291 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1);
+ yymsp[-3].minor.yy193 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1);
}
break;
case 190: /* sliding_opt ::= SLIDING LP tmvar RP */
@@ -3068,238 +3073,241 @@ static YYACTIONTYPE yy_reduce(
{yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = NULL; yymsp[1].minor.yy0.type = 0; }
break;
case 193: /* orderby_opt ::= ORDER BY sortlist */
-{yymsp[-2].minor.yy291 = yymsp[0].minor.yy291;}
+{yymsp[-2].minor.yy193 = yymsp[0].minor.yy193;}
break;
case 194: /* sortlist ::= sortlist COMMA item sortorder */
{
- yylhsminor.yy291 = tVariantListAppend(yymsp[-3].minor.yy291, &yymsp[-1].minor.yy216, yymsp[0].minor.yy382);
+ yylhsminor.yy193 = tVariantListAppend(yymsp[-3].minor.yy193, &yymsp[-1].minor.yy442, yymsp[0].minor.yy312);
}
- yymsp[-3].minor.yy291 = yylhsminor.yy291;
+ yymsp[-3].minor.yy193 = yylhsminor.yy193;
break;
case 195: /* sortlist ::= item sortorder */
{
- yylhsminor.yy291 = tVariantListAppend(NULL, &yymsp[-1].minor.yy216, yymsp[0].minor.yy382);
+ yylhsminor.yy193 = tVariantListAppend(NULL, &yymsp[-1].minor.yy442, yymsp[0].minor.yy312);
}
- yymsp[-1].minor.yy291 = yylhsminor.yy291;
+ yymsp[-1].minor.yy193 = yylhsminor.yy193;
break;
case 196: /* item ::= ids cpxName */
{
toTSDBType(yymsp[-1].minor.yy0.type);
yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
- tVariantCreate(&yylhsminor.yy216, &yymsp[-1].minor.yy0);
+ tVariantCreate(&yylhsminor.yy442, &yymsp[-1].minor.yy0);
}
- yymsp[-1].minor.yy216 = yylhsminor.yy216;
+ yymsp[-1].minor.yy442 = yylhsminor.yy442;
break;
case 197: /* sortorder ::= ASC */
-{ yymsp[0].minor.yy382 = TSDB_ORDER_ASC; }
+{ yymsp[0].minor.yy312 = TSDB_ORDER_ASC; }
break;
case 198: /* sortorder ::= DESC */
-{ yymsp[0].minor.yy382 = TSDB_ORDER_DESC;}
+{ yymsp[0].minor.yy312 = TSDB_ORDER_DESC;}
break;
case 199: /* sortorder ::= */
-{ yymsp[1].minor.yy382 = TSDB_ORDER_ASC; }
+{ yymsp[1].minor.yy312 = TSDB_ORDER_ASC; }
break;
case 200: /* groupby_opt ::= */
-{ yymsp[1].minor.yy291 = 0;}
+{ yymsp[1].minor.yy193 = 0;}
break;
case 201: /* groupby_opt ::= GROUP BY grouplist */
-{ yymsp[-2].minor.yy291 = yymsp[0].minor.yy291;}
+{ yymsp[-2].minor.yy193 = yymsp[0].minor.yy193;}
break;
case 202: /* grouplist ::= grouplist COMMA item */
{
- yylhsminor.yy291 = tVariantListAppend(yymsp[-2].minor.yy291, &yymsp[0].minor.yy216, -1);
+ yylhsminor.yy193 = tVariantListAppend(yymsp[-2].minor.yy193, &yymsp[0].minor.yy442, -1);
}
- yymsp[-2].minor.yy291 = yylhsminor.yy291;
+ yymsp[-2].minor.yy193 = yylhsminor.yy193;
break;
case 203: /* grouplist ::= item */
{
- yylhsminor.yy291 = tVariantListAppend(NULL, &yymsp[0].minor.yy216, -1);
+ yylhsminor.yy193 = tVariantListAppend(NULL, &yymsp[0].minor.yy442, -1);
}
- yymsp[0].minor.yy291 = yylhsminor.yy291;
+ yymsp[0].minor.yy193 = yylhsminor.yy193;
break;
case 204: /* having_opt ::= */
case 214: /* where_opt ::= */ yytestcase(yyruleno==214);
case 253: /* expritem ::= */ yytestcase(yyruleno==253);
-{yymsp[1].minor.yy436 = 0;}
+{yymsp[1].minor.yy454 = 0;}
break;
case 205: /* having_opt ::= HAVING expr */
case 215: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==215);
-{yymsp[-1].minor.yy436 = yymsp[0].minor.yy436;}
+{yymsp[-1].minor.yy454 = yymsp[0].minor.yy454;}
break;
case 206: /* limit_opt ::= */
case 210: /* slimit_opt ::= */ yytestcase(yyruleno==210);
-{yymsp[1].minor.yy74.limit = -1; yymsp[1].minor.yy74.offset = 0;}
+{yymsp[1].minor.yy482.limit = -1; yymsp[1].minor.yy482.offset = 0;}
break;
case 207: /* limit_opt ::= LIMIT signed */
case 211: /* slimit_opt ::= SLIMIT signed */ yytestcase(yyruleno==211);
-{yymsp[-1].minor.yy74.limit = yymsp[0].minor.yy179; yymsp[-1].minor.yy74.offset = 0;}
+{yymsp[-1].minor.yy482.limit = yymsp[0].minor.yy473; yymsp[-1].minor.yy482.offset = 0;}
break;
case 208: /* limit_opt ::= LIMIT signed OFFSET signed */
-{ yymsp[-3].minor.yy74.limit = yymsp[-2].minor.yy179; yymsp[-3].minor.yy74.offset = yymsp[0].minor.yy179;}
+{ yymsp[-3].minor.yy482.limit = yymsp[-2].minor.yy473; yymsp[-3].minor.yy482.offset = yymsp[0].minor.yy473;}
break;
case 209: /* limit_opt ::= LIMIT signed COMMA signed */
-{ yymsp[-3].minor.yy74.limit = yymsp[0].minor.yy179; yymsp[-3].minor.yy74.offset = yymsp[-2].minor.yy179;}
+{ yymsp[-3].minor.yy482.limit = yymsp[0].minor.yy473; yymsp[-3].minor.yy482.offset = yymsp[-2].minor.yy473;}
break;
case 212: /* slimit_opt ::= SLIMIT signed SOFFSET signed */
-{yymsp[-3].minor.yy74.limit = yymsp[-2].minor.yy179; yymsp[-3].minor.yy74.offset = yymsp[0].minor.yy179;}
+{yymsp[-3].minor.yy482.limit = yymsp[-2].minor.yy473; yymsp[-3].minor.yy482.offset = yymsp[0].minor.yy473;}
break;
case 213: /* slimit_opt ::= SLIMIT signed COMMA signed */
-{yymsp[-3].minor.yy74.limit = yymsp[0].minor.yy179; yymsp[-3].minor.yy74.offset = yymsp[-2].minor.yy179;}
+{yymsp[-3].minor.yy482.limit = yymsp[0].minor.yy473; yymsp[-3].minor.yy482.offset = yymsp[-2].minor.yy473;}
break;
case 216: /* expr ::= LP expr RP */
-{yylhsminor.yy436 = yymsp[-1].minor.yy436; yylhsminor.yy436->token.z = yymsp[-2].minor.yy0.z; yylhsminor.yy436->token.n = (yymsp[0].minor.yy0.z - yymsp[-2].minor.yy0.z + 1);}
- yymsp[-2].minor.yy436 = yylhsminor.yy436;
+{yylhsminor.yy454 = yymsp[-1].minor.yy454; yylhsminor.yy454->token.z = yymsp[-2].minor.yy0.z; yylhsminor.yy454->token.n = (yymsp[0].minor.yy0.z - yymsp[-2].minor.yy0.z + 1);}
+ yymsp[-2].minor.yy454 = yylhsminor.yy454;
break;
case 217: /* expr ::= ID */
-{ yylhsminor.yy436 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_ID);}
- yymsp[0].minor.yy436 = yylhsminor.yy436;
+{ yylhsminor.yy454 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_ID);}
+ yymsp[0].minor.yy454 = yylhsminor.yy454;
break;
case 218: /* expr ::= ID DOT ID */
-{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy436 = tSqlExprCreateIdValue(&yymsp[-2].minor.yy0, TK_ID);}
- yymsp[-2].minor.yy436 = yylhsminor.yy436;
+{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy454 = tSqlExprCreateIdValue(&yymsp[-2].minor.yy0, TK_ID);}
+ yymsp[-2].minor.yy454 = yylhsminor.yy454;
break;
case 219: /* expr ::= ID DOT STAR */
-{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy436 = tSqlExprCreateIdValue(&yymsp[-2].minor.yy0, TK_ALL);}
- yymsp[-2].minor.yy436 = yylhsminor.yy436;
+{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy454 = tSqlExprCreateIdValue(&yymsp[-2].minor.yy0, TK_ALL);}
+ yymsp[-2].minor.yy454 = yylhsminor.yy454;
break;
case 220: /* expr ::= INTEGER */
-{ yylhsminor.yy436 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_INTEGER);}
- yymsp[0].minor.yy436 = yylhsminor.yy436;
+{ yylhsminor.yy454 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_INTEGER);}
+ yymsp[0].minor.yy454 = yylhsminor.yy454;
break;
case 221: /* expr ::= MINUS INTEGER */
case 222: /* expr ::= PLUS INTEGER */ yytestcase(yyruleno==222);
-{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy436 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_INTEGER);}
- yymsp[-1].minor.yy436 = yylhsminor.yy436;
+{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy454 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_INTEGER);}
+ yymsp[-1].minor.yy454 = yylhsminor.yy454;
break;
case 223: /* expr ::= FLOAT */
-{ yylhsminor.yy436 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_FLOAT);}
- yymsp[0].minor.yy436 = yylhsminor.yy436;
+{ yylhsminor.yy454 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_FLOAT);}
+ yymsp[0].minor.yy454 = yylhsminor.yy454;
break;
case 224: /* expr ::= MINUS FLOAT */
case 225: /* expr ::= PLUS FLOAT */ yytestcase(yyruleno==225);
-{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_FLOAT; yylhsminor.yy436 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_FLOAT);}
- yymsp[-1].minor.yy436 = yylhsminor.yy436;
+{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_FLOAT; yylhsminor.yy454 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_FLOAT);}
+ yymsp[-1].minor.yy454 = yylhsminor.yy454;
break;
case 226: /* expr ::= STRING */
-{ yylhsminor.yy436 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_STRING);}
- yymsp[0].minor.yy436 = yylhsminor.yy436;
+{ yylhsminor.yy454 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_STRING);}
+ yymsp[0].minor.yy454 = yylhsminor.yy454;
break;
case 227: /* expr ::= NOW */
-{ yylhsminor.yy436 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_NOW); }
- yymsp[0].minor.yy436 = yylhsminor.yy436;
+{ yylhsminor.yy454 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_NOW); }
+ yymsp[0].minor.yy454 = yylhsminor.yy454;
break;
case 228: /* expr ::= VARIABLE */
-{ yylhsminor.yy436 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_VARIABLE);}
- yymsp[0].minor.yy436 = yylhsminor.yy436;
+{ yylhsminor.yy454 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_VARIABLE);}
+ yymsp[0].minor.yy454 = yylhsminor.yy454;
break;
case 229: /* expr ::= BOOL */
-{ yylhsminor.yy436 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_BOOL);}
- yymsp[0].minor.yy436 = yylhsminor.yy436;
+{ yylhsminor.yy454 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_BOOL);}
+ yymsp[0].minor.yy454 = yylhsminor.yy454;
break;
case 230: /* expr ::= ID LP exprlist RP */
-{ yylhsminor.yy436 = tSqlExprCreateFunction(yymsp[-1].minor.yy291, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); }
- yymsp[-3].minor.yy436 = yylhsminor.yy436;
+{ yylhsminor.yy454 = tSqlExprCreateFunction(yymsp[-1].minor.yy193, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); }
+ yymsp[-3].minor.yy454 = yylhsminor.yy454;
break;
case 231: /* expr ::= ID LP STAR RP */
-{ yylhsminor.yy436 = tSqlExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); }
- yymsp[-3].minor.yy436 = yylhsminor.yy436;
+{ yylhsminor.yy454 = tSqlExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); }
+ yymsp[-3].minor.yy454 = yylhsminor.yy454;
break;
case 232: /* expr ::= expr IS NULL */
-{yylhsminor.yy436 = tSqlExprCreate(yymsp[-2].minor.yy436, NULL, TK_ISNULL);}
- yymsp[-2].minor.yy436 = yylhsminor.yy436;
+{yylhsminor.yy454 = tSqlExprCreate(yymsp[-2].minor.yy454, NULL, TK_ISNULL);}
+ yymsp[-2].minor.yy454 = yylhsminor.yy454;
break;
case 233: /* expr ::= expr IS NOT NULL */
-{yylhsminor.yy436 = tSqlExprCreate(yymsp[-3].minor.yy436, NULL, TK_NOTNULL);}
- yymsp[-3].minor.yy436 = yylhsminor.yy436;
+{yylhsminor.yy454 = tSqlExprCreate(yymsp[-3].minor.yy454, NULL, TK_NOTNULL);}
+ yymsp[-3].minor.yy454 = yylhsminor.yy454;
break;
case 234: /* expr ::= expr LT expr */
-{yylhsminor.yy436 = tSqlExprCreate(yymsp[-2].minor.yy436, yymsp[0].minor.yy436, TK_LT);}
- yymsp[-2].minor.yy436 = yylhsminor.yy436;
+{yylhsminor.yy454 = tSqlExprCreate(yymsp[-2].minor.yy454, yymsp[0].minor.yy454, TK_LT);}
+ yymsp[-2].minor.yy454 = yylhsminor.yy454;
break;
case 235: /* expr ::= expr GT expr */
-{yylhsminor.yy436 = tSqlExprCreate(yymsp[-2].minor.yy436, yymsp[0].minor.yy436, TK_GT);}
- yymsp[-2].minor.yy436 = yylhsminor.yy436;
+{yylhsminor.yy454 = tSqlExprCreate(yymsp[-2].minor.yy454, yymsp[0].minor.yy454, TK_GT);}
+ yymsp[-2].minor.yy454 = yylhsminor.yy454;
break;
case 236: /* expr ::= expr LE expr */
-{yylhsminor.yy436 = tSqlExprCreate(yymsp[-2].minor.yy436, yymsp[0].minor.yy436, TK_LE);}
- yymsp[-2].minor.yy436 = yylhsminor.yy436;
+{yylhsminor.yy454 = tSqlExprCreate(yymsp[-2].minor.yy454, yymsp[0].minor.yy454, TK_LE);}
+ yymsp[-2].minor.yy454 = yylhsminor.yy454;
break;
case 237: /* expr ::= expr GE expr */
-{yylhsminor.yy436 = tSqlExprCreate(yymsp[-2].minor.yy436, yymsp[0].minor.yy436, TK_GE);}
- yymsp[-2].minor.yy436 = yylhsminor.yy436;
+{yylhsminor.yy454 = tSqlExprCreate(yymsp[-2].minor.yy454, yymsp[0].minor.yy454, TK_GE);}
+ yymsp[-2].minor.yy454 = yylhsminor.yy454;
break;
case 238: /* expr ::= expr NE expr */
-{yylhsminor.yy436 = tSqlExprCreate(yymsp[-2].minor.yy436, yymsp[0].minor.yy436, TK_NE);}
- yymsp[-2].minor.yy436 = yylhsminor.yy436;
+{yylhsminor.yy454 = tSqlExprCreate(yymsp[-2].minor.yy454, yymsp[0].minor.yy454, TK_NE);}
+ yymsp[-2].minor.yy454 = yylhsminor.yy454;
break;
case 239: /* expr ::= expr EQ expr */
-{yylhsminor.yy436 = tSqlExprCreate(yymsp[-2].minor.yy436, yymsp[0].minor.yy436, TK_EQ);}
- yymsp[-2].minor.yy436 = yylhsminor.yy436;
+{yylhsminor.yy454 = tSqlExprCreate(yymsp[-2].minor.yy454, yymsp[0].minor.yy454, TK_EQ);}
+ yymsp[-2].minor.yy454 = yylhsminor.yy454;
break;
case 240: /* expr ::= expr BETWEEN expr AND expr */
-{ tSqlExpr* X2 = tSqlExprClone(yymsp[-4].minor.yy436); yylhsminor.yy436 = tSqlExprCreate(tSqlExprCreate(yymsp[-4].minor.yy436, yymsp[-2].minor.yy436, TK_GE), tSqlExprCreate(X2, yymsp[0].minor.yy436, TK_LE), TK_AND);}
- yymsp[-4].minor.yy436 = yylhsminor.yy436;
+{ tSqlExpr* X2 = tSqlExprClone(yymsp[-4].minor.yy454); yylhsminor.yy454 = tSqlExprCreate(tSqlExprCreate(yymsp[-4].minor.yy454, yymsp[-2].minor.yy454, TK_GE), tSqlExprCreate(X2, yymsp[0].minor.yy454, TK_LE), TK_AND);}
+ yymsp[-4].minor.yy454 = yylhsminor.yy454;
break;
case 241: /* expr ::= expr AND expr */
-{yylhsminor.yy436 = tSqlExprCreate(yymsp[-2].minor.yy436, yymsp[0].minor.yy436, TK_AND);}
- yymsp[-2].minor.yy436 = yylhsminor.yy436;
+{yylhsminor.yy454 = tSqlExprCreate(yymsp[-2].minor.yy454, yymsp[0].minor.yy454, TK_AND);}
+ yymsp[-2].minor.yy454 = yylhsminor.yy454;
break;
case 242: /* expr ::= expr OR expr */
-{yylhsminor.yy436 = tSqlExprCreate(yymsp[-2].minor.yy436, yymsp[0].minor.yy436, TK_OR); }
- yymsp[-2].minor.yy436 = yylhsminor.yy436;
+{yylhsminor.yy454 = tSqlExprCreate(yymsp[-2].minor.yy454, yymsp[0].minor.yy454, TK_OR); }
+ yymsp[-2].minor.yy454 = yylhsminor.yy454;
break;
case 243: /* expr ::= expr PLUS expr */
-{yylhsminor.yy436 = tSqlExprCreate(yymsp[-2].minor.yy436, yymsp[0].minor.yy436, TK_PLUS); }
- yymsp[-2].minor.yy436 = yylhsminor.yy436;
+{yylhsminor.yy454 = tSqlExprCreate(yymsp[-2].minor.yy454, yymsp[0].minor.yy454, TK_PLUS); }
+ yymsp[-2].minor.yy454 = yylhsminor.yy454;
break;
case 244: /* expr ::= expr MINUS expr */
-{yylhsminor.yy436 = tSqlExprCreate(yymsp[-2].minor.yy436, yymsp[0].minor.yy436, TK_MINUS); }
- yymsp[-2].minor.yy436 = yylhsminor.yy436;
+{yylhsminor.yy454 = tSqlExprCreate(yymsp[-2].minor.yy454, yymsp[0].minor.yy454, TK_MINUS); }
+ yymsp[-2].minor.yy454 = yylhsminor.yy454;
break;
case 245: /* expr ::= expr STAR expr */
-{yylhsminor.yy436 = tSqlExprCreate(yymsp[-2].minor.yy436, yymsp[0].minor.yy436, TK_STAR); }
- yymsp[-2].minor.yy436 = yylhsminor.yy436;
+{yylhsminor.yy454 = tSqlExprCreate(yymsp[-2].minor.yy454, yymsp[0].minor.yy454, TK_STAR); }
+ yymsp[-2].minor.yy454 = yylhsminor.yy454;
break;
case 246: /* expr ::= expr SLASH expr */
-{yylhsminor.yy436 = tSqlExprCreate(yymsp[-2].minor.yy436, yymsp[0].minor.yy436, TK_DIVIDE);}
- yymsp[-2].minor.yy436 = yylhsminor.yy436;
+{yylhsminor.yy454 = tSqlExprCreate(yymsp[-2].minor.yy454, yymsp[0].minor.yy454, TK_DIVIDE);}
+ yymsp[-2].minor.yy454 = yylhsminor.yy454;
break;
case 247: /* expr ::= expr REM expr */
-{yylhsminor.yy436 = tSqlExprCreate(yymsp[-2].minor.yy436, yymsp[0].minor.yy436, TK_REM); }
- yymsp[-2].minor.yy436 = yylhsminor.yy436;
+{yylhsminor.yy454 = tSqlExprCreate(yymsp[-2].minor.yy454, yymsp[0].minor.yy454, TK_REM); }
+ yymsp[-2].minor.yy454 = yylhsminor.yy454;
break;
case 248: /* expr ::= expr LIKE expr */
-{yylhsminor.yy436 = tSqlExprCreate(yymsp[-2].minor.yy436, yymsp[0].minor.yy436, TK_LIKE); }
- yymsp[-2].minor.yy436 = yylhsminor.yy436;
+{yylhsminor.yy454 = tSqlExprCreate(yymsp[-2].minor.yy454, yymsp[0].minor.yy454, TK_LIKE); }
+ yymsp[-2].minor.yy454 = yylhsminor.yy454;
break;
case 249: /* expr ::= expr IN LP exprlist RP */
-{yylhsminor.yy436 = tSqlExprCreate(yymsp[-4].minor.yy436, (tSqlExpr*)yymsp[-1].minor.yy291, TK_IN); }
- yymsp[-4].minor.yy436 = yylhsminor.yy436;
+{yylhsminor.yy454 = tSqlExprCreate(yymsp[-4].minor.yy454, (tSqlExpr*)yymsp[-1].minor.yy193, TK_IN); }
+ yymsp[-4].minor.yy454 = yylhsminor.yy454;
break;
case 250: /* exprlist ::= exprlist COMMA expritem */
-{yylhsminor.yy291 = tSqlExprListAppend(yymsp[-2].minor.yy291,yymsp[0].minor.yy436,0, 0);}
- yymsp[-2].minor.yy291 = yylhsminor.yy291;
+{yylhsminor.yy193 = tSqlExprListAppend(yymsp[-2].minor.yy193,yymsp[0].minor.yy454,0, 0);}
+ yymsp[-2].minor.yy193 = yylhsminor.yy193;
break;
case 251: /* exprlist ::= expritem */
-{yylhsminor.yy291 = tSqlExprListAppend(0,yymsp[0].minor.yy436,0, 0);}
- yymsp[0].minor.yy291 = yylhsminor.yy291;
+{yylhsminor.yy193 = tSqlExprListAppend(0,yymsp[0].minor.yy454,0, 0);}
+ yymsp[0].minor.yy193 = yylhsminor.yy193;
break;
case 252: /* expritem ::= expr */
-{yylhsminor.yy436 = yymsp[0].minor.yy436;}
- yymsp[0].minor.yy436 = yylhsminor.yy436;
+{yylhsminor.yy454 = yymsp[0].minor.yy454;}
+ yymsp[0].minor.yy454 = yylhsminor.yy454;
break;
case 254: /* cmd ::= RESET QUERY CACHE */
{ setDCLSqlElems(pInfo, TSDB_SQL_RESET_CACHE, 0);}
break;
- case 255: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
+ case 255: /* cmd ::= SYNCDB ids REPLICA */
+{ setDCLSqlElems(pInfo, TSDB_SQL_SYNC_DB_REPLICA, 1, &yymsp[-1].minor.yy0);}
+ break;
+ case 256: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
{
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
- SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy291, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, -1);
+ SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy193, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
- case 256: /* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
+ case 257: /* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
{
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
@@ -3310,14 +3318,14 @@ static YYACTIONTYPE yy_reduce(
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
- case 257: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
+ case 258: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
{
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
- SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy291, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, -1);
+ SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy193, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
- case 258: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
+ case 259: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
{
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
@@ -3328,7 +3336,7 @@ static YYACTIONTYPE yy_reduce(
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
- case 259: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
+ case 260: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
{
yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n;
@@ -3342,26 +3350,26 @@ static YYACTIONTYPE yy_reduce(
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
- case 260: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
+ case 261: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
{
yymsp[-6].minor.yy0.n += yymsp[-5].minor.yy0.n;
toTSDBType(yymsp[-2].minor.yy0.type);
SArray* A = tVariantListAppendToken(NULL, &yymsp[-2].minor.yy0, -1);
- A = tVariantListAppend(A, &yymsp[0].minor.yy216, -1);
+ A = tVariantListAppend(A, &yymsp[0].minor.yy442, -1);
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-6].minor.yy0, NULL, A, TSDB_ALTER_TABLE_UPDATE_TAG_VAL, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
- case 261: /* cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */
+ case 262: /* cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */
{
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
- SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy291, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, TSDB_SUPER_TABLE);
+ SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy193, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, TSDB_SUPER_TABLE);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
- case 262: /* cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */
+ case 263: /* cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */
{
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
@@ -3372,14 +3380,14 @@ static YYACTIONTYPE yy_reduce(
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
- case 263: /* cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */
+ case 264: /* cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */
{
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
- SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy291, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, TSDB_SUPER_TABLE);
+ SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy193, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, TSDB_SUPER_TABLE);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
- case 264: /* cmd ::= ALTER STABLE ids cpxName DROP TAG ids */
+ case 265: /* cmd ::= ALTER STABLE ids cpxName DROP TAG ids */
{
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
@@ -3390,7 +3398,7 @@ static YYACTIONTYPE yy_reduce(
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
- case 265: /* cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */
+ case 266: /* cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */
{
yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n;
@@ -3404,13 +3412,13 @@ static YYACTIONTYPE yy_reduce(
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
- case 266: /* cmd ::= KILL CONNECTION INTEGER */
+ case 267: /* cmd ::= KILL CONNECTION INTEGER */
{setKillSql(pInfo, TSDB_SQL_KILL_CONNECTION, &yymsp[0].minor.yy0);}
break;
- case 267: /* cmd ::= KILL STREAM INTEGER COLON INTEGER */
+ case 268: /* cmd ::= KILL STREAM INTEGER COLON INTEGER */
{yymsp[-2].minor.yy0.n += (yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setKillSql(pInfo, TSDB_SQL_KILL_STREAM, &yymsp[-2].minor.yy0);}
break;
- case 268: /* cmd ::= KILL QUERY INTEGER COLON INTEGER */
+ case 269: /* cmd ::= KILL QUERY INTEGER COLON INTEGER */
{yymsp[-2].minor.yy0.n += (yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setKillSql(pInfo, TSDB_SQL_KILL_QUERY, &yymsp[-2].minor.yy0);}
break;
default:
diff --git a/src/rpc/src/rpcMain.c b/src/rpc/src/rpcMain.c
index cae227cbdb..133ae6d0ab 100644
--- a/src/rpc/src/rpcMain.c
+++ b/src/rpc/src/rpcMain.c
@@ -1017,6 +1017,13 @@ static SRpcConn *rpcProcessMsgHead(SRpcInfo *pRpc, SRecvInfo *pRecv, SRpcReqCont
return pConn;
}
+static void doRpcReportBrokenLinkToServer(void *param, void *id) {
+ SRpcMsg *pRpcMsg = (SRpcMsg *)(param);
+ SRpcConn *pConn = (SRpcConn *)(pRpcMsg->handle);
+ SRpcInfo *pRpc = pConn->pRpc;
+ (*(pRpc->cfp))(pRpcMsg, NULL);
+ free(pRpcMsg);
+}
static void rpcReportBrokenLinkToServer(SRpcConn *pConn) {
SRpcInfo *pRpc = pConn->pRpc;
if (pConn->pReqMsg == NULL) return;
@@ -1025,16 +1032,20 @@ static void rpcReportBrokenLinkToServer(SRpcConn *pConn) {
rpcAddRef(pRpc);
tDebug("%s, notify the server app, connection is gone", pConn->info);
- SRpcMsg rpcMsg;
- rpcMsg.pCont = pConn->pReqMsg; // pReqMsg is re-used to store the APP context from server
- rpcMsg.contLen = pConn->reqMsgLen; // reqMsgLen is re-used to store the APP context length
- rpcMsg.ahandle = pConn->ahandle;
- rpcMsg.handle = pConn;
- rpcMsg.msgType = pConn->inType;
- rpcMsg.code = TSDB_CODE_RPC_NETWORK_UNAVAIL;
+ SRpcMsg *rpcMsg = malloc(sizeof(SRpcMsg));
+ rpcMsg->pCont = pConn->pReqMsg; // pReqMsg is re-used to store the APP context from server
+ rpcMsg->contLen = pConn->reqMsgLen; // reqMsgLen is re-used to store the APP context length
+ rpcMsg->ahandle = pConn->ahandle;
+ rpcMsg->handle = pConn;
+ rpcMsg->msgType = pConn->inType;
+ rpcMsg->code = TSDB_CODE_RPC_NETWORK_UNAVAIL;
pConn->pReqMsg = NULL;
pConn->reqMsgLen = 0;
- if (pRpc->cfp) (*(pRpc->cfp))(&rpcMsg, NULL);
+ if (pRpc->cfp) {
+ taosTmrStart(doRpcReportBrokenLinkToServer, 0, rpcMsg, pRpc->tmrCtrl);
+ } else {
+ free(rpcMsg);
+ }
}
static void rpcProcessBrokenLink(SRpcConn *pConn) {
@@ -1051,7 +1062,7 @@ static void rpcProcessBrokenLink(SRpcConn *pConn) {
pConn->pReqMsg = NULL;
taosTmrStart(rpcProcessConnError, 0, pContext, pRpc->tmrCtrl);
}
-
+
if (pConn->inType) rpcReportBrokenLinkToServer(pConn);
rpcReleaseConn(pConn);
diff --git a/src/sync/src/syncMain.c b/src/sync/src/syncMain.c
index 264bbf6b92..76d4379c5f 100644
--- a/src/sync/src/syncMain.c
+++ b/src/sync/src/syncMain.c
@@ -410,7 +410,7 @@ void syncConfirmForward(int64_t rid, uint64_t version, int32_t code, bool force)
syncReleaseNode(pNode);
}
-#if 0
+#if 1
void syncRecover(int64_t rid) {
SSyncPeer *pPeer;
diff --git a/src/tsdb/src/tsdbCommit.c b/src/tsdb/src/tsdbCommit.c
index 02dd2d1ca4..dd0fd18019 100644
--- a/src/tsdb/src/tsdbCommit.c
+++ b/src/tsdb/src/tsdbCommit.c
@@ -17,7 +17,7 @@
#define TSDB_MAX_SUBBLOCKS 8
static FORCE_INLINE int TSDB_KEY_FID(TSKEY key, int32_t days, int8_t precision) {
if (key < 0) {
- return (int)(-((-key) / tsMsPerDay[precision] / days + 1));
+ return (int)((key + 1) / tsMsPerDay[precision] / days + 1);
} else {
return (int)((key / tsMsPerDay[precision] / days));
}
@@ -452,6 +452,14 @@ static int tsdbCommitToFile(SCommitH *pCommith, SDFileSet *pSet, int fid) {
return -1;
}
+ if (tsdbUpdateDFileSetHeader(&(pCommith->wSet)) < 0) {
+ tsdbError("vgId:%d failed to update FSET %d header since %s", REPO_ID(pRepo), fid, tstrerror(terrno));
+ tsdbCloseCommitFile(pCommith, true);
+ // revert the file change
+ tsdbApplyDFileSetChange(TSDB_COMMIT_WRITE_FSET(pCommith), pSet);
+ return -1;
+ }
+
// Close commit file
tsdbCloseCommitFile(pCommith, false);
diff --git a/src/tsdb/src/tsdbFile.c b/src/tsdb/src/tsdbFile.c
index ac33096aae..304ba2f073 100644
--- a/src/tsdb/src/tsdbFile.c
+++ b/src/tsdb/src/tsdbFile.c
@@ -134,14 +134,14 @@ int tsdbCreateMFile(SMFile *pMFile, bool updateHeader) {
return 0;
}
+ pMFile->info.size += TSDB_FILE_HEAD_SIZE;
+
if (tsdbUpdateMFileHeader(pMFile) < 0) {
tsdbCloseMFile(pMFile);
tsdbRemoveMFile(pMFile);
return -1;
}
- pMFile->info.size += TSDB_FILE_HEAD_SIZE;
-
return 0;
}
@@ -378,14 +378,14 @@ int tsdbCreateDFile(SDFile *pDFile, bool updateHeader) {
return 0;
}
+ pDFile->info.size += TSDB_FILE_HEAD_SIZE;
+
if (tsdbUpdateDFileHeader(pDFile) < 0) {
tsdbCloseDFile(pDFile);
tsdbRemoveDFile(pDFile);
return -1;
}
- pDFile->info.size += TSDB_FILE_HEAD_SIZE;
-
return 0;
}
diff --git a/src/tsdb/src/tsdbRead.c b/src/tsdb/src/tsdbRead.c
index 648b6d3617..6c0137abf5 100644
--- a/src/tsdb/src/tsdbRead.c
+++ b/src/tsdb/src/tsdbRead.c
@@ -111,7 +111,7 @@ typedef struct STsdbQueryHandle {
bool loadExternalRow; // load time window external data rows
bool currentLoadExternalRows; // current load external rows
int32_t loadType; // block load type
- void* qinfo; // query info handle, for debug purpose
+ uint64_t qId; // query info handle, for debug purpose
int32_t type; // query type: retrieve all data blocks, 2. retrieve only last row, 3. retrieve direct prev|next rows
SDFileSet* pFileGroup;
SFSIter fileIter;
@@ -286,8 +286,8 @@ static SArray* createCheckInfoFromTableGroup(STsdbQueryHandle* pQueryHandle, STa
}
taosArrayPush(pTableCheckInfo, &info);
- tsdbDebug("%p check table uid:%"PRId64", tid:%d from lastKey:%"PRId64" %p", pQueryHandle, info.tableId.uid,
- info.tableId.tid, info.lastKey, pQueryHandle->qinfo);
+ tsdbDebug("%p check table uid:%"PRId64", tid:%d from lastKey:%"PRId64" %"PRIu64, pQueryHandle, info.tableId.uid,
+ info.tableId.tid, info.lastKey, pQueryHandle->qId);
}
}
@@ -339,7 +339,7 @@ static SArray* createCheckInfoFromCheckInfo(STableCheckInfo* pCheckInfo, TSKEY s
return pNew;
}
-static STsdbQueryHandle* tsdbQueryTablesImpl(STsdbRepo* tsdb, STsdbQueryCond* pCond, void* qinfo, SMemRef* pMemRef) {
+static STsdbQueryHandle* tsdbQueryTablesImpl(STsdbRepo* tsdb, STsdbQueryCond* pCond, uint64_t qId, SMemRef* pMemRef) {
STsdbQueryHandle* pQueryHandle = calloc(1, sizeof(STsdbQueryHandle));
if (pQueryHandle == NULL) {
goto out_of_memory;
@@ -353,7 +353,7 @@ static STsdbQueryHandle* tsdbQueryTablesImpl(STsdbRepo* tsdb, STsdbQueryCond* pC
pQueryHandle->cur.win = TSWINDOW_INITIALIZER;
pQueryHandle->checkFiles = true;
pQueryHandle->activeIndex = 0; // current active table index
- pQueryHandle->qinfo = qinfo;
+ pQueryHandle->qId = qId;
pQueryHandle->outputCapacity = ((STsdbRepo*)tsdb)->config.maxRowsPerFileBlock;
pQueryHandle->allocSize = 0;
pQueryHandle->locateStart = false;
@@ -406,7 +406,7 @@ static STsdbQueryHandle* tsdbQueryTablesImpl(STsdbRepo* tsdb, STsdbQueryCond* pC
pQueryHandle->pDataCols = tdNewDataCols(pMeta->maxRowBytes, pMeta->maxCols, pQueryHandle->pTsdb->config.maxRowsPerFileBlock);
if (pQueryHandle->pDataCols == NULL) {
- tsdbError("%p failed to malloc buf for pDataCols, %p", pQueryHandle, pQueryHandle->qinfo);
+ tsdbError("%p failed to malloc buf for pDataCols, %"PRIu64, pQueryHandle, pQueryHandle->qId);
terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
goto out_of_memory;
}
@@ -422,8 +422,8 @@ static STsdbQueryHandle* tsdbQueryTablesImpl(STsdbRepo* tsdb, STsdbQueryCond* pC
return NULL;
}
-TsdbQueryHandleT* tsdbQueryTables(STsdbRepo* tsdb, STsdbQueryCond* pCond, STableGroupInfo* groupList, void* qinfo, SMemRef* pRef) {
- STsdbQueryHandle* pQueryHandle = tsdbQueryTablesImpl(tsdb, pCond, qinfo, pRef);
+TsdbQueryHandleT* tsdbQueryTables(STsdbRepo* tsdb, STsdbQueryCond* pCond, STableGroupInfo* groupList, uint64_t qId, SMemRef* pRef) {
+ STsdbQueryHandle* pQueryHandle = tsdbQueryTablesImpl(tsdb, pCond, qId, pRef);
STsdbMeta* pMeta = tsdbGetMeta(tsdb);
assert(pMeta != NULL);
@@ -440,7 +440,7 @@ TsdbQueryHandleT* tsdbQueryTables(STsdbRepo* tsdb, STsdbQueryCond* pCond, STable
tsdbMayTakeMemSnapshot(pQueryHandle, psTable);
- tsdbDebug("%p total numOfTable:%" PRIzu " in query, %p", pQueryHandle, taosArrayGetSize(pQueryHandle->pTableCheckInfo), pQueryHandle->qinfo);
+ tsdbDebug("%p total numOfTable:%" PRIzu " in query, %"PRIu64, pQueryHandle, taosArrayGetSize(pQueryHandle->pTableCheckInfo), pQueryHandle->qId);
return (TsdbQueryHandleT) pQueryHandle;
}
@@ -512,7 +512,7 @@ void tsdbResetQueryHandleForNewTable(TsdbQueryHandleT queryHandle, STsdbQueryCon
pQueryHandle->next = doFreeColumnInfoData(pQueryHandle->next);
}
-TsdbQueryHandleT tsdbQueryLastRow(STsdbRepo *tsdb, STsdbQueryCond *pCond, STableGroupInfo *groupList, void* qinfo, SMemRef* pMemRef) {
+TsdbQueryHandleT tsdbQueryLastRow(STsdbRepo *tsdb, STsdbQueryCond *pCond, STableGroupInfo *groupList, uint64_t qId, SMemRef* pMemRef) {
pCond->twindow = updateLastrowForEachGroup(groupList);
// no qualified table
@@ -520,7 +520,7 @@ TsdbQueryHandleT tsdbQueryLastRow(STsdbRepo *tsdb, STsdbQueryCond *pCond, STable
return NULL;
}
- STsdbQueryHandle *pQueryHandle = (STsdbQueryHandle*) tsdbQueryTables(tsdb, pCond, groupList, qinfo, pMemRef);
+ STsdbQueryHandle *pQueryHandle = (STsdbQueryHandle*) tsdbQueryTables(tsdb, pCond, groupList, qId, pMemRef);
int32_t code = checkForCachedLastRow(pQueryHandle, groupList);
if (code != TSDB_CODE_SUCCESS) { // set the numOfTables to be 0
terrno = code;
@@ -581,10 +581,10 @@ static STableGroupInfo* trimTableGroup(STimeWindow* window, STableGroupInfo* pGr
return pNew;
}
-TsdbQueryHandleT tsdbQueryRowsInExternalWindow(STsdbRepo *tsdb, STsdbQueryCond* pCond, STableGroupInfo *groupList, void* qinfo, SMemRef* pRef) {
+TsdbQueryHandleT tsdbQueryRowsInExternalWindow(STsdbRepo *tsdb, STsdbQueryCond* pCond, STableGroupInfo *groupList, uint64_t qId, SMemRef* pRef) {
STableGroupInfo* pNew = trimTableGroup(&pCond->twindow, groupList);
- STsdbQueryHandle *pQueryHandle = (STsdbQueryHandle*) tsdbQueryTables(tsdb, pCond, pNew, qinfo, pRef);
+ STsdbQueryHandle *pQueryHandle = (STsdbQueryHandle*) tsdbQueryTables(tsdb, pCond, pNew, qId, pRef);
pQueryHandle->loadExternalRow = true;
pQueryHandle->currentLoadExternalRows = true;
@@ -651,9 +651,9 @@ static bool initTableMemIterator(STsdbQueryHandle* pHandle, STableCheckInfo* pCh
SDataRow row = (SDataRow)SL_GET_NODE_DATA(node);
TSKEY key = dataRowKey(row); // first timestamp in buffer
tsdbDebug("%p uid:%" PRId64 ", tid:%d check data in mem from skey:%" PRId64 ", order:%d, ts range in buf:%" PRId64
- "-%" PRId64 ", lastKey:%" PRId64 ", numOfRows:%"PRId64", %p",
+ "-%" PRId64 ", lastKey:%" PRId64 ", numOfRows:%"PRId64", %"PRIu64,
pHandle, pCheckInfo->tableId.uid, pCheckInfo->tableId.tid, key, order, pMem->keyFirst, pMem->keyLast,
- pCheckInfo->lastKey, pMem->numOfRows, pHandle->qinfo);
+ pCheckInfo->lastKey, pMem->numOfRows, pHandle->qId);
if (ASCENDING_TRAVERSE(order)) {
assert(pCheckInfo->lastKey <= key);
@@ -662,8 +662,8 @@ static bool initTableMemIterator(STsdbQueryHandle* pHandle, STableCheckInfo* pCh
}
} else {
- tsdbDebug("%p uid:%"PRId64", tid:%d no data in mem, %p", pHandle, pCheckInfo->tableId.uid, pCheckInfo->tableId.tid,
- pHandle->qinfo);
+ tsdbDebug("%p uid:%"PRId64", tid:%d no data in mem, %"PRIu64, pHandle, pCheckInfo->tableId.uid, pCheckInfo->tableId.tid,
+ pHandle->qId);
}
if (!imemEmpty) {
@@ -673,9 +673,9 @@ static bool initTableMemIterator(STsdbQueryHandle* pHandle, STableCheckInfo* pCh
SDataRow row = (SDataRow)SL_GET_NODE_DATA(node);
TSKEY key = dataRowKey(row); // first timestamp in buffer
tsdbDebug("%p uid:%" PRId64 ", tid:%d check data in imem from skey:%" PRId64 ", order:%d, ts range in buf:%" PRId64
- "-%" PRId64 ", lastKey:%" PRId64 ", numOfRows:%"PRId64", %p",
+ "-%" PRId64 ", lastKey:%" PRId64 ", numOfRows:%"PRId64", %"PRIu64,
pHandle, pCheckInfo->tableId.uid, pCheckInfo->tableId.tid, key, order, pIMem->keyFirst, pIMem->keyLast,
- pCheckInfo->lastKey, pIMem->numOfRows, pHandle->qinfo);
+ pCheckInfo->lastKey, pIMem->numOfRows, pHandle->qId);
if (ASCENDING_TRAVERSE(order)) {
assert(pCheckInfo->lastKey <= key);
@@ -683,8 +683,8 @@ static bool initTableMemIterator(STsdbQueryHandle* pHandle, STableCheckInfo* pCh
assert(pCheckInfo->lastKey >= key);
}
} else {
- tsdbDebug("%p uid:%"PRId64", tid:%d no data in imem, %p", pHandle, pCheckInfo->tableId.uid, pCheckInfo->tableId.tid,
- pHandle->qinfo);
+ tsdbDebug("%p uid:%"PRId64", tid:%d no data in imem, %"PRIu64, pHandle, pCheckInfo->tableId.uid, pCheckInfo->tableId.tid,
+ pHandle->qId);
}
return true;
@@ -811,8 +811,8 @@ static bool hasMoreDataInCache(STsdbQueryHandle* pHandle) {
}
pCheckInfo->lastKey = dataRowKey(row); // first timestamp in buffer
- tsdbDebug("%p uid:%" PRId64", tid:%d check data in buffer from skey:%" PRId64 ", order:%d, %p", pHandle,
- pCheckInfo->tableId.uid, pCheckInfo->tableId.tid, pCheckInfo->lastKey, pHandle->order, pHandle->qinfo);
+ tsdbDebug("%p uid:%" PRId64", tid:%d check data in buffer from skey:%" PRId64 ", order:%d, %"PRIu64, pHandle,
+ pCheckInfo->tableId.uid, pCheckInfo->tableId.tid, pCheckInfo->lastKey, pHandle->order, pHandle->qId);
// all data in mem are checked already.
if ((pCheckInfo->lastKey > pHandle->window.ekey && ASCENDING_TRAVERSE(pHandle->order)) ||
@@ -984,21 +984,21 @@ static int32_t doLoadFileDataBlock(STsdbQueryHandle* pQueryHandle, SBlock* pBloc
STSchema *pSchema = tsdbGetTableSchema(pCheckInfo->pTableObj);
int32_t code = tdInitDataCols(pQueryHandle->pDataCols, pSchema);
if (code != TSDB_CODE_SUCCESS) {
- tsdbError("%p failed to malloc buf for pDataCols, %p", pQueryHandle, pQueryHandle->qinfo);
+ tsdbError("%p failed to malloc buf for pDataCols, %"PRIu64, pQueryHandle, pQueryHandle->qId);
terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
goto _error;
}
code = tdInitDataCols(pQueryHandle->rhelper.pDCols[0], pSchema);
if (code != TSDB_CODE_SUCCESS) {
- tsdbError("%p failed to malloc buf for rhelper.pDataCols[0], %p", pQueryHandle, pQueryHandle->qinfo);
+ tsdbError("%p failed to malloc buf for rhelper.pDataCols[0], %"PRIu64, pQueryHandle, pQueryHandle->qId);
terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
goto _error;
}
code = tdInitDataCols(pQueryHandle->rhelper.pDCols[1], pSchema);
if (code != TSDB_CODE_SUCCESS) {
- tsdbError("%p failed to malloc buf for rhelper.pDataCols[1], %p", pQueryHandle, pQueryHandle->qinfo);
+ tsdbError("%p failed to malloc buf for rhelper.pDataCols[1], %"PRIu64, pQueryHandle, pQueryHandle->qId);
terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
goto _error;
}
@@ -1034,15 +1034,15 @@ static int32_t doLoadFileDataBlock(STsdbQueryHandle* pQueryHandle, SBlock* pBloc
int64_t elapsedTime = (taosGetTimestampUs() - st);
pQueryHandle->cost.blockLoadTime += elapsedTime;
- tsdbDebug("%p load file block into buffer, index:%d, brange:%"PRId64"-%"PRId64", rows:%d, elapsed time:%"PRId64 " us, %p",
- pQueryHandle, slotIndex, pBlock->keyFirst, pBlock->keyLast, pBlock->numOfRows, elapsedTime, pQueryHandle->qinfo);
+ tsdbDebug("%p load file block into buffer, index:%d, brange:%"PRId64"-%"PRId64", rows:%d, elapsed time:%"PRId64 " us, %"PRIu64,
+ pQueryHandle, slotIndex, pBlock->keyFirst, pBlock->keyLast, pBlock->numOfRows, elapsedTime, pQueryHandle->qId);
return TSDB_CODE_SUCCESS;
_error:
pBlock->numOfRows = 0;
- tsdbError("%p error occurs in loading file block, index:%d, brange:%"PRId64"-%"PRId64", rows:%d, %p",
- pQueryHandle, slotIndex, pBlock->keyFirst, pBlock->keyLast, pBlock->numOfRows, pQueryHandle->qinfo);
+ tsdbError("%p error occurs in loading file block, index:%d, brange:%"PRId64"-%"PRId64", rows:%d, %"PRIu64,
+ pQueryHandle, slotIndex, pBlock->keyFirst, pBlock->keyLast, pBlock->numOfRows, pQueryHandle->qId);
return terrno;
}
@@ -1064,7 +1064,7 @@ static int32_t handleDataMergeIfNeeded(STsdbQueryHandle* pQueryHandle, SBlock* p
assert(cur->pos >= 0 && cur->pos <= binfo.rows);
TSKEY key = (row != NULL)? dataRowKey(row):TSKEY_INITIAL_VAL;
- tsdbDebug("%p key in mem:%"PRId64", %p", pQueryHandle, key, pQueryHandle->qinfo);
+ tsdbDebug("%p key in mem:%"PRId64", %"PRIu64, pQueryHandle, key, pQueryHandle->qId);
if ((ASCENDING_TRAVERSE(pQueryHandle->order) && (key != TSKEY_INITIAL_VAL && key <= binfo.window.ekey)) ||
(!ASCENDING_TRAVERSE(pQueryHandle->order) && (key != TSKEY_INITIAL_VAL && key >= binfo.window.skey))) {
@@ -1545,9 +1545,9 @@ static void copyAllRemainRowsFromFileBlock(STsdbQueryHandle* pQueryHandle, STabl
updateInfoAfterMerge(pQueryHandle, pCheckInfo, numOfRows, pos);
doCheckGeneratedBlockRange(pQueryHandle);
- tsdbDebug("%p uid:%" PRIu64",tid:%d data block created, mixblock:%d, brange:%"PRIu64"-%"PRIu64" rows:%d, %p",
+ tsdbDebug("%p uid:%" PRIu64",tid:%d data block created, mixblock:%d, brange:%"PRIu64"-%"PRIu64" rows:%d, %"PRIu64,
pQueryHandle, pCheckInfo->tableId.uid, pCheckInfo->tableId.tid, cur->mixBlock, cur->win.skey,
- cur->win.ekey, cur->rows, pQueryHandle->qinfo);
+ cur->win.ekey, cur->rows, pQueryHandle->qId);
}
int32_t getEndPosInDataBlock(STsdbQueryHandle* pQueryHandle, SDataBlockInfo* pBlockInfo) {
@@ -1599,9 +1599,9 @@ static void doMergeTwoLevelData(STsdbQueryHandle* pQueryHandle, STableCheckInfo*
int32_t endPos = getEndPosInDataBlock(pQueryHandle, &blockInfo);
tsdbDebug("%p uid:%" PRIu64",tid:%d start merge data block, file block range:%"PRIu64"-%"PRIu64" rows:%d, start:%d,"
- "end:%d, %p",
+ "end:%d, %"PRIu64,
pQueryHandle, pCheckInfo->tableId.uid, pCheckInfo->tableId.tid, blockInfo.window.skey, blockInfo.window.ekey,
- blockInfo.rows, cur->pos, endPos, pQueryHandle->qinfo);
+ blockInfo.rows, cur->pos, endPos, pQueryHandle->qId);
// compared with the data from in-memory buffer, to generate the correct timestamp array list
int32_t numOfRows = 0;
@@ -1741,9 +1741,9 @@ static void doMergeTwoLevelData(STsdbQueryHandle* pQueryHandle, STableCheckInfo*
updateInfoAfterMerge(pQueryHandle, pCheckInfo, numOfRows, pos);
doCheckGeneratedBlockRange(pQueryHandle);
- tsdbDebug("%p uid:%" PRIu64",tid:%d data block created, mixblock:%d, brange:%"PRIu64"-%"PRIu64" rows:%d, %p",
+ tsdbDebug("%p uid:%" PRIu64",tid:%d data block created, mixblock:%d, brange:%"PRIu64"-%"PRIu64" rows:%d, %"PRIu64,
pQueryHandle, pCheckInfo->tableId.uid, pCheckInfo->tableId.tid, cur->mixBlock, cur->win.skey,
- cur->win.ekey, cur->rows, pQueryHandle->qinfo);
+ cur->win.ekey, cur->rows, pQueryHandle->qId);
}
int32_t binarySearchForKey(char* pValue, int num, TSKEY key, int order) {
@@ -1917,13 +1917,13 @@ static int32_t createDataBlocksInfo(STsdbQueryHandle* pQueryHandle, int32_t numO
memcpy(pQueryHandle->pDataBlockInfo, sup.pDataBlockInfo[0], sizeof(STableBlockInfo) * numOfBlocks);
cleanBlockOrderSupporter(&sup, numOfQualTables);
- tsdbDebug("%p create data blocks info struct completed for 1 table, %d blocks not sorted %p ", pQueryHandle, cnt,
- pQueryHandle->qinfo);
+ tsdbDebug("%p create data blocks info struct completed for 1 table, %d blocks not sorted %"PRIu64, pQueryHandle, cnt,
+ pQueryHandle->qId);
return TSDB_CODE_SUCCESS;
}
- tsdbDebug("%p create data blocks info struct completed, %d blocks in %d tables %p", pQueryHandle, cnt,
- numOfQualTables, pQueryHandle->qinfo);
+ tsdbDebug("%p create data blocks info struct completed, %d blocks in %d tables %"PRIu64, pQueryHandle, cnt,
+ numOfQualTables, pQueryHandle->qId);
assert(cnt <= numOfBlocks && numOfQualTables <= numOfTables); // the pTableQueryInfo[j]->numOfBlocks may be 0
sup.numOfTables = numOfQualTables;
@@ -1959,7 +1959,7 @@ static int32_t createDataBlocksInfo(STsdbQueryHandle* pQueryHandle, int32_t numO
* }
*/
- tsdbDebug("%p %d data blocks sort completed, %p", pQueryHandle, cnt, pQueryHandle->qinfo);
+ tsdbDebug("%p %d data blocks sort completed, %"PRIu64, pQueryHandle, cnt, pQueryHandle->qId);
cleanBlockOrderSupporter(&sup, numOfTables);
free(pTree);
@@ -2017,8 +2017,8 @@ static int32_t getFirstFileDataBlock(STsdbQueryHandle* pQueryHandle, bool* exist
if ((ASCENDING_TRAVERSE(pQueryHandle->order) && win.skey > pQueryHandle->window.ekey) ||
(!ASCENDING_TRAVERSE(pQueryHandle->order) && win.ekey < pQueryHandle->window.ekey)) {
tsdbUnLockFS(REPO_FS(pQueryHandle->pTsdb));
- tsdbDebug("%p remain files are not qualified for qrange:%" PRId64 "-%" PRId64 ", ignore, %p", pQueryHandle,
- pQueryHandle->window.skey, pQueryHandle->window.ekey, pQueryHandle->qinfo);
+ tsdbDebug("%p remain files are not qualified for qrange:%" PRId64 "-%" PRId64 ", ignore, %"PRIu64, pQueryHandle,
+ pQueryHandle->window.skey, pQueryHandle->window.ekey, pQueryHandle->qId);
pQueryHandle->pFileGroup = NULL;
assert(pQueryHandle->numOfBlocks == 0);
break;
@@ -2041,8 +2041,8 @@ static int32_t getFirstFileDataBlock(STsdbQueryHandle* pQueryHandle, bool* exist
break;
}
- tsdbDebug("%p %d blocks found in file for %d table(s), fid:%d, %p", pQueryHandle, numOfBlocks, numOfTables,
- pQueryHandle->pFileGroup->fid, pQueryHandle->qinfo);
+ tsdbDebug("%p %d blocks found in file for %d table(s), fid:%d, %"PRIu64, pQueryHandle, numOfBlocks, numOfTables,
+ pQueryHandle->pFileGroup->fid, pQueryHandle->qId);
assert(numOfBlocks >= 0);
if (numOfBlocks == 0) {
@@ -2133,8 +2133,8 @@ int32_t tsdbGetFileBlocksDistInfo(TsdbQueryHandleT* queryHandle, STableBlockDist
if ((ASCENDING_TRAVERSE(pQueryHandle->order) && win.skey > pQueryHandle->window.ekey) ||
(!ASCENDING_TRAVERSE(pQueryHandle->order) && win.ekey < pQueryHandle->window.ekey)) {
tsdbUnLockFS(REPO_FS(pQueryHandle->pTsdb));
- tsdbDebug("%p remain files are not qualified for qrange:%" PRId64 "-%" PRId64 ", ignore, %p", pQueryHandle,
- pQueryHandle->window.skey, pQueryHandle->window.ekey, pQueryHandle->qinfo);
+ tsdbDebug("%p remain files are not qualified for qrange:%" PRId64 "-%" PRId64 ", ignore, %"PRIu64, pQueryHandle,
+ pQueryHandle->window.skey, pQueryHandle->window.ekey, pQueryHandle->qId);
pQueryHandle->pFileGroup = NULL;
break;
}
@@ -2157,8 +2157,8 @@ int32_t tsdbGetFileBlocksDistInfo(TsdbQueryHandleT* queryHandle, STableBlockDist
break;
}
- tsdbDebug("%p %d blocks found in file for %d table(s), fid:%d, %p", pQueryHandle, numOfBlocks, numOfTables,
- pQueryHandle->pFileGroup->fid, pQueryHandle->qinfo);
+ tsdbDebug("%p %d blocks found in file for %d table(s), fid:%d, %"PRIu64, pQueryHandle, numOfBlocks, numOfTables,
+ pQueryHandle->pFileGroup->fid, pQueryHandle->qId);
if (numOfBlocks == 0) {
continue;
@@ -2205,8 +2205,8 @@ static int32_t getDataBlocksInFiles(STsdbQueryHandle* pQueryHandle, bool* exists
if ((!cur->mixBlock) || cur->blockCompleted) {
// all data blocks in current file has been checked already, try next file if exists
} else {
- tsdbDebug("%p continue in current data block, index:%d, pos:%d, %p", pQueryHandle, cur->slot, cur->pos,
- pQueryHandle->qinfo);
+ tsdbDebug("%p continue in current data block, index:%d, pos:%d, %"PRIu64, pQueryHandle, cur->slot, cur->pos,
+ pQueryHandle->qId);
int32_t code = handleDataMergeIfNeeded(pQueryHandle, pBlockInfo->compBlock, pCheckInfo);
*exists = (pQueryHandle->realNumOfRows > 0);
@@ -2334,8 +2334,8 @@ static int tsdbReadRowsFromCache(STableCheckInfo* pCheckInfo, TSKEY maxKey, int
}
int64_t elapsedTime = taosGetTimestampUs() - st;
- tsdbDebug("%p build data block from cache completed, elapsed time:%"PRId64" us, numOfRows:%d, numOfCols:%d, %p", pQueryHandle,
- elapsedTime, numOfRows, numOfCols, pQueryHandle->qinfo);
+ tsdbDebug("%p build data block from cache completed, elapsed time:%"PRId64" us, numOfRows:%d, numOfCols:%d, %"PRIu64, pQueryHandle,
+ elapsedTime, numOfRows, numOfCols, pQueryHandle->qId);
return numOfRows;
}
@@ -2593,7 +2593,7 @@ static int32_t doGetExternalRow(STsdbQueryHandle* pQueryHandle, int16_t type, SM
memcpy(&cond.colList[i], &pColInfoData->info, sizeof(SColumnInfo));
}
- pSecQueryHandle = tsdbQueryTablesImpl(pQueryHandle->pTsdb, &cond, pQueryHandle->qinfo, pMemRef);
+ pSecQueryHandle = tsdbQueryTablesImpl(pQueryHandle->pTsdb, &cond, pQueryHandle->qId, pMemRef);
tfree(cond.colList);
// current table, only one table
@@ -3393,8 +3393,8 @@ void tsdbCleanupQueryHandle(TsdbQueryHandleT queryHandle) {
pQueryHandle->next = doFreeColumnInfoData(pQueryHandle->next);
SIOCostSummary* pCost = &pQueryHandle->cost;
- tsdbDebug("%p :io-cost summary: statis-info:%"PRId64" us, datablock:%" PRId64" us, check data:%"PRId64" us, %p",
- pQueryHandle, pCost->statisInfoLoadTime, pCost->blockLoadTime, pCost->checkForNextTime, pQueryHandle->qinfo);
+ tsdbDebug("%p :io-cost summary: statis-info:%"PRId64" us, datablock:%" PRId64" us, check data:%"PRId64" us, %"PRIu64,
+ pQueryHandle, pCost->statisInfoLoadTime, pCost->blockLoadTime, pCost->checkForNextTime, pQueryHandle->qId);
tfree(pQueryHandle);
}
diff --git a/src/vnode/inc/vnodeMain.h b/src/vnode/inc/vnodeMain.h
index 73591bc10d..91a5d632cd 100644
--- a/src/vnode/inc/vnodeMain.h
+++ b/src/vnode/inc/vnodeMain.h
@@ -25,6 +25,7 @@ int32_t vnodeCreate(SCreateVnodeMsg *pVnodeCfg);
int32_t vnodeDrop(int32_t vgId);
int32_t vnodeOpen(int32_t vgId);
int32_t vnodeAlter(void *pVnode, SCreateVnodeMsg *pVnodeCfg);
+int32_t vnodeSync(int32_t vgId);
int32_t vnodeClose(int32_t vgId);
void vnodeCleanUp(SVnodeObj *pVnode);
void vnodeDestroy(SVnodeObj *pVnode);
@@ -33,4 +34,4 @@ void vnodeDestroy(SVnodeObj *pVnode);
}
#endif
-#endif
\ No newline at end of file
+#endif
diff --git a/src/vnode/src/vnodeMain.c b/src/vnode/src/vnodeMain.c
index ded39e67cc..441e951250 100644
--- a/src/vnode/src/vnodeMain.c
+++ b/src/vnode/src/vnodeMain.c
@@ -91,6 +91,23 @@ int32_t vnodeCreate(SCreateVnodeMsg *pVnodeCfg) {
return code;
}
+int32_t vnodeSync(int32_t vgId) {
+ SVnodeObj *pVnode = vnodeAcquire(vgId);
+ if (pVnode == NULL) {
+ vDebug("vgId:%d, failed to sync, vnode not find", vgId);
+ return TSDB_CODE_VND_INVALID_VGROUP_ID;
+ }
+
+ if (pVnode->role != TAOS_SYNC_ROLE_MASTER) {
+ vInfo("vgId:%d, vnode will sync, refCount:%d pVnode:%p", pVnode->vgId, pVnode->refCount, pVnode);
+ syncRecover(pVnode->sync);
+ }
+
+ vnodeRelease(pVnode);
+
+ return TSDB_CODE_SUCCESS;
+}
+
int32_t vnodeDrop(int32_t vgId) {
SVnodeObj *pVnode = vnodeAcquire(vgId);
if (pVnode == NULL) {
diff --git a/src/vnode/src/vnodeRead.c b/src/vnode/src/vnodeRead.c
index ef68499b88..8233c45632 100644
--- a/src/vnode/src/vnodeRead.c
+++ b/src/vnode/src/vnodeRead.c
@@ -25,7 +25,7 @@ static int32_t (*vnodeProcessReadMsgFp[TSDB_MSG_TYPE_MAX])(SVnodeObj *pVnode, SV
static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SVReadMsg *pRead);
static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, SVReadMsg *pRead);
-static int32_t vnodeNotifyCurrentQhandle(void* handle, void* qhandle, int32_t vgId);
+static int32_t vnodeNotifyCurrentQhandle(void* handle, uint64_t qId, void* qhandle, int32_t vgId);
int32_t vnodeInitRead(void) {
vnodeProcessReadMsgFp[TSDB_MSG_TYPE_QUERY] = vnodeProcessQueryMsg;
@@ -167,7 +167,7 @@ static int32_t vnodePutItemIntoReadQueue(SVnodeObj *pVnode, void **qhandle, void
* @param ahandle sqlObj address at client side
* @return
*/
-static int32_t vnodeDumpQueryResult(SRspRet *pRet, void *pVnode, void **handle, bool *freeHandle, void *ahandle) {
+static int32_t vnodeDumpQueryResult(SRspRet *pRet, void *pVnode, uint64_t qId, void **handle, bool *freeHandle, void *ahandle) {
bool continueExec = false;
int32_t code = TSDB_CODE_SUCCESS;
@@ -183,7 +183,7 @@ static int32_t vnodeDumpQueryResult(SRspRet *pRet, void *pVnode, void **handle,
}
} else {
*freeHandle = true;
- vTrace("QInfo:%p exec completed, free handle:%d", *handle, *freeHandle);
+ vTrace("QInfo:%"PRIu64"-%p exec completed, free handle:%d", qId, *handle, *freeHandle);
}
} else {
SRetrieveTableRsp *pRsp = (SRetrieveTableRsp *)rpcMallocCont(sizeof(SRetrieveTableRsp));
@@ -220,27 +220,6 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
if (pRead->code == TSDB_CODE_RPC_NETWORK_UNAVAIL) {
vError("error rpc msg in query, %s", tstrerror(pRead->code));
}
-// assert(pRead->code != TSDB_CODE_RPC_NETWORK_UNAVAIL);
-// if (pRead->code == TSDB_CODE_RPC_NETWORK_UNAVAIL) {
-// SCancelQueryMsg *pMsg = (SCancelQueryMsg *)pRead->pCont;
-//// pMsg->free = htons(killQueryMsg->free);
-// pMsg->qhandle = htobe64(pMsg->qhandle);
-//
-// vWarn("QInfo:%p connection %p broken, kill query", (void *)pMsg->qhandle, pRead->rpcHandle);
-//// assert(pRead->contLen > 0 && pMsg->free == 1);
-//
-// void **qhandle = qAcquireQInfo(pVnode->qMgmt, (uint64_t)pMsg->qhandle);
-// if (qhandle == NULL || *qhandle == NULL) {
-// vWarn("QInfo:%p invalid qhandle, no matched query handle, conn:%p", (void *)pMsg->qhandle, pRead->rpcHandle);
-// } else {
-// assert(*qhandle == (void *)pMsg->qhandle);
-//
-// qKillQuery(*qhandle);
-// qReleaseQInfo(pVnode->qMgmt, (void **)&qhandle, true);
-// }
-//
-// return TSDB_CODE_TSC_QUERY_CANCELLED;
-// }
int32_t code = TSDB_CODE_SUCCESS;
void ** handle = NULL;
@@ -274,7 +253,7 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
}
if (handle != NULL &&
- vnodeNotifyCurrentQhandle(pRead->rpcHandle, *handle, pVnode->vgId) != TSDB_CODE_SUCCESS) {
+ vnodeNotifyCurrentQhandle(pRead->rpcHandle, qId, *handle, pVnode->vgId) != TSDB_CODE_SUCCESS) {
vError("vgId:%d, QInfo:%"PRIu64 "-%p, query discarded since link is broken, %p", pVnode->vgId, qId, *handle,
pRead->rpcHandle);
pRsp->code = TSDB_CODE_RPC_NETWORK_UNAVAIL;
@@ -297,16 +276,17 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
} else {
assert(pCont != NULL);
void **qhandle = (void **)pRead->qhandle;
+ uint64_t qId = 0;
vTrace("vgId:%d, QInfo:%p, dnode continues to exec query", pVnode->vgId, *qhandle);
// In the retrieve blocking model, only 50% CPU will be used in query processing
if (tsRetrieveBlockingModel) {
- qTableQuery(*qhandle); // do execute query
+ qTableQuery(*qhandle, &qId); // do execute query
qReleaseQInfo(pVnode->qMgmt, (void **)&qhandle, false);
} else {
bool freehandle = false;
- bool buildRes = qTableQuery(*qhandle); // do execute query
+ bool buildRes = qTableQuery(*qhandle, &qId); // do execute query
// build query rsp, the retrieve request has reached here already
if (buildRes) {
@@ -318,7 +298,7 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
pRead->rpcHandle);
// set the real rsp error code
- pRead->code = vnodeDumpQueryResult(&pRead->rspRet, pVnode, qhandle, &freehandle, pRead->rpcHandle);
+ pRead->code = vnodeDumpQueryResult(&pRead->rspRet, pVnode, qId, qhandle, &freehandle, pRead->rpcHandle);
// NOTE: set return code to be TSDB_CODE_QRY_HAS_RSP to notify dnode to return msg to client
code = TSDB_CODE_QRY_HAS_RSP;
@@ -348,32 +328,32 @@ static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
SRetrieveTableMsg *pRetrieve = pCont;
pRetrieve->free = htons(pRetrieve->free);
- pRetrieve->qhandle = htobe64(pRetrieve->qhandle);
+ pRetrieve->qId = htobe64(pRetrieve->qId);
- vTrace("vgId:%d, QInfo:%" PRIu64 ", retrieve msg is disposed, free:%d, conn:%p", pVnode->vgId, pRetrieve->qhandle,
+ vTrace("vgId:%d, qId:%" PRIu64 ", retrieve msg is disposed, free:%d, conn:%p", pVnode->vgId, pRetrieve->qId,
pRetrieve->free, pRead->rpcHandle);
memset(pRet, 0, sizeof(SRspRet));
terrno = TSDB_CODE_SUCCESS;
int32_t code = TSDB_CODE_SUCCESS;
- void ** handle = qAcquireQInfo(pVnode->qMgmt, pRetrieve->qhandle);
+ void ** handle = qAcquireQInfo(pVnode->qMgmt, pRetrieve->qId);
if (handle == NULL) {
code = terrno;
terrno = TSDB_CODE_SUCCESS;
- } else if (!checkQIdEqual(*handle, pRetrieve->qhandle)) {
+ } else if (!checkQIdEqual(*handle, pRetrieve->qId)) {
code = TSDB_CODE_QRY_INVALID_QHANDLE;
}
if (code != TSDB_CODE_SUCCESS) {
- vError("vgId:%d, invalid handle in retrieving result, code:%s, QInfo:%" PRIu64, pVnode->vgId, tstrerror(code), pRetrieve->qhandle);
+ vError("vgId:%d, invalid qId in retrieving result, code:%s, QInfo:%" PRIu64, pVnode->vgId, tstrerror(code), pRetrieve->qId);
vnodeBuildNoResultQueryRsp(pRet);
return code;
}
// kill current query and free corresponding resources.
if (pRetrieve->free == 1) {
- vWarn("vgId:%d, QInfo:%"PRIu64 "-%p, retrieve msg received to kill query and free qhandle", pVnode->vgId, pRetrieve->qhandle, *handle);
+ vWarn("vgId:%d, QInfo:%"PRIu64 "-%p, retrieve msg received to kill query and free qhandle", pVnode->vgId, pRetrieve->qId, *handle);
qKillQuery(*handle);
qReleaseQInfo(pVnode->qMgmt, (void **)&handle, true);
@@ -383,7 +363,7 @@ static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
}
// register the qhandle to connect to quit query immediate if connection is broken
- if (vnodeNotifyCurrentQhandle(pRead->rpcHandle, *handle, pVnode->vgId) != TSDB_CODE_SUCCESS) {
+ if (vnodeNotifyCurrentQhandle(pRead->rpcHandle, pRetrieve->qId, *handle, pVnode->vgId) != TSDB_CODE_SUCCESS) {
vError("vgId:%d, QInfo:%"PRIu64 "-%p, retrieve discarded since link is broken, %p", pVnode->vgId, pRetrieve->qhandle, *handle, pRead->rpcHandle);
code = TSDB_CODE_RPC_NETWORK_UNAVAIL;
qKillQuery(*handle);
@@ -413,7 +393,7 @@ static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
}
// ahandle is the sqlObj pointer
- code = vnodeDumpQueryResult(pRet, pVnode, handle, &freeHandle, pRead->rpcHandle);
+ code = vnodeDumpQueryResult(pRet, pVnode, pRetrieve->qId, handle, &freeHandle, pRead->rpcHandle);
}
// If qhandle is not added into vread queue, the query should be completed already or paused with error.
@@ -427,13 +407,13 @@ static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
// notify connection(handle) that current qhandle is created, if current connection from
// client is broken, the query needs to be killed immediately.
-int32_t vnodeNotifyCurrentQhandle(void *handle, void *qhandle, int32_t vgId) {
+int32_t vnodeNotifyCurrentQhandle(void *handle, uint64_t qId, void *qhandle, int32_t vgId) {
SRetrieveTableMsg *pMsg = rpcMallocCont(sizeof(SRetrieveTableMsg));
pMsg->qhandle = htobe64((uint64_t)qhandle);
pMsg->header.vgId = htonl(vgId);
pMsg->header.contLen = htonl(sizeof(SRetrieveTableMsg));
- vTrace("QInfo:%p register qhandle to connect:%p", qhandle, handle);
+ vTrace("QInfo:%"PRIu64"-%p register qhandle to connect:%p", qId, qhandle, handle);
return rpcReportProgress(handle, (char *)pMsg, sizeof(SRetrieveTableMsg));
}
diff --git a/tests/Jenkinsfile b/tests/Jenkinsfile
index 7cdcfb2e24..178a0446c3 100644
--- a/tests/Jenkinsfile
+++ b/tests/Jenkinsfile
@@ -1,9 +1,8 @@
def pre_test(){
- catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
- sh '''
- sudo rmtaos
- '''
- }
+
+ sh '''
+ sudo rmtaos||echo 'no taosd installed'
+ '''
sh '''
cd ${WKC}
git reset --hard
@@ -56,14 +55,8 @@ pipeline {
cd ${WKC}/tests
./test-all.sh b1
date'''
- sh '''
- cd ${WKC}/tests
- ./test-all.sh full jdbc
- date'''
- sh '''
- cd ${WKC}/tests
- ./test-all.sh full unit
- date'''
+
+
}
}
@@ -83,9 +76,20 @@ pipeline {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh '''
cd ${WKC}/tests/pytest
+ rm -rf /var/lib/taos/*
+ rm -rf /var/log/taos/*
./handle_crash_gen_val_log.sh
'''
}
+ catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
+ sh '''
+ cd ${WKC}/tests/pytest
+ rm -rf /var/lib/taos/*
+ rm -rf /var/log/taos/*
+ ./handle_taosd_val_log.sh
+ '''
+ }
+
sh'''
systemctl start taosd
sleep 10
@@ -136,6 +140,10 @@ pipeline {
./test-all.sh b2
date
'''
+ sh '''
+ cd ${WKC}/tests
+ ./test-all.sh full unit
+ date'''
}
}
@@ -154,6 +162,10 @@ pipeline {
'''
}
sh '''
+ cd ${WKC}/tests
+ ./test-all.sh full jdbc
+ date'''
+ sh '''
cd ${WKC}/tests/pytest
./valgrind-test.sh 2>&1 > mem-error-out.log
./handle_val_log.sh
@@ -162,6 +174,11 @@ pipeline {
cd ${WKC}/tests
./test-all.sh b3
date'''
+ sh '''
+ date
+ cd ${WKC}/tests
+ ./test-all.sh full example
+ date'''
}
}
diff --git a/tests/examples/JDBC/taosdemo/src/main/resources/insert.json b/tests/examples/JDBC/taosdemo/src/main/resources/insert.json
index a7bd87e6d3..35c7773175 100644
--- a/tests/examples/JDBC/taosdemo/src/main/resources/insert.json
+++ b/tests/examples/JDBC/taosdemo/src/main/resources/insert.json
@@ -38,7 +38,7 @@
"insert_rows": 100,
"multi_thread_write_one_tbl": "no",
"number_of_tbl_in_one_sql": 0,
- "rows_per_tbl": 3,
+ "interlace_rows": 3,
"max_sql_len": 1024,
"disorder_ratio": 0,
"disorder_range": 1000,
diff --git a/tests/examples/c/asyncdemo.c b/tests/examples/c/asyncdemo.c
index 16a14e9654..d711ce22c1 100644
--- a/tests/examples/c/asyncdemo.c
+++ b/tests/examples/c/asyncdemo.c
@@ -163,6 +163,16 @@ int main(int argc, char *argv[])
getchar();
+ while(1) {
+ if (tablesProcessed < numOfTables) {
+ printf("wait for process finished\n");
+ sleep(1);
+ continue;
+ }
+
+ break;
+ }
+
taos_close(taos);
free(tableList);
diff --git a/tests/pytest/cluster/clusterEnvSetup/buildClusterEnv.sh b/tests/pytest/cluster/clusterEnvSetup/buildClusterEnv.sh
index 0057a970ca..60c81cd82b 100755
--- a/tests/pytest/cluster/clusterEnvSetup/buildClusterEnv.sh
+++ b/tests/pytest/cluster/clusterEnvSetup/buildClusterEnv.sh
@@ -68,20 +68,14 @@ function prepareBuild {
rm -rf $CURR_DIR/../../../../release/*
fi
- if [ ! -e $DOCKER_DIR/TDengine-server-$VERSION-Linux-x64.tar.gz ] || [ ! -e $DOCKER_DIR/TDengine-arbitrator-$VERSION-Linux-x64.tar.gz ]; then
- cd $CURR_DIR/../../../../packaging
- echo $CURR_DIR
- echo $IN_TDINTERNAL
- echo "generating TDeninger packages"
- if [[ "$CURR_DIR" == *"$IN_TDINTERNAL"* ]]; then
- pwd
- ./release.sh -v cluster -n $VERSION >> /dev/null 2>&1
- else
- pwd
- ./release.sh -v edge -n $VERSION >> /dev/null 2>&1
- fi
+ cd $CURR_DIR/../../../../packaging
- if [[ "$CURR_DIR" == *"$IN_TDINTERNAL"* ]]; then
+ if [[ "$CURR_DIR" == *"$IN_TDINTERNAL"* ]]; then
+ if [ ! -e $DOCKER_DIR/TDengine-enterprise-server-$VERSION-Linux-x64.tar.gz ] || [ ! -e $DOCKER_DIR/TDengine-enterprise-arbitrator-$VERSION-Linux-x64.tar.gz ]; then
+
+ echo "generating TDeninge enterprise packages"
+ ./release.sh -v cluster -n $VERSION >> /dev/null 2>&1
+
if [ ! -e $CURR_DIR/../../../../release/TDengine-enterprise-server-$VERSION-Linux-x64.tar.gz ]; then
echo "no TDengine install package found"
exit 1
@@ -91,7 +85,17 @@ function prepareBuild {
echo "no arbitrator install package found"
exit 1
fi
- else
+
+ cd $CURR_DIR/../../../../release
+ mv TDengine-enterprise-server-$VERSION-Linux-x64.tar.gz $DOCKER_DIR
+ mv TDengine-enterprise-arbitrator-$VERSION-Linux-x64.tar.gz $DOCKER_DIR
+ fi
+ else
+ if [ ! -e $DOCKER_DIR/TDengine-server-$VERSION-Linux-x64.tar.gz ] || [ ! -e $DOCKER_DIR/TDengine-arbitrator-$VERSION-Linux-x64.tar.gz ]; then
+
+ echo "generating TDeninge community packages"
+ ./release.sh -v edge -n $VERSION >> /dev/null 2>&1
+
if [ ! -e $CURR_DIR/../../../../release/TDengine-server-$VERSION-Linux-x64.tar.gz ]; then
echo "no TDengine install package found"
exit 1
@@ -101,16 +105,11 @@ function prepareBuild {
echo "no arbitrator install package found"
exit 1
fi
- fi
- cd $CURR_DIR/../../../../release
- if [[ "$CURR_DIR" == *"$IN_TDINTERNAL"* ]]; then
- mv TDengine-enterprise-server-$VERSION-Linux-x64.tar.gz $DOCKER_DIR
- mv TDengine-enterprise-arbitrator-$VERSION-Linux-x64.tar.gz $DOCKER_DIR
- else
+ cd $CURR_DIR/../../../../release
mv TDengine-server-$VERSION-Linux-x64.tar.gz $DOCKER_DIR
mv TDengine-arbitrator-$VERSION-Linux-x64.tar.gz $DOCKER_DIR
- fi
+ fi
fi
rm -rf $DOCKER_DIR/*.yml
diff --git a/tests/pytest/cluster/clusterEnvSetup/insert.json b/tests/pytest/cluster/clusterEnvSetup/insert.json
index 56a64b7b85..4548ef74e6 100644
--- a/tests/pytest/cluster/clusterEnvSetup/insert.json
+++ b/tests/pytest/cluster/clusterEnvSetup/insert.json
@@ -39,7 +39,7 @@
"insert_rows": 100000,
"multi_thread_write_one_tbl": "no",
"number_of_tbl_in_one_sql": 1,
- "rows_per_tbl": 100,
+ "interlace_rows": 100,
"max_sql_len": 1024000,
"disorder_ratio": 0,
"disorder_range": 1000,
diff --git a/tests/pytest/fulltest.sh b/tests/pytest/fulltest.sh
index 5037f2c399..fc86570bd2 100755
--- a/tests/pytest/fulltest.sh
+++ b/tests/pytest/fulltest.sh
@@ -196,6 +196,9 @@ python3 ./test.py -f query/bug2119.py
python3 ./test.py -f query/isNullTest.py
python3 ./test.py -f query/queryWithTaosdKilled.py
python3 ./test.py -f query/floatCompare.py
+python3 ./test.py -f query/bug3375.py
+
+
#stream
python3 ./test.py -f stream/metric_1.py
@@ -230,16 +233,6 @@ python3 client/twoClients.py
python3 test.py -f query/queryInterval.py
python3 test.py -f query/queryFillTest.py
-# tools
-python3 test.py -f tools/taosdemoTest.py
-python3 test.py -f tools/taosdemoTestWithoutMetric.py
-python3 test.py -f tools/taosdemoTestWithJson.py
-python3 test.py -f tools/taosdemoTestLimitOffset.py
-python3 test.py -f tools/taosdumpTest.py
-python3 test.py -f tools/taosdemoTest2.py
-python3 test.py -f tools/taosdemoTestSampleData.py
-python3 test.py -f tools/taosdemoTestInterlace.py
-
# subscribe
python3 test.py -f subscribe/singlemeter.py
#python3 test.py -f subscribe/stability.py
@@ -249,6 +242,18 @@ python3 test.py -f subscribe/supertable.py
#======================p3-end===============
#======================p4-start===============
+# tools
+python3 test.py -f tools/taosdumpTest.py
+
+python3 test.py -f tools/taosdemoTest.py
+python3 test.py -f tools/taosdemoTestWithoutMetric.py
+python3 test.py -f tools/taosdemoTestWithJson.py
+python3 test.py -f tools/taosdemoTestLimitOffset.py
+python3 test.py -f tools/taosdemoTest2.py
+python3 test.py -f tools/taosdemoTestSampleData.py
+python3 test.py -f tools/taosdemoTestInterlace.py
+python3 test.py -f tools/taosdemoTestQuery.py
+
python3 ./test.py -f update/merge_commit_data-0.py
# wal
python3 ./test.py -f wal/addOldWalTest.py
diff --git a/tests/pytest/handle_taosd_val_log.sh b/tests/pytest/handle_taosd_val_log.sh
new file mode 100755
index 0000000000..6b7f669efe
--- /dev/null
+++ b/tests/pytest/handle_taosd_val_log.sh
@@ -0,0 +1,68 @@
+#!/bin/bash
+# Color setting
+RED='\033[0;31m'
+GREEN='\033[1;32m'
+GREEN_DARK='\033[0;32m'
+GREEN_UNDERLINE='\033[4;32m'
+NC='\033[0m'
+IN_TDINTERNAL="community"
+TDIR=`pwd`
+if [[ "$tests_dir" == *"$IN_TDINTERNAL"* ]]; then
+ cd ../..
+else
+ cd ../../..
+fi
+TOP_DIR=`pwd`
+TAOSD_DIR=`find . -name "taosd"|grep -v community|grep debug|head -n1`
+VALGRIND_OUT=taosd_valgrind.out
+VALGRIND_ERR=taosd_valgrind.err
+rm -rf /var/lib/taos/*
+# nohup valgrind --tool=memcheck --leak-check=yes $TAOSD_DIR > $TDIR/$VALGRIND_OUT 2> $TDIR/$VALGRIND_ERR &
+nohup valgrind --leak-check=yes $TAOSD_DIR > $TDIR/$VALGRIND_OUT 2> $TDIR/$VALGRIND_ERR &
+sleep 20
+cd -
+./crash_gen.sh -p -t 10 -s 200
+ps -ef |grep valgrind|grep -v grep|awk '{print $2}'|xargs kill -term
+while true
+do
+ monitoring=` ps -ef|grep valgrind |grep -v grep| wc -l`
+ if [ $monitoring -eq 0 ]
+ then
+ echo "Manipulator is not running "
+ break
+ else
+ sleep 1
+ fi
+done
+
+grep 'start to execute\|ERROR SUMMARY' $VALGRIND_ERR | grep -v 'grep' | uniq | tee taosd_mem_err.log
+
+for memError in `grep 'ERROR SUMMARY' taosd_mem_err.log | awk '{print $4}'`
+do
+memError=(${memError//,/})
+if [ -n "$memError" ]; then
+ if [ "$memError" -gt 12 ]; then
+ echo -e "${RED} ## Memory errors number valgrind reports is $memError.\
+ More than our threshold! ## ${NC}"
+ fi
+fi
+done
+
+grep 'start to execute\|definitely lost:' $VALGRIND_ERR|grep -v 'grep'|uniq|tee taosd-definitely-lost-out.log
+for defiMemError in `grep 'definitely lost:' taosd-definitely-lost-out.log | awk '{print $7}'`
+do
+defiMemError=(${defiMemError//,/})
+if [ -n "$defiMemError" ]; then
+ if [ "$defiMemError" -gt 0 -a "$defiMemError" -lt 1013 ]; then
+ cat $VALGRIND_ERR
+ echo -e "${RED} ## Memory errors number valgrind reports \
+ Definitely lost is $defiMemError. More than our threshold! ## ${NC}"
+ exit 8
+ elif [ "$defiMemError" -gt 1013 ];then #add for azure
+ cat $VALGRIND_ERR
+ echo -e "${RED} ## Memory errors number valgrind reports \
+ Definitely lost is $defiMemError. More than our threshold! ## ${NC}"
+ exit 8
+ fi
+fi
+done
diff --git a/tests/pytest/query/bug3375.py b/tests/pytest/query/bug3375.py
new file mode 100644
index 0000000000..25c3467c05
--- /dev/null
+++ b/tests/pytest/query/bug3375.py
@@ -0,0 +1,61 @@
+###################################################################
+# 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 sys
+from util.log import *
+from util.cases import *
+from util.sql import *
+from util.dnodes import *
+
+
+class TDTestCase:
+ def init(self, conn, logSql):
+ tdLog.debug("start to execute %s" % __file__)
+ tdSql.init(conn.cursor(), logSql)
+
+ def run(self):
+ tdSql.prepare()
+ tdSql.execute("drop database if exists db")
+ tdSql.execute("create database if not exists db keep 36500")
+ tdSql.execute("use db")
+
+ tdLog.printNoPrefix("==========step1:create table && insert data")
+ tdSql.execute(
+ "create table stb1 (ts timestamp, c11 int) TAGS(t11 int, t12 int )"
+ )
+ tdSql.execute(
+ "create table stb2 (ts timestamp, c21 int) TAGS(t21 int, t22 int )"
+ )
+ tdSql.execute("create table t10 using stb1 tags(1, 10)")
+ tdSql.execute("create table t20 using stb2 tags(1, 12)")
+ tdSql.execute("insert into t10 values (1600000000000, 1)")
+ tdSql.execute("insert into t10 values (1610000000000, 2)")
+ tdSql.execute("insert into t20 values (1600000000000, 3)")
+ tdSql.execute("insert into t20 values (1610000000000, 4)")
+
+ tdLog.printNoPrefix("==========step2:query crash test")
+ tdSql.query("select stb1.c11, stb1.t11, stb1.t12 from stb2,stb1 where stb2.t21 = stb1.t11 and stb1.ts = stb2.ts")
+ tdSql.checkRows(2)
+ tdSql.query("select stb2.c21, stb2.t21, stb2.t21 from stb1, stb2 where stb2.t21 = stb1.t11 and stb1.ts = stb2.ts")
+ tdSql.checkRows(2)
+ tdSql.query("select top(stb2.c21,2) from stb1, stb2 where stb2.t21 = stb1.t11 and stb1.ts = stb2.ts")
+ tdSql.checkRows(2)
+ tdSql.query("select last(stb2.c21) from stb1, stb2 where stb2.t21 = stb1.t11 and stb1.ts = stb2.ts")
+ tdSql.checkRows(1)
+
+ def stop(self):
+ tdSql.close()
+ tdLog.success("%s successfully executed" % __file__)
+
+tdCases.addWindows(__file__, TDTestCase())
+tdCases.addLinux(__file__, TDTestCase())
\ No newline at end of file
diff --git a/tests/pytest/query/query1970YearsAf.py b/tests/pytest/query/query1970YearsAf.py
new file mode 100644
index 0000000000..9794973325
--- /dev/null
+++ b/tests/pytest/query/query1970YearsAf.py
@@ -0,0 +1,230 @@
+###################################################################
+# 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 taos
+import sys
+import os
+import json
+import subprocess
+import datetime
+
+
+from util.log import *
+from util.sql import *
+from util.cases import *
+
+class TDTestCase:
+
+ def init(self, conn, logSql):
+ tdLog.debug(f"start to excute {__file__}")
+ tdSql.init(conn.cursor())
+
+ def getCfgDir(self, path):
+ binPath = os.path.dirname(os.path.realpath(__file__))
+ binPath = binPath + "/../../../debug/"
+ tdLog.debug("binPath %s" % (binPath))
+ binPath = os.path.realpath(binPath)
+ tdLog.debug("binPath real path %s" % (binPath))
+ if path == "":
+ self.path = os.path.abspath(binPath + "../../")
+ else:
+ self.path = os.path.realpath(path)
+
+ self.cfgDir = "%s/sim/psim/cfg" % (self.path)
+ return self.cfgDir
+
+ def creatcfg(self):
+ dbinfo = {
+ "name": "db",
+ "drop": "yes",
+ "replica": 1,
+ "days": 10,
+ "cache": 16,
+ "blocks": 8,
+ "precision": "ms",
+ "keep": 36500,
+ "minRows": 100,
+ "maxRows": 4096,
+ "comp": 2,
+ "walLevel": 1,
+ "cachelast": 0,
+ "quorum": 1,
+ "fsync": 3000,
+ "update": 0
+ }
+
+ # 设置创建的超级表格式
+ stable1 = {
+ "name": "stb2",
+ "child_table_exists": "no",
+ "childtable_count": 10,
+ "childtable_prefix": "t",
+ "auto_create_table": "no",
+ "data_source": "rand",
+ "insert_mode": "taosc",
+ "insert_rows": 5000,
+ "multi_thread_write_one_tbl": "no",
+ "number_of_tbl_in_one_sql": 0,
+ "rows_per_tbl": 1000,
+ "max_sql_len": 65480,
+ "disorder_ratio": 0,
+ "disorder_range": 1000,
+ "timestamp_step": 19000000,
+ "start_timestamp": "1969-01-01 00:00:00.000",
+ "sample_format": "csv",
+ "sample_file": "./sample.csv",
+ "tags_file": "",
+ "columns": [
+ {"type": "INT"},
+ {"type": "DOUBLE", "count": 10},
+ {"type": "BINARY", "len": 16, "count": 3},
+ {"type": "BINARY", "len": 32, "count": 6}
+ ],
+ "tags": [
+ {"type": "TINYINT", "count": 2},
+ {"type": "BINARY", "len": 16, "count": 5}
+ ]
+ }
+
+ # 需要创建多个超级表时,只需创建不同的超级表格式并添加至super_tables
+ super_tables = [stable1]
+ database = {
+ "dbinfo": dbinfo,
+ "super_tables": super_tables
+ }
+
+ cfgdir = self.getCfgDir("")
+ create_table = {
+ "filetype": "insert",
+ "cfgdir": cfgdir,
+ "host": "127.0.0.1",
+ "port": 6030,
+ "user": "root",
+ "password": "taosdata",
+ "thread_count": 4,
+ "thread_count_create_tbl": 4,
+ "result_file": "/tmp/insert_res.txt",
+ "confirm_parameter_prompt": "no",
+ "insert_interval": 0,
+ "num_of_records_per_req": 100,
+ "databases": [database]
+ }
+ return create_table
+
+ def inserttable(self):
+ create_table = self.creatcfg()
+ date = datetime.datetime.now().strftime("%Y%m%d%H%M")
+ file_create_table = f"/tmp/insert_{date}.json"
+
+ with open(file_create_table, 'w') as f:
+ json.dump(create_table, f)
+
+ create_table_cmd = f"taosdemo -f {file_create_table}"
+ _ = subprocess.check_output(create_table_cmd, shell=True).decode("utf-8")
+
+
+ def run(self):
+ s = 'reset query cache'
+ tdSql.execute(s)
+ s = 'create database if not exists db'
+ tdSql.execute(s)
+ s = 'use db'
+ tdSql.execute(s)
+
+ tdLog.info("==========step1:create table stable and child table,then insert data automatically")
+ self.inserttable()
+ # tdSql.execute(
+ # '''create table if not exists supt
+ # (ts timestamp, c1 int, c2 float, c3 bigint, c4 double, c5 smallint, c6 tinyint)
+ # tags(location binary(64), type int, isused bool , family nchar(64))'''
+ # )
+ # tdSql.execute("create table t1 using supt tags('beijing', 1, 1, '自行车')")
+ # tdSql.execute("create table t2 using supt tags('shanghai', 2, 0, '拖拉机')")
+ # tdSql.execute(
+ # f"insert into t1 values (-31564800000, 6, 5, 4, 3, 2, 1)"
+ # )
+
+
+
+ tdLog.info("==========step2:query join")
+
+ # stable query
+ tdSql.query(
+ "select * from stb2 where stb2.ts < '1970-01-01 00:00:00.000' "
+ )
+ tdSql.checkRows(16600)
+
+ tdSql.query(
+ "select * from stb2 where stb2.ts >= '1970-01-01 00:00:00.000' "
+ )
+ tdSql.checkRows(33400)
+
+ tdSql.query(
+ "select * from stb2 where stb2.ts > '1969-12-01 00:00:00.000' and stb2.ts <'1970-01-31 00:00:00.000' "
+ )
+ tdSql.checkRows(2780)
+
+ # child-table query
+ tdSql.query(
+ "select * from t0 where t0.ts < '1970-01-01 00:00:00.000' "
+ )
+ tdSql.checkRows(1660)
+
+ tdSql.query(
+ "select * from t1 where t1.ts >= '1970-01-01 00:00:00.000' "
+ )
+ tdSql.checkRows(3340)
+
+ tdSql.query(
+ "select * from t9 where t9.ts > '1969-12-01 00:00:00.000' and t9.ts <'1970-01-31 00:00:00.000' "
+ )
+ tdSql.checkRows(278)
+
+ tdSql.query(
+ "select * from t0,t1 where t0.ts=t1.ts and t1.ts >= '1970-01-01 00:00:00.000' "
+ )
+ tdSql.checkRows(3340)
+
+ tdSql.query(
+ "select diff(col1) from t0 where t0.ts >= '1970-01-01 00:00:00.000' "
+ )
+ tdSql.checkRows(3339)
+
+ tdSql.query(
+ "select t0,col1 from stb2 where stb2.ts < '1970-01-01 00:00:00.000' order by ts"
+ )
+ tdSql.checkRows(16600)
+
+ # query with timestamp in 'where ...'
+ tdSql.query(
+ "select * from stb2 where stb2.ts > -28800000 "
+ )
+ tdSql.checkRows(33400)
+
+ tdSql.query(
+ "select * from stb2 where stb2.ts > -28800000 and stb2.ts < '1970-01-01 08:00:00.000' "
+ )
+ tdSql.checkRows(20)
+
+ tdSql.query(
+ "select * from stb2 where stb2.ts < -28800000 and stb2.ts > '1969-12-31 16:00:00.000' "
+ )
+
+
+ def stop(self):
+ tdSql.close()
+ tdLog.success(f"{__file__} successfully executed")
+
+
+tdCases.addLinux(__file__, TDTestCase())
+tdCases.addWindows(__file__, TDTestCase())
\ No newline at end of file
diff --git a/tests/pytest/tools/insert-interlace.json b/tests/pytest/tools/insert-interlace.json
index a2ff2c001c..d4767ad064 100644
--- a/tests/pytest/tools/insert-interlace.json
+++ b/tests/pytest/tools/insert-interlace.json
@@ -10,7 +10,7 @@
"result_file": "./insert_res.txt",
"confirm_parameter_prompt": "no",
"insert_interval": 5000,
- "rows_per_tbl": 50,
+ "interlace_rows": 50,
"num_of_records_per_req": 100,
"max_sql_len": 1024000,
"databases": [{
@@ -42,7 +42,7 @@
"insert_mode": "taosc",
"insert_rows": 250,
"multi_thread_write_one_tbl": "no",
- "rows_per_tbl": 80,
+ "interlace_rows": 80,
"max_sql_len": 1024000,
"disorder_ratio": 0,
"disorder_range": 1000,
diff --git a/tests/pytest/tools/query.json b/tests/pytest/tools/query.json
new file mode 100644
index 0000000000..d486423865
--- /dev/null
+++ b/tests/pytest/tools/query.json
@@ -0,0 +1,22 @@
+{
+ "filetype": "query",
+ "cfgdir": "/etc/taos",
+ "host": "127.0.0.1",
+ "port": 6030,
+ "user": "root",
+ "password": "taosdata",
+ "confirm_parameter_prompt": "no",
+ "databases": "test",
+ "query_times": 1,
+ "super_table_query": {
+ "stblname": "meters",
+ "query_interval": 10,
+ "threads": 8,
+ "sqls": [
+ {
+ "sql": "select last_row(ts) from xxxx",
+ "result": ""
+ }
+ ]
+ }
+}
diff --git a/tests/pytest/tools/taosdemoTest.py b/tests/pytest/tools/taosdemoTest.py
index 2ce9228c54..ff5921be60 100644
--- a/tests/pytest/tools/taosdemoTest.py
+++ b/tests/pytest/tools/taosdemoTest.py
@@ -51,7 +51,7 @@ class TDTestCase:
else:
tdLog.info("taosd found in %s" % buildPath)
binPath = buildPath + "/build/bin/"
- os.system("%staosdemo -y -M -t %d -n %d -x" %
+ os.system("%staosdemo -y -t %d -n %d" %
(binPath, self.numberOfTables, self.numberOfRecords))
tdSql.execute("use test")
diff --git a/tests/pytest/tools/taosdemoTest2.py b/tests/pytest/tools/taosdemoTest2.py
index 75a79d0585..74b05faf8b 100644
--- a/tests/pytest/tools/taosdemoTest2.py
+++ b/tests/pytest/tools/taosdemoTest2.py
@@ -31,12 +31,20 @@ class TDTestCase:
def insertDataAndAlterTable(self, threadID):
if(threadID == 0):
- os.system("taosdemo -M -y -t %d -n %d -x" %
+ os.system("taosdemo -y -t %d -n %d" %
(self.numberOfTables, self.numberOfRecords))
if(threadID == 1):
time.sleep(2)
print("use test")
- tdSql.execute("use test")
+ while True:
+ try:
+ tdSql.execute("use test")
+ break
+ except Exception as e:
+ tdLog.info("use database test failed")
+ time.sleep(1)
+ continue
+
# check if all the tables have heen created
while True:
tdSql.query("show tables")
diff --git a/tests/pytest/tools/taosdemoTestInterlace.py b/tests/pytest/tools/taosdemoTestInterlace.py
index 953bfff90f..4c551f327a 100644
--- a/tests/pytest/tools/taosdemoTestInterlace.py
+++ b/tests/pytest/tools/taosdemoTestInterlace.py
@@ -1,4 +1,4 @@
-###################################################################
+##################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
@@ -25,9 +25,6 @@ class TDTestCase:
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
- self.numberOfTables = 10000
- self.numberOfRecords = 100
-
def getBuildPath(self):
selfPath = os.path.dirname(os.path.realpath(__file__))
diff --git a/tests/pytest/tools/taosdemoTestQuery.py b/tests/pytest/tools/taosdemoTestQuery.py
new file mode 100644
index 0000000000..bb2bb85052
--- /dev/null
+++ b/tests/pytest/tools/taosdemoTestQuery.py
@@ -0,0 +1,78 @@
+###################################################################
+# 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 sys
+import os
+import time
+from util.log import *
+from util.cases import *
+from util.sql import *
+from util.dnodes import *
+import subprocess
+
+
+class TDTestCase:
+ def init(self, conn, logSql):
+ tdLog.debug("start to execute %s" % __file__)
+ tdSql.init(conn.cursor(), logSql)
+
+ self.numberOfTables = 1000
+ self.numberOfRecords = 100
+
+ def getBuildPath(self):
+ selfPath = os.path.dirname(os.path.realpath(__file__))
+
+ if ("community" in selfPath):
+ projPath = selfPath[:selfPath.find("community")]
+ else:
+ projPath = selfPath[:selfPath.find("tests")]
+
+ for root, dirs, files in os.walk(projPath):
+ if ("taosd" in files):
+ rootRealPath = os.path.dirname(os.path.realpath(root))
+ if ("packaging" not in rootRealPath):
+ buildPath = root[:len(root) - len("/build/bin")]
+ break
+ return buildPath
+
+ def run(self):
+ tdSql.prepare()
+ buildPath = self.getBuildPath()
+ if (buildPath == ""):
+ tdLog.exit("taosd not found!")
+ else:
+ tdLog.info("taosd found in %s" % buildPath)
+ binPath = buildPath + "/build/bin/"
+ os.system("%staosdemo -y -t %d -n %d" %
+ (binPath, self.numberOfTables, self.numberOfRecords))
+ print("Sleep 2 seconds..")
+ time.sleep(2)
+ os.system('%staosdemo -f tools/query.json ' % binPath)
+# taosdemoCmd = '%staosdemo -f tools/query.json ' % binPath
+# threads = subprocess.check_output(
+# taosdemoCmd, shell=True).decode("utf-8")
+# print("threads: %d" % int(threads))
+
+# if (int(threads) != 8):
+# caller = inspect.getframeinfo(inspect.stack()[0][0])
+# tdLog.exit(
+# "%s(%d) failed: expected threads 8, actual %d" %
+# (caller.filename, caller.lineno, int(threads)))
+#
+ def stop(self):
+ tdSql.close()
+ tdLog.success("%s successfully executed" % __file__)
+
+
+tdCases.addWindows(__file__, TDTestCase())
+tdCases.addLinux(__file__, TDTestCase())
diff --git a/tests/pytest/tools/taosdemoTestWithoutMetric.py b/tests/pytest/tools/taosdemoTestWithoutMetric.py
index 647d6a37cb..9687600563 100644
--- a/tests/pytest/tools/taosdemoTestWithoutMetric.py
+++ b/tests/pytest/tools/taosdemoTestWithoutMetric.py
@@ -50,7 +50,7 @@ class TDTestCase:
else:
tdLog.info("taosd found in %s" % buildPath)
binPath = buildPath + "/build/bin/"
- os.system("%staosdemo -y -t %d -n %d -x" %
+ os.system("%staosdemo -N -y -t %d -n %d" %
(binPath, self.numberOfTables, self.numberOfRecords))
tdSql.query("show databases")
diff --git a/tests/script/general/parser/join_multitables.sim b/tests/script/general/parser/join_multitables.sim
new file mode 100644
index 0000000000..acb8be10e7
--- /dev/null
+++ b/tests/script/general/parser/join_multitables.sim
@@ -0,0 +1,2326 @@
+system sh/stop_dnodes.sh
+system sh/deploy.sh -n dnode1 -i 1
+system sh/cfg.sh -n dnode1 -c walLevel -v 0
+system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 2
+system sh/exec.sh -n dnode1 -s start
+
+sleep 100
+sql connect
+print ======================== dnode1 start
+
+$db = testdb
+
+sql create database $db
+sql use $db
+
+sql create stable st0 (ts timestamp, f1 int, f2 double, f3 binary(10)) tags(id1 int, id2 smallint, id3 double, id4 bool, id5 binary(5));
+sql create stable st1 (ts timestamp, f1 int, f2 double, f3 binary(10)) tags(id1 int, id2 smallint, id3 double, id4 bool, id5 binary(5));
+sql create stable st2 (ts timestamp, f1 int, f2 double, f3 binary(10)) tags(id1 int, id2 smallint, id3 double, id4 bool, id5 binary(5));
+sql create stable st3 (ts timestamp, f1 int, f2 double, f3 binary(10)) tags(id1 int, id2 smallint, id3 double, id4 bool, id5 binary(5));
+sql create stable st4 (ts timestamp, f1 int, f2 double, f3 binary(10)) tags(id1 int, id2 smallint, id3 double, id4 bool, id5 binary(5));
+sql create stable st5 (ts timestamp, f1 int, f2 double, f3 binary(10)) tags(id1 int, id2 smallint, id3 double, id4 bool, id5 binary(5));
+sql create stable st6 (ts timestamp, f1 int, f2 double, f3 binary(10)) tags(id1 int, id2 smallint, id3 double, id4 bool, id5 binary(5));
+sql create stable st7 (ts timestamp, f1 int, f2 double, f3 binary(10)) tags(id1 int, id2 smallint, id3 double, id4 bool, id5 binary(5));
+sql create stable st8 (ts timestamp, f1 int, f2 double, f3 binary(10)) tags(id1 int, id2 smallint, id3 double, id4 bool, id5 binary(5));
+sql create stable st9 (ts timestamp, f1 int, f2 double, f3 binary(10)) tags(id1 int, id2 smallint, id3 double, id4 bool, id5 binary(5));
+sql create stable sta (ts timestamp, f1 int, f2 double, f3 binary(10)) tags(id1 int, id2 smallint, id3 double, id4 bool, id5 binary(5));
+sql create stable stb (ts timestamp, f1 int, f2 double, f3 binary(10)) tags(id1 int, id2 smallint, id3 double, id4 bool, id5 binary(5));
+
+sql create table tb0_1 using st0 tags(0,1,2.0,true,'3');
+sql create table tb0_2 using st0 tags(1,2,3.0,false,'4');
+sql create table tb0_3 using st0 tags(2,3,4.0,true,'5');
+sql create table tb0_4 using st0 tags(3,4,5.0,false,'6');
+sql create table tb0_5 using st0 tags(4,5,6.0,true,'7');
+
+sql create table tb1_1 using st1 tags(0,1,2.0,true,'3');
+sql create table tb1_2 using st1 tags(1,2,3.0,false,'4');
+sql create table tb1_3 using st1 tags(2,3,4.0,true,'5');
+sql create table tb1_4 using st1 tags(3,4,5.0,false,'6');
+sql create table tb1_5 using st1 tags(4,5,6.0,true,'7');
+
+sql create table tb2_1 using st2 tags(0,1,2.0,true,'3');
+sql create table tb2_2 using st2 tags(1,2,3.0,false,'4');
+sql create table tb2_3 using st2 tags(2,3,4.0,true,'5');
+sql create table tb2_4 using st2 tags(3,4,5.0,false,'6');
+sql create table tb2_5 using st2 tags(4,5,6.0,true,'7');
+
+sql create table tb3_1 using st3 tags(0,1,2.0,true,'3');
+sql create table tb3_2 using st3 tags(1,2,3.0,false,'4');
+sql create table tb3_3 using st3 tags(2,3,4.0,true,'5');
+sql create table tb3_4 using st3 tags(3,4,5.0,false,'6');
+sql create table tb3_5 using st3 tags(4,5,6.0,true,'7');
+
+sql create table tb4_1 using st4 tags(0,1,2.0,true,'3');
+sql create table tb4_2 using st4 tags(1,2,3.0,false,'4');
+sql create table tb4_3 using st4 tags(2,3,4.0,true,'5');
+sql create table tb4_4 using st4 tags(3,4,5.0,false,'6');
+sql create table tb4_5 using st4 tags(4,5,6.0,true,'7');
+
+sql create table tb5_1 using st5 tags(0,1,2.0,true,'3');
+sql create table tb5_2 using st5 tags(1,2,3.0,false,'4');
+sql create table tb5_3 using st5 tags(2,3,4.0,true,'5');
+sql create table tb5_4 using st5 tags(3,4,5.0,false,'6');
+sql create table tb5_5 using st5 tags(4,5,6.0,true,'7');
+
+sql create table tb6_1 using st6 tags(0,1,2.0,true,'3');
+sql create table tb6_2 using st6 tags(1,2,3.0,false,'4');
+sql create table tb6_3 using st6 tags(2,3,4.0,true,'5');
+sql create table tb6_4 using st6 tags(3,4,5.0,false,'6');
+sql create table tb6_5 using st6 tags(4,5,6.0,true,'7');
+
+sql create table tb7_1 using st7 tags(0,1,2.0,true,'3');
+sql create table tb7_2 using st7 tags(1,2,3.0,false,'4');
+sql create table tb7_3 using st7 tags(2,3,4.0,true,'5');
+sql create table tb7_4 using st7 tags(3,4,5.0,false,'6');
+sql create table tb7_5 using st7 tags(4,5,6.0,true,'7');
+
+sql create table tb8_1 using st8 tags(0,1,2.0,true,'3');
+sql create table tb8_2 using st8 tags(1,2,3.0,false,'4');
+sql create table tb8_3 using st8 tags(2,3,4.0,true,'5');
+sql create table tb8_4 using st8 tags(3,4,5.0,false,'6');
+sql create table tb8_5 using st8 tags(4,5,6.0,true,'7');
+
+sql create table tb9_1 using st9 tags(0,1,2.0,true,'3');
+sql create table tb9_2 using st9 tags(1,2,3.0,false,'4');
+sql create table tb9_3 using st9 tags(2,3,4.0,true,'5');
+sql create table tb9_4 using st9 tags(3,4,5.0,false,'6');
+sql create table tb9_5 using st9 tags(4,5,6.0,true,'7');
+
+sql create table tba_1 using sta tags(0,1,2.0,true,'3');
+sql create table tba_2 using sta tags(0,1,2.0,true,'3');
+sql create table tba_3 using sta tags(0,1,2.0,true,'3');
+sql create table tba_4 using sta tags(0,1,2.0,true,'3');
+sql create table tba_5 using sta tags(0,1,2.0,true,'3');
+
+sql create table tbb_1 using stb tags(0,1,2.0,true,'3');
+sql create table tbb_2 using stb tags(0,1,2.0,true,'3');
+sql create table tbb_3 using stb tags(0,1,2.0,true,'3');
+sql create table tbb_4 using stb tags(0,1,2.0,true,'3');
+sql create table tbb_5 using stb tags(0,1,2.0,true,'3');
+
+sql insert into tb0_1 values('2021-03-01 01:00:00.000', 9901,9901.0,'01');
+sql insert into tb0_1 values('2021-03-02 01:00:00.000', 9901,9901.0,'01');
+sql insert into tb0_1 values('2021-03-03 01:00:00.000', 9901,9901.0,'01');
+sql insert into tb0_1 values('2021-03-04 01:00:00.000', 9901,9901.0,'01');
+sql insert into tb0_1 values('2021-03-05 01:00:00.000', 9901,9901.0,'01');
+sql insert into tb0_2 values('2021-03-01 02:00:00.000', 9902,9902.0,'02');
+sql insert into tb0_2 values('2021-03-02 02:00:00.000', 9902,9902.0,'02');
+sql insert into tb0_2 values('2021-03-03 02:00:00.000', 9902,9902.0,'02');
+sql insert into tb0_2 values('2021-03-04 02:00:00.000', 9902,9902.0,'02');
+sql insert into tb0_2 values('2021-03-05 02:00:00.000', 9902,9902.0,'02');
+sql insert into tb0_3 values('2021-03-01 03:00:00.000', 9903,9903.0,'03');
+sql insert into tb0_3 values('2021-03-02 03:00:00.000', 9903,9903.0,'03');
+sql insert into tb0_3 values('2021-03-03 03:00:00.000', 9903,9903.0,'03');
+sql insert into tb0_3 values('2021-03-04 03:00:00.000', 9903,9903.0,'03');
+sql insert into tb0_3 values('2021-03-05 03:00:00.000', 9903,9903.0,'03');
+sql insert into tb0_4 values('2021-03-01 04:00:00.000', 9904,9904.0,'04');
+sql insert into tb0_4 values('2021-03-02 04:00:00.000', 9904,9904.0,'04');
+sql insert into tb0_4 values('2021-03-03 04:00:00.000', 9904,9904.0,'04');
+sql insert into tb0_4 values('2021-03-04 04:00:00.000', 9904,9904.0,'04');
+sql insert into tb0_4 values('2021-03-05 04:00:00.000', 9904,9904.0,'04');
+sql insert into tb0_5 values('2021-03-01 05:00:00.000', 9905,9905.0,'05');
+sql insert into tb0_5 values('2021-03-02 05:00:00.000', 9905,9905.0,'05');
+sql insert into tb0_5 values('2021-03-03 05:00:00.000', 9905,9905.0,'05');
+sql insert into tb0_5 values('2021-03-04 05:00:00.000', 9905,9905.0,'05');
+sql insert into tb0_5 values('2021-03-05 05:00:00.000', 9905,9905.0,'05');
+
+sql insert into tb1_1 values('2021-03-01 01:00:00.000', 9911,9911.0,'11');
+sql insert into tb1_1 values('2021-03-02 01:00:00.000', 9911,9911.0,'11');
+sql insert into tb1_1 values('2021-03-03 01:00:00.000', 9911,9911.0,'11');
+sql insert into tb1_1 values('2021-03-04 01:00:00.000', 9911,9911.0,'11');
+sql insert into tb1_1 values('2021-03-05 01:00:00.000', 9911,9911.0,'11');
+sql insert into tb1_2 values('2021-03-01 02:00:00.000', 9912,9912.0,'12');
+sql insert into tb1_2 values('2021-03-02 02:00:00.000', 9912,9912.0,'12');
+sql insert into tb1_2 values('2021-03-03 02:00:00.000', 9912,9912.0,'12');
+sql insert into tb1_2 values('2021-03-04 02:00:00.000', 9912,9912.0,'12');
+sql insert into tb1_2 values('2021-03-05 02:00:00.000', 9912,9912.0,'12');
+sql insert into tb1_3 values('2021-03-01 03:00:00.000', 9913,9913.0,'13');
+sql insert into tb1_3 values('2021-03-02 03:00:00.000', 9913,9913.0,'13');
+sql insert into tb1_3 values('2021-03-03 03:00:00.000', 9913,9913.0,'13');
+sql insert into tb1_3 values('2021-03-04 03:00:00.000', 9913,9913.0,'13');
+sql insert into tb1_3 values('2021-03-05 03:00:00.000', 9913,9913.0,'13');
+sql insert into tb1_4 values('2021-03-01 04:00:00.000', 9914,9914.0,'14');
+sql insert into tb1_4 values('2021-03-02 04:00:00.000', 9914,9914.0,'14');
+sql insert into tb1_4 values('2021-03-03 04:00:00.000', 9914,9914.0,'14');
+sql insert into tb1_4 values('2021-03-04 04:00:00.000', 9914,9914.0,'14');
+sql insert into tb1_4 values('2021-03-05 04:00:00.000', 9914,9914.0,'14');
+sql insert into tb1_5 values('2021-03-01 05:00:00.000', 9915,9915.0,'15');
+sql insert into tb1_5 values('2021-03-02 05:00:00.000', 9915,9915.0,'15');
+sql insert into tb1_5 values('2021-03-03 05:00:00.000', 9915,9915.0,'15');
+sql insert into tb1_5 values('2021-03-04 05:00:00.000', 9915,9915.0,'15');
+sql insert into tb1_5 values('2021-03-05 05:00:00.000', 9915,9915.0,'15');
+
+sql insert into tb2_1 values('2021-03-01 01:00:00.000', 9921,9921.0,'21');
+sql insert into tb2_1 values('2021-03-02 01:00:00.000', 9921,9921.0,'21');
+sql insert into tb2_1 values('2021-03-03 01:00:00.000', 9921,9921.0,'21');
+sql insert into tb2_1 values('2021-03-04 01:00:00.000', 9921,9921.0,'21');
+sql insert into tb2_1 values('2021-03-05 01:00:00.000', 9921,9921.0,'21');
+sql insert into tb2_2 values('2021-03-01 02:00:00.000', 9922,9922.0,'22');
+sql insert into tb2_2 values('2021-03-02 02:00:00.000', 9922,9922.0,'22');
+sql insert into tb2_2 values('2021-03-03 02:00:00.000', 9922,9922.0,'22');
+sql insert into tb2_2 values('2021-03-04 02:00:00.000', 9922,9922.0,'22');
+sql insert into tb2_2 values('2021-03-05 02:00:00.000', 9922,9922.0,'22');
+sql insert into tb2_3 values('2021-03-01 03:00:00.000', 9923,9923.0,'23');
+sql insert into tb2_3 values('2021-03-02 03:00:00.000', 9923,9923.0,'23');
+sql insert into tb2_3 values('2021-03-03 03:00:00.000', 9923,9923.0,'23');
+sql insert into tb2_3 values('2021-03-04 03:00:00.000', 9923,9923.0,'23');
+sql insert into tb2_3 values('2021-03-05 03:00:00.000', 9923,9923.0,'23');
+sql insert into tb2_4 values('2021-03-01 04:00:00.000', 9924,9924.0,'24');
+sql insert into tb2_4 values('2021-03-02 04:00:00.000', 9924,9924.0,'24');
+sql insert into tb2_4 values('2021-03-03 04:00:00.000', 9924,9924.0,'24');
+sql insert into tb2_4 values('2021-03-04 04:00:00.000', 9924,9924.0,'24');
+sql insert into tb2_4 values('2021-03-05 04:00:00.000', 9924,9924.0,'24');
+sql insert into tb2_5 values('2021-03-01 05:00:00.000', 9925,9925.0,'25');
+sql insert into tb2_5 values('2021-03-02 05:00:00.000', 9925,9925.0,'25');
+sql insert into tb2_5 values('2021-03-03 05:00:00.000', 9925,9925.0,'25');
+sql insert into tb2_5 values('2021-03-04 05:00:00.000', 9925,9925.0,'25');
+sql insert into tb2_5 values('2021-03-05 05:00:00.000', 9925,9925.0,'25');
+
+
+sql insert into tb3_1 values('2021-03-01 01:00:00.000', 9931,9931.0,'31');
+sql insert into tb3_1 values('2021-03-02 01:00:00.000', 9931,9931.0,'31');
+sql insert into tb3_1 values('2021-03-03 01:00:00.000', 9931,9931.0,'31');
+sql insert into tb3_1 values('2021-03-04 01:00:00.000', 9931,9931.0,'31');
+sql insert into tb3_1 values('2021-03-05 01:00:00.000', 9931,9931.0,'31');
+sql insert into tb3_2 values('2021-03-01 02:00:00.000', 9932,9932.0,'32');
+sql insert into tb3_2 values('2021-03-02 02:00:00.000', 9932,9932.0,'32');
+sql insert into tb3_2 values('2021-03-03 02:00:00.000', 9932,9932.0,'32');
+sql insert into tb3_2 values('2021-03-04 02:00:00.000', 9932,9932.0,'32');
+sql insert into tb3_2 values('2021-03-05 02:00:00.000', 9932,9932.0,'32');
+sql insert into tb3_3 values('2021-03-01 03:00:00.000', 9933,9933.0,'33');
+sql insert into tb3_3 values('2021-03-02 03:00:00.000', 9933,9933.0,'33');
+sql insert into tb3_3 values('2021-03-03 03:00:00.000', 9933,9933.0,'33');
+sql insert into tb3_3 values('2021-03-04 03:00:00.000', 9933,9933.0,'33');
+sql insert into tb3_3 values('2021-03-05 03:00:00.000', 9933,9933.0,'33');
+sql insert into tb3_4 values('2021-03-01 04:00:00.000', 9934,9934.0,'34');
+sql insert into tb3_4 values('2021-03-02 04:00:00.000', 9934,9934.0,'34');
+sql insert into tb3_4 values('2021-03-03 04:00:00.000', 9934,9934.0,'34');
+sql insert into tb3_4 values('2021-03-04 04:00:00.000', 9934,9934.0,'34');
+sql insert into tb3_4 values('2021-03-05 04:00:00.000', 9934,9934.0,'34');
+sql insert into tb3_5 values('2021-03-01 05:00:00.000', 9935,9935.0,'35');
+sql insert into tb3_5 values('2021-03-02 05:00:00.000', 9935,9935.0,'35');
+sql insert into tb3_5 values('2021-03-03 05:00:00.000', 9935,9935.0,'35');
+sql insert into tb3_5 values('2021-03-04 05:00:00.000', 9935,9935.0,'35');
+sql insert into tb3_5 values('2021-03-05 05:00:00.000', 9935,9935.0,'35');
+
+
+sql insert into tb4_1 values('2021-03-01 01:00:00.000', 9941,9941.0,'41');
+sql insert into tb4_1 values('2021-03-02 01:00:00.000', 9941,9941.0,'41');
+sql insert into tb4_1 values('2021-03-03 01:00:00.000', 9941,9941.0,'41');
+sql insert into tb4_1 values('2021-03-04 01:00:00.000', 9941,9941.0,'41');
+sql insert into tb4_1 values('2021-03-05 01:00:00.000', 9941,9941.0,'41');
+sql insert into tb4_2 values('2021-03-01 02:00:00.000', 9942,9942.0,'42');
+sql insert into tb4_2 values('2021-03-02 02:00:00.000', 9942,9942.0,'42');
+sql insert into tb4_2 values('2021-03-03 02:00:00.000', 9942,9942.0,'42');
+sql insert into tb4_2 values('2021-03-04 02:00:00.000', 9942,9942.0,'42');
+sql insert into tb4_2 values('2021-03-05 02:00:00.000', 9942,9942.0,'42');
+sql insert into tb4_3 values('2021-03-01 03:00:00.000', 9943,9943.0,'43');
+sql insert into tb4_3 values('2021-03-02 03:00:00.000', 9943,9943.0,'43');
+sql insert into tb4_3 values('2021-03-03 03:00:00.000', 9943,9943.0,'43');
+sql insert into tb4_3 values('2021-03-04 03:00:00.000', 9943,9943.0,'43');
+sql insert into tb4_3 values('2021-03-05 03:00:00.000', 9943,9943.0,'43');
+sql insert into tb4_4 values('2021-03-01 04:00:00.000', 9944,9944.0,'44');
+sql insert into tb4_4 values('2021-03-02 04:00:00.000', 9944,9944.0,'44');
+sql insert into tb4_4 values('2021-03-03 04:00:00.000', 9944,9944.0,'44');
+sql insert into tb4_4 values('2021-03-04 04:00:00.000', 9944,9944.0,'44');
+sql insert into tb4_4 values('2021-03-05 04:00:00.000', 9944,9944.0,'44');
+sql insert into tb4_5 values('2021-03-01 05:00:00.000', 9945,9945.0,'45');
+sql insert into tb4_5 values('2021-03-02 05:00:00.000', 9945,9945.0,'45');
+sql insert into tb4_5 values('2021-03-03 05:00:00.000', 9945,9945.0,'45');
+sql insert into tb4_5 values('2021-03-04 05:00:00.000', 9945,9945.0,'45');
+sql insert into tb4_5 values('2021-03-05 05:00:00.000', 9945,9945.0,'45');
+
+sql insert into tb5_1 values('2021-03-01 01:00:00.000', 9951,9951.0,'51');
+sql insert into tb5_1 values('2021-03-02 01:00:00.000', 9951,9951.0,'51');
+sql insert into tb5_1 values('2021-03-03 01:00:00.000', 9951,9951.0,'51');
+sql insert into tb5_1 values('2021-03-04 01:00:00.000', 9951,9951.0,'51');
+sql insert into tb5_1 values('2021-03-05 01:00:00.000', 9951,9951.0,'51');
+sql insert into tb5_2 values('2021-03-01 02:00:00.000', 9952,9952.0,'52');
+sql insert into tb5_2 values('2021-03-02 02:00:00.000', 9952,9952.0,'52');
+sql insert into tb5_2 values('2021-03-03 02:00:00.000', 9952,9952.0,'52');
+sql insert into tb5_2 values('2021-03-04 02:00:00.000', 9952,9952.0,'52');
+sql insert into tb5_2 values('2021-03-05 02:00:00.000', 9952,9952.0,'52');
+sql insert into tb5_3 values('2021-03-01 03:00:00.000', 9953,9953.0,'53');
+sql insert into tb5_3 values('2021-03-02 03:00:00.000', 9953,9953.0,'53');
+sql insert into tb5_3 values('2021-03-03 03:00:00.000', 9953,9953.0,'53');
+sql insert into tb5_3 values('2021-03-04 03:00:00.000', 9953,9953.0,'53');
+sql insert into tb5_3 values('2021-03-05 03:00:00.000', 9953,9953.0,'53');
+sql insert into tb5_4 values('2021-03-01 04:00:00.000', 9954,9954.0,'54');
+sql insert into tb5_4 values('2021-03-02 04:00:00.000', 9954,9954.0,'54');
+sql insert into tb5_4 values('2021-03-03 04:00:00.000', 9954,9954.0,'54');
+sql insert into tb5_4 values('2021-03-04 04:00:00.000', 9954,9954.0,'54');
+sql insert into tb5_4 values('2021-03-05 04:00:00.000', 9954,9954.0,'54');
+sql insert into tb5_5 values('2021-03-01 05:00:00.000', 9955,9955.0,'55');
+sql insert into tb5_5 values('2021-03-02 05:00:00.000', 9955,9955.0,'55');
+sql insert into tb5_5 values('2021-03-03 05:00:00.000', 9955,9955.0,'55');
+sql insert into tb5_5 values('2021-03-04 05:00:00.000', 9955,9955.0,'55');
+sql insert into tb5_5 values('2021-03-05 05:00:00.000', 9955,9955.0,'55');
+
+sql insert into tb6_1 values('2021-03-01 01:00:00.000', 9961,9961.0,'61');
+sql insert into tb6_1 values('2021-03-02 01:00:00.000', 9961,9961.0,'61');
+sql insert into tb6_1 values('2021-03-03 01:00:00.000', 9961,9961.0,'61');
+sql insert into tb6_1 values('2021-03-04 01:00:00.000', 9961,9961.0,'61');
+sql insert into tb6_1 values('2021-03-05 01:00:00.000', 9961,9961.0,'61');
+sql insert into tb6_2 values('2021-03-01 02:00:00.000', 9962,9962.0,'62');
+sql insert into tb6_2 values('2021-03-02 02:00:00.000', 9962,9962.0,'62');
+sql insert into tb6_2 values('2021-03-03 02:00:00.000', 9962,9962.0,'62');
+sql insert into tb6_2 values('2021-03-04 02:00:00.000', 9962,9962.0,'62');
+sql insert into tb6_2 values('2021-03-05 02:00:00.000', 9962,9962.0,'62');
+sql insert into tb6_3 values('2021-03-01 03:00:00.000', 9963,9963.0,'63');
+sql insert into tb6_3 values('2021-03-02 03:00:00.000', 9963,9963.0,'63');
+sql insert into tb6_3 values('2021-03-03 03:00:00.000', 9963,9963.0,'63');
+sql insert into tb6_3 values('2021-03-04 03:00:00.000', 9963,9963.0,'63');
+sql insert into tb6_3 values('2021-03-05 03:00:00.000', 9963,9963.0,'63');
+sql insert into tb6_4 values('2021-03-01 04:00:00.000', 9964,9964.0,'64');
+sql insert into tb6_4 values('2021-03-02 04:00:00.000', 9964,9964.0,'64');
+sql insert into tb6_4 values('2021-03-03 04:00:00.000', 9964,9964.0,'64');
+sql insert into tb6_4 values('2021-03-04 04:00:00.000', 9964,9964.0,'64');
+sql insert into tb6_4 values('2021-03-05 04:00:00.000', 9964,9964.0,'64');
+sql insert into tb6_5 values('2021-03-01 05:00:00.000', 9965,9965.0,'65');
+sql insert into tb6_5 values('2021-03-02 05:00:00.000', 9965,9965.0,'65');
+sql insert into tb6_5 values('2021-03-03 05:00:00.000', 9965,9965.0,'65');
+sql insert into tb6_5 values('2021-03-04 05:00:00.000', 9965,9965.0,'65');
+sql insert into tb6_5 values('2021-03-05 05:00:00.000', 9965,9965.0,'65');
+
+sql insert into tb7_1 values('2021-03-01 01:00:00.000', 9971,9971.0,'71');
+sql insert into tb7_1 values('2021-03-02 01:00:00.000', 9971,9971.0,'71');
+sql insert into tb7_1 values('2021-03-03 01:00:00.000', 9971,9971.0,'71');
+sql insert into tb7_1 values('2021-03-04 01:00:00.000', 9971,9971.0,'71');
+sql insert into tb7_1 values('2021-03-05 01:00:00.000', 9971,9971.0,'71');
+sql insert into tb7_2 values('2021-03-01 02:00:00.000', 9972,9972.0,'72');
+sql insert into tb7_2 values('2021-03-02 02:00:00.000', 9972,9972.0,'72');
+sql insert into tb7_2 values('2021-03-03 02:00:00.000', 9972,9972.0,'72');
+sql insert into tb7_2 values('2021-03-04 02:00:00.000', 9972,9972.0,'72');
+sql insert into tb7_2 values('2021-03-05 02:00:00.000', 9972,9972.0,'72');
+sql insert into tb7_3 values('2021-03-01 03:00:00.000', 9973,9973.0,'73');
+sql insert into tb7_3 values('2021-03-02 03:00:00.000', 9973,9973.0,'73');
+sql insert into tb7_3 values('2021-03-03 03:00:00.000', 9973,9973.0,'73');
+sql insert into tb7_3 values('2021-03-04 03:00:00.000', 9973,9973.0,'73');
+sql insert into tb7_3 values('2021-03-05 03:00:00.000', 9973,9973.0,'73');
+sql insert into tb7_4 values('2021-03-01 04:00:00.000', 9974,9974.0,'74');
+sql insert into tb7_4 values('2021-03-02 04:00:00.000', 9974,9974.0,'74');
+sql insert into tb7_4 values('2021-03-03 04:00:00.000', 9974,9974.0,'74');
+sql insert into tb7_4 values('2021-03-04 04:00:00.000', 9974,9974.0,'74');
+sql insert into tb7_4 values('2021-03-05 04:00:00.000', 9974,9974.0,'74');
+sql insert into tb7_5 values('2021-03-01 05:00:00.000', 9975,9975.0,'75');
+sql insert into tb7_5 values('2021-03-02 05:00:00.000', 9975,9975.0,'75');
+sql insert into tb7_5 values('2021-03-03 05:00:00.000', 9975,9975.0,'75');
+sql insert into tb7_5 values('2021-03-04 05:00:00.000', 9975,9975.0,'75');
+sql insert into tb7_5 values('2021-03-05 05:00:00.000', 9975,9975.0,'75');
+
+sql insert into tb8_1 values('2021-03-01 01:00:00.000', 9981,9981.0,'81');
+sql insert into tb8_1 values('2021-03-02 01:00:00.000', 9981,9981.0,'81');
+sql insert into tb8_1 values('2021-03-03 01:00:00.000', 9981,9981.0,'81');
+sql insert into tb8_1 values('2021-03-04 01:00:00.000', 9981,9981.0,'81');
+sql insert into tb8_1 values('2021-03-05 01:00:00.000', 9981,9981.0,'81');
+sql insert into tb8_2 values('2021-03-01 02:00:00.000', 9982,9982.0,'82');
+sql insert into tb8_2 values('2021-03-02 02:00:00.000', 9982,9982.0,'82');
+sql insert into tb8_2 values('2021-03-03 02:00:00.000', 9982,9982.0,'82');
+sql insert into tb8_2 values('2021-03-04 02:00:00.000', 9982,9982.0,'82');
+sql insert into tb8_2 values('2021-03-05 02:00:00.000', 9982,9982.0,'82');
+sql insert into tb8_3 values('2021-03-01 03:00:00.000', 9983,9983.0,'83');
+sql insert into tb8_3 values('2021-03-02 03:00:00.000', 9983,9983.0,'83');
+sql insert into tb8_3 values('2021-03-03 03:00:00.000', 9983,9983.0,'83');
+sql insert into tb8_3 values('2021-03-04 03:00:00.000', 9983,9983.0,'83');
+sql insert into tb8_3 values('2021-03-05 03:00:00.000', 9983,9983.0,'83');
+sql insert into tb8_4 values('2021-03-01 04:00:00.000', 9984,9984.0,'84');
+sql insert into tb8_4 values('2021-03-02 04:00:00.000', 9984,9984.0,'84');
+sql insert into tb8_4 values('2021-03-03 04:00:00.000', 9984,9984.0,'84');
+sql insert into tb8_4 values('2021-03-04 04:00:00.000', 9984,9984.0,'84');
+sql insert into tb8_4 values('2021-03-05 04:00:00.000', 9984,9984.0,'84');
+sql insert into tb8_5 values('2021-03-01 05:00:00.000', 9985,9985.0,'85');
+sql insert into tb8_5 values('2021-03-02 05:00:00.000', 9985,9985.0,'85');
+sql insert into tb8_5 values('2021-03-03 05:00:00.000', 9985,9985.0,'85');
+sql insert into tb8_5 values('2021-03-04 05:00:00.000', 9985,9985.0,'85');
+sql insert into tb8_5 values('2021-03-05 05:00:00.000', 9985,9985.0,'85');
+
+sql insert into tb9_1 values('2021-03-01 01:00:00.000', 9991,9991.0,'91');
+sql insert into tb9_1 values('2021-03-02 01:00:00.000', 9991,9991.0,'91');
+sql insert into tb9_1 values('2021-03-03 01:00:00.000', 9991,9991.0,'91');
+sql insert into tb9_1 values('2021-03-04 01:00:00.000', 9991,9991.0,'91');
+sql insert into tb9_1 values('2021-03-05 01:00:00.000', 9991,9991.0,'91');
+sql insert into tb9_2 values('2021-03-01 02:00:00.000', 9992,9992.0,'92');
+sql insert into tb9_2 values('2021-03-02 02:00:00.000', 9992,9992.0,'92');
+sql insert into tb9_2 values('2021-03-03 02:00:00.000', 9992,9992.0,'92');
+sql insert into tb9_2 values('2021-03-04 02:00:00.000', 9992,9992.0,'92');
+sql insert into tb9_2 values('2021-03-05 02:00:00.000', 9992,9992.0,'92');
+sql insert into tb9_3 values('2021-03-01 03:00:00.000', 9993,9993.0,'93');
+sql insert into tb9_3 values('2021-03-02 03:00:00.000', 9993,9993.0,'93');
+sql insert into tb9_3 values('2021-03-03 03:00:00.000', 9993,9993.0,'93');
+sql insert into tb9_3 values('2021-03-04 03:00:00.000', 9993,9993.0,'93');
+sql insert into tb9_3 values('2021-03-05 03:00:00.000', 9993,9993.0,'93');
+sql insert into tb9_4 values('2021-03-01 04:00:00.000', 9994,9994.0,'94');
+sql insert into tb9_4 values('2021-03-02 04:00:00.000', 9994,9994.0,'94');
+sql insert into tb9_4 values('2021-03-03 04:00:00.000', 9994,9994.0,'94');
+sql insert into tb9_4 values('2021-03-04 04:00:00.000', 9994,9994.0,'94');
+sql insert into tb9_4 values('2021-03-05 04:00:00.000', 9994,9994.0,'94');
+sql insert into tb9_5 values('2021-03-01 05:00:00.000', 9995,9995.0,'95');
+sql insert into tb9_5 values('2021-03-02 05:00:00.000', 9995,9995.0,'95');
+sql insert into tb9_5 values('2021-03-03 05:00:00.000', 9995,9995.0,'95');
+sql insert into tb9_5 values('2021-03-04 05:00:00.000', 9995,9995.0,'95');
+sql insert into tb9_5 values('2021-03-05 05:00:00.000', 9995,9995.0,'95');
+
+sql insert into tba_1 values('2021-03-01 01:00:00.000', 99101,99101.0,'a1');
+sql insert into tba_1 values('2021-03-02 01:00:00.000', 99101,99101.0,'a1');
+sql insert into tba_1 values('2021-03-03 01:00:00.000', 99101,99101.0,'a1');
+sql insert into tba_1 values('2021-03-04 01:00:00.000', 99101,99101.0,'a1');
+sql insert into tba_1 values('2021-03-05 01:00:00.000', 99101,99101.0,'a1');
+sql insert into tba_2 values('2021-03-01 02:00:00.000', 99102,99102.0,'a2');
+sql insert into tba_2 values('2021-03-02 02:00:00.000', 99102,99102.0,'a2');
+sql insert into tba_2 values('2021-03-03 02:00:00.000', 99102,99102.0,'a2');
+sql insert into tba_2 values('2021-03-04 02:00:00.000', 99102,99102.0,'a2');
+sql insert into tba_2 values('2021-03-05 02:00:00.000', 99102,99102.0,'a2');
+sql insert into tba_3 values('2021-03-01 03:00:00.000', 99103,99103.0,'a3');
+sql insert into tba_3 values('2021-03-02 03:00:00.000', 99103,99103.0,'a3');
+sql insert into tba_3 values('2021-03-03 03:00:00.000', 99103,99103.0,'a3');
+sql insert into tba_3 values('2021-03-04 03:00:00.000', 99103,99103.0,'a3');
+sql insert into tba_3 values('2021-03-05 03:00:00.000', 99103,99103.0,'a3');
+sql insert into tba_4 values('2021-03-01 04:00:00.000', 99104,99104.0,'a4');
+sql insert into tba_4 values('2021-03-02 04:00:00.000', 99104,99104.0,'a4');
+sql insert into tba_4 values('2021-03-03 04:00:00.000', 99104,99104.0,'a4');
+sql insert into tba_4 values('2021-03-04 04:00:00.000', 99104,99104.0,'a4');
+sql insert into tba_4 values('2021-03-05 04:00:00.000', 99104,99104.0,'a4');
+sql insert into tba_5 values('2021-03-01 05:00:00.000', 99105,99105.0,'a5');
+sql insert into tba_5 values('2021-03-02 05:00:00.000', 99105,99105.0,'a5');
+sql insert into tba_5 values('2021-03-03 05:00:00.000', 99105,99105.0,'a5');
+sql insert into tba_5 values('2021-03-04 05:00:00.000', 99105,99105.0,'a5');
+sql insert into tba_5 values('2021-03-05 05:00:00.000', 99105,99105.0,'a5');
+
+sql insert into tbb_1 values('2021-03-01 01:00:00.000', 99111,99111.0,'b1');
+sql insert into tbb_1 values('2021-03-02 01:00:00.000', 99111,99111.0,'b1');
+sql insert into tbb_1 values('2021-03-03 01:00:00.000', 99111,99111.0,'b1');
+sql insert into tbb_1 values('2021-03-04 01:00:00.000', 99111,99111.0,'b1');
+sql insert into tbb_1 values('2021-03-05 01:00:00.000', 99111,99111.0,'b1');
+sql insert into tbb_2 values('2021-03-01 02:00:00.000', 99112,99112.0,'b2');
+sql insert into tbb_2 values('2021-03-02 02:00:00.000', 99112,99112.0,'b2');
+sql insert into tbb_2 values('2021-03-03 02:00:00.000', 99112,99112.0,'b2');
+sql insert into tbb_2 values('2021-03-04 02:00:00.000', 99112,99112.0,'b2');
+sql insert into tbb_2 values('2021-03-05 02:00:00.000', 99112,99112.0,'b2');
+sql insert into tbb_3 values('2021-03-01 03:00:00.000', 99113,99113.0,'b3');
+sql insert into tbb_3 values('2021-03-02 03:00:00.000', 99113,99113.0,'b3');
+sql insert into tbb_3 values('2021-03-03 03:00:00.000', 99113,99113.0,'b3');
+sql insert into tbb_3 values('2021-03-04 03:00:00.000', 99113,99113.0,'b3');
+sql insert into tbb_3 values('2021-03-05 03:00:00.000', 99113,99113.0,'b3');
+sql insert into tbb_4 values('2021-03-01 04:00:00.000', 99114,99114.0,'b4');
+sql insert into tbb_4 values('2021-03-02 04:00:00.000', 99114,99114.0,'b4');
+sql insert into tbb_4 values('2021-03-03 04:00:00.000', 99114,99114.0,'b4');
+sql insert into tbb_4 values('2021-03-04 04:00:00.000', 99114,99114.0,'b4');
+sql insert into tbb_4 values('2021-03-05 04:00:00.000', 99114,99114.0,'b4');
+sql insert into tbb_5 values('2021-03-01 05:00:00.000', 99115,99115.0,'b5');
+sql insert into tbb_5 values('2021-03-02 05:00:00.000', 99115,99115.0,'b5');
+sql insert into tbb_5 values('2021-03-03 05:00:00.000', 99115,99115.0,'b5');
+sql insert into tbb_5 values('2021-03-04 05:00:00.000', 99115,99115.0,'b5');
+sql insert into tbb_5 values('2021-03-05 05:00:00.000', 99115,99115.0,'b5');
+
+
+sql select * from st0, st1 where st0.ts=st1.ts and st0.id1=st1.id1;
+
+if $rows != 25 then
+ return -1
+endi
+
+if $data00 != @21-03-01 01:00:00.000@ then
+ return -1
+endi
+if $data01 != 9901 then
+ return -1
+endi
+if $data02 != 9901.000000000 then
+ return -1
+endi
+if $data03 != 01 then
+ return -1
+endi
+if $data04 != 0 then
+ return -1
+endi
+if $data05 != 1 then
+ return -1
+endi
+if $data06 != 2.000000000 then
+ return -1
+endi
+if $data07 != 1 then
+ print $data07
+ return -1
+endi
+if $data08 != 3 then
+ return -1
+endi
+if $data09 != @21-03-01 01:00:00.000@ then
+ return -1
+endi
+
+if $data10 != @21-03-02 01:00:00.000@ then
+ return -1
+endi
+if $data11 != 9901 then
+ return -1
+endi
+if $data12 != 9901.000000000 then
+ return -1
+endi
+if $data13 != 01 then
+ return -1
+endi
+if $data14 != 0 then
+ return -1
+endi
+if $data15 != 1 then
+ return -1
+endi
+if $data16 != 2.000000000 then
+ return -1
+endi
+if $data17 != 1 then
+ return -1
+endi
+if $data18 != 3 then
+ return -1
+endi
+if $data19 != @21-03-02 01:00:00.000@ then
+ return -1
+endi
+
+
+
+if $data20 != @21-03-03 01:00:00.000@ then
+ return -1
+endi
+if $data21 != 9901 then
+ return -1
+endi
+if $data22 != 9901.000000000 then
+ return -1
+endi
+if $data23 != 01 then
+ return -1
+endi
+if $data24 != 0 then
+ return -1
+endi
+if $data25 != 1 then
+ return -1
+endi
+if $data26 != 2.000000000 then
+ return -1
+endi
+if $data27 != 1 then
+ return -1
+endi
+if $data28 != 3 then
+ return -1
+endi
+if $data29 != @21-03-03 01:00:00.000@ then
+ return -1
+endi
+
+
+if $data30 != @21-03-04 01:00:00.000@ then
+ return -1
+endi
+if $data31 != 9901 then
+ return -1
+endi
+if $data32 != 9901.000000000 then
+ return -1
+endi
+if $data33 != 01 then
+ return -1
+endi
+if $data34 != 0 then
+ return -1
+endi
+if $data35 != 1 then
+ return -1
+endi
+if $data36 != 2.000000000 then
+ return -1
+endi
+if $data37 != 1 then
+ return -1
+endi
+if $data38 != 3 then
+ return -1
+endi
+if $data39 != @21-03-04 01:00:00.000@ then
+ return -1
+endi
+
+
+
+
+sql select * from st0, st1 where st0.ts=st1.ts and st0.id2=st1.id2;
+
+if $rows != 25 then
+ return -1
+endi
+
+if $data00 != @21-03-01 01:00:00.000@ then
+ return -1
+endi
+if $data01 != 9901 then
+ return -1
+endi
+if $data02 != 9901.000000000 then
+ return -1
+endi
+if $data03 != 01 then
+ return -1
+endi
+if $data04 != 0 then
+ return -1
+endi
+if $data05 != 1 then
+ return -1
+endi
+if $data06 != 2.000000000 then
+ return -1
+endi
+if $data07 != 1 then
+ print $data07
+ return -1
+endi
+if $data08 != 3 then
+ return -1
+endi
+if $data09 != @21-03-01 01:00:00.000@ then
+ return -1
+endi
+
+if $data10 != @21-03-02 01:00:00.000@ then
+ return -1
+endi
+if $data11 != 9901 then
+ return -1
+endi
+if $data12 != 9901.000000000 then
+ return -1
+endi
+if $data13 != 01 then
+ return -1
+endi
+if $data14 != 0 then
+ return -1
+endi
+if $data15 != 1 then
+ return -1
+endi
+if $data16 != 2.000000000 then
+ return -1
+endi
+if $data17 != 1 then
+ return -1
+endi
+if $data18 != 3 then
+ return -1
+endi
+if $data19 != @21-03-02 01:00:00.000@ then
+ return -1
+endi
+
+
+
+if $data20 != @21-03-03 01:00:00.000@ then
+ return -1
+endi
+if $data21 != 9901 then
+ return -1
+endi
+if $data22 != 9901.000000000 then
+ return -1
+endi
+if $data23 != 01 then
+ return -1
+endi
+if $data24 != 0 then
+ return -1
+endi
+if $data25 != 1 then
+ return -1
+endi
+if $data26 != 2.000000000 then
+ return -1
+endi
+if $data27 != 1 then
+ return -1
+endi
+if $data28 != 3 then
+ return -1
+endi
+if $data29 != @21-03-03 01:00:00.000@ then
+ return -1
+endi
+
+
+if $data30 != @21-03-04 01:00:00.000@ then
+ return -1
+endi
+if $data31 != 9901 then
+ return -1
+endi
+if $data32 != 9901.000000000 then
+ return -1
+endi
+if $data33 != 01 then
+ return -1
+endi
+if $data34 != 0 then
+ return -1
+endi
+if $data35 != 1 then
+ return -1
+endi
+if $data36 != 2.000000000 then
+ return -1
+endi
+if $data37 != 1 then
+ return -1
+endi
+if $data38 != 3 then
+ return -1
+endi
+if $data39 != @21-03-04 01:00:00.000@ then
+ return -1
+endi
+
+
+
+
+sql select * from st0, st1 where st0.id3=st1.id3 and st1.ts=st0.ts;
+
+if $rows != 25 then
+ return -1
+endi
+
+if $data00 != @21-03-01 01:00:00.000@ then
+ return -1
+endi
+if $data01 != 9901 then
+ return -1
+endi
+if $data02 != 9901.000000000 then
+ return -1
+endi
+if $data03 != 01 then
+ return -1
+endi
+if $data04 != 0 then
+ return -1
+endi
+if $data05 != 1 then
+ return -1
+endi
+if $data06 != 2.000000000 then
+ return -1
+endi
+if $data07 != 1 then
+ print $data07
+ return -1
+endi
+if $data08 != 3 then
+ return -1
+endi
+if $data09 != @21-03-01 01:00:00.000@ then
+ return -1
+endi
+
+if $data10 != @21-03-02 01:00:00.000@ then
+ return -1
+endi
+if $data11 != 9901 then
+ return -1
+endi
+if $data12 != 9901.000000000 then
+ return -1
+endi
+if $data13 != 01 then
+ return -1
+endi
+if $data14 != 0 then
+ return -1
+endi
+if $data15 != 1 then
+ return -1
+endi
+if $data16 != 2.000000000 then
+ return -1
+endi
+if $data17 != 1 then
+ return -1
+endi
+if $data18 != 3 then
+ return -1
+endi
+if $data19 != @21-03-02 01:00:00.000@ then
+ return -1
+endi
+
+
+
+if $data20 != @21-03-03 01:00:00.000@ then
+ return -1
+endi
+if $data21 != 9901 then
+ return -1
+endi
+if $data22 != 9901.000000000 then
+ return -1
+endi
+if $data23 != 01 then
+ return -1
+endi
+if $data24 != 0 then
+ return -1
+endi
+if $data25 != 1 then
+ return -1
+endi
+if $data26 != 2.000000000 then
+ return -1
+endi
+if $data27 != 1 then
+ return -1
+endi
+if $data28 != 3 then
+ return -1
+endi
+if $data29 != @21-03-03 01:00:00.000@ then
+ return -1
+endi
+
+
+if $data30 != @21-03-04 01:00:00.000@ then
+ return -1
+endi
+if $data31 != 9901 then
+ return -1
+endi
+if $data32 != 9901.000000000 then
+ return -1
+endi
+if $data33 != 01 then
+ return -1
+endi
+if $data34 != 0 then
+ return -1
+endi
+if $data35 != 1 then
+ return -1
+endi
+if $data36 != 2.000000000 then
+ return -1
+endi
+if $data37 != 1 then
+ return -1
+endi
+if $data38 != 3 then
+ return -1
+endi
+if $data39 != @21-03-04 01:00:00.000@ then
+ return -1
+endi
+
+
+
+
+
+sql select * from st0, st1 where st1.id5=st0.id5 and st0.ts=st1.ts;
+
+if $rows != 25 then
+ return -1
+endi
+
+if $data00 != @21-03-01 01:00:00.000@ then
+ return -1
+endi
+if $data01 != 9901 then
+ return -1
+endi
+if $data02 != 9901.000000000 then
+ return -1
+endi
+if $data03 != 01 then
+ return -1
+endi
+if $data04 != 0 then
+ return -1
+endi
+if $data05 != 1 then
+ return -1
+endi
+if $data06 != 2.000000000 then
+ return -1
+endi
+if $data07 != 1 then
+ print $data07
+ return -1
+endi
+if $data08 != 3 then
+ return -1
+endi
+if $data09 != @21-03-01 01:00:00.000@ then
+ return -1
+endi
+
+if $data10 != @21-03-02 01:00:00.000@ then
+ return -1
+endi
+if $data11 != 9901 then
+ return -1
+endi
+if $data12 != 9901.000000000 then
+ return -1
+endi
+if $data13 != 01 then
+ return -1
+endi
+if $data14 != 0 then
+ return -1
+endi
+if $data15 != 1 then
+ return -1
+endi
+if $data16 != 2.000000000 then
+ return -1
+endi
+if $data17 != 1 then
+ return -1
+endi
+if $data18 != 3 then
+ return -1
+endi
+if $data19 != @21-03-02 01:00:00.000@ then
+ return -1
+endi
+
+
+
+if $data20 != @21-03-03 01:00:00.000@ then
+ return -1
+endi
+if $data21 != 9901 then
+ return -1
+endi
+if $data22 != 9901.000000000 then
+ return -1
+endi
+if $data23 != 01 then
+ return -1
+endi
+if $data24 != 0 then
+ return -1
+endi
+if $data25 != 1 then
+ return -1
+endi
+if $data26 != 2.000000000 then
+ return -1
+endi
+if $data27 != 1 then
+ return -1
+endi
+if $data28 != 3 then
+ return -1
+endi
+if $data29 != @21-03-03 01:00:00.000@ then
+ return -1
+endi
+
+
+if $data30 != @21-03-04 01:00:00.000@ then
+ return -1
+endi
+if $data31 != 9901 then
+ return -1
+endi
+if $data32 != 9901.000000000 then
+ return -1
+endi
+if $data33 != 01 then
+ return -1
+endi
+if $data34 != 0 then
+ return -1
+endi
+if $data35 != 1 then
+ return -1
+endi
+if $data36 != 2.000000000 then
+ return -1
+endi
+if $data37 != 1 then
+ return -1
+endi
+if $data38 != 3 then
+ return -1
+endi
+if $data39 != @21-03-04 01:00:00.000@ then
+ return -1
+endi
+
+
+
+
+sql select st0.* from st0, st1 where st0.ts=st1.ts and st0.id1=st1.id1;
+
+if $rows != 25 then
+ return -1
+endi
+
+if $data00 != @21-03-01 01:00:00.000@ then
+ return -1
+endi
+if $data01 != 9901 then
+ return -1
+endi
+if $data02 != 9901.000000000 then
+ return -1
+endi
+if $data03 != 01 then
+ return -1
+endi
+if $data04 != 0 then
+ return -1
+endi
+if $data05 != 1 then
+ return -1
+endi
+if $data06 != 2.000000000 then
+ return -1
+endi
+if $data07 != 1 then
+ print $data07
+ return -1
+endi
+if $data08 != 3 then
+ return -1
+endi
+
+if $data10 != @21-03-02 01:00:00.000@ then
+ return -1
+endi
+if $data11 != 9901 then
+ return -1
+endi
+if $data12 != 9901.000000000 then
+ return -1
+endi
+if $data13 != 01 then
+ return -1
+endi
+if $data14 != 0 then
+ return -1
+endi
+if $data15 != 1 then
+ return -1
+endi
+if $data16 != 2.000000000 then
+ return -1
+endi
+if $data17 != 1 then
+ return -1
+endi
+if $data18 != 3 then
+ return -1
+endi
+
+
+
+if $data20 != @21-03-03 01:00:00.000@ then
+ return -1
+endi
+if $data21 != 9901 then
+ return -1
+endi
+if $data22 != 9901.000000000 then
+ return -1
+endi
+if $data23 != 01 then
+ return -1
+endi
+if $data24 != 0 then
+ return -1
+endi
+if $data25 != 1 then
+ return -1
+endi
+if $data26 != 2.000000000 then
+ return -1
+endi
+if $data27 != 1 then
+ return -1
+endi
+if $data28 != 3 then
+ return -1
+endi
+
+
+if $data30 != @21-03-04 01:00:00.000@ then
+ return -1
+endi
+if $data31 != 9901 then
+ return -1
+endi
+if $data32 != 9901.000000000 then
+ return -1
+endi
+if $data33 != 01 then
+ return -1
+endi
+if $data34 != 0 then
+ return -1
+endi
+if $data35 != 1 then
+ return -1
+endi
+if $data36 != 2.000000000 then
+ return -1
+endi
+if $data37 != 1 then
+ return -1
+endi
+if $data38 != 3 then
+ return -1
+endi
+
+
+
+
+sql select st0.* from st0, st1 where st0.ts=st1.ts and st1.id2=st0.id2;
+
+if $rows != 25 then
+ return -1
+endi
+
+if $data00 != @21-03-01 01:00:00.000@ then
+ return -1
+endi
+if $data01 != 9901 then
+ return -1
+endi
+if $data02 != 9901.000000000 then
+ return -1
+endi
+if $data03 != 01 then
+ return -1
+endi
+if $data04 != 0 then
+ return -1
+endi
+if $data05 != 1 then
+ return -1
+endi
+if $data06 != 2.000000000 then
+ return -1
+endi
+if $data07 != 1 then
+ print $data07
+ return -1
+endi
+if $data08 != 3 then
+ return -1
+endi
+
+if $data10 != @21-03-02 01:00:00.000@ then
+ return -1
+endi
+if $data11 != 9901 then
+ return -1
+endi
+if $data12 != 9901.000000000 then
+ return -1
+endi
+if $data13 != 01 then
+ return -1
+endi
+if $data14 != 0 then
+ return -1
+endi
+if $data15 != 1 then
+ return -1
+endi
+if $data16 != 2.000000000 then
+ return -1
+endi
+if $data17 != 1 then
+ return -1
+endi
+if $data18 != 3 then
+ return -1
+endi
+
+
+
+if $data20 != @21-03-03 01:00:00.000@ then
+ return -1
+endi
+if $data21 != 9901 then
+ return -1
+endi
+if $data22 != 9901.000000000 then
+ return -1
+endi
+if $data23 != 01 then
+ return -1
+endi
+if $data24 != 0 then
+ return -1
+endi
+if $data25 != 1 then
+ return -1
+endi
+if $data26 != 2.000000000 then
+ return -1
+endi
+if $data27 != 1 then
+ return -1
+endi
+if $data28 != 3 then
+ return -1
+endi
+
+
+if $data30 != @21-03-04 01:00:00.000@ then
+ return -1
+endi
+if $data31 != 9901 then
+ return -1
+endi
+if $data32 != 9901.000000000 then
+ return -1
+endi
+if $data33 != 01 then
+ return -1
+endi
+if $data34 != 0 then
+ return -1
+endi
+if $data35 != 1 then
+ return -1
+endi
+if $data36 != 2.000000000 then
+ return -1
+endi
+if $data37 != 1 then
+ return -1
+endi
+if $data38 != 3 then
+ return -1
+endi
+
+
+
+
+
+sql select st0.* from st0, st1 where st0.id3=st1.id3 and st1.ts=st0.ts;
+
+if $rows != 25 then
+ return -1
+endi
+
+if $data00 != @21-03-01 01:00:00.000@ then
+ return -1
+endi
+if $data01 != 9901 then
+ return -1
+endi
+if $data02 != 9901.000000000 then
+ return -1
+endi
+if $data03 != 01 then
+ return -1
+endi
+if $data04 != 0 then
+ return -1
+endi
+if $data05 != 1 then
+ return -1
+endi
+if $data06 != 2.000000000 then
+ return -1
+endi
+if $data07 != 1 then
+ print $data07
+ return -1
+endi
+if $data08 != 3 then
+ return -1
+endi
+
+if $data10 != @21-03-02 01:00:00.000@ then
+ return -1
+endi
+if $data11 != 9901 then
+ return -1
+endi
+if $data12 != 9901.000000000 then
+ return -1
+endi
+if $data13 != 01 then
+ return -1
+endi
+if $data14 != 0 then
+ return -1
+endi
+if $data15 != 1 then
+ return -1
+endi
+if $data16 != 2.000000000 then
+ return -1
+endi
+if $data17 != 1 then
+ return -1
+endi
+if $data18 != 3 then
+ return -1
+endi
+
+
+
+if $data20 != @21-03-03 01:00:00.000@ then
+ return -1
+endi
+if $data21 != 9901 then
+ return -1
+endi
+if $data22 != 9901.000000000 then
+ return -1
+endi
+if $data23 != 01 then
+ return -1
+endi
+if $data24 != 0 then
+ return -1
+endi
+if $data25 != 1 then
+ return -1
+endi
+if $data26 != 2.000000000 then
+ return -1
+endi
+if $data27 != 1 then
+ return -1
+endi
+if $data28 != 3 then
+ return -1
+endi
+
+
+if $data30 != @21-03-04 01:00:00.000@ then
+ return -1
+endi
+if $data31 != 9901 then
+ return -1
+endi
+if $data32 != 9901.000000000 then
+ return -1
+endi
+if $data33 != 01 then
+ return -1
+endi
+if $data34 != 0 then
+ return -1
+endi
+if $data35 != 1 then
+ return -1
+endi
+if $data36 != 2.000000000 then
+ return -1
+endi
+if $data37 != 1 then
+ return -1
+endi
+if $data38 != 3 then
+ return -1
+endi
+
+
+
+
+sql select st1.* from st0, st1 where st1.id5=st0.id5 and st0.ts=st1.ts;
+
+if $rows != 25 then
+ return -1
+endi
+
+if $data00 != @21-03-01 01:00:00.000@ then
+ return -1
+endi
+if $data01 != 9911 then
+ return -1
+endi
+if $data02 != 9911.000000000 then
+ return -1
+endi
+if $data03 != 11 then
+ return -1
+endi
+if $data04 != 0 then
+ return -1
+endi
+if $data05 != 1 then
+ return -1
+endi
+if $data06 != 2.000000000 then
+ return -1
+endi
+if $data07 != 1 then
+ print $data07
+ return -1
+endi
+if $data08 != 3 then
+ return -1
+endi
+
+if $data10 != @21-03-02 01:00:00.000@ then
+ return -1
+endi
+if $data11 != 9911 then
+ return -1
+endi
+if $data12 != 9911.000000000 then
+ return -1
+endi
+if $data13 != 11 then
+ return -1
+endi
+if $data14 != 0 then
+ return -1
+endi
+if $data15 != 1 then
+ return -1
+endi
+if $data16 != 2.000000000 then
+ return -1
+endi
+if $data17 != 1 then
+ return -1
+endi
+if $data18 != 3 then
+ return -1
+endi
+
+
+
+if $data20 != @21-03-03 01:00:00.000@ then
+ return -1
+endi
+if $data21 != 9911 then
+ return -1
+endi
+if $data22 != 9911.000000000 then
+ return -1
+endi
+if $data23 != 11 then
+ return -1
+endi
+if $data24 != 0 then
+ return -1
+endi
+if $data25 != 1 then
+ return -1
+endi
+if $data26 != 2.000000000 then
+ return -1
+endi
+if $data27 != 1 then
+ return -1
+endi
+if $data28 != 3 then
+ return -1
+endi
+
+
+if $data30 != @21-03-04 01:00:00.000@ then
+ return -1
+endi
+if $data31 != 9911 then
+ return -1
+endi
+if $data32 != 9911.000000000 then
+ return -1
+endi
+if $data33 != 11 then
+ return -1
+endi
+if $data34 != 0 then
+ return -1
+endi
+if $data35 != 1 then
+ return -1
+endi
+if $data36 != 2.000000000 then
+ return -1
+endi
+if $data37 != 1 then
+ return -1
+endi
+if $data38 != 3 then
+ return -1
+endi
+
+
+sql select st0.f1,st1.f1 from st0, st1 where st0.ts=st1.ts and st0.id1=st1.id1;
+
+if $rows != 25 then
+ return -1
+endi
+
+if $data00 != 9901 then
+ return -1
+endi
+if $data01 != 9911 then
+ return -1
+endi
+if $data10 != 9901 then
+ return -1
+endi
+if $data11 != 9911 then
+ return -1
+endi
+if $data20 != 9901 then
+ return -1
+endi
+if $data21 != 9911 then
+ return -1
+endi
+if $data30 != 9901 then
+ return -1
+endi
+if $data31 != 9911 then
+ return -1
+endi
+
+
+
+
+sql select st0.ts,st1.ts from st0, st1 where st0.ts=st1.ts and st1.id2=st0.id2;
+
+
+if $rows != 25 then
+ return -1
+endi
+
+if $data00 != @21-03-01 01:00:00.000@ then
+ return -1
+endi
+if $data01 != @21-03-01 01:00:00.000@ then
+ return -1
+endi
+if $data10 != @21-03-02 01:00:00.000@ then
+ return -1
+endi
+if $data11 != @21-03-02 01:00:00.000@ then
+ return -1
+endi
+if $data20 != @21-03-03 01:00:00.000@ then
+ return -1
+endi
+if $data21 != @21-03-03 01:00:00.000@ then
+ return -1
+endi
+if $data30 != @21-03-04 01:00:00.000@ then
+ return -1
+endi
+if $data31 != @21-03-04 01:00:00.000@ then
+ return -1
+endi
+
+
+
+sql select st1.ts,st0.ts,st0.id3,st1.id3,st0.f3,st1.f3 from st0, st1 where st0.id3=st1.id3 and st1.ts=st0.ts;
+
+
+if $rows != 25 then
+ return -1
+endi
+
+if $data00 != @21-03-01 01:00:00.000@ then
+ return -1
+endi
+if $data01 != @21-03-01 01:00:00.000@ then
+ return -1
+endi
+if $data02 != 2.000000000 then
+ return -1
+endi
+if $data03 != 2.000000000 then
+ return -1
+endi
+if $data04 != 01 then
+ return -1
+endi
+if $data05 != 11 then
+ return -1
+endi
+
+if $data10 != @21-03-02 01:00:00.000@ then
+ return -1
+endi
+if $data11 != @21-03-02 01:00:00.000@ then
+ return -1
+endi
+if $data02 != 2.000000000 then
+ return -1
+endi
+if $data03 != 2.000000000 then
+ return -1
+endi
+if $data04 != 01 then
+ return -1
+endi
+if $data05 != 11 then
+ return -1
+endi
+
+
+
+sql select st0.ts,st0.f2,st1.f3,st1.f2,st0.f3 from st0, st1 where st1.id5=st0.id5 and st0.ts=st1.ts;
+if $rows != 25 then
+ return -1
+endi
+if $data00 != @21-03-01 01:00:00.000@ then
+ return -1
+endi
+if $data01 != 9901.000000000 then
+ return -1
+endi
+if $data02 != 11 then
+ return -1
+endi
+if $data03 != 9911.000000000 then
+ return -1
+endi
+if $data04 != 01 then
+ return -1
+endi
+if $data10 != @21-03-02 01:00:00.000@ then
+ return -1
+endi
+if $data11 != 9901.000000000 then
+ return -1
+endi
+if $data12 != 11 then
+ return -1
+endi
+if $data13 != 9911.000000000 then
+ return -1
+endi
+if $data14 != 01 then
+ return -1
+endi
+
+
+
+
+sql select last(*) from st0, st1 where st0.ts=st1.ts and st0.id1=st1.id1 interval(10a);
+if $rows != 25 then
+ return -1
+endi
+if $data00 != @21-03-01 01:00:00.000@ then
+ return -1
+endi
+if $data01 != @21-03-01 01:00:00.000@ then
+ return -1
+endi
+if $data02 != 9901 then
+ return -1
+endi
+if $data03 != 9901.000000000 then
+ return -1
+endi
+if $data04 != 01 then
+ return -1
+endi
+if $data05 != @21-03-01 01:00:00.000@ then
+ return -1
+endi
+if $data06 != 9911 then
+ return -1
+endi
+if $data07 != 9911.000000000 then
+ return -1
+endi
+if $data08 != 11 then
+ return -1
+endi
+if $data10 != @21-03-01 02:00:00.000@ then
+ return -1
+endi
+if $data11 != @21-03-01 02:00:00.000@ then
+ return -1
+endi
+if $data12 != 9902 then
+ return -1
+endi
+if $data13 != 9902.000000000 then
+ return -1
+endi
+if $data14 != 02 then
+ return -1
+endi
+if $data15 != @21-03-01 02:00:00.000@ then
+ return -1
+endi
+if $data16 != 9912 then
+ return -1
+endi
+if $data17 != 9912.000000000 then
+ return -1
+endi
+if $data18 != 12 then
+ return -1
+endi
+
+
+
+sql select last(*) from st0, st1 where st0.ts=st1.ts and st0.id1=st1.id1 interval(1d) sliding(1d);
+if $rows != 5 then
+ return -1
+endi
+if $data00 != @21-03-01 00:00:00.000@ then
+ return -1
+endi
+if $data01 != @21-03-01 05:00:00.000@ then
+ return -1
+endi
+if $data02 != 9905 then
+ return -1
+endi
+if $data03 != 9905.000000000 then
+ return -1
+endi
+if $data04 != 05 then
+ return -1
+endi
+if $data05 != @21-03-01 05:00:00.000@ then
+ return -1
+endi
+if $data06 != 9915 then
+ return -1
+endi
+if $data07 != 9915.000000000 then
+ return -1
+endi
+if $data08 != 15 then
+ return -1
+endi
+if $data10 != @21-03-02 00:00:00.000@ then
+ return -1
+endi
+if $data11 != @21-03-02 05:00:00.000@ then
+ return -1
+endi
+if $data12 != 9905 then
+ return -1
+endi
+if $data13 != 9905.000000000 then
+ return -1
+endi
+if $data14 != 05 then
+ return -1
+endi
+if $data15 != @21-03-02 05:00:00.000@ then
+ return -1
+endi
+if $data16 != 9915 then
+ return -1
+endi
+if $data17 != 9915.000000000 then
+ return -1
+endi
+if $data18 != 15 then
+ return -1
+endi
+
+
+
+sql select st0.*,st1.* from st0, st1 where st1.id1=st0.id1 and st0.ts=st1.ts and st1.ts=st0.ts and st0.id1=st1.id1;
+if $rows != 25 then
+ return -1
+endi
+if $data00 != @21-03-01 01:00:00.000@ then
+ return -1
+endi
+if $data01 != 9901 then
+ return -1
+endi
+if $data02 != 9901.000000000 then
+ return -1
+endi
+if $data03 != 01 then
+ return -1
+endi
+if $data04 != 0 then
+ return -1
+endi
+if $data05 != 1 then
+ return -1
+endi
+if $data06 != 2.000000000 then
+ return -1
+endi
+if $data07 != 1 then
+ return -1
+endi
+if $data08 != 3 then
+ return -1
+endi
+if $data09 != @21-03-01 01:00:00.000@ then
+ return -1
+endi
+
+
+
+
+
+sql select st0.ts,* from st0, st1 where st0.ts=st1.ts and st0.id1=st1.id1 order by st0.ts;
+
+if $rows != 25 then
+ return -1
+endi
+if $data00 != @21-03-01 01:00:00.000@ then
+ return -1
+endi
+if $data01 != @21-03-01 01:00:00.000@ then
+ return -1
+endi
+if $data02 != 9901 then
+ return -1
+endi
+if $data03 != 9901.000000000 then
+ return -1
+endi
+if $data04 != 01 then
+ return -1
+endi
+if $data05 != 0 then
+ return -1
+endi
+if $data06 != 1 then
+ return -1
+endi
+if $data07 != 2.000000000 then
+ return -1
+endi
+if $data08 != 1 then
+ return -1
+endi
+if $data09 != 3 then
+ return -1
+endi
+
+
+
+
+
+sql select st0.*,st1.* from st0, st1 where st1.id1=st0.id1 and st0.ts=st1.ts and st1.ts=st0.ts and st0.id1=st1.id1 order by st0.ts limit 5 offset 5
+if $rows != 5 then
+ return -1
+endi
+if $data00 != @21-03-01 01:00:00.000@ then
+ print $data00
+ return -1
+endi
+if $data01 != 9901 then
+ return -1
+endi
+if $data02 != 9901.000000000 then
+ return -1
+endi
+if $data03 != 01 then
+ return -1
+endi
+if $data04 != 0 then
+ return -1
+endi
+if $data05 != 1 then
+ return -1
+endi
+if $data06 != 2.000000000 then
+ return -1
+endi
+if $data07 != 1 then
+ return -1
+endi
+if $data08 != 3 then
+ return -1
+endi
+if $data09 != @21-03-01 01:00:00.000@ then
+ return -1
+endi
+
+
+
+sql select top(st1.f1, 5) from st0, st1 where st1.id1=st0.id1 and st0.ts=st1.ts and st1.ts=st0.ts and st0.id1=st1.id1;
+if $rows != 5 then
+ return -1
+endi
+if $data00 != @21-03-01 05:00:00.000@ then
+ return -1
+endi
+if $data01 != 9915 then
+ return -1
+endi
+if $data10 != @21-03-02 05:00:00.000@ then
+ return -1
+endi
+if $data11 != 9915 then
+ return -1
+endi
+if $data20 != @21-03-03 05:00:00.000@ then
+ return -1
+endi
+if $data21 != 9915 then
+ return -1
+endi
+if $data30 != @21-03-04 05:00:00.000@ then
+ return -1
+endi
+if $data31 != 9915 then
+ return -1
+endi
+if $data40 != @21-03-05 05:00:00.000@ then
+ return -1
+endi
+if $data41 != 9915 then
+ return -1
+endi
+
+
+
+
+
+sql select top(st0.f1,5) from st0, st1 where st1.id1=st0.id1 and st0.ts=st1.ts and st1.ts=st0.ts and st0.id1=st1.id1;
+if $rows != 5 then
+ return -1
+endi
+if $data00 != @21-03-01 05:00:00.000@ then
+ return -1
+endi
+if $data01 != 9905 then
+ return -1
+endi
+if $data10 != @21-03-02 05:00:00.000@ then
+ return -1
+endi
+if $data11 != 9905 then
+ return -1
+endi
+if $data20 != @21-03-03 05:00:00.000@ then
+ return -1
+endi
+if $data21 != 9905 then
+ return -1
+endi
+if $data30 != @21-03-04 05:00:00.000@ then
+ return -1
+endi
+if $data31 != 9905 then
+ return -1
+endi
+if $data40 != @21-03-05 05:00:00.000@ then
+ return -1
+endi
+if $data41 != 9905 then
+ return -1
+endi
+
+
+#sql select st0.*,st1.*,st2.*,st3.* from st3,st2,st1,st0 where st0.id1=st3.id1 and st3.ts=st2.ts and st2.id1=st1.id1 and st1.ts=st0.ts;
+#sql select st0.*,st1.*,st2.*,st3.* from st3,st2,st1,st0 where st0.id1=st3.id1 and st3.ts=st2.ts and st2.id1=st1.id1 and st1.ts=st0.ts and st0.id1=st2.id1 and st1.ts=st2.ts;
+#if $rows != 25 then
+# print $rows
+# return -1
+#endi
+#if $data00 != @21-03-01 01:00:00.000@ then
+# return -1
+#endi
+#if $data01 != 9901 then
+# return -1
+#endi
+#if $data02 != 9901.000000000 then
+# return -1
+#endi
+#if $data03 != 01 then
+# return -1
+#endi
+#if $data04 != 0 then
+# return -1
+#endi
+#if $data05 != 1 then
+# return -1
+#endi
+#if $data06 != 2.000000000 then
+# return -1
+#endi
+#if $data07 != 1 then
+# return -1
+#endi
+#if $data08 != 3 then
+# return -1
+#endi
+#if $data09 != @21-03-01 01:00:00.000@ then
+# return -1
+#endi
+
+
+
+#sql select st0.*,st1.*,st2.*,st3.* from st3,st2,st1,st0 where st0.id1=st1.id1 and st1.ts=st0.ts and st2.id1=st3.id1 and st3.ts=st2.ts;
+#sql select st0.*,st1.*,st2.*,st3.* from st3,st2,st1,st0 where st0.id1=st1.id1 and st1.ts=st0.ts and st2.id1=st3.id1 and st3.ts=st2.ts and st0.id1=st2.id1 and st0.ts=st2.ts;
+#if $rows != 25 then
+# return -1
+#endi
+#if $data00 != @21-03-01 01:00:00.000@ then
+# return -1
+#endi
+#if $data01 != 9901 then
+# return -1
+#endi
+#if $data02 != 9901.000000000 then
+# return -1
+#endi
+#if $data03 != 01 then
+# return -1
+#endi
+#if $data04 != 0 then
+# return -1
+#endi
+#if $data05 != 1 then
+# return -1
+#endi
+#if $data06 != 2.000000000 then
+# return -1
+#endi
+#if $data07 != 1 then
+# return -1
+#endi
+#if $data08 != 3 then
+# return -1
+#endi
+#if $data09 != @21-03-01 01:00:00.000@ then
+# return -1
+#endi
+
+
+
+sql select st0.*,st1.*,st2.*,st3.*,st4.*,st5.*,st6.*,st7.*,st8.*,st9.* from st0,st1,st2,st3,st4,st5,st6,st7,st8,st9 where st0.ts=st2.ts and st0.ts=st4.ts and st0.ts=st6.ts and st0.ts=st8.ts and st1.ts=st3.ts and st3.ts=st5.ts and st5.ts=st7.ts and st7.ts=st9.ts and st0.ts=st1.ts and st0.id1=st2.id1 and st0.id1=st4.id1 and st0.id1=st6.id1 and st0.id1=st8.id1 and st1.id1=st3.id1 and st3.id1=st5.id1 and st5.id1=st7.id1 and st7.id1=st9.id1 and st0.id1=st1.id1;
+if $rows != 25 then
+ return -1
+endi
+if $data00 != @21-03-01 01:00:00.000@ then
+ return -1
+endi
+if $data01 != 9901 then
+ return -1
+endi
+if $data02 != 9901.000000000 then
+ return -1
+endi
+if $data03 != 01 then
+ return -1
+endi
+if $data04 != 0 then
+ return -1
+endi
+if $data05 != 1 then
+ return -1
+endi
+if $data06 != 2.000000000 then
+ return -1
+endi
+if $data07 != 1 then
+ return -1
+endi
+if $data08 != 3 then
+ return -1
+endi
+if $data09 != @21-03-01 01:00:00.000@ then
+ return -1
+endi
+
+
+
+sql select tb0_1.*, tb1_1.* from tb0_1, tb1_1 where tb0_1.ts=tb1_1.ts;
+if $rows != 5 then
+ return -1
+endi
+if $data00 != @21-03-01 01:00:00.000@ then
+ return -1
+endi
+if $data01 != 9901 then
+ return -1
+endi
+if $data02 != 9901.000000000 then
+ return -1
+endi
+if $data03 != 01 then
+ return -1
+endi
+if $data04 != @21-03-01 01:00:00.000@ then
+ return -1
+endi
+if $data05 != 9911 then
+ return -1
+endi
+if $data06 != 9911.000000000 then
+ return -1
+endi
+if $data07 != 11 then
+ return -1
+endi
+if $data10 != @21-03-02 01:00:00.000@ then
+ return -1
+endi
+if $data11 != 9901 then
+ return -1
+endi
+if $data12 != 9901.000000000 then
+ return -1
+endi
+if $data13 != 01 then
+ return -1
+endi
+if $data14 != @21-03-02 01:00:00.000@ then
+ return -1
+endi
+if $data15 != 9911 then
+ return -1
+endi
+if $data16 != 9911.000000000 then
+ return -1
+endi
+if $data17 != 11 then
+ return -1
+endi
+
+
+
+sql select tb0_1.*, tb1_1.* from tb0_1, tb1_1 where tb0_1.ts=tb1_1.ts and tb0_1.id1=tb1_1.id1;
+if $rows != 5 then
+ return -1
+endi
+if $data00 != @21-03-01 01:00:00.000@ then
+ return -1
+endi
+if $data01 != 9901 then
+ return -1
+endi
+if $data02 != 9901.000000000 then
+ return -1
+endi
+if $data03 != 01 then
+ return -1
+endi
+if $data04 != @21-03-01 01:00:00.000@ then
+ return -1
+endi
+if $data05 != 9911 then
+ return -1
+endi
+if $data06 != 9911.000000000 then
+ return -1
+endi
+if $data07 != 11 then
+ return -1
+endi
+if $data10 != @21-03-02 01:00:00.000@ then
+ return -1
+endi
+if $data11 != 9901 then
+ return -1
+endi
+if $data12 != 9901.000000000 then
+ return -1
+endi
+if $data13 != 01 then
+ return -1
+endi
+if $data14 != @21-03-02 01:00:00.000@ then
+ return -1
+endi
+if $data15 != 9911 then
+ return -1
+endi
+if $data16 != 9911.000000000 then
+ return -1
+endi
+if $data17 != 11 then
+ return -1
+endi
+
+
+sql select tb0_1.*, tb1_2.*,tb2_3.*,tb3_4.*,tb4_5.* from tb0_1, tb1_2, tb2_3, tb3_4, tb4_5 where tb0_1.ts=tb1_2.ts and tb0_1.ts=tb2_3.ts and tb0_1.ts=tb3_4.ts and tb0_1.ts=tb4_5.ts;
+if $rows != 0 then
+ return -1
+endi
+
+
+
+sql select tb0_1.*, tb1_1.*,tb2_1.*,tb3_1.*,tb4_1.* from tb0_1, tb1_1, tb2_1, tb3_1, tb4_1 where tb0_1.ts=tb1_1.ts and tb0_1.ts=tb2_1.ts and tb0_1.ts=tb3_1.ts and tb0_1.ts=tb4_1.ts;
+
+if $rows != 5 then
+ return -1
+endi
+
+if $data00 != @21-03-01 01:00:00.000@ then
+ return -1
+endi
+if $data01 != 9901 then
+ return -1
+endi
+if $data02 != 9901.000000000 then
+ return -1
+endi
+if $data03 != 01 then
+ return -1
+endi
+if $data04 != @21-03-01 01:00:00.000@ then
+ return -1
+endi
+if $data05 != 9911 then
+ return -1
+endi
+if $data06 != 9911.000000000 then
+ return -1
+endi
+if $data07 != 11 then
+ return -1
+endi
+if $data08 != @21-03-01 01:00:00.000@ then
+ return -1
+endi
+if $data09 != 9921 then
+ return -1
+endi
+if $data10 != @21-03-02 01:00:00.000@ then
+ return -1
+endi
+if $data11 != 9901 then
+ return -1
+endi
+if $data12 != 9901.000000000 then
+ return -1
+endi
+if $data13 != 01 then
+ return -1
+endi
+if $data14 != @21-03-02 01:00:00.000@ then
+ return -1
+endi
+if $data15 != 9911 then
+ return -1
+endi
+if $data16 != 9911.000000000 then
+ return -1
+endi
+if $data17 != 11 then
+ return -1
+endi
+if $data18 != @21-03-02 01:00:00.000@ then
+ return -1
+endi
+if $data19 != 9921 then
+ return -1
+endi
+
+
+
+sql select tb0_5.*, tb1_5.*,tb2_5.*,tb3_5.*,tb4_5.*,tb5_5.*, tb6_5.*,tb7_5.*,tb8_5.*,tb9_5.* from tb0_5, tb1_5, tb2_5, tb3_5, tb4_5,tb5_5, tb6_5, tb7_5, tb8_5, tb9_5 where tb9_5.ts=tb8_5.ts and tb8_5.ts=tb7_5.ts and tb7_5.ts=tb6_5.ts and tb6_5.ts=tb5_5.ts and tb5_5.ts=tb4_5.ts and tb4_5.ts=tb3_5.ts and tb3_5.ts=tb2_5.ts and tb2_5.ts=tb1_5.ts and tb1_5.ts=tb0_5.ts;
+
+if $rows != 5 then
+ return -1
+endi
+
+if $data00 != @21-03-01 05:00:00.000@ then
+ return -1
+endi
+if $data01 != 9905 then
+ return -1
+endi
+if $data02 != 9905.000000000 then
+ return -1
+endi
+if $data03 != 05 then
+ return -1
+endi
+if $data04 != @21-03-01 05:00:00.000@ then
+ return -1
+endi
+if $data05 != 9915 then
+ return -1
+endi
+if $data06 != 9915.000000000 then
+ return -1
+endi
+if $data07 != 15 then
+ return -1
+endi
+if $data08 != @21-03-01 05:00:00.000@ then
+ return -1
+endi
+if $data09 != 9925 then
+ return -1
+endi
+if $data10 != @21-03-02 05:00:00.000@ then
+ return -1
+endi
+if $data11 != 9905 then
+ return -1
+endi
+if $data12 != 9905.000000000 then
+ return -1
+endi
+if $data13 != 05 then
+ return -1
+endi
+if $data14 != @21-03-02 05:00:00.000@ then
+ return -1
+endi
+if $data15 != 9915 then
+ return -1
+endi
+if $data16 != 9915.000000000 then
+ return -1
+endi
+if $data17 != 15 then
+ return -1
+endi
+if $data18 != @21-03-02 05:00:00.000@ then
+ return -1
+endi
+if $data19 != 9925 then
+ return -1
+endi
+
+
+sql_error select tb0_1.*, tb1_1.* from tb0_1, tb1_1 where tb0_1.f1=tb1_1.f1;
+sql_error select tb0_1.*, tb1_1.* from tb0_1, tb1_1 where tb0_1.ts=tb1_1.ts and tb0_1.id1=tb1_1.id2;
+sql_error select tb0_5.*, tb1_5.*,tb2_5.*,tb3_5.*,tb4_5.*,tb5_5.*, tb6_5.*,tb7_5.*,tb8_5.*,tb9_5.*,tba_5.* from tb0_5, tb1_5, tb2_5, tb3_5, tb4_5,tb5_5, tb6_5, tb7_5, tb8_5, tb9_5, tba_5 where tb9_5.ts=tb8_5.ts and tb8_5.ts=tb7_5.ts and tb7_5.ts=tb6_5.ts and tb6_5.ts=tb5_5.ts and tb5_5.ts=tb4_5.ts and tb4_5.ts=tb3_5.ts and tb3_5.ts=tb2_5.ts and tb2_5.ts=tb1_5.ts and tb1_5.ts=tb0_5.ts and tb0_5.ts=tba_5.ts;
+
+sql_error select * from st0, st1 where st0.ts=st1.ts;
+sql_error select * from st0, st1 where st0.id1=st1.id1;
+sql_error select * from st0, st1 where st0.f1=st1.f1 and st0.id1=st1.id1;
+sql_error select * from st0, st1, st2, st3 where st0.id1=st1.id1 and st2.id1=st3.id1 and st0.ts=st1.ts and st1.ts=st2.ts and st2.ts=st3.ts;
+sql_error select * from st0, st1, st2 where st0.id1=st1.id1;
+sql_error select * from st0, st1 where st0.id1=st1.id1 and st0.id2=st1.id3;
+sql_error select * from st0, st1 where st0.id1=st1.id1 or st0.ts=st1.ts;
+sql_error select * from st0, st1 where st0.ts=st1.ts and st0.id1=st1.id1 or st0.id2=st1.id2;
+sql_error select * from st0, st1, st2 where st0.ts=st1.ts and st0.id1=st1.id1;
+sql_error select * from st0, st1 where st0.id1=st1.ts and st0.ts=st1.id1;
+sql_error select * from st0, st1 where st0.id1=st1.id2 and st0.ts=st1.ts;
+sql_error select * from st0, st1 where st1.id4=st0.id4 and st1.ts=st0.ts;
+sql_error select * from st0, st1 where st0.id1=st1.id2 and st1.ts=st0.ts;
+sql_error select * from st0, st1 where st0.ts=st1.ts and st0.id1=st1.id1 interval 10a;
+sql_error select last(*) from st0, st1 where st0.ts=st1.ts and st0.id1=st1.id1 group by f1;
+sql_error select st0.*,st1.*,st2.*,st3.*,st4.*,st5.*,st6.*,st7.*,st8.*,st9.* from st0,st1,st2,st3,st4,st5,st6,st7,st8,st9 where st0.ts=st2.ts and st0.ts=st4.ts and st0.ts=st6.ts and st0.ts=st8.ts and st1.ts=st3.ts and st3.ts=st5.ts and st5.ts=st7.ts and st7.ts=st9.ts and st0.id1=st2.id1 and st0.id1=st4.id1 and st0.id1=st6.id1 and st0.id1=st8.id1 and st1.id1=st3.id1 and st3.id1=st5.id1 and st5.id1=st7.id1 and st7.id1=st9.id1;
+sql_error select st0.*,st1.*,st2.*,st3.*,st4.*,st5.*,st6.*,st7.*,st8.*,st9.* from st0,st1,st2,st3,st4,st5,st6,st7,st8,st9,sta where st0.ts=st2.ts and st0.ts=st4.ts and st0.ts=st6.ts and st0.ts=st8.ts and st1.ts=st3.ts and st3.ts=st5.ts and st5.ts=st7.ts and st7.ts=st9.ts and st0.ts=st1.ts and st0.id1=st2.id1 and st0.id1=st4.id1 and st0.id1=st6.id1 and st0.id1=st8.id1 and st1.id1=st3.id1 and st3.id1=st5.id1 and st5.id1=st7.id1 and st7.id1=st9.id1 and st0.id1=st1.id1 and st0.id1=sta.id1 and st0.ts=sta.ts;
+
+
+
+
+
+
+
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/test-all.sh b/tests/test-all.sh
index b5e23c1506..1f9c76daf4 100755
--- a/tests/test-all.sh
+++ b/tests/test-all.sh
@@ -29,7 +29,25 @@ function dohavecore(){
proc=`echo $corefile|cut -d "_" -f3`
if [ -n "$corefile" ];then
echo 'taosd or taos has generated core'
- tar -zcPf $corepath'taos_'`date "+%Y_%m_%d_%H_%M_%S"`.tar.gz /usr/local/taos/
+ if [[ "$tests_dir" == *"$IN_TDINTERNAL"* ]] && [[ $1 == 1 ]]; then
+ cd ../../../
+ tar -zcPf $corepath'taos_'`date "+%Y_%m_%d_%H_%M_%S"`.tar.gz debug/build/bin/taosd debug/build/bin/tsim debug/build/lib/libtaos*so*
+ if [[ $2 == 1 ]];then
+ cp -r sim ~/sim_`date "+%Y_%m_%d_%H:%M:%S"`
+ rm -rf sim/case.log
+ else
+ cd community
+ cp -r sim ~/sim_`date "+%Y_%m_%d_%H:%M:%S" `
+ rm -rf sim/case.log
+ fi
+ else
+ cd ../../
+ if [[ $1 == 1 ]];then
+ tar -zcPf $corepath'taos_'`date "+%Y_%m_%d_%H_%M_%S"`.tar.gz debug/build/bin/taosd debug/build/bin/tsim debug/build/lib/libtaos*so*
+ cp -r sim ~/sim_`date "+%Y_%m_%d_%H:%M:%S" `
+ rm -rf sim/case.log
+ fi
+ fi
if [[ $1 == 1 ]];then
echo '\n'|gdb /usr/local/taos/bin/$proc $core_file -ex "bt 10" -ex quit
exit 8
@@ -100,11 +118,14 @@ function runSimCaseOneByOnefq {
cp -r ../../sim ~/sim_`date "+%Y_%m_%d_%H:%M:%S" `
rm -rf ../../sim/case.log
fi
- exit 8
+ dohavecore $2 1
+ if [[ $2 == 1 ]];then
+ exit 8
+ fi
fi
end_time=`date +%s`
echo execution time of $case was `expr $end_time - $start_time`s. | tee -a out.log
- dohavecore $2
+ dohavecore $2 1
fi
done
rm -rf ../../../sim/case.log
@@ -169,16 +190,19 @@ function runPyCaseOneByOnefq() {
out_log=`tail -1 pytest-out.log `
if [[ $out_log =~ 'failed' ]];then
cp -r ../../sim ~/sim_`date "+%Y_%m_%d_%H:%M:%S" `
- echo '=====================log====================='
+ echo '=====================log===================== '
cat ../../sim/case.log
rm -rf ../../sim/case.log
- exit 8
+ dohavecore $2 2
+ if [[ $2 == 1 ]];then
+ exit 8
+ fi
fi
echo execution time of $case was `expr $end_time - $start_time`s. | tee -a pytest-out.log
else
$line > /dev/null 2>&1
fi
- dohavecore $2
+ dohavecore $2 2
fi
done
rm -rf ../../sim/case.log
@@ -188,9 +212,10 @@ totalFailed=0
totalPyFailed=0
totalJDBCFailed=0
totalUnitFailed=0
+totalExampleFailed=0
corepath=`grep -oP '.*(?=core_)' /proc/sys/kernel/core_pattern||grep -oP '.*(?=core-)' /proc/sys/kernel/core_pattern`
-if [ "$2" != "jdbc" ] && [ "$2" != "python" ] && [ "$2" != "unit" ]; then
+if [ "$2" != "jdbc" ] && [ "$2" != "python" ] && [ "$2" != "unit" ] && [ "$2" != "example" ]; then
echo "### run TSIM test case ###"
cd $tests_dir/script
@@ -205,15 +230,15 @@ if [ "$2" != "jdbc" ] && [ "$2" != "python" ] && [ "$2" != "unit" ]; then
echo "### run TSIM b1 test ###"
runSimCaseOneByOnefq b1 0
runSimCaseOneByOnefq b4 0
- runSimCaseOneByOnefq b5 0
- runSimCaseOneByOnefq b6 0
runSimCaseOneByOnefq b7 0
elif [ "$1" == "b2" ]; then
echo "### run TSIM b2 test ###"
runSimCaseOneByOnefq b2 0
+ runSimCaseOneByOnefq b5 0
elif [ "$1" == "b3" ]; then
echo "### run TSIM b3 test ###"
runSimCaseOneByOnefq b3 0
+ runSimCaseOneByOnefq b6 0
elif [ "$1" == "b1fq" ]; then
echo "### run TSIM b1 test ###"
runSimCaseOneByOnefq b1 1
@@ -259,7 +284,7 @@ if [ "$2" != "jdbc" ] && [ "$2" != "python" ] && [ "$2" != "unit" ]; then
fi
fi
-if [ "$2" != "sim" ] && [ "$2" != "jdbc" ] && [ "$2" != "unit" ]; then
+if [ "$2" != "sim" ] && [ "$2" != "jdbc" ] && [ "$2" != "unit" ] && [ "$2" != "example" ]; then
echo "### run Python test case ###"
cd $tests_dir
@@ -328,7 +353,7 @@ if [ "$2" != "sim" ] && [ "$2" != "jdbc" ] && [ "$2" != "unit" ]; then
fi
-if [ "$2" != "sim" ] && [ "$2" != "python" ] && [ "$2" != "unit" ] && [ "$1" == "full" ]; then
+if [ "$2" != "sim" ] && [ "$2" != "python" ] && [ "$2" != "unit" ] && [ "$2" != "example" ] && [ "$1" == "full" ]; then
echo "### run JDBC test cases ###"
cd $tests_dir
@@ -372,7 +397,7 @@ if [ "$2" != "sim" ] && [ "$2" != "python" ] && [ "$2" != "unit" ] && [ "$1" ==
dohavecore 1
fi
-if [ "$2" != "sim" ] && [ "$2" != "python" ] && [ "$2" != "jdbc" ] && [ "$1" == "full" ]; then
+if [ "$2" != "sim" ] && [ "$2" != "python" ] && [ "$2" != "jdbc" ] && [ "$2" != "example" ] && [ "$1" == "full" ]; then
echo "### run Unit tests ###"
stopTaosd
@@ -408,5 +433,80 @@ if [ "$2" != "sim" ] && [ "$2" != "python" ] && [ "$2" != "jdbc" ] && [ "$1" ==
dohavecore 1
fi
+if [ "$2" != "sim" ] && [ "$2" != "python" ] && [ "$2" != "jdbc" ] && [ "$2" != "unit" ] && [ "$1" == "full" ]; then
+ echo "### run Example tests ###"
-exit $(($totalFailed + $totalPyFailed + $totalJDBCFailed + $totalUnitFailed))
+ stopTaosd
+ cd $tests_dir
+
+ if [[ "$tests_dir" == *"$IN_TDINTERNAL"* ]]; then
+ cd ../../
+ else
+ cd ../
+ fi
+
+ pwd
+ cd debug/build/bin
+ rm -rf /var/lib/taos/*
+ nohup ./taosd -c /etc/taos/ > /dev/null 2>&1 &
+ echo "sleeping for 30 seconds"
+ #sleep 30
+
+ cd $tests_dir
+ echo "current dir: "
+ pwd
+ cd examples/c
+ echo "building applications"
+ make > /dev/null
+ totalExamplePass=0
+
+ echo "Running tests"
+ ./apitest > /dev/null 2>&1
+ if [ $? != "0" ]; then
+ echo "prepare failed"
+ totalExampleFailed=`expr $totalExampleFailed + 1`
+ else
+ echo "prepare pass"
+ totalExamplePass=`expr $totalExamplePass + 1`
+ fi
+
+ ./prepare 127.0.0.1 > /dev/null 2>&1
+ if [ $? != "0" ]; then
+ echo "prepare failed"
+ totalExampleFailed=`expr $totalExampleFailed + 1`
+ else
+ echo "prepare pass"
+ totalExamplePass=`expr $totalExamplePass + 1`
+ fi
+
+ ./subscribe -test > /dev/null 2>&1
+ if [ $? != "0" ]; then
+ echo "prepare failed"
+ totalExampleFailed=`expr $totalExampleFailed + 1`
+ else
+ echo "prepare pass"
+ totalExamplePass=`expr $totalExamplePass + 1`
+ fi
+
+ yes |./asyncdemo 127.0.0.1 test 1000 10 > /dev/null 2>&1
+ if [ $? != "0" ]; then
+ echo "prepare failed"
+ totalExampleFailed=`expr $totalExampleFailed + 1`
+ else
+ echo "prepare pass"
+ totalExamplePass=`expr $totalExamplePass + 1`
+ fi
+
+ if [ "$totalExamplePass" -gt "0" ]; then
+ echo -e "\n${GREEN} ### Total $totalExamplePass examples succeed! ### ${NC}"
+ fi
+
+ if [ "$totalExampleFailed" -ne "0" ]; then
+ echo -e "\n${RED} ### Total $totalExampleFailed examples failed! ### ${NC}"
+ fi
+
+ dohavecore 1
+fi
+
+
+exit $(($totalFailed + $totalPyFailed + $totalJDBCFailed + $totalUnitFailed + $totalExampleFailed))